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() [1/2]

FWPFEcalRecHitLegoProxyBuilder::FWPFEcalRecHitLegoProxyBuilder ( )
inline

Definition at line 39 of file FWPFEcalRecHitLegoProxyBuilder.h.

39 : m_maxEnergy(0), m_maxEt(0), m_maxEnergyLog(0), m_maxEtLog(0) {}

◆ ~FWPFEcalRecHitLegoProxyBuilder()

FWPFEcalRecHitLegoProxyBuilder::~FWPFEcalRecHitLegoProxyBuilder ( )
inlineoverride

Definition at line 40 of file FWPFEcalRecHitLegoProxyBuilder.h.

40 {}

◆ FWPFEcalRecHitLegoProxyBuilder() [2/2]

FWPFEcalRecHitLegoProxyBuilder::FWPFEcalRecHitLegoProxyBuilder ( const FWPFEcalRecHitLegoProxyBuilder )
privatedelete

Member Function Documentation

◆ build()

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

Reimplemented from FWProxyBuilderBase.

Definition at line 51 of file FWPFEcalRecHitLegoProxyBuilder.cc.

53  {
54  size_t itemSize = iItem->size(); //cache size
55 
56  for (size_t index = 0; index < itemSize; ++index) {
57  TEveCompound *itemHolder = createCompound();
58  product->AddElement(itemHolder);
59 
60  const EcalRecHit &iData = modelData(index);
61  const float *corners = item()->getGeom()->getCorners(iData.detid());
62  float energy, et;
63  std::vector<TEveVector> etaphiCorners(8);
64  TEveVector centre;
65 
66  if (corners == nullptr)
67  continue;
68 
69  int k = 3;
70  for (int i = 0; i < 4; ++i) {
71  int j = k * 3;
72  TEveVector cv = TEveVector(corners[j], corners[j + 1], corners[j + 2]);
73  etaphiCorners[i].fX = cv.Eta(); // Conversion of rechit X/Y values for plotting in Eta/Phi
74  etaphiCorners[i].fY = cv.Phi();
75  etaphiCorners[i].fZ = 0.0;
76 
77  etaphiCorners[i + 4].fX =
78  etaphiCorners[i].fX; // Top can simply be plotted exactly over the top of the bottom face
79  etaphiCorners[i + 4].fY = etaphiCorners[i].fY;
80  etaphiCorners[i + 4].fZ = 0.001;
81  // printf("%f %f %d \n", etaphiCorners[i].fX, etaphiCorners[i].fY, i);
82  --k;
83  }
84 
85  centre = calculateCentre(etaphiCorners);
86  energy = iData.energy();
87  et = FWPFMaths::calculateEt(centre, energy);
89 
90  if (energy > m_maxEnergy)
92  if (energy > m_maxEt)
93  m_maxEt = et;
94 
95  // Stop phi wrap
96  float dPhi1 = etaphiCorners[2].fY - etaphiCorners[1].fY;
97  float dPhi2 = etaphiCorners[3].fY - etaphiCorners[0].fY;
98  float dPhi3 = etaphiCorners[1].fY - etaphiCorners[2].fY;
99  float dPhi4 = etaphiCorners[0].fY - etaphiCorners[3].fY;
100 
101  if (dPhi1 > 1)
102  etaphiCorners[2].fY = etaphiCorners[2].fY - (2 * TMath::Pi());
103  if (dPhi2 > 1)
104  etaphiCorners[3].fY = etaphiCorners[3].fY - (2 * TMath::Pi());
105  if (dPhi3 > 1)
106  etaphiCorners[2].fY = etaphiCorners[2].fY + (2 * TMath::Pi());
107  if (dPhi4 > 1)
108  etaphiCorners[3].fY = etaphiCorners[3].fY + (2 * TMath::Pi());
109 
110  FWPFLegoRecHit *recHit = new FWPFLegoRecHit(etaphiCorners, itemHolder, this, vc, energy, et);
111  recHit->setSquareColor(item()->defaultDisplayProperties().color());
112  m_recHits.push_back(recHit);
113  }
114 
117 
119 }

References calculateCentre(), FWPFMaths::calculateEt(), FWProxyBuilderBase::context(), FWProxyBuilderBase::createCompound(), cuy::cv, EcalRecHit::detid(), HCALHighEnergyHPDFilter_cfi::energy, EcalRecHit::energy(), EgHLTOffHistBins_cfi::et, FWGeometry::getCorners(), FWEventItem::getGeom(), mps_fire::i, FWProxyBuilderBase::item(), dqmiolumiharvest::j, dqmdumpme::k, FWViewType::kLegoPFECAL, dqm-mbProfile::log, m_maxEnergy, m_maxEnergyLog, m_maxEt, m_maxEtLog, m_recHits, FWProxyBuilderTemplate< EcalRecHit >::modelData(), Pi, rpcPointValidation_cfi::recHit, scaleProduct(), FWEventItem::size(), and fireworks::Context::voteMaxEtAndEnergy().

