CMS 3D CMS Logo

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

#include <FWPFEcalRecHitLegoProxyBuilder.h>

Inheritance diagram for FWPFEcalRecHitLegoProxyBuilder:
FWProxyBuilderTemplate< EcalRecHit > FWProxyBuilderBase

Public Member Functions

void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *) override
 
TEveVector calculateCentre (const std::vector< TEveVector > &corners) const
 
void cleanLocal () override
 
 FWPFEcalRecHitLegoProxyBuilder ()
 
float getMaxVal (bool et) const
 
float getMaxValLog (bool et) const
 
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
 
 ~FWPFEcalRecHitLegoProxyBuilder () 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...
 

Protected Member Functions

void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
 
- 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 modelChanges (const FWModelIds &, Product *)
 
const FWProxyBuilderBaseoperator= (const FWProxyBuilderBase &)
 
virtual bool visibilityModelChanges (const FWModelId &, TEveElement *, FWViewType::EType, const FWViewContext *)
 

Private Member Functions

 FWPFEcalRecHitLegoProxyBuilder (const FWPFEcalRecHitLegoProxyBuilder &)=delete
 
const FWPFEcalRecHitLegoProxyBuilderoperator= (const FWPFEcalRecHitLegoProxyBuilder &)=delete
 

Private Attributes

float m_maxEnergy
 
float m_maxEnergyLog
 
float m_maxEt
 
float m_maxEtLog
 
std::vector< FWPFLegoRecHit * > m_recHits
 

Additional Inherited Members

- Protected Types inherited from FWProxyBuilderBase
typedef std::vector< Product * >::iterator Product_it
 
- Protected Attributes inherited from FWProxyBuilderBase
std::vector< Product * > m_products
 

Detailed Description

Definition at line 36 of file FWPFEcalRecHitLegoProxyBuilder.h.

Constructor & Destructor Documentation

FWPFEcalRecHitLegoProxyBuilder::FWPFEcalRecHitLegoProxyBuilder ( )
inline
FWPFEcalRecHitLegoProxyBuilder::~FWPFEcalRecHitLegoProxyBuilder ( )
inlineoverride

Definition at line 41 of file FWPFEcalRecHitLegoProxyBuilder.h.

41 {}
FWPFEcalRecHitLegoProxyBuilder::FWPFEcalRecHitLegoProxyBuilder ( const FWPFEcalRecHitLegoProxyBuilder )
privatedelete

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 58 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References calculateCentre(), FWPFMaths::calculateEt(), create_public_lumi_plots::color, FWProxyBuilderBase::context(), FWProxyBuilderBase::createCompound(), cuy::cv, EcalRecHit::detid(), EcalRecHit::energy(), stringResolutionProvider_cfi::et, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, FWProxyBuilderBase::item(), gen::k, FWViewType::kLegoPFECAL, cmsBatch::log, m_maxEnergy, m_maxEnergyLog, m_maxEt, m_maxEtLog, m_recHits, FWProxyBuilderTemplate< EcalRecHit >::modelData(), Pi, rpcPointValidation_cfi::recHit, scaleProduct(), FWPFLegoRecHit::setSquareColor(), FWEventItem::size(), and fireworks::Context::voteMaxEtAndEnergy().

