CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWPFRhoPhiRecHit Class Reference

#include <FWPFRhoPhiRecHit.h>

Public Member Functions

void addChild (FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, float E, float et)
 
void buildRecHit (FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, std::vector< TEveVector > &bCorners)
 
void clean ()
 
 FWPFRhoPhiRecHit (FWProxyBuilderBase *pb, TEveElement *iH, const FWViewContext *vc, float E, float et, double lPhi, double rPhi, std::vector< TEveVector > &bCorners)
 
TEveScalableStraightLineSet * getLineSet ()
 
Double_t getlPhi ()
 
void setCorners (int i, TEveVector vec)
 
void setHasChild (bool b)
 
void updateScale (const FWViewContext *vc)
 
void updateScale (TEveScalableStraightLineSet *ls, Double_t scale, unsigned int i)
 
virtual ~FWPFRhoPhiRecHit ()
 

Private Member Functions

 FWPFRhoPhiRecHit (const FWPFRhoPhiRecHit &)
 
FWPFRhoPhiRecHitoperator= (const FWPFRhoPhiRecHit &)
 

Private Attributes

FWPFRhoPhiRecHitm_child
 
std::vector< TEveVector > m_corners
 
float m_energy
 
float m_et
 
bool m_hasChild
 
Double_t m_lPhi
 
TEveScalableStraightLineSet * m_ls
 
Double_t m_rPhi
 

Detailed Description

Definition at line 28 of file FWPFRhoPhiRecHit.h.

Constructor & Destructor Documentation

◆ FWPFRhoPhiRecHit() [1/2]

FWPFRhoPhiRecHit::FWPFRhoPhiRecHit ( FWProxyBuilderBase pb,
TEveElement *  iH,
const FWViewContext vc,
float  E,
float  et,
double  lPhi,
double  rPhi,
std::vector< TEveVector > &  bCorners 
)

Definition at line 4 of file FWPFRhoPhiRecHit.cc.

12  : m_hasChild(false), m_energy(E), m_et(et), m_lPhi(lPhi), m_rPhi(rPhi), m_child(nullptr) {
13  buildRecHit(pb, iH, vc, bCorners);
14 }

References buildRecHit().

Referenced by addChild().

◆ ~FWPFRhoPhiRecHit()

FWPFRhoPhiRecHit::~FWPFRhoPhiRecHit ( )
virtual

Definition at line 17 of file FWPFRhoPhiRecHit.cc.

17 {}

◆ FWPFRhoPhiRecHit() [2/2]

FWPFRhoPhiRecHit::FWPFRhoPhiRecHit ( const FWPFRhoPhiRecHit )
private

Member Function Documentation

◆ addChild()

void FWPFRhoPhiRecHit::addChild ( FWProxyBuilderBase pb,
TEveElement *  itemHolder,
const FWViewContext vc,
float  E,
float  et 
)

Definition at line 105 of file FWPFRhoPhiRecHit.cc.

106  {
107  if (m_hasChild) // Already has a child stacked on top so move on to child
108  m_child->addChild(pb, itemHolder, vc, E, et);
109  else {
110  std::vector<TEveVector> corners(2);
111  corners[0] = m_corners[2]; // Top left of current tower
112  corners[1] = m_corners[3]; // Top right of current tower
113  m_child = new FWPFRhoPhiRecHit(pb, itemHolder, vc, E, et, m_lPhi, m_rPhi, corners);
114  m_hasChild = true;
115  }
116 }

References addChild(), EgHLTOffHistBins_cfi::et, FWPFRhoPhiRecHit(), m_child, m_corners, m_hasChild, m_lPhi, and m_rPhi.

Referenced by addChild().

◆ buildRecHit()

void FWPFRhoPhiRecHit::buildRecHit ( FWProxyBuilderBase pb,
TEveElement *  itemHolder,
const FWViewContext vc,
std::vector< TEveVector > &  bCorners 
)

Definition at line 119 of file FWPFRhoPhiRecHit.cc.

122  {
123  float scale = 0;
124  float value = 0;
125  TEveVector v1, v2, v3, v4;
126  TEveVector vec;
127 
128  FWViewEnergyScale *caloScale = vc->getEnergyScale();
129  value = caloScale->getPlotEt() ? m_et : m_energy;
130  scale = caloScale->getScaleFactor3D() * value;
131 
132  v1 = bCorners[0]; // Bottom left
133  v2 = bCorners[1]; // Bottom right
134 
135  v3 = v1;
136  vec = v3;
137  vec.Normalize();
138  v3 = v3 + (vec * scale);
139 
140  v4 = v2;
141  vec = v4;
142  vec.Normalize();
143  v4 = v4 + (vec * scale);
144 
145  m_ls = new TEveScalableStraightLineSet("rhophiRecHit");
146  m_ls->AddLine(v1.fX, v1.fY, 0, v3.fX, v3.fY, 0); // Bottom left - Top left
147  m_ls->AddLine(v3.fX, v3.fY, 0, v4.fX, v4.fY, 0); // Top left - Top right
148  m_ls->AddLine(v4.fX, v4.fY, 0, v2.fX, v2.fY, 0); // Top right - Bottom right
149  m_ls->AddLine(v2.fX, v2.fY, 0, v1.fX, v1.fY, 0); // Bottom right - Bottom left
150 
151  m_corners.push_back(v1);
152  m_corners.push_back(v2);
153  m_corners.push_back(v3);
154  m_corners.push_back(v4);
155 
156  pb->setupAddElement(m_ls, itemHolder);
157 }

References FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), m_corners, m_energy, m_et, m_ls, Scenarios_cff::scale, FWProxyBuilderBase::setupAddElement(), and relativeConstraints::value.

Referenced by FWPFRhoPhiRecHit().

◆ clean()

void FWPFRhoPhiRecHit::clean ( )

Definition at line 96 of file FWPFRhoPhiRecHit.cc.

96  {
97  m_corners.clear();
98  if (m_hasChild)
99  m_child->clean();
100 
101  delete this;
102 }

References clean(), m_child, m_corners, and m_hasChild.

Referenced by clean().

◆ getLineSet()

TEveScalableStraightLineSet* FWPFRhoPhiRecHit::getLineSet ( )
inline

Definition at line 53 of file FWPFRhoPhiRecHit.h.

53 { return m_ls; }

References m_ls.

◆ getlPhi()

Double_t FWPFRhoPhiRecHit::getlPhi ( )
inline

Definition at line 52 of file FWPFRhoPhiRecHit.h.

52 { return m_lPhi; }

References m_lPhi.

◆ operator=()

FWPFRhoPhiRecHit& FWPFRhoPhiRecHit::operator= ( const FWPFRhoPhiRecHit )
private

◆ setCorners()

void FWPFRhoPhiRecHit::setCorners ( int  i,
TEveVector  vec 
)
inline

Definition at line 55 of file FWPFRhoPhiRecHit.h.

55 { m_corners[i] = vec; }

References mps_fire::i, and m_corners.

Referenced by updateScale().

◆ setHasChild()

void FWPFRhoPhiRecHit::setHasChild ( bool  b)
inline

Definition at line 54 of file FWPFRhoPhiRecHit.h.

54 { m_hasChild = b; }

References b, and m_hasChild.

◆ updateScale() [1/2]

void FWPFRhoPhiRecHit::updateScale ( const FWViewContext vc)

Definition at line 20 of file FWPFRhoPhiRecHit.cc.

20  {
21  FWViewEnergyScale *caloScale = vc->getEnergyScale();
22  float value = caloScale->getPlotEt() ? m_et : m_energy;
23  Double_t scale = caloScale->getScaleFactor3D() * value;
24  unsigned int a = 0;
25 
26  if (scale < 0.f)
27  scale *= -1.f;
28 
29  // Scale centres
30  TEveVector sc1 = m_corners[1];
31  TEveVector sc2 = m_corners[0];
32 
33  // Used to store normalized vectors
34  TEveVector v1 = sc1; // Bottom right corner
35  TEveVector v2 = sc2; // Bottom left corner
36 
37  v1.Normalize();
38  v2.Normalize();
39 
40  v1 *= scale; // Now at new height
41  v2 *= scale;
42 
43  // Get line parameters and scale coordinates
44  TEveChunkManager::iterator li(m_ls->GetLinePlex());
45  while (li.next()) {
46  TEveStraightLineSet::Line_t &l = *(TEveStraightLineSet::Line_t *)li();
47  switch (a) {
48  case 0:
49  // Left side of tower first
50  l.fV1[0] = sc2.fX;
51  l.fV1[1] = sc2.fY;
52  l.fV2[0] = sc2.fX + v2.fX;
53  l.fV2[1] = sc2.fY + v2.fY;
54  break;
55 
56  case 1:
57  // Top of tower
58  l.fV1[0] = sc2.fX + v2.fX;
59  l.fV1[1] = sc2.fY + v2.fY;
60  l.fV2[0] = sc1.fX + v1.fX;
61  l.fV2[1] = sc1.fY + v1.fY;
62  break;
63 
64  case 2:
65  // Right hand side of tower
66  l.fV1[0] = sc1.fX + v1.fX;
67  l.fV1[1] = sc1.fY + v1.fY;
68  l.fV2[0] = sc1.fX;
69  l.fV2[1] = sc1.fY;
70  break;
71 
72  case 3:
73  // Bottom of tower
74  l.fV1[0] = sc1.fX;
75  l.fV1[1] = sc1.fY;
76  l.fV2[0] = sc2.fX;
77  l.fV2[1] = sc2.fY;
78  break;
79  }
80  a++;
81  }
82  TEveProjected *proj = *(m_ls)->BeginProjecteds();
83  proj->UpdateProjection();
84 
85  m_corners[2] = sc2 + v2; // New top left of tower
86  m_corners[3] = sc1 + v1; // New top right of tower
87 
88  if (m_hasChild) {
90  m_child->setCorners(1, m_corners[3]); // Base of child is now top of parent
91  m_child->updateScale(vc);
92  }
93 }

