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
FWPFLegoRecHit Class Reference

#include <FWPFLegoRecHit.h>

Public Member Functions

void addLine (float x1, float y1, float z1, float x2, float y2, float z2)
 
void addLine (const TEveVector &v1, const TEveVector &v2)
 
 FWPFLegoRecHit (const std::vector< TEveVector > &corners, TEveElement *comp, FWProxyBuilderBase *pb, const FWViewContext *vc, float e, float et)
 
float getEtEnergy (bool b) const
 
TEveBox * getTower ()
 
bool isTallest () const
 
void setIsTallest (bool b)
 
void setLine (int idx, float x1, float y1, float z1, float x2, float y2, float z2)
 
void setSquareColor (Color_t c)
 
void updateScale (const FWViewContext *vc, float maxLogVal)
 
virtual ~FWPFLegoRecHit ()
 

Private Member Functions

void buildLineSet (const std::vector< TEveVector > &corners, const FWViewContext *vc)
 
void buildTower (const std::vector< TEveVector > &corners, const FWViewContext *vc)
 
 FWPFLegoRecHit (const FWPFLegoRecHit &)
 
const FWPFLegoRecHitoperator= (const FWPFLegoRecHit &)
 
void setupEveBox (std::vector< TEveVector > &corners, float scale)
 

Private Attributes

float m_energy
 
float m_et
 
bool m_isTallest
 
TEveStraightLineSet * m_ls
 
TEveBox * m_tower
 

Detailed Description

Definition at line 34 of file FWPFLegoRecHit.h.

Constructor & Destructor Documentation

FWPFLegoRecHit::FWPFLegoRecHit ( const std::vector< TEveVector > &  corners,
TEveElement *  comp,
FWProxyBuilderBase pb,
const FWViewContext vc,
float  e,
float  et 
)

Definition at line 5 of file FWPFLegoRecHit.cc.

References buildLineSet(), buildTower(), m_ls, m_tower, and FWProxyBuilderBase::setupAddElement().

7  : m_energy(e), m_et(et), m_isTallest(false)
8 {
9  buildTower( corners, vc );
10  buildLineSet( corners, vc );
11 
13  pb->setupAddElement( m_ls, comp );
14 }
void buildTower(const std::vector< TEveVector > &corners, const FWViewContext *vc)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
TEveBox * m_tower
void buildLineSet(const std::vector< TEveVector > &corners, const FWViewContext *vc)
TEveStraightLineSet * m_ls
virtual FWPFLegoRecHit::~FWPFLegoRecHit ( )
inlinevirtual

Definition at line 40 of file FWPFLegoRecHit.h.

40 {}
FWPFLegoRecHit::FWPFLegoRecHit ( const FWPFLegoRecHit )
private

Member Function Documentation

void FWPFLegoRecHit::addLine ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Definition at line 152 of file FWPFLegoRecHit.cc.

References m_ls.

Referenced by setIsTallest().

153 {
154  m_ls->AddLine( x1, y1, z1, x2, y2, z2 );
155 }
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::addLine ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 159 of file FWPFLegoRecHit.cc.

References m_ls.

160 {
161  m_ls->AddLine(v1.fX, v1.fY, v1.fZ, v2.fX, v2.fY, v2.fZ);
162 }
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::buildLineSet ( const std::vector< TEveVector > &  corners,
const FWViewContext vc 
)
private

Definition at line 52 of file FWPFLegoRecHit.cc.

References trackerHits::c, and m_ls.

Referenced by FWPFLegoRecHit().

53 {
54  m_ls = new TEveStraightLineSet( "EcalRecHitLineSet" );
55 
56  // no need to set anything, all is re-set in updateScales()
57  // reserve space for square outline
58  TEveVector c;
59  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
60  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
61  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
62  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
63 
64  // last line is trick to add a marker in line set
65  m_ls->SetMarkerStyle( 1 );
66  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
67  m_ls->AddMarker( 0, 0. );
68 }
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::buildTower ( const std::vector< TEveVector > &  corners,
const FWViewContext vc 
)
private

