ATLAS Offline Software
Loading...
Searching...
No Matches
PFOPVMatchedPlots.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace PFO {
9
10 PFOPVMatchedPlots::PFOPVMatchedPlots(PlotBase* pParent, const std::string & sDir, const std::string & sFEContainerName) : PlotBase(pParent, sDir), m_sFEContainerName(sFEContainerName){
11
12 }
13
15 //book Flow Element histograms
16 if(!m_sFEContainerName.empty()){
17 m_FE_pt = Book1D("_PVMatched_Pt",m_sFEContainerName + "_Pt (Entries/1 GeV)",30,-10.0,20.0);
18 m_FE_eta = Book1D("_PVMatched_Eta",m_sFEContainerName + "_Eta (Entries/0.1)",100,-5.0,5.0);
19 m_FE_phi = Book1D("_PVMatched_Phi",m_sFEContainerName + "_Phi (Entries/0.1)",64,-3.2,3.2);
20 m_FE_m = Book1D("_PVMatched_m",m_sFEContainerName + "_m (Entries/100 MeV)",10,0.0,0.5);
21 m_FE_charge = Book1D("_PVMatched_charge",m_sFEContainerName + "_charge (Entries/unit charge)",5,-2,2);
22
23 m_FE_pt_etaBinA = Book1D("_Pt_PVMatched_A",m_sFEContainerName + "_Pt (Entries/1 GeV, |eta| < 1 )",30,-10.0,20.0);
24 m_FE_pt_etaBinB = Book1D("_Pt_PVMatched_B",m_sFEContainerName + "_Pt (Entries/1 GeV, 1 <= |eta| < 2 )",30,-10.0,20.0);
25 m_FE_pt_etaBinC = Book1D("_Pt_PVMatched_C",m_sFEContainerName + "_Pt (Entries/1 GeV, |eta| >= 2 )",30,-10.0,20.0);
26 }
27 }
28
29 void PFOPVMatchedPlots::fill(const xAOD::FlowElement& FE, const xAOD::Vertex& theVertex, const xAOD::EventInfo& eventInfo){
30 if(FE.nChargedObjects()==0)
31 return;
32 const xAOD::TrackParticle* theTrack =static_cast<const xAOD::TrackParticle*>(FE.chargedObjects().at(0));
33
34 if (theTrack){
35 //vtz.z() provides z of that vertex w.r.t the center of the beamspot (z = 0). Thus we corrext the track z0 to be w.r.t z = 0
36 float z0 = theTrack->z0() + theTrack->vz();
37 z0 = z0 - theVertex.z();
38 float theta = theTrack->theta();
39 if ( fabs(z0*sin(theta)) < 2.0 ){
40 m_FE_pt->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
41 m_FE_eta->Fill(FE.eta(),eventInfo.beamSpotWeight());
42 m_FE_phi->Fill(FE.phi(),eventInfo.beamSpotWeight());
43 m_FE_m->Fill(FE.m()/1000.0,eventInfo.beamSpotWeight());
44 m_FE_charge->Fill(FE.charge(),eventInfo.beamSpotWeight());
45
46 if (fabs(FE.eta()) < 1) m_FE_pt_etaBinA->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
47 else if (fabs(FE.eta()) < 2) m_FE_pt_etaBinB->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
48 else m_FE_pt_etaBinC->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
49 }//fill histograms if track is matched to the PV
50 }//if valid pointer to track
51 }
52
53
54}
Scalar theta() const
theta method
PFOPVMatchedPlots(PlotBase *pParent, const std::string &sDir, const std::string &sFEContainerName)
TH1 * m_FE_pt_etaBinA
Pt Histogram binned in eta.
void fill(const xAOD::FlowElement &FE, const xAOD::Vertex &theVertex, const xAOD::EventInfo &eventInfo)
TH1D * Book1D(const std::string &name, const std::string &labels, int nBins, float start, float end, bool prependDir=true)
Book a TH1D histogram.
Definition PlotBase.cxx:94
PlotBase(PlotBase *parent, const std::string &sDir)
Definition PlotBase.cxx:29
float beamSpotWeight() const
Weight for beam spot size reweighting.
std::size_t nChargedObjects() const
std::vector< const xAOD::IParticle * > chargedObjects() const
virtual double pt() const override
virtual double m() const override
The invariant mass of the particle.
virtual double phi() const override
The azimuthal angle ( ) of the particle.
virtual double eta() const override
The pseudorapidity ( ) of the particle.
float charge() const
float z0() const
Returns the parameter.
float theta() const
Returns the parameter, which has range 0 to .
float vz() const
The z origin for the parameters.
float z() const
Returns the z position.
EventInfo_v1 EventInfo
Definition of the latest event info version.
FlowElement_v1 FlowElement
Definition of the current "pfo version".
Definition FlowElement.h:16
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.