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 (const TEveVector &v1, const TEveVector &v2)
 
void addLine (float x1, float y1, float z1, float x2, float y2, float z2)
 
 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() [1/2]

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.

11  : m_energy(e), m_et(et), m_isTallest(false) {
12  buildTower(corners, vc);
13  buildLineSet(corners, vc);
14 
17 }

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

◆ ~FWPFLegoRecHit()

virtual FWPFLegoRecHit::~FWPFLegoRecHit ( )
inlinevirtual

Definition at line 43 of file FWPFLegoRecHit.h.

43 {}

◆ FWPFLegoRecHit() [2/2]

FWPFLegoRecHit::FWPFLegoRecHit ( const FWPFLegoRecHit )
privatedelete

Member Function Documentation

◆ addLine() [1/2]

void FWPFLegoRecHit::addLine ( const TEveVector &  v1,
const TEveVector &  v2 
)

Definition at line 146 of file FWPFLegoRecHit.cc.

146  {
147  m_ls->AddLine(v1.fX, v1.fY, v1.fZ, v2.fX, v2.fY, v2.fZ);
148 }

References m_ls.

◆ addLine() [2/2]

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

◆ buildLineSet()

void FWPFLegoRecHit::buildLineSet ( const std::vector< TEveVector > &  corners,
const FWViewContext vc 
)
private

Definition at line 49 of file FWPFLegoRecHit.cc.

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 }

References HltBtagPostValidation_cff::c, and m_ls.

Referenced by FWPFLegoRecHit().

◆ buildTower()

void FWPFLegoRecHit::buildTower ( const std::vector< TEveVector > &  corners,
const FWViewContext vc 
)
private

Definition at line 35 of file FWPFLegoRecHit.cc.

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 }

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

Referenced by FWPFLegoRecHit().

◆ getEtEnergy()

float FWPFLegoRecHit::getEtEnergy ( bool  b) const
inline

Definition at line 56 of file FWPFLegoRecHit.h.

56 { return b ? m_et : m_energy; }

References b, m_energy, and m_et.

◆ getTower()

TEveBox* FWPFLegoRecHit::getTower ( )
inline

Definition at line 52 of file FWPFLegoRecHit.h.

52 { return m_tower; }

References m_tower.

◆ isTallest()

bool FWPFLegoRecHit::isTallest ( ) const
inline

Definition at line 57 of file FWPFLegoRecHit.h.

57 { return m_isTallest; }

References m_isTallest.

◆ operator=()

const FWPFLegoRecHit& FWPFLegoRecHit::operator= ( const FWPFLegoRecHit )
privatedelete

◆ setIsTallest()

void FWPFLegoRecHit::setIsTallest ( bool  b)

Definition at line 130 of file FWPFLegoRecHit.cc.

130  {
131  m_isTallest = b;
132 
133  if (m_isTallest) {
134  TEveVector vec;
135  addLine(vec, vec);
136  addLine(vec, vec);
137  }
138 }

References addLine(), b, and m_isTallest.

◆ setLine()

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.

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 }

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

Referenced by updateScale().

◆ setSquareColor()

void FWPFLegoRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 47 of file FWPFLegoRecHit.h.

47  {
48  m_ls->SetMarkerColor(c);
49  m_ls->SetLineColor(kBlack);
50  }

References HltBtagPostValidation_cff::c, and m_ls.

◆ setupEveBox()

void FWPFLegoRecHit::setupEveBox ( std::vector< TEveVector > &  corners,
float  scale 
)
private

Definition at line 20 of file FWPFLegoRecHit.cc.

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 }

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

Referenced by buildTower().

◆ updateScale()

void FWPFLegoRecHit::updateScale ( const FWViewContext vc,
float  maxLogVal 
)

Definition at line 67 of file FWPFLegoRecHit.cc.

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 }

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.

Member Data Documentation

◆ m_energy

float FWPFLegoRecHit::m_energy
private

Definition at line 72 of file FWPFLegoRecHit.h.

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

◆ m_et

float FWPFLegoRecHit::m_et
private

Definition at line 73 of file FWPFLegoRecHit.h.

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

◆ m_isTallest

bool FWPFLegoRecHit::m_isTallest
private

Definition at line 74 of file FWPFLegoRecHit.h.

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

◆ m_ls

TEveStraightLineSet* FWPFLegoRecHit::m_ls
private

◆ m_tower

TEveBox* FWPFLegoRecHit::m_tower
private

Definition at line 70 of file FWPFLegoRecHit.h.

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

mps_fire.i
i
Definition: mps_fire.py:355
FWPFLegoRecHit::buildTower
void buildTower(const std::vector< TEveVector > &corners, const FWViewContext *vc)
Definition: FWPFLegoRecHit.cc:35
FWPFLegoRecHit::m_energy
float m_energy
Definition: FWPFLegoRecHit.h:72
FWPFLegoRecHit::m_et
float m_et
Definition: FWPFLegoRecHit.h:73
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
FWPFLegoRecHit::addLine
void addLine(float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWPFLegoRecHit.cc:141
FWViewEnergyScale::getPlotEt
bool getPlotEt() const
Definition: FWViewEnergyScale.h:47
FWPFLegoRecHit::setupEveBox
void setupEveBox(std::vector< TEveVector > &corners, float scale)
Definition: FWPFLegoRecHit.cc:20
training_settings.idx
idx
Definition: training_settings.py:16
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
FWPFLegoRecHit::m_isTallest
bool m_isTallest
Definition: FWPFLegoRecHit.h:74
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
alignCSCRings.s
s
Definition: alignCSCRings.py:92
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
DDAxes::z
b
double b
Definition: hdecay.h:118
FWViewEnergyScale::getScaleFactorLego
float getScaleFactorLego() const
Definition: FWViewEnergyScale.h:45
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
Scenarios_cff.scale
scale
Definition: Scenarios_cff.py:2186
FWProxyBuilderBase::setupAddElement
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Definition: FWProxyBuilderBase.cc:350
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
FWPFLegoRecHit::buildLineSet
void buildLineSet(const std::vector< TEveVector > &corners, const FWViewContext *vc)
Definition: FWPFLegoRecHit.cc:49
FWPFLegoRecHit::setLine
void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWPFLegoRecHit.cc:115
heppy_batch.val
val
Definition: heppy_batch.py:351
FWPFLegoRecHit::m_ls
TEveStraightLineSet * m_ls
Definition: FWPFLegoRecHit.h:71
FWViewEnergyScale
Definition: FWViewEnergyScale.h:34
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
ztail.d
d
Definition: ztail.py:151
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
FWViewContext::getEnergyScale
FWViewEnergyScale * getEnergyScale() const
Definition: FWViewContext.cc:25
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FWPFLegoRecHit::m_tower
TEveBox * m_tower
Definition: FWPFLegoRecHit.h:70