test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWBoxRecHit.cc
Go to the documentation of this file.
1 #include "TEveCompound.h"
2 
7 
8 
9 //______________________________________________________________________________
10 FWBoxRecHit::FWBoxRecHit( const std::vector<TEveVector> &corners, TEveElement *list,float e , float et):
11  m_tower(0), m_ls(0), m_energy(e), m_et(et), m_isTallest(false)
12 {
13  buildTower( corners);
14  buildLineSet( corners);
15 
16  TEveCompound* h = new TEveCompound("rechit box", "tower");
17  list->AddElement(h);
18  h->CSCApplyMainColorToAllChildren();
19  h->AddElement( m_tower);
20  h->AddElement( m_ls );
21 }
22 
23 //______________________________________________________________________________
24 /*
25  FWViewEnergyScale*
26  FWBoxRecHit::getEnergyScale() const
27  {
28  return fireworks::Context::getInstance()->commonPrefs()->getEnergyScale();
29  }
30 */
31 
32 //______________________________________________________________________________
33 void
34 FWBoxRecHit::setupEveBox( std::vector<TEveVector> &corners, float scale )
35 {
36  // printf("---\n");
37  // TEveVector z(0.f, 0.f, 0.f);
38  for( size_t i = 0; i < 4; ++i)
39  {
40  int j = i + 4;
41  corners[i+4].fZ = scale;
42  m_tower->SetVertex( i, corners[i] );
43  m_tower->SetVertex( j, corners[j] );
44  // printf("%ld -> %f, %f , height=%f \n",i, corners[i].fX, corners[i].fY, scale);
45  }
46 
47  m_tower->SetLineWidth( 1.0 );
48  m_tower->SetLineColor( kBlack );
49 }
50 
51 //______________________________________________________________________________
52 void
53 FWBoxRecHit::buildTower( const std::vector<TEveVector> &corners )
54 {
55  m_tower = new TEveBox( "EcalRecHitTower" );
56  std::vector<TEveVector> towerCorners = corners;
57  /*
58  FWViewEnergyScale *caloScale = 1;//getEnergyScale();
59  float val = caloScale->getPlotEt() ? m_et : m_energy;
60  float scale = caloScale->getScaleFactorLego() * val;
61 
62  if( scale < 0 )
63  scale *= -1;
64  */
65  setupEveBox( towerCorners, 0.01f );
66 }
67 
68 //______________________________________________________________________________
69 void
70 FWBoxRecHit::buildLineSet( const std::vector<TEveVector> &corners )
71 {
72  m_ls = new TEveStraightLineSet( "EcalRecHitLineSet" );
73 
74 
75  const float *data;
76  TEveVector c;
77  for( unsigned int i = 0; i < 4; ++i )
78  {
79  data = m_tower->GetVertex( i );
80  c.fX += data[0];
81  c.fY += data[1];
82  m_ls->AddLine( data[0], data[1], 0, data[0], data[1], 0);
83 
84  }
85  c *= 0.25;
86 
87 
88  // last line is trick to add a marker in line set
89  m_ls->SetMarkerStyle( 1 );
90  m_ls->AddLine( c.fX, c.fY, c.fZ, c.fX, c.fY, c.fZ );
91  m_ls->AddMarker( 0, 0. );
92 
93 
94  m_ls->ResetBBox();
95  m_ls->ComputeBBox();
96 }
97 
98 //______________________________________________________________________________
99 void
100 FWBoxRecHit::updateScale(float scaleFac, float maxLogVal, bool plotEt )
101 {
102  // FWViewEnergyScale *caloScale = getEnergyScale();
103  //
104  //float scale = caloScale->getScaleFactorLego() * val;
105 
106  // printf("scale %f %f\n", caloScale->getValToHeight(), val);
107 float val = plotEt ? m_et : m_energy;
108  float scale = scaleFac * val;
109  // Reposition top points of tower
110  const float *data;
111  TEveVector c;
112  for( unsigned int i = 0; i < 4; ++i )
113  {
114  data = m_tower->GetVertex( i );
115  c.fX += data[0];
116  c.fY += data[1];
117  m_tower->SetVertex( i, data[0], data[1], 0 );
118  m_tower->SetVertex( i+4, data[0], data[1], scale);
119  }
120  c *= 0.25;
121  if (0) c.Dump();
122 
123  // Scale lineset
124  float s = log( 1 + val ) / maxLogVal;
125  float d = 0.5 * ( m_tower->GetVertex(1)[0] -m_tower->GetVertex(0)[0]);
126  d *= s;
127  float z = scale * 1.001;
128  setLine(0, c.fX - d, c.fY -d, z, c.fX + d, c.fY -d, z);
129  setLine(1, c.fX + d, c.fY -d, z, c.fX + d, c.fY +d, z);
130  setLine(2, c.fX + d, c.fY +d, z, c.fX - d, c.fY +d, z);
131  setLine(3, c.fX - d, c.fY +d, z, c.fX - d, c.fY -d, z);
132 
133  if( m_isTallest )
134  {
135 
136  m_ls->AddLine( c.fX - d, c.fY - d, z, c.fX + d, c.fY + d, z );
137  m_ls->AddLine( c.fX - d, c.fY + d, z, c.fX + d, c.fY - d, z );
138  m_ls->GetMarkerPlex().Refit();
139  }
140 
141  TEveStraightLineSet::Marker_t* m = ((TEveStraightLineSet::Marker_t*)(m_ls->GetMarkerPlex().Atom(0)));
142  m->fV[0] = c.fX; m->fV[1] = c.fY; m->fV[2] = z;
143 
144  // stamp changed elements
145 
146  m_ls->ComputeBBox();
147  // float* bb = m_ls->GetBBox();
148  m_tower->StampTransBBox();
149  m_ls->StampTransBBox();
150 }
151 
152 //______________________________________________________________________________
153 void FWBoxRecHit::setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
154 {
155  // AMT: this func should go in TEveStraightLineSet class
156 
157  TEveStraightLineSet::Line_t* l = ((TEveStraightLineSet::Line_t*)(m_ls->GetLinePlex().Atom(idx)));
158 
159  l->fV1[0] = x1;
160  l->fV1[1] = y1;
161  l->fV1[2] = z1;
162 
163  l->fV2[0] = x2;
164  l->fV2[1] = y2;
165  l->fV2[2] = z2;
166 }
167 
168 //______________________________________________________________________________
169 void
171 {
172  m_isTallest = true;
173 
174 
175 }
176 
177 //______________________________________________________________________________
178 void
179 FWBoxRecHit::addLine( float x1, float y1, float z1, float x2, float y2, float z2 )
180 {
181  m_ls->AddLine( x1, y1, z1, x2, y2, z2 );
182 }
183 
184 //______________________________________________________________________________
185 void
186 FWBoxRecHit::addLine( const TEveVector &v1, const TEveVector &v2 )
187 {
188  m_ls->AddLine(v1.fX, v1.fY, v1.fZ, v2.fX, v2.fY, v2.fZ);
189 }
int i
Definition: DBlmapReader.cc:9
void setupEveBox(std::vector< TEveVector > &corners, float scale)
Definition: FWBoxRecHit.cc:34
float m_energy
Definition: FWBoxRecHit.h:65
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
void buildTower(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:53
TEveStraightLineSet * m_ls
Definition: FWBoxRecHit.h:64
void updateScale(float scale, float maxLogVal, bool plotEt)
Definition: FWBoxRecHit.cc:100
void addLine(float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWBoxRecHit.cc:179
void buildLineSet(const std::vector< TEveVector > &corners)
Definition: FWBoxRecHit.cc:70
tuple d
Definition: ztail.py:151
void setIsTallest()
Definition: FWBoxRecHit.cc:170
int j
Definition: DBlmapReader.cc:9
double f[11][100]
TEveBox * m_tower
Definition: FWBoxRecHit.h:63
bool m_isTallest
Definition: FWBoxRecHit.h:67
float m_et
Definition: FWBoxRecHit.h:66
FWBoxRecHit(const std::vector< TEveVector > &corners, TEveElement *comp, float e, float et)
Definition: FWBoxRecHit.cc:10
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
void setLine(int idx, float x1, float y1, float z1, float x2, float y2, float z2)
Definition: FWBoxRecHit.cc:153
volatile std::atomic< bool > shutdown_flag false
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run