CMS 3D CMS Logo

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 &)=delete
 
const FWPFLegoRecHitoperator= (const FWPFLegoRecHit &)=delete
 
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().

Referenced by isTallest().

11  : m_energy(e), m_et(et), m_isTallest(false) {
12  buildTower(corners, vc);
13  buildLineSet(corners, vc);
14 
17 }
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 43 of file FWPFLegoRecHit.h.

References updateScale().

43 {}
FWPFLegoRecHit::FWPFLegoRecHit ( const FWPFLegoRecHit )
privatedelete

Member Function Documentation

void FWPFLegoRecHit::addLine ( float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)
void FWPFLegoRecHit::addLine ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 146 of file FWPFLegoRecHit.cc.

References m_ls.

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

Definition at line 49 of file FWPFLegoRecHit.cc.

References HltBtagPostValidation_cff::c, and m_ls.

Referenced by FWPFLegoRecHit(), and isTallest().

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

Definition at line 35 of file FWPFLegoRecHit.cc.

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

Referenced by FWPFLegoRecHit(), and isTallest().

35  {
36  m_tower = new TEveBox("EcalRecHitTower");
37  std::vector<TEveVector> towerCorners = corners;
38  FWViewEnergyScale *caloScale = vc->getEnergyScale();
39  float val = caloScale->getPlotEt() ? m_et : m_energy;
40  float scale = caloScale->getScaleFactorLego() * val;
41 
42  if (scale < 0)
43  scale *= -1;
44 
45  setupEveBox(towerCorners, scale);
46 }
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 56 of file FWPFLegoRecHit.h.

References m_energy, and m_et.

56 { return b ? m_et : m_energy; }
double b
Definition: hdecay.h:118
TEveBox* FWPFLegoRecHit::getTower ( )
inline
bool FWPFLegoRecHit::isTallest ( ) const
inline
const FWPFLegoRecHit& FWPFLegoRecHit::operator= ( const FWPFLegoRecHit )
privatedelete

Referenced by isTallest().

void FWPFLegoRecHit::setIsTallest ( bool  b)

Definition at line 130 of file FWPFLegoRecHit.cc.

References addLine(), b, and m_isTallest.

Referenced by isTallest().

130  {
131  m_isTallest = b;
132 
133  if (m_isTallest) {
134  TEveVector vec;
135  addLine(vec, vec);
136  addLine(vec, vec);
137  }
138 }
void addLine(float x1, float y1, float z1, float x2, float y2, float z2)
double b
Definition: hdecay.h:118
void FWPFLegoRecHit::setLine ( int  idx,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Definition at line 115 of file FWPFLegoRecHit.cc.

References cmsLHEtoEOSManager::l, m_ls, testProducerWithPsetDescEmpty_cfi::x1, testProducerWithPsetDescEmpty_cfi::x2, testProducerWithPsetDescEmpty_cfi::y1, testProducerWithPsetDescEmpty_cfi::y2, and testProducerWithPsetDescEmpty_cfi::z2.

Referenced by getTower(), and updateScale().

115  {
116  // AMT: this func should go in TEveStraightLineSet class
117 
118  TEveStraightLineSet::Line_t *l = ((TEveStraightLineSet::Line_t *)(m_ls->GetLinePlex().Atom(idx)));
119 
120  l->fV1[0] = x1;
121  l->fV1[1] = y1;
122  l->fV1[2] = z1;
123 
124  l->fV2[0] = x2;
125  l->fV2[1] = y2;
126  l->fV2[2] = z2;
127 }
TEveStraightLineSet * m_ls
void FWPFLegoRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 47 of file FWPFLegoRecHit.h.

References m_ls.

Referenced by FWPFEcalRecHitLegoProxyBuilder::build().

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

Definition at line 20 of file FWPFLegoRecHit.cc.

References mps_fire::i, dqmiolumiharvest::j, m_tower, and Scenarios_cff::scale.

Referenced by buildTower(), and isTallest().

20  {
21  for (size_t i = 0; i < 4; ++i) {
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 }
TEveBox * m_tower
void FWPFLegoRecHit::updateScale ( const FWViewContext vc,
float  maxLogVal 
)

Definition at line 67 of file FWPFLegoRecHit.cc.

References HltBtagPostValidation_cff::c, ztail::d, data, FWViewContext::getEnergyScale(), FWViewEnergyScale::getPlotEt(), FWViewEnergyScale::getScaleFactorLego(), mps_fire::i, dqm-mbProfile::log, visualization-live-secondInstance_cfg::m, m_energy, m_et, m_isTallest, m_ls, m_tower, alignCSCRings::s, Scenarios_cff::scale, setLine(), heppy_batch::val, and z.

Referenced by ~FWPFLegoRecHit().

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

Member Data Documentation

float FWPFLegoRecHit::m_energy
private

Definition at line 72 of file FWPFLegoRecHit.h.

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

float FWPFLegoRecHit::m_et
private

Definition at line 73 of file FWPFLegoRecHit.h.

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

bool FWPFLegoRecHit::m_isTallest
private

Definition at line 74 of file FWPFLegoRecHit.h.

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

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

Definition at line 70 of file FWPFLegoRecHit.h.

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