11 #include "TEveStraightLineSet.h"
12 #include "TEvePointSet.h"
13 #include "TEveScene.h"
14 #include "TEveViewer.h"
15 #include "TGLViewer.h"
16 #include "TGLOverlay.h"
19 #include "TEveCaloLegoOverlay.h"
20 #include "TRootEmbeddedCanvas.h"
48 m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser);
60 if( !iElectron )
return;
71 eta = iElectron->
eta();
72 phi = iElectron->
phi();
86 m_legend =
new TLegend(0.01, 0.01, 0.99, 0.99, 0,
"NDC");
102 TEveCaloLegoOverlay* overlay =
new TEveCaloLegoOverlay();
103 overlay->SetShowPlane( kFALSE );
104 overlay->SetShowPerspective( kFALSE );
105 overlay->SetCaloLego( lego );
106 overlay->SetShowScales( 1 );
107 viewerGL()->AddOverlayElement( overlay );
110 viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY );
114 viewerGL()->ResetCamerasAfterNextUpdate();
142 TLatex* latex =
new TLatex( x, y,
"" );
143 const double textsize( 0.05 );
144 latex->SetTextSize( 2*textsize );
146 latex->DrawLatex( x, y,
id.
item()->modelName(
id.
index() ).c_str() );
147 y -= latex->GetTextSize()*0.6;
149 latex->SetTextSize( textsize );
150 float lineH = latex->GetTextSize()*0.6;
152 latex->DrawLatex( x, y, Form(
" E_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f",
153 electron->
et(), electron->
eta(), electron->
phi()) );
156 if( electron->
charge() > 0 )
157 latex->DrawLatex( x, y,
" charge = +1" );
159 latex->DrawLatex( x, y,
" charge = -1" );
164 latex->DrawLatex( x, y,
"SuperCluster vs inner state extrapolation" );
171 latex->DrawLatex( x, y,
"SeedCluster vs outer state extrapolation" );
178 latex->DrawLatex( x, y,
"Ref to SuperCluster is not available" );
181 latex->DrawLatex(x, y, TString::Format(
" Tracker driven seed: %s", electron->
trackerDrivenSeed() ?
"YES" :
"NO"));
183 latex->DrawLatex(x, y, TString::Format(
" ECAL driven seed: %s", electron->
ecalDrivenSeed() ?
"YES" :
"NO"));
197 unsigned int subdetId( 0 );
199 if( !i->
superCluster()->seed()->hitsAndFractions().empty() )
200 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
202 double ymax = lego->GetPhiMax();
203 double ymin = lego->GetPhiMin();
204 double xmax = lego->GetEtaMax();
205 double xmin = lego->GetEtaMin();
215 TEveStraightLineSet *trackpositionAtCalo =
new TEveStraightLineSet(
"sc trackpositionAtCalo");
216 trackpositionAtCalo->SetPickable(kTRUE);
217 trackpositionAtCalo->SetTitle(
"Track position at Calo propagating from the outermost state");
220 trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0);
221 trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0);
227 trackpositionAtCalo->AddLine(pos.X(), ymin, 0, pos.X(), ymax, 0);
228 trackpositionAtCalo->AddLine(xmin, pos.Y(), 0, xmax,pos.Y(),0);
230 trackpositionAtCalo->SetDepthTest(kFALSE);
231 trackpositionAtCalo->SetLineColor(kBlue);
232 tList->AddElement(trackpositionAtCalo);
234 m_legend->AddEntry(trackpositionAtCalo,
"From outermost state",
"l");
240 TEveStraightLineSet *pinposition =
new TEveStraightLineSet(
"pin position");
241 pinposition->SetPickable(kTRUE);
242 pinposition->SetTitle(
"Track position at Calo propagating from the innermost state");
248 pinposition->AddLine(eta, ymax, 0, eta, ymin, 0);
249 pinposition->AddLine(xmin, phi, 0, xmax, phi, 0);
255 pinposition->AddLine(pos.X(),ymin, 0, pos.X(), ymax, 0);
256 pinposition->AddLine(xmin, pos.Y(), 0, xmax, pos.Y(), 0);
258 pinposition->SetDepthTest(kFALSE);
259 pinposition->SetLineColor(kRed);
260 tList->AddElement(pinposition);
262 m_legend->AddEntry(pinposition,
"From innermost state",
"l");
268 Double_t
eta, Double_t
phi )
270 Bool_t changed = kFALSE;
301 unsigned int subdetId(0);
303 if ( !i->
superCluster()->seed()->hitsAndFractions().empty() )
304 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
306 TEveCaloDataVec*
data = (TEveCaloDataVec*)lego->GetData();
307 Double_t em, eM, pm, pM;
308 data->GetEtaLimits(em, eM);
309 data->GetPhiLimits(pm, pM);
310 data->IncDenyDestroy();
311 Bool_t changed = kFALSE;
329 if (
checkRange(em, eM, pm, pM, pos.X(), pos.Y()))
346 if (
checkRange(em, eM, pm, pM, pos.X(), pos.Y()))
352 data->AddTower(em, eM, pm, pM);
353 data->FillSlice(2, 0); data->DataChanged();
356 Double_t legoScale = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm);
357 lego->InitMainTrans();
358 lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5);
359 lego->RefMainTrans().SetPos((eM+em)*0.5, (pM+pm)*0.5, 0);
360 lego->ElementChanged(
true);
367 unsigned int subdetId(0);
369 if ( !i->
superCluster()->seed()->hitsAndFractions().empty() )
370 subdetId = i->
superCluster()->seed()->hitsAndFractions().front().first.subdetId();
373 Double_t
x(0),
y(0),
z(0);
374 Double_t
delta(0.02);
376 TEveStraightLineSet *scposition =
new TEveStraightLineSet(
"sc position");
377 scposition->SetPickable(kTRUE);
378 scposition->SetTitle(
"Super cluster centroid");
386 scposition->AddLine(
x-delta,
y,z,
x+delta,
y,z);
387 scposition->AddLine(
x,
y-delta,z,
x,
y+delta,z);
388 scposition->AddLine(
x,
y,z-delta,
x,
y,z+delta);
389 scposition->SetLineColor(kBlue);
390 scposition->SetLineWidth(2);
391 scposition->SetDepthTest(kFALSE);
392 tList->AddElement(scposition);
394 scposition->SetMarkerColor(kBlue);
395 scposition->SetMarkerStyle(2);
396 m_legend->AddEntry(scposition,
"Super cluster centroid",
"p");
399 TEveStraightLineSet *seedposition =
new TEveStraightLineSet(
"seed position");
400 seedposition->SetTitle(
"Seed cluster centroid");
401 seedposition->SetPickable(kTRUE);
409 seedposition->AddLine(
x-delta,
y-delta,z,
x+delta,
y+delta,z);
410 seedposition->AddLine(
x-delta,
y+delta,z,
x+delta,
y-delta,z);
411 seedposition->SetLineColor(kRed);
412 seedposition->SetLineWidth(2);
413 seedposition->SetDepthTest(kFALSE);
414 tList->AddElement(seedposition);
416 seedposition->SetMarkerColor(kRed);
417 seedposition->SetMarkerStyle(5);
418 m_legend->AddEntry(seedposition,
"Seed cluster centroid",
"p");
425 TEveStraightLineSet *eldirection =
new TEveStraightLineSet(
"seed position");
426 eldirection->SetTitle(
"Electron direction at vertex");
427 eldirection->SetPickable(kTRUE);
435 eldirection->AddLine(
x-delta,
y-delta,z,
x+delta,
y+delta,z);
436 eldirection->AddLine(
x-delta,
y+delta,z,
x+delta,
y-delta,z);
437 eldirection->SetLineColor(kGreen);
438 eldirection->SetDepthTest(kFALSE);
439 tList->AddElement(eldirection);
441 eldirection->SetMarkerColor(kGreen);
442 eldirection->SetMarkerStyle(5);
443 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 ~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)
virtual double eta() const
momentum pseudorapidity
FWECALDetailViewBuilder * m_builder
float deltaEtaSuperClusterTrackAtVtx() const
float deltaPhiSeedClusterTrackAtCalo() const
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 *)
virtual double phi() const
momentum azimuthal angle
bool ecalDrivenSeed() const