CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
FWHGTowerProxyBuilderBase Class Reference

#include <FWHGTowerProxyBuilder.h>

Inheritance diagram for FWHGTowerProxyBuilderBase:
FWCaloDataProxyBuilderBase FWProxyBuilderBase

Public Member Functions

 FWHGTowerProxyBuilderBase ()
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWHGTowerProxyBuilderBase () 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 ()
 

Static Public Member Functions

static const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
- 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 Member Functions

bool assertCaloDataSlice () override
 
void fillCaloData () override
 
void itemBeingDestroyed (const FWEventItem *) override
 
void setCaloData (const fireworks::Context &) 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 *)
 

Private Member Functions

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
int fillTowerForDetId (unsigned int rawid, float)
 
 FWHGTowerProxyBuilderBase (const FWHGTowerProxyBuilderBase &)=delete
 
const FWHGTowerProxyBuilderBaseoperator= (const FWHGTowerProxyBuilderBase &)=delete
 

Private Attributes

const HGCRecHitCollectionm_hits
 
TEveCaloDataVec * m_vecData
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Attributes inherited from FWCaloDataProxyBuilderBase
TEveCaloData * m_caloData
 
Int_t m_sliceIndex
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 33 of file FWHGTowerProxyBuilder.h.

Constructor & Destructor Documentation

◆ FWHGTowerProxyBuilderBase() [1/2]

FWHGTowerProxyBuilderBase::FWHGTowerProxyBuilderBase ( )

Definition at line 28 of file FWHGTowerProxyBuilder.cc.

29  : m_hits(nullptr),
30  // m_depth(depth),
31  m_vecData(nullptr) {}

◆ ~FWHGTowerProxyBuilderBase()

FWHGTowerProxyBuilderBase::~FWHGTowerProxyBuilderBase ( )
override

Definition at line 33 of file FWHGTowerProxyBuilder.cc.

33 {}

◆ FWHGTowerProxyBuilderBase() [2/2]

FWHGTowerProxyBuilderBase::FWHGTowerProxyBuilderBase ( const FWHGTowerProxyBuilderBase )
privatedelete

Member Function Documentation

◆ assertCaloDataSlice()

bool FWHGTowerProxyBuilderBase::assertCaloDataSlice ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 42 of file FWHGTowerProxyBuilder.cc.

42  {
43  if (m_sliceIndex == -1) {
44  m_sliceIndex = m_vecData->AddSlice();
45  // printf("add slice %d \n",m_sliceIndex );
46  m_caloData->RefSliceInfo(m_sliceIndex)
47  .Setup(item()->name().c_str(),
48  0.,
49  item()->defaultDisplayProperties().color(),
50  item()->defaultDisplayProperties().transparency());
51 
52  // add new selector
54  if (m_caloData->GetUserData()) {
55  FWFromEveSelectorBase* base = reinterpret_cast<FWFromEveSelectorBase*>(m_caloData->GetUserData());
56  assert(nullptr != base);
57  sel = dynamic_cast<FWFromTEveCaloDataSelector*>(base);
58  assert(nullptr != sel);
59  } else {
61  //make sure it is accessible via the base class
62  m_caloData->SetUserData(static_cast<FWFromEveSelectorBase*>(sel));
63  }
64 
65  sel->addSliceSelector(m_sliceIndex, new FWHGTowerSliceSelector(item(), m_vecData));
66 
67  return true;
68  }
69  return false;
70 }

References cms::cuda::assert(), newFWLiteAna::base, FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, Skims_PA_cff::name, and EgammaValidation_Wenu_cff::sel.

◆ build()

void FWHGTowerProxyBuilderBase::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext ctx 
)
overrideprivatevirtual

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 72 of file FWHGTowerProxyBuilder.cc.

72  {
73  m_hits = nullptr;
74  if (iItem) {
75  iItem->get(m_hits);
76  FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
77  }
78 }

References FWProxyBuilderBase::build(), FWEventItem::get(), and m_hits.

