11 #include "TEveScalableStraightLineSet.h" 12 #include "TEveStraightLineSet.h" 13 #include "TEveTrans.h" 14 #include "TEveGeoNode.h" 15 #include "TEveGeoShape.h" 21 std::pair<double, double>
getPhiRange(
const std::vector<double>& phis,
double phi) {
25 for (std::vector<double>::const_iterator
i = phis.begin();
i != phis.end(); ++
i) {
28 if (aphi - phi >
M_PI)
30 if (phi - aphi >
M_PI)
39 return std::pair<double, double>(0, 0);
41 return std::pair<double, double>(
min,
max);
44 TEveGeoShape*
getShape(
const char*
name, TGeoBBox* shape, Color_t color) {
45 TEveGeoShape* egs =
new TEveGeoShape(
name);
46 TColor*
c = gROOT->GetColor(color);
47 Float_t rgba[4] = {1, 0, 0, 1};
49 rgba[0] =
c->GetRed();
50 rgba[1] =
c->GetGreen();
51 rgba[2] =
c->GetBlue();
53 egs->SetMainColorRGB(rgba[0], rgba[1], rgba[2]);
59 TEveElement* container,
65 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
66 double z1 = r_ecal /
tan(theta_min);
71 double z2 = r_ecal /
tan(theta_max);
76 double r1 = z_ecal * fabs(
tan(theta_min));
81 double r2 = z_ecal * fabs(
tan(theta_max));
87 if (fabs(
r2 -
r1) > 1) {
88 TGeoBBox* sc_box =
new TGeoBBox(0., fabs(
r2 -
r1) / 2, 1);
89 TEveGeoShape* element =
new TEveGeoShape(
"r-segment");
90 element->SetShape(sc_box);
91 TEveTrans&
t = element->RefMainTrans();
93 t(2, 4) = (
r2 +
r1) / 2;
94 t(3, 4) = fabs(
z2) > fabs(z1) ?
z2 : z1;
97 if (fabs(
z2 - z1) > 1) {
98 TGeoBBox* sc_box =
new TGeoBBox(0., 1, (
z2 - z1) / 2);
99 TEveGeoShape* element =
new TEveGeoShape(
"z-segment");
100 element->SetShape(sc_box);
101 TEveTrans&
t = element->RefMainTrans();
104 t(3, 4) = (
z2 + z1) / 2;
110 time_t
t(
event.time().value() >> 32);
113 if (
pos != std::string::npos)
120 time_t
t(
event.time().value() >> 32);
121 struct tm*
xx = localtime(&
t);
124 if (
pos != std::string::npos)
153 TEveBox* eveBox =
new TEveBox(
"Box");
154 eveBox->SetDrawFrame(
false);
155 eveBox->SetPickable(
true);
156 eveBox->SetVertices(&corners[0]);
164 const unsigned int nLineSegments,
167 TEveStraightLineSet* container =
new TEveStraightLineSet;
169 for (
unsigned int iphi = 0;
iphi < nLineSegments; ++
iphi) {
181 TEveScalableStraightLineSet* marker =
new TEveScalableStraightLineSet;
182 marker->SetLineWidth(1);
183 marker->SetLineStyle(2);
192 if (theta < pb->
context().caloTransAngle() ||
M_PI - theta < pb->
context().caloTransAngle())
197 TEveStraightLineSet* marker =
new TEveStraightLineSet;
198 marker->SetLineWidth(2);
199 marker->SetLineStyle(2);
210 TEveStraightLineSet* mainLine =
new TEveStraightLineSet;
211 mainLine->AddLine(-5.191,
phi, 0.01, 5.191,
phi, 0.01);
215 TEveStraightLineSet* secondLine =
new TEveStraightLineSet;
216 secondLine->SetLineStyle(7);
217 secondLine->AddLine(-5.191,
phi, 0.01, 5.191,
phi, 0.01);
223 std::vector<float> centre(3, 0);
225 for (
unsigned int i = 0;
i < 24;
i += 3) {
226 centre[0] += corners[
i];
227 centre[1] += corners[
i + 1];
228 centre[2] += corners[
i + 2];
231 for (
unsigned int i = 0;
i < 3; ++
i)
232 centre[
i] *= 1.0
f / 8.0
f;
235 for (
unsigned int i = 0;
i < 24;
i += 3) {
236 scaledCorners[
i] = centre[0] + (corners[
i] - centre[0]) *
scale;
237 scaledCorners[
i + 1] = centre[1] + (corners[
i + 1] - centre[1]) *
scale;
238 scaledCorners[
i + 2] = centre[2] + (corners[
i + 2] - centre[2]) *
scale;
246 std::vector<float> scaledCorners(24);
253 const float* corners,
float energy,
float maxEnergy, std::vector<float>& scaledCorners,
bool invert) {
254 std::vector<float> centre(3, 0);
256 for (
unsigned int i = 0;
i < 24;
i += 3) {
257 centre[0] += corners[
i];
258 centre[1] += corners[
i + 1];
259 centre[2] += corners[
i + 2];
262 for (
unsigned int i = 0;
i < 3; ++
i)
263 centre[
i] *= 1.0
f / 8.0
f;
265 TEveVector
c(centre[0], centre[1], centre[2]);
269 for (
unsigned int i = 0;
i < 24;
i += 3) {
270 scaledCorners[
i] = centre[0] + (corners[
i] - centre[0]) *
scale;
271 scaledCorners[
i + 1] = centre[1] + (corners[
i + 1] - centre[1]) *
scale;
272 scaledCorners[
i + 2] = centre[2] + (corners[
i + 2] - centre[2]) *
scale;
281 std::vector<float> scaledCorners(24);
288 for (
int i = 0;
i < 24; ++
i)
289 scaledCorners[
i] = corners[
i];
294 for (
unsigned int i = 0;
i < 12;
i += 3) {
296 corners[
i] - corners[
i + 12], corners[
i + 1] - corners[
i + 13], corners[
i + 2] - corners[
i + 14]);
300 scaledCorners[
i] = corners[
i] +
diff.fX;
301 scaledCorners[
i + 1] = corners[
i + 1] +
diff.fY;
302 scaledCorners[
i + 2] = corners[
i + 2] +
diff.fZ;
305 for (
unsigned int i = 0;
i < 12;
i += 3) {
307 corners[
i + 12] - corners[
i], corners[
i + 13] - corners[
i + 1], corners[
i + 14] - corners[
i + 2]);
311 scaledCorners[
i] = corners[
i + 12];
312 scaledCorners[
i + 1] = corners[
i + 13];
313 scaledCorners[
i + 2] = corners[
i + 14];
315 scaledCorners[
i + 12] = corners[
i + 12] +
diff.fX;
316 scaledCorners[
i + 13] = corners[
i + 13] +
diff.fY;
317 scaledCorners[
i + 14] = corners[
i + 14] +
diff.fZ;
323 std::vector<float> scaledCorners(24);
331 for (
int i = 0;
i < 24; ++
i)
332 scaledCorners[
i] = corners[
i];
337 for (
unsigned int i = 0;
i < 12;
i += 3) {
339 corners[
i] - corners[
i + 12], corners[
i + 1] - corners[
i + 13], corners[
i + 2] - corners[
i + 14]);
343 scaledCorners[
i] = corners[
i] +
diff.fX;
344 scaledCorners[
i + 1] = corners[
i + 1] +
diff.fY;
345 scaledCorners[
i + 2] = corners[
i + 2] +
diff.fZ;
348 for (
unsigned int i = 0;
i < 12;
i += 3) {
350 corners[
i + 12] - corners[
i], corners[
i + 13] - corners[
i + 1], corners[
i + 14] - corners[
i + 2]);
354 scaledCorners[
i] = corners[
i + 12];
355 scaledCorners[
i + 1] = corners[
i + 13];
356 scaledCorners[
i + 2] = corners[
i + 14];
358 scaledCorners[
i + 12] = corners[
i + 12] +
diff.fX;
359 scaledCorners[
i + 13] = corners[
i + 13] +
diff.fY;
360 scaledCorners[
i + 14] = corners[
i + 14] +
diff.fZ;
366 std::vector<float> scaledCorners(24);
std::pair< double, double > getPhiRange(const std::vector< double > &phis, double phi)
void addDoubleLines(double phi, TEveElement *comp, FWProxyBuilderBase *pb)
void setupAddElement(TEveElement *el, TEveElement *parent, bool set_color=true) const
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)
Sin< T >::type sin(const T &t)
static float caloZ2(bool offset=true)
const fireworks::Context & context() const
void addDashedLine(double phi, double theta, double size, TEveElement *comp, FWProxyBuilderBase *pb)
void drawEtTower3D(const float *corners, float scale, TEveElement *, FWProxyBuilderBase *, bool reflect=false)
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)
std::string getTimeGMT(const edm::EventBase &event)
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)
Geom::Theta< T > theta() const
void drawEtScaledBox3D(const float *corners, float energy, float maxEnergy, TEveElement *, FWProxyBuilderBase *, bool reflect=false)