CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
FWPFEcalRecHitRPProxyBuilder Class Reference

#include <FWPFEcalRecHitRPProxyBuilder.h>

Inheritance diagram for FWPFEcalRecHitRPProxyBuilder:
FWProxyBuilderTemplate< EcalRecHit > FWProxyBuilderBase

Public Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
virtual void cleanLocal ()
 
 FWPFEcalRecHitRPProxyBuilder ()
 
virtual bool havePerViewProduct (FWViewType::EType) const
 
 REGISTER_PROXYBUILDER_METHODS ()
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
virtual ~FWPFEcalRecHitRPProxyBuilder ()
 
- Public Member Functions inherited from FWProxyBuilderTemplate< EcalRecHit >
 FWProxyBuilderTemplate ()
 
virtual ~FWProxyBuilderTemplate ()
 
- 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 haveSingleProduct () const
 
const FWEventItemitem () const
 
virtual void itemBeingDestroyed (const FWEventItem *)
 
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 bool willHandleInteraction () const
 
virtual ~FWProxyBuilderBase ()
 

Static Public Member Functions

static std::string typeOfBuilder ()
 
- 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...
 

Private Member Functions

TEveVector calculateCentre (const float *corners)
 
 FWPFEcalRecHitRPProxyBuilder (const FWPFEcalRecHitRPProxyBuilder &)
 
const
FWPFEcalRecHitRPProxyBuilder
operator= (const FWPFEcalRecHitRPProxyBuilder &)
 

Private Attributes

std::vector< FWPFRhoPhiRecHit * > m_towers
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >
::iterator 
Product_it
 
- Protected Member Functions inherited from FWProxyBuilderTemplate< EcalRecHit >
const EcalRecHitmodelData (int index)
 
- Protected Member Functions inherited from FWProxyBuilderBase
virtual void buildViewType (const FWEventItem *iItem, TEveElementList *, FWViewType::EType, const FWViewContext *)
 
virtual void clean ()
 
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)
 
virtual void modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 35 of file FWPFEcalRecHitRPProxyBuilder.h.

Constructor & Destructor Documentation

FWPFEcalRecHitRPProxyBuilder::FWPFEcalRecHitRPProxyBuilder ( )
inline

Definition at line 41 of file FWPFEcalRecHitRPProxyBuilder.h.

41 {}
virtual FWPFEcalRecHitRPProxyBuilder::~FWPFEcalRecHitRPProxyBuilder ( )
inlinevirtual

Definition at line 42 of file FWPFEcalRecHitRPProxyBuilder.h.

42 {}
FWPFEcalRecHitRPProxyBuilder::FWPFEcalRecHitRPProxyBuilder ( const FWPFEcalRecHitRPProxyBuilder )
private

Member Function Documentation

void FWPFEcalRecHitRPProxyBuilder::build ( const FWEventItem iItem,
TEveElementList *  product,
const FWViewContext vc 
)
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 49 of file FWPFEcalRecHitRPProxyBuilder.cc.

References calculateCentre(), FWPFMaths::calculateEt(), FWPFGeom::caloR1(), FWProxyBuilderBase::context(), funct::cos(), FWProxyBuilderBase::createCompound(), EcalRecHit::detid(), FWEventItem::ModelInfo::displayProperties(), EcalRecHit::energy(), FWGeometry::getCorners(), FWEventItem::getGeom(), i, cmsHarvester::index, info(), FWDisplayProperties::isVisible(), FWProxyBuilderBase::item(), m_towers, FWProxyBuilderTemplate< EcalRecHit >::modelData(), FWEventItem::modelInfo(), phi, funct::sin(), FWEventItem::size(), and fireworks::Context::voteMaxEtAndEnergy().

