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

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::FWHFTowerProxyBuilderBase ( )

Definition at line 28 of file FWHFTowerProxyBuilder.cc.

28  :
29  m_hits(nullptr),
30  // m_depth(depth),
31  m_vecData(nullptr)
32 {}
const HFRecHitCollection * m_hits
FWHFTowerProxyBuilderBase::~FWHFTowerProxyBuilderBase ( )
override

Definition at line 34 of file FWHFTowerProxyBuilder.cc.

35 {}
FWHFTowerProxyBuilderBase::FWHFTowerProxyBuilderBase ( const FWHFTowerProxyBuilderBase )
privatedelete

Member Function Documentation

bool FWHFTowerProxyBuilderBase::assertCaloDataSlice ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 47 of file FWHFTowerProxyBuilder.cc.

References FWFromTEveCaloDataSelector::addSliceSelector(), runEdmFileComparison::base, create_public_lumi_plots::color, FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, dataset::name, and triggerObjects_cff::sel.

48 {
49  if (m_sliceIndex == -1)
50  {
51  m_sliceIndex = m_vecData->AddSlice();
52  // printf("add slice %d \n",m_sliceIndex );
53  m_caloData->RefSliceInfo(m_sliceIndex).Setup(item()->name().c_str() , 0.,
54  item()->defaultDisplayProperties().color(),
55  item()->defaultDisplayProperties().transparency());
56 
57  // add new selector
59  if (m_caloData->GetUserData())
60  {
61  FWFromEveSelectorBase* base = reinterpret_cast<FWFromEveSelectorBase*>(m_caloData->GetUserData());
62  assert(nullptr!=base);
63  sel = dynamic_cast<FWFromTEveCaloDataSelector*> (base);
64  assert(nullptr!=sel);
65  }
66  else
67  {
69  //make sure it is accessible via the base class
70  m_caloData->SetUserData(static_cast<FWFromEveSelectorBase*>(sel));
71  }
72 
74 
75  return true;
76  }
77  return false;
78 }
void addSliceSelector(int iSlice, FWFromSliceSelector *)
const FWEventItem * item() const
base
Make Sure CMSSW is Setup ##.
void FWHFTowerProxyBuilderBase::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext ctx 
)
overrideprivatevirtual

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 81 of file FWHFTowerProxyBuilder.cc.

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

83 {
84  m_hits=nullptr;
85  if (iItem)
86  {
87  iItem->get(m_hits);
88  FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
89  }
90 }
void get(const T *&oData) const
Definition: FWEventItem.h:85
const HFRecHitCollection * m_hits
const std::string & FWHFTowerProxyBuilderBase::classPurpose ( )
static

Definition at line 243 of file FWHFTowerProxyBuilder.cc.

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

Definition at line 243 of file FWHFTowerProxyBuilder.cc.

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

Definition at line 243 of file FWHFTowerProxyBuilder.cc.

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

Definition at line 243 of file FWHFTowerProxyBuilder.cc.

void FWHFTowerProxyBuilderBase::fillCaloData ( )
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 111 of file FWHFTowerProxyBuilder.cc.

References edm::SortedCollection< T, SORT >::begin(), FWEventItem::ModelInfo::displayProperties(), edm::SortedCollection< T, SORT >::end(), fillTowerForDetId(), mps_fire::i, info(), FWEventItem::ModelInfo::isSelected(), FWDisplayProperties::isVisible(), FWProxyBuilderBase::item(), m_hits, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, FWEventItem::modelInfo(), edm::SortedCollection< T, SORT >::size(), and findQualityFiles::size.

