CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
FWCaloDataHistProxyBuilder Class Referenceabstract

#include <FWCaloDataHistProxyBuilder.h>

Inheritance diagram for FWCaloDataHistProxyBuilder:
FWCaloDataProxyBuilderBase FWProxyBuilderBase FWCaloTowerProxyBuilderBase FWCandidateTowerProxyBuilder FWHGCalMultiClusterLegoProxyBuilder FWPFCandidateTowerProxyBuilder FWECalCaloTowerProxyBuilder FWHCalCaloTowerProxyBuilder FWHOCaloTowerProxyBuilder FWECalPFCandidateProxyBuilder FWHCalPFCandidateProxyBuilder

Public Member Functions

 FWCaloDataHistProxyBuilder ()
 
 ~FWCaloDataHistProxyBuilder () override
 
- Public Member Functions inherited from FWCaloDataProxyBuilderBase
 FWCaloDataProxyBuilderBase ()
 
bool willHandleInteraction () const override
 
 ~FWCaloDataProxyBuilderBase () override
 
- Public Member Functions inherited from FWProxyBuilderBase
void build ()
 
virtual bool canHandle (const FWEventItem &)
 
const fireworks::Contextcontext () const
 
TEveElementList * createProduct (FWViewType::EType, const FWViewContext *)
 
 FWProxyBuilderBase ()
 
bool getHaveWindow () const
 
virtual bool havePerViewProduct (FWViewType::EType) const
 
virtual bool haveSingleProduct () const
 
const FWEventItemitem () const
 
void itemChanged (const FWEventItem *)
 
int layer () const
 
void modelChanges (const FWModelIds &)
 
void removePerViewProduct (FWViewType::EType, const FWViewContext *vc)
 
void scaleChanged (const FWViewContext *)
 
void setHaveWindow (bool iFlag)
 
virtual void setInteractionList (FWInteractionList *, const std::string &)
 
virtual void setItem (const FWEventItem *iItem)
 
void setupAddElement (TEveElement *el, TEveElement *parent, bool set_color=true) const
 
void setupElement (TEveElement *el, bool color=true) const
 
virtual ~FWProxyBuilderBase ()
 

Protected Member Functions

void addEntryToTEveCaloData (float eta, float phi, float Et, bool isSelected)
 
bool assertCaloDataSlice () override
 
virtual FWHistSliceSelectorinstantiateSliceSelector ()=0
 
void itemBeingDestroyed (const FWEventItem *) override
 
void setCaloData (const fireworks::Context &) override
 
- Protected Member Functions inherited from FWCaloDataProxyBuilderBase
void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
virtual void fillCaloData ()=0
 
void itemBeingDestroyed (const FWEventItem *) override
 
- Protected Member Functions inherited from FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
virtual void cleanLocal ()
 
TEveCompound * createCompound (bool set_color=true, bool propagate_color_to_all_children=false) const
 
 FWProxyBuilderBase (const FWProxyBuilderBase &)
 
void increaseComponentTransparency (unsigned int index, TEveElement *holder, const std::string &name, Char_t transpOffset)
 
virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 

Protected Attributes

TH2F * m_hist
 
FWHistSliceSelectorm_sliceSelector
 
- Protected Attributes inherited from FWCaloDataProxyBuilderBase
TEveCaloData * m_caloData
 
Int_t m_sliceIndex
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Additional Inherited Members

- Static Public Member Functions inherited from FWProxyBuilderBase
static bool representsSubPart ()
 
static std::string typeOfBuilder ()
 Used by the plugin system to determine how the proxy uses the data from FWEventItem. More...
 
- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 

Detailed Description

Definition at line 10 of file FWCaloDataHistProxyBuilder.h.

Constructor & Destructor Documentation

◆ FWCaloDataHistProxyBuilder()

FWCaloDataHistProxyBuilder::FWCaloDataHistProxyBuilder ( )

Definition at line 14 of file FWCaloDataHistProxyBuilder.cc.

14 : m_hist(nullptr), m_sliceSelector(nullptr) {}

◆ ~FWCaloDataHistProxyBuilder()

FWCaloDataHistProxyBuilder::~FWCaloDataHistProxyBuilder ( )
override

