CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWBoxRecHit Class Reference

#include <FWBoxRecHit.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)
 
 FWBoxRecHit (const std::vector< TEveVector > &corners, TEveElement *comp, float e, float et)
 
float getEnergy (bool b) const
 
TEveBox * getTower ()
 
bool isTallest () const
 
void setIsTallest ()
 
void setLine (int idx, float x1, float y1, float z1, float x2, float y2, float z2)
 
void setSquareColor (Color_t c)
 
void updateScale (float scale, float maxLogVal, bool plotEt)
 
virtual ~FWBoxRecHit ()
 

Private Member Functions

void buildLineSet (const std::vector< TEveVector > &corners)
 
void buildTower (const std::vector< TEveVector > &corners)
 
 FWBoxRecHit (const FWBoxRecHit &)=delete
 
const FWBoxRecHitoperator= (const FWBoxRecHit &)=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 FWBoxRecHit.h.

Constructor & Destructor Documentation

◆ FWBoxRecHit() [1/2]

FWBoxRecHit::FWBoxRecHit ( const std::vector< TEveVector > &  corners,
TEveElement *  comp,
float  e,
float  et 
)

Definition at line 9 of file FWBoxRecHit.cc.

10  : m_tower(nullptr), m_ls(nullptr), m_energy(e), m_et(et), m_isTallest(false) {
11  buildTower(corners);
12  buildLineSet(corners);
13 
14  TEveCompound *h = new TEveCompound("rechit box", "tower");
15  list->AddElement(h);
16  h->CSCApplyMainColorToAllChildren();
17  h->AddElement(m_tower);
18  h->AddElement(m_ls);
19 }

References buildLineSet(), buildTower(), m_ls, and m_tower.

◆ ~FWBoxRecHit()

virtual FWBoxRecHit::~FWBoxRecHit ( )
inlinevirtual

Definition at line 38 of file FWBoxRecHit.h.

38 {}

◆ FWBoxRecHit() [2/2]

FWBoxRecHit::FWBoxRecHit ( const FWBoxRecHit )
privatedelete

Member Function Documentation

◆ addLine() [1/2]

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

Definition at line 160 of file FWBoxRecHit.cc.

160  {
161  m_ls->AddLine(v1.fX, v1.fY, v1.fZ, v2.fX, v2.fY, v2.fZ);
162 }

References m_ls.

◆ addLine() [2/2]

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

◆ buildLineSet()

void FWBoxRecHit::buildLineSet ( const std::vector< TEveVector > &  corners)
private

Definition at line 62 of file FWBoxRecHit.cc.

62  {
63  m_ls = new TEveStraightLineSet("EcalRecHitLineSet");
64 
65  const float *data;
66  TEveVector c;
67  for (unsigned int i = 0; i < 4; ++i) {
68  data = m_tower->GetVertex(i);
69  c.fX += data[0];
70  c.fY += data[1];
71  m_ls->AddLine(data[0], data[1], 0, data[0], data[1], 0);
72  }
73  c *= 0.25;
74 
75  // last line is trick to add a marker in line set
76  m_ls->SetMarkerStyle(1);
77  m_ls->AddLine(c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ);
78  m_ls->AddMarker(0, 0.);
79 
80  m_ls->ResetBBox();
81  m_ls->ComputeBBox();
82 }

References HltBtagPostValidation_cff::c, data, mps_fire::i, m_ls, and m_tower.

Referenced by FWBoxRecHit().

◆ buildTower()

void FWBoxRecHit::buildTower ( const std::vector< TEveVector > &  corners)
private

Definition at line 47 of file FWBoxRecHit.cc.

47  {
48  m_tower = new TEveBox("EcalRecHitTower");
49  std::vector<TEveVector> towerCorners = corners;
50  /*
51  FWViewEnergyScale *caloScale = 1;//getEnergyScale();
52  float val = caloScale->getPlotEt() ? m_et : m_energy;
53  float scale = caloScale->getScaleFactorLego() * val;
54 
55  if( scale < 0 )
56  scale *= -1;
57  */
58  setupEveBox(towerCorners, 0.01f);
59 }

References f, m_tower, and setupEveBox().

Referenced by FWBoxRecHit().

◆ getEnergy()

float FWBoxRecHit::getEnergy ( bool  b) const
inline

Definition at line 51 of file FWBoxRecHit.h.

51 { return b ? m_et : m_energy; }

References b, m_energy, and m_et.

◆ getTower()

TEveBox* FWBoxRecHit::getTower ( )
inline

Definition at line 47 of file FWBoxRecHit.h.

47 { return m_tower; }

References m_tower.

◆ isTallest()

bool FWBoxRecHit::isTallest ( ) const
inline

Definition at line 52 of file FWBoxRecHit.h.

52 { return m_isTallest; }

References m_isTallest.

◆ operator=()

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

◆ setIsTallest()

void FWBoxRecHit::setIsTallest ( )

Definition at line 152 of file FWBoxRecHit.cc.

152 { m_isTallest = true; }

References m_isTallest.

◆ setLine()

void FWBoxRecHit::setLine ( int  idx,
float  x1,
float  y1,
float  z1,
float  x2,
float  y2,
float  z2 
)

Definition at line 137 of file FWBoxRecHit.cc.

137  {
138  // AMT: this func should go in TEveStraightLineSet class
139 
140  TEveStraightLineSet::Line_t *l = ((TEveStraightLineSet::Line_t *)(m_ls->GetLinePlex().Atom(idx)));
141 
142  l->fV1[0] = x1;
143  l->fV1[1] = y1;
144  l->fV1[2] = z1;
145 
146  l->fV2[0] = x2;
147  l->fV2[1] = y2;
148  l->fV2[2] = z2;
149 }

