5 #include "TEveCaloData.h" 6 #include "TEveViewer.h" 10 #include "THLimitsFinder.h" 23 #include "TGeoMatrix.h" 24 #include "TEveTrans.h" 34 if (fabs(
m_eta) < 1.5) {
42 fwLog(
fwlog::kWarning) <<
"FWECALCaloDataDetailViewBuilder::build():: Failed to access EcalRecHitsEB collection." 55 <<
"FWECALCaloDataDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEB collection." 66 fwLog(
fwlog::kWarning) <<
"FWECALCaloDataDetailViewBuilder::build():: Failed to access ecalRecHitsEE collection." 80 <<
"FWECALCaloDataDetailViewBuilder::build():: Failed to access reducedEcalRecHitsEE collection." 87 TEveCaloDataVec*
data =
new TEveCaloDataVec(1 +
m_colors.size());
90 data->RefSliceInfo(
i + 1).Setup(
"hits (clustered)", 0.0,
m_colors[
i]);
101 << Form(
"FWECALCaloDataDetailViewBuilder::build():: No hits found in eta[%f] phi[%f] region",
107 float x =
m_size * TMath::DegToRad();
108 if (fabs(
m_eta) < 1.5 || xyEE ==
false) {
115 float theta = TEveCaloData::EtaToTheta(
m_eta);
116 float r = TMath::Tan(
theta) * 290;
126 data->FillSlice(0, 0.1);
129 TAxis* eta_axis =
nullptr;
130 TAxis* phi_axis =
nullptr;
135 if (fabs(
m_eta) > 1.5 && xyEE) {
138 eta_axis->SetTitle(
"X[cm]");
139 phi_axis->SetTitle(
"Y[cm]");
140 phi_axis->SetTitleSize(0.05);
141 eta_axis->SetTitleSize(0.05);
143 std::vector<double> etaBinsWithinLimits;
144 etaBinsWithinLimits.push_back(
etaMin);
145 for (
unsigned int i = 0;
i < 83; ++
i)
148 etaBinsWithinLimits.push_back(
etaMax);
150 std::vector<double> phiBinsWithinLimits;
151 phiBinsWithinLimits.push_back(
phiMin);
154 phiBinsWithinLimits.push_back(
phi);
155 phiBinsWithinLimits.push_back(
phiMax);
157 eta_axis =
new TAxis((
int)etaBinsWithinLimits.size() - 1, &etaBinsWithinLimits[0]);
158 phi_axis =
new TAxis((
int)phiBinsWithinLimits.size() - 1, &phiBinsWithinLimits[0]);
160 eta_axis->SetTitleFont(122);
161 eta_axis->SetTitle(
"h");
162 eta_axis->SetTitleSize(0.07);
163 phi_axis->SetTitleFont(122);
164 phi_axis->SetTitle(
"f");
165 phi_axis->SetTitleSize(0.07);
167 eta_axis->SetNdivisions(510);
168 phi_axis->SetNdivisions(510);
169 data->SetEtaBins(eta_axis);
170 data->SetPhiBins(phi_axis);
183 TEveCaloLego* lego =
new TEveCaloLego(
data);
184 lego->SetDrawNumberCellPixels(100);
189 lego->InitMainTrans();
190 lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale * 0.5);
192 lego->SetAutoRebin(kFALSE);
193 lego->Set2DMode(TEveCaloLego::kValSizeOutline);
194 lego->SetName(
"ECALDetail Lego");
205 for (
size_t i = 0;
i < detIds.size(); ++
i)
210 std::vector<DetId> clusterDetIds;
211 const std::vector<std::pair<DetId, float> >& hitsAndFractions = cluster.
hitsAndFractions();
212 for (
size_t j = 0;
j < hitsAndFractions.size(); ++
j) {
213 clusterDetIds.push_back(hitsAndFractions[
j].
first);
223 if (fabs(
m_eta) < 1.5) {
237 unsigned int colorIndex = 0;
241 for (
size_t i = 0;
i < sorted.size(); ++
i) {
245 if (colorIndex % 2 == 0)
255 const float barrelCR =
m_size * 0.0172;
260 double centerEta = 0;
261 double centerPhi = 0;
266 for (
int i = 0;
i < 8; ++
i) {
273 fwLog(
fwlog::kInfo) <<
"cannot get geometry for DetId: " <<
k->id().rawId() <<
". Ignored.\n";
275 double size =
k->energy() / cosh(centerEta);
287 centerPhi -= 2 *
M_PI;
289 centerPhi += 2 *
M_PI;
292 if (!(fabs(centerEta -
m_eta) < barrelCR && fabs(centerPhi -
m_phi) < barrelCR))
305 for (
unsigned int i = 0;
i < 8; ++
i) {
308 double eta = crystal.Eta();
309 double phi = crystal.Phi();
310 if (((
k->id().subdetId() ==
EcalBarrel) && (crystal.Perp() > 135)) ||
311 ((
k->id().subdetId() ==
EcalEndcap) && (crystal.Perp() > 155)))
331 double delta = 0.0172 * 0.5;
337 if (
minPhi >= (
m_phi - barrelCR) && maxPhi <= (m_phi + barrelCR) && minEta >= (
m_eta - barrelCR) &&
346 double crystalSize =
m_size * 0.0172;
347 if (!(fabs(centerEta -
m_eta) < (crystalSize) && fabs(centerPhi -
m_phi) < (crystalSize)))
353 for (
unsigned int i = 0;
i < 8; ++
i) {
356 double x = crystal.fX;
357 double y = crystal.fY;
358 if (fabs(crystal.fZ) > 330)
380 double x0,
double y0, Color_t clustered1, Color_t clustered2, Color_t supercluster) {
381 Double_t fontsize = 0.07;
382 TLatex* latex =
new TLatex();
385 Double_t boxH = 0.25 * fontsize;
386 Double_t
yStep = 0.04;
389 latex->DrawLatex(
x,
y,
"Energy types:");
399 latex->DrawLatex(
x + 0.25,
y,
"unclustered");
407 latex->DrawLatex(
x + 0.25,
y,
"clustered");
415 latex->DrawLatex(
x + 0.25,
y,
"clustered");
417 if (supercluster < 0)
423 latex->DrawLatex(
x + 0.25,
y,
"super-cluster");
const FWGeometry * m_geom
std::vector< Color_t > m_colors
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow)
std::vector< EcalRecHit >::const_iterator const_iterator
bool getByLabel(InputTag const &, Handle< T > &) const
TEveCaloData * buildCaloData(bool xyEE)
const float * getCorners(unsigned int id) const
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs)
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
const edm::EventBase * m_event
void setColor(Color_t color, const std::vector< DetId > &detIds)
void fillData(const EcalRecHitCollection *hits, TEveCaloDataVec *data, bool xyEE)
std::map< DetId, int > m_detIdsToColor
char data[epos_bytes_allocation]
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
Geom::Theta< T > theta() const
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)