Definition at line 36 of file FWPFLegoRecHit.cc.

References FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactorLego(), m_energy, m_et, m_tower, pileupReCalc_HLTpaths::scale, and setupEveBox().

Referenced by FWPFLegoRecHit().

37 {
38  m_tower = new TEveBox( "EcalRecHitTower" );
39  std::vector<TEveVector> towerCorners = corners;
40  FWViewEnergyScale *caloScale = vc->getEnergyScale();
41  float val = caloScale->getPlotEt() ? m_et : m_energy;
42  float scale = caloScale->getScaleFactorLego() * val;
43 
44  if( scale < 0 )
45  scale *= -1;
46 
47  setupEveBox( towerCorners, scale );
48 }
FWViewEnergyScale * getEnergyScale() const
void setupEveBox(std::vector< TEveVector > &corners, float scale)
TEveBox * m_tower
float getScaleFactorLego() const
bool getPlotEt() const
float FWPFLegoRecHit::getEtEnergy ( bool  b) const
inline

Definition at line 50 of file FWPFLegoRecHit.h.

References m_energy, and m_et.

50 { return b ? m_et : m_energy; }
double b
Definition: hdecay.h:120
TEveBox* FWPFLegoRecHit::getTower ( )
inline

Definition at line 46 of file FWPFLegoRecHit.h.

References m_tower.

46 { return m_tower; }
TEveBox * m_tower
bool FWPFLegoRecHit::isTallest ( ) const
inline

Definition at line 51 of file FWPFLegoRecHit.h.

References m_isTallest.

51 { return m_isTallest; }
const FWPFLegoRecHit& FWPFLegoRecHit::operator= ( const FWPFLegoRecHit )
private
void FWPFLegoRecHit::setIsTallest ( bool  b)

Definition at line 138 of file FWPFLegoRecHit.cc.

References addLine(), b, and m_isTallest.

