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

#include <CalcTtbarPartonHistory.h>

Inheritance diagram for top::CalcTtbarPartonHistory:
Collaboration diagram for top::CalcTtbarPartonHistory:

Public Member Functions

 CalcTtbarPartonHistory (const std::string &name)
 
virtual ~CalcTtbarPartonHistory ()
 
 CalcTtbarPartonHistory (const CalcTtbarPartonHistory &rhs)=delete
 
 CalcTtbarPartonHistory (CalcTtbarPartonHistory &&rhs)=delete
 
CalcTtbarPartonHistoryoperator= (const CalcTtbarPartonHistory &rhs)=delete
 
void ttbarHistorySaver (const xAOD::TruthParticleContainer *truthParticles, xAOD::PartonHistory *ttbarPartonHistory)
 
virtual StatusCode execute ()
 
bool topAfterFSR_SC (const xAOD::TruthParticleContainer *truthParticles, int start, TLorentzVector &top_afterFSR_SC_p4)
 Store the four-momentum of the post-FSR top or anti-top found using statusCodes This would only work if there is at most one "true" top of each charge (i.e. More...
 
bool topWb (const xAOD::TruthParticleContainer *truthParticles, int start, TLorentzVector &t_beforeFSR_p4, TLorentzVector &t_afterFSR_p4, TLorentzVector &W_p4, TLorentzVector &b_p4, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId)
 Store the four-momentum of several particles in the top decay chain. More...
 
bool topWq (const xAOD::TruthParticleContainer *truthParticles, int start, TLorentzVector &t_beforeFSR_p4, TLorentzVector &t_afterFSR_p4, TLorentzVector &W_p4, TLorentzVector &q_p4, int &q_pdgId, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId)
 
bool b (const xAOD::TruthParticleContainer *truthParticles, TLorentzVector &b_beforeFSR, TLorentzVector &b_afterFSR)
 Store the four-momentum of b (not from tops_ before and after FSR. More...
 
bool Wlv (const xAOD::TruthParticleContainer *truthParticles, TLorentzVector &W_p4, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId)
 Store the four-momentum of several particles in the W decay chain. More...
 
bool Wt_W (const xAOD::TruthParticleContainer *truthParticles, TLorentzVector &W_p4, int &W_pdgId, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId)
 Store the four-momentum of several particles in W decay chain for W that is NOT from top in Wt ST events. More...
 
bool Wt_b (const xAOD::TruthParticleContainer *truthParticles, TLorentzVector &b_beforeFSR, TLorentzVector &b_afterFSR, int &b_pdgId)
 Store the four-momentum of b quark that is NOT from top in Wt(b) ST events. More...
 
bool topPhWb (const xAOD::TruthParticleContainer *truthParticles, int topId, TLorentzVector &t_beforeFSR_p4, TLorentzVector &t_afterFSR_p4, TLorentzVector &Ph_p4, TLorentzVector &W_p4, TLorentzVector &b_p4, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId, bool &has_ph, int &BranchType, int &IniPartonType, bool &missingTop)
 Store the four-momentum of photon coming from virtual top in ttgamma events. More...
 
virtual StatusCode initialize ()
 Dummy implementation of the initialisation function. More...
 
virtual void print () const
 Print the state of the tool. More...
 
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 fillEtaBranch (xAOD::PartonHistory *partonHistory, std::string branchName, TLorentzVector &tlv)
 
StatusCode buildContainerFromMultipleCollections (const std::vector< std::string > &collections, const std::string &out_contName)
 used to build container from multiple collections in DAOD_PHYS we don't have the TruthParticles collection, so we have to build a TruthParticleContainer (named out_contName) by merging several collections; this is stored in the evtStore this method has to use some tricks, like the helper m_tempParticles ConstDataVector, due to the desing of DataVector, see https://twiki.cern.ch/twiki/bin/view/AtlasComputing/DataVector More...
 
StatusCode linkBosonCollections ()
 currently in DAOD_PHYS TruthTop have links to Ws from the TruthBoson collection, which have no link to their decay products; we have therefore to associate the W from the TruthBoson collections to those in the TruthBosonsWithDecayParticles collection. More...
 
const xAOD::TruthParticlegetTruthParticleLinkedFromDecoration (const xAOD::TruthParticle *part, const std::string &decorationName)
 helper method to handle retriveing the truth particle linked in the decoration of another particle More...
 
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...
 

Protected Attributes

std::shared_ptr< top::TopConfigm_config
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

StatusCode decorateCollectionWithLinksToAnotherCollection (const std::string &collectionToDecorate, const std::string &collectionToLink, const std::string &nameOfDecoration)
 helper method currently used in DAOD_PHYS to link particles from a given collection to the same particles included in another collection; needed because particles may be duplicated in different collections, but their navigation links may only be there in some of them... More...
 
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

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 33 of file CalcTtbarPartonHistory.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

◆ CalcTtbarPartonHistory() [1/3]

top::CalcTtbarPartonHistory::CalcTtbarPartonHistory ( const std::string &  name)
explicit

Definition at line 11 of file CalcTtbarPartonHistory.cxx.

◆ ~CalcTtbarPartonHistory()

virtual top::CalcTtbarPartonHistory::~CalcTtbarPartonHistory ( )
inlinevirtual

Definition at line 36 of file CalcTtbarPartonHistory.h.

36 {}

◆ CalcTtbarPartonHistory() [2/3]

top::CalcTtbarPartonHistory::CalcTtbarPartonHistory ( const CalcTtbarPartonHistory rhs)
delete

◆ CalcTtbarPartonHistory() [3/3]

top::CalcTtbarPartonHistory::CalcTtbarPartonHistory ( CalcTtbarPartonHistory &&  rhs)
delete

Member Function Documentation

◆ b()

bool top::CalcTopPartonHistory::b ( const xAOD::TruthParticleContainer truthParticles,
TLorentzVector &  b_beforeFSR,
TLorentzVector &  b_afterFSR 
)
inherited

Store the four-momentum of b (not from tops_ before and after FSR.

Definition at line 156 of file CalcTopPartonHistory.cxx.

157  {
158  for (const xAOD::TruthParticle* particle : *truthParticles) {
159  if (abs(particle->pdgId()) != 5) continue;
160 
161  bool skipit(false);
162  for (size_t i = 0; i < particle->nParents(); i++) {
163  const xAOD::TruthParticle* parent = particle->parent(i);
164  if (parent && (parent->isTop() || abs(parent->pdgId()) == 5)) {
165  skipit = true;
166  break;
167  }//if
168  }//for
169 
170  if (skipit) continue;
171 
172  b_beforeFSR = particle->p4();
174 
175  return true;
176  }
177 
178 
179  return false;
180  }

◆ buildContainerFromMultipleCollections()

StatusCode top::CalcTopPartonHistory::buildContainerFromMultipleCollections ( const std::vector< std::string > &  collections,
const std::string &  out_contName 
)
protectedinherited

used to build container from multiple collections in DAOD_PHYS we don't have the TruthParticles collection, so we have to build a TruthParticleContainer (named out_contName) by merging several collections; this is stored in the evtStore this method has to use some tricks, like the helper m_tempParticles ConstDataVector, due to the desing of DataVector, see https://twiki.cern.ch/twiki/bin/view/AtlasComputing/DataVector

Definition at line 21 of file CalcTopPartonHistory.cxx.

22  {
24 
25  for(const std::string& collection : collections)
26  {
27  const xAOD::TruthParticleContainer* cont=nullptr;
28  ATH_CHECK(evtStore()->retrieve(cont,collection));
29  for(const xAOD::TruthParticle* p : *cont) out_cont->push_back(p);
30  }
31 
32  //we give control of the container to the store, because in this way we are able to retrieve it as a const data vector, see https://twiki.cern.ch/twiki/bin/view/AtlasComputing/DataVector#ConstDataVector
33  StatusCode save = evtStore()->tds()->record(out_cont,out_contName);
34  if (!save) return StatusCode::FAILURE;
35 
36  return StatusCode::SUCCESS;
37  }

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

◆ decorateCollectionWithLinksToAnotherCollection()

StatusCode top::CalcTopPartonHistory::decorateCollectionWithLinksToAnotherCollection ( const std::string &  collectionToDecorate,
const std::string &  collectionToLink,
const std::string &  nameOfDecoration 
)
privateinherited

helper method currently used in DAOD_PHYS to link particles from a given collection to the same particles included in another collection; needed because particles may be duplicated in different collections, but their navigation links may only be there in some of them...

Definition at line 44 of file CalcTopPartonHistory.cxx.

45  {
46  const xAOD::TruthParticleContainer* cont1(nullptr);
47  const xAOD::TruthParticleContainer* cont2(nullptr);
48  ATH_CHECK(evtStore()->retrieve(cont1,collectionToDecorate));
49  ATH_CHECK(evtStore()->retrieve(cont2,collectionToLink));
50 
51  for(const xAOD::TruthParticle *p : *cont1)
52  {
53 
54  const xAOD::TruthParticle* link =0;
55  for(const xAOD::TruthParticle *p2 : *cont2)
56  {
57  if(p->pdgId()==p2->pdgId() && HepMC::uniqueID(p) == HepMC::uniqueID(p2))
58  {
59  link=p2;
60  break;
61  }
62  }
63  p->auxdecor<const xAOD::TruthParticle*>(nameOfDecoration)=link;
64 
65  }
66  return StatusCode::SUCCESS;
67  }

◆ 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; }

◆ execute()

StatusCode top::CalcTtbarPartonHistory::execute ( )
virtual

Reimplemented from top::CalcTopPartonHistory.

Reimplemented in top::CalcTTZPartonHistory.

Definition at line 107 of file CalcTtbarPartonHistory.cxx.

107  {
108  // Get the Truth Particles
109 
110  const xAOD::TruthParticleContainer* truthParticles(nullptr);
111 
112  if(m_config->getDerivationStream() == "PHYS") //in DAOD_PHYS we don't have the truth particles container
113  {
114  //the functions ued in this class always start from the top, so it's enough to do the following
115  std::vector<std::string> collections = {"TruthTop"};
116  ATH_CHECK(buildContainerFromMultipleCollections(collections,"AT_TTbarPartonHistory_TruthParticles"));
117  ATH_CHECK(evtStore()->retrieve(truthParticles, "AT_TTbarPartonHistory_TruthParticles"));
118 
119  //we need to be able to navigate from the Ws to their decayProducts, see CalcTopPartonHistory.h for details
121 
122  }
123  else //otherwise we retrieve the container as usual
124  {
125  ATH_CHECK(evtStore()->retrieve(truthParticles, m_config->sgKeyMCParticle()));
126  }
127 
128  // Create the partonHistory xAOD object
129  //cppcheck-suppress uninitvar
131  //cppcheck-suppress uninitvar
133  partonCont->setStore(partonAuxCont);
134  //cppcheck-suppress uninitvar
135  xAOD::PartonHistory* ttbarPartonHistory = new xAOD::PartonHistory {};
136  partonCont->push_back(ttbarPartonHistory);
137 
138  // Recover the parton history for ttbar events
139  ttbarHistorySaver(truthParticles, ttbarPartonHistory);
140 
141  // Save to StoreGate / TStore
142  std::string outputSGKey = m_config->sgKeyTopPartonHistory();
143  std::string outputSGKeyAux = outputSGKey + "Aux.";
144 
145  StatusCode save = evtStore()->tds()->record(partonCont, outputSGKey);
146  StatusCode saveAux = evtStore()->tds()->record(partonAuxCont, outputSGKeyAux);
147  if (!save || !saveAux) {
148  return StatusCode::FAILURE;
149  }
150 
151  return StatusCode::SUCCESS;
152  }

◆ 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

◆ fillEtaBranch()

void top::CalcTopPartonHistory::fillEtaBranch ( xAOD::PartonHistory partonHistory,
std::string  branchName,
TLorentzVector &  tlv 
)
protectedinherited

Definition at line 692 of file CalcTopPartonHistory.cxx.

693  {
694  if (tlv.CosTheta() == 1.) partonHistory->auxdecor< float >(branchName) = 1000.;
695  else if (tlv.CosTheta() == -1.) partonHistory->auxdecor< float >(branchName) = 1000.;
696  else partonHistory->auxdecor< float >(branchName) = tlv.Eta();
697  return;
698  }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ getTruthParticleLinkedFromDecoration()

const xAOD::TruthParticle * top::CalcTopPartonHistory::getTruthParticleLinkedFromDecoration ( const xAOD::TruthParticle part,
const std::string &  decorationName 
)
protectedinherited

helper method to handle retriveing the truth particle linked in the decoration of another particle

Definition at line 69 of file CalcTopPartonHistory.cxx.

70  {
71  if(!part->isAvailable<const xAOD::TruthParticle*>(decorationName)) return part;
72 
73  const xAOD::TruthParticle* link=part->auxdecor<const xAOD::TruthParticle*>(decorationName);
74  if(link) return link;
75 
76  return part;
77  }

◆ initialize()

virtual StatusCode asg::AsgTool::initialize ( )
inlinevirtualinherited

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented in SimpleMuonTriggerScaleFactors, Trig::TrigMuonMatching, CP::MuonTriggerScaleFactors, Trig::TrigTauMatchingTool, IHIEventShapeMapTool, ST::SUSYObjDef_xAOD, InDetSecVtxTruthMatchTool, JetGrooming::RecSoftDrop, met::METMaker, AsgForwardElectronIsEMSelector, JetGrooming::JetTrimming, ORUtils::BaseOverlapTool, PMGTools::PMGSherpa22VJetsWeightTool, AsgElectronEfficiencyCorrectionTool, CP::ElectronChargeEfficiencyCorrectionTool, AsgForwardElectronLikelihoodTool, CorrectPFOTool, CP::IsolationCorrectionTool, TauAnalysisTools::TauTruthMatchingTool, EGammaAmbiguityTool, InDetVertexTruthMatchTool, AthOnnx::OnnxRuntimeSessionToolCPU, AthOnnx::OnnxRuntimeSessionToolCUDA, PuppiWeightTool, JetIsolationTool, JetBalancePFlowJvtTool, CP::FFJetSmearingTool, JetForwardPFlowJvtTool, MCTruthClassifier, InDet::InDetHardScatterSelectionTool, dRMatchingTool, xAOD::BPhysBlindingTool, CP::EgammaCalibrationAndSmearingTool, JetVertexTaggerTool, tauRecTools::TrackRNN, LVL1::L1CaloOfflineTriggerTowerTools, TauAnalysisTools::TauSelectionTool, JetRecTool, met::METAssociationTool, CP::TrackVertexAssociationTool, met::METRebuilder, met::METAssociator, xAOD::TrackIsolationTool, InDet::InDetTrackSelectionTool, egammaMVACalibTool, TrigConf::xAODConfigTool, JetCleaningTool, met::METCaloRegionsTool, ZDC::ZdcLEDAnalysisTool, CP::MuonCalibTool, LVL1::L1CaloCells2TriggerTowers, JetVertexFractionTool, LVL1BS::PpmByteStreamReadV1V2Tool, JetClusterer, JetForwardJvtToolBDT, CP::AsgFlagSelectionTool, TauTrackFinder, TauAnalysisTools::DiTauSelectionTool, JetClustererByVertex, JetBadChanCorrTool, xAOD::BPhysTrackVertexMapTool, JetModifiedMassDrop, xAOD::CaloIsolationTool, EnhancedBiasWeighter, BookkeeperTool, ZDC::RpdSubtractCentroidTool, InDet::InDetUsedInFitTrackDecoratorTool, CP::AsgPtEtaSelectionTool, TauAnalysisTools::BuildTruthTaus, top::EventSaverFlatNtuple, tauRecTools::TauTrackRNNClassifier, InDet::InDetSecVtxTrackSelectionTool, JetForwardJvtTool, JetPileupTag::JetVertexNNTagger, CP::EgammaIsGoodOQSelectionTool, CP::IsolationCloseByCorrectionTool, CP::MuonCalibIntScaleSmearTool, DiTauRecTools::DiTauIDVarCalculator, JetFinder, AsgElectronIsEMSelector, CP::MuonCalibIntHighpTSmearTool, CP::MuonCalibIntSagittaTool, DiTauRecTools::DiTauDiscriminantTool, met::METBuilderTool, CP::AsgMaskSelectionTool, ElectronPhotonVariableCorrectionBase, ECUtils::EventCleaningTool, TauAnalysisTools::TauTruthTrackMatchingTool, met::METSoftTermsTool, LVL1::L1CaloLArTowerEnergy, HiggsTruthCategoryTool, IDTPM::TrackRoiSelectionTool, TauAnalysisTools::CommonDiTauEfficiencyTool, HIJetConstituentSubtractionTool, JetTrackSumMomentsTool, JetGrooming::SoftDrop, JetQGTaggerVariableTool, JetTrackMomentsTool, met::METTruthTool, CP::BaseLinearFakeBkgTool, PMGTools::PMGSherpaVjetsSysTool, ClusterMatching::CaloClusterMatchingTool, AsgPhotonEfficiencyCorrectionTool, InDet::JetTrackFilterTool, asg::DataHandleTestTool, xAODMaker::FileMetaDataTool, CP::BaseFakeBkgTool, InDet::InclusiveTrackFilterTool, InDet::InDetTrackTruthFilterTool, HIJetClusterSubtractorTool, CP::MVATrackVertexAssociationTool, IDTPM::RoiSelectionTool, ElectronPhotonVariableCorrectionTool, JetCalibrationTool, JetCaloQualityTool, JetOriginCorrectionTool, InDet::InDetTrackBiasingTool, HIJetClusterIndexAssociationTool, TauWPDecorator, TrigGlobalEfficiencyCorrectionTool, ZdcRecChannelToolV2, IDTPM::TrackObjectSelectionTool, CP::LhoodMM_tools, FlavorTagDiscriminants::GNNTool, FlavorTagDiscriminants::MultifoldGNNTool, CP::MuonSelectionTool, TauAnalysisTools::CommonDiTauSmearingTool, JSSTaggerBase, ZDC::ZdcAnalysisTool, IDTPM::TrackQualitySelectionTool, AsgElectronLikelihoodTool, CP::JetQGTagger, CP::JetJvtEfficiency, LVL1::L1CaloFcal23Cells2RxMappingTool, ORUtils::OverlapRemovalTool, Analysis::JetQuarkLabel, Ringer::AsgRingerSelectorTool, InDet::InDetTrackSmearingTool, JetCopier, JetGrooming::JetGroomer, met::METPhotonAssociator, JetECPSFractionTool, JetPtAssociationTool, met::METElectronAssociator, met::METTauAssociator, PMGTools::PMGDecayProductsSelectionTool, WeightToolBase, HIJetDRAssociationTool, JetClusterMomentsTool, met::METJetAssocTool, TauVertexFinder, IDTPM::JsonPlotsDefReadTool, TauAnalysisTools::DiTauSmearingTool, JetDRTrackAssocTool, JetReclusterer, TauDecayModeNNClassifier, BDTVertexWeightCalculator, asg::UnitTestTool1, IDTPM::DeltaRMatchingToolBase< T, R >, AsgElectronSelectorTool, JetReclusteringTool, met::METMuonAssociator, TauPi0CreateROI, TauShotFinder, IDTPM::DeltaRMatchingToolBase< xAOD::TrackParticle, xAOD::TruthParticle >, IDTPM::DeltaRMatchingToolBase< xAOD::TruthParticle, xAOD::TrackParticle >, IDTPM::DeltaRMatchingToolBase< xAOD::TrackParticle >, ZdcRecChannelToolLucrod, PMGTools::PMGTruthWeightTool, JetVoronoiMomentsTool, Trig::MatchFromCompositeTool, asg::UnitTestTool3, IDTPM::TruthTrackMatchingTool, CP::ApplyFakeFactor, AsgElectronChargeIDSelectorTool, HIJetMaxOverMeanTool, PanTau::Tool_FeatureExtractor, TauElectronVetoVariables, CP::IsolationSelectionTool, WeightsAgregator, EL::UnitTestTool, FlavorTagDiscriminants::TrackClassifier, JetLArHVTool, ZDC::ZdcTrigValidTool, IDTPM::TrackTruthMatchingTool, HI::HIPileupTool, InDet::InDetTrackTruthOriginTool, JetHelper::VarTool, FlavorTagDiscriminants::DL2Tool, BTaggingSelectionTool, EnergyCorrelatorGeneralizedRatiosTool, EnergyCorrelatorGeneralizedTool, EnergyCorrelatorRatiosTool, EnergyCorrelatorTool, TauEleOverlapChecker, TauJetRNNEvaluator, asg::UnitTestTool2, JetTruthLabelingTool, ZDC::ZdcRecTool, HIJetConstituentModifierTool, TauCalibrateLC, TauGNNEvaluator, TauPi0ScoreCalculator, TauRecToolBase, Trig::TrigEgammaEmulationPrecisionElectronHypoTool, asg::UnitTestTool1A, PDFWeight, HIEventShapeJetIteration, HIJetSignificanceTool, CP::JetQGTaggerBDT, JetWidthTool, TauVertexVariables, Trig::TrigEgammaEmulationPrecisionPhotonHypoTool, Trig::TrigEgammaMatchingTool, Trig::R3IParticleRetrievalTool, IDTPM::TruthTrackQualitySelectionTool, JetPileupLabelingTool, JetFromPseudojet, JetTruthParticleSelectorTool, Trig::TrigEgammaEmulationBaseHypoTool, CP::ApplyE2YFakeRate, ParticleScaleFactorTool, InDet::InDetTrackSystematicsTool, JetCaloQualityToolFE, Trig::MatchingTool, Trig::R3MatchingTool, IDTPM::OfflineTrackQualitySelectionTool, JetParticleAssociation, Trig::TrigEgammaEmulationChain, Trig::TrigEgammaEmulationFastCaloHypoTool, AthOnnx::OnnxRuntimeInferenceTool, xAODtoHepMCTool, HIEventShapeMapTool, HI::HIVertexSelectionTool, JetHelper::HistoInput2D, TauVertexedClusterDecorator, Trig::IParticleRetrievalTool, CP::AsymptMatrixTool, HI::HIEventSelectionTool, FlavorTagDiscriminants::HbbTagTool, JetConstituentFrac, JetGroomMRatio, JetHelper::HistoInput1D, JetHelper::TextInputMCJES, ExtendTrackToLayerTool, Trig::TypedScoringTool, TrackTruthSelectionTool, HIUEModulatorTool, JSSWTopTaggerANN, CP::JvtEfficiencyToolBase, JetEMScaleMomTool, MvaTESVariableDecorator, TauAODLeptonRemovalTool, TauCombinedTES, ParticleJetDeltaRLabelTool, HIEventShapeSummaryTool, FlavorTagDiscriminants::BTagAugmenterTool, FlavorTagDiscriminants::VRJetOverlapDecoratorTool, JetCaloEnergies, ParticleJetGhostLabelTool, FlavorTagDiscriminants::BTagMuonAugmenterTool, MBTSTimeFilterTool, JSSWTopTaggerDNN, SmoothedTopTagger, MvaTESEvaluator, CP::IsolationLowPtPLVTool, Trig::DRScoringTool, Trig::EgammaDRScoringTool, SmoothedWZTagger, CP::FJvtEfficiencyTool, CP::JvtSelectionToolBase, CP::NNJvtSelectionTool, AthAsgExUnittestTool, CP::JvtSelectionTool, BTaggingSelectionJsonTool, CP::FJvtSelectionTool, CP::JvtEfficiencyTool, CP::NNJvtEfficiencyTool, BookkeeperDumperTool, TrigFastCalibWithRings, top::ScaleFactorRetriever, BTaggingEfficiencyTool, BTaggingTruthTaggingTool, MissingCellListTool, JetVoronoiDiagramHelpers::Diagram, FastJetInterfaceTool, met::METSystematicsTool, Trig::TrigEgammaEmulationToolMT, JetAttributeRatioSelector, top::GhostTrackSystematicsMaker, top::TopObjectSelection, BTaggingEigenVectorRecompositionTool, LVL1::TrigT1CaloLWHistogramToolV1, LVL1::TrigT1CaloLWHistogramTool, Trig::TrigDecisionTool, CP::PhotonPointingTool, met::METRecoTool, CP::PhotonVertexSelectionTool, top::KLFitterTool, ZdcByteStreamReadV1V2Tool, CP::PileupReweightingTool, top::JetObjectCollectionMaker, LVL1::L1CaloxAODOfflineTriggerTowerTools, RCJet, LVL1::TrigT1CaloMonErrorToolV1, met::METTrackFilterTool, LVL1::TrigT1CaloMonErrorTool, SoftKillerWeightTool, EventDensityTool, met::METSignificance, ParticleLevelRCJetObjectLoader, JetUncertaintiesTool, top::TopToolStore, CP::JetTileCorrectionTool, xAODMaker::TriggerMenuMetaDataTool, D3PD::D3PDMCTruthClassifier, top::ElectronInJetSubtractionCollectionMaker, top::MuonObjectCollectionMaker, JetConstituentModSequence, top::EgammaObjectCollectionMaker, HistoGroupBase, AsgPhotonIsEMSelector, JetAttributeSelector, top::ObjectCollectionMaker, TrackVertexAssociationTool, met::METRefinerTool, TauAnalysisTools::CommonSmearingTool, top::GlobalLeptonTriggerCalculator, top::ScaleFactorCalculator, top::TrackSystematicsMaker, top::ElectronScaleFactorCalculator, top::JetScaleFactorCalculator, top::MuonScaleFactorCalculator, PanTau::Tool_DetailsArranger, LVL1::L1CaloMonitoringCaloTool, top::EventSaverxAOD, LVL1::L1CaloTTIdTools, top::SoftMuonObjectCollectionMaker, top::TauObjectCollectionMaker, JetInputElRemovalTool, TauAnalysisTools::CommonEfficiencyTool, top::BTagScaleFactorCalculator, top::MissingETObjectCollectionMaker, PanTau::PanTauProcessor, xAODMaker::TruthMetaDataTool, top::PDFScaleFactorCalculator, top::PhotonScaleFactorCalculator, top::PseudoTopReco, EventShapeCopier, met::METJetTool, GoodRunsListSelectionTool, top::EventSaverxAODNext, top::FwdElectronScaleFactorCalculator, FSR::FsrPhotonTool, Trig::StaticBunchCrossingTool, ZMassConstraint::ConstraintFit, TauAnalysisTools::TauEfficiencyCorrectionsTool, PanTau::Tool_DecayModeDeterminator, PanTau::Tool_ModeDiscriminator, CP::ElectronLRTOverlapRemovalTool, HIClusterSubtraction, JetAttributeHisto, JetPseudojetCopier, met::METEgammaAssociator, Trig::xAODBunchCrossingTool, TauAnalysisTools::DiTauEfficiencyCorrectionsTool, TauAnalysisTools::DiTauTruthMatchingTool, TauAnalysisTools::TauSmearingTool, top::JetMETCPTools, met::METTruthAssociator, PanTau::Tool_InformationStore, HistoDefinitionTool, PanTau::Tool_InputConverter, JetBottomUpSoftDrop, JetRecursiveSoftDrop, PMGTools::PMGCrossSectionTool, JetSoftDrop, TrigEgammaMatchingToolMT, DiTauMassTools::MissingMassToolV2, top::TauScaleFactorCalculator, top::TriggerCPTools, JetConstituentsRetriever, VoronoiWeightTool, top::GhostTrackCPTools, JetCaloCellQualityTool, JetContainerHistoFiller, ChargedHadronSubtractionTool, JetTrackSelectionTool, met::METRegionsTool, met::METSoftAssociator, PanTau::Tool_TauConstituentGetter, top::EventCleaningSelection, ConstituentSubtractorTool, top::EgammaCPTools, top::OtherCPTools, top::TopEventMaker, JetHistoBase, JetSelectorAttributeRunII, JetSplitter, CaloClusterConstituentsOrigin, JetTrackSelectionTool2, SimpleJetTrackSelectionTool, CP::MuonLRTOverlapRemovalTool, top::FlavorTaggingCPTools, top::TauCPTools, HistosForJetSelection, JetPruner, JetToolRunner, JetUsedInFitTrackDecoratorTool, top::TrackCPTools, JetTrimmer, NSubjettinessRatiosTool, CP::MuonEfficiencyScaleFactors, top::PileupScaleFactorCalculator, top::MuonCPTools, JetConstitFourMomTool, NSubjettinessTool, ZdcDataAccessV2, JetPseudojetRetriever, LVL1BS::TrigT1CaloDataAccessV2, PanTau::Tool_TauConstituentSelector, CopyTruthParticles, top::IsolationCPTools, top::OverlapRemovalCPTools, ClusterAtEMScaleTool, CP::IsolationHelper, top::BoostedTaggingCPTools, AsgDeadHVCellRemovalTool, ConstitTimeCutTool, Analysis::JetConeLabeling, JetSelectorAttribute, HIJetUEMonitoring, HIEfficiencyResponseHistos, JetSubStructureMomentToolsBase, AsgHelloTool, CopyTruthJetParticles, LeadingJetsRelations, EfficiencyResponseHistos, and JetEventSelector.

Definition at line 133 of file AsgTool.h.

133 { return StatusCode::SUCCESS; }

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

◆ linkBosonCollections()

StatusCode top::CalcTopPartonHistory::linkBosonCollections ( )
protectedinherited

currently in DAOD_PHYS TruthTop have links to Ws from the TruthBoson collection, which have no link to their decay products; we have therefore to associate the W from the TruthBoson collections to those in the TruthBosonsWithDecayParticles collection.

This method will use the helper method decorateCollectionWithLinksToAnotherCollection to decorate bosons in the TruthBoson collection with "AT_linkToTruthBosonsWithDecayParticles", which is a link to the same bosons in the TruthBosonsWithDecayParticles collection

Definition at line 39 of file CalcTopPartonHistory.cxx.

40  {
41  return decorateCollectionWithLinksToAnotherCollection("TruthBoson","TruthBosonsWithDecayParticles","AT_linkToTruthBosonsWithDecayParticles");
42  }

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

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

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

◆ operator=()

CalcTtbarPartonHistory& top::CalcTtbarPartonHistory::operator= ( const CalcTtbarPartonHistory rhs)
delete

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

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

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

◆ topAfterFSR_SC()

bool top::CalcTopPartonHistory::topAfterFSR_SC ( const xAOD::TruthParticleContainer truthParticles,
int  start,
TLorentzVector &  top_afterFSR_SC_p4 
)
inherited

Store the four-momentum of the post-FSR top or anti-top found using statusCodes This would only work if there is at most one "true" top of each charge (i.e.

won't work for SS tops or 4 tops) This code was adapted from the 7TeV parton-level differential ttbar routine: https://svnweb.cern.ch/trac/atlasphys-top/browser/Physics/Top/Software/MCvalidation/Rivet/Rivet2.X/trunk/routines/ATLAS_2014_I1304289/ATLAS_2014_I1304289.cc

won't work for SS tops or 4 tops) This code was adapted from the 7TeV parton-level differential ttbar routine:

Step1: create vectors of particles of each status codes

Step2: loop on the container of particles and fill the above created vectors

Step3: for some of the statuscodes, keep only the last of the vector

Step4: chose which statuscode to take according to what is found in the event

Step5: if everything worked, set the 4-vector to its value and return true

Definition at line 83 of file CalcTopPartonHistory.cxx.

84  {
86  // Vectors to hold any status=3 (anti-)top quarks (Pythia 6)
87  std::vector<const xAOD::TruthParticle*> v_status3_top;
88  // Vectors to hold any status=155 (anti-)top quarks (Herwig 6)
89  std::vector<const xAOD::TruthParticle*> v_status155_top;
90  // Vectors to hold any status=11 (anti-)top quarks for Herwig++
91  std::vector<const xAOD::TruthParticle*> v_status11_top;
92  // Vectors to hold any status=22 (anti-)top quarks
93  std::vector<const xAOD::TruthParticle*> v_statusOther_top;
94 
96  for (const xAOD::TruthParticle* particle : *truthParticles) {
97  if (particle->pdgId() != start) continue; // only keep particles of a given pdgID (e.g. 6 or -6)
98 
99  if (particle->status() == 3) {
100  v_status3_top.push_back(particle);
101  } else if (particle->status() == 155) {
102  v_status155_top.push_back(particle);
103  } else if (particle->status() == 11) {// for Herwig++: take only the tops that decay into Wb!!!
104  if (!particle->hasDecayVtx()) continue;
105  const xAOD::TruthVertex* vertex = particle->decayVtx();
106  if (vertex == nullptr) continue;
107  if (vertex->nOutgoingParticles() == 2) v_status11_top.push_back(particle);
108  } else {
109  v_statusOther_top.push_back(particle);
110  }
111  }
112 
114  // If there are more than 1 status 3 tops or anti-tops, only keep the last one put into the vector
115  if (v_status3_top.size() > 1) {
116  v_status3_top = std::vector<const xAOD::TruthParticle*>(v_status3_top.end() - 1, v_status3_top.end());
117  }
118  // If there are more than 1 status 11 tops or anti-tops, only keep the last one put into the vector
119  if (v_status11_top.size() > 1) {
120  v_status11_top = std::vector<const xAOD::TruthParticle*>(v_status11_top.end() - 1, v_status11_top.end());
121  }
122  // Rach: check for Pythia 8 as well
123  // If there are more than 1 status 3 tops or anti-tops, only keep the last one put into the vector
124  if (v_statusOther_top.size() > 1) {
125  v_statusOther_top = std::vector<const xAOD::TruthParticle*>(v_statusOther_top.end() - 1, v_statusOther_top.end());
126  }
127 
129  const xAOD::TruthParticle* top = nullptr;
130  // If there are status 3 tops and no status 155 tops this is probably a Pythia event, so used the status 3s.
131  if (v_status3_top.size() == 1 && v_status155_top.size() == 0) {
132  top = v_status3_top[0];
133  }
134  // If there are status 155 tops this must be a Herwig event, so use the status 155s.
135  if (v_status155_top.size() == 1 && v_status3_top.size() == 0) {
136  top = v_status155_top[0];
137  }
138  // If there are tops with other status this must be a Pythia8 event, so use them.
139  if (v_statusOther_top.size() == 1 && v_status155_top.size() == 0 && v_status3_top.size() == 0) {
140  top = v_statusOther_top[0];
141  }
142  // If there are status 155 tops this must be a Herwig event, so use the status 155s.
143  if (v_status11_top.size() == 1 && v_status3_top.size() == 0) {
144  top = v_status11_top[0];
145  }
146 
148  if (top != nullptr) {
149  top_afterFSR_SC_p4 = top->p4();
150  return true;
151  }
152  return false;
153  }

◆ topPhWb()

bool top::CalcTopPartonHistory::topPhWb ( const xAOD::TruthParticleContainer truthParticles,
int  topId,
TLorentzVector &  t_beforeFSR_p4,
TLorentzVector &  t_afterFSR_p4,
TLorentzVector &  Ph_p4,
TLorentzVector &  W_p4,
TLorentzVector &  b_p4,
TLorentzVector &  Wdecay1_p4,
int &  Wdecay1_pdgId,
TLorentzVector &  Wdecay2_p4,
int &  Wdecay2_pdgId,
bool &  has_ph,
int &  BranchType,
int &  IniPartonType,
bool &  missingTop 
)
inherited

Store the four-momentum of photon coming from virtual top in ttgamma events.

Definition at line 448 of file CalcTopPartonHistory.cxx.

453  {
454  bool hasT = false;
455  bool hasW = false;
456  bool hasAbsentW = false;
457  bool hasB = false;
458 
459  has_ph = false;
460  bool ph_W = false;
461  bool ph_Top = false;
462  bool ph_ISR = false;
463  bool ph_b = false;
464  bool hasWdecayProd1 = false;
465  bool hasWdecayProd2 = false;
466  missingTop = false;
467 
468  for (const xAOD::TruthParticle* particle : *truthParticles) {
469  if (particle->pdgId() != topId) continue;
470 
471  if (PartonHistoryUtils::hasParticleIdenticalParent(particle)) continue; // kepping only top before FSR
472  BranchType = -1;// 10(50): leptonic(hadronic), 12(52):topRad, 14(54):Wrad, 15(55):ISR, 18(58):b
473  IniPartonType = -1;
474 
475  // finding siblings
476  for (size_t iparent = 0; iparent < particle->nParents(); iparent++) {
477  if (abs(particle->parent(iparent)->pdgId()) == 21) {
478  IniPartonType = 1;
479  } // gg fusion
480  else if (abs(particle->parent(iparent)->pdgId()) < 6) {
481  IniPartonType = 2;
482  } //qq annihilation
483 
484  for (size_t ichild = 0; ichild < particle->parent(iparent)->nChildren(); ichild++) {
485  if (particle->parent(iparent)->child(ichild)->pdgId() == 22) {
486  const xAOD::TruthParticle* photon = PartonHistoryUtils::findAfterFSR(particle->parent(iparent)->child(ichild));
487  Ph_p4 = photon->p4();
488  has_ph = true;
489  ph_ISR = true;
490  }
491  if (!missingTop &&
492  (abs(particle->parent(iparent)->child(ichild)->pdgId()) == 5 ||
493  abs(particle->parent(iparent)->child(ichild)->pdgId()) == 24)) {
494  missingTop = true;
495  }
496  }
497  }
498 
499  t_beforeFSR_p4 = particle->p4(); // top before FSR
500  hasT = true;
501  // demanding the last tops after FSR
503  t_afterFSR_p4 = particle->p4(); // top after FSR
504 
505  for (size_t k = 0; k < particle->nChildren(); k++) {// top children
506  const xAOD::TruthParticle* topChildren = particle->child(k);
507 
508  if (abs(topChildren->pdgId()) == 24) {
509  W_p4 = topChildren->p4(); // W boson before FSR
510  hasW = true;
511 
512  // demanding the last W after FSR
513  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
514 
515  for (size_t q = 0; q < topChildren->nChildren(); q++) {// W children
516  const xAOD::TruthParticle* WChildren = topChildren->child(q);
517  if (abs(WChildren->pdgId()) > 0 && abs(WChildren->pdgId()) < 17) {
518  if (abs(WChildren->pdgId()) < 7) {
519  BranchType = 50;
520  }// hadronic
521  else if (abs(WChildren->pdgId()) > 10 && abs(WChildren->pdgId()) < 17) {
522  BranchType = 10;
523  }// leptonic
524  if (WChildren->pdgId() > 0) {
525  WChildren = PartonHistoryUtils::findAfterFSR(WChildren);
526  Wdecay1_p4 = WChildren->p4();
527  Wdecay1_pdgId = WChildren->pdgId();
528  hasWdecayProd1 = true;
529  } else {
530  WChildren = PartonHistoryUtils::findAfterFSR(WChildren);
531  Wdecay2_p4 = WChildren->p4();
532  Wdecay2_pdgId = WChildren->pdgId();
533  hasWdecayProd2 = true;
534  }//else
535  } else if (abs(WChildren->pdgId()) == 22) {// photon
536  // JUST FOR EXTRA SAFETY (not necessary)
537  // check if there exists a photon already
538  // if it does, check the photon's Pt
539  // if found harder then consider, else do nothing
540  if (has_ph) {
541  if (WChildren->p4().Pt() > Ph_p4.Pt()) {
542  ph_W = true;
543  ph_ISR = false;
544  ph_Top = false;
545  ph_b = false;
546  WChildren = PartonHistoryUtils::findAfterFSR(WChildren);
547  Ph_p4 = WChildren->p4();
548  }
549  } else {
550  has_ph = true;
551  ph_W = true;
552  WChildren = PartonHistoryUtils::findAfterFSR(WChildren);
553  Ph_p4 = WChildren->p4();
554  }
555  }
556  }// W children
557  } else if (abs(topChildren->pdgId()) == 5) { // b
558  hasB = true;
559  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);// b After FSR
560  b_p4 = topChildren->p4();
561  // In MG5 generation of ttgamma it is not expected to have any b radiation 'recorded'
562  for (size_t b = 0; b < topChildren->nChildren(); b++) {// b Children
563  const xAOD::TruthParticle* bChildren = topChildren->child(b);
564  if (bChildren && MC::isPhoton(bChildren)) {
565  // JUST FOR EXTRA SAFETY (not necessary)
566  if (has_ph) {
567  if (bChildren->p4().Pt() > Ph_p4.Pt()) {
568  ph_b = true;
569  ph_ISR = false;
570  ph_Top = false;
571  ph_W = false;
572  bChildren = PartonHistoryUtils::findAfterFSR(bChildren);
573  Ph_p4 = bChildren->p4();
574  }
575  } else {
576  has_ph = true;
577  ph_b = true;
578  bChildren = PartonHistoryUtils::findAfterFSR(bChildren);
579  Ph_p4 = bChildren->p4();
580  }
581  }
582  }
583  } else if (MC::isPhoton(topChildren)) {
584  // JUST FOR EXTRA SAFETY (not necessary)
585  if (has_ph) {
586  if (topChildren->p4().Pt() > Ph_p4.Pt()) {
587  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
588  Ph_p4 = topChildren->p4();
589  ph_Top = true;
590  }
591  } else {
592  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
593  Ph_p4 = topChildren->p4();
594  has_ph = true;
595  ph_Top = true;
596  ph_W = false;
597  ph_ISR = false;
598  ph_b = false;
599  }
600  }
601  // sometimes the W is not recorded and the W products are recorded as top products
602  else if (abs(topChildren->pdgId()) <= 4 || (abs(topChildren->pdgId()) > 10 && abs(topChildren->pdgId()) < 17)) {
603  hasW = true;
604  hasAbsentW = true;
605  if (abs(topChildren->pdgId()) < 7) {
606  BranchType = 50;
607  }// hadronic
608  else if (abs(topChildren->pdgId()) > 10 && abs(topChildren->pdgId()) < 17) {
609  BranchType = 10;
610  }// leptonic
611  if (topChildren->pdgId() > 0) {
612  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
613  Wdecay1_p4 = topChildren->p4();
614  Wdecay1_pdgId = topChildren->pdgId();
615  hasWdecayProd1 = true;
616  } else {
617  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
618  Wdecay2_p4 = topChildren->p4();
619  Wdecay2_pdgId = topChildren->pdgId();
620  hasWdecayProd2 = true;
621  }//else
622  W_p4 = W_p4 + topChildren->p4();
623  }// if top children
624  } // for top children
625 
626  // BranchType Determination if there is a photon
627  if (hasAbsentW && (ph_Top || ph_W)) {
628  BranchType = -1;
629  }// if the W is not recorded and still the photon is from the top, the source of the photon is then ambiguous
630  // among top and W. BranchType would be +1. Category would be 0.
631  if (has_ph && ph_Top) {
632  BranchType = BranchType + 2;
633  }
634  if (has_ph && ph_W) {
635  BranchType = BranchType + 4;
636  }
637  if (has_ph && ph_ISR) {
638  BranchType = BranchType + 5;
639  }
640  if (has_ph && ph_b) {
641  BranchType = BranchType + 8;
642  }
643 
644  if (hasT && hasW && hasB && hasWdecayProd1 && hasWdecayProd2 && BranchType != -1) return true;
645  }// particle
646 
647  return false;
648  }

◆ topWb()

bool top::CalcTopPartonHistory::topWb ( const xAOD::TruthParticleContainer truthParticles,
int  start,
TLorentzVector &  t_beforeFSR_p4,
TLorentzVector &  t_afterFSR_p4,
TLorentzVector &  W_p4,
TLorentzVector &  b_p4,
TLorentzVector &  Wdecay1_p4,
int &  Wdecay1_pdgId,
TLorentzVector &  Wdecay2_p4,
int &  Wdecay2_pdgId 
)
inherited

Store the four-momentum of several particles in the top decay chain.

Definition at line 182 of file CalcTopPartonHistory.cxx.

186  {
187  bool hasT = false;
188  bool hasW = false;
189  bool hasB = false;
190  bool hasWdecayProd1 = false;
191  bool hasWdecayProd2 = false;
192 
193  for (const xAOD::TruthParticle* particle : *truthParticles) {
194  if (particle->pdgId() != start) continue;
195 
196  if (PartonHistoryUtils::hasParticleIdenticalParent(particle)) continue; // kepping only top before FSR
197 
198  t_beforeFSR_p4 = particle->p4(); // top before FSR
199  hasT = true;
200 
201  // demanding the last tops after FSR
203  t_afterFSR_p4 = particle->p4(); // top after FSR
204 
205  for (size_t k = 0; k < particle->nChildren(); k++) {
206  const xAOD::TruthParticle* topChildren = particle->child(k);
207 
208  if (abs(topChildren->pdgId()) == 24) {
209  W_p4 = topChildren->p4(); // W boson after FSR
210  hasW = true;
211 
212  // demanding the last W after FSR
213  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
214 
215  //for DAOD_PHYS we have to use a special procedure to associate W bosons linked from the top to those in the TruthBosonsWithDecayParticles collection, which have the correct links for their decay products
216  //this is better explained in the head; this will work only if the class calling this function has called linkBosonCollections() before
217  if(m_config->getDerivationStream() == "PHYS") topChildren=getTruthParticleLinkedFromDecoration(topChildren,"AT_linkToTruthBosonsWithDecayParticles");
218 
219  for (size_t q = 0; q < topChildren->nChildren(); ++q) {
220  const xAOD::TruthParticle* WChildren = topChildren->child(q);
221  if (abs(WChildren->pdgId()) < 17) {
222  if (WChildren->pdgId() > 0) {
223  Wdecay1_p4 = WChildren->p4();
224  Wdecay1_pdgId = WChildren->pdgId();
225  hasWdecayProd1 = true;
226  } else {
227  Wdecay2_p4 = WChildren->p4();
228  Wdecay2_pdgId = WChildren->pdgId();
229  hasWdecayProd2 = true;
230  }//else
231  }//if
232  }//for
233  } else if (abs(topChildren->pdgId()) == 5) {
234  b_p4 = topChildren->p4();
235  hasB = true;
236  } //else if
237  } //for (size_t k=0; k < particle->nChildren(); k++)
238 
239  if (hasT && hasW && hasB && hasWdecayProd1 && hasWdecayProd2) return true;
240 
241  } //for (const xAOD::TruthParticle* particle : *truthParticles)
242 
243  return false;
244  }

◆ topWq()

bool top::CalcTopPartonHistory::topWq ( const xAOD::TruthParticleContainer truthParticles,
int  start,
TLorentzVector &  t_beforeFSR_p4,
TLorentzVector &  t_afterFSR_p4,
TLorentzVector &  W_p4,
TLorentzVector &  q_p4,
int &  q_pdgId,
TLorentzVector &  Wdecay1_p4,
int &  Wdecay1_pdgId,
TLorentzVector &  Wdecay2_p4,
int &  Wdecay2_pdgId 
)
inherited

Definition at line 246 of file CalcTopPartonHistory.cxx.

250  {
251  bool hasT = false;
252  bool hasW = false;
253  bool hasQ = false;
254  bool hasWdecayProd1 = false;
255  bool hasWdecayProd2 = false;
256 
257  for (const xAOD::TruthParticle* particle : *truthParticles) {
258  if (particle->pdgId() != start) continue;
259 
260  if (PartonHistoryUtils::hasParticleIdenticalParent(particle)) continue; // kepping only top before FSR
261 
262  t_beforeFSR_p4 = particle->p4(); // top before FSR
263  hasT = true;
264 
265  // demanding the last tops after FSR
267  t_afterFSR_p4 = particle->p4(); // top after FSR
268 
269  for (size_t k = 0; k < particle->nChildren(); k++) {
270  const xAOD::TruthParticle* topChildren = particle->child(k);
271 
272  if (abs(topChildren->pdgId()) == 24) {
273  W_p4 = topChildren->p4(); // W boson after FSR
274  hasW = true;
275 
276  // demanding the last W after FSR
277  topChildren = PartonHistoryUtils::findAfterFSR(topChildren);
278 
279  for (size_t q = 0; q < topChildren->nChildren(); ++q) {
280  const xAOD::TruthParticle* WChildren = topChildren->child(q);
281  if (abs(WChildren->pdgId()) < 17) {
282  if (WChildren->pdgId() > 0) {
283  Wdecay1_p4 = WChildren->p4();
284  Wdecay1_pdgId = WChildren->pdgId();
285  hasWdecayProd1 = true;
286  } else {
287  Wdecay2_p4 = WChildren->p4();
288  Wdecay2_pdgId = WChildren->pdgId();
289  hasWdecayProd2 = true;
290  }//else
291  }//if
292  }//for
293  } else if (abs(topChildren->pdgId()) == 5 || abs(topChildren->pdgId()) == 3 || abs(topChildren->pdgId()) == 1) {
294  q_p4 = topChildren->p4();
295  q_pdgId = topChildren->pdgId();
296  hasQ = true;
297  } //else if
298  } //for (size_t k=0; k < particle->nChildren(); k++)
299  if (hasT && hasW && hasQ && hasWdecayProd1 && hasWdecayProd2) return true;
300  } //for (const xAOD::TruthParticle* particle : *truthParticles)
301 
302  return false;
303  }

◆ ttbarHistorySaver()

void top::CalcTtbarPartonHistory::ttbarHistorySaver ( const xAOD::TruthParticleContainer truthParticles,
xAOD::PartonHistory ttbarPartonHistory 
)

Definition at line 13 of file CalcTtbarPartonHistory.cxx.

14  {
15  ttbarPartonHistory->IniVarTtbar();
16 
17  TLorentzVector t_before, t_after, t_after_SC;
18  TLorentzVector Wp;
19  TLorentzVector b;
20  TLorentzVector WpDecay1;
21  TLorentzVector WpDecay2;
22  int WpDecay1_pdgId{};
23  int WpDecay2_pdgId{};
24 
25  bool event_top = CalcTopPartonHistory::topWb(truthParticles, 6, t_before, t_after, Wp, b, WpDecay1, WpDecay1_pdgId,
26  WpDecay2, WpDecay2_pdgId);
27  bool event_top_SC = CalcTopPartonHistory::topAfterFSR_SC(truthParticles, 6, t_after_SC);
28 
29  TLorentzVector tbar_before, tbar_after, tbar_after_SC;
30  TLorentzVector Wm;
31  TLorentzVector bbar;
32  TLorentzVector WmDecay1;
33  TLorentzVector WmDecay2;
34  int WmDecay1_pdgId{};
35  int WmDecay2_pdgId{};
36 
37  bool event_topbar = CalcTopPartonHistory::topWb(truthParticles, -6, tbar_before, tbar_after, Wm, bbar, WmDecay1,
38  WmDecay1_pdgId, WmDecay2, WmDecay2_pdgId);
39  bool event_topbar_SC = CalcTopPartonHistory::topAfterFSR_SC(truthParticles, -6, tbar_after_SC);
40 
41  if (event_top && event_topbar) {
42  TLorentzVector temp = t_before + tbar_before;
43  decorateWithMPtPhi(ttbarPartonHistory, "MC_ttbar_beforeFSR", temp);
44  fillEtaBranch(ttbarPartonHistory, "MC_ttbar_beforeFSR_eta", temp);
45 
46  temp = t_after + tbar_after;
47  decorateWithMPtPhi(ttbarPartonHistory, "MC_ttbar_afterFSR_beforeDecay", temp);
48  fillEtaBranch(ttbarPartonHistory, "MC_ttbar_afterFSR_beforeDecay_eta", temp);
49 
50  temp = WmDecay1 + WmDecay2 + b + WpDecay1 + WpDecay2 + bbar;
51  decorateWithMPtPhi(ttbarPartonHistory, "MC_ttbar_afterFSR", temp);
52  fillEtaBranch(ttbarPartonHistory, "MC_ttbar_afterFSR_eta", temp);
53  }//if
54  if (event_top) {
55  decorateWithMPtPhi(ttbarPartonHistory, "MC_t_beforeFSR", t_before);
56  fillEtaBranch(ttbarPartonHistory, "MC_t_beforeFSR_eta", t_before);
57 
58  decorateWithMPtPhi(ttbarPartonHistory, "MC_t_afterFSR", t_after);
59  fillEtaBranch(ttbarPartonHistory, "MC_t_afterFSR_eta", t_after);
60 
61  if (event_top_SC) {
62  decorateWithMPtPhi(ttbarPartonHistory, "MC_t_afterFSR_SC", t_after_SC);
63  fillEtaBranch(ttbarPartonHistory, "MC_t_afterFSR_SC_eta", t_after_SC);
64  }
65  decorateWithMPtPhi(ttbarPartonHistory, "MC_W_from_t", Wp);
66  fillEtaBranch(ttbarPartonHistory, "MC_W_from_t_eta", Wp);
67 
68  decorateWithMPtPhi(ttbarPartonHistory, "MC_b_from_t", b);
69  fillEtaBranch(ttbarPartonHistory, "MC_b_from_t_eta", b);
70 
71  decorateWithMPtPhi(ttbarPartonHistory, "MC_Wdecay1_from_t", WpDecay1);
72  ttbarPartonHistory->auxdecor< int >("MC_Wdecay1_from_t_pdgId") = WpDecay1_pdgId;
73  fillEtaBranch(ttbarPartonHistory, "MC_Wdecay1_from_t_eta", WpDecay1);
74 
75  decorateWithMPtPhi(ttbarPartonHistory, "MC_Wdecay2_from_t", WpDecay2);
76  ttbarPartonHistory->auxdecor< int >("MC_Wdecay2_from_t_pdgId") = WpDecay2_pdgId;
77  fillEtaBranch(ttbarPartonHistory, "MC_Wdecay2_from_t_eta", WpDecay2);
78  }//if
79  if (event_topbar) {
80  decorateWithMPtPhi(ttbarPartonHistory, "MC_tbar_beforeFSR", tbar_before);
81  fillEtaBranch(ttbarPartonHistory, "MC_tbar_beforeFSR_eta", tbar_before);
82 
83  decorateWithMPtPhi(ttbarPartonHistory, "MC_tbar_afterFSR", tbar_after);
84  fillEtaBranch(ttbarPartonHistory, "MC_tbar_afterFSR_eta", tbar_after);
85 
86  if (event_topbar_SC) {
87  decorateWithMPtPhi(ttbarPartonHistory, "MC_tbar_afterFSR_SC", tbar_after_SC);
88  fillEtaBranch(ttbarPartonHistory, "MC_tbar_afterFSR_SC_eta", tbar_after_SC);
89  }
90 
91  decorateWithMPtPhi(ttbarPartonHistory, "MC_W_from_tbar", Wm);
92  fillEtaBranch(ttbarPartonHistory, "MC_W_from_tbar_eta", Wm);
93 
94  decorateWithMPtPhi(ttbarPartonHistory, "MC_b_from_tbar", bbar);
95  fillEtaBranch(ttbarPartonHistory, "MC_b_from_tbar_eta", bbar);
96 
97  decorateWithMPtPhi(ttbarPartonHistory, "MC_Wdecay1_from_tbar", WmDecay1);
98  ttbarPartonHistory->auxdecor< int >("MC_Wdecay1_from_tbar_pdgId") = WmDecay1_pdgId;
99  fillEtaBranch(ttbarPartonHistory, "MC_Wdecay1_from_tbar_eta", WmDecay1);
100 
101  decorateWithMPtPhi(ttbarPartonHistory, "MC_Wdecay2_from_tbar", WmDecay2);
102  ttbarPartonHistory->auxdecor< int >("MC_Wdecay2_from_tbar_pdgId") = WmDecay2_pdgId;
103  fillEtaBranch(ttbarPartonHistory, "MC_Wdecay2_from_tbar_eta", WmDecay2);
104  }//if
105  }

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

◆ Wlv()

bool top::CalcTopPartonHistory::Wlv ( const xAOD::TruthParticleContainer truthParticles,
TLorentzVector &  W_p4,
TLorentzVector &  Wdecay1_p4,
int &  Wdecay1_pdgId,
TLorentzVector &  Wdecay2_p4,
int &  Wdecay2_pdgId 
)
inherited

Store the four-momentum of several particles in the W decay chain.

Definition at line 305 of file CalcTopPartonHistory.cxx.

308  {
309  bool hasW = false;
310  bool hasWdecayProd1 = false;
311  bool hasWdecayProd2 = false;
312 
313  for (const xAOD::TruthParticle* particle : *truthParticles) {
314  if (abs(particle->pdgId()) != 24) continue;
315  //std::cout << "PDGID: " << particle->pdgId() << std::endl;
316 
317  // demanding the last W after FSR
319  W_p4 = particle->p4(); // W boson after FSR
320  hasW = true;
321 
322  for (size_t k = 0; k < particle->nChildren(); k++) {
323  const xAOD::TruthParticle* WChildren = particle->child(k);
324  if (abs(WChildren->pdgId()) < 17) {
325  if (WChildren->pdgId() % 2 == 1) { // charged lepton in the Wlv case
326  Wdecay1_p4 = WChildren->p4();
327  Wdecay1_pdgId = WChildren->pdgId();
328  hasWdecayProd1 = true;
329  } else {// neutral lepton in the Wlv case
330  Wdecay2_p4 = WChildren->p4();
331  Wdecay2_pdgId = WChildren->pdgId();
332  hasWdecayProd2 = true;
333  }//else
334  }//if
335  } //for (size_t k=0; k < particle->nChildren(); k++)
336 
337  if (hasW && hasWdecayProd1 && hasWdecayProd2) return true;
338  } //for (const xAOD::TruthParticle* particle : *truthParticles)
339 
340 
341  return false;
342  }

◆ Wt_b()

bool top::CalcTopPartonHistory::Wt_b ( const xAOD::TruthParticleContainer truthParticles,
TLorentzVector &  b_beforeFSR,
TLorentzVector &  b_afterFSR,
int &  b_pdgId 
)
inherited

Store the four-momentum of b quark that is NOT from top in Wt(b) ST events.

Definition at line 403 of file CalcTopPartonHistory.cxx.

405  {
406  bool hasB = false;
407 
408  // identify "other" b quark that is not from radiation but from ME (Wtb)
409  // logic is simple: search for b quark that doesn't have top, proton, or
410  // nullptr as parent
411 
412  for (const xAOD::TruthParticle* particle : *truthParticles) {
413  if (particle == nullptr) continue;
414  if (abs(particle->pdgId()) != 5) continue;
415 
416  for (size_t iparent = 0; iparent < particle->nParents(); ++iparent) {
417  if (particle->parent(iparent) == nullptr) continue;
418 
419  // we dont want b-quarks that have b as parent
420  if (abs(particle->parent(iparent)->pdgId()) == 5) continue;
421 
422  // we dont want b-quarks that come from top
423  if (abs(particle->parent(iparent)->pdgId()) == 6) continue;
424 
425  // we dont want b-quarks that come from W
426  if (abs(particle->parent(iparent)->pdgId()) == 24) continue;
427 
428  // we dont want b-quarks that come from proton
429  if (abs(particle->parent(iparent)->pdgId()) == 2212) continue;
430 
431  hasB = true;
432  b_beforeFSR = particle->p4();
433  b_pdgId = particle->pdgId();
434 
435  // find after FSR
437  b_afterFSR = particle->p4();
438  }
439  }
440 
441 
442  if (hasB) return true;
443 
444  return false;
445  }

◆ Wt_W()

bool top::CalcTopPartonHistory::Wt_W ( const xAOD::TruthParticleContainer truthParticles,
TLorentzVector &  W_p4,
int &  W_pdgId,
TLorentzVector &  Wdecay1_p4,
int &  Wdecay1_pdgId,
TLorentzVector &  Wdecay2_p4,
int &  Wdecay2_pdgId 
)
inherited

Store the four-momentum of several particles in W decay chain for W that is NOT from top in Wt ST events.

Definition at line 345 of file CalcTopPartonHistory.cxx.

347  {
348  bool hasW = false;
349  bool hasWdecayProd1 = false;
350  bool hasWdecayProd2 = false;
351 
352  for (const xAOD::TruthParticle* particle : *truthParticles) {
353  if (particle == nullptr) continue;
354  if (abs(particle->pdgId()) != 24) continue; // W boson
355 
356  // need to check if the W is from top
357  // identify the first in chain and check
358  // if that particle has top as parent
359  if (PartonHistoryUtils::hasParticleIdenticalParent(particle)) continue; // kepping only W before FSR
360 
361  bool isFromTop = false;
362  // now we should have only the first W in chain
363  for (size_t iparent = 0; iparent < particle->nParents(); ++iparent) {
364  if (particle->parent(iparent) == nullptr) continue;
365  if (abs(particle->parent(iparent)->pdgId()) == 6) { // has top as parent
366  isFromTop = true;
367  break;
368  }
369  }
370 
371  if (isFromTop) continue;
372  else {
374  W_p4 = particle->p4();
375  W_pdgId = particle->pdgId();
376  hasW = true;
377  }
378 
379  // check the decay products of the W
380  for (size_t q = 0; q < particle->nChildren(); ++q) {
381  const xAOD::TruthParticle* WChildren = particle->child(q);
382  if (WChildren == nullptr) continue;
383  if (abs(WChildren->pdgId()) < 17) {
384  if (WChildren->pdgId() > 0) {
385  Wdecay1_p4 = WChildren->p4();
386  Wdecay1_pdgId = WChildren->pdgId();
387  hasWdecayProd1 = true;
388  } else {
389  Wdecay2_p4 = WChildren->p4();
390  Wdecay2_pdgId = WChildren->pdgId();
391  hasWdecayProd2 = true;
392  }//else
393  }//if
394  }//for
395 
396  if (hasW && hasWdecayProd1 && hasWdecayProd2) return true;
397  } // loop over truth particles
398 
399  return false;
400  }

Member Data Documentation

◆ m_config

std::shared_ptr<top::TopConfig> top::CalcTopPartonHistory::m_config
protectedinherited

Definition at line 87 of file CalcTopPartonHistory.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_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:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
xAOD::PartonHistory
Interface class.
Definition: PartonHistory.h:48
top::CalcTopPartonHistory::buildContainerFromMultipleCollections
StatusCode buildContainerFromMultipleCollections(const std::vector< std::string > &collections, const std::string &out_contName)
used to build container from multiple collections in DAOD_PHYS we don't have the TruthParticles colle...
Definition: CalcTopPartonHistory.cxx:21
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
top
TopConfig A simple configuration that is NOT a singleton.
Definition: AnalysisTrackingHelper.cxx:58
top::CalcTopPartonHistory::linkBosonCollections
StatusCode linkBosonCollections()
currently in DAOD_PHYS TruthTop have links to Ws from the TruthBoson collection, which have no link t...
Definition: CalcTopPartonHistory.cxx:39
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
top::CalcTopPartonHistory::getTruthParticleLinkedFromDecoration
const xAOD::TruthParticle * getTruthParticleLinkedFromDecoration(const xAOD::TruthParticle *part, const std::string &decorationName)
helper method to handle retriveing the truth particle linked in the decoration of another particle
Definition: CalcTopPartonHistory.cxx:69
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
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::AuxElement::auxdecor
Decorator< T, ALLOC >::reference_type auxdecor(const std::string &name) const
Fetch an aux decoration, as a non-const reference.
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
top::CalcTopPartonHistory::m_config
std::shared_ptr< top::TopConfig > m_config
Definition: CalcTopPartonHistory.h:87
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
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
top::CalcTopPartonHistory::b
bool b(const xAOD::TruthParticleContainer *truthParticles, TLorentzVector &b_beforeFSR, TLorentzVector &b_afterFSR)
Store the four-momentum of b (not from tops_ before and after FSR.
Definition: CalcTopPartonHistory.cxx:156
top::PartonHistoryUtils::findAfterFSR
const xAOD::TruthParticle * findAfterFSR(const xAOD::TruthParticle *particle)
Return particle after FSR (before the decay vertex)
Definition: PartonHistoryUtils.cxx:8
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:41
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:113
test_pyathena.parent
parent
Definition: test_pyathena.py:15
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
top::CalcTopPartonHistory::topAfterFSR_SC
bool topAfterFSR_SC(const xAOD::TruthParticleContainer *truthParticles, int start, TLorentzVector &top_afterFSR_SC_p4)
Store the four-momentum of the post-FSR top or anti-top found using statusCodes This would only work ...
Definition: CalcTopPartonHistory.cxx:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
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
xAOD::PartonHistory::IniVarTtbar
void IniVarTtbar()
Definition: PartonHistory.cxx:21
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:41
xAOD::TruthParticle_v1::nChildren
size_t nChildren() const
Number of children of this particle.
Definition: TruthParticle_v1.cxx:140
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
top::CalcTopPartonHistory::CalcTopPartonHistory
CalcTopPartonHistory(const std::string &name)
Definition: CalcTopPartonHistory.cxx:15
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
xAOD::photon
@ photon
Definition: TrackingPrimitives.h:199
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::PartonHistoryAuxContainer
Aux Container.
Definition: PartonHistory.h:41
top::CalcTtbarPartonHistory::ttbarHistorySaver
void ttbarHistorySaver(const xAOD::TruthParticleContainer *truthParticles, xAOD::PartonHistory *ttbarPartonHistory)
Definition: CalcTtbarPartonHistory.cxx:13
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
xAOD::EgammaHelpers::isPhoton
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Definition: EgammaxAODHelpers.cxx:22
xAOD::TruthParticle_v1::child
const TruthParticle_v1 * child(size_t i=0) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
Definition: TruthParticle_v1.cxx:149
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
top::CalcTopPartonHistory::decorateCollectionWithLinksToAnotherCollection
StatusCode decorateCollectionWithLinksToAnotherCollection(const std::string &collectionToDecorate, const std::string &collectionToLink, const std::string &nameOfDecoration)
helper method currently used in DAOD_PHYS to link particles from a given collection to the same parti...
Definition: CalcTopPartonHistory.cxx:44
extractSporadic.q
list q
Definition: extractSporadic.py:98
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
top::CalcTopPartonHistory::topWb
bool topWb(const xAOD::TruthParticleContainer *truthParticles, int start, TLorentzVector &t_beforeFSR_p4, TLorentzVector &t_afterFSR_p4, TLorentzVector &W_p4, TLorentzVector &b_p4, TLorentzVector &Wdecay1_p4, int &Wdecay1_pdgId, TLorentzVector &Wdecay2_p4, int &Wdecay2_pdgId)
Store the four-momentum of several particles in the top decay chain.
Definition: CalcTopPartonHistory.cxx:182
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::TruthParticle_v1::p4
virtual FourMom_t p4() const override final
The full 4-momentum of the particle.
Definition: TruthParticle_v1.cxx:196
top::CalcTopPartonHistory::fillEtaBranch
void fillEtaBranch(xAOD::PartonHistory *partonHistory, std::string branchName, TLorentzVector &tlv)
Definition: CalcTopPartonHistory.cxx:692
xAOD::TruthParticle_v1::pdgId
int pdgId() const
PDG ID code.
SG::DataProxy
Definition: DataProxy.h:44
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
top::PartonHistoryUtils::hasParticleIdenticalParent
bool hasParticleIdenticalParent(const xAOD::TruthParticle *particle)
Return true when particle is a top before FSR.
Definition: PartonHistoryUtils.cxx:28
top::PartonHistoryUtils::decorateWithMPtPhi
void decorateWithMPtPhi(xAOD::PartonHistory *pHistory, const std::string &prefix, const TLorentzVector &vec)
Perform decoration M, Pt, Phi of the history from a TLorentzVector.
Definition: PartonHistoryUtils.cxx:187
fitman.k
k
Definition: fitman.py:528