CMS 3D CMS Logo

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

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
void cleanLocal () override
 
 FWPFEcalRecHitRPProxyBuilder ()
 
bool havePerViewProduct (FWViewType::EType) const override
 
const std::string & purpose () const
 
void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
 
const std::string & typeName () const
 
const std::string & view () const
 
 ~FWPFEcalRecHitRPProxyBuilder () override
 
- Public Member Functions inherited from FWProxyBuilderTemplate< EcalRecHit >
 FWProxyBuilderTemplate ()
 
 ~FWProxyBuilderTemplate () 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 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 const std::string & classPurpose ()
 
static const std::string & classRegisterTypeName ()
 
static const std::string & classTypeName ()
 
static const std::string & classView ()
 
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 &)=delete
 
const FWPFEcalRecHitRPProxyBuilderoperator= (const FWPFEcalRecHitRPProxyBuilder &)=delete
 

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 {}
FWPFEcalRecHitRPProxyBuilder::~FWPFEcalRecHitRPProxyBuilder ( )
inlineoverride

Definition at line 42 of file FWPFEcalRecHitRPProxyBuilder.h.

References FWProxyBuilderBase::build().

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

Member Function Documentation

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

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(), stringResolutionProvider_cfi::et, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, info(), FWDisplayProperties::isVisible(), FWProxyBuilderBase::item(), m_towers, FWProxyBuilderTemplate< EcalRecHit >::modelData(), FWEventItem::modelInfo(), phi, funct::sin(), FWEventItem::size(), electrons_cff::vertices, 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
static const TGPicture * info(bool iBackgroundIsBlack)
const FWDisplayProperties & displayProperties() const
Definition: FWEventItem.h:68
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
std::vector< FWPFRhoPhiRecHit * > m_towers
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
const DetId & detid() const
Definition: EcalRecHit.h:72
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:297
size_t size() const
Definition: FWEventItem.cc:550
et
define resolution functions of each parameter
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:537
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:683
TEveVector FWPFEcalRecHitRPProxyBuilder::calculateCentre ( const float *  corners)
private

Definition at line 30 of file FWPFEcalRecHitRPProxyBuilder.cc.

References mps_fire::i.

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 }
const std::string & FWPFEcalRecHitRPProxyBuilder::classPurpose ( )
static

Definition at line 105 of file FWPFEcalRecHitRPProxyBuilder.cc.

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

Definition at line 105 of file FWPFEcalRecHitRPProxyBuilder.cc.

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

Definition at line 105 of file FWPFEcalRecHitRPProxyBuilder.cc.

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

Definition at line 105 of file FWPFEcalRecHitRPProxyBuilder.cc.

void FWPFEcalRecHitRPProxyBuilder::cleanLocal ( )
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 19 of file FWPFEcalRecHitRPProxyBuilder.cc.

References mps_fire::i, and m_towers.

Referenced by havePerViewProduct().

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 }
std::vector< FWPFRhoPhiRecHit * > m_towers
bool FWPFEcalRecHitRPProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 47 of file FWPFEcalRecHitRPProxyBuilder.h.

References cleanLocal(), class-composition::parent, and scaleProduct().

47 { return true; }
const FWPFEcalRecHitRPProxyBuilder& FWPFEcalRecHitRPProxyBuilder::operator= ( const FWPFEcalRecHitRPProxyBuilder )
privatedelete
const std::string& FWPFEcalRecHitRPProxyBuilder::purpose ( ) const
inline
void FWPFEcalRecHitRPProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 5 of file FWPFEcalRecHitRPProxyBuilder.cc.

References mps_fire::i, and m_towers.

Referenced by havePerViewProduct().

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 }
std::vector< FWPFRhoPhiRecHit * > m_towers
const std::string& FWPFEcalRecHitRPProxyBuilder::typeName ( ) const
inline
static std::string FWPFEcalRecHitRPProxyBuilder::typeOfBuilder ( )
inlinestatic

Definition at line 38 of file FWPFEcalRecHitRPProxyBuilder.h.

38 { return "simple#"; }
const std::string& FWPFEcalRecHitRPProxyBuilder::view ( ) const
inline

Member Data Documentation

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

Definition at line 61 of file FWPFEcalRecHitRPProxyBuilder.h.

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