ATLAS Offline Software
PFOPVMatchedPlots.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 namespace PFO {
9 
10  PFOPVMatchedPlots::PFOPVMatchedPlots(PlotBase* pParent, std::string sDir, std::string sFEContainerName) : PlotBase(pParent, sDir), m_sFEContainerName(sFEContainerName){
11  m_FE_pt = nullptr;
12  m_FE_eta = nullptr;
13  m_FE_phi = nullptr;
14  m_FE_m = nullptr;
15  m_FE_charge = nullptr;
16  }
17 
19  //book Flow Element histograms
20  if(!m_sFEContainerName.empty()){
21  m_FE_pt = Book1D("_PVMatched_Pt",m_sFEContainerName + "_Pt (Entries/1 GeV)",30,-10.0,20.0);
22  m_FE_eta = Book1D("_PVMatched_Eta",m_sFEContainerName + "_Eta (Entries/0.1)",100,-5.0,5.0);
23  m_FE_phi = Book1D("_PVMatched_Phi",m_sFEContainerName + "_Phi (Entries/0.1)",64,-3.2,3.2);
24  m_FE_m = Book1D("_PVMatched_m",m_sFEContainerName + "_m (Entries/100 MeV)",10,0.0,0.5);
25  m_FE_charge = Book1D("_PVMatched_charge",m_sFEContainerName + "_charge (Entries/unit charge)",5,-2,2);
26 
27  m_FE_pt_etaBinA = Book1D("_Pt_PVMatched_A",m_sFEContainerName + "_Pt (Entries/1 GeV, |eta| < 1 )",30,-10.0,20.0);
28  m_FE_pt_etaBinB = Book1D("_Pt_PVMatched_B",m_sFEContainerName + "_Pt (Entries/1 GeV, 1 <= |eta| < 2 )",30,-10.0,20.0);
29  m_FE_pt_etaBinC = Book1D("_Pt_PVMatched_C",m_sFEContainerName + "_Pt (Entries/1 GeV, |eta| >= 2 )",30,-10.0,20.0);
30  }
31  }
32 
33  void PFOPVMatchedPlots::fill(const xAOD::FlowElement& FE, const xAOD::Vertex& theVertex, const xAOD::EventInfo& eventInfo){
34  if(FE.nChargedObjects()==0)
35  return;
36  const xAOD::TrackParticle* theTrack =static_cast<const xAOD::TrackParticle*>(FE.chargedObjects().at(0));
37 
38  if (theTrack){
39  //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
40  float z0 = theTrack->z0() + theTrack->vz();
41  z0 = z0 - theVertex.z();
42  float theta = theTrack->theta();
43  if ( fabs(z0*sin(theta)) < 2.0 ){
44  m_FE_pt->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
45  m_FE_eta->Fill(FE.eta(),eventInfo.beamSpotWeight());
46  m_FE_phi->Fill(FE.phi(),eventInfo.beamSpotWeight());
47  m_FE_m->Fill(FE.m()/1000.0,eventInfo.beamSpotWeight());
48  m_FE_charge->Fill(FE.charge(),eventInfo.beamSpotWeight());
49 
50  if (fabs(FE.eta()) < 1) m_FE_pt_etaBinA->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
51  else if (fabs(FE.eta()) < 2) m_FE_pt_etaBinB->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
52  else m_FE_pt_etaBinC->Fill(FE.pt()/1000.0,eventInfo.beamSpotWeight());
53  }//fill histograms if track is matched to the PV
54  }//if valid pointer to track
55  }
56 
57 
58 }
PFO::PFOPVMatchedPlots::m_FE_pt_etaBinB
TH1 * m_FE_pt_etaBinB
Definition: PFOPVMatchedPlots.h:32
PFO::PFOPVMatchedPlots::initializePlots
void initializePlots()
Definition: PFOPVMatchedPlots.cxx:18
PFO::PFOPVMatchedPlots::fill
void fill(const xAOD::FlowElement &FE, const xAOD::Vertex &theVertex, const xAOD::EventInfo &eventInfo)
Definition: PFOPVMatchedPlots.cxx:33
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::PFOPVMatchedPlots
PFOPVMatchedPlots(PlotBase *pParent, std::string sDir, std::string sFEContainerName)
Definition: PFOPVMatchedPlots.cxx:10
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:13
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
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