5 #include "TEveCaloData.h"
6 #include "TEveViewer.h"
7 #include "TEvePointSet.h"
9 #include "TEveCompound.h"
12 #include "THLimitsFinder.h"
28 #include "TGeoMatrix.h"
29 #include "TEveTrans.h"
35 float eta,
float phi,
int size , Color_t defaultColor)
37 : m_event(event), m_geom(geom),
38 m_eta(eta), m_phi(phi), m_size(size),
39 m_defaultColor(defaultColor), m_towerList(0)
49 TEveCaloDataVec*
data =
new TEveCaloDataVec( 1);
50 data->SetWrapTwoPi(
false);
51 data->RefSliceInfo(0).Setup(
"hits (not clustered)", 0.0,
m_defaultColor );
63 data->FillSlice(0, 0.1);
71 std::vector<double> etaBinsWithinLimits;
72 etaBinsWithinLimits.push_back(etaMin);
73 for (
unsigned int i=0;
i<83; ++
i)
76 etaBinsWithinLimits.push_back(etaMax);
78 std::vector<double> phiBinsWithinLimits;
79 phiBinsWithinLimits.push_back(phiMin);
81 if (
phi > phiMin &&
phi < phiMax )
82 phiBinsWithinLimits.push_back(
phi);
83 phiBinsWithinLimits.push_back(phiMax);
85 eta_axis =
new TAxis((
int)etaBinsWithinLimits.size() -1, &etaBinsWithinLimits[0]);
86 phi_axis =
new TAxis((
int)phiBinsWithinLimits.size() -1, &phiBinsWithinLimits[0]);
88 eta_axis->SetTitleFont(122);
89 eta_axis->SetTitle(
"h");
90 eta_axis->SetTitleSize(0.07);
91 phi_axis->SetTitleFont(122);
92 phi_axis->SetTitle(
"f");
93 phi_axis->SetTitleSize(0.07);
95 eta_axis->SetNdivisions(510);
96 phi_axis->SetNdivisions(510);
97 data->SetEtaBins(eta_axis);
98 data->SetPhiBins(phi_axis);
116 TEveCaloLego *lego =
new TEveCaloLego();
119 lego->SetAutoRange(
false);
120 lego->SetDrawNumberCellPixels(100);
122 lego->SetEta(etaMin, etaMax);
123 lego->SetPhiWithRng((phiMin+phiMax)*0.5, (phiMax-phiMin)*0.5);
124 Double_t legoScale =
sizeRad() *2;
125 lego->InitMainTrans();
126 lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5);
127 lego->RefMainTrans().SetPos(
m_eta,
m_phi, -0.01);
128 lego->SetAutoRebin(kFALSE);
129 lego->SetName(
"ECALDetail Lego");
132 lego->SetScaleAbs(
true);
133 lego->SetHasFixedHeightIn2DMode(
true);
134 lego->SetFixedHeightValIn2DMode(0.001);
137 TEvePointSet* ps =
new TEvePointSet(
"origin");
139 ps->SetMarkerSize(0.05);
140 ps->SetMarkerStyle(2);
141 ps->SetMainColor(kGreen);
142 ps->SetMarkerColor(kGreen);
143 lego->AddElement(ps);
151 for (
size_t i = 0;
i < detIds.size(); ++
i)
158 std::vector<DetId> clusterDetIds;
159 const std::vector<std::pair<DetId, float> > &hitsAndFractions = cluster.
hitsAndFractions();
160 for (
size_t j = 0;
j < hitsAndFractions.size(); ++
j)
162 clusterDetIds.push_back(hitsAndFractions[
j].
first);
174 if( fabs(
m_eta ) < 1.5 ) {
193 unsigned int colorIndex = 0;
197 for(
size_t i = 0;
i < sorted.size(); ++
i )
203 if( colorIndex %2 == 0 )
217 TEveVector vec = centre;
235 double eta1 =
m_eta - area;
236 double eta2 =
m_eta + area;
237 double phi1 =
m_phi - area;
238 double phi2 =
m_phi + area;
241 std::vector<FWBoxRecHit*> boxes;
246 std::vector<TEveVector> etaphiCorners(8);
252 for(
int i = 0;
i < 4; ++
i )
254 TEveVector
cv = TEveVector( corners[
i*3], corners[i*3+1], corners[i*3+2] );
255 etaphiCorners[
i].fX = cv.Eta();
256 etaphiCorners[
i].fY = cv.Phi();
257 etaphiCorners[
i].fZ = 0.0;
259 etaphiCorners[i+4].fX = etaphiCorners[
i].fX;
260 etaphiCorners[i+4].fY = etaphiCorners[
i].fY;
261 etaphiCorners[i+4].fZ = 0.001;
266 for(
int i = 0;
i < 4; ++
i )
267 center += etaphiCorners[
i];
271 if ( center.fX < eta1 || center.fX > eta2)
continue;
272 if ( center.fY < phi1 || center.fY > phi2)
continue;
277 float dPhi1 = etaphiCorners[2].fY - etaphiCorners[1].fY;
278 float dPhi2 = etaphiCorners[3].fY - etaphiCorners[0].fY;
279 float dPhi3 = etaphiCorners[1].fY - etaphiCorners[2].fY;
280 float dPhi4 = etaphiCorners[0].fY - etaphiCorners[3].fY;
283 etaphiCorners[2].fY = etaphiCorners[2].fY - ( 2 *
TMath::Pi() );
285 etaphiCorners[3].fY = etaphiCorners[3].fY - ( 2 *
TMath::Pi() );
287 etaphiCorners[2].fY = etaphiCorners[2].fY + ( 2 *
TMath::Pi() );
289 etaphiCorners[3].fY = etaphiCorners[3].fY + ( 2 *
TMath::Pi() );
293 energy = hitIt->energy();
296 std::map<DetId, int>::const_iterator itr =
m_detIdsToColor.find(hitIt->id());
300 TEveElement::List_i pIt =
m_boxes.back()->getTower()->BeginParents();
301 TEveCompound*
comp =
dynamic_cast<TEveCompound*
>(*pIt);
302 comp->SetMainColor(bcolor);
303 m_boxes.back()->getTower()->SetPickable(
true);
304 m_boxes.back()->getTower()->SetElementTitle(Form(
"rawId = %d, et = %f", hitIt->id().rawId(), et));
327 hitsEB = &*handle_hitsEB;
332 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access EcalRecHitsEB collection." << std::endl;
337 if ( ! handle_hitsEB.
isValid()) {
343 hitsEB = &*handle_hitsEB;
349 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::filData():: Failed to access reducedEcalRecHitsEB collection." << std::endl;
354 if ( ! handle_hitsEB.
isValid()) {
360 hitsEB = &*handle_hitsEB;
369 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::filData():: Failed to access reducedEgamma collection." << std::endl;
390 hitsEE = &*handle_hitsEE;
394 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access ecalRecHitsEE collection." << std::endl;
398 if ( ! handle_hitsEE.
isValid()) {
404 hitsEE = &*handle_hitsEE;
410 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl;
414 if ( ! handle_hitsEE.
isValid()) {
420 hitsEE = &*handle_hitsEE;
426 fwLog(
fwlog::kWarning) <<
"FWECALDetailViewBuilder::fillData():: Failed to access reducedEcalRecHitsEE collection." << std::endl;
442 int maxEnergyIdx = 0;
447 if (
i->getEnergy(plotEt) > maxEnergy) {
448 maxEnergy =
i->getEnergy(plotEt);
454 m_boxes[maxEnergyIdx]->setIsTallest();
457 float scale = 0.3/maxEnergy;
458 for (
auto &
i : m_boxes) {
459 i->updateScale(scale,
log(maxEnergy + 1), plotEt);
460 i->getTower()->SetDrawFrame(
true);
467 Color_t clustered1, Color_t clustered2,
471 Double_t fontsize = 0.07;
472 TLatex* latex =
new TLatex();
475 Double_t boxH = 0.25*fontsize;
476 Double_t
yStep = 0.04;
479 latex->DrawLatex(x, y,
"Energy types:");
486 pos[1] =
y; pos[3] = pos[1] + boxH;
488 latex->DrawLatex(x+0.25, y,
"unclustered");
490 if (clustered1<0)
return y;
492 pos[1] =
y; pos[3] = pos[1] + boxH;
494 latex->DrawLatex(x+0.25, y,
"clustered");
496 if (clustered2<0)
return y;
498 pos[1] =
y; pos[3] = pos[1] + boxH;
500 latex->DrawLatex(x+0.25, y,
"clustered");
502 if (supercluster<0)
return y;
504 pos[1] =
y; pos[3] = pos[1] + boxH;
506 latex->DrawLatex(x+0.25, y,
"super-cluster");
515 float rs =
m_size * TMath::DegToRad();
void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow)
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
void fillData(TEveCaloDataVec *data)
std::vector< EcalRecHit >::const_iterator const_iterator
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
void fillEtaPhi(const EcalRecHitCollection *hits, TEveCaloDataVec *data)
const edm::EventBase * m_event
TEveElement * m_towerList
std::map< DetId, int > m_detIdsToColor
FWECALDetailViewBuilder(const edm::EventBase *event, const FWGeometry *geom, float eta, float phi, int size=50, Color_t defaultColor=kMagenta+1)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
const FWGeometry * m_geom
TEveCaloData * buildCaloData(bool xyEE)
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
float calculateEt(const TEveVector ¢re, float e)
const_iterator end() const
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
const float * getCorners(unsigned int id) const
T const * product() const
void setColor(Color_t color, const std::vector< DetId > &detIds)
Geom::Phi< T > phi() const
bool getByLabel(InputTag const &, Handle< T > &) const
char data[epos_bytes_allocation]
static bool superClusterEtaLess(const reco::CaloCluster &lhs, const reco::CaloCluster &rhs)
std::vector< FWBoxRecHit * > m_boxes
tuple size
Write out results.
const_iterator begin() const
static void drawCanvasBox(Double_t *pos, Color_t fillCol, Int_t fillType=0, bool bg=kTRUE)