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 ()
 
 FWCaloDataProxyBuilderBase (const FWCaloDataProxyBuilderBase &)=delete
 
const FWCaloDataProxyBuilderBaseoperator= (const FWCaloDataProxyBuilderBase &)=delete
 
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.

◆ ~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.

References FWHistSliceSelector::aggregatePhiCells(), ztail::d, PVValHelper::eta, isSelected(), 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().

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 }
const double Pi
const double xbins[]
virtual bool aggregatePhiCells() const
d
Definition: ztail.py:151
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)

◆ assertCaloDataSlice()

bool FWCaloDataHistProxyBuilder::assertCaloDataSlice ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 40 of file FWCaloDataHistProxyBuilder.cc.

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.

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 }
const double xbins[]
base
Main Program
Definition: newFWLiteAna.py:92
assert(be >=bs)
virtual FWHistSliceSelector * instantiateSliceSelector()=0
#define M_PI
const int xbins_n
const FWEventItem * item() const

◆ 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.

References FWCaloDataProxyBuilderBase::itemBeingDestroyed(), and m_hist.

33  {
34  if (nullptr != m_hist) {
35  m_hist->Reset();
36  }
38 }
void itemBeingDestroyed(const FWEventItem *) override

◆ 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().