ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
DerivationFramework::TTbarPlusHeavyFlavorFilterTool Class Reference

#include <TTbarPlusHeavyFlavorFilterTool.h>

Inheritance diagram for DerivationFramework::TTbarPlusHeavyFlavorFilterTool:
Collaboration diagram for DerivationFramework::TTbarPlusHeavyFlavorFilterTool:

Public Member Functions

 TTbarPlusHeavyFlavorFilterTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual ~TTbarPlusHeavyFlavorFilterTool ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
int filterFlag () const
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool passBSelection (const xAOD::TruthParticle *part) const
 
bool passCSelection (const xAOD::TruthParticle *part) const
 
bool isInitialHadron (const xAOD::TruthParticle *part) const
 
bool isFinalHadron (const xAOD::TruthParticle *part) const
 
bool isQuarkFromHadron (const xAOD::TruthParticle *part) const
 
bool isCHadronFromB (const xAOD::TruthParticle *part) const
 
bool isLooping (const xAOD::TruthParticle *part, std::set< const xAOD::TruthParticle * > init_part=std::set< const xAOD::TruthParticle * >()) const
 init_part needed to detect looping graphs (sherpa) and to switch on using barcode to resolve it without affecting pythia8 up to know only seen at parton level More...
 
const xAOD::TruthParticlefindInitial (const xAOD::TruthParticle *part, bool looping) const
 
bool isFromTop (const xAOD::TruthParticle *part, bool looping) const
 
bool isDirectlyFromTop (const xAOD::TruthParticle *part) const
 
bool isDirectlyFromWTop (const xAOD::TruthParticle *part, bool looping) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

std::string m_mcName
 properties More...
 
bool m_usePileUp
 
bool m_useFinalStateHadrons
 
double m_bPtMinCut
 
double m_bEtaMaxCut
 
double m_cPtMinCut
 
double m_cEtaMaxCut
 
int m_bMultiCut
 
int m_cMultiCut
 
bool m_excludeBFromTop
 
bool m_excludeCFromTop
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 23 of file TTbarPlusHeavyFlavorFilterTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TTbarPlusHeavyFlavorFilterTool()

DerivationFramework::TTbarPlusHeavyFlavorFilterTool::TTbarPlusHeavyFlavorFilterTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

of course doesn't work if pu is not available e.g. generation level

MeV

MeV

>=

>=

use IS quark

use IS quark

Definition at line 10 of file TTbarPlusHeavyFlavorFilterTool.cxx.

11  : AthAlgTool(t,n,p)
12 {
13 
14  declareProperty("MCCollectionName",m_mcName="TruthEvents");
15  declareProperty("UsePileUp",m_usePileUp=false);
16  declareProperty("UseFinalStateHadrons",m_useFinalStateHadrons=false);
17  declareProperty("BpTMinCut",m_bPtMinCut=5000.);
18  declareProperty("BetaMaxCut",m_bEtaMaxCut=3.);
19  declareProperty("CpTMinCut",m_cPtMinCut=5000.);
20  declareProperty("CetaMaxCut",m_cEtaMaxCut=3.);
21  declareProperty("BMultiplicityCut",m_bMultiCut=1);
22  declareProperty("CMultiplicityCut",m_cMultiCut=1);
23  declareProperty("ExcludeBFromTTbar",m_excludeBFromTop=true);
24  declareProperty("ExcludeCFromTTbar",m_excludeCFromTop=true);
25 
26 }

◆ ~TTbarPlusHeavyFlavorFilterTool()

DerivationFramework::TTbarPlusHeavyFlavorFilterTool::~TTbarPlusHeavyFlavorFilterTool ( )
virtual

Definition at line 28 of file TTbarPlusHeavyFlavorFilterTool.cxx.

28 {}

Member Function Documentation

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ filterFlag()

int DerivationFramework::TTbarPlusHeavyFlavorFilterTool::filterFlag ( ) const

loop on particles

only one hard scatter break

loop on events (only one at evgen - no PU)

Definition at line 40 of file TTbarPlusHeavyFlavorFilterTool.cxx.

