ATLAS Offline Software
HadronOriginClassifier.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 /*
6 
7  * @author Mirko Casolino, version w/o barcodes by Andrii Verbytskyi 2024
8  * @date June 2015
9  * @brief tool to compute oring of hadron to flag ttbar+HF
10  *
11  */
12 
13 #ifndef DerivationFrameworkMCTruth_HadronOriginClassifier_H
14 #define DerivationFrameworkMCTruth_HadronOriginClassifier_H
15 
19 
20 #include <map>
21 #include <set>
22 #include <string>
23 
24 namespace DerivationFramework{
25 
26 
27  static const InterfaceID IID_HadronOriginClassifier("HadronOriginClassifier", 1, 0);
28 
30 
31 
32  public:
33  HadronOriginClassifier(const std::string& t, const std::string& n, const IInterface* p);
34  virtual ~HadronOriginClassifier();
35 
36  virtual StatusCode initialize() override;
37 
38  static const InterfaceID& interfaceID() { return IID_HadronOriginClassifier; }
39 
40 
41  typedef enum {extrajet=0,
42  c_MPI =-1, b_MPI =1,
43  c_FSR =-2, b_FSR =2,
44  c_from_W =-3, b_from_W =3,
47 
48  typedef enum { Pythia6=0, Pythia8=1, HerwigPP=2, Sherpa=3 } GEN_id;
49 
50  std::map<const xAOD::TruthParticle*, HF_id> GetOriginMap() const;
51 
52  private:
53 
54  void fillHadronMap(std::set<const xAOD::TruthParticle*>& usedHadron, std::map<const xAOD::TruthParticle*,int>& mainHadronMap, const xAOD::TruthParticle* mainhad, const xAOD::TruthParticle* ihad, bool decayed=false) const;
55 
56  void buildPartonsHadronsMaps(std::map<const xAOD::TruthParticle*,int>& mainHadronMap,
57  std::map<const xAOD::TruthParticle*,HF_id>& partonsOrigin) const;
58 
59  bool isCHadronFromB(const xAOD::TruthParticle* part, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
60 
61 
64  bool isLooping(const xAOD::TruthParticle* part, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
65 
66  const xAOD::TruthParticle* findInitial(const xAOD::TruthParticle* part, bool looping, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
67 
68  bool isFromTop(const xAOD::TruthParticle* part, bool looping) const;
69  static bool isDirectlyFromTop(const xAOD::TruthParticle* part, bool looping) ;
70  bool isDirectlyFromWTop(const xAOD::TruthParticle* part, bool looping) const;
71 
72  static bool isDirectlyFromGluonQuark(const xAOD::TruthParticle* part, bool looping) ;
73  bool isFromGluonQuark(const xAOD::TruthParticle* part, bool looping) const;
74  bool isDirectlyFSRPythia6(const xAOD::TruthParticle* part, bool looping) const;
75 
76  bool isDirectlyFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const;
77  bool isFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const;
78  bool isDirectlyFSR(const xAOD::TruthParticle* part, bool looping) const;
79  bool isFromWTop(const xAOD::TruthParticle* part, bool looping) const;
80 
81  static bool isDirectlyMPIPythia6(const xAOD::TruthParticle* part, bool looping) ;
82 
83  bool isDirectlyMPIPythia8(const xAOD::TruthParticle* part, bool looping) const;
84  bool isDirectlyFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const;
85  bool isFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const;
86  bool isDirectlyFSRPythia8(const xAOD::TruthParticle* part, bool looping) const;
87 
88  static bool isDirectlyMPISherpa(const xAOD::TruthParticle* part) ;
89 
90 
91  inline bool IsHerwigPP() const {return m_GenUsed==HerwigPP;};
92  inline bool IsPythia8() const {return m_GenUsed==Pythia8;};
93  inline bool IsPythia6() const {return m_GenUsed==Pythia6;};
94  inline bool IsSherpa() const {return m_GenUsed==Sherpa;};
95  inline bool IsTtBb() const {return m_ttbb;}
96 
97  std::string m_mcName;
98  double m_HadronPtMinCut{};
100  int m_DSID{};
102  bool m_ttbb = false;
103 
104  };
105 
106 } //namespace
107 
108 
109 #endif //DerivationFrameworkMCTruth_HadronOriginClassifier_H
110 
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DerivationFramework::HadronOriginClassifier::isDirectlyMPIPythia8
bool isDirectlyMPIPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:615
DerivationFramework::HadronOriginClassifier::isFromTop
bool isFromTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:421
DerivationFramework::HadronOriginClassifier::isDirectlyMPISherpa
static bool isDirectlyMPISherpa(const xAOD::TruthParticle *part)
Definition: HadronOriginClassifier.cxx:620
DerivationFramework::HadronOriginClassifier::interfaceID
static const InterfaceID & interfaceID()
Definition: HadronOriginClassifier.h:38
DerivationFramework::HadronOriginClassifier::b_FSR
@ b_FSR
Definition: HadronOriginClassifier.h:43
DerivationFramework::HadronOriginClassifier
Definition: HadronOriginClassifier.h:29
DerivationFramework::HadronOriginClassifier::c_from_H
@ c_from_H
Definition: HadronOriginClassifier.h:46
DerivationFramework::HadronOriginClassifier::c_FSR
@ c_FSR
Definition: HadronOriginClassifier.h:43
DerivationFramework::HadronOriginClassifier::IsHerwigPP
bool IsHerwigPP() const
Definition: HadronOriginClassifier.h:91
DerivationFramework::HadronOriginClassifier::GetOriginMap
std::map< const xAOD::TruthParticle *, HF_id > GetOriginMap() const
Definition: HadronOriginClassifier.cxx:171
DerivationFramework::HadronOriginClassifier::HerwigPP
@ HerwigPP
Definition: HadronOriginClassifier.h:48
DerivationFramework::HadronOriginClassifier::c_MPI
@ c_MPI
Definition: HadronOriginClassifier.h:42
DerivationFramework::HadronOriginClassifier::m_HadronEtaMaxCut
double m_HadronEtaMaxCut
Definition: HadronOriginClassifier.h:99
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::HadronOriginClassifier::HF_id
HF_id
Definition: HadronOriginClassifier.h:41
DerivationFramework::HadronOriginClassifier::c_from_W
@ c_from_W
Definition: HadronOriginClassifier.h:44
DerivationFramework::HadronOriginClassifier::isDirectlyFSR
bool isDirectlyFSR(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:510
DerivationFramework::HadronOriginClassifier::isFromGluonQuark
bool isFromGluonQuark(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:485
DerivationFramework::HadronOriginClassifier::c_from_top
@ c_from_top
Definition: HadronOriginClassifier.h:45
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
DerivationFramework::HadronOriginClassifier::b_from_W
@ b_from_W
Definition: HadronOriginClassifier.h:44
DerivationFramework::HadronOriginClassifier::isFromQuarkTop
bool isFromQuarkTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:543
DerivationFramework::HadronOriginClassifier::fillHadronMap
void fillHadronMap(std::set< const xAOD::TruthParticle * > &usedHadron, std::map< const xAOD::TruthParticle *, int > &mainHadronMap, const xAOD::TruthParticle *mainhad, const xAOD::TruthParticle *ihad, bool decayed=false) const
Definition: HadronOriginClassifier.cxx:374
DerivationFramework::HadronOriginClassifier::~HadronOriginClassifier
virtual ~HadronOriginClassifier()
Definition: HadronOriginClassifier.cxx:24
DerivationFramework::HadronOriginClassifier::IsSherpa
bool IsSherpa() const
Definition: HadronOriginClassifier.h:94
DerivationFramework::HadronOriginClassifier::findInitial
const xAOD::TruthParticle * findInitial(const xAOD::TruthParticle *part, bool looping, std::shared_ptr< std::set< const xAOD::TruthParticle * >> checked=nullptr) const
Definition: HadronOriginClassifier.cxx:656
DerivationFramework::HadronOriginClassifier::m_ttbb
bool m_ttbb
Definition: HadronOriginClassifier.h:102
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::HadronOriginClassifier::isDirectlyMPIPythia6
static bool isDirectlyMPIPythia6(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:604
DerivationFramework::HadronOriginClassifier::b_MPI
@ b_MPI
Definition: HadronOriginClassifier.h:42
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DerivationFramework::HadronOriginClassifier::GEN_id
GEN_id
Definition: HadronOriginClassifier.h:48
DerivationFramework::HadronOriginClassifier::Pythia8
@ Pythia8
Definition: HadronOriginClassifier.h:48
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
DerivationFramework::HadronOriginClassifier::isFromWTop
bool isFromWTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:448
DerivationFramework::HadronOriginClassifier::isDirectlyFSRPythia8
bool isDirectlyFSRPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:550
AthAlgTool.h
DerivationFramework::HadronOriginClassifier::m_GenUsed
GEN_id m_GenUsed
Definition: HadronOriginClassifier.h:101
DerivationFramework::HadronOriginClassifier::m_HadronPtMinCut
double m_HadronPtMinCut
Definition: HadronOriginClassifier.h:98
DerivationFramework::HadronOriginClassifier::isDirectlyFSRPythia6
bool isDirectlyFSRPythia6(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:490
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::HadronOriginClassifier::Pythia6
@ Pythia6
Definition: HadronOriginClassifier.h:48
DerivationFramework::HadronOriginClassifier::isDirectlyFromGluonQuark
static bool isDirectlyFromGluonQuark(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:474
DerivationFramework::HadronOriginClassifier::HadronOriginClassifier
HadronOriginClassifier(const std::string &t, const std::string &n, const IInterface *p)
Definition: HadronOriginClassifier.cxx:9
DerivationFramework::HadronOriginClassifier::isDirectlyFromQuarkTopPythia8
bool isDirectlyFromQuarkTopPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:571
DerivationFramework::HadronOriginClassifier::isDirectlyFromQuarkTop
bool isDirectlyFromQuarkTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:523
DerivationFramework::HadronOriginClassifier::isDirectlyFromTop
static bool isDirectlyFromTop(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:429
DerivationFramework::HadronOriginClassifier::IsPythia6
bool IsPythia6() const
Definition: HadronOriginClassifier.h:93
DerivationFramework::HadronOriginClassifier::b_from_H
@ b_from_H
Definition: HadronOriginClassifier.h:46
EventInfo.h
DerivationFramework::HadronOriginClassifier::IsPythia8
bool IsPythia8() const
Definition: HadronOriginClassifier.h:92
DerivationFramework::HadronOriginClassifier::m_mcName
std::string m_mcName
Definition: HadronOriginClassifier.h:97
DerivationFramework::HadronOriginClassifier::isDirectlyFromWTop
bool isDirectlyFromWTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:455
DerivationFramework::HadronOriginClassifier::IsTtBb
bool IsTtBb() const
Definition: HadronOriginClassifier.h:95
DerivationFramework::HadronOriginClassifier::isFromQuarkTopPythia8
bool isFromQuarkTopPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:597
DerivationFramework::HadronOriginClassifier::m_DSID
int m_DSID
Definition: HadronOriginClassifier.h:100
DerivationFramework::HadronOriginClassifier::extrajet
@ extrajet
Definition: HadronOriginClassifier.h:41
AthAlgTool
Definition: AthAlgTool.h:26
TruthEventContainer.h
DerivationFramework::HadronOriginClassifier::buildPartonsHadronsMaps
void buildPartonsHadronsMaps(std::map< const xAOD::TruthParticle *, int > &mainHadronMap, std::map< const xAOD::TruthParticle *, HF_id > &partonsOrigin) const
Definition: HadronOriginClassifier.cxx:239
DerivationFramework::HadronOriginClassifier::b_from_top
@ b_from_top
Definition: HadronOriginClassifier.h:45
DerivationFramework::HadronOriginClassifier::isLooping
bool isLooping(const xAOD::TruthParticle *part, std::shared_ptr< std::set< const xAOD::TruthParticle * >> checked=nullptr) const
init_part needed to detect looping graphs (sherpa) up to know only seen at parton level
Definition: HadronOriginClassifier.cxx:633
DerivationFramework::HadronOriginClassifier::Sherpa
@ Sherpa
Definition: HadronOriginClassifier.h:48
DerivationFramework::HadronOriginClassifier::isCHadronFromB
bool isCHadronFromB(const xAOD::TruthParticle *part, std::shared_ptr< std::set< const xAOD::TruthParticle * >> checked=nullptr) const
Definition: HadronOriginClassifier.cxx:352
DerivationFramework::HadronOriginClassifier::initialize
virtual StatusCode initialize() override
Definition: HadronOriginClassifier.cxx:26