◆ calculateCentre()

TEveVector FWPFEcalRecHitLegoProxyBuilder::calculateCentre ( const std::vector< TEveVector > &  corners) const

Definition at line 37 of file FWPFEcalRecHitLegoProxyBuilder.cc.

37  {
38  TEveVector centre;
39 
40  for (size_t i = 0; i < corners.size(); ++i) {
41  centre.fX += corners[i].fX;
42  centre.fY += corners[i].fY; // Get total for x,y,z values
43  centre.fZ += corners[i].fZ;
44  }
45  centre *= 1.f / 8.f;
46 
47  return centre;
48 }

References mps_fire::i.

Referenced by build().

◆ classPurpose()

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

Definition at line 130 of file FWPFEcalRecHitLegoProxyBuilder.cc.

◆ classRegisterTypeName()

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

Definition at line 130 of file FWPFEcalRecHitLegoProxyBuilder.cc.

◆ classTypeName()

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

Definition at line 130 of file FWPFEcalRecHitLegoProxyBuilder.cc.

◆ classView()

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

Definition at line 130 of file FWPFEcalRecHitLegoProxyBuilder.cc.

◆ cleanLocal()

void FWPFEcalRecHitLegoProxyBuilder::cleanLocal ( )
overridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 122 of file FWPFEcalRecHitLegoProxyBuilder.cc.

122  {
123  for (std::vector<FWPFLegoRecHit *>::iterator i = m_recHits.begin(); i != m_recHits.end(); ++i)
124  delete (*i);
125 
126  m_recHits.clear();
127 }

References mps_fire::i, and m_recHits.

◆ getMaxVal()

float FWPFEcalRecHitLegoProxyBuilder::getMaxVal ( bool  et) const
inline

Definition at line 54 of file FWPFEcalRecHitLegoProxyBuilder.h.

54 { return et ? m_maxEt : m_maxEnergy; }

References EgHLTOffHistBins_cfi::et, m_maxEnergy, and m_maxEt.

Referenced by scaleProduct().

◆ getMaxValLog()

float FWPFEcalRecHitLegoProxyBuilder::getMaxValLog ( bool  et) const
inline

Definition at line 53 of file FWPFEcalRecHitLegoProxyBuilder.h.

53 { return et ? m_maxEtLog : m_maxEnergyLog; }

References EgHLTOffHistBins_cfi::et, m_maxEnergyLog, and m_maxEtLog.

Referenced by scaleProduct().

◆ havePerViewProduct()

bool FWPFEcalRecHitLegoProxyBuilder::havePerViewProduct ( FWViewType::EType  ) const
inlineoverridevirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 48 of file FWPFEcalRecHitLegoProxyBuilder.h.

48 { return true; }

◆ localModelChanges()

void FWPFEcalRecHitLegoProxyBuilder::localModelChanges ( const FWModelId iId,
TEveElement *  iCompound,
FWViewType::EType  viewType,
const FWViewContext vc 
)
overrideprotectedvirtual

Reimplemented from FWProxyBuilderBase.

Definition at line 22 of file FWPFEcalRecHitLegoProxyBuilder.cc.

25  {
26  for (TEveElement::List_i i = parent->BeginChildren(); i != parent->EndChildren(); ++i) {
27  {
28  TEveStraightLineSet *line = dynamic_cast<TEveStraightLineSet *>(*i);
29  if (line) {
30  line->SetMarkerColor(item()->modelInfo(iId.index()).displayProperties().color());
31  }
32  }
33  }
34 }

References mps_fire::i, FWModelId::index(), FWProxyBuilderBase::item(), mps_splice::line, and class-composition::parent.

◆ operator=()

const FWPFEcalRecHitLegoProxyBuilder& FWPFEcalRecHitLegoProxyBuilder::operator= ( const FWPFEcalRecHitLegoProxyBuilder )
privatedelete

◆ purpose()

const std::string& FWPFEcalRecHitLegoProxyBuilder::purpose ( ) const
inline

Definition at line 56 of file FWPFEcalRecHitLegoProxyBuilder.h.

58 :
59  // --------------------- Member Functions --------------------------

◆ scaleProduct()

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

Reimplemented from FWProxyBuilderBase.

Definition at line 4 of file FWPFEcalRecHitLegoProxyBuilder.cc.

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) { // Tallest tower needs deciding still
14  if ((*i)->isTallest() == false && (*i)->getEtEnergy(b) == maxVal)
15  (*i)->setIsTallest(true);
16 
17  (*i)->updateScale(vc, getMaxValLog(caloScale->getPlotEt()));
18  }
19 }

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