References a, f, FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactor3D(), cmsLHEtoEOSManager::l, m_child, m_corners, m_energy, m_et, m_hasChild, m_ls, amptDefault_cfi::proj, Scenarios_cff::scale, setCorners(), updateScale(), and relativeConstraints::value.

◆ updateScale() [2/2]

void FWPFRhoPhiRecHit::updateScale ( TEveScalableStraightLineSet *  ls,
Double_t  scale,
unsigned int  i 
)

Referenced by updateScale().

Member Data Documentation

◆ m_child

FWPFRhoPhiRecHit* FWPFRhoPhiRecHit::m_child
private

Definition at line 68 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), clean(), and updateScale().

◆ m_corners

std::vector<TEveVector> FWPFRhoPhiRecHit::m_corners
private

Definition at line 69 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), buildRecHit(), clean(), setCorners(), and updateScale().

◆ m_energy

float FWPFRhoPhiRecHit::m_energy
private

Definition at line 63 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

◆ m_et

float FWPFRhoPhiRecHit::m_et
private

Definition at line 64 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

◆ m_hasChild

bool FWPFRhoPhiRecHit::m_hasChild
private

Definition at line 62 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), clean(), setHasChild(), and updateScale().

◆ m_lPhi

Double_t FWPFRhoPhiRecHit::m_lPhi
private

Definition at line 65 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), and getlPhi().

◆ m_ls

TEveScalableStraightLineSet* FWPFRhoPhiRecHit::m_ls
private

Definition at line 67 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), getLineSet(), and updateScale().

◆ m_rPhi

Double_t FWPFRhoPhiRecHit::m_rPhi
private

Definition at line 66 of file FWPFRhoPhiRecHit.h.

Referenced by addChild().

FWPFRhoPhiRecHit::FWPFRhoPhiRecHit
FWPFRhoPhiRecHit(FWProxyBuilderBase *pb, TEveElement *iH, const FWViewContext *vc, float E, float et, double lPhi, double rPhi, std::vector< TEveVector > &bCorners)
Definition: FWPFRhoPhiRecHit.cc:4
mps_fire.i
i
Definition: mps_fire.py:355
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
FWPFRhoPhiRecHit::buildRecHit
void buildRecHit(FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, std::vector< TEveVector > &bCorners)
Definition: FWPFRhoPhiRecHit.cc:119
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
FWPFRhoPhiRecHit::m_et
float m_et
Definition: FWPFRhoPhiRecHit.h:64
FWPFRhoPhiRecHit::addChild
void addChild(FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, float E, float et)
Definition: FWPFRhoPhiRecHit.cc:105
FWPFRhoPhiRecHit::updateScale
void updateScale(TEveScalableStraightLineSet *ls, Double_t scale, unsigned int i)
FWPFRhoPhiRecHit::m_lPhi
Double_t m_lPhi
Definition: FWPFRhoPhiRecHit.h:65
FWPFRhoPhiRecHit::m_hasChild
bool m_hasChild
Definition: FWPFRhoPhiRecHit.h:62
FWPFRhoPhiRecHit::m_child
FWPFRhoPhiRecHit * m_child
Definition: FWPFRhoPhiRecHit.h:68
b
double b
Definition: hdecay.h:118
amptDefault_cfi.proj
proj
Definition: amptDefault_cfi.py:13
FWPFRhoPhiRecHit::setCorners
void setCorners(int i, TEveVector vec)
Definition: FWPFRhoPhiRecHit.h:55
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
a
double a
Definition: hdecay.h:119
FWPFRhoPhiRecHit::m_energy
float m_energy
Definition: FWPFRhoPhiRecHit.h:63
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
value
Definition: value.py:1
FWPFRhoPhiRecHit::m_ls
TEveScalableStraightLineSet * m_ls
Definition: FWPFRhoPhiRecHit.h:67
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
FWPFRhoPhiRecHit::m_corners
std::vector< TEveVector > m_corners
Definition: FWPFRhoPhiRecHit.h:69
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FWViewEnergyScale::getScaleFactor3D
float getScaleFactor3D() const
Definition: FWViewEnergyScale.h:44
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
FWPFRhoPhiRecHit::clean
void clean()
Definition: FWPFRhoPhiRecHit.cc:96
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
FWPFRhoPhiRecHit::m_rPhi
Double_t m_rPhi
Definition: FWPFRhoPhiRecHit.h:66