59 {
60  size_t itemSize = iItem->size(); //cache size
61 
62  for( size_t index = 0; index < itemSize; ++index )
63  {
64  TEveCompound *itemHolder = createCompound();
65  product->AddElement( itemHolder );
66 
67  const EcalRecHit &iData = modelData( index );
68  const float *corners = item()->getGeom()->getCorners( iData.detid() );
69  float energy, et;
70  std::vector<TEveVector> etaphiCorners(8);
71  TEveVector centre;
72 
73  if( corners == nullptr )
74  continue;
75 
76  int k = 3;
77  for( int i = 0; i < 4; ++i )
78  {
79  int j = k * 3;
80  TEveVector cv = TEveVector( corners[j], corners[j+1], corners[j+2] );
81  etaphiCorners[i].fX = cv.Eta(); // Conversion of rechit X/Y values for plotting in Eta/Phi
82  etaphiCorners[i].fY = cv.Phi();
83  etaphiCorners[i].fZ = 0.0;
84 
85  etaphiCorners[i+4].fX = etaphiCorners[i].fX; // Top can simply be plotted exactly over the top of the bottom face
86  etaphiCorners[i+4].fY = etaphiCorners[i].fY;
87  etaphiCorners[i+4].fZ = 0.001;
88  // printf("%f %f %d \n", etaphiCorners[i].fX, etaphiCorners[i].fY, i);
89  --k;
90  }
91 
92  centre = calculateCentre( etaphiCorners );
93  energy = iData.energy();
94  et = FWPFMaths::calculateEt( centre, energy );
95  context().voteMaxEtAndEnergy( et, energy );
96 
97  if( energy > m_maxEnergy )
98  m_maxEnergy = energy;
99  if( energy > m_maxEt )
100  m_maxEt = et;
101 
102  // Stop phi wrap
103  float dPhi1 = etaphiCorners[2].fY - etaphiCorners[1].fY;
104  float dPhi2 = etaphiCorners[3].fY - etaphiCorners[0].fY;
105  float dPhi3 = etaphiCorners[1].fY - etaphiCorners[2].fY;
106  float dPhi4 = etaphiCorners[0].fY - etaphiCorners[3].fY;
107 
108  if( dPhi1 > 1 )
109  etaphiCorners[2].fY = etaphiCorners[2].fY - ( 2 * TMath::Pi() );
110  if( dPhi2 > 1 )
111  etaphiCorners[3].fY = etaphiCorners[3].fY - ( 2 * TMath::Pi() );
112  if( dPhi3 > 1 )
113  etaphiCorners[2].fY = etaphiCorners[2].fY + ( 2 * TMath::Pi() );
114  if( dPhi4 > 1 )
115  etaphiCorners[3].fY = etaphiCorners[3].fY + ( 2 * TMath::Pi() );
116 
117  FWPFLegoRecHit *recHit = new FWPFLegoRecHit( etaphiCorners, itemHolder, this, vc, energy, et );
118  recHit->setSquareColor( item()->defaultDisplayProperties().color() );
119  m_recHits.push_back( recHit );
120  }
121 
123  m_maxEtLog = log( m_maxEt );
124 
125  scaleProduct( product, FWViewType::kLegoPFECAL, vc );
126 }
const double Pi
const fireworks::Context & context() const
TEveVector calculateCentre(const std::vector< TEveVector > &corners) const
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:183
const DetId & detid() const
Definition: EcalRecHit.h:72
cv
Definition: cuy.py:364
const FWEventItem * item() const
const EcalRecHit & modelData(int index)
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
float energy() const
Definition: EcalRecHit.h:68
void setSquareColor(Color_t c)
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
int k[5][pyjets_maxn]
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:430
size_t size() const
Definition: FWEventItem.cc:553
et
define resolution functions of each parameter
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
std::vector< FWPFLegoRecHit * > m_recHits
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:686
TEveVector FWPFEcalRecHitLegoProxyBuilder::calculateCentre ( const std::vector< TEveVector > &  corners) const

Definition at line 41 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References mps_fire::i.

Referenced by build(), and havePerViewProduct().

42 {
43  TEveVector centre;
44 
45  for( size_t i = 0; i < corners.size(); ++i )
46  {
47  centre.fX += corners[i].fX;
48  centre.fY += corners[i].fY; // Get total for x,y,z values
49  centre.fZ += corners[i].fZ;
50  }
51  centre *= 1.f / 8.f;
52 
53  return centre;
54 }
const std::string & FWPFEcalRecHitLegoProxyBuilder::classPurpose ( )
static

Definition at line 139 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 139 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 139 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 139 of file FWPFEcalRecHitLegoProxyBuilder.cc.

void FWPFEcalRecHitLegoProxyBuilder::cleanLocal ( )
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 130 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References mps_fire::i, and m_recHits.

Referenced by havePerViewProduct().

131 {
132  for( std::vector<FWPFLegoRecHit*>::iterator i = m_recHits.begin(); i != m_recHits.end(); ++i )
133  delete (*i);
134 
135  m_recHits.clear();
136 }
std::vector< FWPFLegoRecHit * > m_recHits
float FWPFEcalRecHitLegoProxyBuilder::getMaxVal ( bool  et) const
inline

