ATLAS Offline Software
LLPTruthStrategy.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // LLPTruthStrategy.cxx, (c) ATLAS Detector software
8 
9 // class header include
10 #include "LLPTruthStrategy.h"
11 
12 // ISF includes
14 #include "ISF_Event/ISFParticle.h"
15 
17 ISF::LLPTruthStrategy::LLPTruthStrategy(const std::string& t, const std::string& n, const IInterface* p) :
18  base_class(t,n,p),
19  m_passProcessCodeRangeLow(0),
20  m_passProcessCodeRangeHigh(0),
21  m_passProcessCategory(0)
22 {
23  declareProperty("PassProcessCodeRangeLow" , m_passProcessCodeRangeLow=200);
24  declareProperty("PassProcessCodeRangeHigh", m_passProcessCodeRangeHigh=299);
25  declareProperty("PassProcessCategory" , m_passProcessCategory=9);
27 }
28 
31 {
32 }
33 
34 // Athena algtool's Hooks
36 {
37  ATH_MSG_VERBOSE("Initializing ...");
38 
39  for(auto region : m_regionListProperty.value()) {
40  if(region < AtlasDetDescr::fFirstAtlasRegion || region >= AtlasDetDescr::fNumAtlasRegions) {
41  ATH_MSG_ERROR("Unknown Region (" << region << ") specified. Please check your configuration.");
42  return StatusCode::FAILURE;
43  }
44  }
45 
46  ATH_MSG_VERBOSE("Initialization successful.");
47  return StatusCode::SUCCESS;
48 }
49 
51 {
52  ATH_MSG_VERBOSE("Finalizing ...");
53 
54  ATH_MSG_VERBOSE("Finalization successful.");
55  return StatusCode::SUCCESS;
56 }
57 
59 
60  int processCode = ti.physicsProcessCode(); // == G4ProcessSubType
61  if( (processCode>m_passProcessCodeRangeLow && processCode<m_passProcessCodeRangeHigh) ){ // All kinds of decay processes are included here...
62 
63  // Check if this is a sparticle - if not, return
64  int pdg = ti.parentPdgCode();
65  if ( !isSUSYParticle( abs(pdg) ) ) {
66  // not passed!
67  return false;
68  }
69 
70  ATH_MSG_VERBOSE("ACHLLP: saved a truth vertex for pdg "<<pdg);
71 
72  // passed!
73  return true;
74  }
75 
76  int processCategory = ti.physicsProcessCategory(); // == G4ProcessType
77  if( processCategory==m_passProcessCategory ){//save all interactions for user-defined processes, like rhadron interactions
78 
79  int pdg = ti.parentPdgCode();
80  ATH_MSG_VERBOSE("ACHLLP: saved a truth interaction fUserDefined for pdg "<<pdg);
81 
82  // passed!
83  return true;
84  }
85 
86  // not passed!
87  return false;
88 }
89 
90 
91 bool ISF::LLPTruthStrategy::appliesToRegion(unsigned short geoID) const
92 {
93  return std::find( m_regionListProperty.begin(),
94  m_regionListProperty.end(),
95  geoID ) != m_regionListProperty.end();
96 }
97 
98 
99 bool ISF::LLPTruthStrategy::isSUSYParticle(const int id) const
100 {
101  return ( (id>1000000 && id<1000007) || (id>1000010 && id<1000017) ||
102  (id>2000000 && id<2000007) || (id>2000010 && id<2000017) || // squarks and sleptons
103  (id>1000020 && id<1000026) || (id>1000034 && id<1000040) || // higgses etc
104  id==1000512 || id==1000522 || id==1000991 || id==1000993 || // R-hadrons
105  id==1000612 || id==1000622 || id==1000632 || id==1000642 || id==1000652 || id==1005211 ||
106  id==1006113 || id==1006211 || id==1006213 || id==1006223 || id==1006311 ||
107  id==1006313 || id==1006321 || id==1006323 || id==1006333 ||
108  id==1009111 || id==1009113 || id==1009211 || id==1009213 || id==1009311 ||
109  id==1009313 || id==1009321 || id==1009323 || id==1009223 || id==1009333 ||
110  id==1092112 || id==1091114 || id==1092114 || id==1092212 || id==1092214 || id==1092224 ||
111  id==1093114 || id==1093122 || id==1093214 || id==1093224 || id==1093314 || id==1093324 || id==1093334 );
112 }
AtlasDetDescr::fNumAtlasRegions
@ fNumAtlasRegions
Definition: AtlasRegion.h:39
ISF::LLPTruthStrategy::pass
virtual bool pass(ITruthIncident &incident) const override
True if the ITruthStrategy implementationapplies to the given ITruthIncident.
Definition: LLPTruthStrategy.cxx:58
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
ISF::ITruthIncident::physicsProcessCode
virtual int physicsProcessCode() const =0
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
ISF::ITruthIncident::parentPdgCode
virtual int parentPdgCode() const =0
Return the PDG Code of the parent particle.
ISF::LLPTruthStrategy::m_passProcessCodeRangeLow
int m_passProcessCodeRangeLow
The process code range (low-high) and the category of processes that should pass this strategy.
Definition: LLPTruthStrategy.h:53
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
ISF::LLPTruthStrategy::finalize
virtual StatusCode finalize() override
Definition: LLPTruthStrategy.cxx:50
ISF::LLPTruthStrategy::m_passProcessCategory
int m_passProcessCategory
Definition: LLPTruthStrategy.h:55
ISF::LLPTruthStrategy::LLPTruthStrategy
LLPTruthStrategy(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: LLPTruthStrategy.cxx:17
ISF::LLPTruthStrategy::~LLPTruthStrategy
~LLPTruthStrategy()
Destructor.
Definition: LLPTruthStrategy.cxx:30
ISFParticle.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
ISF::LLPTruthStrategy::m_passProcessCodeRangeHigh
int m_passProcessCodeRangeHigh
Definition: LLPTruthStrategy.h:54
ITruthIncident.h
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::LLPTruthStrategy::initialize
virtual StatusCode initialize() override
Definition: LLPTruthStrategy.cxx:35
ISF::ITruthIncident
Definition: ITruthIncident.h:45
ISF::LLPTruthStrategy::m_regionListProperty
IntegerArrayProperty m_regionListProperty
Definition: LLPTruthStrategy.h:57
ISF::LLPTruthStrategy::appliesToRegion
virtual bool appliesToRegion(unsigned short geoID) const override
Definition: LLPTruthStrategy.cxx:91
LLPTruthStrategy.h
ISF::ITruthIncident::physicsProcessCategory
virtual int physicsProcessCategory() const =0
Return category of the physics process represented by the truth incident (eg hadronic,...
ISF::LLPTruthStrategy::isSUSYParticle
bool isSUSYParticle(const int absPdgID) const
Returns true if the given |pdgID| is a SUSY particle.
Definition: LLPTruthStrategy.cxx:99
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15