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 
16 #include <vector>
17 #include <map>
18 #include <set>
19 #include <string>
20 #include <utility>
21 
25 
26 namespace DerivationFramework{
27 
28 
29  static const InterfaceID IID_HadronOriginClassifier("HadronOriginClassifier", 1, 0);
30 
32 
33 
34  public:
35  HadronOriginClassifier(const std::string& t, const std::string& n, const IInterface* p);
36  virtual ~HadronOriginClassifier();
37 
38  virtual StatusCode initialize() override;
39 
40  static const InterfaceID& interfaceID() { return IID_HadronOriginClassifier; }
41 
42 
43  typedef enum {extrajet=0,
44  c_MPI =-1, b_MPI =1,
45  c_FSR =-2, b_FSR =2,
46  c_from_W =-3, b_from_W =3,
49 
50  typedef enum { Pythia6=0, Pythia8=1, HerwigPP=2, Sherpa=3 } GEN_id;
51 
52  std::map<const xAOD::TruthParticle*, HF_id> GetOriginMap() const;
53 
54  private:
55 
56  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;
57 
58  void buildPartonsHadronsMaps(std::map<const xAOD::TruthParticle*,int>& mainHadronMap,
59  std::map<const xAOD::TruthParticle*,HF_id>& partonsOrigin) const;
60 
61  bool isCHadronFromB(const xAOD::TruthParticle* part, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
62 
63 
66  bool isLooping(const xAOD::TruthParticle* part, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
67 
68  const xAOD::TruthParticle* findInitial(const xAOD::TruthParticle* part, bool looping, std::shared_ptr<std::set<const xAOD::TruthParticle*>> checked = nullptr) const;
69 
70  bool isFromTop(const xAOD::TruthParticle* part, bool looping) const;
71  static bool isDirectlyFromTop(const xAOD::TruthParticle* part, bool looping) ;
72  bool isDirectlyFromWTop(const xAOD::TruthParticle* part, bool looping) const;
73 
74  static bool isDirectlyFromGluonQuark(const xAOD::TruthParticle* part, bool looping) ;
75  bool isFromGluonQuark(const xAOD::TruthParticle* part, bool looping) const;
76  bool isDirectlyFSRPythia6(const xAOD::TruthParticle* part, bool looping) const;
77 
78  bool isDirectlyFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const;
79  bool isFromQuarkTop(const xAOD::TruthParticle* part, bool looping) const;
80  bool isDirectlyFSR(const xAOD::TruthParticle* part, bool looping) const;
81  bool isFromWTop(const xAOD::TruthParticle* part, bool looping) const;
82 
83  static bool isDirectlyMPIPythia6(const xAOD::TruthParticle* part, bool looping) ;
84 
85  bool isDirectlyMPIPythia8(const xAOD::TruthParticle* part, bool looping) const;
86  bool isDirectlyFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const;
87  bool isFromQuarkTopPythia8(const xAOD::TruthParticle* part, bool looping) const;
88  bool isDirectlyFSRPythia8(const xAOD::TruthParticle* part, bool looping) const;
89 
90  static bool isDirectlyMPISherpa(const xAOD::TruthParticle* part) ;
91 
92 
93  inline bool IsHerwigPP() const {return m_GenUsed==HerwigPP;};
94  inline bool IsPythia8() const {return m_GenUsed==Pythia8;};
95  inline bool IsPythia6() const {return m_GenUsed==Pythia6;};
96  inline bool IsSherpa() const {return m_GenUsed==Sherpa;};
97  inline bool IsTtBb() const {return m_ttbb;}
98 
99  std::string m_mcName;
102  int m_DSID;
104  bool m_ttbb = false;
105 
106  };
107 
108 } //namespace
109 
110 
111 #endif //DerivationFrameworkMCTruth_HadronOriginClassifier_H
112 
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
DerivationFramework::HadronOriginClassifier::isDirectlyMPIPythia8
bool isDirectlyMPIPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:603
DerivationFramework::HadronOriginClassifier::isFromTop
bool isFromTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:409
DerivationFramework::HadronOriginClassifier::isDirectlyMPISherpa
static bool isDirectlyMPISherpa(const xAOD::TruthParticle *part)
Definition: HadronOriginClassifier.cxx:608
DerivationFramework::HadronOriginClassifier::interfaceID
static const InterfaceID & interfaceID()
Definition: HadronOriginClassifier.h:40
DerivationFramework::HadronOriginClassifier::b_FSR
@ b_FSR
Definition: HadronOriginClassifier.h:45
DerivationFramework::HadronOriginClassifier
Definition: HadronOriginClassifier.h:31
DerivationFramework::HadronOriginClassifier::c_from_H
@ c_from_H
Definition: HadronOriginClassifier.h:48
DerivationFramework::HadronOriginClassifier::c_FSR
@ c_FSR
Definition: HadronOriginClassifier.h:45
DerivationFramework::HadronOriginClassifier::IsHerwigPP
bool IsHerwigPP() const
Definition: HadronOriginClassifier.h:93
DerivationFramework::HadronOriginClassifier::GetOriginMap
std::map< const xAOD::TruthParticle *, HF_id > GetOriginMap() const
Definition: HadronOriginClassifier.cxx:159
DerivationFramework::HadronOriginClassifier::HerwigPP
@ HerwigPP
Definition: HadronOriginClassifier.h:50
DerivationFramework::HadronOriginClassifier::c_MPI
@ c_MPI
Definition: HadronOriginClassifier.h:44
DerivationFramework::HadronOriginClassifier::m_HadronEtaMaxCut
double m_HadronEtaMaxCut
Definition: HadronOriginClassifier.h:101
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::HadronOriginClassifier::HF_id
HF_id
Definition: HadronOriginClassifier.h:43
DerivationFramework::HadronOriginClassifier::c_from_W
@ c_from_W
Definition: HadronOriginClassifier.h:46
DerivationFramework::HadronOriginClassifier::isDirectlyFSR
bool isDirectlyFSR(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:498
DerivationFramework::HadronOriginClassifier::isFromGluonQuark
bool isFromGluonQuark(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:473
DerivationFramework::HadronOriginClassifier::c_from_top
@ c_from_top
Definition: HadronOriginClassifier.h:47
Pythia8
Author: James Monk (jmonk@cern.ch)
Definition: IPythia8Custom.h:13
DerivationFramework::HadronOriginClassifier::b_from_W
@ b_from_W
Definition: HadronOriginClassifier.h:46
DerivationFramework::HadronOriginClassifier::isFromQuarkTop
bool isFromQuarkTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:531
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:362
DerivationFramework::HadronOriginClassifier::~HadronOriginClassifier
virtual ~HadronOriginClassifier()
Definition: HadronOriginClassifier.cxx:24
DerivationFramework::HadronOriginClassifier::IsSherpa
bool IsSherpa() const
Definition: HadronOriginClassifier.h:96
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:644
DerivationFramework::HadronOriginClassifier::m_ttbb
bool m_ttbb
Definition: HadronOriginClassifier.h:104
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
DerivationFramework::HadronOriginClassifier::isDirectlyMPIPythia6
static bool isDirectlyMPIPythia6(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:592
DerivationFramework::HadronOriginClassifier::b_MPI
@ b_MPI
Definition: HadronOriginClassifier.h:44
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:50
DerivationFramework::HadronOriginClassifier::Pythia8
@ Pythia8
Definition: HadronOriginClassifier.h:50
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:436
DerivationFramework::HadronOriginClassifier::isDirectlyFSRPythia8
bool isDirectlyFSRPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:538
AthAlgTool.h
DerivationFramework::HadronOriginClassifier::m_GenUsed
GEN_id m_GenUsed
Definition: HadronOriginClassifier.h:103
DerivationFramework::HadronOriginClassifier::m_HadronPtMinCut
double m_HadronPtMinCut
Definition: HadronOriginClassifier.h:100
DerivationFramework::HadronOriginClassifier::isDirectlyFSRPythia6
bool isDirectlyFSRPythia6(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:478
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DerivationFramework::HadronOriginClassifier::Pythia6
@ Pythia6
Definition: HadronOriginClassifier.h:50
DerivationFramework::HadronOriginClassifier::isDirectlyFromGluonQuark
static bool isDirectlyFromGluonQuark(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:462
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:559
DerivationFramework::HadronOriginClassifier::isDirectlyFromQuarkTop
bool isDirectlyFromQuarkTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:511
DerivationFramework::HadronOriginClassifier::isDirectlyFromTop
static bool isDirectlyFromTop(const xAOD::TruthParticle *part, bool looping)
Definition: HadronOriginClassifier.cxx:417
DerivationFramework::HadronOriginClassifier::IsPythia6
bool IsPythia6() const
Definition: HadronOriginClassifier.h:95
DerivationFramework::HadronOriginClassifier::b_from_H
@ b_from_H
Definition: HadronOriginClassifier.h:48
EventInfo.h
DerivationFramework::HadronOriginClassifier::IsPythia8
bool IsPythia8() const
Definition: HadronOriginClassifier.h:94
DerivationFramework::HadronOriginClassifier::m_mcName
std::string m_mcName
Definition: HadronOriginClassifier.h:99
DerivationFramework::HadronOriginClassifier::isDirectlyFromWTop
bool isDirectlyFromWTop(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:443
DerivationFramework::HadronOriginClassifier::IsTtBb
bool IsTtBb() const
Definition: HadronOriginClassifier.h:97
DerivationFramework::HadronOriginClassifier::isFromQuarkTopPythia8
bool isFromQuarkTopPythia8(const xAOD::TruthParticle *part, bool looping) const
Definition: HadronOriginClassifier.cxx:585
DerivationFramework::HadronOriginClassifier::m_DSID
int m_DSID
Definition: HadronOriginClassifier.h:102
DerivationFramework::HadronOriginClassifier::extrajet
@ extrajet
Definition: HadronOriginClassifier.h:43
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:227
DerivationFramework::HadronOriginClassifier::b_from_top
@ b_from_top
Definition: HadronOriginClassifier.h:47
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:621
DerivationFramework::HadronOriginClassifier::Sherpa
@ Sherpa
Definition: HadronOriginClassifier.h:50
DerivationFramework::HadronOriginClassifier::isCHadronFromB
bool isCHadronFromB(const xAOD::TruthParticle *part, std::shared_ptr< std::set< const xAOD::TruthParticle * >> checked=nullptr) const
Definition: HadronOriginClassifier.cxx:340
DerivationFramework::HadronOriginClassifier::initialize
virtual StatusCode initialize() override
Definition: HadronOriginClassifier.cxx:26