Referenced by build().

◆ typeName()

const std::string& FWPFEcalRecHitLegoProxyBuilder::typeName ( ) const
inline

Definition at line 56 of file FWPFEcalRecHitLegoProxyBuilder.h.

58 :
59  // --------------------- Member Functions --------------------------

◆ typeOfBuilder()

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

Definition at line 42 of file FWPFEcalRecHitLegoProxyBuilder.h.

42 { return "simple#"; }

◆ view()

const std::string& FWPFEcalRecHitLegoProxyBuilder::view ( ) const
inline

Definition at line 56 of file FWPFEcalRecHitLegoProxyBuilder.h.

58 :
59  // --------------------- Member Functions --------------------------

Member Data Documentation

◆ m_maxEnergy

float FWPFEcalRecHitLegoProxyBuilder::m_maxEnergy
private

Definition at line 72 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

◆ m_maxEnergyLog

float FWPFEcalRecHitLegoProxyBuilder::m_maxEnergyLog
private

Definition at line 74 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

◆ m_maxEt

float FWPFEcalRecHitLegoProxyBuilder::m_maxEt
private

Definition at line 73 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

◆ m_maxEtLog

float FWPFEcalRecHitLegoProxyBuilder::m_maxEtLog
private

Definition at line 75 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

◆ m_recHits

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

Definition at line 76 of file FWPFEcalRecHitLegoProxyBuilder.h.

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

EcalRecHit
Definition: EcalRecHit.h:15
mps_fire.i
i
Definition: mps_fire.py:428
EcalRecHit::detid
const DetId & detid() const
Definition: EcalRecHit.h:72
FWGeometry::getCorners
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:467
FWPFEcalRecHitLegoProxyBuilder::getMaxValLog
float getMaxValLog(bool et) const
Definition: FWPFEcalRecHitLegoProxyBuilder.h:53
cuy.cv
cv
Definition: cuy.py:363
FWPFEcalRecHitLegoProxyBuilder::m_maxEnergy
float m_maxEnergy
Definition: FWPFEcalRecHitLegoProxyBuilder.h:72
FWPFEcalRecHitLegoProxyBuilder::m_recHits
std::vector< FWPFLegoRecHit * > m_recHits
Definition: FWPFEcalRecHitLegoProxyBuilder.h:76
FWPFEcalRecHitLegoProxyBuilder::m_maxEnergyLog
float m_maxEnergyLog
Definition: FWPFEcalRecHitLegoProxyBuilder.h:74
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
FWPFEcalRecHitLegoProxyBuilder::scaleProduct
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
Definition: FWPFEcalRecHitLegoProxyBuilder.cc:4
FWPFEcalRecHitLegoProxyBuilder::calculateCentre
TEveVector calculateCentre(const std::vector< TEveVector > &corners) const
Definition: FWPFEcalRecHitLegoProxyBuilder.cc:37
EcalRecHit::energy
float energy() const
Definition: EcalRecHit.h:68
FWProxyBuilderBase::createCompound
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
Definition: FWProxyBuilderBase.cc:374
rpcPointValidation_cfi.recHit
recHit
Definition: rpcPointValidation_cfi.py:7
FWPFMaths::calculateEt
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
FWPFEcalRecHitLegoProxyBuilder::getMaxVal
float getMaxVal(bool et) const
Definition: FWPFEcalRecHitLegoProxyBuilder.h:54
fireworks::Context::voteMaxEtAndEnergy
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
FWViewType::kLegoPFECAL
Definition: FWViewType.h:43
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
dqmdumpme.k
k
Definition: dqmdumpme.py:60
FWModelId::index
int index() const
Definition: FWModelId.h:41
b
double b
Definition: hdecay.h:118
FWPFLegoRecHit
Definition: FWPFLegoRecHit.h:34
FWPFEcalRecHitLegoProxyBuilder::m_maxEt
float m_maxEt
Definition: FWPFEcalRecHitLegoProxyBuilder.h:73
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWPFEcalRecHitLegoProxyBuilder::m_maxEtLog
float m_maxEtLog
Definition: FWPFEcalRecHitLegoProxyBuilder.h:75
FWProxyBuilderTemplate< EcalRecHit >::modelData
const EcalRecHit & modelData(int index)
Definition: FWProxyBuilderTemplate.h:42
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
FWProxyBuilderBase::context
const fireworks::Context & context() const
Definition: FWProxyBuilderBase.cc:412
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
mps_splice.line
line
Definition: mps_splice.py:76
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
class-composition.parent
parent
Definition: class-composition.py:98
FWEventItem::size
size_t size() const
Definition: FWEventItem.cc:457