◆ classPurpose()

const std::string & FWHGTowerProxyBuilderBase::classPurpose ( )
static

Definition at line 208 of file FWHGTowerProxyBuilder.cc.

◆ classRegisterTypeName()

const std::string & FWHGTowerProxyBuilderBase::classRegisterTypeName ( )
static

Definition at line 208 of file FWHGTowerProxyBuilder.cc.

◆ classTypeName()

const std::string & FWHGTowerProxyBuilderBase::classTypeName ( )
static

Definition at line 208 of file FWHGTowerProxyBuilder.cc.

◆ classView()

const std::string & FWHGTowerProxyBuilderBase::classView ( )
static

Definition at line 208 of file FWHGTowerProxyBuilder.cc.

◆ fillCaloData()

void FWHGTowerProxyBuilderBase::fillCaloData ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 91 of file FWHGTowerProxyBuilder.cc.

91  {
92  //reset values for this slice
93  std::vector<float>& sliceVals = m_vecData->GetSliceVals(m_sliceIndex);
94  for (std::vector<float>::iterator i = sliceVals.begin(); i != sliceVals.end(); ++i) {
95  *i = 0;
96  }
97 
98  if (m_hits) {
99  TEveCaloData::vCellId_t& selected = m_vecData->GetCellsSelected();
100 
101  if (item()->defaultDisplayProperties().isVisible()) {
102  assert(item()->size() >= m_hits->size());
103 
104  unsigned int index = 0;
105  TEveCaloData::vCellId_t cellId;
106  for (HGCRecHitCollection::const_iterator it = m_hits->begin(); it != m_hits->end(); ++it, ++index) {
108  if (info.displayProperties().isVisible()) {
109  unsigned int rawid = (*it).detid().rawId();
110  int tower = fillTowerForDetId(rawid, (*it).energy());
111 
112  if (info.isSelected()) {
113  selected.push_back(TEveCaloData::CellId_t(tower, m_sliceIndex));
114  }
115  }
116  }
117  }
118  }
119 }

References cms::cuda::assert(), edm::SortedCollection< T, SORT >::begin(), edm::SortedCollection< T, SORT >::end(), fillTowerForDetId(), mps_fire::i, info(), FWProxyBuilderBase::item(), m_hits, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, FWEventItem::modelInfo(), edm::SortedCollection< T, SORT >::size(), findQualityFiles::size, and hgcalTowerProducer_cfi::tower.

◆ fillTowerForDetId()

int FWHGTowerProxyBuilderBase::fillTowerForDetId ( unsigned int  rawid,
float  val 
)
private

Definition at line 121 of file FWHGTowerProxyBuilder.cc.

