ATLAS Offline Software
HardTruthThinning.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // HardTruthThinning, (c) ATLAS Detector software
7 // Author: Frank Paige
8 // Thinning tool to use with CompactHardTruth and truth jets.
9 // Selects:
10 // (1) Stable TruthEvent particles matching HardTruth barcodes.
11 // (2) Constituents of truth jets.
12 // (3) Selected particles (e.g., B's) and their decays.
13 // (4) Stable particles within cone around hard leptons/photons.
14 // Treatment of Geant particles not yet implemented.
15 //
16 // Required parameter Type MCGN2 key
17 // EventInfo EventInfo "EventInfo"
18 // TruthParticles TruthParticleContainer "TruthParticle"
19 // TruthVertices TruthVertexContainer key "TruthVertex"
20 // HardParticles TruthParticleContainer "TruthHardParticle"
21 //
22 // Parameters that turn on features:
23 // JetName If not empty, save constituents with cuts
24 // KeepIds If pdgId list not empty, save particles and decay chains
25 // IsolRadius If positive, save stable particles in isolation cones
26 //
28 
29 #ifndef DERIVATIONFRAMEWORK_HARDTRUTHTHINNINGTOOL_H
30 #define DERIVATIONFRAMEWORK_HARDTRUTHTHINNINGTOOL_H
31 
32 #include <string>
33 #include <atomic>
34 
40 #include "GaudiKernel/ToolHandle.h"
43 #include "GaudiKernel/ToolHandle.h"
45 
46 
47 namespace DerivationFramework {
48 
49  class HardTruthThinning : public extends<AthAlgTool, IThinningTool> {
50  public:
51 
52  HardTruthThinning(const std::string& t, const std::string& n, const IInterface* p);
53  virtual ~HardTruthThinning();
54  virtual StatusCode initialize() override;
55  virtual StatusCode finalize() override;
56  virtual StatusCode doThinning() const override;
57 
58  static int getDescendants(const xAOD::TruthParticle* p,
59  std::vector<const xAOD::TruthParticle*>& d) ;
60  static void printxAODTruth(long long evnum,
61  const xAOD::TruthParticleContainer* truths) ;
62 
63  private:
64  SG::ReadHandleKey<xAOD::EventInfo> m_evt {this, "EvtInfo", "EventInfo", "EventInfo name"};
65 
66  StringProperty m_streamName
67  { this, "StreamName", "", "Name of the stream being thinned" };
69  { this, "TruthParticles", "", "truth particle container name" };
71  { this, "TruthVertices", "", "truth vertex container name" };
72 
73  std::string m_hardParticleName;
74 
75  // TruthJet name and parameters
76  std::string m_jetName;
77  float m_jetPtCut;
78  float m_jetEtaCut;
81  float m_isolR;
82  float m_isolPtCut;
83 
84  // Counters
85  mutable std::atomic<int> m_evtCount{};
87  mutable std::atomic<int> m_errCount{};
88 
89  // Special particles to keep (with descendants)
90  std::vector<int> m_keepIds;
91 
92  };
93 } //end namespace
94 
95 #endif // DERIVATIONFRAMEWORK_HARDTRUTHTHINNING_H
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
DerivationFramework::HardTruthThinning::printxAODTruth
static void printxAODTruth(long long evnum, const xAOD::TruthParticleContainer *truths)
Definition: HardTruthThinning.cxx:442
DerivationFramework::HardTruthThinning::m_isolR
float m_isolR
Definition: HardTruthThinning.h:81
DerivationFramework::HardTruthThinning::initialize
virtual StatusCode initialize() override
Definition: HardTruthThinning.cxx:101
SG::ThinningHandleKey
HandleKey object for adding thinning to an object.
Definition: ThinningHandleKey.h:38
hist_file_dump.d
d
Definition: hist_file_dump.py:137
TruthVertexContainer.h
TruthParticleContainer.h
DerivationFramework::HardTruthThinning::m_evtCount
std::atomic< int > m_evtCount
Definition: HardTruthThinning.h:85
IThinningTool.h
DerivationFramework::HardTruthThinning::m_streamName
StringProperty m_streamName
Definition: HardTruthThinning.h:67
DerivationFramework::HardTruthThinning::getDescendants
static int getDescendants(const xAOD::TruthParticle *p, std::vector< const xAOD::TruthParticle * > &d)
Definition: HardTruthThinning.cxx:390
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::HardTruthThinning::m_evt
SG::ReadHandleKey< xAOD::EventInfo > m_evt
Definition: HardTruthThinning.h:64
DerivationFramework::HardTruthThinning::m_errCount
std::atomic< int > m_errCount
Definition: HardTruthThinning.h:87
SG::ReadHandleKey< xAOD::EventInfo >
DerivationFramework::HardTruthThinning
Definition: HardTruthThinning.h:49
DerivationFramework::HardTruthThinning::m_jetPhotonPtCut
float m_jetPhotonPtCut
Definition: HardTruthThinning.h:80
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::HardTruthThinning::doThinning
virtual StatusCode doThinning() const override
Definition: HardTruthThinning.cxx:134
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
AthAlgTool.h
DerivationFramework::HardTruthThinning::HardTruthThinning
HardTruthThinning(const std::string &t, const std::string &n, const IInterface *p)
Definition: HardTruthThinning.cxx:45
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::HardTruthThinning::m_jetName
std::string m_jetName
Definition: HardTruthThinning.h:76
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::HardTruthThinning::~HardTruthThinning
virtual ~HardTruthThinning()
Definition: HardTruthThinning.cxx:93
DerivationFramework::HardTruthThinning::m_hardParticleName
std::string m_hardParticleName
Definition: HardTruthThinning.h:73
DerivationFramework::HardTruthThinning::m_jetEtaCut
float m_jetEtaCut
Definition: HardTruthThinning.h:78
DerivationFramework::HardTruthThinning::m_jetPtCut
float m_jetPtCut
Definition: HardTruthThinning.h:77
DerivationFramework::HardTruthThinning::m_isolPtCut
float m_isolPtCut
Definition: HardTruthThinning.h:82
DecayGraphHelper.h
EventInfo.h
DerivationFramework::HardTruthThinning::finalize
virtual StatusCode finalize() override
Definition: HardTruthThinning.cxx:117
DerivationFramework::HardTruthThinning::m_truthVertexName
SG::ThinningHandleKey< xAOD::TruthVertexContainer > m_truthVertexName
Definition: HardTruthThinning.h:71
ThinningHandleKey.h
HandleKey object for adding thinning to an object.
DerivationFramework::HardTruthThinning::m_maxCount
int m_maxCount
Definition: HardTruthThinning.h:86
DerivationFramework::HardTruthThinning::m_truthParticleName
SG::ThinningHandleKey< xAOD::TruthParticleContainer > m_truthParticleName
Definition: HardTruthThinning.h:69
DerivationFramework::HardTruthThinning::m_keepIds
std::vector< int > m_keepIds
Definition: HardTruthThinning.h:90
DerivationFramework::HardTruthThinning::m_jetConstPtCut
float m_jetConstPtCut
Definition: HardTruthThinning.h:79