11 #include "TEveScalableStraightLineSet.h"
12 #include "TEveStraightLineSet.h"
13 #include "TEveTrans.h"
14 #include "TEveGeoNode.h"
21 std::pair<double,double>
getPhiRange(
const std::vector<double>& phis,
double phi )
26 for( std::vector<double>::const_iterator
i = phis.begin();
27 i != phis.end(); ++
i )
31 if( aphi - phi >
M_PI ) aphi -= 2*
M_PI;
32 if( phi - aphi >
M_PI ) aphi += 2*
M_PI;
33 if( aphi > max ) max = aphi;
34 if( aphi < min ) min = aphi;
37 if( min > max )
return std::pair<double,double>( 0, 0 );
39 return std::pair<double,double>(
min,
max );
46 TEveGeoShape* egs =
new TEveGeoShape( name );
47 TColor*
c = gROOT->GetColor( color );
48 Float_t rgba[4] = { 1, 0, 0, 1 };
51 rgba[0] = c->GetRed();
52 rgba[1] = c->GetGreen();
53 rgba[2] = c->GetBlue();
55 egs->SetMainColorRGB( rgba[0], rgba[1], rgba[2] );
56 egs->SetShape( shape );
61 double r_ecal,
double z_ecal,
62 double theta_min,
double theta_max,
65 TEveGeoManagerHolder gmgr( TEveGeoShape::GetGeoMangeur());
66 double z1 = r_ecal /
tan( theta_min );
67 if( z1 > z_ecal ) z1 = z_ecal;
68 if( z1 < -z_ecal ) z1 = -z_ecal;
69 double z2 = r_ecal /
tan( theta_max );
70 if( z2 > z_ecal ) z2 = z_ecal;
71 if( z2 < -z_ecal ) z2 = -z_ecal;
72 double r1 = z_ecal * fabs(
tan( theta_min ));
73 if( r1 > r_ecal ) r1 = r_ecal;
74 if( phi < 0 ) r1 = -
r1;
75 double r2 = z_ecal * fabs(
tan( theta_max ));
76 if( r2 > r_ecal ) r2 = r_ecal;
77 if( phi < 0 ) r2 = -
r2;
79 if( fabs(r2 - r1) > 1 )
81 TGeoBBox *sc_box =
new TGeoBBox( 0., fabs( r2 - r1 ) / 2, 1 );
82 TEveGeoShape *element =
new TEveGeoShape(
"r-segment");
83 element->SetShape(sc_box);
84 TEveTrans &
t = element->RefMainTrans();
87 t(3,4) = fabs(z2)>fabs(z1) ? z2 : z1;
90 if( fabs(z2 - z1) > 1 )
92 TGeoBBox *sc_box =
new TGeoBBox( 0., 1, ( z2 - z1 ) / 2 );
93 TEveGeoShape *element =
new TEveGeoShape(
"z-segment");
94 element->SetShape( sc_box );
95 TEveTrans &
t = element->RefMainTrans();
97 t(2,4) = fabs(r2)>fabs(r1) ? r2 :
r1;
107 size_t pos = text.find(
'\n' );
108 if( pos != std::string::npos ) text = text.substr( 0, pos );
117 size_t pos = text.find(
'\n');
118 if( pos != std::string::npos ) text = text.substr( 0, pos );
148 TEveBox* eveBox =
new TEveBox(
"Box" );
149 eveBox->SetDrawFrame(
false );
150 eveBox->SetPickable(
true );
151 eveBox->SetVertices( &corners[0] );
158 TEveStraightLineSet* container =
new TEveStraightLineSet;
160 for(
unsigned int iphi = 0; iphi < nLineSegments; ++iphi )
162 container->AddLine( eta + radius *
cos( 2 *
M_PI / nLineSegments * iphi ),
163 phi + radius *
sin( 2 *
M_PI / nLineSegments * iphi ),
165 eta + radius *
cos( 2 *
M_PI / nLineSegments * ( iphi + 1 )),
166 phi + radius *
sin( 2 *
M_PI / nLineSegments * ( iphi + 1 )),
174 TEveScalableStraightLineSet*
marker =
new TEveScalableStraightLineSet;
175 marker->SetLineWidth( 1 );
176 marker->SetLineStyle( 2 );
177 marker->AddLine( 0, 0, 0, size *
cos( phi ), size *
sin( phi ), 0 );
178 marker->AddLine( size * 0.9 *
cos( phi + 0.03 ), size * 0.9 *
sin( phi + 0.03 ), 0, size *
cos( phi ), size *
sin( phi ), 0 );
179 marker->AddLine( size * 0.9 *
cos( phi - 0.03 ), size * 0.9 *
sin( phi - 0.03 ), 0, size *
cos( phi ), size *
sin( phi ), 0 );
186 if( theta < pb->context().caloTransAngle() ||
M_PI - theta < pb->context().caloTransAngle())
191 TEveStraightLineSet*
marker =
new TEveStraightLineSet;
192 marker->SetLineWidth( 2 );
193 marker->SetLineStyle( 2 );
194 marker->AddLine( r *
cos( phi ) *
sin( theta ), r *
sin( phi ) *
sin( theta ), r *
cos( theta ),
195 ( r + size ) *
cos( phi ) *
sin( theta ), ( r + size ) *
sin( phi ) *
sin( theta ), ( r + size ) *
cos( theta ));
201 TEveStraightLineSet* mainLine =
new TEveStraightLineSet;
202 mainLine->AddLine( -5.191, phi, 0.01, 5.191, phi, 0.01 );
205 phi = phi > 0 ? phi -
M_PI : phi +
M_PI;
206 TEveStraightLineSet* secondLine =
new TEveStraightLineSet;
207 secondLine->SetLineStyle( 7 );
208 secondLine->AddLine( -5.191, phi, 0.01, 5.191, phi, 0.01 );
215 std::vector<float> centre( 3, 0 );
217 for(
unsigned int i = 0;
i < 24;
i += 3 )
219 centre[0] += corners[
i];
220 centre[1] += corners[
i + 1];
221 centre[2] += corners[
i + 2];
224 for(
unsigned int i = 0;
i < 3; ++
i )
225 centre[
i] *= 1.0
f / 8.0
f;
228 for(
unsigned int i = 0;
i < 24;
i += 3 )
230 scaledCorners[
i] = centre[0] + ( corners[
i] - centre[0] ) * scale;
231 scaledCorners[
i + 1] = centre[1] + ( corners[
i + 1] - centre[1] ) * scale;
232 scaledCorners[
i + 2] = centre[2] + ( corners[
i + 2] - centre[2] ) * scale;
241 std::vector<float> scaledCorners( 24 );
243 addBox( scaledCorners, comp, pb );
249 std::vector<float> centre( 3, 0 );
251 for(
unsigned int i = 0;
i < 24;
i += 3 )
253 centre[0] += corners[
i];
254 centre[1] += corners[
i + 1];
255 centre[2] += corners[
i + 2];
258 for(
unsigned int i = 0;
i < 3; ++
i )
259 centre[
i] *= 1.0
f / 8.0
f;
261 TEveVector
c( centre[0], centre[1], centre[2] );
262 float scale = energy / maxEnergy *
sin( c.Theta());
265 for(
unsigned int i = 0;
i < 24;
i += 3 )
267 scaledCorners[
i] = centre[0] + ( corners[
i] - centre[0] ) * scale;
268 scaledCorners[
i + 1] = centre[1] + ( corners[
i + 1] - centre[1] ) * scale;
269 scaledCorners[
i + 2] = centre[2] + ( corners[
i + 2] - centre[2] ) * scale;
278 std::vector<float> scaledCorners( 24 );
280 addBox( scaledCorners, comp, pb );
286 for(
int i = 0;
i < 24; ++
i )
287 scaledCorners[
i] = corners[
i];
293 for(
unsigned int i = 0;
i < 12;
i += 3 )
295 TEveVector
diff( corners[
i] - corners[
i + 12], corners[
i + 1] - corners[
i + 13], corners[
i + 2] - corners[
i + 14] );
299 scaledCorners[
i] = corners[
i] + diff.fX;
300 scaledCorners[
i + 1] = corners[
i + 1] + diff.fY;
301 scaledCorners[
i + 2] = corners[
i + 2] + diff.fZ;
306 for(
unsigned int i = 0;
i < 12;
i += 3 )
308 TEveVector
diff( corners[
i + 12] - corners[
i], corners[i + 13] - corners[i + 1], corners[i + 14] - corners[i + 2] );
312 scaledCorners[
i] = corners[i + 12];
313 scaledCorners[i + 1] = corners[i + 13];
314 scaledCorners[i + 2] = corners[i + 14];
316 scaledCorners[i + 12] = corners[i + 12] + diff.fX;
317 scaledCorners[i + 13] = corners[i + 13] + diff.fY;
318 scaledCorners[i + 14] = corners[i + 14] + diff.fZ;
325 std::vector<float> scaledCorners( 24 );
327 addBox( scaledCorners, comp, pb );
334 for(
int i = 0;
i < 24; ++
i )
335 scaledCorners[
i] = corners[
i];
341 for(
unsigned int i = 0;
i < 12;
i += 3 )
343 TEveVector
diff( corners[
i] - corners[
i + 12], corners[
i + 1] - corners[
i + 13], corners[
i + 2] - corners[
i + 14] );
345 diff *= ( scale *
sin( diff.Theta()));
347 scaledCorners[
i] = corners[
i] + diff.fX;
348 scaledCorners[
i + 1] = corners[
i + 1] + diff.fY;
349 scaledCorners[
i + 2] = corners[
i + 2] + diff.fZ;
354 for(
unsigned int i = 0;
i < 12;
i += 3 )
356 TEveVector
diff( corners[
i + 12] - corners[
i], corners[i + 13] - corners[i + 1], corners[i + 14] - corners[i + 2] );
358 diff *= ( scale *
sin( diff.Theta()));
360 scaledCorners[
i] = corners[i + 12];
361 scaledCorners[i + 1] = corners[i + 13];
362 scaledCorners[i + 2] = corners[i + 14];
364 scaledCorners[i + 12] = corners[i + 12] + diff.fX;
365 scaledCorners[i + 13] = corners[i + 13] + diff.fY;
366 scaledCorners[i + 14] = corners[i + 14] + diff.fZ;
374 std::vector<float> scaledCorners( 24 );
376 addBox( scaledCorners, comp, pb );
const fireworks::Context & context() const
std::pair< double, double > getPhiRange(const std::vector< double > &phis, double phi)
void addDoubleLines(double phi, TEveElement *comp, FWProxyBuilderBase *pb)
void etTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
void drawEnergyScaledBox3D(const float *corners, float scale, TEveElement *, FWProxyBuilderBase *, bool invert=false)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
static float caloZ2(bool offset=true)
void addDashedLine(double phi, double theta, double size, TEveElement *comp, FWProxyBuilderBase *pb)
void drawEtTower3D(const float *corners, float scale, TEveElement *, FWProxyBuilderBase *, bool reflect=false)
const T & max(const T &a, const T &b)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
void invertBox(std::vector< float > &corners)
void addDashedArrow(double phi, double size, TEveElement *comp, FWProxyBuilderBase *pb)
Cos< T >::type cos(const T &t)
static float caloR1(bool offset=true)
Tan< T >::type tan(const T &t)
void addCircle(double eta, double phi, double radius, const unsigned int nLineSegments, TEveElement *comp, FWProxyBuilderBase *pb)
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 but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::string getTimeGMT(const edm::EventBase &event)
TimeValue_t value() const
void energyTower3DCorners(const float *corners, float scale, std::vector< float > &, bool reflect=false)
void addRhoZEnergyProjection(FWProxyBuilderBase *, TEveElement *, double r_ecal, double z_ecal, double theta_min, double theta_max, double phi)
void energyScaledBox3DCorners(const float *corners, float scale, std::vector< float > &, bool invert=false)
void addBox(const std::vector< float > &corners, TEveElement *, FWProxyBuilderBase *)
std::string getLocalTime(const edm::EventBase &event)
void etScaledBox3DCorners(const float *corners, float energy, float maxEnergy, std::vector< float > &scaledCorners, bool reflect=false)
void drawEnergyTower3D(const float *corners, float scale, TEveElement *, FWProxyBuilderBase *, bool reflect=false)
TEveGeoShape * getShape(const char *name, TGeoBBox *shape, Color_t color)
tuple size
Write out results.
edm::Timestamp time() const
void drawEtScaledBox3D(const float *corners, float energy, float maxEnergy, TEveElement *, FWProxyBuilderBase *, bool reflect=false)