ATLAS Offline Software
Public Member Functions | Static 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
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

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 25 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  declareInterface<DerivationFramework::TTbarPlusHeavyFlavorFilterTool>(this);
15 
16  declareProperty("MCCollectionName",m_mcName="TruthEvents");
17  declareProperty("UsePileUp",m_usePileUp=false);
18  declareProperty("UseFinalStateHadrons",m_useFinalStateHadrons=false);
19  declareProperty("BpTMinCut",m_bPtMinCut=5000.);
20  declareProperty("BetaMaxCut",m_bEtaMaxCut=3.);
21  declareProperty("CpTMinCut",m_cPtMinCut=5000.);
22  declareProperty("CetaMaxCut",m_cEtaMaxCut=3.);
23  declareProperty("BMultiplicityCut",m_bMultiCut=1);
24  declareProperty("CMultiplicityCut",m_cMultiCut=1);
25  declareProperty("ExcludeBFromTTbar",m_excludeBFromTop=true);
26  declareProperty("ExcludeCFromTTbar",m_excludeCFromTop=true);
27 
28 }

◆ ~TTbarPlusHeavyFlavorFilterTool()

DerivationFramework::TTbarPlusHeavyFlavorFilterTool::~TTbarPlusHeavyFlavorFilterTool ( )
virtual

Definition at line 30 of file TTbarPlusHeavyFlavorFilterTool.cxx.

30 {}

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 42 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ finalize()

StatusCode DerivationFramework::TTbarPlusHeavyFlavorFilterTool::finalize ( )
virtual

Definition at line 37 of file TTbarPlusHeavyFlavorFilterTool.cxx.

37  {
38  return StatusCode::SUCCESS;
39 }

◆ findInitial()

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

protection for sherpa

Definition at line 250 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ initialize()

StatusCode DerivationFramework::TTbarPlusHeavyFlavorFilterTool::initialize ( )
virtual

Definition at line 32 of file TTbarPlusHeavyFlavorFilterTool.cxx.

32  {
33  ATH_MSG_INFO("Initialize " );
34  return StatusCode::SUCCESS;
35 }

◆ 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.

◆ interfaceID()

static const InterfaceID& DerivationFramework::TTbarPlusHeavyFlavorFilterTool::interfaceID ( )
inlinestatic

Definition at line 34 of file TTbarPlusHeavyFlavorFilterTool.h.

34 { return IID_TTbarPlusHeavyFlavorFilterTool; }

◆ isCHadronFromB()

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

protection for sherpa

Definition at line 222 of file TTbarPlusHeavyFlavorFilterTool.cxx.

222  {
223 
225 
226  for(unsigned int i=0; i<part->nParents(); ++i){
227  const xAOD::TruthParticle* parent = part->parent(i);
228  if (HepMC::uniqueID(part) == HepMC::uniqueID(parent) ) continue;
230  return true;
231  }
233  if(isCHadronFromB(parent)) return true;
234  }
235  }
236 
237  return false;
238 }

◆ isDirectlyFromTop()

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

protection for sherpa

Definition at line 267 of file TTbarPlusHeavyFlavorFilterTool.cxx.

267  {
268 
269  for(unsigned int i=0; i<part->nParents(); ++i){
270  const xAOD::TruthParticle* parent = part->parent(i);
271  if (HepMC::uniqueID(part) == HepMC::uniqueID(parent) ) continue;
272  if (std::abs( parent->pdgId() ) == 6 ) return true;
273  }
274  return false;
275 }

◆ isDirectlyFromWTop()

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

protection for sherpa

Definition at line 277 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ isFinalHadron()

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

protection for sherpa

Definition at line 194 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ isFromTop()

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

Definition at line 262 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ isInitialHadron()

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

protection for sherpa

Definition at line 178 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ 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 240 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ isQuarkFromHadron()

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

protection for sherpa

Definition at line 208 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ 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 157 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ passCSelection()

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

Definition at line 169 of file TTbarPlusHeavyFlavorFilterTool.cxx.

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

◆ 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 48 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_bMultiCut

int DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bMultiCut
private

Definition at line 52 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_bPtMinCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bPtMinCut
private

Definition at line 47 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cEtaMaxCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cEtaMaxCut
private

Definition at line 50 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cMultiCut

int DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cMultiCut
private

Definition at line 53 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_cPtMinCut

double DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cPtMinCut
private

Definition at line 49 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 55 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_excludeCFromTop

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeCFromTop
private

Definition at line 56 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_mcName

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

properties

Definition at line 42 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_useFinalStateHadrons

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_useFinalStateHadrons
private

Definition at line 45 of file TTbarPlusHeavyFlavorFilterTool.h.

◆ m_usePileUp

bool DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_usePileUp
private

Definition at line 44 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:52
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passBSelection
bool passBSelection(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:157
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
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:44
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromTop
bool isDirectlyFromTop(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:267
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:240
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::findInitial
const xAOD::TruthParticle * findInitial(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:250
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeCFromTop
bool m_excludeCFromTop
Definition: TTbarPlusHeavyFlavorFilterTool.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cEtaMaxCut
double m_cEtaMaxCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:50
isBottomHadron
bool isBottomHadron(const T &p)
Definition: AtlasPID.h:466
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_useFinalStateHadrons
bool m_useFinalStateHadrons
Definition: TTbarPlusHeavyFlavorFilterTool.h:45
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:299
lumiFormat.i
int i
Definition: lumiFormat.py:92
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isInitialHadron
bool isInitialHadron(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:178
leadingQuark
int leadingQuark(const T &p)
Definition: AtlasPID.h:444
beamspotman.n
n
Definition: beamspotman.py:731
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFinalHadron
bool isFinalHadron(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:194
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:113
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:49
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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:192
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_excludeBFromTop
bool m_excludeBFromTop
Definition: TTbarPlusHeavyFlavorFilterTool.h:55
isW
bool isW(const T &p)
Definition: AtlasPID.h:167
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_mcName
std::string m_mcName
properties
Definition: TTbarPlusHeavyFlavorFilterTool.h:42
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::passCSelection
bool passCSelection(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:169
a
TList * a
Definition: liststreamerinfos.cxx:10
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:208
isCharmHadron
bool isCharmHadron(const T &p)
Definition: AtlasPID.h:465
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_bPtMinCut
double m_bPtMinCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:47
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
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:48
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isFromTop
bool isFromTop(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:262
fitman.k
k
Definition: fitman.py:528
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isDirectlyFromWTop
bool isDirectlyFromWTop(const xAOD::TruthParticle *part, bool looping) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:277
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::isCHadronFromB
bool isCHadronFromB(const xAOD::TruthParticle *part) const
Definition: TTbarPlusHeavyFlavorFilterTool.cxx:222
DerivationFramework::TTbarPlusHeavyFlavorFilterTool::m_cMultiCut
int m_cMultiCut
Definition: TTbarPlusHeavyFlavorFilterTool.h:53