139 {
140  m_isTallest = b;
141 
142  if( m_isTallest )
143  {
144  TEveVector vec;
145  addLine( vec, vec );
146  addLine( vec, vec );
147  }
148 }
void addLine(float x1, float y1, float z1, float x2, float y2, float z2)
double b
Definition: hdecay.h:120
void FWPFLegoRecHit::setLine ( int  idx,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Definition at line 121 of file FWPFLegoRecHit.cc.

References prof2calltree::l, and m_ls.

Referenced by updateScale().

122 {
123  // AMT: this func should go in TEveStraightLineSet class
124 
125  TEveStraightLineSet::Line_t* l = ((TEveStraightLineSet::Line_t*)(m_ls->GetLinePlex().Atom(idx)));
126 
127  l->fV1[0] = x1;
128  l->fV1[1] = y1;
129  l->fV1[2] = z1;
130 
131  l->fV2[0] = x2;
132  l->fV2[1] = y2;
133  l->fV2[2] = z2;
134 }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 44 of file FWPFLegoRecHit.h.

References m_ls.

Referenced by FWPFEcalRecHitLegoProxyBuilder::build().

44 { m_ls->SetMarkerColor(c); m_ls->SetLineColor(kBlack); }
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::setupEveBox ( std::vector< TEveVector > &  corners,
float  scale 
)
private

Definition at line 18 of file FWPFLegoRecHit.cc.

References i, j, m_tower, and pileupReCalc_HLTpaths::scale.

Referenced by buildTower().

19 {
20  for( size_t i = 0; i < 4; ++i )
21  {
22  int j = i + 4;
23  corners[i+4].fZ = corners[i].fZ + scale;
24  m_tower->SetVertex( i, corners[i] );
25  m_tower->SetVertex( j, corners[j] );
26  }
27 
28  m_tower->SetPickable( true );
29  m_tower->SetDrawFrame(false);
30  m_tower->SetLineWidth( 1.0 );
31  m_tower->SetLineColor( kBlack );
32 }
int i
Definition: DBlmapReader.cc:9
TEveBox * m_tower
int j
Definition: DBlmapReader.cc:9
void FWPFLegoRecHit::updateScale ( const FWViewContext vc,
float  maxLogVal 
)

Definition at line 72 of file FWPFLegoRecHit.cc.

References trackerHits::c, data, FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactorLego(), i, create_public_lumi_plots::log, m, m_energy, m_et, m_isTallest, m_ls, m_tower, alignCSCRings::s, pileupReCalc_HLTpaths::scale, setLine(), and detailsBasic3DVector::z.

73 {
74  FWViewEnergyScale *caloScale = vc->getEnergyScale();
75  float val = caloScale->getPlotEt() ? m_et : m_energy;
76  float scale = caloScale->getScaleFactorLego() * val;
77 
78  // printf("scale %f %f\n", caloScale->getValToHeight(), val);
79 
80  if( scale < 0 )
81  scale *= -1;
82 
83  // Reposition top points of tower
84  const float *data;
85  TEveVector c;
86  for( unsigned int i = 0; i < 4; ++i )
87  {
88  data = m_tower->GetVertex( i );
89  c.fX += data[0];
90  c.fY += data[1];
91  m_tower->SetVertex( i, data[0], data[1], 0 );
92  m_tower->SetVertex( i+4, data[0], data[1], scale);
93  }
94  c *= 0.25;
95  // Scale lineset
96  float s = log( 1 + val ) / maxLogVal;
97  float d = 0.5 * ( m_tower->GetVertex(1)[0] -m_tower->GetVertex(0)[0]);
98  d *= s;
99  float z = scale * 1.001;
100  setLine(0, c.fX - d, c.fY -d, z, c.fX + d, c.fY -d, z);
101  setLine(1, c.fX + d, c.fY -d, z, c.fX + d, c.fY +d, z);
102  setLine(2, c.fX + d, c.fY +d, z, c.fX - d, c.fY +d, z);
103  setLine(3, c.fX - d, c.fY +d, z, c.fX - d, c.fY -d, z);
104 
105  if( m_isTallest )
106  {
107  // This is the tallest tower and hence two additional lines needs scaling
108  setLine( 4, c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z );
109  setLine( 5, c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z );
110  }
111 
112  TEveStraightLineSet::Marker_t* m = ((TEveStraightLineSet::Marker_t*)(m_ls->GetMarkerPlex().Atom(0)));
113  m->fV[0] = c.fX; m->fV[1] = c.fY; m->fV[2] = z;
114 
115  // stamp changed elements
116  m_tower->StampTransBBox();
117  m_ls->StampTransBBox();
118 }
int i
Definition: DBlmapReader.cc:9
void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
FWViewEnergyScale * getEnergyScale() const
TEveBox * m_tower
float float float z
float getScaleFactorLego() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
TEveStraightLineSet * m_ls
bool getPlotEt() const

Member Data Documentation

float FWPFLegoRecHit::m_energy
private

Definition at line 66 of file FWPFLegoRecHit.h.

Referenced by buildTower(), getEtEnergy(), and updateScale().

float FWPFLegoRecHit::m_et
private

Definition at line 67 of file FWPFLegoRecHit.h.

Referenced by buildTower(), getEtEnergy(), and updateScale().

bool FWPFLegoRecHit::m_isTallest
private

Definition at line 68 of file FWPFLegoRecHit.h.

Referenced by isTallest(), setIsTallest(), and updateScale().

TEveStraightLineSet* FWPFLegoRecHit::m_ls
private
TEveBox* FWPFLegoRecHit::m_tower
private

Definition at line 64 of file FWPFLegoRecHit.h.

Referenced by buildTower(), FWPFLegoRecHit(), getTower(), setupEveBox(), and updateScale().