10 #include "TEveStraightLineSet.h"
11 #include "TEvePointSet.h"
12 #include "TEveScene.h"
13 #include "TEveViewer.h"
14 #include "TGLViewer.h"
15 #include "TGLOverlay.h"
18 #include "TEveCaloLegoOverlay.h"
19 #include "TRootEmbeddedCanvas.h"
59 if( !iElectron )
return;
70 eta = iElectron->
eta();
71 phi = iElectron->
phi();
85 m_legend =
new TLegend(0.01, 0.01, 0.99, 0.99, 0,
"NDC");
101 TEveCaloLegoOverlay* overlay =
new TEveCaloLegoOverlay();
102 overlay->SetShowPlane( kFALSE );
103 overlay->SetShowPerspective( kFALSE );
104 overlay->SetCaloLego( lego );
105 overlay->SetShowScales( 1 );
106 viewerGL()->AddOverlayElement( overlay );
109 viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY );
113 viewerGL()->ResetCamerasAfterNextUpdate();
141 TLatex* latex =
new TLatex( x, y,
"" );
142 const double textsize( 0.05 );
143 latex->SetTextSize( 2*textsize );
145 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index() ).c_str() );
146 y -= latex->GetTextSize()*0.6;
148 latex->SetTextSize( textsize );
149 float lineH = latex->GetTextSize()*0.6;
151 latex->DrawLatex( x, y, Form(
" E_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
152 electron->
et(), electron->
eta(), electron->
phi()) );
155 if( electron->
charge() > 0 )
156 latex->DrawLatex( x, y,
" charge = +1" );
158 latex->DrawLatex( x, y,
" charge = -1" );
163 latex->DrawLatex( x, y,
"SuperCluster vs inner state extrapolation" );
170 latex->DrawLatex( x, y,
"SeedCluster vs outer state extrapolation" );
177 latex->DrawLatex( x, y,
"Ref to SuperCluster is not available" );
180 latex->DrawLatex(x, y, TString::Format(
" Tracker driven seed: %s", electron->
trackerDrivenSeed() ?
"YES" :
"NO"));
182 latex->DrawLatex(x, y, TString::Format(
" ECAL driven seed: %s", electron->
ecalDrivenSeed() ?
"YES" :
"NO"));
196 unsigned int subdetId( 0 );
198 if( !i->
superCluster()->seed()->hitsAndFractions().empty() )
199 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
201 double ymax = lego->GetPhiMax();
202 double ymin = lego->GetPhiMin();
203 double xmax = lego->GetEtaMax();
204 double xmin = lego->GetEtaMin();
214 TEveStraightLineSet *trackpositionAtCalo =
new TEveStraightLineSet(
"sc trackpositionAtCalo");
215 trackpositionAtCalo->SetPickable(kTRUE);
216 trackpositionAtCalo->SetTitle(
"Track position at Calo propagating from the outermost state");
219 trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0);
220 trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0);
226 trackpositionAtCalo->AddLine(pos.X(),
ymin, 0, pos.X(),
ymax, 0);
227 trackpositionAtCalo->AddLine(xmin, pos.Y(), 0,
xmax,pos.Y(),0);
229 trackpositionAtCalo->SetDepthTest(kFALSE);
230 trackpositionAtCalo->SetLineColor(kBlue);
231 tList->AddElement(trackpositionAtCalo);
233 m_legend->AddEntry(trackpositionAtCalo,
"From outermost state",
"l");
239 TEveStraightLineSet *pinposition =
new TEveStraightLineSet(
"pin position");
240 pinposition->SetPickable(kTRUE);
241 pinposition->SetTitle(
"Track position at Calo propagating from the innermost state");
247 pinposition->AddLine(eta, ymax, 0, eta, ymin, 0);
248 pinposition->AddLine(xmin, phi, 0, xmax, phi, 0);
254 pinposition->AddLine(pos.X(),
ymin, 0, pos.X(),
ymax, 0);
255 pinposition->AddLine(xmin, pos.Y(), 0,
xmax, pos.Y(), 0);
257 pinposition->SetDepthTest(kFALSE);
258 pinposition->SetLineColor(kRed);
259 tList->AddElement(pinposition);
261 m_legend->AddEntry(pinposition,
"From innermost state",
"l");
267 Double_t
eta, Double_t
phi )
269 Bool_t changed = kFALSE;
300 unsigned int subdetId(0);
302 if ( !i->
superCluster()->seed()->hitsAndFractions().empty() )
303 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
305 TEveCaloDataVec*
data = (TEveCaloDataVec*)lego->GetData();
306 Double_t em, eM, pm, pM;
307 data->GetEtaLimits(em, eM);
308 data->GetPhiLimits(pm, pM);
309 data->IncDenyDestroy();
310 Bool_t changed = kFALSE;
328 if (
checkRange(em, eM, pm, pM, pos.X(), pos.Y()))
345 if (
checkRange(em, eM, pm, pM, pos.X(), pos.Y()))
351 data->AddTower(em, eM, pm, pM);
352 data->FillSlice(2, 0); data->DataChanged();
355 Double_t legoScale = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm);
356 lego->InitMainTrans();
357 lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5);
358 lego->RefMainTrans().SetPos((eM+em)*0.5, (pM+pm)*0.5, 0);
359 lego->ElementChanged(
true);
366 unsigned int subdetId(0);
368 if ( !i->
superCluster()->seed()->hitsAndFractions().empty() )
369 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
372 Double_t
x(0),
y(0),
z(0);
373 Double_t
delta(0.02);
375 TEveStraightLineSet *scposition =
new TEveStraightLineSet(
"sc position");
376 scposition->SetPickable(kTRUE);
377 scposition->SetTitle(
"Super cluster centroid");
385 scposition->AddLine(
x-delta,
y,z,
x+delta,
y,z);
386 scposition->AddLine(
x,
y-delta,z,
x,
y+delta,z);
387 scposition->AddLine(
x,
y,z-delta,
x,
y,z+delta);
388 scposition->SetLineColor(kBlue);
389 scposition->SetLineWidth(2);
390 scposition->SetDepthTest(kFALSE);
391 tList->AddElement(scposition);
393 scposition->SetMarkerColor(kBlue);
394 scposition->SetMarkerStyle(2);
395 m_legend->AddEntry(scposition,
"Super cluster centroid",
"p");
398 TEveStraightLineSet *seedposition =
new TEveStraightLineSet(
"seed position");
399 seedposition->SetTitle(
"Seed cluster centroid");
400 seedposition->SetPickable(kTRUE);
408 seedposition->AddLine(
x-delta,
y-delta,z,
x+delta,
y+delta,z);
409 seedposition->AddLine(
x-delta,
y+delta,z,
x+delta,
y-delta,z);
410 seedposition->SetLineColor(kRed);
411 seedposition->SetLineWidth(2);
412 seedposition->SetDepthTest(kFALSE);
413 tList->AddElement(seedposition);
415 seedposition->SetMarkerColor(kRed);
416 seedposition->SetMarkerStyle(5);
417 m_legend->AddEntry(seedposition,
"Seed cluster centroid",
"p");
424 TEveStraightLineSet *eldirection =
new TEveStraightLineSet(
"seed position");
425 eldirection->SetTitle(
"Electron direction at vertex");
426 eldirection->SetPickable(kTRUE);
434 eldirection->AddLine(
x-delta,
y-delta,z,
x+delta,
y+delta,z);
435 eldirection->AddLine(
x-delta,
y+delta,z,
x+delta,
y-delta,z);
436 eldirection->SetLineColor(kGreen);
437 eldirection->SetDepthTest(kFALSE);
438 tList->AddElement(eldirection);
440 eldirection->SetMarkerColor(kGreen);
441 eldirection->SetMarkerStyle(5);
442 m_legend->AddEntry(eldirection,
"Direction at vertex",
"p");
void showSuperCluster(const reco::SuperCluster &cluster, Color_t color=kYellow)
TGLViewer * viewerGL() const
double makeLegend(double x0=0.02, double y0=0.95, Color_t clustered1=kGreen+1, Color_t clustered2=kTeal, Color_t supercluster=kYellow)
virtual void setTextInfo(const FWModelId &id, const reco::GsfElectron *)
virtual double et() const
transverse energy
virtual float phi() const
momentum azimuthal angle
virtual ~FWElectronDetailView()
Sin< T >::type sin(const T &t)
const FWEventItem * item()
Bool_t checkRange(Double_t &, Double_t &, Double_t &, Double_t &, Double_t, Double_t)
FWECALDetailViewBuilder * m_builder
float deltaEtaSuperClusterTrackAtVtx() const
float deltaPhiSeedClusterTrackAtCalo() const
virtual float eta() const
momentum pseudorapidity
virtual SuperClusterRef superCluster() const
reference to a SuperCluster
float deltaPhiSuperClusterTrackAtVtx() const
Cos< T >::type cos(const T &t)
virtual int charge() const
electric charge
Tan< T >::type tan(const T &t)
virtual double theta() const
momentum polar angle
void showSuperClusters(Color_t color1=kGreen+2, Color_t color2=kTeal)
math::XYZPoint caloPosition() const
virtual void build(const FWModelId &id, const reco::GsfElectron *)
void drawCrossHair(const reco::GsfElectron *, TEveCaloLego *, TEveElementList *)
double deltaEtaSuperClusterTrackAtVtx(const reco::GsfElectron &)
float deltaEtaSeedClusterTrackAtCalo() const
void addSceneInfo(const reco::GsfElectron *i, TEveElementList *tList)
char data[epos_bytes_allocation]
#define REGISTER_FWDETAILVIEW(_classname_, _name_)
double deltaPhiSuperClusterTrackAtVtx(const reco::GsfElectron &)
bool trackerDrivenSeed() const
void addTrackPointsInCaloData(const reco::GsfElectron *, TEveCaloLego *)
bool ecalDrivenSeed() const