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 | Protected Member Functions | Private Member Functions | Private Attributes
FWPFEcalRecHitLegoProxyBuilder Class Reference

#include <FWPFEcalRecHitLegoProxyBuilder.h>

Inheritance diagram for FWPFEcalRecHitLegoProxyBuilder:
FWProxyBuilderTemplate< EcalRecHit > FWProxyBuilderBase

Public Member Functions

virtual void build (const FWEventItem *iItem, TEveElementList *product, const FWViewContext *)
 
TEveVector calculateCentre (const std::vector< TEveVector > &corners) const
 
virtual void cleanLocal ()
 
 FWPFEcalRecHitLegoProxyBuilder ()
 
float getMaxVal (bool et) const
 
float getMaxValLog (bool et) const
 
virtual bool havePerViewProduct (FWViewType::EType) const
 
const std::string & purpose () const
 
virtual void scaleProduct (TEveElementList *parent, FWViewType::EType, const FWViewContext *vc)
 
const std::string & typeName () const
 
const std::string & view () const
 
virtual ~FWPFEcalRecHitLegoProxyBuilder ()
 
- 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 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

virtual void localModelChanges (const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc)
 
- 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 &)
 
const
FWPFEcalRecHitLegoProxyBuilder
operator= (const FWPFEcalRecHitLegoProxyBuilder &)
 

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
virtual FWPFEcalRecHitLegoProxyBuilder::~FWPFEcalRecHitLegoProxyBuilder ( )
inlinevirtual

Definition at line 41 of file FWPFEcalRecHitLegoProxyBuilder.h.

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

Member Function Documentation

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

Reimplemented from FWProxyBuilderBase.

Definition at line 59 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References calculateCentre(), FWPFMaths::calculateEt(), create_public_lumi_plots::color, FWProxyBuilderBase::context(), FWProxyBuilderBase::createCompound(), cuy::cv, EcalRecHit::detid(), relval_parameters_module::energy, EcalRecHit::energy(), FWGeometry::getCorners(), FWEventItem::getGeom(), i, cmsHarvester::index, FWProxyBuilderBase::item(), j, relval_2017::k, FWViewType::kLegoPFECAL, dqm-mbProfile::log, m_maxEnergy, m_maxEnergyLog, m_maxEt, m_maxEtLog, m_recHits, FWProxyBuilderTemplate< EcalRecHit >::modelData(), Pi, scaleProduct(), FWPFLegoRecHit::setSquareColor(), FWEventItem::size(), and fireworks::Context::voteMaxEtAndEnergy().

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

Definition at line 42 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References i.

Referenced by build().

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

Definition at line 140 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 140 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 140 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Definition at line 140 of file FWPFEcalRecHitLegoProxyBuilder.cc.

void FWPFEcalRecHitLegoProxyBuilder::cleanLocal ( )
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 131 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References i, and m_recHits.

132 {
133  for( std::vector<FWPFLegoRecHit*>::iterator i = m_recHits.begin(); i != m_recHits.end(); ++i )
134  delete (*i);
135 
136  m_recHits.clear();
137 }
int i
Definition: DBlmapReader.cc:9
std::vector< FWPFLegoRecHit * > m_recHits
float FWPFEcalRecHitLegoProxyBuilder::getMaxVal ( bool  et) const
inline
float FWPFEcalRecHitLegoProxyBuilder::getMaxValLog ( bool  et) const
inline
virtual bool FWPFEcalRecHitLegoProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlinevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 49 of file FWPFEcalRecHitLegoProxyBuilder.h.

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

Reimplemented from FWProxyBuilderBase.

Definition at line 24 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References FWDisplayProperties::color(), i, FWModelId::index(), FWProxyBuilderBase::item(), geometryCSVtoXML::line, FWEventItem::modelInfo(), and AlCaHLTBitMon_ParallelJobs::p.

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  const FWDisplayProperties &p = item()->modelInfo( iId.index() ).displayProperties();
34  line->SetMarkerColor( p.color() );
35  }
36  }
37  }
38 }
int i
Definition: DBlmapReader.cc:9
const FWEventItem * item() const
Color_t color() const
int index() const
Definition: FWModelId.h:49
ModelInfo modelInfo(int iIndex) const
Definition: FWEventItem.cc:535
const FWPFEcalRecHitLegoProxyBuilder& FWPFEcalRecHitLegoProxyBuilder::operator= ( const FWPFEcalRecHitLegoProxyBuilder )
private
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 
)
virtual

Reimplemented from FWProxyBuilderBase.

Definition at line 5 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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

Referenced by build().

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 }
int i
Definition: DBlmapReader.cc:9
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.

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().