121  {
122  using namespace TMath;
123  const static float upPhiLimit = Pi() - 10 * DegToRad() - 1e-5;
124 
125  TEveCaloData::vCellId_t cellIds;
126  const FWGeometry* geom = item()->getGeom();
127  if (!geom->contains(rawid)) {
128  fwLog(fwlog::kInfo) << "FWHGTowerProxyBuilderBase cannot get geometry for DetId: " << rawid << ". Ignored.\n";
129  return -1;
130  }
131 
132  const float* corners = geom->getCorners(rawid);
133  if (!corners) {
134  fwLog(fwlog::kInfo) << "FWHGTowerProxyBuilderBase cannot get corners for DetId: " << rawid << ". Ignored.\n";
135  return -1;
136  }
137 
138  std::vector<TEveVector> front(4);
139  float eta[4], phi[4];
140  bool plusSignPhi = false;
141  bool minusSignPhi = false;
142  int j = 0;
143  for (int i = 0; i < 4; ++i) {
144  front[i] = TEveVector(corners[j], corners[j + 1], corners[j + 2]);
145  j += 3;
146 
147  eta[i] = front[i].Eta();
148  phi[i] = front[i].Phi();
149 
150  // make sure sign around Pi is same as sign of fY
151  phi[i] = Sign(phi[i], front[i].fY);
152 
153  (phi[i] >= 0) ? plusSignPhi = true : minusSignPhi = true;
154  }
155 
156  // check for cell around phi and move up edge to negative side
157  if (plusSignPhi && minusSignPhi) {
158  for (int i = 0; i < 4; ++i) {
159  if (phi[i] >= upPhiLimit) {
160  // printf("over phi max limit %f \n", phi[i]);
161  phi[i] -= TwoPi();
162  }
163  }
164  }
165 
166  float etaM = -10;
167  float etam = 10;
168  float phiM = -4;
169  float phim = 4;
170  for (int i = 0; i < 4; ++i) {
171  etam = Min(etam, eta[i]);
172  etaM = Max(etaM, eta[i]);
173  phim = Min(phim, phi[i]);
174  phiM = Max(phiM, phi[i]);
175  }
176 
177  /*
178  if (phiM - phim > 1)
179  printf("!!! [%.2f %.2f] input(%.3f, %.3f, %.3f, %.3f) \n", phim, phiM, phiRef[0] , phiRef[1] , phiRef[2], phiRef[3]);
180  */
181 
182  // check if tower is there
183  Float_t ceta = (etam + etaM) * 0.5;
184  Float_t cphi = (phim + phiM) * 0.5;
185  int tower = -1;
186  int idx = 0;
187  for (TEveCaloData::vCellGeom_i i = m_vecData->GetCellGeom().begin(); i != m_vecData->GetCellGeom().end();
188  ++i, ++idx) {
189  const TEveCaloData::CellGeom_t& cg = *i;
190  if ((ceta > cg.fEtaMin && ceta < cg.fEtaMax) && (cphi > cg.fPhiMin && cphi < cg.fPhiMax)) {
191  tower = idx;
192  break;
193  }
194  }
195 
196  // add it if not there
197  if (tower == -1) {
198  tower = m_vecData->AddTower(etam, etaM, phim, phiM);
199  }
200 
201  m_vecData->FillSlice(m_sliceIndex, tower, val);
202  return tower;
203 }

References MillePedeFileConverter_cfg::e, PVValHelper::eta, fwLog, relativeConstraints::geom, FWEventItem::getGeom(), mps_fire::i, heavyIonCSV_trainingSettings::idx, FWProxyBuilderBase::item(), dqmiolumiharvest::j, fwlog::kInfo, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, Max(), Min(), phi, Pi, Sign(), hgcalTowerProducer_cfi::tower, TwoPi, and heppy_batch::val.

Referenced by fillCaloData().

◆ itemBeingDestroyed()

void FWHGTowerProxyBuilderBase::itemBeingDestroyed ( const FWEventItem iItem)
overrideprotectedvirtual

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 80 of file FWHGTowerProxyBuilder.cc.

80  {
81  if (nullptr != m_hits) {
82  //reset values for this slice
83  std::vector<float>& sliceVals = m_vecData->GetSliceVals(m_sliceIndex);
84  for (std::vector<float>::iterator i = sliceVals.begin(); i != sliceVals.end(); ++i) {
85  *i = 0;
86  }
87  }
89 }

References mps_fire::i, FWCaloDataProxyBuilderBase::itemBeingDestroyed(), m_hits, FWCaloDataProxyBuilderBase::m_sliceIndex, and m_vecData.

◆ operator=()

const FWHGTowerProxyBuilderBase& FWHGTowerProxyBuilderBase::operator= ( const FWHGTowerProxyBuilderBase )
privatedelete

◆ purpose()

const std::string& FWHGTowerProxyBuilderBase::purpose ( ) const
inline

Definition at line 43 of file FWHGTowerProxyBuilder.h.

45 :
46  void setCaloData(const fireworks::Context&) override;

◆ setCaloData()

void FWHGTowerProxyBuilderBase::setCaloData ( const fireworks::Context ctx)
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 37 of file FWHGTowerProxyBuilder.cc.

