test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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().

6  : m_hasChild(false), m_energy(E), m_et(et), m_lPhi(lPhi), m_rPhi(rPhi), m_child(0)
7 {
8  buildRecHit( pb, iH, vc, bCorners );
9 }
void buildRecHit(FWProxyBuilderBase *pb, TEveElement *itemHolder, const FWViewContext *vc, std::vector< TEveVector > &bCorners)
FWPFRhoPhiRecHit * m_child
FWPFRhoPhiRecHit::~FWPFRhoPhiRecHit ( )
virtual

Definition at line 12 of file FWPFRhoPhiRecHit.cc.

12 {}
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 109 of file FWPFRhoPhiRecHit.cc.

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

Referenced by addChild().

110 {
111  if( m_hasChild ) // Already has a child stacked on top so move on to child
112  m_child->addChild( pb, itemHolder, vc, E, et );
113  else
114  {
115  std::vector<TEveVector> corners(2);
116  corners[0] = m_corners[2]; // Top left of current tower
117  corners[1] = m_corners[3]; // Top right of current tower
118  m_child = new FWPFRhoPhiRecHit( pb, itemHolder, vc, E, et, m_lPhi, m_rPhi, corners );
119  m_hasChild = true;
120  }
121 }
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 125 of file FWPFRhoPhiRecHit.cc.

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

Referenced by FWPFRhoPhiRecHit().

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

Definition at line 98 of file FWPFRhoPhiRecHit.cc.

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

Referenced by clean().

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

Definition at line 45 of file FWPFRhoPhiRecHit.h.

References m_ls.

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

Definition at line 44 of file FWPFRhoPhiRecHit.h.

References m_lPhi.

44 { return m_lPhi; }
FWPFRhoPhiRecHit& FWPFRhoPhiRecHit::operator= ( const FWPFRhoPhiRecHit )
private
void FWPFRhoPhiRecHit::setCorners ( int  i,
TEveVector  vec 
)
inline

Definition at line 47 of file FWPFRhoPhiRecHit.h.

References i, and m_corners.

Referenced by updateScale().

47 { m_corners[i] = vec; }
int i
Definition: DBlmapReader.cc:9
std::vector< TEveVector > m_corners
void FWPFRhoPhiRecHit::setHasChild ( bool  b)
inline

Definition at line 46 of file FWPFRhoPhiRecHit.h.

References b, and m_hasChild.

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

Referenced by updateScale().

void FWPFRhoPhiRecHit::updateScale ( const FWViewContext vc)

Definition at line 16 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, pileupReCalc_HLTpaths::scale, setCorners(), updateScale(), and relativeConstraints::value.

17 {
18  FWViewEnergyScale *caloScale = vc->getEnergyScale();
19  float value = caloScale->getPlotEt() ? m_et : m_energy;
20  Double_t scale = caloScale->getScaleFactor3D() * value;
21  unsigned int a = 0;
22 
23  if( scale < 0.f )
24  scale *= -1.f;
25 
26  // Scale centres
27  TEveVector sc1 = m_corners[1];
28  TEveVector sc2 = m_corners[0];
29 
30  // Used to store normalized vectors
31  TEveVector v1 = sc1; // Bottom right corner
32  TEveVector v2 = sc2; // Bottom left corner
33 
34  v1.Normalize();
35  v2.Normalize();
36 
37  v1 *= scale; // Now at new height
38  v2 *= scale;
39 
40 
41  // Get line parameters and scale coordinates
42  TEveChunkManager::iterator li( m_ls->GetLinePlex() );
43  while( li.next() )
44  {
45  TEveStraightLineSet::Line_t &l = *( TEveStraightLineSet::Line_t* ) li();
46  switch( a )
47  {
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 )
89  {
90  m_child->setCorners( 0, m_corners[2] );
91  m_child->setCorners( 1, m_corners[3] ); // Base of child is now top of parent
92  m_child->updateScale( vc );
93  }
94 }
float getScaleFactor3D() const
std::vector< TEveVector > m_corners
FWViewEnergyScale * getEnergyScale() const
double f[11][100]
void updateScale(TEveScalableStraightLineSet *ls, Double_t scale, unsigned int i)
double a
Definition: hdecay.h:121
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 60 of file FWPFRhoPhiRecHit.h.

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

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

Definition at line 61 of file FWPFRhoPhiRecHit.h.

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

float FWPFRhoPhiRecHit::m_energy
private

Definition at line 55 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

float FWPFRhoPhiRecHit::m_et
private

Definition at line 56 of file FWPFRhoPhiRecHit.h.

Referenced by buildRecHit(), and updateScale().

bool FWPFRhoPhiRecHit::m_hasChild
private

Definition at line 54 of file FWPFRhoPhiRecHit.h.

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

Double_t FWPFRhoPhiRecHit::m_lPhi
private

Definition at line 57 of file FWPFRhoPhiRecHit.h.

Referenced by addChild(), and getlPhi().

TEveScalableStraightLineSet* FWPFRhoPhiRecHit::m_ls
private

Definition at line 59 of file FWPFRhoPhiRecHit.h.

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

Double_t FWPFRhoPhiRecHit::m_rPhi
private

Definition at line 58 of file FWPFRhoPhiRecHit.h.

Referenced by addChild().