CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | 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 ()
 
 REGISTER_PROXYBUILDER_METHODS ()
 
virtual ~FWHFTowerProxyBuilderBase ()
 
- Public Member Functions inherited from FWCaloDataProxyBuilderBase
 FWCaloDataProxyBuilderBase ()
 
virtual bool willHandleInteraction () const
 
virtual ~FWCaloDataProxyBuilderBase ()
 
- 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 &)
 
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

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

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
int fillTowerForDetId (unsigned int rawid, float)
 
 FWHFTowerProxyBuilderBase (const FWHFTowerProxyBuilderBase &)
 
const FWHFTowerProxyBuilderBaseoperator= (const FWHFTowerProxyBuilderBase &)
 

Private Attributes

const HFRecHitCollectionm_hits
 
TEveCaloDataVec * m_vecData
 

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
 
- 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 34 of file FWHFTowerProxyBuilder.h.

Constructor & Destructor Documentation

FWHFTowerProxyBuilderBase::FWHFTowerProxyBuilderBase ( )

Definition at line 29 of file FWHFTowerProxyBuilder.cc.

29  :
30  m_hits(0),
31  // m_depth(depth),
32  m_vecData(0)
33 {}
const HFRecHitCollection * m_hits
FWHFTowerProxyBuilderBase::~FWHFTowerProxyBuilderBase ( )
virtual

Definition at line 35 of file FWHFTowerProxyBuilder.cc.

36 {}
FWHFTowerProxyBuilderBase::FWHFTowerProxyBuilderBase ( const FWHFTowerProxyBuilderBase )
private

Member Function Documentation

bool FWHFTowerProxyBuilderBase::assertCaloDataSlice ( )
protectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 48 of file FWHFTowerProxyBuilder.cc.

References FWFromTEveCaloDataSelector::addSliceSelector(), newFWLiteAna::base, FWProxyBuilderBase::item(), FWCaloDataProxyBuilderBase::m_caloData, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, mergeVDriftHistosByStation::name, and runTheMatrix::sel.

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

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 82 of file FWHFTowerProxyBuilder.cc.

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

84 {
85  m_hits=0;
86  if (iItem)
87  {
88  iItem->get(m_hits);
89  FWCaloDataProxyBuilderBase::build(iItem, el, ctx);
90  }
91 }
void get(const T *&oData) const
Definition: FWEventItem.h:84
const HFRecHitCollection * m_hits
void FWHFTowerProxyBuilderBase::fillCaloData ( )
protectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 112 of file FWHFTowerProxyBuilder.cc.

References edm::SortedCollection< T, SORT >::begin(), FWEventItem::ModelInfo::displayProperties(), edm::SortedCollection< T, SORT >::end(), fillTowerForDetId(), i, getHLTprescales::index, 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.

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

Definition at line 149 of file FWHFTowerProxyBuilder.cc.

References eta(), prof2calltree::front, fwLog, relativeConstraints::geom, FWEventItem::getGeom(), i, FWProxyBuilderBase::item(), j, fwlog::kInfo, FWCaloDataProxyBuilderBase::m_sliceIndex, m_vecData, siStripFEDMonitor_P5_cff::Max, siStripFEDMonitor_P5_cff::Min, phi, Pi, and TwoPi.

Referenced by fillCaloData().

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

Reimplemented from FWCaloDataProxyBuilderBase.

Definition at line 94 of file FWHFTowerProxyBuilder.cc.

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

95 {
96 
97  if(0!=m_hits) {
98 
99  //reset values for this slice
100  std::vector<float>& sliceVals = m_vecData->GetSliceVals(m_sliceIndex);
101  for (std::vector<float>::iterator i = sliceVals.begin(); i!= sliceVals.end(); ++i)
102  {
103  *i = 0;
104  }
105 
106 
107  }
109 }
int i
Definition: DBlmapReader.cc:9
const HFRecHitCollection * m_hits
virtual void itemBeingDestroyed(const FWEventItem *)
const FWHFTowerProxyBuilderBase& FWHFTowerProxyBuilderBase::operator= ( const FWHFTowerProxyBuilderBase )
private
FWHFTowerProxyBuilderBase::REGISTER_PROXYBUILDER_METHODS ( )
void FWHFTowerProxyBuilderBase::setCaloData ( const fireworks::Context ctx)
protectedvirtual

Implements FWCaloDataProxyBuilderBase.

Definition at line 41 of file FWHFTowerProxyBuilder.cc.

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

42 {
43  m_vecData = ctx.getCaloDataHF();// cached to avoid casting
45 }
TEveCaloDataVec * getCaloDataHF() const
Definition: Context.h:82

Member Data Documentation

const HFRecHitCollection* FWHFTowerProxyBuilderBase::m_hits
private

Definition at line 66 of file FWHFTowerProxyBuilder.h.

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

TEveCaloDataVec* FWHFTowerProxyBuilderBase::m_vecData
private