40  {
41 
42  int nB=0;
43  int nC=0;
44 
45  int nBtop=0;
46  int nCtop=0;
47 
48  const xAOD::TruthEventContainer* xTruthEventContainer = 0;
49  if (evtStore()->retrieve(xTruthEventContainer,m_mcName).isFailure()) {
50  ATH_MSG_WARNING("could not retrieve TruthEventContainer " <<m_mcName);
51  return -1;
52  }
53 
54  for ( const auto* truthevent : *xTruthEventContainer ) {
55 
56  for(unsigned int i = 0; i < truthevent->nTruthParticles(); i++){
57 
58  const xAOD::TruthParticle* part = truthevent->truthParticle(i);
59  // In release 21 we'll have a thinned truth record in the AODs.
60  // Specifically, geant particle are removed in most cases. The subsequent
61  // nullptr check is supposed to catch these truth particles,
62  // unfortunately however, there's no way to check whether this truth
63  // particle would have had an impact on what we do further down.
64  if ( !part){
65  // We could possibly also use break since the thinned truth particles
66  // in principle should have no simulation particles.
67  continue;
68  }
69 
71 
72  bool isbquark=false;
73  bool iscquark=false;
74 
75  bool isbhadron=false;
76  bool ischadron=false;
77 
78  int pdgid = std::abs(part->pdgId());
79 
81  if ( MC::isBottom(pdgid) ) {
82  isbquark=true;
83  }
84  else if ( MC::isCharm(pdgid) ) {
85  iscquark=true;
86  }
88  isbhadron=true;
89  }
91  ischadron=true;
92  }
93  else {
94  continue;
95  }
96 
97  if( (isbquark || isbhadron) && !passBSelection(part) ) continue;
98  if( (iscquark || ischadron) && !passCSelection(part) ) continue;
99 
100  if(isbhadron || ischadron){
101  if(!isInitialHadron(part) && !m_useFinalStateHadrons) continue;
102  if(!isFinalHadron(part) && m_useFinalStateHadrons) continue;
103  }
104 
105  if(m_excludeBFromTop && isbquark){
106  bool islooping = isLooping(part);
107  if (isDirectlyFromTop(part)) ++nBtop;
108  if (isDirectlyFromWTop(part, islooping)) ++nBtop;
109  }
110  if(m_excludeCFromTop && iscquark){
111  bool islooping = isLooping(part);
112  if(isDirectlyFromTop(part))++nCtop;
113  if(isDirectlyFromWTop(part, islooping))++nCtop;
114  }
115 
116  bool ischadronfromb = isCHadronFromB(part);
117 
118  if(isbhadron) ++nB;
119  if(ischadron && !ischadronfromb) ++nC;
120 
121  }
122 
123  if(!m_usePileUp){
124  break;
125  }
126 
127  }
128 
129 
130  int nAddB=nB;
131  if(m_excludeBFromTop){
132  nAddB-=nBtop;
133  }
134 
135  int nAddC=nC;
136  if(m_excludeCFromTop){
137  nAddC-=nCtop;
138  }
139 
140  int flavortype=0;
141 
142  if(nAddC>=m_cMultiCut){
143  flavortype=4;
144  }
145 
146  if(nAddB>=m_bMultiCut){
147  flavortype=5;
148  }
149 
150  return flavortype;
151 
152 }

◆ finalize()

StatusCode DerivationFramework::TTbarPlusHeavyFlavorFilterTool::finalize ( )
virtual

Definition at line 35 of file TTbarPlusHeavyFlavorFilterTool.cxx.

35  {
36  return StatusCode::SUCCESS;
37 }

◆ findInitial()

const xAOD::TruthParticle * DerivationFramework::TTbarPlusHeavyFlavorFilterTool::findInitial ( const xAOD::TruthParticle part,
bool  looping 
) const
private

protection for sherpa

Definition at line 248 of file TTbarPlusHeavyFlavorFilterTool.cxx.

248  {
249 
250  for(unsigned int i=0; i<part->nParents(); ++i){
251  const xAOD::TruthParticle* parent = part->parent(i);
252  if (HepMC::is_same_particle(part,parent)) continue;
253  if (part->pdgId() == parent->pdgId() ){
254  return findInitial(parent, looping);
255  }
256  }
257  return part;
258 }

◆ initialize()

StatusCode DerivationFramework::TTbarPlusHeavyFlavorFilterTool::initialize ( )
virtual

Definition at line 30 of file TTbarPlusHeavyFlavorFilterTool.cxx.

30  {
31  ATH_MSG_INFO("Initialize " );
32  return StatusCode::SUCCESS;
33 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isCHadronFromB()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isCHadronFromB ( const xAOD::TruthParticle part) const
private

protection for sherpa

Definition at line 220 of file TTbarPlusHeavyFlavorFilterTool.cxx.

220  {
221 
223 
224  for(unsigned int i=0; i<part->nParents(); ++i){
225  const xAOD::TruthParticle* parent = part->parent(i);
226  if (HepMC::is_same_particle(part,parent) ) continue;
228  return true;
229  }
231  if(isCHadronFromB(parent)) return true;
232  }
233  }
234 
235  return false;
236 }

