CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected 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 ()
 
 FWPFEcalRecHitLegoProxyBuilder (const FWPFEcalRecHitLegoProxyBuilder &)=delete
 
float getMaxVal (bool et) const
 
float getMaxValLog (bool et) const
 
bool havePerViewProduct (FWViewType::EType) const override
 
const FWPFEcalRecHitLegoProxyBuilderoperator= (const FWPFEcalRecHitLegoProxyBuilder &)=delete
 
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 (const FWProxyBuilderTemplate &)=delete
 
const FWProxyBuilderTemplateoperator= (const FWProxyBuilderTemplate &)=delete
 
 ~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 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

◆ ~FWPFEcalRecHitLegoProxyBuilder()

FWPFEcalRecHitLegoProxyBuilder::~FWPFEcalRecHitLegoProxyBuilder ( )
inlineoverride

Definition at line 40 of file FWPFEcalRecHitLegoProxyBuilder.h.

40 {}

◆ FWPFEcalRecHitLegoProxyBuilder() [2/2]

FWPFEcalRecHitLegoProxyBuilder::FWPFEcalRecHitLegoProxyBuilder ( const FWPFEcalRecHitLegoProxyBuilder )
delete

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.

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

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 }
const double Pi
size_t size() const
Definition: FWEventItem.cc:457
cv
Definition: cuy.py:363
const fireworks::Context & context() const
const EcalRecHit & modelData(int index)
void scaleProduct(TEveElementList *parent, FWViewType::EType, const FWViewContext *vc) override
TEveVector calculateCentre(const std::vector< TEveVector > &corners) const
const float * getCorners(unsigned int id) const
Definition: FWGeometry.cc:439
void voteMaxEtAndEnergy(float Et, float energy) const
Definition: Context.cc:162
float calculateEt(const TEveVector &centre, float e)
Definition: FWPFMaths.cc:115
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
TEveCompound * createCompound(bool set_color=true, bool propagate_color_to_all_children=false) const
const DetId & detid() const
Definition: EcalRecHit.h:72
float energy() const
Definition: EcalRecHit.h:68
const FWEventItem * item() const
std::vector< FWPFLegoRecHit * > m_recHits

◆ calculateCentre()

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

Definition at line 37 of file FWPFEcalRecHitLegoProxyBuilder.cc.

References mps_fire::i.

Referenced by build().

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 }

◆ 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.

References mps_fire::i, and m_recHits.

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 }
std::vector< FWPFLegoRecHit * > m_recHits

◆ getMaxVal()

float FWPFEcalRecHitLegoProxyBuilder::getMaxVal ( bool  et) const
inline

◆ getMaxValLog()

float FWPFEcalRecHitLegoProxyBuilder::getMaxValLog ( bool  et) const
inline

◆ 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.

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

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 }
int index() const
Definition: FWModelId.h:41
const FWEventItem * item() const

◆ operator=()

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

◆ 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.

References b, FWViewContext::getEnergyScale(), getMaxVal(), getMaxValLog(), FWViewEnergyScale::getPlotEt(), mps_fire::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) { // 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 }
bool getPlotEt() const
FWViewEnergyScale * getEnergyScale() const
double b
Definition: hdecay.h:118
std::vector< FWPFLegoRecHit * > m_recHits

◆ 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 73 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

◆ m_maxEnergyLog

float FWPFEcalRecHitLegoProxyBuilder::m_maxEnergyLog
private

Definition at line 75 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

◆ m_maxEt

float FWPFEcalRecHitLegoProxyBuilder::m_maxEt
private

Definition at line 74 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxVal().

◆ m_maxEtLog

float FWPFEcalRecHitLegoProxyBuilder::m_maxEtLog
private

Definition at line 76 of file FWPFEcalRecHitLegoProxyBuilder.h.

Referenced by build(), and getMaxValLog().

◆ m_recHits

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

Definition at line 77 of file FWPFEcalRecHitLegoProxyBuilder.h.

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