Definition at line 15 of file FWCaloDataHistProxyBuilder.cc.

15 {}

Member Function Documentation

◆ addEntryToTEveCaloData()

void FWCaloDataHistProxyBuilder::addEntryToTEveCaloData ( float  eta,
float  phi,
float  Et,
bool  isSelected 
)
protected

Definition at line 76 of file FWCaloDataHistProxyBuilder.cc.

76  {
77  using namespace TMath;
78  static float d = 2.5 * Pi() / 180;
79  // printf("comapre %f, %f \n", fw3dlego::xbins[80], fw3dlego::xbins[61] );
80 
82  if (Abs(eta) > fw3dlego::xbins[80]) {
83  m_hist->Fill(eta, wrapPi(phi - 3 * d), Et * 0.25);
84  m_hist->Fill(eta, wrapPi(phi - d), Et * 0.25);
85  m_hist->Fill(eta, wrapPi(phi + d), Et * 0.25);
86  m_hist->Fill(eta, wrapPi(phi + 3 * d), Et * 0.25);
87  } else if (Abs(eta) > fw3dlego::xbins[61]) {
88  m_hist->Fill(eta, wrapPi(phi - d), Et * 0.5);
89  m_hist->Fill(eta, wrapPi(phi + d), Et * 0.5);
90  } else {
91  m_hist->Fill(eta, phi, Et);
92  }
93  } else {
94  m_hist->Fill(eta, phi, Et);
95  }
96 
97  TEveCaloData::vCellId_t& selected = m_caloData->GetCellsSelected();
98  if (isSelected) {
99  //NOTE: I tried calling TEveCalo::GetCellList but it always returned 0, probably because of threshold issues
100  // but looking at the TEveCaloHist::GetCellList code the CellId_t is just the histograms bin # and the slice
101  // printf("applyChangesToAllModels ...check selected \n");
102 
104  if (Abs(eta) > fw3dlego::xbins[80]) {
105  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi - 3 * d)), m_sliceIndex));
106  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi - d)), m_sliceIndex));
107  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi + d)), m_sliceIndex));
108  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi + 3 * d)), m_sliceIndex));
109  }
110  if (Abs(eta) > fw3dlego::xbins[60]) {
111  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi - d)), m_sliceIndex));
112  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, wrapPi(phi + d)), m_sliceIndex));
113  } else {
114  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, phi), m_sliceIndex));
115  }
116  } else {
117  selected.push_back(TEveCaloData::CellId_t(m_hist->FindBin(eta, phi), m_sliceIndex));
118  }
119  }
120 }

References Abs(), FWHistSliceSelector::aggregatePhiCells(), ztail::d, PVValHelper::eta, FWCaloDataProxyBuilderBase::m_caloData, m_hist, FWCaloDataProxyBuilderBase::m_sliceIndex, m_sliceSelector, phi, Pi, and fw3dlego::xbins.

Referenced by FWHGCalMultiClusterLegoProxyBuilder::fillCaloData(), FWCandidateTowerProxyBuilder::fillCaloData(), FWPFCandidateTowerProxyBuilder::fillCaloData(), and FWCaloTowerProxyBuilderBase::fillCaloData().

◆ assertCaloDataSlice()

bool FWCaloDataHistProxyBuilder::assertCaloDataSlice ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 40 of file FWCaloDataHistProxyBuilder.cc.

40  {
41  if (m_hist == nullptr) {
42  // add new slice
43  Bool_t status = TH1::AddDirectoryStatus();
44  TH1::AddDirectory(kFALSE); //Keeps histogram from going into memory
45  m_hist = new TH2F("caloHist", "caloHist", fw3dlego::xbins_n - 1, fw3dlego::xbins, 72, -M_PI, M_PI);
46  TH1::AddDirectory(status);
47  TEveCaloDataHist* ch = static_cast<TEveCaloDataHist*>(m_caloData);
48  m_sliceIndex = ch->AddHistogram(m_hist);
49 
50  m_caloData->RefSliceInfo(m_sliceIndex)
51  .Setup(item()->name().c_str(),
52  0.,
53  item()->defaultDisplayProperties().color(),
54  item()->defaultDisplayProperties().transparency());
55 
56  // add new selector
58  if (m_caloData->GetUserData()) {
59  FWFromEveSelectorBase* base = reinterpret_cast<FWFromEveSelectorBase*>(m_caloData->GetUserData());
60  assert(nullptr != base);
61  sel = dynamic_cast<FWFromTEveCaloDataSelector*>(base);
62  assert(nullptr != sel);
63  } else {
65  //make sure it is accessible via the base class
66  m_caloData->SetUserData(static_cast<FWFromEveSelectorBase*>(sel));
67  }
69  sel->addSliceSelector(m_sliceIndex, m_sliceSelector);
70 
71  return true;
72  }
73  return false;
74 }

