11 #include "TEveScalableStraightLineSet.h"
12 #include "TEveStraightLineSet.h"
13 #include "TEveTrans.h"
14 #include "TEveGeoNode.h"
20 std::pair<double, double>
getPhiRange(
const std::vector<double>& phis,
double phi) {
24 for (std::vector<double>::const_iterator
i = phis.begin();
i != phis.end(); ++
i) {
27 if (aphi - phi >
M_PI)
29 if (phi - aphi >
M_PI)
38 return std::pair<double, double>(0, 0);
40 return std::pair<double, double>(
min,
max);
43 TEveGeoShape*
getShape(
const char*
name, TGeoBBox* shape, Color_t color) {
44 TEveGeoShape* egs =
new TEveGeoShape(
name);
45 TColor*
c = gROOT->GetColor(color);
46 Float_t rgba[4] = {1, 0, 0, 1};
48 rgba[0] =
c->GetRed();
49 rgba[1] =
c->GetGreen();
50 rgba[2] =
c->GetBlue();
52 egs->SetMainColorRGB(rgba[0], rgba[1], rgba[2]);
58 TEveElement* container,
64 TEveGeoManagerHolder gmgr(TEveGeoShape::GetGeoMangeur());
65 double z1 = r_ecal /
tan(theta_min);
70 double z2 = r_ecal /
tan(theta_max);
75 double r1 = z_ecal * fabs(
tan(theta_min));
80 double r2 = z_ecal * fabs(
tan(theta_max));
86 if (fabs(
r2 -
r1) > 1) {
87 TGeoBBox* sc_box =
new TGeoBBox(0., fabs(
r2 -
r1) / 2, 1);
88 TEveGeoShape* element =
new TEveGeoShape(
"r-segment");
89 element->SetShape(sc_box);
90 TEveTrans&
t = element->RefMainTrans();
92 t(2, 4) = (
r2 +
r1) / 2;
93 t(3, 4) = fabs(
z2) > fabs(z1) ?
z2 : z1;
96 if (fabs(
z2 - z1) > 1) {
97 TGeoBBox* sc_box =
new TGeoBBox(0., 1, (
z2 - z1) / 2);
98 TEveGeoShape* element =
new TEveGeoShape(
"z-segment");
99 element->SetShape(sc_box);
100 TEveTrans&
t = element->RefMainTrans();
103 t(3, 4) = (
z2 + z1) / 2;
109 time_t
t(
event.time().value() >> 32);
112 if (
pos != std::string::npos)
119 time_t
t(
event.time().value() >> 32);
120 struct tm*
xx = localtime(&
t);
123 if (
pos != std::string::npos)
152 TEveBox* eveBox =
new TEveBox(
"Box");
153 eveBox->SetDrawFrame(
false);
154 eveBox->SetPickable(
true);
155 eveBox->SetVertices(&corners[0]);
163 const unsigned int nLineSegments,
166 TEveStraightLineSet* container =
new TEveStraightLineSet;
168 for (
unsigned int iphi = 0;
iphi < nLineSegments; ++
iphi) {
180 TEveScalableStraightLineSet* marker =
new TEveScalableStraightLineSet;
181 marker->SetLineWidth(1);
182 marker->SetLineStyle(2);
191 if (theta < pb->context().caloTransAngle() ||
M_PI - theta < pb->context().caloTransAngle())
196 TEveStraightLineSet* marker =
new TEveStraightLineSet;
197 marker->SetLineWidth(2);
198 marker->SetLineStyle(2);
209 TEveStraightLineSet* mainLine =
new TEveStraightLineSet;
210 mainLine->AddLine(-5.191,
phi, 0.01, 5.191,
phi, 0.01);
214 TEveStraightLineSet* secondLine =
new TEveStraightLineSet;
215 secondLine->SetLineStyle(7);
216 secondLine->AddLine(-5.191,
phi, 0.01, 5.191,
phi, 0.01);
222 std::vector<float> centre(3, 0);
224 for (
unsigned int i = 0;
i < 24;
i += 3) {
225 centre[0] += corners[
i];
226 centre[1] += corners[
i + 1];
227 centre[2] += corners[
i + 2];
230 for (
unsigned int i = 0;
i < 3; ++
i)
231 centre[
i] *= 1.0
f / 8.0
f;
234 for (
unsigned int i = 0;
i < 24;
i += 3) {
235 scaledCorners[
i] = centre[0] + (corners[
i] - centre[0]) *
scale;
236 scaledCorners[
i + 1] = centre[1] + (corners[
i + 1] - centre[1]) *
scale;
237 scaledCorners[
i + 2] = centre[2] + (corners[
i + 2] - centre[2]) *
scale;
245 std::vector<float> scaledCorners(24);
252 const float* corners,
float energy,
float maxEnergy, std::vector<float>& scaledCorners,
bool invert) {
253 std::vector<float> centre(3, 0);
255 for (
unsigned int i = 0;
i < 24;
i += 3) {
256 centre[0] += corners[
i];
257 centre[1] += corners[
i + 1];
258 centre[2] += corners[
i + 2];
261 for (
unsigned int i = 0;
i < 3; ++
i)
262 centre[
i] *= 1.0
f / 8.0
f;
264 TEveVector
c(centre[0], centre[1], centre[2]);
268 for (
unsigned int i = 0;
i < 24;
i += 3) {
269 scaledCorners[
i] = centre[0] + (corners[
i] - centre[0]) *
scale;
270 scaledCorners[
i + 1] = centre[1] + (corners[
i + 1] - centre[1]) *
scale;
271 scaledCorners[
i + 2] = centre[2] + (corners[
i + 2] - centre[2]) *
scale;
280 std::vector<float> scaledCorners(24);
287 for (
int i = 0;
i < 24; ++
i)
288 scaledCorners[
i] = corners[
i];
293 for (
unsigned int i = 0;
i < 12;
i += 3) {
295 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;
304 for (
unsigned int i = 0;
i < 12;
i += 3) {
306 corners[
i + 12] - corners[
i], corners[
i + 13] - corners[
i + 1], corners[
i + 14] - corners[
i + 2]);
310 scaledCorners[
i] = corners[
i + 12];
311 scaledCorners[
i + 1] = corners[
i + 13];
312 scaledCorners[
i + 2] = corners[
i + 14];
314 scaledCorners[
i + 12] = corners[
i + 12] +
diff.fX;
315 scaledCorners[
i + 13] = corners[
i + 13] +
diff.fY;
316 scaledCorners[
i + 14] = corners[
i + 14] +
diff.fZ;
322 std::vector<float> scaledCorners(24);
330 for (
int i = 0;
i < 24; ++
i)
331 scaledCorners[
i] = corners[
i];
336 for (
unsigned int i = 0;
i < 12;
i += 3) {
338 corners[
i] - corners[
i + 12], corners[
i + 1] - corners[
i + 13], corners[
i + 2] - corners[
i + 14]);
342 scaledCorners[
i] = corners[
i] +
diff.fX;
343 scaledCorners[
i + 1] = corners[
i + 1] +
diff.fY;
344 scaledCorners[
i + 2] = corners[
i + 2] +
diff.fZ;
347 for (
unsigned int i = 0;
i < 12;
i += 3) {
349 corners[
i + 12] - corners[
i], corners[
i + 13] - corners[
i + 1], corners[
i + 14] - corners[
i + 2]);
353 scaledCorners[
i] = corners[
i + 12];
354 scaledCorners[
i + 1] = corners[
i + 13];
355 scaledCorners[
i + 2] = corners[
i + 14];
357 scaledCorners[
i + 12] = corners[
i + 12] +
diff.fX;
358 scaledCorners[
i + 13] = corners[
i + 13] +
diff.fY;
359 scaledCorners[
i + 14] = corners[
i + 14] +
diff.fZ;
365 std::vector<float> scaledCorners(24);