CMS 3D CMS Logo

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

#include <FWHFTowerProxyBuilder.h>

Inheritance diagram for FWHFTowerProxyBuilderBase:
FWCaloDataProxyBuilderBase FWProxyBuilderBase

Public Member Functions

 FWHFTowerProxyBuilderBase ()
 
 FWHFTowerProxyBuilderBase (const FWHFTowerProxyBuilderBase &)=delete
 
const FWHFTowerProxyBuilderBaseoperator= (const FWHFTowerProxyBuilderBase &)=delete
 
const std::string & purpose () const
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWHFTowerProxyBuilderBase () 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 ()
 

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)
 

Private Attributes

const HFRecHitCollectionm_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 FWHFTowerProxyBuilder.h.

Constructor & Destructor Documentation

◆ FWHFTowerProxyBuilderBase() [1/2]

FWHFTowerProxyBuilderBase::FWHFTowerProxyBuilderBase ( )

Definition at line 28 of file FWHFTowerProxyBuilder.cc.

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

◆ ~FWHFTowerProxyBuilderBase()

FWHFTowerProxyBuilderBase::~FWHFTowerProxyBuilderBase ( )
override

Definition at line 33 of file FWHFTowerProxyBuilder.cc.

33 {}

◆ FWHFTowerProxyBuilderBase() [2/2]

FWHFTowerProxyBuilderBase::FWHFTowerProxyBuilderBase ( const FWHFTowerProxyBuilderBase )
delete

Member Function Documentation

◆ assertCaloDataSlice()

bool FWHFTowerProxyBuilderBase::assertCaloDataSlice ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 42 of file FWHFTowerProxyBuilder.cc.

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.

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 FWHFTowerSliceSelector(item(), m_vecData));
66 
67  return true;
68  }
69  return false;
70 }
base
Main Program
Definition: newFWLiteAna.py:92
assert(be >=bs)
const FWEventItem * item() const

◆ build()

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

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 72 of file FWHFTowerProxyBuilder.cc.

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

72  {
73  m_hits = nullptr;
74  if (iItem) {
75  iItem->get(m_hits);
76  FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
77  }
78 }
void get(const T *&oData) const
Definition: FWEventItem.h:78
const HFRecHitCollection * m_hits

◆ classPurpose()

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

Definition at line 208 of file FWHFTowerProxyBuilder.cc.

◆ classRegisterTypeName()

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

Definition at line 208 of file FWHFTowerProxyBuilder.cc.

◆ classTypeName()

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

Definition at line 208 of file FWHFTowerProxyBuilder.cc.

◆ classView()

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

Definition at line 208 of file FWHFTowerProxyBuilder.cc.

◆ fillCaloData()

void FWHFTowerProxyBuilderBase::fillCaloData ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 91 of file FWHFTowerProxyBuilder.cc.

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.

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 (HFRecHitCollection::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 }
size
Write out results.
static const TGPicture * info(bool iBackgroundIsBlack)
size_type size() const
std::vector< T >::const_iterator const_iterator
assert(be >=bs)
const_iterator begin() const
const_iterator end() const
const HFRecHitCollection * m_hits
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:446
const FWEventItem * item() const
int fillTowerForDetId(unsigned int rawid, float)

◆ fillTowerForDetId()

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

Definition at line 121 of file FWHFTowerProxyBuilder.cc.

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, METSkim_cff::Max, METSkim_cff::Min, phi, Pi, hgcalTowerProducer_cfi::tower, TwoPi, and heppy_batch::val.

Referenced by fillCaloData().

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) << "FWHFTowerProxyBuilderBase 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) << "FWHFTowerProxyBuilderBase 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 }
const double TwoPi
const double Pi
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
#define fwLog(_level_)
Definition: fwLog.h:45
const FWEventItem * item() const

◆ itemBeingDestroyed()

void FWHFTowerProxyBuilderBase::itemBeingDestroyed ( const FWEventItem iItem)
overrideprotectedvirtual

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 80 of file FWHFTowerProxyBuilder.cc.

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

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 }
void itemBeingDestroyed(const FWEventItem *) override
const HFRecHitCollection * m_hits

◆ operator=()

const FWHFTowerProxyBuilderBase& FWHFTowerProxyBuilderBase::operator= ( const FWHFTowerProxyBuilderBase )
delete

◆ purpose()

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

Definition at line 43 of file FWHFTowerProxyBuilder.h.

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

◆ setCaloData()

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

Implements FWCaloDataProxyBuilderBase.

Definition at line 37 of file FWHFTowerProxyBuilder.cc.

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

37  {
38  m_vecData = ctx.getCaloDataHF(); // cached to avoid casting
40 }
TEveCaloDataVec * getCaloDataHF() const
Definition: Context.h:70

◆ typeName()

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

Definition at line 43 of file FWHFTowerProxyBuilder.h.

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

◆ view()

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

Definition at line 43 of file FWHFTowerProxyBuilder.h.

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

Member Data Documentation

◆ m_hits

const HFRecHitCollection* FWHFTowerProxyBuilderBase::m_hits
private

Definition at line 63 of file FWHFTowerProxyBuilder.h.

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

◆ m_vecData

TEveCaloDataVec* FWHFTowerProxyBuilderBase::m_vecData
private