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 (TEveScalableStraightLineSet *ls, Double_t scale, unsigned int i)
 
void updateScale (const FWViewContext *vc)
 
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::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.

References buildRecHit().

Referenced by addChild(), and setCorners().

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 }
void buildRecHit(FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, std::vector< TEveVector > &bCorners)
FWPFRhoPhiRecHit * m_child
FWPFRhoPhiRecHit::~FWPFRhoPhiRecHit ( )
virtual

Definition at line 17 of file FWPFRhoPhiRecHit.cc.

17 {}
FWPFRhoPhiRecHit::FWPFRhoPhiRecHit ( const FWPFRhoPhiRecHit )
private

Member Function Documentation

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

Definition at line 105 of file FWPFRhoPhiRecHit.cc.

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

Referenced by addChild().

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 }
std::vector< TEveVector > m_corners
FWPFRhoPhiRecHit(FWProxyBuilderBase *pb, TEveElement *iH, const FWViewContext *vc, float E, float et, double lPhi, double rPhi, std::vector< TEveVector > &bCorners)
void addChild(FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, float E, float et)
FWPFRhoPhiRecHit * m_child
void FWPFRhoPhiRecHit::buildRecHit ( FWProxyBuilderBase pb,
TEveElement *  itemHolder,
const FWViewContext vc,
std::vector< TEveVector > &  bCorners 
)

Definition at line 119 of file FWPFRhoPhiRecHit.cc.

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

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 }
float getScaleFactor3D() const
std::vector< TEveVector > m_corners
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
FWViewEnergyScale * getEnergyScale() const
Definition: value.py:1
TEveScalableStraightLineSet * m_ls
bool getPlotEt() const
void FWPFRhoPhiRecHit::clean ( )

Definition at line 96 of file FWPFRhoPhiRecHit.cc.

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

Referenced by clean().

96  {
97  m_corners.clear();
98  if (m_hasChild)
99  m_child->clean();
100 
101  delete this;
102 }
std::vector< TEveVector > m_corners
FWPFRhoPhiRecHit * m_child
TEveScalableStraightLineSet* FWPFRhoPhiRecHit::getLineSet ( )
inline

Definition at line 53 of file FWPFRhoPhiRecHit.h.

References m_ls.

53 { return m_ls; }
TEveScalableStraightLineSet * m_ls
Double_t FWPFRhoPhiRecHit::getlPhi ( )
inline

Definition at line 52 of file FWPFRhoPhiRecHit.h.

References m_lPhi.

52 { return m_lPhi; }
FWPFRhoPhiRecHit& FWPFRhoPhiRecHit::operator= ( const FWPFRhoPhiRecHit )
private

Referenced by setCorners().

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

Definition at line 55 of file FWPFRhoPhiRecHit.h.

References FWPFRhoPhiRecHit(), mps_fire::i, m_corners, and operator=().

Referenced by updateScale().

55 { m_corners[i] = vec; }
std::vector< TEveVector > m_corners
void FWPFRhoPhiRecHit::setHasChild ( bool  b)
inline

Definition at line 54 of file FWPFRhoPhiRecHit.h.

References b, and m_hasChild.

54 { m_hasChild = b; }
double b
Definition: hdecay.h:118
void FWPFRhoPhiRecHit::updateScale ( TEveScalableStraightLineSet *  ls,
Double_t  scale,
unsigned int  i 
)

Referenced by updateScale().

void FWPFRhoPhiRecHit::updateScale ( const FWViewContext vc)

Definition at line 20 of file FWPFRhoPhiRecHit.cc.

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.

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 }
float getScaleFactor3D() const
std::vector< TEveVector > m_corners
FWViewEnergyScale * getEnergyScale() const
double f[11][100]
Definition: value.py:1
void updateScale(TEveScalableStraightLineSet *ls, Double_t scale, unsigned int i)
double a
Definition: hdecay.h:119
void setCorners(int i, TEveVector vec)
TEveScalableStraightLineSet * m_ls
bool getPlotEt() const
FWPFRhoPhiRecHit * m_child

Member Data Documentation

FWPFRhoPhiRecHit* FWPFRhoPhiRecHit::m_child
private

Definition at line 68 of file FWPFRhoPhiRecHit.h.

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

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

Definition at line 69 of file FWPFRhoPhiRecHit.h.

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

float FWPFRhoPhiRecHit::m_energy
private

Definition at line 63 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

float FWPFRhoPhiRecHit::m_et
private

Definition at line 64 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

bool FWPFRhoPhiRecHit::m_hasChild
private

Definition at line 62 of file FWPFRhoPhiRecHit.h.

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

Double_t FWPFRhoPhiRecHit::m_lPhi
private

Definition at line 65 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), and getlPhi().

TEveScalableStraightLineSet* FWPFRhoPhiRecHit::m_ls
private

Definition at line 67 of file FWPFRhoPhiRecHit.h.

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

Double_t FWPFRhoPhiRecHit::m_rPhi
private

Definition at line 66 of file FWPFRhoPhiRecHit.h.

Referenced by addChild().