ATLAS Offline Software
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 
8 namespace 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 }
PFO::PFOPVMatchedPlots::m_FE_pt_etaBinB
TH1 * m_FE_pt_etaBinB
Definition: PFOPVMatchedPlots.h:32
PFO::PFOPVMatchedPlots::initializePlots
void initializePlots()
Definition: PFOPVMatchedPlots.cxx:14
PFO::PFOPVMatchedPlots::fill
void fill(const xAOD::FlowElement &FE, const xAOD::Vertex &theVertex, const xAOD::EventInfo &eventInfo)
Definition: PFOPVMatchedPlots.cxx:29
PlotBase
Definition: PlotBase.h:34
xAOD::FlowElement_v1::m
virtual double m() const override
The invariant mass of the particle.
python.copyTCTOutput.sDir
sDir
Definition: copyTCTOutput.py:60
xAOD::TrackParticle_v1::vz
float vz() const
The z origin for the parameters.
PFO::PFOPVMatchedPlots::m_FE_phi
TH1 * m_FE_phi
Definition: PFOPVMatchedPlots.h:26
xAOD::TrackParticle_v1::z0
float z0() const
Returns the parameter.
PFO::PFOPVMatchedPlots::m_FE_m
TH1 * m_FE_m
Definition: PFOPVMatchedPlots.h:27
xAOD::FlowElement_v1::phi
virtual double phi() const override
The azimuthal angle ( ) of the particle.
xAOD::FlowElement_v1::pt
virtual double pt() const override
xAOD::FlowElement_v1::nChargedObjects
std::size_t nChargedObjects() const
Definition: FlowElement_v1.cxx:123
PFO::PFOPVMatchedPlots::m_FE_pt
TH1 * m_FE_pt
Definition: PFOPVMatchedPlots.h:24
PFO::PFOPVMatchedPlots::m_FE_eta
TH1 * m_FE_eta
Definition: PFOPVMatchedPlots.h:25
PlotBase::Book1D
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
PFO::PFOPVMatchedPlots::m_FE_charge
TH1 * m_FE_charge
Definition: PFOPVMatchedPlots.h:28
PFO::PFOPVMatchedPlots::m_FE_pt_etaBinA
TH1 * m_FE_pt_etaBinA
Pt Histogram binned in eta.
Definition: PFOPVMatchedPlots.h:31
PFO::PFOPVMatchedPlots::m_FE_pt_etaBinC
TH1 * m_FE_pt_etaBinC
Definition: PFOPVMatchedPlots.h:33
xAOD::FlowElement_v1::charge
float charge() const
xAOD::Vertex_v1::z
float z() const
Returns the z position.
TRT::Track::z0
@ z0
Definition: InnerDetector/InDetCalibEvent/TRT_CalibData/TRT_CalibData/TrackInfo.h:63
PFOPVMatchedPlots.h
PFO
Definition: ClusterMomentPlots.h:15
xAOD::FlowElement_v1::chargedObjects
std::vector< const xAOD::IParticle * > chargedObjects() const
Definition: FlowElement_v1.cxx:94
xAOD::EventInfo_v1
Class describing the basic event information.
Definition: EventInfo_v1.h:43
TrackParticle.h
xAOD::FlowElement_v1::eta
virtual double eta() const override
The pseudorapidity ( ) of the particle.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
PFO::PFOPVMatchedPlots::PFOPVMatchedPlots
PFOPVMatchedPlots(PlotBase *pParent, const std::string &sDir, const std::string &sFEContainerName)
Definition: PFOPVMatchedPlots.cxx:10
drawFromPickle.sin
sin
Definition: drawFromPickle.py:36
PFO::PFOPVMatchedPlots::m_sFEContainerName
std::string m_sFEContainerName
Definition: PFOPVMatchedPlots.h:36
xAOD::TrackParticle_v1::theta
float theta() const
Returns the parameter, which has range 0 to .
xAOD::EventInfo_v1::beamSpotWeight
float beamSpotWeight() const
Weight for beam spot size reweighting.
Definition: EventInfo_v1.cxx:970
xAOD::FlowElement_v1
A detector object made of other lower level object(s)
Definition: FlowElement_v1.h:25