50 {
51  m_towers.clear(); // Bug fix required for when multiple RhoPhiPF views are active
52  for( unsigned int index = 0; index < static_cast<unsigned int>( iItem->size() ); ++index )
53  {
54  TEveCompound *itemHolder = createCompound();
55  product->AddElement( itemHolder );
57 
58  if( info.displayProperties().isVisible() )
59  {
60  bool added = false;
61  float E, et;
62  float ecalR = FWPFGeom::caloR1();
63  Double_t lPhi, rPhi;
64  const EcalRecHit &iData = modelData( index );
65  const float *vertices = item()->getGeom()->getCorners( iData.detid() );
66 
67  TEveVector centre = calculateCentre( vertices );
68  TEveVector lVec = TEveVector( vertices[0], vertices[1], 0 ); // Bottom left corner of tower
69  TEveVector rVec = TEveVector( vertices[9], vertices[10], 0 ); // Bottom right corner of tower
70 
71  lPhi = lVec.Phi();
72  rPhi = rVec.Phi();
73  E = iData.energy();
74  et = FWPFMaths::calculateEt( centre, E );
75 
76  for( unsigned int i = 0; i < m_towers.size(); i++ )
77  { // Small range to catch rounding inaccuracies etc.
78  Double_t phi = m_towers[i]->getlPhi();
79  if( ( lPhi == phi ) || ( ( lPhi < phi + 0.0005 ) && ( lPhi > phi - 0.0005 ) ) )
80  {
81  m_towers[i]->addChild( this, itemHolder, vc, E, et );
82  context().voteMaxEtAndEnergy( et, E );
83  added = true;
84  break;
85  }
86  }
87 
88  if( !added )
89  {
90  rVec.fX = ecalR * cos( rPhi ); rVec.fY = ecalR * sin( rPhi );
91  lVec.fX = ecalR * cos( lPhi ); lVec.fY = ecalR * sin( lPhi );
92  std::vector<TEveVector> bCorners(2);
93  bCorners[0] = lVec;
94  bCorners[1] = rVec;
95 
96  FWPFRhoPhiRecHit *rh = new FWPFRhoPhiRecHit( this, itemHolder, vc, E, et, lPhi, rPhi, bCorners );
97  context().voteMaxEtAndEnergy(et, E);
98  m_towers.push_back( rh );
99  }
100  }
101  }
102 }
const fireworks::Context & context() const
int i
Definition: DBlmapReader.cc:9
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:67
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:184
std::vector< FWPFRhoPhiRecHit * > m_towers
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const DetId & detid() const
Definition: EcalRecHit.h:71
const FWEventItem * item() const
const EcalRecHit & modelData(int index)
float caloR1()
Definition: FWPFGeom.h:21
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
float energy() const
Definition: EcalRecHit.h:68
TEveVector calculateCentre(const float *corners)
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:261
size_t size() const
Definition: FWEventItem.cc:548
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:681
Definition: DDAxes.h:10
TEveVector FWPFEcalRecHitRPProxyBuilder::calculateCentre ( const float *  corners)
private

Definition at line 30 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, and j.

Referenced by build().

31 {
32  TEveVector centre;
33 
34  for( unsigned int i = 0; i < 8; i++ )
35  {
36  int j = i * 3;
37  centre.fX += vertices[j];
38  centre.fY += vertices[j+1]; // Total x,y,z values
39  centre.fZ += vertices[j+2];
40  }
41 
42  centre *= 1.0f / 8.0f; // Actually calculate the centre point
43 
44  return centre;
45 }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
void FWPFEcalRecHitRPProxyBuilder::cleanLocal ( )
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 19 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, and m_towers.

20 {
21  typedef std::vector<FWPFRhoPhiRecHit*> rpRecHits;
22  for( rpRecHits::iterator i = m_towers.begin(); i != m_towers.end(); ++i )
23  (*i)->clean();
24 
25  m_towers.clear();
26 }
int i
Definition: DBlmapReader.cc:9
std::vector< FWPFRhoPhiRecHit * > m_towers
virtual bool FWPFEcalRecHitRPProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlinevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 47 of file FWPFEcalRecHitRPProxyBuilder.h.

47 { return true; }
const FWPFEcalRecHitRPProxyBuilder& FWPFEcalRecHitRPProxyBuilder::operator= ( const FWPFEcalRecHitRPProxyBuilder )
private
FWPFEcalRecHitRPProxyBuilder::REGISTER_PROXYBUILDER_METHODS ( )
void FWPFEcalRecHitRPProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 5 of file FWPFEcalRecHitRPProxyBuilder.cc.

References i, cmsHarvester::index, and m_towers.

6 {
7  typedef std::vector<FWPFRhoPhiRecHit*> rpRecHits;
8  unsigned int index = 0;
9 
10  for( rpRecHits::iterator i = m_towers.begin(); i != m_towers.end(); ++i )
11  {
12  m_towers[index]->updateScale( vc );
13  index++;
14  }
15 }
int i
Definition: DBlmapReader.cc:9
std::vector< FWPFRhoPhiRecHit * > m_towers
static std::string FWPFEcalRecHitRPProxyBuilder::typeOfBuilder ( )
inlinestatic

Definition at line 38 of file FWPFEcalRecHitRPProxyBuilder.h.

38 { return "simple#"; }

Member Data Documentation

std::vector<FWPFRhoPhiRecHit*> FWPFEcalRecHitRPProxyBuilder::m_towers
private

Definition at line 61 of file FWPFEcalRecHitRPProxyBuilder.h.

Referenced by build(), cleanLocal(), and scaleProduct().