References cms::cuda::assert(), newFWLiteAna::base, instantiateSliceSelector(), FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, m_hist, M_PI, FWCaloDataProxyBuilderBase::m_sliceIndex, m_sliceSelector, Skims_PA_cff::name, EgammaValidation_Wenu_cff::sel, mps_update::status, fw3dlego::xbins, and fw3dlego::xbins_n.

◆ instantiateSliceSelector()

virtual FWHistSliceSelector* FWCaloDataHistProxyBuilder::instantiateSliceSelector ( )
protectedpure virtual

◆ itemBeingDestroyed()

void FWCaloDataHistProxyBuilder::itemBeingDestroyed ( const FWEventItem iItem)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 33 of file FWCaloDataHistProxyBuilder.cc.

33  {
34  if (nullptr != m_hist) {
35  m_hist->Reset();
36  }
38 }

References FWCaloDataProxyBuilderBase::itemBeingDestroyed(), and m_hist.

◆ setCaloData()

void FWCaloDataHistProxyBuilder::setCaloData ( const fireworks::Context )
overrideprotectedvirtual

Member Data Documentation

◆ m_hist

TH2F* FWCaloDataHistProxyBuilder::m_hist
protected

◆ m_sliceSelector

FWHistSliceSelector* FWCaloDataHistProxyBuilder::m_sliceSelector
protected

Definition at line 23 of file FWCaloDataHistProxyBuilder.h.

Referenced by addEntryToTEveCaloData(), and assertCaloDataSlice().

fw3dlego::xbins
const double xbins[]
Definition: fw3dlego_xbins.cc:16
FWCaloDataHistProxyBuilder::instantiateSliceSelector
virtual FWHistSliceSelector * instantiateSliceSelector()=0
mps_update.status
status
Definition: mps_update.py:69
FWCaloDataProxyBuilderBase::itemBeingDestroyed
void itemBeingDestroyed(const FWEventItem *) override
Definition: FWCaloDataProxyBuilderBase.cc:106
cms::cuda::assert
assert(be >=bs)
fw3dlego::xbins_n
const int xbins_n
Definition: fw3dlego_xbins.cc:15
FWCaloDataProxyBuilderBase::m_sliceIndex
Int_t m_sliceIndex
Definition: FWCaloDataProxyBuilderBase.h:56
Abs
T Abs(T a)
Definition: MathUtil.h:49
PVValHelper::eta
Definition: PVValidationHelpers.h:70
FWCaloDataProxyBuilderBase::m_caloData
TEveCaloData * m_caloData
Definition: FWCaloDataProxyBuilderBase.h:55
FWCaloDataHistProxyBuilder::m_hist
TH2F * m_hist
Definition: FWCaloDataHistProxyBuilder.h:22
FWHistSliceSelector::aggregatePhiCells
virtual bool aggregatePhiCells() const
Definition: FWHistSliceSelector.h:15
FWFromTEveCaloDataSelector
Definition: FWFromTEveCaloDataSelector.h:34
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
FWFromEveSelectorBase
Definition: FWFromEveSelectorBase.h:27
DDAxes::phi
FWCaloDataHistProxyBuilder::m_sliceSelector
FWHistSliceSelector * m_sliceSelector
Definition: FWCaloDataHistProxyBuilder.h:23
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
fireworks::Context::getCaloData
TEveCaloDataHist * getCaloData() const
Definition: Context.h:69
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
ztail.d
d
Definition: ztail.py:151
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92