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 (float x1, float y1, float z1, float x2, float y2, float z2)
 
void addLine (const TEveVector &v1, const TEveVector &v2)
 
 FWBoxRecHit (const std::vector< TEveVector > &corners, TEveElement *comp, float e, float et)
 
 FWBoxRecHit (const FWBoxRecHit &)=delete
 
float getEnergy (bool b) const
 
TEveBox * getTower ()
 
bool isTallest () const
 
const FWBoxRecHitoperator= (const FWBoxRecHit &)=delete
 
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)
 
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.

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

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 }
float m_energy
Definition: FWBoxRecHit.h:67
void buildTower(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:47
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:66
void buildLineSet(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:62
TEveBox * m_tower
Definition: FWBoxRecHit.h:65
bool m_isTallest
Definition: FWBoxRecHit.h:69
float m_et
Definition: FWBoxRecHit.h:68
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ ~FWBoxRecHit()

virtual FWBoxRecHit::~FWBoxRecHit ( )
inlinevirtual

Definition at line 38 of file FWBoxRecHit.h.

38 {}

◆ FWBoxRecHit() [2/2]

FWBoxRecHit::FWBoxRecHit ( const FWBoxRecHit )
delete

Member Function Documentation

◆ addLine() [1/2]

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

◆ addLine() [2/2]

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

Definition at line 160 of file FWBoxRecHit.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
Definition: FWBoxRecHit.h:66

◆ buildLineSet()

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

Definition at line 62 of file FWBoxRecHit.cc.

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

Referenced by FWBoxRecHit().

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 }
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:66
TEveBox * m_tower
Definition: FWBoxRecHit.h:65
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ buildTower()

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

Definition at line 47 of file FWBoxRecHit.cc.

References f, m_tower, and setupEveBox().

Referenced by FWBoxRecHit().

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 }
void setupEveBox(std::vector< TEveVector > &corners, float scale)
Definition: FWBoxRecHit.cc:31
double f[11][100]
TEveBox * m_tower
Definition: FWBoxRecHit.h:65

◆ getEnergy()

float FWBoxRecHit::getEnergy ( bool  b) const
inline

Definition at line 51 of file FWBoxRecHit.h.

References b, m_energy, and m_et.

51 { return b ? m_et : m_energy; }
float m_energy
Definition: FWBoxRecHit.h:67
float m_et
Definition: FWBoxRecHit.h:68
double b
Definition: hdecay.h:120

◆ getTower()

TEveBox* FWBoxRecHit::getTower ( )
inline

Definition at line 47 of file FWBoxRecHit.h.

References m_tower.

47 { return m_tower; }
TEveBox * m_tower
Definition: FWBoxRecHit.h:65

◆ isTallest()

bool FWBoxRecHit::isTallest ( ) const
inline

Definition at line 52 of file FWBoxRecHit.h.

References m_isTallest.

52 { return m_isTallest; }
bool m_isTallest
Definition: FWBoxRecHit.h:69

◆ operator=()

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

◆ setIsTallest()

void FWBoxRecHit::setIsTallest ( )

Definition at line 152 of file FWBoxRecHit.cc.

References m_isTallest.

152 { m_isTallest = true; }
bool m_isTallest
Definition: FWBoxRecHit.h:69

◆ setLine()

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

◆ setSquareColor()

void FWBoxRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 42 of file FWBoxRecHit.h.

References HltBtagPostValidation_cff::c, and m_ls.

42  {
43  m_ls->SetMarkerColor(c);
44  m_ls->SetLineColor(kBlack);
45  }
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:66

◆ setupEveBox()

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

Definition at line 31 of file FWBoxRecHit.cc.

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

Referenced by buildTower().

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 }
TEveBox * m_tower
Definition: FWBoxRecHit.h:65

◆ updateScale()

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

Definition at line 85 of file FWBoxRecHit.cc.

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, pfClustersFromCombinedCaloHF_cfi::scale, setLine(), heppy_batch::val, and z.

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 }
float m_energy
Definition: FWBoxRecHit.h:67
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:66
TEveBox * m_tower
Definition: FWBoxRecHit.h:65
bool m_isTallest
Definition: FWBoxRecHit.h:69
d
Definition: ztail.py:151
float m_et
Definition: FWBoxRecHit.h:68
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWBoxRecHit.cc:137

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().