112 {
113  //reset values for this slice
114  std::vector<float>& sliceVals = m_vecData->GetSliceVals(m_sliceIndex);
115  for (std::vector<float>::iterator i = sliceVals.begin(); i!= sliceVals.end(); ++i)
116  {
117  *i = 0;
118  }
119 
120  if (m_hits)
121  {
122  TEveCaloData::vCellId_t& selected = m_vecData->GetCellsSelected();
123 
124  if(item()->defaultDisplayProperties().isVisible()) {
125  assert(item()->size() >= m_hits->size());
126 
127  unsigned int index=0;
128  TEveCaloData::vCellId_t cellId;
129  for(HFRecHitCollection::const_iterator it = m_hits->begin(); it != m_hits->end(); ++it,++index)
130  {
131  const FWEventItem::ModelInfo& info = item()->modelInfo(index);
132  if(info.displayProperties().isVisible())
133  {
134  unsigned int rawid = (*it).detid().rawId();
135  int tower = fillTowerForDetId(rawid, (*it).energy());
136 
137  if(info.isSelected())
138  {
139  selected.push_back(TEveCaloData::CellId_t(tower, m_sliceIndex));
140  }
141  }
142  }
143  }
144  }
145 }
size
Write out results.
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
bool isSelected() const
Definition: FWEventItem.h:71
std::vector< HFRecHit >::const_iterator const_iterator
const FWEventItem * item() const
const_iterator end() const
size_type size() const
const HFRecHitCollection * m_hits
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
int fillTowerForDetId(unsigned int rawid, float)
const_iterator begin() const
int FWHFTowerProxyBuilderBase::fillTowerForDetId ( unsigned int  rawid,
float  val 
)
private

Definition at line 148 of file FWHFTowerProxyBuilder.cc.

References FWGeometry::contains(), MillePedeFileConverter_cfg::e, PVValHelper::eta, fwLog, relativeConstraints::geom, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, training_settings::idx, FWProxyBuilderBase::item(), fwlog::kInfo, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, Max(), Min(), phi, Pi, Sign(), and TwoPi.

Referenced by fillCaloData().

149 {
150  using namespace TMath;
151  const static float upPhiLimit = Pi() -10*DegToRad() -1e-5;
152 
153  TEveCaloData::vCellId_t cellIds;
154  const FWGeometry *geom = item()->getGeom();
155  if( ! geom->contains( rawid ))
156  {
157  fwLog( fwlog::kInfo ) << "FWHFTowerProxyBuilderBase cannot get geometry for DetId: "<< rawid << ". Ignored.\n";
158  return -1;
159  }
160 
161  const float* corners = geom->getCorners( rawid );
162  if( ! corners )
163  {
164  fwLog( fwlog::kInfo ) << "FWHFTowerProxyBuilderBase cannot get corners for DetId: "<< rawid << ". Ignored.\n";
165  return -1;
166  }
167 
168  std::vector<TEveVector> front( 4 );
169  float eta[4], phi[4];
170  bool plusSignPhi = false;
171  bool minusSignPhi = false;
172  int j = 0;
173  for( int i = 0; i < 4; ++i )
174  {
175  front[i] = TEveVector( corners[j], corners[j + 1], corners[j + 2] );
176  j += 3;
177 
178  eta[i] = front[i].Eta();
179  phi[i] = front[i].Phi();
180 
181  // make sure sign around Pi is same as sign of fY
182  phi[i] = Sign( phi[i], front[i].fY );
183 
184  ( phi[i] >= 0 ) ? plusSignPhi = true : minusSignPhi = true;
185  }
186 
187  // check for cell around phi and move up edge to negative side
188  if( plusSignPhi && minusSignPhi )
189  {
190  for( int i = 0; i < 4; ++i )
191  {
192  if( phi[i] >= upPhiLimit )
193  {
194  // printf("over phi max limit %f \n", phi[i]);
195  phi[i] -= TwoPi();
196  }
197  }
198  }
199 
200  float etaM = -10;
201  float etam = 10;
202  float phiM = -4;
203  float phim = 4;
204  for( int i = 0; i < 4; ++i )
205  {
206  etam = Min( etam, eta[i] );
207  etaM = Max( etaM, eta[i] );
208  phim = Min( phim, phi[i] );
209  phiM = Max( phiM, phi[i] );
210  }
211 
212  /*
213  if (phiM - phim > 1)
214  printf("!!! [%.2f %.2f] input(%.3f, %.3f, %.3f, %.3f) \n", phim, phiM, phiRef[0] , phiRef[1] , phiRef[2], phiRef[3]);
215  */
216 
217  // check if tower is there
218  Float_t ceta = (etam+etaM)*0.5;
219  Float_t cphi = (phim+phiM)*0.5;
220  int tower = -1;
221  int idx = 0;
222  for ( TEveCaloData::vCellGeom_i i = m_vecData->GetCellGeom().begin(); i!= m_vecData->GetCellGeom().end(); ++i, ++idx)
223  {
224  const TEveCaloData::CellGeom_t &cg = *i;
225  if ((ceta > cg.fEtaMin && ceta < cg.fEtaMax) && (cphi > cg.fPhiMin && cphi < cg.fPhiMax))
226  {
227  tower = idx;
228  break;
229  }
230  }
231 
232  // add it if not there
233  if (tower == -1 )
234  {
235  tower = m_vecData->AddTower(etam, etaM, phim, phiM);
236  }
237 
238 
239  m_vecData->FillSlice(m_sliceIndex, tower, val);
240  return tower;
241 }
const double TwoPi
const double Pi
T Sign(T A, T B)
Definition: MathUtil.h:54
T Min(T a, T b)
Definition: MathUtil.h:39
const FWEventItem * item() const
bool contains(unsigned int id) const
Definition: FWGeometry.h:117
T Max(T a, T b)
Definition: MathUtil.h:44
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:430
#define fwLog(_level_)
Definition: fwLog.h:50
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
void FWHFTowerProxyBuilderBase::itemBeingDestroyed ( const FWEventItem iItem)
overrideprotectedvirtual

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 93 of file FWHFTowerProxyBuilder.cc.

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