37  {
38  m_vecData = ctx.getCaloDataHF(); // cached to avoid casting
40 }

References fireworks::Context::getCaloDataHF(), FWCaloDataProxyBuilderBase::m_caloData, and m_vecData.

◆ typeName()

const std::string& FWHGTowerProxyBuilderBase::typeName ( ) const
inline

Definition at line 43 of file FWHGTowerProxyBuilder.h.

45 :
46  void setCaloData(const fireworks::Context&) override;

◆ view()

const std::string& FWHGTowerProxyBuilderBase::view ( ) const
inline

Definition at line 43 of file FWHGTowerProxyBuilder.h.

45 :
46  void setCaloData(const fireworks::Context&) override;

Member Data Documentation

◆ m_hits

const HGCRecHitCollection* FWHGTowerProxyBuilderBase::m_hits
private

Definition at line 62 of file FWHGTowerProxyBuilder.h.

Referenced by build(), fillCaloData(), and itemBeingDestroyed().

◆ m_vecData

TEveCaloDataVec* FWHGTowerProxyBuilderBase::m_vecData
private
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
FWEventItem::modelInfo
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
mps_fire.i
i
Definition: mps_fire.py:428
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
fireworks::Context
Definition: Context.h:41
FWGeometry
Definition: FWGeometry.h:27
TwoPi
const double TwoPi
Definition: CosmicMuonParameters.h:19
FWEventItem::get
void get(const T *&oData) const
Definition: FWEventItem.h:78
FWCaloDataProxyBuilderBase::itemBeingDestroyed
void itemBeingDestroyed(const FWEventItem *) override
Definition: FWCaloDataProxyBuilderBase.cc:106
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:4
Sign
T Sign(T A, T B)
Definition: MathUtil.h:54
cms::cuda::assert
assert(be >=bs)
edm::SortedCollection::size
size_type size() const
Definition: SortedCollection.h:215
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
FWHGTowerSliceSelector
Definition: FWHGTowerSliceSelector.h:31
fireworks::Context::getCaloDataHF
TEveCaloDataVec * getCaloDataHF() const
Definition: Context.h:70
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
FWEventItem::ModelInfo
Definition: FWEventItem.h:58
FWCaloDataProxyBuilderBase::m_sliceIndex
Int_t m_sliceIndex
Definition: FWCaloDataProxyBuilderBase.h:56
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
PVValHelper::eta
Definition: PVValidationHelpers.h:70
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
FWCaloDataProxyBuilderBase::m_caloData
TEveCaloData * m_caloData
Definition: FWCaloDataProxyBuilderBase.h:55
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
FWFromTEveCaloDataSelector
Definition: FWFromTEveCaloDataSelector.h:34
FWFromEveSelectorBase
Definition: FWFromEveSelectorBase.h:27
Max
T Max(T a, T b)
Definition: MathUtil.h:44
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
DDAxes::phi
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
fwlog::kInfo
Definition: fwLog.h:35
FWHGTowerProxyBuilderBase::fillTowerForDetId
int fillTowerForDetId(unsigned int rawid, float)
Definition: FWHGTowerProxyBuilder.cc:121
heppy_batch.val
val
Definition: heppy_batch.py:351
FWHGTowerProxyBuilderBase::setCaloData
void setCaloData(const fireworks::Context &) override
Definition: FWHGTowerProxyBuilder.cc:37
FWHGTowerProxyBuilderBase::m_hits
const HGCRecHitCollection * m_hits
Definition: FWHGTowerProxyBuilder.h:62
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
EgammaValidation_Wenu_cff.sel
sel
Definition: EgammaValidation_Wenu_cff.py:33
Min
T Min(T a, T b)
Definition: MathUtil.h:39
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
newFWLiteAna.base
base
Definition: newFWLiteAna.py:92
FWHGTowerProxyBuilderBase::m_vecData
TEveCaloDataVec * m_vecData
Definition: FWHGTowerProxyBuilder.h:64
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37