#include <FWElectronDetailView.h>
Public Member Functions | |
FWElectronDetailView () | |
virtual | ~FWElectronDetailView () |
Private Member Functions | |
void | addSceneInfo (const reco::GsfElectron *i, TEveElementList *tList) |
void | addTrackPointsInCaloData (const reco::GsfElectron *, TEveCaloLego *) |
virtual void | build (const FWModelId &id, const reco::GsfElectron *) |
Bool_t | checkRange (Double_t &, Double_t &, Double_t &, Double_t &, Double_t, Double_t) |
double | deltaEtaSuperClusterTrackAtVtx (const reco::GsfElectron &) |
double | deltaPhiSuperClusterTrackAtVtx (const reco::GsfElectron &) |
void | drawCrossHair (const reco::GsfElectron *, TEveCaloLego *, TEveElementList *) |
FWElectronDetailView (const FWElectronDetailView &) | |
const FWElectronDetailView & | operator= (const FWElectronDetailView &) |
virtual void | setTextInfo (const FWModelId &id, const reco::GsfElectron *) |
Private Attributes | |
FWECALDetailViewBuilder * | m_builder |
TEveCaloData * | m_data |
TLegend * | m_legend |
Definition at line 31 of file FWElectronDetailView.h.
FWElectronDetailView::FWElectronDetailView | ( | ) |
Definition at line 39 of file FWElectronDetailView.cc.
FWElectronDetailView::~FWElectronDetailView | ( | ) | [virtual] |
Definition at line 46 of file FWElectronDetailView.cc.
References m_builder, m_data, and FWDetailViewGL< reco::GsfElectron >::m_eveViewer.
{ m_eveViewer->GetGLViewer()->DeleteOverlayElements(TGLOverlayElement::kUser); delete m_builder; if (m_data) m_data->DecDenyDestroy(); }
FWElectronDetailView::FWElectronDetailView | ( | const FWElectronDetailView & | ) | [private] |
void FWElectronDetailView::addSceneInfo | ( | const reco::GsfElectron * | i, |
TEveElementList * | tList | ||
) | [private] |
Definition at line 365 of file FWElectronDetailView.cc.
References reco::GsfElectron::caloPosition(), funct::cos(), delta, EcalBarrel, EcalEndcap, reco::LeafCandidate::eta(), m_legend, reco::LeafCandidate::phi(), funct::sin(), reco::GsfElectron::superCluster(), funct::tan(), reco::LeafCandidate::theta(), ExpressReco_HICollisions_FallBack::x, ExpressReco_HICollisions_FallBack::y, and z.
Referenced by build().
{ unsigned int subdetId(0); if ( !i->superCluster()->seed()->hitsAndFractions().empty() ) subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); // centroids Double_t x(0), y(0), z(0); Double_t delta(0.02); if (subdetId == EcalEndcap) delta = 2.5; TEveStraightLineSet *scposition = new TEveStraightLineSet("sc position"); scposition->SetPickable(kTRUE); scposition->SetTitle("Super cluster centroid"); if (subdetId == EcalBarrel) { x = i->caloPosition().eta(); y = i->caloPosition().phi(); } else if (subdetId == EcalEndcap) { x = i->caloPosition().x(); y = i->caloPosition().y(); } scposition->AddLine(x-delta,y,z,x+delta,y,z); scposition->AddLine(x,y-delta,z,x,y+delta,z); scposition->AddLine(x,y,z-delta,x,y,z+delta); scposition->SetLineColor(kBlue); scposition->SetLineWidth(2); scposition->SetDepthTest(kFALSE); tList->AddElement(scposition); scposition->SetMarkerColor(kBlue); scposition->SetMarkerStyle(2); m_legend->AddEntry(scposition, "Super cluster centroid", "p"); // seed position TEveStraightLineSet *seedposition = new TEveStraightLineSet("seed position"); seedposition->SetTitle("Seed cluster centroid"); seedposition->SetPickable(kTRUE); if (subdetId == EcalBarrel) { x = i->superCluster()->seed()->position().eta(); y = i->superCluster()->seed()->position().phi(); } else if (subdetId == EcalEndcap) { x = i->superCluster()->seed()->position().x(); y = i->superCluster()->seed()->position().y(); } seedposition->AddLine(x-delta,y-delta,z,x+delta,y+delta,z); seedposition->AddLine(x-delta,y+delta,z,x+delta,y-delta,z); seedposition->SetLineColor(kRed); seedposition->SetLineWidth(2); seedposition->SetDepthTest(kFALSE); tList->AddElement(seedposition); seedposition->SetMarkerColor(kRed); seedposition->SetMarkerStyle(5); m_legend->AddEntry(seedposition, "Seed cluster centroid", "p"); // electron direction (show it if it's within // the area of interest) if ( fabs(i->phi()-i->caloPosition().phi())< 25*0.0172 && fabs(i->eta()-i->caloPosition().eta())< 25*0.0172 ) { TEveStraightLineSet *eldirection = new TEveStraightLineSet("seed position"); eldirection->SetTitle("Electron direction at vertex"); eldirection->SetPickable(kTRUE); if (subdetId == EcalBarrel) { x = i->eta(); y = i->phi(); }else{ x = 310*fabs(tan(i->theta()))*cos(i->phi()); y = 310*fabs(tan(i->theta()))*sin(i->phi()); } eldirection->AddLine(x-delta,y-delta,z,x+delta,y+delta,z); eldirection->AddLine(x-delta,y+delta,z,x+delta,y-delta,z); eldirection->SetLineColor(kGreen); eldirection->SetDepthTest(kFALSE); tList->AddElement(eldirection); eldirection->SetMarkerColor(kGreen); eldirection->SetMarkerStyle(5); m_legend->AddEntry(eldirection, "Direction at vertex", "p"); } }
void FWElectronDetailView::addTrackPointsInCaloData | ( | const reco::GsfElectron * | i, |
TEveCaloLego * | lego | ||
) | [private] |
Definition at line 299 of file FWElectronDetailView.cc.
References reco::GsfElectron::caloPosition(), checkRange(), runTheMatrix::data, reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaPhiSuperClusterTrackAtVtx(), EcalBarrel, EcalEndcap, eta(), phi, pos, and reco::GsfElectron::superCluster().
Referenced by build().
{ unsigned int subdetId(0); if ( !i->superCluster()->seed()->hitsAndFractions().empty() ) subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); TEveCaloDataVec* data = (TEveCaloDataVec*)lego->GetData(); Double_t em, eM, pm, pM; data->GetEtaLimits(em, eM); data->GetPhiLimits(pm, pM); data->IncDenyDestroy(); Bool_t changed = kFALSE; // add cells in third layer if necessary // trackpositionAtCalo { double eta = i->superCluster()->seed()->position().eta() - i->deltaEtaSeedClusterTrackAtCalo(); double phi = i->superCluster()->seed()->position().phi() - i->deltaPhiSeedClusterTrackAtCalo(); if (subdetId == EcalBarrel) { if (checkRange(em, eM, pm, pM, eta, phi)) changed = kTRUE; } else if (subdetId == EcalEndcap) { TVector3 pos; pos.SetPtEtaPhi(i->superCluster()->seed()->position().rho(),eta, phi); if (checkRange(em, eM, pm, pM, pos.X(), pos.Y())) changed = kTRUE; } } // pinposition { double eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i); double phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i); if (subdetId == EcalBarrel) { if (checkRange(em, eM, pm, pM, eta, phi)) changed = kTRUE; } else if (subdetId == EcalEndcap) { TVector3 pos; pos.SetPtEtaPhi(i->caloPosition().rho(), eta, phi); if (checkRange(em, eM, pm, pM, pos.X(), pos.Y())) changed = kTRUE; } } if (changed) { data->AddTower(em, eM, pm, pM); data->FillSlice(2, 0); data->DataChanged(); lego->ComputeBBox(); Double_t legoScale = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm); lego->InitMainTrans(); lego->RefMainTrans().SetScale(legoScale, legoScale, legoScale*0.5); lego->RefMainTrans().SetPos((eM+em)*0.5, (pM+pm)*0.5, 0); lego->ElementChanged(true); } }
void FWElectronDetailView::build | ( | const FWModelId & | id, |
const reco::GsfElectron * | iElectron | ||
) | [private, virtual] |
Implements FWDetailView< reco::GsfElectron >.
Definition at line 58 of file FWElectronDetailView.cc.
References addSceneInfo(), addTrackPointsInCaloData(), FWECALDetailViewBuilder::build(), reco::GsfElectron::caloPosition(), drawCrossHair(), eta(), reco::LeafCandidate::eta(), FWDetailViewBase::item(), m_builder, m_data, FWDetailViewGL< reco::GsfElectron >::m_eveScene, m_legend, reco::LeafCandidate::phi(), phi, setTextInfo(), FWECALDetailViewBuilder::showSuperCluster(), FWECALDetailViewBuilder::showSuperClusters(), reco::GsfElectron::superCluster(), and FWDetailViewGL< reco::GsfElectron >::viewerGL().
{ if( !iElectron ) return; // If SuperCluster reference is not stored, // take eta and phi of a Candidate double eta = 0; double phi = 0; if( iElectron->superCluster().isAvailable() ) { eta = iElectron->caloPosition().eta(); phi = iElectron->caloPosition().phi(); } else { eta = iElectron->eta(); phi = iElectron->phi(); } // build ECAL objects m_builder = new FWECALDetailViewBuilder( id.item()->getEvent(), id.item()->getGeom(), eta, phi, 25); m_builder->showSuperClusters(); if( iElectron->superCluster().isAvailable() ) m_builder->showSuperCluster( *(iElectron->superCluster() ), kYellow); TEveCaloLego* lego = m_builder->build(); m_data = lego->GetData(); m_eveScene->AddElement( lego ); m_legend = new TLegend(0.01, 0.01, 0.99, 0.99, 0, "NDC"); m_legend->SetTextSize(0.075); m_legend->SetBorderSize(0); m_legend->SetMargin(0.15); m_legend->SetEntrySeparation(0.05); // add Electron specific details if( iElectron->superCluster().isAvailable() ) { addTrackPointsInCaloData( iElectron, lego ); drawCrossHair( iElectron, lego, m_eveScene ); addSceneInfo( iElectron, m_eveScene ); } // draw axis at the window corners if (1) { TEveCaloLegoOverlay* overlay = new TEveCaloLegoOverlay(); overlay->SetShowPlane( kFALSE ); overlay->SetShowPerspective( kFALSE ); overlay->SetCaloLego( lego ); overlay->SetShowScales( 1 ); // temporary viewerGL()->AddOverlayElement( overlay ); } // set event handler and flip camera to top view at beginning viewerGL()->SetCurrentCamera( TGLViewer::kCameraOrthoXOY ); FWGLEventHandler* eh = new FWGLEventHandler( (TGWindow*)viewerGL()->GetGLWidget(), (TObject*)viewerGL(), lego ); viewerGL()->SetEventHandler( eh ); viewerGL()->ResetCamerasAfterNextUpdate(); viewerGL()->UpdateScene(kFALSE); gEve->Redraw3D(); setTextInfo( id, iElectron ); }
Bool_t FWElectronDetailView::checkRange | ( | Double_t & | em, |
Double_t & | eM, | ||
Double_t & | pm, | ||
Double_t & | pM, | ||
Double_t | eta, | ||
Double_t | phi | ||
) | [private] |
Definition at line 267 of file FWElectronDetailView.cc.
Referenced by addTrackPointsInCaloData().
double FWElectronDetailView::deltaEtaSuperClusterTrackAtVtx | ( | const reco::GsfElectron & | electron | ) | [private] |
Definition at line 122 of file FWElectronDetailView.cc.
References reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx().
Referenced by addTrackPointsInCaloData(), and drawCrossHair().
{ return electron.deltaEtaSuperClusterTrackAtVtx(); }
double FWElectronDetailView::deltaPhiSuperClusterTrackAtVtx | ( | const reco::GsfElectron & | electron | ) | [private] |
Definition at line 128 of file FWElectronDetailView.cc.
References reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx().
Referenced by addTrackPointsInCaloData(), and drawCrossHair().
{ return electron.deltaPhiSuperClusterTrackAtVtx(); }
void FWElectronDetailView::drawCrossHair | ( | const reco::GsfElectron * | i, |
TEveCaloLego * | lego, | ||
TEveElementList * | tList | ||
) | [private] |
Definition at line 195 of file FWElectronDetailView.cc.
References reco::GsfElectron::caloPosition(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), deltaPhiSuperClusterTrackAtVtx(), EcalBarrel, EcalEndcap, eta(), m_legend, phi, pos, and reco::GsfElectron::superCluster().
Referenced by build().
{ unsigned int subdetId( 0 ); if( !i->superCluster()->seed()->hitsAndFractions().empty() ) subdetId = i->superCluster()->seed()->hitsAndFractions().front().first.subdetId(); double ymax = lego->GetPhiMax(); double ymin = lego->GetPhiMin(); double xmax = lego->GetEtaMax(); double xmin = lego->GetEtaMin(); // draw crosshairs for track intersections { const double eta = i->superCluster()->seed()->position().eta() - i->deltaEtaSeedClusterTrackAtCalo(); const double phi = i->superCluster()->seed()->position().phi() - i->deltaPhiSeedClusterTrackAtCalo(); TEveStraightLineSet *trackpositionAtCalo = new TEveStraightLineSet("sc trackpositionAtCalo"); trackpositionAtCalo->SetPickable(kTRUE); trackpositionAtCalo->SetTitle("Track position at Calo propagating from the outermost state"); if (subdetId == EcalBarrel) { trackpositionAtCalo->AddLine(eta, ymin, 0, eta, ymax, 0); trackpositionAtCalo->AddLine(xmin, phi, 0, xmax, phi, 0); } else if (subdetId == EcalEndcap) { TVector3 pos; pos.SetPtEtaPhi(i->superCluster()->seed()->position().rho(), eta, phi); trackpositionAtCalo->AddLine(pos.X(), ymin, 0, pos.X(), ymax, 0); trackpositionAtCalo->AddLine(xmin, pos.Y(), 0, xmax,pos.Y(),0); } trackpositionAtCalo->SetDepthTest(kFALSE); trackpositionAtCalo->SetLineColor(kBlue); tList->AddElement(trackpositionAtCalo); m_legend->AddEntry(trackpositionAtCalo, "From outermost state", "l"); } // // pin position // { TEveStraightLineSet *pinposition = new TEveStraightLineSet("pin position"); pinposition->SetPickable(kTRUE); pinposition->SetTitle("Track position at Calo propagating from the innermost state"); Double_t eta = i->caloPosition().eta() - deltaEtaSuperClusterTrackAtVtx(*i); Double_t phi = i->caloPosition().phi() - deltaPhiSuperClusterTrackAtVtx(*i); if (subdetId == EcalBarrel) { pinposition->AddLine(eta, ymax, 0, eta, ymin, 0); pinposition->AddLine(xmin, phi, 0, xmax, phi, 0); } else if (subdetId == EcalEndcap) { TVector3 pos; pos.SetPtEtaPhi(i->caloPosition().rho(), eta, phi); pinposition->AddLine(pos.X(),ymin, 0, pos.X(), ymax, 0); pinposition->AddLine(xmin, pos.Y(), 0, xmax, pos.Y(), 0); } pinposition->SetDepthTest(kFALSE); pinposition->SetLineColor(kRed); tList->AddElement(pinposition); m_legend->AddEntry(pinposition, "From innermost state", "l"); } }
const FWElectronDetailView& FWElectronDetailView::operator= | ( | const FWElectronDetailView & | ) | [private] |
void FWElectronDetailView::setTextInfo | ( | const FWModelId & | id, |
const reco::GsfElectron * | electron | ||
) | [private, virtual] |
Implements FWDetailView< reco::GsfElectron >.
Definition at line 134 of file FWElectronDetailView.cc.
References reco::LeafCandidate::charge(), reco::GsfElectron::deltaEtaSeedClusterTrackAtCalo(), reco::GsfElectron::deltaEtaSuperClusterTrackAtVtx(), reco::GsfElectron::deltaPhiSeedClusterTrackAtCalo(), reco::GsfElectron::deltaPhiSuperClusterTrackAtVtx(), reco::GsfElectron::ecalDrivenSeed(), reco::LeafCandidate::et(), reco::LeafCandidate::eta(), getHLTprescales::index, FWDetailViewBase::item(), m_builder, FWDetailViewGL< reco::GsfElectron >::m_infoCanvas, m_legend, FWECALDetailViewBuilder::makeLegend(), reco::LeafCandidate::phi(), reco::GsfElectron::superCluster(), reco::GsfElectron::trackerDrivenSeed(), ExpressReco_HICollisions_FallBack::x, and ExpressReco_HICollisions_FallBack::y.
Referenced by build().
{ m_infoCanvas->cd(); float_t x = 0.02; float_t x2 = 0.52; float y = 0.95; TLatex* latex = new TLatex( x, y, "" ); const double textsize( 0.05 ); latex->SetTextSize( 2*textsize ); latex->DrawLatex( x, y, id.item()->modelName( id.index() ).c_str() ); y -= latex->GetTextSize()*0.6; latex->SetTextSize( textsize ); float lineH = latex->GetTextSize()*0.6; latex->DrawLatex( x, y, Form( " E_{T} = %.1f GeV, #eta = %0.2f, #varphi = %0.2f", electron->et(), electron->eta(), electron->phi()) ); y -= lineH; // summary if( electron->charge() > 0 ) latex->DrawLatex( x, y, " charge = +1" ); else latex->DrawLatex( x, y, " charge = -1" ); y -= lineH; if( electron->superCluster().isAvailable() ) { // delta phi/eta in latex->DrawLatex( x, y, "SuperCluster vs inner state extrapolation" ); y -= lineH; latex->DrawLatex( x, y, TString::Format(" #Delta#eta_{in} = %.3f", electron->deltaEtaSuperClusterTrackAtVtx()) ); latex->DrawLatex( x2, y, TString::Format("#Delta#varphi_{in} = %.3f", electron->deltaPhiSuperClusterTrackAtVtx()) ); y -= lineH; // delta phi/eta out latex->DrawLatex( x, y, "SeedCluster vs outer state extrapolation" ); y -= lineH; latex->DrawLatex( x, y, TString::Format(" #Delta#eta_{out} = %.3f", electron->deltaEtaSeedClusterTrackAtCalo()) ); latex->DrawLatex( x2, y, TString::Format(" #Delta#varphi_{out} = %.3f", electron->deltaPhiSeedClusterTrackAtCalo()) ); y -= 2*lineH; } else { latex->DrawLatex( x, y, "Ref to SuperCluster is not available" ); } latex->DrawLatex(x, y, TString::Format(" Tracker driven seed: %s", electron->trackerDrivenSeed() ? "YES" : "NO")); y -= lineH; latex->DrawLatex(x, y, TString::Format(" ECAL driven seed: %s", electron->ecalDrivenSeed() ? "YES" : "NO")); y -= lineH; y = m_builder->makeLegend( 0.02, y ); y -= lineH; m_legend->SetY2(y); m_legend->Draw(); m_legend = 0; // Deleted together with TPad. }
Definition at line 54 of file FWElectronDetailView.h.
Referenced by build(), setTextInfo(), and ~FWElectronDetailView().
TEveCaloData* FWElectronDetailView::m_data [private] |
Definition at line 53 of file FWElectronDetailView.h.
Referenced by build(), and ~FWElectronDetailView().
TLegend* FWElectronDetailView::m_legend [private] |
Definition at line 55 of file FWElectronDetailView.h.
Referenced by addSceneInfo(), build(), drawCrossHair(), and setTextInfo().