94 {
95 
96  if(nullptr!=m_hits) {
97 
98  //reset values for this slice
99  std::vector<float>& sliceVals = m_vecData->GetSliceVals(m_sliceIndex);
100  for (std::vector<float>::iterator i = sliceVals.begin(); i!= sliceVals.end(); ++i)
101  {
102  *i = 0;
103  }
104 
105 
106  }
108 }
void itemBeingDestroyed(const FWEventItem *) override
const HFRecHitCollection * m_hits
const FWHFTowerProxyBuilderBase& FWHFTowerProxyBuilderBase::operator= ( const FWHFTowerProxyBuilderBase )
privatedelete
const std::string& FWHFTowerProxyBuilderBase::purpose ( ) const
inline

Definition at line 44 of file FWHFTowerProxyBuilder.h.

46 :
47  void setCaloData(const fireworks::Context&) override;
void setCaloData(const fireworks::Context &) override
void FWHFTowerProxyBuilderBase::setCaloData ( const fireworks::Context ctx)
overrideprotectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 40 of file FWHFTowerProxyBuilder.cc.

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

41 {
42  m_vecData = ctx.getCaloDataHF();// cached to avoid casting
44 }
TEveCaloDataVec * getCaloDataHF() const
Definition: Context.h:81
const std::string& FWHFTowerProxyBuilderBase::typeName ( ) const
inline

Definition at line 44 of file FWHFTowerProxyBuilder.h.

46 :
47  void setCaloData(const fireworks::Context&) override;
void setCaloData(const fireworks::Context &) override
const std::string& FWHFTowerProxyBuilderBase::view ( ) const
inline

Definition at line 44 of file FWHFTowerProxyBuilder.h.

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

Member Data Documentation

const HFRecHitCollection* FWHFTowerProxyBuilderBase::m_hits
private

Definition at line 65 of file FWHFTowerProxyBuilder.h.

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

TEveCaloDataVec* FWHFTowerProxyBuilderBase::m_vecData
private