References heavyIonCSV_trainingSettings::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 FWBoxRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 42 of file FWBoxRecHit.h.

42  {
43  m_ls->SetMarkerColor(c);
44  m_ls->SetLineColor(kBlack);
45  }

References HltBtagPostValidation_cff::c, and m_ls.

◆ setupEveBox()

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

Definition at line 31 of file FWBoxRecHit.cc.

31  {
32  // printf("---\n");
33  // TEveVector z(0.f, 0.f, 0.f);
34  for (size_t i = 0; i < 4; ++i) {
35  int j = i + 4;
36  corners[i + 4].fZ = scale;
37  m_tower->SetVertex(i, corners[i]);
38  m_tower->SetVertex(j, corners[j]);
39  // printf("%ld -> %f, %f , height=%f \n",i, corners[i].fX, corners[i].fY, scale);
40  }
41 
42  m_tower->SetLineWidth(1.0);
43  m_tower->SetLineColor(kBlack);
44 }

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

Referenced by buildTower().

◆ updateScale()

void FWBoxRecHit::updateScale ( float  scale,
float  maxLogVal,
bool  plotEt 
)

Definition at line 85 of file FWBoxRecHit.cc.

85  {
86  // FWViewEnergyScale *caloScale = getEnergyScale();
87  //
88  //float scale = caloScale->getScaleFactorLego() * val;
89 
90  // printf("scale %f %f\n", caloScale->getValToHeight(), val);
91  float val = plotEt ? m_et : m_energy;
92  float scale = scaleFac * val;
93  // Reposition top points of tower
94  const float *data;
95  TEveVector c;
96  for (unsigned int i = 0; i < 4; ++i) {
97  data = m_tower->GetVertex(i);
98  c.fX += data[0];
99  c.fY += data[1];
100  m_tower->SetVertex(i, data[0], data[1], 0);
101  m_tower->SetVertex(i + 4, data[0], data[1], scale);
102  }
103  c *= 0.25;
104  if (false)
105  c.Dump();
106 
107  // Scale lineset
108  float s = log(1 + val) / maxLogVal;
109  float d = 0.5 * (m_tower->GetVertex(1)[0] - m_tower->GetVertex(0)[0]);
110  d *= s;
111  float z = scale * 1.001;
112  setLine(0, c.fX - d, c.fY - d, z, c.fX + d, c.fY - d, z);
113  setLine(1, c.fX + d, c.fY - d, z, c.fX + d, c.fY + d, z);
114  setLine(2, c.fX + d, c.fY + d, z, c.fX - d, c.fY + d, z);
115  setLine(3, c.fX - d, c.fY + d, z, c.fX - d, c.fY - d, z);
116 
117  if (m_isTallest) {
118  m_ls->AddLine(c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z);
119  m_ls->AddLine(c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z);
120  m_ls->GetMarkerPlex().Refit();
121  }
122 
123  TEveStraightLineSet::Marker_t *m = ((TEveStraightLineSet::Marker_t *)(m_ls->GetMarkerPlex().Atom(0)));
124  m->fV[0] = c.fX;
125  m->fV[1] = c.fY;
126  m->fV[2] = z;
127 
128  // stamp changed elements
129 
130  m_ls->ComputeBBox();
131  // float* bb = m_ls->GetBBox();
132  m_tower->StampTransBBox();
133  m_ls->StampTransBBox();
134 }

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

Member Data Documentation

◆ m_energy

float FWBoxRecHit::m_energy
private

Definition at line 67 of file FWBoxRecHit.h.

Referenced by getEnergy(), and updateScale().

◆ m_et

float FWBoxRecHit::m_et
private

Definition at line 68 of file FWBoxRecHit.h.

Referenced by getEnergy(), and updateScale().

◆ m_isTallest

bool FWBoxRecHit::m_isTallest
private

Definition at line 69 of file FWBoxRecHit.h.

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

◆ m_ls

TEveStraightLineSet* FWBoxRecHit::m_ls
private

Definition at line 66 of file FWBoxRecHit.h.

Referenced by addLine(), buildLineSet(), FWBoxRecHit(), setLine(), setSquareColor(), and updateScale().

◆ m_tower

TEveBox* FWBoxRecHit::m_tower
private

Definition at line 65 of file FWBoxRecHit.h.

Referenced by buildLineSet(), buildTower(), FWBoxRecHit(), getTower(), setupEveBox(), and updateScale().

FWBoxRecHit::setLine
void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWBoxRecHit.cc:137
mps_fire.i
i
Definition: mps_fire.py:428
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
FWBoxRecHit::m_energy
float m_energy
Definition: FWBoxRecHit.h:67
FWBoxRecHit::buildTower
void buildTower(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:47
FWBoxRecHit::buildLineSet
void buildLineSet(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:62
heavyIonCSV_trainingSettings.idx
idx
Definition: heavyIonCSV_trainingSettings.py:5
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
FWBoxRecHit::m_ls
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:66
h
b
double b
Definition: hdecay.h:118
FWBoxRecHit::m_tower
TEveBox * m_tower
Definition: FWBoxRecHit.h:65
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
FWBoxRecHit::m_et
float m_et
Definition: FWBoxRecHit.h:68
FWBoxRecHit::m_isTallest
bool m_isTallest
Definition: FWBoxRecHit.h:69
EgHLTOffHistBins_cfi.et
et
Definition: EgHLTOffHistBins_cfi.py:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
heppy_batch.val
val
Definition: heppy_batch.py:351
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
FWBoxRecHit::setupEveBox
void setupEveBox(std::vector< TEveVector > &corners, float scale)
Definition: FWBoxRecHit.cc:31
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37