ATLAS Offline Software
MSVtxValidationAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MSVTXVALIDATIONALG_H
6 #define MSVTXVALIDATIONALG_H
7 
8 #include <memory>
9 #include <vector>
10 
11 #include <TLorentzVector.h>
12 #include <TH1.h>
13 #include <TMath.h>
14 
16 #include "StoreGate/ReadHandle.h"
18 
19 #include "GaudiKernel/ITHistSvc.h"
20 #include "GaudiKernel/SystemOfUnits.h"
21 
27 #include "xAODJet/JetContainer.h"
29 
35 
36 
38  public:
39  // using the AthHistogramAlgorithm constructor which creates a THistSvc, whose pointer is accessible via histSvc()
41 
42  virtual StatusCode initialize() override final;
43  virtual StatusCode execute() override final;
44  virtual StatusCode finalize() override final;
45 
46  private:
47  SG::ReadHandleKey<xAOD::EventInfo> m_evtKey{this, "EvtKey", "EventInfo"};
48  SG::ReadHandleKey<xAOD::TruthParticleContainer> m_TruthParticleKey{this, "TruthParticleKey", "TruthParticles"};
49  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrackParticleKey{this, "TrackParticleKey", "InDetTrackParticles"};
50  SG::ReadHandleKey<xAOD::JetContainer> m_JetKey{this, "JetKey", "STCalibAntiKt4EMTopoJets"};
52  SG::ReadHandleKey<xAOD::TrackParticleContainer> m_TrackletKey{this, "TrackletKey", "MSonlyTracklets"};
53  SG::ReadHandleKey<xAOD::VertexContainer> m_MSVtxKey{this, "MSVertexKey", "MSDisplacedVertex"};
54 
55  // tree
56  MuonVal::MuonTesterTree m_tree{"MSVtxValidTree", "MSVtxValidation"};
57 
58  // Algorithm properties
59  Gaudi::Property<std::string> m_MuonSegKey{this, "MuonSegmentsKey", "MuonSegments"};
60 
61  Gaudi::Property<bool> m_readJets{this, "readJets", false, "add jet information to the tree"};
62  Gaudi::Property<bool> m_readMET{this, "readMET", false, "add met information to the tree"};
63  Gaudi::Property<bool> m_computeIso{this, "computeIso", false, "add vertex isolation variables to the tree"};
64 
65  Gaudi::Property<int> m_pdgId_portal{this, "pdgId_portal", 25, "Truth portal PDGId"};
66  Gaudi::Property<int> m_pdgId_llp{this, "pdgId_llp", 35, "Truth LLP PDGId"};
67  Gaudi::Property<float> m_trackIso_pT{this, "trackIso_pT", 5.0*Gaudi::Units::GeV, "minimum track pT [GeV] to be considered for isolation"};
68  Gaudi::Property<float> m_softTrackIso_R{this, "softTrackIso_R", 0.2, "cone radius around vertex to sum up track pT"};
69  Gaudi::Property<float> m_jetIso_pT{this, "jetIso_pT", 20.0*Gaudi::Units::GeV, "minimum jet pT [GeV] to be considered for isolation"};
70  Gaudi::Property<float> m_jetIso_LogRatio{this, "jetIso_LogRatio", 0.5, "max log ECal/HCal ratio for jet to be considered for isolation"};
71 
72  // filling routines
73  StatusCode fillTruth(const EventContext& ctx);
74  StatusCode fillMSVtx(const EventContext& ctx);
75  StatusCode fillMSVtxIso(const EventContext& ctx);
76  StatusCode fillTracklets(const EventContext& ctx);
77  StatusCode fillMuonSegments(const EventContext& ctx);
78  StatusCode fillJet(const EventContext& ctx);
79  StatusCode fillMet(const EventContext& ctx);
80  // helpers
81  void fillHits(const xAOD::Vertex* vtx, const std::string& decorator_str, MuonVal::VectorBranch<int>& branch);
82 
83  // --- //
84  // n-tuple branches with kinematics filled in units of GeV
85  // additional variables are added to IParticleFourMomBranch in initialize()
86  // --- //
87 
88  // portal particle
89  std::shared_ptr<MuonVal::IParticleFourMomBranch> m_portal{nullptr};
91 
92  // truth LLPs and their children
93  std::shared_ptr<MuonVal::IParticleFourMomBranch> m_llp{nullptr};
98 
99  // truth displaced vertex
100  std::shared_ptr<MuonVal::ThreeVectorBranch> m_llpVtx{nullptr};
104 
105  // reconstructed MS vertex
106  std::shared_ptr<MuonVal::ThreeVectorBranch> m_msVtx{nullptr};
111  // hits near the vertex
130  // vertex isolation variables
134 
135  // tracklets
136  std::shared_ptr<MuonVal::ThreeVectorBranch> m_trklet_pos{nullptr};
137  std::shared_ptr<MuonVal::ThreeVectorBranch> m_trklet_mom{nullptr};
147 
148  // muon segments
149  std::shared_ptr<MuonPRDTest::SegmentVariables> m_muonSeg{nullptr};
150 
151  // jet and met
152  std::shared_ptr<MuonVal::IParticleFourMomBranch> m_jet{nullptr};
154 
160 
161 
162  // --- //
163  // histograms //
164  // --- //
165  TH1F* m_h_LLP1LLP2dR{nullptr};
166  TH1F* m_h_diLLPMass{nullptr};
167  TH1F* m_h_leadLLPLxy{nullptr};
168  TH1F* m_h_leadLLPLz{nullptr};
170  TH1F* m_h_leadLLPpt{nullptr};
175 };
176 
177 #endif // MSVTXVALIDATIONALG_H
MSVtxValidationAlg::m_llpKid_pdgid
MuonVal::VectorBranch< int > & m_llpKid_pdgid
Definition: MSVtxValidationAlg.h:97
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
MSVtxValidationAlg::m_h_subleadLLPLz
TH1F * m_h_subleadLLPLz
Definition: MSVtxValidationAlg.h:172
MSVtxValidationAlg::m_msVtx_nTGC
MuonVal::VectorBranch< int > & m_msVtx_nTGC
Definition: MSVtxValidationAlg.h:124
MSVtxValidationAlg::m_trklet_q
MuonVal::VectorBranch< float > & m_trklet_q
Definition: MSVtxValidationAlg.h:145
MSVtxValidationAlg::m_softTrackIso_R
Gaudi::Property< float > m_softTrackIso_R
Definition: MSVtxValidationAlg.h:68
MSVtxValidationAlg::m_h_leadLLPpt
TH1F * m_h_leadLLPpt
Definition: MSVtxValidationAlg.h:170
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
AthHistogramAlgorithm::AthHistogramAlgorithm
AthHistogramAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Definition: AthHistogramAlgorithm.cxx:31
MSVtxValidationAlg::m_msVtx_chi2
MuonVal::VectorBranch< float > & m_msVtx_chi2
Definition: MSVtxValidationAlg.h:108
MSVtxValidationAlg::m_tree
MuonVal::MuonTesterTree m_tree
Definition: MSVtxValidationAlg.h:56
MSVtxValidationAlg::m_muonSeg
std::shared_ptr< MuonPRDTest::SegmentVariables > m_muonSeg
Definition: MSVtxValidationAlg.h:149
MSVtxValidationAlg::fillTruth
StatusCode fillTruth(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:133
MSVtxValidationAlg::m_h_subleadLLPctau
TH1F * m_h_subleadLLPctau
Definition: MSVtxValidationAlg.h:173
MSVtxValidationAlg::m_portal_N
MuonVal::ScalarBranch< int > & m_portal_N
Definition: MSVtxValidationAlg.h:90
IParticleFourMomBranch.h
MSVtxValidationAlg::finalize
virtual StatusCode finalize() override final
Definition: MSVtxValidationAlg.cxx:376
MSVtxValidationAlg::m_TrackParticleKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackParticleKey
Definition: MSVtxValidationAlg.h:49
MSVtxValidationAlg::m_msVtx_nTGC_M
MuonVal::VectorBranch< int > & m_msVtx_nTGC_M
Definition: MSVtxValidationAlg.h:128
MSVtxValidationAlg::m_llp_Nkids
MuonVal::VectorBranch< int > & m_llp_Nkids
Definition: MSVtxValidationAlg.h:95
TruthParticleContainer.h
MSVtxValidationAlg::m_msVtx_Ntrklet
MuonVal::VectorBranch< int > & m_msVtx_Ntrklet
Definition: MSVtxValidationAlg.h:110
MSVtxValidationAlg::m_met_y
MuonVal::ScalarBranch< float > & m_met_y
Definition: MSVtxValidationAlg.h:157
MSVtxValidationAlg::m_msVtx_nRPC_M
MuonVal::VectorBranch< int > & m_msVtx_nRPC_M
Definition: MSVtxValidationAlg.h:122
MSVtxValidationAlg::m_met_phi
MuonVal::ScalarBranch< float > & m_met_phi
Definition: MSVtxValidationAlg.h:158
MSVtxValidationAlg::m_msVtx_nRPC_E
MuonVal::VectorBranch< int > & m_msVtx_nRPC_E
Definition: MSVtxValidationAlg.h:121
MSVtxValidationAlg::m_llpVtx_Lxy
MuonVal::VectorBranch< float > & m_llpVtx_Lxy
Definition: MSVtxValidationAlg.h:102
MSVtxValidationAlg::fillMSVtx
StatusCode fillMSVtx(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:282
MSVtxValidationAlg::m_JetKey
SG::ReadHandleKey< xAOD::JetContainer > m_JetKey
Definition: MSVtxValidationAlg.h:50
MSVtxValidationAlg::m_llpVtx_N
MuonVal::ScalarBranch< int > & m_llpVtx_N
Definition: MSVtxValidationAlg.h:101
EventInfoBranch.h
MuonVal::VectorBranch< int >
MuonTesterTree.h
MSVtxValidationAlg::m_msVtx_nMDT_M
MuonVal::VectorBranch< int > & m_msVtx_nMDT_M
Definition: MSVtxValidationAlg.h:116
MSVtxValidationAlg::m_MSVtxKey
SG::ReadHandleKey< xAOD::VertexContainer > m_MSVtxKey
Definition: MSVtxValidationAlg.h:53
ThreeVectorBranch.h
MSVtxValidationAlg::m_msVtx_nTGC_inwards
MuonVal::VectorBranch< int > & m_msVtx_nTGC_inwards
Definition: MSVtxValidationAlg.h:125
SG::ReadHandleKey< xAOD::EventInfo >
MSVtxValidationAlg::m_trackIso_pT
Gaudi::Property< float > m_trackIso_pT
Definition: MSVtxValidationAlg.h:67
MSVtxValidationAlg::m_msVtx_nTGC_E
MuonVal::VectorBranch< int > & m_msVtx_nTGC_E
Definition: MSVtxValidationAlg.h:127
MSVtxValidationAlg::fillJet
StatusCode fillJet(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:215
MSVtxValidationAlg::m_computeIso
Gaudi::Property< bool > m_computeIso
Definition: MSVtxValidationAlg.h:63
MSVtxValidationAlg::m_met_x
MuonVal::ScalarBranch< float > & m_met_x
Definition: MSVtxValidationAlg.h:156
MSVtxValidationAlg::m_trklet_z0
MuonVal::VectorBranch< float > & m_trklet_z0
Definition: MSVtxValidationAlg.h:140
MSVtxValidationAlg::m_msVtx_isoJets_mindR
MuonVal::VectorBranch< float > & m_msVtx_isoJets_mindR
Definition: MSVtxValidationAlg.h:133
MSVtxValidationAlg::m_met
MuonVal::ScalarBranch< float > & m_met
Definition: MSVtxValidationAlg.h:155
MSVtxValidationAlg::m_llpVtx
std::shared_ptr< MuonVal::ThreeVectorBranch > m_llpVtx
Definition: MSVtxValidationAlg.h:100
MuonSegmentContainer.h
MSVtxValidationAlg::m_jet
std::shared_ptr< MuonVal::IParticleFourMomBranch > m_jet
Definition: MSVtxValidationAlg.h:152
AthHistogramAlgorithm.h
MSVtxValidationAlg::m_readMET
Gaudi::Property< bool > m_readMET
Definition: MSVtxValidationAlg.h:62
MSVtxValidationAlg::m_msVtx_nRPC_I
MuonVal::VectorBranch< int > & m_msVtx_nRPC_I
Definition: MSVtxValidationAlg.h:120
MSVtxValidationAlg::m_msVtx_nDoF
MuonVal::VectorBranch< int > & m_msVtx_nDoF
Definition: MSVtxValidationAlg.h:109
MSVtxValidationAlg::m_msVtx_nRPC
MuonVal::VectorBranch< int > & m_msVtx_nRPC
Definition: MSVtxValidationAlg.h:118
MSVtxValidationAlg::m_llpKid_llpLink
MuonVal::VectorBranch< int > & m_llpKid_llpLink
Definition: MSVtxValidationAlg.h:96
MSVtxValidationAlg::m_msVtx_nMDT_inwards
MuonVal::VectorBranch< int > & m_msVtx_nMDT_inwards
Definition: MSVtxValidationAlg.h:113
MSVtxValidationAlg::m_trklet_theta
MuonVal::VectorBranch< float > & m_trklet_theta
Definition: MSVtxValidationAlg.h:141
MSVtxValidationAlg::fillMSVtxIso
StatusCode fillMSVtxIso(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:331
MSVtxValidationAlg::m_pdgId_portal
Gaudi::Property< int > m_pdgId_portal
Definition: MSVtxValidationAlg.h:65
MSVtxValidationAlg::m_portal
std::shared_ptr< MuonVal::IParticleFourMomBranch > m_portal
Definition: MSVtxValidationAlg.h:89
MuonVal::MuonTesterTree
Definition: MuonTesterTree.h:30
MSVtxValidationAlg::m_jetIso_pT
Gaudi::Property< float > m_jetIso_pT
Definition: MSVtxValidationAlg.h:69
MSVtxValidationAlg::m_msVtx_N
MuonVal::ScalarBranch< int > & m_msVtx_N
Definition: MSVtxValidationAlg.h:107
MSVtxValidationAlg::m_msVtx
std::shared_ptr< MuonVal::ThreeVectorBranch > m_msVtx
Definition: MSVtxValidationAlg.h:106
MSVtxValidationAlg::m_msVtx_isoTracks_pTsum
MuonVal::VectorBranch< float > & m_msVtx_isoTracks_pTsum
Definition: MSVtxValidationAlg.h:132
MSVtxValidationAlg::execute
virtual StatusCode execute() override final
Definition: MSVtxValidationAlg.cxx:353
MSVtxValidationAlg::m_h_LLP1LLP2dR
TH1F * m_h_LLP1LLP2dR
Definition: MSVtxValidationAlg.h:165
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MSVtxValidationAlg::initialize
virtual StatusCode initialize() override final
Definition: MSVtxValidationAlg.cxx:16
MSVtxValidationAlg::m_msVtx_nMDT_O
MuonVal::VectorBranch< int > & m_msVtx_nMDT_O
Definition: MSVtxValidationAlg.h:117
MSVtxValidationAlg::m_msVtx_nTGC_I
MuonVal::VectorBranch< int > & m_msVtx_nTGC_I
Definition: MSVtxValidationAlg.h:126
MSVtxValidationAlg::m_sumEt
MuonVal::ScalarBranch< float > & m_sumEt
Definition: MSVtxValidationAlg.h:159
MSVtxValidationAlg
Definition: MSVtxValidationAlg.h:37
MSVtxValidationAlg::fillMuonSegments
StatusCode fillMuonSegments(const EventContext &ctx)
MSVtxValidationAlg::m_msVtx_nMDT
MuonVal::VectorBranch< int > & m_msVtx_nMDT
Definition: MSVtxValidationAlg.h:112
MSVtxValidationAlg::m_llp_N
MuonVal::ScalarBranch< int > & m_llp_N
Definition: MSVtxValidationAlg.h:94
MSVtxValidationAlg::m_trklet_d0
MuonVal::VectorBranch< float > & m_trklet_d0
Definition: MSVtxValidationAlg.h:139
MuonVal::MuonTesterTree::newVector
VectorBranch< T > & newVector(const std::string &name)
Creates new branches and returns their reference.
AthHistogramAlgorithm
Definition: AthHistogramAlgorithm.h:32
MSVtxValidationAlg::m_jet_N
MuonVal::ScalarBranch< int > & m_jet_N
Definition: MSVtxValidationAlg.h:153
MSVtxValidationAlg::m_trklet_pos
std::shared_ptr< MuonVal::ThreeVectorBranch > m_trklet_pos
Definition: MSVtxValidationAlg.h:136
MSVtxValidationAlg::m_msVtx_isoTracks_mindR
MuonVal::VectorBranch< float > & m_msVtx_isoTracks_mindR
Definition: MSVtxValidationAlg.h:131
MSVtxValidationAlg::m_msVtx_nMDT_E
MuonVal::VectorBranch< int > & m_msVtx_nMDT_E
Definition: MSVtxValidationAlg.h:115
MSVtxValidationAlg::m_jetIso_LogRatio
Gaudi::Property< float > m_jetIso_LogRatio
Definition: MSVtxValidationAlg.h:70
MSVtxValidationAlg::m_trklet_phi
MuonVal::VectorBranch< float > & m_trklet_phi
Definition: MSVtxValidationAlg.h:143
MuonVal::ScalarBranch< int >
MSVtxValidationAlg::m_h_diLLPMass
TH1F * m_h_diLLPMass
Definition: MSVtxValidationAlg.h:166
MSVtxValidationAlg::m_TruthParticleKey
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_TruthParticleKey
Definition: MSVtxValidationAlg.h:48
MuonVal::MuonTesterTree::newScalar
ScalarBranch< T > & newScalar(const std::string &name)
MSVtxValidationAlg::m_trklet_vtxLink
MuonVal::VectorBranch< int > & m_trklet_vtxLink
Definition: MSVtxValidationAlg.h:146
MSVtxValidationAlg::m_msVtx_nRPC_O
MuonVal::VectorBranch< int > & m_msVtx_nRPC_O
Definition: MSVtxValidationAlg.h:123
MSVtxValidationAlg::m_llpVtx_ctau
MuonVal::VectorBranch< float > & m_llpVtx_ctau
Definition: MSVtxValidationAlg.h:103
MSVtxValidationAlg::m_pdgId_llp
Gaudi::Property< int > m_pdgId_llp
Definition: MSVtxValidationAlg.h:66
MSVtxValidationAlg::m_msVtx_nMDT_I
MuonVal::VectorBranch< int > & m_msVtx_nMDT_I
Definition: MSVtxValidationAlg.h:114
MSVtxValidationAlg::m_llp
std::shared_ptr< MuonVal::IParticleFourMomBranch > m_llp
Definition: MSVtxValidationAlg.h:93
MSVtxValidationAlg::m_evtKey
SG::ReadHandleKey< xAOD::EventInfo > m_evtKey
Definition: MSVtxValidationAlg.h:47
EventInfo.h
MSVtxValidationAlg::m_MetKey
SG::ReadHandleKey< xAOD::MissingETContainer > m_MetKey
Definition: MSVtxValidationAlg.h:51
RTTAlgmain.branch
branch
Definition: RTTAlgmain.py:61
MSVtxValidationAlg::m_h_subleadLLPpt
TH1F * m_h_subleadLLPpt
Definition: MSVtxValidationAlg.h:174
VertexContainer.h
MSVtxValidationAlg::m_trklet_eta
MuonVal::VectorBranch< float > & m_trklet_eta
Definition: MSVtxValidationAlg.h:142
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
JetContainer.h
MSVtxValidationAlg::m_trklet_qOverP
MuonVal::VectorBranch< float > & m_trklet_qOverP
Definition: MSVtxValidationAlg.h:144
MSVtxValidationAlg::m_msVtx_nTGC_O
MuonVal::VectorBranch< int > & m_msVtx_nTGC_O
Definition: MSVtxValidationAlg.h:129
MSVtxValidationAlg::m_h_leadLLPLz
TH1F * m_h_leadLLPLz
Definition: MSVtxValidationAlg.h:168
MSVtxValidationAlg::fillHits
void fillHits(const xAOD::Vertex *vtx, const std::string &decorator_str, MuonVal::VectorBranch< int > &branch)
Definition: MSVtxValidationAlg.cxx:273
SegmentVariables.h
MSVtxValidationAlg::m_trklet_mom
std::shared_ptr< MuonVal::ThreeVectorBranch > m_trklet_mom
Definition: MSVtxValidationAlg.h:137
MSVtxValidationAlg::m_trklet_N
MuonVal::ScalarBranch< int > & m_trklet_N
Definition: MSVtxValidationAlg.h:138
MSVtxValidationAlg::m_h_subleadLLPLxy
TH1F * m_h_subleadLLPLxy
Definition: MSVtxValidationAlg.h:171
MSVtxValidationAlg::m_msVtx_nRPC_inwards
MuonVal::VectorBranch< int > & m_msVtx_nRPC_inwards
Definition: MSVtxValidationAlg.h:119
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
MSVtxValidationAlg::m_h_leadLLPLxy
TH1F * m_h_leadLLPLxy
Definition: MSVtxValidationAlg.h:167
ReadHandle.h
Handle class for reading from StoreGate.
MSVtxValidationAlg::m_MuonSegKey
Gaudi::Property< std::string > m_MuonSegKey
Definition: MSVtxValidationAlg.h:59
MSVtxValidationAlg::m_TrackletKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_TrackletKey
Definition: MSVtxValidationAlg.h:52
MSVtxValidationAlg::fillTracklets
StatusCode fillTracklets(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:244
MSVtxValidationAlg::m_readJets
Gaudi::Property< bool > m_readJets
Definition: MSVtxValidationAlg.h:61
MissingETContainer.h
MSVtxValidationAlg::fillMet
StatusCode fillMet(const EventContext &ctx)
Definition: MSVtxValidationAlg.cxx:228
TrackParticleContainer.h
MSVtxValidationAlg::m_h_leadLLPctau
TH1F * m_h_leadLLPctau
Definition: MSVtxValidationAlg.h:169