CMS 3D CMS Logo

FWPFEcalRecHitLegoProxyBuilder.cc
Go to the documentation of this file.
2 
3 //______________________________________________________________________________
6  const FWViewContext *vc) {
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 }
20 
21 //______________________________________________________________________________
23  TEveElement *parent,
24  FWViewType::EType viewType,
25  const FWViewContext *vc) {
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 }
35 
36 //______________________________________________________________________________
37 TEveVector FWPFEcalRecHitLegoProxyBuilder::calculateCentre(const std::vector<TEveVector> &corners) const {
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 }
49 
50 //______________________________________________________________________________
52  TEveElementList *product,
53  const FWViewContext *vc) {
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 }
120 
121 //______________________________________________________________________________
123  for (std::vector<FWPFLegoRecHit *>::iterator i = m_recHits.begin(); i != m_recHits.end(); ++i)
124  delete (*i);
125 
126  m_recHits.clear();
127 }
128 
129 //______________________________________________________________________________
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
FWViewType::EType
EType
Definition: FWViewType.h:31
FWPFEcalRecHitLegoProxyBuilder::getMaxValLog
float getMaxValLog(bool et) const
Definition: FWPFEcalRecHitLegoProxyBuilder.h:53
cuy.cv
cv
Definition: cuy.py:363
REGISTER_FWPROXYBUILDER
#define REGISTER_FWPROXYBUILDER(_name_, _type_, _purpose_, _view_)
Definition: FWProxyBuilderFactory.h:33
FWModelId
Definition: FWModelId.h:28
FWPFEcalRecHitLegoProxyBuilder::m_maxEnergy
float m_maxEnergy
Definition: FWPFEcalRecHitLegoProxyBuilder.h:72
FWViewType::kLegoPFECALBit
Definition: FWViewType.h:57
FWPFEcalRecHitLegoProxyBuilder::m_recHits
std::vector< FWPFLegoRecHit * > m_recHits
Definition: FWPFEcalRecHitLegoProxyBuilder.h:76
FWPFEcalRecHitLegoProxyBuilder::m_maxEnergyLog
float m_maxEnergyLog
Definition: FWPFEcalRecHitLegoProxyBuilder.h:74
FWPFEcalRecHitLegoProxyBuilder::cleanLocal
void cleanLocal() override
Definition: FWPFEcalRecHitLegoProxyBuilder.cc:122
FWPFEcalRecHitLegoProxyBuilder::localModelChanges
void localModelChanges(const FWModelId &iId, TEveElement *iCompound, FWViewType::EType viewType, const FWViewContext *vc) override
Definition: FWPFEcalRecHitLegoProxyBuilder.cc:22
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
FWPFEcalRecHitLegoProxyBuilder.h
FWModelId::index
int index() const
Definition: FWModelId.h:41
b
double b
Definition: hdecay.h:118
type
type
Definition: SiPixelVCal_PayloadInspector.cc:39
FWPFLegoRecHit
Definition: FWPFLegoRecHit.h:34
FWPFEcalRecHitLegoProxyBuilder::m_maxEt
float m_maxEt
Definition: FWPFEcalRecHitLegoProxyBuilder.h:73
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
FWPFEcalRecHitLegoProxyBuilder
Definition: FWPFEcalRecHitLegoProxyBuilder.h:36
FWProxyBuilderBase::build
void build()
Definition: FWProxyBuilderBase.cc:110
FWViewContext
Definition: FWViewContext.h:32
FWEventItem::getGeom
const FWGeometry * getGeom() const
Definition: FWEventItem.cc:548
FWProxyBuilderBase::item
const FWEventItem * item() const
Definition: FWProxyBuilderBase.h:64
FWEventItem
Definition: FWEventItem.h:56
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