Definition at line 55 of file FWPFEcalRecHitLegoProxyBuilder.h.

References m_maxEnergy, and m_maxEt.

Referenced by scaleProduct().

float FWPFEcalRecHitLegoProxyBuilder::getMaxValLog ( bool  et) const
inline
bool FWPFEcalRecHitLegoProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 49 of file FWPFEcalRecHitLegoProxyBuilder.h.

References calculateCentre(), and cleanLocal().

49 { return true; }
void FWPFEcalRecHitLegoProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 24 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References mps_fire::i, FWModelId::index(), FWProxyBuilderBase::item(), and mps_splice::line.

26 {
27  for (TEveElement::List_i i = parent->BeginChildren(); i!= parent->EndChildren(); ++i)
28  {
29  {
30  TEveStraightLineSet* line = dynamic_cast<TEveStraightLineSet*>(*i);
31  if (line)
32  {
33  line->SetMarkerColor( item()->modelInfo( iId.index() ).displayProperties().color() );
34  }
35  }
36  }
37 }
const FWEventItem * item() const
int index() const
Definition: FWModelId.h:49
const FWPFEcalRecHitLegoProxyBuilder& FWPFEcalRecHitLegoProxyBuilder::operator= ( const FWPFEcalRecHitLegoProxyBuilder )
privatedelete
const std::string& FWPFEcalRecHitLegoProxyBuilder::purpose ( ) const
inline

Definition at line 57 of file FWPFEcalRecHitLegoProxyBuilder.h.

59 :
60 
void FWPFEcalRecHitLegoProxyBuilder::scaleProduct ( TEveElementList *  parent,
FWViewType::EType  type,
const FWViewContext vc 
)
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 5 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References b, FWViewContext::getEnergyScale(), getMaxVal(), getMaxValLog(), FWViewEnergyScale::getPlotEt(), mps_fire::i, and m_recHits.

Referenced by build(), and typeOfBuilder().

6 {
7  FWViewEnergyScale *caloScale = vc->getEnergyScale();
8  bool b = caloScale->getPlotEt();
9  float maxVal = getMaxVal( b );
10  typedef std::vector<FWPFLegoRecHit*> rh;
11 
12  // printf("FWPFEcalRecHitLegoProxyBuilder::scaleProduct >> scale %f \n", caloScale->getValToHeight());
13  for( rh::iterator i = m_recHits.begin(); i != m_recHits.end(); ++i )
14  { // Tallest tower needs deciding still
15  if( (*i)->isTallest() == false && (*i)->getEtEnergy( b ) == maxVal )
16  (*i)->setIsTallest( true );
17 
18  (*i)->updateScale( vc, getMaxValLog(caloScale->getPlotEt()));
19  }
20 }
FWViewEnergyScale * getEnergyScale() const
double b
Definition: hdecay.h:120
std::vector< FWPFLegoRecHit * > m_recHits
bool getPlotEt() const
const std::string& FWPFEcalRecHitLegoProxyBuilder::typeName ( ) const
inline

Definition at line 57 of file FWPFEcalRecHitLegoProxyBuilder.h.

59 :
60 
static std::string FWPFEcalRecHitLegoProxyBuilder::typeOfBuilder ( )
inlinestatic

Definition at line 43 of file FWPFEcalRecHitLegoProxyBuilder.h.

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

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

Definition at line 57 of file FWPFEcalRecHitLegoProxyBuilder.h.

59 :
60 

Member Data Documentation

float FWPFEcalRecHitLegoProxyBuilder::m_maxEnergy
private

Definition at line 72 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

float FWPFEcalRecHitLegoProxyBuilder::m_maxEnergyLog
private

Definition at line 74 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

float FWPFEcalRecHitLegoProxyBuilder::m_maxEt
private

Definition at line 73 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

float FWPFEcalRecHitLegoProxyBuilder::m_maxEtLog
private

Definition at line 75 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

std::vector<FWPFLegoRecHit*> FWPFEcalRecHitLegoProxyBuilder::m_recHits
private

Definition at line 76 of file FWPFEcalRecHitLegoProxyBuilder.h.

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