◆ isDirectlyFromTop()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromTop ( const xAOD::TruthParticle part) const
private

protection for sherpa

Definition at line 265 of file TTbarPlusHeavyFlavorFilterTool.cxx.

265  {
266 
267  for(unsigned int i=0; i<part->nParents(); ++i){
268  const xAOD::TruthParticle* parent = part->parent(i);
269  if (HepMC::is_same_particle(part,parent) ) continue;
270  if ( MC::isTop(parent->pdgId()) ) return true;
271  }
272  return false;
273 }

◆ isDirectlyFromWTop()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromWTop ( const xAOD::TruthParticle part,
bool  looping 
) const
private

protection for sherpa

Definition at line 275 of file TTbarPlusHeavyFlavorFilterTool.cxx.

275  {
276 
277  for(unsigned int i=0; i<part->nParents(); ++i){
278  const xAOD::TruthParticle* parent = part->parent(i);
279  if (HepMC::is_same_particle(part,parent)) continue;
280  if (MC::isW(parent) ){
281  if (isFromTop(parent, looping) ) return true;
282  }
283  }
284  return false;
285 }

◆ isFinalHadron()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFinalHadron ( const xAOD::TruthParticle part) const
private

protection for sherpa

Definition at line 192 of file TTbarPlusHeavyFlavorFilterTool.cxx.

192  {
193 
194  int qtype = std::abs(MC::leadingQuark(part));
195  for(unsigned j = 0; j < part->nChildren(); j++){
196  const xAOD::TruthParticle* child = part->child(j);
197  if (HepMC::is_same_particle(part,child) ) continue;
198  int childtype = std::abs(MC::leadingQuark(child));
199  if (childtype == qtype ){
200  return false;
201  }
202  }
203  return true;
204 }

◆ isFromTop()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFromTop ( const xAOD::TruthParticle part,
bool  looping 
) const
private

Definition at line 260 of file TTbarPlusHeavyFlavorFilterTool.cxx.

260  {
261  const xAOD::TruthParticle* initpart = findInitial(part, looping);
262  return isDirectlyFromTop(initpart);
263 }

◆ isInitialHadron()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isInitialHadron ( const xAOD::TruthParticle part) const
private

protection for sherpa

Definition at line 176 of file TTbarPlusHeavyFlavorFilterTool.cxx.

176  {
177 
178  int qtype = std::abs(MC::leadingQuark(part));
179  for(unsigned int i=0; i<part->nParents(); ++i){
180  const xAOD::TruthParticle* parent = part->parent(i);
181  if (HepMC::is_same_particle(part,parent) ) continue;
182  int mothertype = std::abs(MC::leadingQuark(parent));
183  if (mothertype == qtype ){
184  return false;
185  }
186  }
187 
188  return true;
189 }

◆ isLooping()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isLooping ( const xAOD::TruthParticle part,
std::set< const xAOD::TruthParticle * >  init_part = std::set<const xAOD::TruthParticle*>() 
) const
private

init_part needed to detect looping graphs (sherpa) and to switch on using barcode to resolve it without affecting pythia8 up to know only seen at parton level

Definition at line 238 of file TTbarPlusHeavyFlavorFilterTool.cxx.

238  {
239  init_part.insert(part);
240  for(unsigned int i=0; i<part->nParents(); ++i){
241  const xAOD::TruthParticle* parent = part->parent(i);
242  if (init_part.find(parent) != init_part.end()) return true;
243  if (isLooping(parent, init_part)) return true;
244  }
245  return false;
246 }

◆ isQuarkFromHadron()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isQuarkFromHadron ( const xAOD::TruthParticle part) const
private

protection for sherpa

Definition at line 206 of file TTbarPlusHeavyFlavorFilterTool.cxx.

