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)
 
 FWPFLegoRecHit (const FWPFLegoRecHit &)=delete
 
float getEtEnergy (bool b) const
 
TEveBox * getTower ()
 
bool isTallest () const
 
const FWPFLegoRecHitoperator= (const FWPFLegoRecHit &)=delete
 
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)
 
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.

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

11  : m_energy(e), m_et(et), m_isTallest(false) {
12  buildTower(corners, vc);
13  buildLineSet(corners, vc);
14 
17 }
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
void buildTower(const std::vector< TEveVector > &corners, const FWViewContext *vc)
TEveBox * m_tower
void buildLineSet(const std::vector< TEveVector > &corners, const FWViewContext *vc)
TEveStraightLineSet * m_ls

◆ ~FWPFLegoRecHit()

virtual FWPFLegoRecHit::~FWPFLegoRecHit ( )
inlinevirtual

Definition at line 43 of file FWPFLegoRecHit.h.

43 {}

◆ FWPFLegoRecHit() [2/2]

FWPFLegoRecHit::FWPFLegoRecHit ( const FWPFLegoRecHit )
delete

Member Function Documentation

◆ addLine() [1/2]

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

◆ addLine() [2/2]

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

◆ buildLineSet()

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

Definition at line 49 of file FWPFLegoRecHit.cc.

References DummyCfis::c, and m_ls.

Referenced by FWPFLegoRecHit().

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

◆ buildTower()

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, l1tEGammaCrystalsEmulatorProducer_cfi::scale, setupEveBox(), and heppy_batch::val.

Referenced by FWPFLegoRecHit().

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 }
void setupEveBox(std::vector< TEveVector > &corners, float scale)
TEveBox * m_tower
bool getPlotEt() const
float getScaleFactorLego() const
FWViewEnergyScale * getEnergyScale() const

◆ getEtEnergy()

float FWPFLegoRecHit::getEtEnergy ( bool  b) const
inline

Definition at line 56 of file FWPFLegoRecHit.h.

References b, m_energy, and m_et.

56 { return b ? m_et : m_energy; }
double b
Definition: hdecay.h:120

◆ getTower()

TEveBox* FWPFLegoRecHit::getTower ( )
inline

Definition at line 52 of file FWPFLegoRecHit.h.

References m_tower.

52 { return m_tower; }
TEveBox * m_tower

◆ isTallest()

bool FWPFLegoRecHit::isTallest ( ) const
inline

Definition at line 57 of file FWPFLegoRecHit.h.

References m_isTallest.

57 { return m_isTallest; }

◆ operator=()

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

◆ setIsTallest()

void FWPFLegoRecHit::setIsTallest ( bool  b)

Definition at line 130 of file FWPFLegoRecHit.cc.

References addLine(), b, and m_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:120

◆ setLine()

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

◆ setSquareColor()

void FWPFLegoRecHit::setSquareColor ( Color_t  c)
inline

Definition at line 47 of file FWPFLegoRecHit.h.

References DummyCfis::c, and m_ls.

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

◆ setupEveBox()

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 l1tEGammaCrystalsEmulatorProducer_cfi::scale.

Referenced by buildTower().

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

◆ updateScale()

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

Definition at line 67 of file FWPFLegoRecHit.cc.

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

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)
TEveBox * m_tower
bool getPlotEt() const
float getScaleFactorLego() const
FWViewEnergyScale * getEnergyScale() const
d
Definition: ztail.py:151
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80
TEveStraightLineSet * m_ls

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