5 #include "TEveCaloData.h"
6 #include "TEveViewer.h"
7 #include "TEvePointSet.h"
9 #include "TEveCompound.h"
12 #include "THLimitsFinder.h"
27 #include "TGeoMatrix.h"
28 #include "TEveTrans.h"
40 m_defaultColor(defaultColor),
41 m_towerList(nullptr) {}
47 TEveCaloDataVec *
data =
new TEveCaloDataVec(1);
48 data->SetWrapTwoPi(
false);
61 data->FillSlice(0, 0.1);
63 TAxis *eta_axis =
nullptr;
64 TAxis *phi_axis =
nullptr;
67 std::vector<double> etaBinsWithinLimits;
68 etaBinsWithinLimits.push_back(
etaMin);
69 for (
unsigned int i = 0;
i < 83; ++
i)
72 etaBinsWithinLimits.push_back(
etaMax);
74 std::vector<double> phiBinsWithinLimits;
75 phiBinsWithinLimits.push_back(
phiMin);
78 phiBinsWithinLimits.push_back(
phi);
79 phiBinsWithinLimits.push_back(
phiMax);
81 eta_axis =
new TAxis((
int)etaBinsWithinLimits.size() - 1, &etaBinsWithinLimits[0]);
82 phi_axis =
new TAxis((
int)phiBinsWithinLimits.size() - 1, &phiBinsWithinLimits[0]);
84 eta_axis->SetTitleFont(122);
85 eta_axis->SetTitle(
"h");
86 eta_axis->SetTitleSize(0.07);
87 phi_axis->SetTitleFont(122);
88 phi_axis->SetTitle(
"f");
89 phi_axis->SetTitleSize(0.07);
91 eta_axis->SetNdivisions(510);
92 phi_axis->SetNdivisions(510);
93 data->SetEtaBins(eta_axis);
94 data->SetPhiBins(phi_axis);
110 TEveCaloLego *lego =
new TEveCaloLego();
113 lego->SetAutoRange(
false);
114 lego->SetDrawNumberCellPixels(100);
118 Double_t legoScale =
sizeRad() * 2;
119 lego->InitMainTrans();
120 lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale * 0.5);
121 lego->RefMainTrans().SetPos(
m_eta,
m_phi, -0.01);
122 lego->SetAutoRebin(kFALSE);
123 lego->SetName(
"ECALDetail Lego");
126 lego->SetScaleAbs(
true);
127 lego->SetHasFixedHeightIn2DMode(
true);
128 lego->SetFixedHeightValIn2DMode(0.001);
130 TEvePointSet *ps =
new TEvePointSet(
"origin");
132 ps->SetMarkerSize(0.05);
133 ps->SetMarkerStyle(2);
134 ps->SetMainColor(kGreen);
135 ps->SetMarkerColor(kGreen);
136 lego->AddElement(ps);
142 for (
size_t i = 0;
i < detIds.size(); ++
i)
147 std::vector<DetId> clusterDetIds;
148 const std::vector<std::pair<DetId, float> > &hitsAndFractions = cluster.
hitsAndFractions();
149 for (
size_t j = 0;
j < hitsAndFractions.size(); ++
j) {
150 clusterDetIds.push_back(hitsAndFractions[
j].
first);
160 if (fabs(
m_eta) < 1.5) {
174 unsigned int colorIndex = 0;
178 for (
size_t i = 0;
i < sorted.size(); ++
i) {
182 if (colorIndex % 2 == 0)
193 TEveVector vec = centre;
214 std::vector<FWBoxRecHit *> boxes;
218 std::vector<TEveVector> etaphiCorners(8);
220 if (corners ==
nullptr)
223 for (
int i = 0;
i < 4; ++
i) {
224 TEveVector
cv = TEveVector(corners[
i * 3], corners[
i * 3 + 1], corners[
i * 3 + 2]);
225 etaphiCorners[
i].fX =
cv.Eta();
226 etaphiCorners[
i].fY =
cv.Phi();
227 etaphiCorners[
i].fZ = 0.0;
229 etaphiCorners[
i + 4].fX =
231 etaphiCorners[
i + 4].fY = etaphiCorners[
i].fY;
232 etaphiCorners[
i + 4].fZ = 0.001;
237 for (
int i = 0;
i < 4; ++
i)
238 center += etaphiCorners[
i];
241 if (center.fX <
eta1 || center.fX >
eta2)
243 if (center.fY < phi1 || center.fY > phi2)
247 float dPhi1 = etaphiCorners[2].fY - etaphiCorners[1].fY;
248 float dPhi2 = etaphiCorners[3].fY - etaphiCorners[0].fY;
249 float dPhi3 = etaphiCorners[1].fY - etaphiCorners[2].fY;
250 float dPhi4 = etaphiCorners[0].fY - etaphiCorners[3].fY;
253 etaphiCorners[2].fY = etaphiCorners[2].fY - (2 *
TMath::Pi());
255 etaphiCorners[3].fY = etaphiCorners[3].fY - (2 *
TMath::Pi());
257 etaphiCorners[2].fY = etaphiCorners[2].fY + (2 *
TMath::Pi());
259 etaphiCorners[3].fY = etaphiCorners[3].fY + (2 *
TMath::Pi());
266 bcolor =
itr->second;
269 TEveElement::List_i pIt =
m_boxes.back()->getTower()->BeginParents();
270 TEveCompound *
comp = dynamic_cast<TEveCompound *>(*pIt);
271 comp->SetMainColor(bcolor);
272 m_boxes.back()->getTower()->SetPickable(
true);
273 m_boxes.back()->getTower()->SetElementTitle(Form(
"rawId = %d, et = %f", hitIt->id().rawId(),
et));
289 hitsEB = &*handle_hitsEB;
292 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access EcalRecHitsEB collection."
297 if (!handle_hitsEB.
isValid()) {
302 hitsEB = &*handle_hitsEB;
307 <<
"FWECALDetailViewBuilder::filData():: Failed to access reducedEcalRecHitsEB collection." << std::endl;
312 if (!handle_hitsEB.
isValid()) {
317 hitsEB = &*handle_hitsEB;
321 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::filData():: Failed to access reducedEgamma collection."
341 hitsEE = &*handle_hitsEE;
343 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access ecalRecHitsEE collection."
348 if (!handle_hitsEE.
isValid()) {
353 hitsEE = &*handle_hitsEE;
358 <<
"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl;
362 if (!handle_hitsEE.
isValid()) {
367 hitsEE = &*handle_hitsEE;
372 <<
"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl;
387 int maxEnergyIdx = 0;
399 m_boxes[maxEnergyIdx]->setIsTallest();
405 i->getTower()->SetDrawFrame(
true);
411 double x0,
double y0, Color_t clustered1, Color_t clustered2, Color_t supercluster) {
412 Double_t fontsize = 0.07;
413 TLatex *latex =
new TLatex();
416 Double_t boxH = 0.25 * fontsize;
417 Double_t
yStep = 0.04;
420 latex->DrawLatex(
x,
y,
"Energy types:");
430 latex->DrawLatex(
x + 0.25,
y,
"unclustered");
438 latex->DrawLatex(
x + 0.25,
y,
"clustered");
446 latex->DrawLatex(
x + 0.25,
y,
"clustered");
448 if (supercluster < 0)
454 latex->DrawLatex(
x + 0.25,
y,
"super-cluster");
462 float rs =
m_size * TMath::DegToRad();