206  {
207 
208  for(unsigned int i=0; i<part->nParents(); ++i){
209  const xAOD::TruthParticle* parent = part->parent(i);
210  if (HepMC::is_same_particle(part,parent) ) continue;
211  int mothertype = std::abs(MC::leadingQuark(parent));
212  if ( MC::isCharm(mothertype) || MC::isBottom(mothertype) ){
213  return true;
214  }
215  if (isQuarkFromHadron(parent)) return true;
216  }
217  return false;
218 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ passBSelection()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passBSelection ( const xAOD::TruthParticle part) const
private

Definition at line 155 of file TTbarPlusHeavyFlavorFilterTool.cxx.

155  {
156 
157  double pt = part->pt();
158  double eta = fabs(part->eta());
159 
160  if(pt <m_bPtMinCut) return false;
161  if(eta > m_bEtaMaxCut) return false;
162 
163  return true;
164 
165 }

◆ passCSelection()

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passCSelection ( const xAOD::TruthParticle part) const
private

Definition at line 167 of file TTbarPlusHeavyFlavorFilterTool.cxx.

167  {
168 
169  double pt = part->pt();
170  double eta = fabs(part->eta());
171  if (pt < m_cPtMinCut) return false;
172  if (eta > m_cEtaMaxCut) return false;
173  return true;
174 }

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_bEtaMaxCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bEtaMaxCut
private

Definition at line 44 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_bMultiCut

int DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bMultiCut
private

Definition at line 48 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_bPtMinCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bPtMinCut
private

Definition at line 43 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cEtaMaxCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cEtaMaxCut
private

Definition at line 46 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cMultiCut

int DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cMultiCut
private

Definition at line 49 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cPtMinCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cPtMinCut
private

Definition at line 45 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_excludeBFromTop

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeBFromTop
private

Definition at line 51 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_excludeCFromTop

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeCFromTop
private

Definition at line 52 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_mcName

std::string DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_mcName
private

properties

Definition at line 38 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_useFinalStateHadrons

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_useFinalStateHadrons
private

Definition at line 41 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_usePileUp

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_usePileUp
private

Definition at line 40 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bMultiCut
int m_bMultiCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:48
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
test_pyathena.eta
eta
Definition: test_pyathena.py:10
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passBSelection
bool passBSelection(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:155
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_usePileUp
bool m_usePileUp
Definition: TTbarPlusHeavyFlavorFilterTool.h:40
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromTop
bool isDirectlyFromTop(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:265
test_pyathena.pt
pt
Definition: test_pyathena.py:11
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isLooping
bool isLooping(const xAOD::TruthParticle *part, std::set< const xAOD::TruthParticle * > init_part=std::set< const xAOD::TruthParticle * >()) const
init_part needed to detect looping graphs (sherpa) and to switch on using barcode to resolve it witho...
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:238
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::findInitial
const xAOD::TruthParticle * findInitial(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:248
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeCFromTop
bool m_excludeCFromTop
Definition: TTbarPlusHeavyFlavorFilterTool.h:52
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
HepMC::is_same_particle
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
Definition: MagicNumbers.h:367
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cEtaMaxCut
double m_cEtaMaxCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:46
isBottomHadron
bool isBottomHadron(const T &p)
Definition: AtlasPID.h:846
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
isBottom
bool isBottom(const T &p)
Definition: AtlasPID.h:172
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_useFinalStateHadrons
bool m_useFinalStateHadrons
Definition: TTbarPlusHeavyFlavorFilterTool.h:41
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:355
lumiFormat.i
int i
Definition: lumiFormat.py:85
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isInitialHadron
bool isInitialHadron(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:176
leadingQuark
int leadingQuark(const T &p)
Definition: AtlasPID.h:823
beamspotman.n
n
Definition: beamspotman.py:731
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFinalHadron
bool isFinalHadron(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:192
test_pyathena.parent
parent
Definition: test_pyathena.py:15
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cPtMinCut
double m_cPtMinCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:45
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeBFromTop
bool m_excludeBFromTop
Definition: TTbarPlusHeavyFlavorFilterTool.h:51
isW
bool isW(const T &p)
Definition: AtlasPID.h:355
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_mcName
std::string m_mcName
properties
Definition: TTbarPlusHeavyFlavorFilterTool.h:38
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passCSelection
bool passCSelection(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:167
a
TList * a
Definition: liststreamerinfos.cxx:10
isTop
bool isTop(const T &p)
Definition: AtlasPID.h:175
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isQuarkFromHadron
bool isQuarkFromHadron(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:206
isCharm
bool isCharm(const T &p)
Definition: AtlasPID.h:169
isCharmHadron
bool isCharmHadron(const T &p)
Definition: AtlasPID.h:845
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:629
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bPtMinCut
double m_bPtMinCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:43
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bEtaMaxCut
double m_bEtaMaxCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:44
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFromTop
bool isFromTop(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:260
fitman.k
k
Definition: fitman.py:528
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromWTop
bool isDirectlyFromWTop(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:275
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isCHadronFromB
bool isCHadronFromB(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:220
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cMultiCut
int m_cMultiCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:49