ATLAS Offline Software
Loading...
Searching...
No Matches
CP::CalcPartonHistory Class Reference

#include <CalcPartonHistory.h>

Inheritance diagram for CP::CalcPartonHistory:
Collaboration diagram for CP::CalcPartonHistory:

Public Member Functions

 CalcPartonHistory (const std::string &name, const std::vector< std::string > &truthCollections={"TruthTop"})
virtual ~CalcPartonHistory ()
 CalcPartonHistory (const CalcPartonHistory &rhs)=delete
 CalcPartonHistory (CalcPartonHistory &&rhs)=delete
CalcPartonHistoryoperator= (const CalcPartonHistory &rhs)=delete
void AddToParticleMap (const xAOD::TruthParticle *particle, const std::string &key)
bool ExistsInMap (const std::string &key) const
bool ExistsInKey (const std::string &key, const xAOD::TruthParticle *particle) const
bool Retrievep4 (const std::string &key, PtEtaPhiMVector &p4)
bool Retrievep4 (const std::string &key, PtEtaPhiMVector &p4, const int &idx)
bool Retrievep4Gamma (PtEtaPhiMVector &p4, int &parentpdgId)
bool RetrievepdgId (const std::string &key, std::vector< int > &pdgIds)
bool RetrievepdgId (const std::string &key, int &pdgId)
bool RetrievepdgId (const std::string &key, int &pdgId, const int &idx)
bool RetrieveParticleInfo (const std::string &prefix, std::vector< const xAOD::TruthParticle * > &particles)
bool RetrieveParticleInfo (const std::string &prefix, PtEtaPhiMVector &particle, int &pdgId)
bool RetrieveParticleInfo (const std::string &prefix, PtEtaPhiMVector &particle, int &pdgId, const int &idx)
bool RetrieveParticleInfo (const std::string &prefix, const std::string &alt_prefix, PtEtaPhiMVector &particle, int &pdgId)
bool RetrieveParticleInfo (const std::string &prefix, std::vector< PtEtaPhiMVector > &particles, std::vector< int > &pdgIds)
void Initialize4TopDecorators ()
void InitializeTopDecorators ()
void InitializeAntiTopDecorators ()
void InitializeBottomDecorators ()
void InitializeVectorBottomDecorators ()
void InitializeAntiBottomDecorators ()
void InitializeVectorAntiBottomDecorators ()
void InitializeCharmDecorators ()
void InitializeVectorCharmDecorators ()
void InitializeAntiCharmDecorators ()
void InitializeVectorAntiCharmDecorators ()
void InitializeTtbarDecorators ()
void InitializeHiggsDecorators ()
void InitializePhotonDecorators ()
void InitializeZDecorators (int nZs=1, bool extend=false)
void InitializeWDecorators (int nWs=1)
std::string GetParticleType (const xAOD::TruthParticle *particle)
void TraceParticle (const xAOD::TruthParticle *particle, std::vector< const xAOD::TruthParticle * > &currentPath, std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
void TraceParticles (const xAOD::TruthParticleContainer *truthParticles)
bool handleFSR (const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
bool handleDecay (const xAOD::TruthParticle *particle, std::string &key, int decayID)
void handleSameAsParent (const xAOD::TruthParticle *particle, std::string &key)
void handleDefault (const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
void FillParticleMap (std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
void FillGenericPartonHistory (const std::string &retrievalstring, const std::string &decorationstring, const int idx)
void FillGenericPartonHistory (const std::vector< std::string > &retrievalStrings, const std::string &decorationstring, const int idx)
void FillGenericPartonHistory (const std::vector< std::string > &retrievalStrings, const std::string &decorationstring)
void FillGenericVectorPartonHistory (const std::string &retrievalstring, const std::string &decorationstring)
void FillGammaPartonHistory (const std::string &parent)
void FillZPartonHistory (const std::string &parent, int nZs=1, const std::string &mode="resonant")
void FillZtautauPartonHistory (const std::string &parent, int nZs=1, const std::string &mode="resonant")
void FillWPartonHistory (const std::string &parent, int nWs=1, const std::string &mode="resonant")
void FillTopPartonHistory ()
void FillAntiTopPartonHistory ()
void FillHiggsPartonHistory (const std::string &mode)
void FillTtbarPartonHistory ()
void setHiggs (const std::string &fsr)
void setW (const std::string &fsr, int nWs)
bool getW (const std::string &str_lep, const std::string &str_nu, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)
void setZ (const std::string &fsr, int nZs)
void setZtautau (const std::string &fsr, int nZs)
bool getZ (const std::string &str_lep1, const std::string &str_lep2, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)
bool getZFromTaus (const std::string &fsr, PtEtaPhiMVector &Zdecay1, int &Zdecay1_pdgId, PtEtaPhiMVector &Zdecay2, int &Zdecay2_pdgId, PtEtaPhiMVector &Zdecay1_decay1, int &Zdecay1_decay1_pdgId, PtEtaPhiMVector &Zdecay1_decay2, int &Zdecay1_decay2_pdgId, PtEtaPhiMVector &Zdecay1_decay3, int &Zdecay1_decay3_pdgId, PtEtaPhiMVector &Zdecay2_decay1, int &Zdecay2_decay1_pdgId, PtEtaPhiMVector &Zdecay2_decay2, int &Zdecay2_decay2_pdgId, PtEtaPhiMVector &Zdecay2_decay3, int &Zdecay2_decay3_pdgId)
void configure (const PartonSchemeConfig &config)
virtual StatusCode initialize () override
 Dummy implementation of the initialisation function.
virtual StatusCode execute ()
virtual void print () const
 Print the state of the tool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
Additional helper functions, not directly mimicking Athena
template<class T>
const T * getProperty (const std::string &name) const
 Get one of the tool's properties.
const std::string & msg_level_name () const __attribute__((deprecated))
 A deprecated function for getting the message level's name.
const std::string & getName (const void *ptr) const
 Get the name of an object that is / should be in the event store.
SG::sgkey_t getKey (const void *ptr) const
 Get the (hashed) key of an object that is in the event store.

Protected Member Functions

virtual StatusCode linkTruthContainers (const xAOD::TruthParticleContainer *&tp)
virtual StatusCode runHistorySaver (const xAOD::TruthParticleContainer *truthParticles, const xAOD::EventInfo *ttbarPartonHistory)
virtual void initializeDecorators ()
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
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.
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
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
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.

Protected Attributes

std::map< std::string, std::vector< const xAOD::TruthParticle * > > m_particleMap
PartonDecorator m_dec
const std::vector< std::string > m_truthCollections
std::string m_prefix
 prefix applied to all decorator and m_particleMap names
PartonSchemeConfig m_config
 scheme configuration set via configure()
bool m_configured = false
 true after configure() has been called

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...
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 26 of file CalcPartonHistory.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

◆ CalcPartonHistory() [1/3]

CP::CalcPartonHistory::CalcPartonHistory ( const std::string & name,
const std::vector< std::string > & truthCollections = {"TruthTop"} )
explicit

Definition at line 36 of file CalcPartonHistory.cxx.

38 : asg::AsgTool(name), m_truthCollections(truthCollection) {
39 declareProperty("prefix", m_prefix = "",
40 "Prefix to apply to all names to avoid overwriting");
41}
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const std::vector< std::string > m_truthCollections
std::string m_prefix
prefix applied to all decorator and m_particleMap names

◆ ~CalcPartonHistory()

virtual CP::CalcPartonHistory::~CalcPartonHistory ( )
inlinevirtual

Definition at line 32 of file CalcPartonHistory.h.

32{};

◆ CalcPartonHistory() [2/3]

CP::CalcPartonHistory::CalcPartonHistory ( const CalcPartonHistory & rhs)
delete

◆ CalcPartonHistory() [3/3]

CP::CalcPartonHistory::CalcPartonHistory ( CalcPartonHistory && rhs)
delete

Member Function Documentation

◆ AddToParticleMap()

void CP::CalcPartonHistory::AddToParticleMap ( const xAOD::TruthParticle * particle,
const std::string & key )

Definition at line 248 of file CalcPartonHistory.cxx.

249 {
250 if (!ExistsInKey(key, p))
251 m_particleMap[key].push_back(p);
252}
bool ExistsInKey(const std::string &key, const xAOD::TruthParticle *particle) const
std::map< std::string, std::vector< const xAOD::TruthParticle * > > m_particleMap

◆ buildContainerFromMultipleCollections()

StatusCode CP::CalcPartonHistory::buildContainerFromMultipleCollections ( const std::vector< std::string > & collections,
const std::string & out_contName )
protected

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 409 of file CalcPartonHistory.cxx.

411 {
412 // In DAOD_PHYS there is no single TruthParticles collection, so we merge
413 // several dedicated collections (e.g. TruthTop,
414 // TruthBosonsWithDecayParticles) into one working container stored in the
415 // event store.
416 //
417 // The merge must avoid double-counting: the same particle can appear in
418 // multiple collections (e.g. the b from a top appears in both TruthTop and
419 // TruthBottom). We therefore keep only "root" particles — those that are not
420 // a descendant of any other candidate in the merged pool. TraceParticles then
421 // walks down from these roots, naturally visiting all descendants regardless
422 // of which original collection they came from.
423 ConstDataVector<DataVector<xAOD::TruthParticle_v1>>* out_cont =
424 new ConstDataVector<DataVector<xAOD::TruthParticle_v1>>(
426 std::vector<const xAOD::TruthParticle*> p_candidates;
427 std::vector<const xAOD::TruthParticle*> p_parents;
428
429 for (const std::string& collection : collections) {
430 const xAOD::TruthParticleContainer* cont = nullptr;
431 ANA_CHECK(evtStore()->retrieve(cont, collection));
432 p_candidates.insert(p_candidates.end(), cont->begin(), cont->end());
433 }
434 // Retain only particles that have no ancestor among the other candidates.
435 for (const xAOD::TruthParticle* potential_parent : p_candidates) {
436 if (PartonHistoryUtils::isQuarkFromPDF(potential_parent)) {
437 continue;
438 }
439
440 if (std::none_of(p_candidates.begin(), p_candidates.end(),
441 [&](const xAOD::TruthParticle* other_candidate) {
442 return other_candidate != potential_parent &&
443 !PartonHistoryUtils::isQuarkFromPDF(
444 other_candidate) &&
445 PartonHistoryUtils::isChildOf(other_candidate,
446
447 potential_parent);
448 }))
449 p_parents.push_back(potential_parent);
450 }
451 out_cont->insert(out_cont->end(), p_parents.begin(), p_parents.end());
452 StatusCode save = TDS()->record(out_cont, out_contName);
453 if (!save)
454 return StatusCode::FAILURE;
455 return StatusCode::SUCCESS;
456}
#define TDS()
#define ANA_CHECK(EXP)
check whether the given expression was successful
ServiceHandle< StoreGateSvc > & evtStore()
iterator end() noexcept
Return an iterator pointing past the end of the collection.
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
bool isQuarkFromPDF(const xAOD::TruthParticle *particle)
::StatusCode StatusCode
StatusCode definition for legacy code.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
save(self, fileName="./columbo.out")
Definition checkTP.py:176
TruthParticle_v1 TruthParticle
Typedef to implementation.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.

◆ configure()

void CP::CalcPartonHistory::configure ( const PartonSchemeConfig & config)

Definition at line 510 of file CalcPartonHistory.cxx.

510 {
512 m_configured = true;
513}
bool m_configured
true after configure() has been called
PartonSchemeConfig m_config
scheme configuration set via configure()

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ decorateCollectionWithLinksToAnotherCollection()

StatusCode CP::CalcPartonHistory::decorateCollectionWithLinksToAnotherCollection ( const std::string & collectionToDecorate,
const std::string & collectionToLink,
const std::string & nameOfDecoration )
private

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 464 of file CalcPartonHistory.cxx.

466 {
467 const SG::Decorator<const xAOD::TruthParticle*> dec(nameOfDecoration);
468 const xAOD::TruthParticleContainer* cont1 = nullptr;
469 const xAOD::TruthParticleContainer* cont2 = nullptr;
470 ANA_CHECK(evtStore()->retrieve(cont1, collectionToDecorate));
471 ANA_CHECK(evtStore()->retrieve(cont2, collectionToLink));
472 for (const auto* p : *cont1) {
473 const xAOD::TruthParticle* link = nullptr;
474 for (const auto* q : *cont2) {
475 if (p->pdgId() == q->pdgId() && p->uid() == q->uid()) {
476 link = q;
477 break;
478 }
479 }
480 dec(*p) = link;
481 }
482 return StatusCode::SUCCESS;
483}
SG::Decorator< T, ALLOC > Decorator
Helper class to provide type-safe access to aux data, specialized for JaggedVecElt.
Definition AuxElement.h:576
pointer & link(pointer p) const
Return a reference to the link for an element.

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

◆ evtStore()

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.

◆ execute()

StatusCode CP::CalcPartonHistory::execute ( )
virtual

Definition at line 398 of file CalcPartonHistory.cxx.

398 {
399 const xAOD::TruthParticleContainer* truthParticles{nullptr};
400 ANA_CHECK(linkTruthContainers(truthParticles));
401
402 const xAOD::EventInfo* partonHistory = nullptr;
403 ANA_CHECK(evtStore()->retrieve(partonHistory, "EventInfo"));
404
405 ANA_CHECK(runHistorySaver(truthParticles, partonHistory));
406 return StatusCode::SUCCESS;
407}
virtual StatusCode runHistorySaver(const xAOD::TruthParticleContainer *truthParticles, const xAOD::EventInfo *ttbarPartonHistory)
virtual StatusCode linkTruthContainers(const xAOD::TruthParticleContainer *&tp)
EventInfo_v1 EventInfo
Definition of the latest event info version.

◆ ExistsInKey()

bool CP::CalcPartonHistory::ExistsInKey ( const std::string & key,
const xAOD::TruthParticle * particle ) const

Definition at line 48 of file CalcPartonHistory.cxx.

49 {
50 // Checks whether a given particle exists in the vector for the given key.
51 if (const auto* v = findVector(m_particleMap, key)) {
52 return std::find(v->begin(), v->end(), p) != v->end();
53 }
54 return false;
55}

◆ ExistsInMap()

bool CP::CalcPartonHistory::ExistsInMap ( const std::string & key) const

Definition at line 43 of file CalcPartonHistory.cxx.

43 {
44 // Checks whether a given key exists in the particle map.
45 return m_particleMap.find(key) != m_particleMap.end();
46}

◆ 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

◆ FillAntiTopPartonHistory()

void CP::CalcPartonHistory::FillAntiTopPartonHistory ( )

Definition at line 22 of file CalcTopPartonHistory.cxx.

22 {
23 FillGenericPartonHistory("MC_tbar_beforeFSR", "MC_tbar_beforeFSR", 0);
24 FillGenericPartonHistory("MC_tbar_bbar_beforeFSR",
25 "MC_bbar_beforeFSR_from_tbar", 0);
26 FillGenericPartonHistory("MC_tbar_afterFSR", "MC_tbar_afterFSR", 0);
27 FillGenericPartonHistory("MC_tbar_bbar_afterFSR",
28 "MC_bbar_afterFSR_from_tbar", 0);
29 FillWPartonHistory("tbar");
30}
void FillWPartonHistory(const std::string &parent, int nWs=1, const std::string &mode="resonant")
void FillGenericPartonHistory(const std::string &retrievalstring, const std::string &decorationstring, const int idx)

◆ FillGammaPartonHistory()

void CP::CalcPartonHistory::FillGammaPartonHistory ( const std::string & parent)

Definition at line 14 of file CalcPhotonPartonHistory.cxx.

14 {
15 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
16 PtEtaPhiMVector gamma;
17 int gamma_origin = -1;
18
19 m_dec.decorateDefault("MC_gamma" + parentstring);
20 m_dec.decorateCustom("MC_gamma_origin", 0);
21
22 if (Retrievep4Gamma(gamma, gamma_origin))
23 m_dec.decorateParticle("MC_gamma" + parentstring, gamma);
24
25 m_dec.decorateCustom("MC_gamma_origin", gamma_origin);
26}
bool Retrievep4Gamma(PtEtaPhiMVector &p4, int &parentpdgId)

◆ FillGenericPartonHistory() [1/3]

void CP::CalcPartonHistory::FillGenericPartonHistory ( const std::string & retrievalstring,
const std::string & decorationstring,
const int idx )

Definition at line 14 of file CalcGenericPartonHistory.cxx.

16 {
17 PtEtaPhiMVector v;
18 int pdgId = 0;
19 m_dec.decorateDefault(decorationstring);
20 if (RetrieveParticleInfo(m_prefix + "_" + retrievalstring, v, pdgId, idx))
21 m_dec.decorateParticle(decorationstring, v, pdgId);
22}
bool RetrieveParticleInfo(const std::string &prefix, std::vector< const xAOD::TruthParticle * > &particles)

◆ FillGenericPartonHistory() [2/3]

void CP::CalcPartonHistory::FillGenericPartonHistory ( const std::vector< std::string > & retrievalStrings,
const std::string & decorationstring )

Definition at line 38 of file CalcGenericPartonHistory.cxx.

40 {
41 FillGenericPartonHistory(retrievalStrings, decorationstring, 0);
42}

◆ FillGenericPartonHistory() [3/3]

void CP::CalcPartonHistory::FillGenericPartonHistory ( const std::vector< std::string > & retrievalStrings,
const std::string & decorationstring,
const int idx )

Definition at line 24 of file CalcGenericPartonHistory.cxx.

26 {
27 PtEtaPhiMVector v;
28 int pdgId = 0;
29 m_dec.decorateDefault(decorationstring);
30 for (const auto& retrievalString : retrievalStrings) {
31 if (RetrieveParticleInfo(m_prefix + "_" + retrievalString, v, pdgId, idx)) {
32 m_dec.decorateParticle(decorationstring, v, pdgId);
33 break;
34 }
35 }
36}

◆ FillGenericVectorPartonHistory()

void CP::CalcPartonHistory::FillGenericVectorPartonHistory ( const std::string & retrievalstring,
const std::string & decorationstring )

Definition at line 44 of file CalcGenericPartonHistory.cxx.

45 {
46 std::vector<PtEtaPhiMVector> v;
47 std::vector<int> pdgId;
48 m_dec.decorateVectorDefault(decorationstring);
49 if (RetrieveParticleInfo(m_prefix + "_" + retrievalstring, v, pdgId))
50 m_dec.decorateVectorParticle(decorationstring, v, pdgId);
51}

◆ FillHiggsPartonHistory()

void CP::CalcPartonHistory::FillHiggsPartonHistory ( const std::string & mode)

Definition at line 53 of file CalcHiggsPartonHistory.cxx.

53 {
54 PtEtaPhiMVector v;
55 int pdgId = 0;
56
57 // Defaults for all branches regardless of mode.
58 m_dec.decorateDefault("MC_H_beforeFSR");
59 m_dec.decorateDefault("MC_Hdecay1_beforeFSR");
60 m_dec.decorateDefault("MC_Hdecay2_beforeFSR");
61 m_dec.decorateDefault("MC_Hdecay1_decay1_beforeFSR");
62 m_dec.decorateDefault("MC_Hdecay1_decay2_beforeFSR");
63 m_dec.decorateDefault("MC_Hdecay2_decay1_beforeFSR");
64 m_dec.decorateDefault("MC_Hdecay2_decay2_beforeFSR");
65 m_dec.decorateDefault("MC_H_afterFSR");
66 m_dec.decorateDefault("MC_Hdecay1_afterFSR");
67 m_dec.decorateDefault("MC_Hdecay2_afterFSR");
68 m_dec.decorateDefault("MC_Hdecay1_decay1_afterFSR");
69 m_dec.decorateDefault("MC_Hdecay1_decay2_afterFSR");
70 m_dec.decorateDefault("MC_Hdecay2_decay1_afterFSR");
71 m_dec.decorateDefault("MC_Hdecay2_decay2_afterFSR");
72
73 if (mode == "resonant") {
74 // RetrieveParticleInfo uses full m_particleMap keys (with m_prefix).
75 // m_dec.decorateParticle uses bare names.
76 if (RetrieveParticleInfo(m_prefix + "_" + "MC_H_beforeFSR", v, pdgId))
77 m_dec.decorateParticle("MC_H_beforeFSR", v, pdgId);
78 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1_beforeFSR", v, pdgId))
79 m_dec.decorateParticle("MC_Hdecay1_beforeFSR", v, pdgId);
80 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2_beforeFSR", v, pdgId))
81 m_dec.decorateParticle("MC_Hdecay2_beforeFSR", v, pdgId);
82 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1Decay1_beforeFSR", v,
83 pdgId))
84 m_dec.decorateParticle("MC_Hdecay1_decay1_beforeFSR", v, pdgId);
85 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1Decay2_beforeFSR", v,
86 pdgId))
87 m_dec.decorateParticle("MC_Hdecay1_decay2_beforeFSR", v, pdgId);
88 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2Decay1_beforeFSR", v,
89 pdgId))
90 m_dec.decorateParticle("MC_Hdecay2_decay1_beforeFSR", v, pdgId);
91 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2Decay2_beforeFSR", v,
92 pdgId))
93 m_dec.decorateParticle("MC_Hdecay2_decay2_beforeFSR", v, pdgId);
94 if (RetrieveParticleInfo(m_prefix + "_" + "MC_H_afterFSR", v, pdgId))
95 m_dec.decorateParticle("MC_H_afterFSR", v, pdgId);
96 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1_afterFSR", v, pdgId))
97 m_dec.decorateParticle("MC_Hdecay1_afterFSR", v, pdgId);
98 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2_afterFSR", v, pdgId))
99 m_dec.decorateParticle("MC_Hdecay2_afterFSR", v, pdgId);
100 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1Decay1_afterFSR", v,
101 pdgId))
102 m_dec.decorateParticle("MC_Hdecay1_decay1_afterFSR", v, pdgId);
103 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay1Decay2_afterFSR", v,
104 pdgId))
105 m_dec.decorateParticle("MC_Hdecay1_decay2_afterFSR", v, pdgId);
106 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2Decay1_afterFSR", v,
107 pdgId))
108 m_dec.decorateParticle("MC_Hdecay2_decay1_afterFSR", v, pdgId);
109 if (RetrieveParticleInfo(m_prefix + "_" + "MC_HDecay2Decay2_afterFSR", v,
110 pdgId))
111 m_dec.decorateParticle("MC_Hdecay2_decay2_afterFSR", v, pdgId);
112 } else if (mode == "single_top") {
113 // FillGenericPartonHistory retrieval strings are bare suffixes.
115 {"MC_H_beforeFSR", "MC_b_H_beforeFSR", "MC_bbar_H_beforeFSR"},
116 "MC_H_beforeFSR", 0);
117 FillGenericPartonHistory({"MC_HDecay1_beforeFSR", "MC_b_HDecay1_beforeFSR",
118 "MC_bbar_HDecay1_beforeFSR"},
119 "MC_Hdecay1_beforeFSR", 0);
120 FillGenericPartonHistory({"MC_HDecay2_beforeFSR", "MC_b_HDecay2_beforeFSR",
121 "MC_bbar_HDecay2_beforeFSR"},
122 "MC_Hdecay2_beforeFSR", 0);
124 {"MC_HDecay1Decay1_beforeFSR", "MC_b_HDecay1Decay1_beforeFSR",
125 "MC_bbar_HDecay1Decay1_beforeFSR"},
126 "MC_Hdecay1_decay1_beforeFSR", 0);
128 {"MC_HDecay1Decay2_beforeFSR", "MC_b_HDecay1Decay2_beforeFSR",
129 "MC_bbar_HDecay1Decay2_beforeFSR"},
130 "MC_Hdecay1_decay2_beforeFSR", 0);
132 {"MC_HDecay2Decay1_beforeFSR", "MC_b_HDecay2Decay1_beforeFSR",
133 "MC_bbar_HDecay2Decay1_beforeFSR"},
134 "MC_Hdecay2_decay1_beforeFSR", 0);
136 {"MC_HDecay2Decay2_beforeFSR", "MC_b_HDecay2Decay2_beforeFSR",
137 "MC_bbar_HDecay2Decay2_beforeFSR"},
138 "MC_Hdecay2_decay2_beforeFSR", 0);
140 {"MC_H_afterFSR", "MC_b_H_afterFSR", "MC_bbar_H_afterFSR"},
141 "MC_H_afterFSR", 0);
142 FillGenericPartonHistory({"MC_HDecay1_afterFSR", "MC_b_HDecay1_afterFSR",
143 "MC_bbar_HDecay1_afterFSR"},
144 "MC_Hdecay1_afterFSR", 0);
145 FillGenericPartonHistory({"MC_HDecay2_afterFSR", "MC_b_HDecay2_afterFSR",
146 "MC_bbar_HDecay2_afterFSR"},
147 "MC_Hdecay2_afterFSR", 0);
149 {"MC_HDecay1Decay1_afterFSR", "MC_b_HDecay1Decay1_afterFSR",
150 "MC_bbar_HDecay1Decay1_afterFSR"},
151 "MC_Hdecay1_decay1_afterFSR", 0);
153 {"MC_HDecay1Decay2_afterFSR", "MC_b_HDecay1Decay2_afterFSR",
154 "MC_bbar_HDecay1Decay2_afterFSR"},
155 "MC_Hdecay1_decay2_afterFSR", 0);
157 {"MC_HDecay2Decay1_afterFSR", "MC_b_HDecay2Decay1_afterFSR",
158 "MC_bbar_HDecay2Decay1_afterFSR"},
159 "MC_Hdecay2_decay1_afterFSR", 0);
161 {"MC_HDecay2Decay2_afterFSR", "MC_b_HDecay2Decay2_afterFSR",
162 "MC_bbar_HDecay2Decay2_afterFSR"},
163 "MC_Hdecay2_decay2_afterFSR", 0);
164 } else if (mode == "non_resonant_WW") {
165 setHiggs("beforeFSR");
166 setHiggs("afterFSR");
167 }
168}
void setHiggs(const std::string &fsr)

◆ FillParticleMap()

void CP::CalcPartonHistory::FillParticleMap ( std::vector< std::vector< const xAOD::TruthParticle * > > & allPaths)

Definition at line 307 of file CalcPartonHistory.cxx.

308 {
309 // Converts the raw decay paths produced by TraceParticles into the
310 // m_particleMap used by all Retrieve* and Fill* methods.
311 //
312 // Key construction: each path is walked particle by particle, accumulating
313 // a string key of the form
314 // "<prefix>_MC_<type1>_<type2>_..._<beforeFSR|afterFSR>". For example, a b
315 // quark from a top gives "MySch_MC_t_b_beforeFSR". Decay products of W/Z/H
316 // get an additional "Decay<N>" segment to distinguish the two daughters, e.g.
317 // "MySch_MC_t_WDecay1_beforeFSR".
318 //
319 // Handler priority (first match wins for each particle in the path):
320 // handleDecay — daughters of W/Z/H: appends "Decay<N>" and records
321 // beforeFSR/afterFSR handleFSR — the radiating particle itself:
322 // records both before and after FSR copies handleSameAsParent —
323 // intermediate FSR copies (same PDG as parent): stored under current key
324 // handleDefault — all other particles: appends the type suffix and
325 // advances the key
326 m_particleMap.clear();
327 static const SG::Accessor<unsigned int> acc_classification("Classification");
328 static const SG::Accessor<unsigned int> acc_classifierParticleOrigin(
329 "classifierParticleOrigin");
330 static const SG::Accessor<unsigned int> acc_classifierParticleType(
331 "classifierParticleType");
332
333 for (const auto& path : allPaths) {
334 // m_particleMap keys always include the prefix, built once here.
335 std::string key = m_prefix + "_" + "MC";
336
337 for (const auto* p : path) {
338 // beforeFSR: this node has an identical child (it will radiate).
339 // afterFSR: this node's parent has the same PDG ID (it was radiated
340 // from).
341 const bool beforeFSR = PartonHistoryUtils::hasIdenticalChild(p);
342 const bool afterFSR = PartonHistoryUtils::hasParentPdgId(p);
343
344 // Determine which child index this particle is under its parent; used to
345 // label W/Z/H decay daughters as Decay1, Decay2. Falls back to sign of
346 // pdgId (negative → 2) if parent navigation is unavailable.
347 int decayID = (p->pdgId() < 0) ? 2 : 1;
348 if (p->nParents() != 0 && p->parent(0)) {
349 const auto* par = p->parent(0);
350 for (std::size_t i = 0; i < par->nChildren(); ++i) {
351 if (par->child(i) == p) {
352 decayID = static_cast<int>(i) + 1;
353 break;
354 }
355 }
356 }
357
358 const std::string new_key = GetParticleType(p);
359
360 // Skip pure intermediate FSR nodes that are neither the first nor last
361 // in the FSR chain — they carry no additional physics information.
362 if (beforeFSR && afterFSR)
363 continue;
364 if (handleDecay(p, key, decayID))
365 continue;
366 if (handleFSR(p, new_key, key))
367 continue;
369 handleSameAsParent(p, key);
370 continue;
371 }
372 if (!new_key.empty())
373 handleDefault(p, new_key, key);
374 }
375 }
376}
std::string GetParticleType(const xAOD::TruthParticle *particle)
bool handleDecay(const xAOD::TruthParticle *particle, std::string &key, int decayID)
void handleDefault(const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
bool handleFSR(const xAOD::TruthParticle *particle, const std::string &newKey, std::string &key)
void handleSameAsParent(const xAOD::TruthParticle *particle, std::string &key)
bool hasIdenticalChild(const xAOD::TruthParticle *particle)
bool hasParentPdgId(const xAOD::TruthParticle *particle, int PdgId)
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573

◆ FillTopPartonHistory()

void CP::CalcPartonHistory::FillTopPartonHistory ( )

Definition at line 14 of file CalcTopPartonHistory.cxx.

14 {
15 FillGenericPartonHistory("MC_t_beforeFSR", "MC_t_beforeFSR", 0);
16 FillGenericPartonHistory("MC_t_b_beforeFSR", "MC_b_beforeFSR_from_t", 0);
17 FillGenericPartonHistory("MC_t_afterFSR", "MC_t_afterFSR", 0);
18 FillGenericPartonHistory("MC_t_b_afterFSR", "MC_b_afterFSR_from_t", 0);
20}

◆ FillTtbarPartonHistory()

void CP::CalcPartonHistory::FillTtbarPartonHistory ( )

Definition at line 32 of file CalcTopPartonHistory.cxx.

32 {
33 // Assumes FillTopPartonHistory and FillAntiTopPartonHistory have already run.
34 PtEtaPhiMVector ttbar;
35 PtEtaPhiMVector t_beforeFSR, tbar_beforeFSR, t_afterFSR, tbar_afterFSR;
36 PtEtaPhiMVector WpDecay1, WpDecay2, WmDecay1, WmDecay2, b, bbar;
37
38 // m_dec.decorate* takes bare names; Retrievep4 takes full m_particleMap keys.
39 m_dec.decorateDefaultNoPdgId("MC_ttbar_beforeFSR");
40 m_dec.decorateDefaultNoPdgId("MC_ttbar_afterFSR");
41 m_dec.decorateDefaultNoPdgId("MC_ttbar_fromDecay_beforeFSR");
42 m_dec.decorateDefaultNoPdgId("MC_ttbar_fromDecay_afterFSR");
43
44 if (Retrievep4(m_prefix + "_" + "MC_t_beforeFSR", t_beforeFSR) &&
45 Retrievep4(m_prefix + "_" + "MC_tbar_beforeFSR", tbar_beforeFSR)) {
46 ttbar = t_beforeFSR + tbar_beforeFSR;
47 m_dec.decorateParticle("MC_ttbar_beforeFSR", ttbar);
48 }
49
50 if (Retrievep4(m_prefix + "_" + "MC_t_afterFSR", t_afterFSR) &&
51 Retrievep4(m_prefix + "_" + "MC_tbar_afterFSR", tbar_afterFSR)) {
52 ttbar = t_afterFSR + tbar_afterFSR;
53 m_dec.decorateParticle("MC_ttbar_afterFSR", ttbar);
54 }
55
56 if (Retrievep4(m_prefix + "_" + "MC_t_WDecay1_beforeFSR", WpDecay1) &&
57 Retrievep4(m_prefix + "_" + "MC_t_WDecay2_beforeFSR", WpDecay2) &&
58 Retrievep4(m_prefix + "_" + "MC_tbar_WDecay1_beforeFSR", WmDecay1) &&
59 Retrievep4(m_prefix + "_" + "MC_tbar_WDecay2_beforeFSR", WmDecay2) &&
60 Retrievep4(m_prefix + "_" + "MC_t_b_beforeFSR", b) &&
61 Retrievep4(m_prefix + "_" + "MC_tbar_bbar_beforeFSR", bbar)) {
62 ttbar = WpDecay1 + WpDecay2 + WmDecay1 + WmDecay2 + b + bbar;
63 m_dec.decorateParticle("MC_ttbar_fromDecay_beforeFSR", ttbar);
64 }
65
66 if (Retrievep4(m_prefix + "_" + "MC_t_WDecay1_afterFSR", WpDecay1) &&
67 Retrievep4(m_prefix + "_" + "MC_t_WDecay2_afterFSR", WpDecay2) &&
68 Retrievep4(m_prefix + "_" + "MC_tbar_WDecay1_afterFSR", WmDecay1) &&
69 Retrievep4(m_prefix + "_" + "MC_tbar_WDecay2_afterFSR", WmDecay2) &&
70 Retrievep4(m_prefix + "_" + "MC_t_b_afterFSR", b) &&
71 Retrievep4(m_prefix + "_" + "MC_tbar_bbar_afterFSR", bbar)) {
72 ttbar = WpDecay1 + WpDecay2 + WmDecay1 + WmDecay2 + b + bbar;
73 m_dec.decorateParticle("MC_ttbar_fromDecay_afterFSR", ttbar);
74 }
75}
bool Retrievep4(const std::string &key, PtEtaPhiMVector &p4)

◆ FillWPartonHistory()

void CP::CalcPartonHistory::FillWPartonHistory ( const std::string & parent,
int nWs = 1,
const std::string & mode = "resonant" )

Definition at line 113 of file CalcWPartonHistory.cxx.

114 {
115 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
116 // Bare suffix for FillGenericPartonHistory (it prepends m_prefix + "_"
117 // internally).
118 std::string prefix = "MC_" + (parent.empty() ? "W" : parent + "_W");
119
120 if (mode == "resonant") {
121 if (nWs == 1) {
122 FillGenericPartonHistory(prefix + "_beforeFSR",
123 "MC_W_beforeFSR" + parentstring, 0);
124 FillGenericPartonHistory(prefix + "Decay1_beforeFSR",
125 "MC_Wdecay1_beforeFSR" + parentstring, 0);
126 FillGenericPartonHistory(prefix + "Decay2_beforeFSR",
127 "MC_Wdecay2_beforeFSR" + parentstring, 0);
128 FillGenericPartonHistory(prefix + "_afterFSR",
129 "MC_W_afterFSR" + parentstring, 0);
130 FillGenericPartonHistory(prefix + "Decay1_afterFSR",
131 "MC_Wdecay1_afterFSR" + parentstring, 0);
132 FillGenericPartonHistory(prefix + "Decay2_afterFSR",
133 "MC_Wdecay2_afterFSR" + parentstring, 0);
134 } else {
135 for (int idx = 0; idx < nWs; idx++) {
136 const std::string idxStr = std::to_string(idx + 1);
137 FillGenericPartonHistory(prefix + "_beforeFSR",
138 "MC_W" + idxStr + "_beforeFSR" + parentstring,
139 0);
141 prefix + "Decay1_beforeFSR",
142 "MC_W" + idxStr + "decay1_beforeFSR" + parentstring, 0);
144 prefix + "Decay2_beforeFSR",
145 "MC_W" + idxStr + "decay2_beforeFSR" + parentstring, 0);
146 FillGenericPartonHistory(prefix + "_afterFSR",
147 "MC_W" + idxStr + "_afterFSR" + parentstring,
148 0);
150 prefix + "Decay1_afterFSR",
151 "MC_W" + idxStr + "decay1_afterFSR" + parentstring, 0);
153 prefix + "Decay2_afterFSR",
154 "MC_W" + idxStr + "decay2_afterFSR" + parentstring, 0);
155 }
156 }
157 } else if (mode == "non_resonant") {
158 setW("beforeFSR", nWs);
159 setW("afterFSR", nWs);
160 }
161}
void setW(const std::string &fsr, int nWs)

◆ FillZPartonHistory()

void CP::CalcPartonHistory::FillZPartonHistory ( const std::string & parent,
int nZs = 1,
const std::string & mode = "resonant" )

Definition at line 211 of file CalcZPartonHistory.cxx.

212 {
213 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
214 // mapPrefix: full m_particleMap key base (with m_prefix) — used only for
215 // ExistsInMap.
216 std::string mapPrefix =
217 m_prefix + "_" + "MC_" + (parent.empty() ? "Z" : parent + "_Z");
218 // decPrefix: bare suffix passed to FillGenericPartonHistory as
219 // retrievalstring; FillGenericPartonHistory prepends m_prefix + "_"
220 // internally.
221 std::string decPrefix = "MC_" + (parent.empty() ? "Z" : parent + "_Z");
222
223 if (mode == "resonant") {
224 if (nZs == 1) {
225 if (ExistsInMap(mapPrefix + "_beforeFSR")) {
226 m_dec.decorateCustom("MC_Z_IsOnShell", 1);
227 FillGenericPartonHistory(decPrefix + "_beforeFSR",
228 "MC_Z" + parentstring + "_beforeFSR", 0);
229 FillGenericPartonHistory(decPrefix + "Decay1_beforeFSR",
230 "MC_Zdecay1" + parentstring + "_beforeFSR", 0);
231 FillGenericPartonHistory(decPrefix + "Decay2_beforeFSR",
232 "MC_Zdecay2" + parentstring + "_beforeFSR", 0);
233 FillGenericPartonHistory(decPrefix + "_afterFSR",
234 "MC_Z" + parentstring + "_afterFSR", 0);
235 FillGenericPartonHistory(decPrefix + "Decay1_afterFSR",
236 "MC_Zdecay1" + parentstring + "_afterFSR", 0);
237 FillGenericPartonHistory(decPrefix + "Decay2_afterFSR",
238 "MC_Zdecay2" + parentstring + "_afterFSR", 0);
239 } else {
240 setZ("beforeFSR", nZs);
241 setZ("afterFSR", nZs);
242 }
243 } else {
244 for (int idx = 0; idx < nZs; idx++) {
245 const std::string idxStr = std::to_string(idx + 1);
246 m_dec.decorateCustom("MC_Z" + idxStr + "_IsOnShell", 1);
247 FillGenericPartonHistory(decPrefix + "_beforeFSR",
248 "MC_Z" + idxStr + parentstring + "_beforeFSR",
249 idx);
251 decPrefix + "Decay1_beforeFSR",
252 "MC_Z" + idxStr + "decay1" + parentstring + "_beforeFSR", idx);
254 decPrefix + "Decay2_beforeFSR",
255 "MC_Z" + idxStr + "decay2" + parentstring + "_beforeFSR", idx);
256 FillGenericPartonHistory(decPrefix + "_afterFSR",
257 "MC_Z" + idxStr + parentstring + "_afterFSR",
258 idx);
260 decPrefix + "Decay1_afterFSR",
261 "MC_Z" + idxStr + "decay1" + parentstring + "_afterFSR", idx);
263 decPrefix + "Decay2_afterFSR",
264 "MC_Z" + idxStr + "decay2" + parentstring + "_afterFSR", idx);
265 }
266 }
267 } else if (mode == "non_resonant") {
268 setZ("beforeFSR", nZs);
269 setZ("afterFSR", nZs);
270 }
271}
void setZ(const std::string &fsr, int nZs)
bool ExistsInMap(const std::string &key) const

◆ FillZtautauPartonHistory()

void CP::CalcPartonHistory::FillZtautauPartonHistory ( const std::string & parent,
int nZs = 1,
const std::string & mode = "resonant" )

Definition at line 273 of file CalcZPartonHistory.cxx.

275 {
276 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
277 // mapPrefix: full key for ExistsInMap (used indirectly via
278 // FillZPartonHistory).
279 std::string mapPrefix =
280 m_prefix + "_" + "MC_" + (parent.empty() ? "Z" : parent + "_Z");
281 // decPrefix: bare suffix for FillGenericPartonHistory retrieval strings.
282 std::string decPrefix = "MC_" + (parent.empty() ? "Z" : parent + "_Z");
283
284 FillZPartonHistory(parent, nZs, mode);
285 m_dec.decorateCustom("MC_Z_IsOnShell",
286 0); // default; overwritten to 1 below if resonant
287 if (mode == "resonant") {
288 if (nZs == 1) {
289 m_dec.decorateCustom("MC_Z_IsOnShell", 1);
291 decPrefix + "Decay1_Decay1_beforeFSR",
292 "MC_Zdecay1_decay1" + parentstring + "_beforeFSR", 0);
294 decPrefix + "Decay1_Decay2_beforeFSR",
295 "MC_Zdecay1_decay2" + parentstring + "_beforeFSR", 0);
297 decPrefix + "Decay1_Decay3_beforeFSR",
298 "MC_Zdecay1_decay3" + parentstring + "_beforeFSR", 0);
299 FillGenericPartonHistory(decPrefix + "Decay1_Decay1_afterFSR",
300 "MC_Zdecay1_decay1" + parentstring + "_afterFSR",
301 0);
302 FillGenericPartonHistory(decPrefix + "Decay1_Decay2_afterFSR",
303 "MC_Zdecay1_decay2" + parentstring + "_afterFSR",
304 0);
305 FillGenericPartonHistory(decPrefix + "Decay1_Decay3_afterFSR",
306 "MC_Zdecay1_decay3" + parentstring + "_afterFSR",
307 0);
308 } else {
309 for (int idx = 0; idx < nZs; idx++) {
310 const std::string idxStr = std::to_string(idx + 1);
311 m_dec.decorateCustom("MC_Z" + idxStr + "_IsOnShell", 1);
313 decPrefix + "Decay1_Decay1_beforeFSR",
314 "MC_Z" + idxStr + "decay1_decay1" + parentstring + "_beforeFSR",
315 idx);
317 decPrefix + "Decay1_Decay2_beforeFSR",
318 "MC_Z" + idxStr + "decay1_decay2" + parentstring + "_beforeFSR",
319 idx);
321 decPrefix + "Decay1_Decay3_beforeFSR",
322 "MC_Z" + idxStr + "decay1_decay3" + parentstring + "_beforeFSR",
323 idx);
325 decPrefix + "Decay1_Decay1_afterFSR",
326 "MC_Z" + idxStr + "decay1_decay1" + parentstring + "_afterFSR",
327 idx);
329 decPrefix + "Decay1_Decay2_afterFSR",
330 "MC_Z" + idxStr + "decay1_decay2" + parentstring + "_afterFSR",
331 idx);
333 decPrefix + "Decay1_Decay3_afterFSR",
334 "MC_Z" + idxStr + "decay1_decay3" + parentstring + "_afterFSR",
335 idx);
336 }
337 }
338 } else if (mode == "non_resonant") {
339 setZtautau("beforeFSR", nZs);
340 setZtautau("afterFSR", nZs);
341 }
342}
void FillZPartonHistory(const std::string &parent, int nZs=1, const std::string &mode="resonant")
void setZtautau(const std::string &fsr, int nZs)

◆ 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::Event 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::Event, 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::Event 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::Event, 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 }

◆ GetParticleType()

std::string CP::CalcPartonHistory::GetParticleType ( const xAOD::TruthParticle * particle)

Definition at line 169 of file CalcPartonHistory.cxx.

170 {
171 static const std::unordered_map<int, std::string> pdgMap = {
172 {1, "_q"}, {2, "_q"}, {3, "_q"}, {-1, "_qbar"},
173 {-2, "_qbar"}, {-3, "_qbar"}, {6, "_t"}, {-6, "_tbar"},
174 {5, "_b"}, {-5, "_bbar"}, {4, "_c"}, {-4, "_cbar"},
175 {25, "_H"}, {24, "_W"}, {-24, "_W"}, {23, "_Z"},
176 {22, "_gamma"}, {21, "_g"}, {11, "_l"}, {13, "_l"},
177 {15, "_l"}, {-11, "_lbar"}, {-13, "_lbar"}, {-15, "_lbar"},
178 {12, "_nu"}, {14, "_nu"}, {16, "_nu"}, {-12, "_nubar"},
179 {-14, "_nubar"}, {-16, "_nubar"}, {2212, "_p"}, {1103, "_dd"},
180 {2101, "_ud"}, {2103, "_ud"}, {2203, "_uu"}, {3101, "_sd"},
181 {3103, "_sd"}, {3201, "_su"}, {3203, "_su"}, {3303, "_ss"},
182 {4101, "_cd"}, {4103, "_cd"}, {4201, "_cu"}, {4203, "_cu"},
183 {4301, "_cs"}, {4303, "_cs"}, {4403, "_cc"}, {5101, "_bd"},
184 {5103, "_bd"}, {5201, "_bu"}, {5203, "_bu"}, {5301, "_bs"},
185 {5303, "_bs"}, {5401, "_bc"}, {5403, "_bc"}, {5503, "_bb"}};
186 int pdgId = particle->pdgId();
187 auto it = pdgMap.find(pdgId);
188 return it != pdgMap.end() ? it->second : "_" + std::to_string(pdgId);
189}
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ 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 * CP::CalcPartonHistory::getTruthParticleLinkedFromDecoration ( const xAOD::TruthParticle * part,
const std::string & decorationName )
protected

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

Definition at line 486 of file CalcPartonHistory.cxx.

487 {
489 if (!acc.isAvailable(*part))
490 return part;
491 const xAOD::TruthParticle* link = acc(*part);
492 return link ? link : part;
493}
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.

◆ getW()

bool CP::CalcPartonHistory::getW ( const std::string & str_lep,
const std::string & str_nu,
PtEtaPhiMVector & p1,
int & pdgId1,
PtEtaPhiMVector & p2,
int & pdgId2 )

Definition at line 15 of file CalcWPartonHistory.cxx.

17 {
18 // Off-shell / non-resonant W reconstruction from lepton + neutrino
19 // candidates. Loops over all (lepton, neutrino) pairs and returns the first
20 // pair that passes the three conditions below. The caller is responsible for
21 // passing the correct lepton/neutrino flavour keys (e.g. MC_lbar + MC_nu for
22 // W+).
23 std::vector<const xAOD::TruthParticle*> W_offshell_decay1_candidates;
24 std::vector<const xAOD::TruthParticle*> W_offshell_decay2_candidates;
25 // str_lep/str_nu are full m_particleMap keys (caller passes m_prefix + "_" +
26 // ...)
27 bool has_candidates =
28 (RetrieveParticleInfo(str_lep, W_offshell_decay1_candidates) &&
29 RetrieveParticleInfo(str_nu, W_offshell_decay2_candidates));
30 if (has_candidates) {
31 for (const auto* particle_1 : W_offshell_decay1_candidates) {
32 for (const auto* particle_2 : W_offshell_decay2_candidates) {
33 // Condition 1: Opposite charge — lepton and neutrino must have
34 // opposite-sign pdgIds (e.g. e- has pdgId=11, νe has pdgId=12; product
35 // is positive, so we require the product to be negative for a valid W
36 // decay pair).
37 if ((particle_1->pdgId() * particle_2->pdgId()) > 0)
38 continue;
39 // Condition 2: Same lepton generation — |pdgId| of lepton and neutrino
40 // must differ by exactly 1 (e.g. 11 & 12, 13 & 14, 15 & 16).
41 if (std::abs(particle_1->absPdgId() - particle_2->absPdgId()) != 1)
42 continue;
43 // Condition 3: Reject shower particles — particles produced during
44 // parton showering are assigned UIDs above 10100 by the generator.
45 // We require at least one of the pair to be a hard-scatter particle
46 // (UID ≤ 10100) to avoid picking up shower leptons.
47 if (particle_1->uid() > 10100 && particle_2->uid() > 10100)
48 continue;
49
50 p1 = GetPtEtaPhiMfromTruth(particle_1);
51 pdgId1 = particle_1->pdgId();
52 p2 = GetPtEtaPhiMfromTruth(particle_2);
53 pdgId2 = particle_2->pdgId();
54 return true;
55 }
56 }
57 }
58 return false;
59}
ROOT::Math::PtEtaPhiMVector GetPtEtaPhiMfromTruth(const xAOD::TruthParticle *TruthParticle)

◆ getZ()

bool CP::CalcPartonHistory::getZ ( const std::string & str_lep1,
const std::string & str_lep2,
PtEtaPhiMVector & p1,
int & pdgId1,
PtEtaPhiMVector & p2,
int & pdgId2 )

Definition at line 15 of file CalcZPartonHistory.cxx.

17 {
18 // Off-shell / non-resonant Z reconstruction from two same-flavour
19 // opposite-sign lepton candidates. Uses MCTruthClassifier decorations
20 // (classifierParticleOrigin, classifierParticleType) to restrict to
21 // prompt, isolated leptons from a Z decay, rejecting fakes and non-prompt
22 // background. Only electrons and muons are considered (not taus); for
23 // Z→ττ use getZFromTaus instead.
24 static const SG::Accessor<unsigned int> acc_classifierParticleOrigin(
25 "classifierParticleOrigin");
26 static const SG::Accessor<unsigned int> acc_classifierParticleType(
27 "classifierParticleType");
28 std::vector<const xAOD::TruthParticle*> Z_offshell_decay1_candidates;
29 std::vector<const xAOD::TruthParticle*> Z_offshell_decay2_candidates;
30 // str_lep1/2 are full m_particleMap keys (caller passes m_prefix + "_" + ...)
31 bool has_candidates =
32 (RetrieveParticleInfo(str_lep1, Z_offshell_decay1_candidates) &&
33 RetrieveParticleInfo(str_lep2, Z_offshell_decay2_candidates));
34 if (has_candidates) {
35 const xAOD::TruthParticle* bp1 = nullptr;
36 const xAOD::TruthParticle* bp2 = nullptr;
37 for (const auto* pDecay1 : Z_offshell_decay1_candidates) {
38 for (const auto* pDecay2 : Z_offshell_decay2_candidates) {
39 unsigned int o1 = acc_classifierParticleOrigin(*pDecay1);
40 unsigned int o2 = acc_classifierParticleOrigin(*pDecay2);
41 unsigned int t1 = acc_classifierParticleType(*pDecay1);
42 unsigned int t2 = acc_classifierParticleType(*pDecay2);
43 // Condition 1: Opposite charge — pdgId product must be negative
44 // (e.g. e-=11, e+=−11 → product −121 < 0).
45 if ((pDecay1->pdgId() * pDecay2->pdgId()) > 0)
46 continue;
47 // Condition 2: Same flavour — both leptons must have the same |pdgId|
48 // (e.g. both electrons or both muons).
49 if (pDecay1->absPdgId() != pDecay2->absPdgId())
50 continue;
51 // Condition 3: Origin == 13 (ZBoson) from MCTruthClassifier
52 // (see TruthUtils/TruthClasses.h). Ensures both leptons are
53 // truth-matched to a Z decay and not to backgrounds such as photon
54 // conversions or heavy-flavour semileptonic decays.
55 if (!(o1 == 13 && o2 == 13))
56 continue;
57 // Condition 4: Type == 2 (IsoElectron) or 4 (IsoMuon) from
58 // MCTruthClassifier. Selects prompt isolated leptons, rejecting
59 // non-isolated or non-prompt contributions.
60 if (!((t1 == 2 && t2 == 2) || (t1 == 4 && t2 == 4)))
61 continue;
62 bp1 = pDecay1;
63 bp2 = pDecay2;
64 }
65 }
66 if (bp1 && bp2) {
68 pdgId1 = bp1->pdgId();
70 pdgId2 = bp2->pdgId();
71 return true;
72 }
73 }
74 return false;
75}
int pdgId() const
PDG ID code.
std::vector< ALFA_RawDataContainer_p1 > t2
std::vector< ALFA_RawDataCollection_p1 > t1

◆ getZFromTaus()

bool CP::CalcPartonHistory::getZFromTaus ( const std::string & fsr,
PtEtaPhiMVector & Zdecay1,
int & Zdecay1_pdgId,
PtEtaPhiMVector & Zdecay2,
int & Zdecay2_pdgId,
PtEtaPhiMVector & Zdecay1_decay1,
int & Zdecay1_decay1_pdgId,
PtEtaPhiMVector & Zdecay1_decay2,
int & Zdecay1_decay2_pdgId,
PtEtaPhiMVector & Zdecay1_decay3,
int & Zdecay1_decay3_pdgId,
PtEtaPhiMVector & Zdecay2_decay1,
int & Zdecay2_decay1_pdgId,
PtEtaPhiMVector & Zdecay2_decay2,
int & Zdecay2_decay2_pdgId,
PtEtaPhiMVector & Zdecay2_decay3,
int & Zdecay2_decay3_pdgId )

Definition at line 77 of file CalcZPartonHistory.cxx.

85 {
86
87 std::vector<const xAOD::TruthParticle*> Z_offshell_l_candidates; // tau
88 std::vector<const xAOD::TruthParticle*>
89 Z_offshell_l_l_candidates; // l from tau
90 std::vector<const xAOD::TruthParticle*>
91 Z_offshell_l_nubar_candidates; // anti-nu from tau
92 std::vector<const xAOD::TruthParticle*>
93 Z_offshell_l_nu_candidates; // nu from tau
94 std::vector<const xAOD::TruthParticle*> Z_offshell_lbar_candidates; // taubar
95 std::vector<const xAOD::TruthParticle*>
96 Z_offshell_lbar_lbar_candidates; // lbar from taubar
97 std::vector<const xAOD::TruthParticle*>
98 Z_offshell_lbar_nu_candidates; // nu from taubar
99 std::vector<const xAOD::TruthParticle*>
100 Z_offshell_lbar_nubar_candidates; // anti-nu from taubar
101
102 // All RetrieveParticleInfo calls use full m_particleMap keys (with prefix).
103 bool has_taum_candidates = RetrieveParticleInfo(
104 m_prefix + "_" + "MC_l_" + fsr, Z_offshell_l_candidates);
105 bool has_taum_decay_candidates =
106 (RetrieveParticleInfo(m_prefix + "_" + "MC_l_l_" + fsr,
107 Z_offshell_l_l_candidates) &&
108 RetrieveParticleInfo(m_prefix + "_" + "MC_l_nubar_" + fsr,
109 Z_offshell_l_nubar_candidates) &&
110 RetrieveParticleInfo(m_prefix + "_" + "MC_l_nu_" + fsr,
111 Z_offshell_l_nu_candidates));
112 bool has_taup_candidates = RetrieveParticleInfo(
113 m_prefix + "_" + "MC_lbar_" + fsr, Z_offshell_lbar_candidates);
114 bool has_taup_decay_candidates =
115 (RetrieveParticleInfo(m_prefix + "_" + "MC_lbar_lbar_" + fsr,
116 Z_offshell_lbar_lbar_candidates) &&
117 RetrieveParticleInfo(m_prefix + "_" + "MC_lbar_nu_" + fsr,
118 Z_offshell_lbar_nu_candidates) &&
119 RetrieveParticleInfo(m_prefix + "_" + "MC_lbar_nubar_" + fsr,
120 Z_offshell_lbar_nubar_candidates));
121
122 if (has_taum_candidates) {
123 Zdecay1 = GetPtEtaPhiMfromTruth(Z_offshell_l_candidates.at(0));
124 Zdecay1_pdgId = Z_offshell_l_candidates.at(0)->pdgId();
125 }
126 if (has_taum_decay_candidates) {
127 Zdecay1_decay1 = GetPtEtaPhiMfromTruth(Z_offshell_l_l_candidates.at(0));
128 Zdecay1_decay1_pdgId = Z_offshell_l_l_candidates.at(0)->pdgId();
129 Zdecay1_decay2 = GetPtEtaPhiMfromTruth(Z_offshell_l_nubar_candidates.at(0));
130 Zdecay1_decay2_pdgId = Z_offshell_l_nubar_candidates.at(0)->pdgId();
131 Zdecay1_decay3 = GetPtEtaPhiMfromTruth(Z_offshell_l_nu_candidates.at(0));
132 Zdecay1_decay3_pdgId = Z_offshell_l_nu_candidates.at(0)->pdgId();
133 }
134 if (has_taup_candidates) {
135 Zdecay2 = GetPtEtaPhiMfromTruth(Z_offshell_lbar_candidates.at(0));
136 Zdecay2_pdgId = Z_offshell_lbar_candidates.at(0)->pdgId();
137 }
138 if (has_taup_decay_candidates) {
139 Zdecay2_decay1 =
140 GetPtEtaPhiMfromTruth(Z_offshell_lbar_lbar_candidates.at(0));
141 Zdecay2_decay1_pdgId = Z_offshell_lbar_lbar_candidates.at(0)->pdgId();
142 Zdecay2_decay2 = GetPtEtaPhiMfromTruth(Z_offshell_lbar_nu_candidates.at(0));
143 Zdecay2_decay2_pdgId = Z_offshell_lbar_nu_candidates.at(0)->pdgId();
144 Zdecay2_decay3 =
145 GetPtEtaPhiMfromTruth(Z_offshell_lbar_nubar_candidates.at(0));
146 Zdecay2_decay3_pdgId = Z_offshell_lbar_nubar_candidates.at(0)->pdgId();
147 }
148 return has_taum_candidates && has_taup_candidates;
149}

◆ handleDecay()

bool CP::CalcPartonHistory::handleDecay ( const xAOD::TruthParticle * particle,
std::string & key,
int decayID )

Definition at line 276 of file CalcPartonHistory.cxx.

277 {
278 const bool fromH = PartonHistoryUtils::hasParentAbsPdgId(p, 25) &&
280 const bool fromW = PartonHistoryUtils::hasParentAbsPdgId(p, 24) &&
282 const bool fromZ = PartonHistoryUtils::hasParentAbsPdgId(p, 23) &&
284 if (!fromH && !fromW && !fromZ)
285 return false;
286
287 const std::string decayStr = "Decay" + std::to_string(decayID);
288 key += decayStr;
289 AddToParticleMap(p, key + kBeforeFSR);
291 AddToParticleMap(p, key + kAfterFSR);
292 return true;
293}
void AddToParticleMap(const xAOD::TruthParticle *particle, const std::string &key)
bool hasParentAbsPdgId(const xAOD::TruthParticle *particle, int absPdgId)

◆ handleDefault()

void CP::CalcPartonHistory::handleDefault ( const xAOD::TruthParticle * particle,
const std::string & newKey,
std::string & key )

Definition at line 300 of file CalcPartonHistory.cxx.

302 {
303 AddToParticleMap(particle, key + newKey);
304 key += newKey;
305}

◆ handleFSR()

bool CP::CalcPartonHistory::handleFSR ( const xAOD::TruthParticle * particle,
const std::string & newKey,
std::string & key )

Definition at line 254 of file CalcPartonHistory.cxx.

255 {
257 key += newKey;
258
259 if (p->nParents() == 0) {
260 AddToParticleMap(p, key + kBeforeFSR);
262 AddToParticleMap(p, key + kAfterFSR);
263 return true;
264 }
265
267 AddToParticleMap(p, key + kAfterFSR);
268 } else {
269 AddToParticleMap(p, key + kBeforeFSR);
271 AddToParticleMap(p, key + kAfterFSR);
272 }
273 return true;
274}

◆ handleSameAsParent()

void CP::CalcPartonHistory::handleSameAsParent ( const xAOD::TruthParticle * particle,
std::string & key )

Definition at line 295 of file CalcPartonHistory.cxx.

296 {
297 AddToParticleMap(particle, key);
298}

◆ initialize()

StatusCode CP::CalcPartonHistory::initialize ( void )
overridevirtual

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 from asg::AsgTool.

Definition at line 392 of file CalcPartonHistory.cxx.

392 {
393 m_dec.setPrefix(m_prefix);
395 return StatusCode::SUCCESS;
396}
virtual void initializeDecorators()

◆ Initialize4TopDecorators()

void CP::CalcPartonHistory::Initialize4TopDecorators ( )

Definition at line 11 of file PartonHistoryDecorators.cxx.

11 {
12 for (int idx = 1; idx <= 2; idx++) {
13 m_dec.initializePtEtaPhiMDecorator("MC_t" + std::to_string(idx) +
14 "_beforeFSR");
15 m_dec.initializePtEtaPhiMDecorator("MC_b_beforeFSR_from_t" +
16 std::to_string(idx));
17 m_dec.initializePtEtaPhiMDecorator("MC_W_beforeFSR_from_t" +
18 std::to_string(idx));
19 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_beforeFSR_from_t" +
20 std::to_string(idx));
21 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_beforeFSR_from_t" +
22 std::to_string(idx));
23
24 m_dec.initializePtEtaPhiMDecorator("MC_t" + std::to_string(idx) +
25 "_afterFSR");
26 m_dec.initializePtEtaPhiMDecorator("MC_b_afterFSR_from_t" +
27 std::to_string(idx));
28 m_dec.initializePtEtaPhiMDecorator("MC_W_afterFSR_from_t" +
29 std::to_string(idx));
30 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_afterFSR_from_t" +
31 std::to_string(idx));
32 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_afterFSR_from_t" +
33 std::to_string(idx));
34
35 m_dec.initializePtEtaPhiMDecorator("MC_tbar" + std::to_string(idx) +
36 "_beforeFSR");
37 m_dec.initializePtEtaPhiMDecorator("MC_bbar_beforeFSR_from_tbar" +
38 std::to_string(idx));
39 m_dec.initializePtEtaPhiMDecorator("MC_W_beforeFSR_from_tbar" +
40 std::to_string(idx));
41 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_beforeFSR_from_tbar" +
42 std::to_string(idx));
43 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_beforeFSR_from_tbar" +
44 std::to_string(idx));
45
46 m_dec.initializePtEtaPhiMDecorator("MC_tbar" + std::to_string(idx) +
47 "_afterFSR");
48 m_dec.initializePtEtaPhiMDecorator("MC_bbar_afterFSR_from_tbar" +
49 std::to_string(idx));
50 m_dec.initializePtEtaPhiMDecorator("MC_W_afterFSR_from_tbar" +
51 std::to_string(idx));
52 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_afterFSR_from_tbar" +
53 std::to_string(idx));
54 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_afterFSR_from_tbar" +
55 std::to_string(idx));
56
57 m_dec.initializeIntDecorator("MC_t" + std::to_string(idx) +
58 "_beforeFSR_pdgId");
59 m_dec.initializeIntDecorator("MC_b_beforeFSR_from_t" + std::to_string(idx) +
60 "_pdgId");
61 m_dec.initializeIntDecorator("MC_W_beforeFSR_from_t" + std::to_string(idx) +
62 "_pdgId");
63 m_dec.initializeIntDecorator("MC_Wdecay1_beforeFSR_from_t" +
64 std::to_string(idx) + "_pdgId");
65 m_dec.initializeIntDecorator("MC_Wdecay2_beforeFSR_from_t" +
66 std::to_string(idx) + "_pdgId");
67
68 m_dec.initializeIntDecorator("MC_t" + std::to_string(idx) +
69 "_afterFSR_pdgId");
70 m_dec.initializeIntDecorator("MC_b_afterFSR_from_t" + std::to_string(idx) +
71 "_pdgId");
72 m_dec.initializeIntDecorator("MC_W_afterFSR_from_t" + std::to_string(idx) +
73 "_pdgId");
74 m_dec.initializeIntDecorator("MC_Wdecay1_afterFSR_from_t" +
75 std::to_string(idx) + "_pdgId");
76 m_dec.initializeIntDecorator("MC_Wdecay2_afterFSR_from_t" +
77 std::to_string(idx) + "_pdgId");
78
79 m_dec.initializeIntDecorator("MC_tbar" + std::to_string(idx) +
80 "_beforeFSR_pdgId");
81 m_dec.initializeIntDecorator("MC_bbar_beforeFSR_from_tbar" +
82 std::to_string(idx) + "_pdgId");
83 m_dec.initializeIntDecorator("MC_W_beforeFSR_from_tbar" +
84 std::to_string(idx) + "_pdgId");
85 m_dec.initializeIntDecorator("MC_Wdecay1_beforeFSR_from_tbar" +
86 std::to_string(idx) + "_pdgId");
87 m_dec.initializeIntDecorator("MC_Wdecay2_beforeFSR_from_tbar" +
88 std::to_string(idx) + "_pdgId");
89
90 m_dec.initializeIntDecorator("MC_tbar" + std::to_string(idx) +
91 "_afterFSR_pdgId");
92 m_dec.initializeIntDecorator("MC_bbar_afterFSR_from_tbar" +
93 std::to_string(idx) + "_pdgId");
94 m_dec.initializeIntDecorator("MC_W_afterFSR_from_tbar" +
95 std::to_string(idx) + "_pdgId");
96 m_dec.initializeIntDecorator("MC_Wdecay1_afterFSR_from_tbar" +
97 std::to_string(idx) + "_pdgId");
98 m_dec.initializeIntDecorator("MC_Wdecay2_afterFSR_from_tbar" +
99 std::to_string(idx) + "_pdgId");
100 }
101}

◆ InitializeAntiBottomDecorators()

void CP::CalcPartonHistory::InitializeAntiBottomDecorators ( )

Definition at line 171 of file PartonHistoryDecorators.cxx.

171 {
172 m_dec.initializePtEtaPhiMDecorator("MC_bbar_beforeFSR");
173 m_dec.initializePtEtaPhiMDecorator("MC_bbar_afterFSR");
174
175 m_dec.initializeIntDecorator("MC_bbar_beforeFSR_pdgId");
176 m_dec.initializeIntDecorator("MC_bbar_afterFSR_pdgId");
177}

◆ InitializeAntiCharmDecorators()

void CP::CalcPartonHistory::InitializeAntiCharmDecorators ( )

Definition at line 203 of file PartonHistoryDecorators.cxx.

203 {
204 m_dec.initializePtEtaPhiMDecorator("MC_cbar_beforeFSR");
205 m_dec.initializePtEtaPhiMDecorator("MC_cbar_afterFSR");
206
207 m_dec.initializeIntDecorator("MC_cbar_beforeFSR_pdgId");
208 m_dec.initializeIntDecorator("MC_cbar_afterFSR_pdgId");
209}

◆ InitializeAntiTopDecorators()

void CP::CalcPartonHistory::InitializeAntiTopDecorators ( )

Definition at line 129 of file PartonHistoryDecorators.cxx.

129 {
130 m_dec.initializePtEtaPhiMDecorator("MC_tbar_beforeFSR");
131 m_dec.initializePtEtaPhiMDecorator("MC_bbar_beforeFSR_from_tbar");
132 m_dec.initializePtEtaPhiMDecorator("MC_W_beforeFSR_from_tbar");
133 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_beforeFSR_from_tbar");
134 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_beforeFSR_from_tbar");
135
136 m_dec.initializePtEtaPhiMDecorator("MC_tbar_afterFSR");
137 m_dec.initializePtEtaPhiMDecorator("MC_bbar_afterFSR_from_tbar");
138 m_dec.initializePtEtaPhiMDecorator("MC_W_afterFSR_from_tbar");
139 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_afterFSR_from_tbar");
140 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_afterFSR_from_tbar");
141
142 m_dec.initializeIntDecorator("MC_tbar_beforeFSR_pdgId");
143 m_dec.initializeIntDecorator("MC_bbar_beforeFSR_from_tbar_pdgId");
144 m_dec.initializeIntDecorator("MC_W_beforeFSR_from_tbar_pdgId");
145 m_dec.initializeIntDecorator("MC_Wdecay1_beforeFSR_from_tbar_pdgId");
146 m_dec.initializeIntDecorator("MC_Wdecay2_beforeFSR_from_tbar_pdgId");
147
148 m_dec.initializeIntDecorator("MC_tbar_afterFSR_pdgId");
149 m_dec.initializeIntDecorator("MC_bbar_afterFSR_from_tbar_pdgId");
150 m_dec.initializeIntDecorator("MC_W_afterFSR_from_tbar_pdgId");
151 m_dec.initializeIntDecorator("MC_Wdecay1_afterFSR_from_tbar_pdgId");
152 m_dec.initializeIntDecorator("MC_Wdecay2_afterFSR_from_tbar_pdgId");
153}

◆ InitializeBottomDecorators()

void CP::CalcPartonHistory::InitializeBottomDecorators ( )

Definition at line 155 of file PartonHistoryDecorators.cxx.

155 {
156 m_dec.initializePtEtaPhiMDecorator("MC_b_beforeFSR");
157 m_dec.initializePtEtaPhiMDecorator("MC_b_afterFSR");
158
159 m_dec.initializeIntDecorator("MC_b_beforeFSR_pdgId");
160 m_dec.initializeIntDecorator("MC_b_afterFSR_pdgId");
161}

◆ InitializeCharmDecorators()

void CP::CalcPartonHistory::InitializeCharmDecorators ( )

Definition at line 187 of file PartonHistoryDecorators.cxx.

187 {
188 m_dec.initializePtEtaPhiMDecorator("MC_c_beforeFSR");
189 m_dec.initializePtEtaPhiMDecorator("MC_c_afterFSR");
190
191 m_dec.initializeIntDecorator("MC_c_beforeFSR_pdgId");
192 m_dec.initializeIntDecorator("MC_c_afterFSR_pdgId");
193}

◆ initializeDecorators()

void CP::CalcPartonHistory::initializeDecorators ( )
protectedvirtual

Definition at line 515 of file CalcPartonHistory.cxx.

515 {
516 if (!m_configured)
517 return;
518
519 for (const auto& group : m_config.decoratorGroups) {
520 switch (group) {
523 break;
526 break;
529 break;
532 break;
535 break;
538 break;
541 break;
544 break;
547 break;
550 break;
553 break;
556 break;
559 break;
562 break;
563 }
564 }
565
566 for (const auto& zw : m_config.decoratorZWs) {
567 if (zw.type == DecoratorZW::Z)
568 InitializeZDecorators(zw.count, zw.extended);
569 else
570 InitializeWDecorators(zw.count);
571 }
572
573 for (const auto& fill : m_config.genericFills) {
574 if (fill.isVector) {
575 m_dec.initializeVectorPtEtaPhiMDecorator(fill.decorationKey);
576 m_dec.initializeVectorIntDecorator(fill.decorationKey + "_pdgId");
577 } else {
578 m_dec.initializePtEtaPhiMDecorator(fill.decorationKey);
579 m_dec.initializeIntDecorator(fill.decorationKey + "_pdgId");
580 }
581 }
582}
void InitializeZDecorators(int nZs=1, bool extend=false)
@ FourTop
Initialize4TopDecorators().
@ VectorAntiBottom
InitializeVectorAntiBottomDecorators().
@ VectorAntiCharm
InitializeVectorAntiCharmDecorators().
@ Bottom
InitializeBottomDecorators().
@ Charm
InitializeCharmDecorators().
@ AntiCharm
InitializeAntiCharmDecorators().
@ VectorBottom
InitializeVectorBottomDecorators().
@ Ttbar
InitializeTtbarDecorators().
@ VectorCharm
InitializeVectorCharmDecorators().
@ Higgs
InitializeHiggsDecorators().
@ Top
InitializeTopDecorators().
@ AntiBottom
InitializeAntiBottomDecorators().
@ AntiTop
InitializeAntiTopDecorators().
@ Photon
InitializePhotonDecorators().
void fill(H5::Group &out_file, size_t iterations)

◆ InitializeHiggsDecorators()

void CP::CalcPartonHistory::InitializeHiggsDecorators ( )

Definition at line 241 of file PartonHistoryDecorators.cxx.

241 {
242 m_dec.initializePtEtaPhiMDecorator("MC_H_beforeFSR");
243 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_beforeFSR");
244 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_beforeFSR");
245 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_decay1_beforeFSR");
246 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_decay1_beforeFSR");
247 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_decay2_beforeFSR");
248 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_decay2_beforeFSR");
249
250 m_dec.initializePtEtaPhiMDecorator("MC_H_afterFSR");
251 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_afterFSR");
252 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_afterFSR");
253 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_decay1_afterFSR");
254 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_decay1_afterFSR");
255 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay1_decay2_afterFSR");
256 m_dec.initializePtEtaPhiMDecorator("MC_Hdecay2_decay2_afterFSR");
257
258 m_dec.initializeIntDecorator("MC_H_beforeFSR_pdgId");
259 m_dec.initializeIntDecorator("MC_Hdecay1_beforeFSR_pdgId");
260 m_dec.initializeIntDecorator("MC_Hdecay2_beforeFSR_pdgId");
261 m_dec.initializeIntDecorator("MC_Hdecay1_decay1_beforeFSR_pdgId");
262 m_dec.initializeIntDecorator("MC_Hdecay2_decay1_beforeFSR_pdgId");
263 m_dec.initializeIntDecorator("MC_Hdecay1_decay2_beforeFSR_pdgId");
264 m_dec.initializeIntDecorator("MC_Hdecay2_decay2_beforeFSR_pdgId");
265
266 m_dec.initializeIntDecorator("MC_H_afterFSR_pdgId");
267 m_dec.initializeIntDecorator("MC_Hdecay1_afterFSR_pdgId");
268 m_dec.initializeIntDecorator("MC_Hdecay2_afterFSR_pdgId");
269 m_dec.initializeIntDecorator("MC_Hdecay1_decay1_afterFSR_pdgId");
270 m_dec.initializeIntDecorator("MC_Hdecay2_decay1_afterFSR_pdgId");
271 m_dec.initializeIntDecorator("MC_Hdecay1_decay2_afterFSR_pdgId");
272 m_dec.initializeIntDecorator("MC_Hdecay2_decay2_afterFSR_pdgId");
273}

◆ InitializePhotonDecorators()

void CP::CalcPartonHistory::InitializePhotonDecorators ( )

Definition at line 235 of file PartonHistoryDecorators.cxx.

235 {
236 m_dec.initializePtEtaPhiMDecorator("MC_gamma");
237 m_dec.initializeIntDecorator("MC_gamma_origin");
238 m_dec.initializeIntDecorator("MC_gamma_pdgId");
239}

◆ InitializeTopDecorators()

void CP::CalcPartonHistory::InitializeTopDecorators ( )

Definition at line 103 of file PartonHistoryDecorators.cxx.

103 {
104 m_dec.initializePtEtaPhiMDecorator("MC_t_beforeFSR");
105 m_dec.initializePtEtaPhiMDecorator("MC_b_beforeFSR_from_t");
106 m_dec.initializePtEtaPhiMDecorator("MC_W_beforeFSR_from_t");
107 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_beforeFSR_from_t");
108 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_beforeFSR_from_t");
109
110 m_dec.initializePtEtaPhiMDecorator("MC_t_afterFSR");
111 m_dec.initializePtEtaPhiMDecorator("MC_b_afterFSR_from_t");
112 m_dec.initializePtEtaPhiMDecorator("MC_W_afterFSR_from_t");
113 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay1_afterFSR_from_t");
114 m_dec.initializePtEtaPhiMDecorator("MC_Wdecay2_afterFSR_from_t");
115
116 m_dec.initializeIntDecorator("MC_t_beforeFSR_pdgId");
117 m_dec.initializeIntDecorator("MC_b_beforeFSR_from_t_pdgId");
118 m_dec.initializeIntDecorator("MC_W_beforeFSR_from_t_pdgId");
119 m_dec.initializeIntDecorator("MC_Wdecay1_beforeFSR_from_t_pdgId");
120 m_dec.initializeIntDecorator("MC_Wdecay2_beforeFSR_from_t_pdgId");
121
122 m_dec.initializeIntDecorator("MC_t_afterFSR_pdgId");
123 m_dec.initializeIntDecorator("MC_b_afterFSR_from_t_pdgId");
124 m_dec.initializeIntDecorator("MC_W_afterFSR_from_t_pdgId");
125 m_dec.initializeIntDecorator("MC_Wdecay1_afterFSR_from_t_pdgId");
126 m_dec.initializeIntDecorator("MC_Wdecay2_afterFSR_from_t_pdgId");
127}

◆ InitializeTtbarDecorators()

void CP::CalcPartonHistory::InitializeTtbarDecorators ( )

Definition at line 219 of file PartonHistoryDecorators.cxx.

219 {
220 m_dec.initializeFloatDecorator(
221 {"MC_ttbar_beforeFSR_m", "MC_ttbar_beforeFSR_pt",
222 "MC_ttbar_beforeFSR_eta", "MC_ttbar_beforeFSR_phi"});
223 m_dec.initializeFloatDecorator(
224 {"MC_ttbar_fromDecay_beforeFSR_m", "MC_ttbar_fromDecay_beforeFSR_pt",
225 "MC_ttbar_fromDecay_beforeFSR_eta", "MC_ttbar_fromDecay_beforeFSR_phi"});
226
227 m_dec.initializeFloatDecorator({"MC_ttbar_afterFSR_m", "MC_ttbar_afterFSR_pt",
228 "MC_ttbar_afterFSR_eta",
229 "MC_ttbar_afterFSR_phi"});
230 m_dec.initializeFloatDecorator(
231 {"MC_ttbar_fromDecay_afterFSR_m", "MC_ttbar_fromDecay_afterFSR_pt",
232 "MC_ttbar_fromDecay_afterFSR_eta", "MC_ttbar_fromDecay_afterFSR_phi"});
233}

◆ InitializeVectorAntiBottomDecorators()

void CP::CalcPartonHistory::InitializeVectorAntiBottomDecorators ( )

Definition at line 179 of file PartonHistoryDecorators.cxx.

179 {
180 m_dec.initializeVectorPtEtaPhiMDecorator("MC_bbar_beforeFSR");
181 m_dec.initializeVectorPtEtaPhiMDecorator("MC_bbar_afterFSR");
182
183 m_dec.initializeVectorIntDecorator("MC_bbar_beforeFSR_pdgId");
184 m_dec.initializeVectorIntDecorator("MC_bbar_afterFSR_pdgId");
185}

◆ InitializeVectorAntiCharmDecorators()

void CP::CalcPartonHistory::InitializeVectorAntiCharmDecorators ( )

Definition at line 211 of file PartonHistoryDecorators.cxx.

211 {
212 m_dec.initializeVectorPtEtaPhiMDecorator("MC_cbar_beforeFSR");
213 m_dec.initializeVectorPtEtaPhiMDecorator("MC_cbar_afterFSR");
214
215 m_dec.initializeVectorIntDecorator("MC_cbar_beforeFSR_pdgId");
216 m_dec.initializeVectorIntDecorator("MC_cbar_afterFSR_pdgId");
217}

◆ InitializeVectorBottomDecorators()

void CP::CalcPartonHistory::InitializeVectorBottomDecorators ( )

Definition at line 163 of file PartonHistoryDecorators.cxx.

163 {
164 m_dec.initializeVectorPtEtaPhiMDecorator("MC_b_beforeFSR");
165 m_dec.initializeVectorPtEtaPhiMDecorator("MC_b_afterFSR");
166
167 m_dec.initializeVectorIntDecorator("MC_b_beforeFSR_pdgId");
168 m_dec.initializeVectorIntDecorator("MC_b_afterFSR_pdgId");
169}

◆ InitializeVectorCharmDecorators()

void CP::CalcPartonHistory::InitializeVectorCharmDecorators ( )

Definition at line 195 of file PartonHistoryDecorators.cxx.

195 {
196 m_dec.initializeVectorPtEtaPhiMDecorator("MC_c_beforeFSR");
197 m_dec.initializeVectorPtEtaPhiMDecorator("MC_c_afterFSR");
198
199 m_dec.initializeVectorIntDecorator("MC_c_beforeFSR_pdgId");
200 m_dec.initializeVectorIntDecorator("MC_c_afterFSR_pdgId");
201}

◆ InitializeWDecorators()

void CP::CalcPartonHistory::InitializeWDecorators ( int nWs = 1)

Definition at line 334 of file PartonHistoryDecorators.cxx.

334 {
335 std::vector<std::string> Ws;
336 if (n_Ws == 1)
337 Ws.push_back("W");
338 else {
339 for (int i = 1; i <= n_Ws; i++) {
340 Ws.push_back("W" + std::to_string(i));
341 }
342 }
343 for (auto& W : Ws) {
344 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "_beforeFSR");
345 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "decay1_beforeFSR");
346 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "decay2_beforeFSR");
347
348 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "_afterFSR");
349 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "decay1_afterFSR");
350 m_dec.initializePtEtaPhiMDecorator("MC_" + W + "decay2_afterFSR");
351
352 m_dec.initializeIntDecorator("MC_" + W + "_beforeFSR_pdgId");
353 m_dec.initializeIntDecorator("MC_" + W + "decay1_beforeFSR_pdgId");
354 m_dec.initializeIntDecorator("MC_" + W + "decay2_beforeFSR_pdgId");
355
356 m_dec.initializeIntDecorator("MC_" + W + "_afterFSR_pdgId");
357 m_dec.initializeIntDecorator("MC_" + W + "decay1_afterFSR_pdgId");
358 m_dec.initializeIntDecorator("MC_" + W + "decay2_afterFSR_pdgId");
359
360 m_dec.initializeIntDecorator("MC_" + W + "_IsOnShell");
361 }
362}
@ W
FillWPartonHistory(history, parent, dec, count, mode).

◆ InitializeZDecorators()

void CP::CalcPartonHistory::InitializeZDecorators ( int nZs = 1,
bool extend = false )

Definition at line 275 of file PartonHistoryDecorators.cxx.

275 {
276 std::vector<std::string> Zs;
277 if (n_Zs == 1)
278 Zs.push_back("Z");
279 else {
280 for (int i = 1; i <= n_Zs; i++)
281 Zs.push_back("Z" + std::to_string(i));
282 }
283 for (auto& Z : Zs) {
284 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "_beforeFSR");
285 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_beforeFSR");
286 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_beforeFSR");
287
288 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "_afterFSR");
289 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_afterFSR");
290 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_afterFSR");
291
292 m_dec.initializeIntDecorator("MC_" + Z + "_beforeFSR_pdgId");
293 m_dec.initializeIntDecorator("MC_" + Z + "decay1_beforeFSR_pdgId");
294 m_dec.initializeIntDecorator("MC_" + Z + "decay2_beforeFSR_pdgId");
295
296 m_dec.initializeIntDecorator("MC_" + Z + "_afterFSR_pdgId");
297 m_dec.initializeIntDecorator("MC_" + Z + "decay1_afterFSR_pdgId");
298 m_dec.initializeIntDecorator("MC_" + Z + "decay2_afterFSR_pdgId");
299
300 if (extend) {
301 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay1_beforeFSR");
302 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay2_beforeFSR");
303 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay3_beforeFSR");
304 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay1_beforeFSR");
305 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay2_beforeFSR");
306 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay3_beforeFSR");
307
308 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay1_beforeFSR_pdgId");
309 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay2_beforeFSR_pdgId");
310 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay3_beforeFSR_pdgId");
311 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay1_beforeFSR_pdgId");
312 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay2_beforeFSR_pdgId");
313 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay3_beforeFSR_pdgId");
314
315 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay1_afterFSR");
316 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay2_afterFSR");
317 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay1_decay3_afterFSR");
318 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay1_afterFSR");
319 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay2_afterFSR");
320 m_dec.initializePtEtaPhiMDecorator("MC_" + Z + "decay2_decay3_afterFSR");
321
322 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay1_afterFSR_pdgId");
323 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay2_afterFSR_pdgId");
324 m_dec.initializeIntDecorator("MC_" + Z + "decay1_decay3_afterFSR_pdgId");
325 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay1_afterFSR_pdgId");
326 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay2_afterFSR_pdgId");
327 m_dec.initializeIntDecorator("MC_" + Z + "decay2_decay3_afterFSR_pdgId");
328 }
329
330 m_dec.initializeIntDecorator("MC_" + Z + "_IsOnShell");
331 }
332}
@ Z
FillZPartonHistory(history, parent, dec, count, mode).

◆ 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 CP::CalcPartonHistory::linkBosonCollections ( )
protected

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 "CustomLinkedTruthBosonWithDecayParticles", which is a link to the same bosons in the TruthBosonsWithDecayParticles collection

Definition at line 458 of file CalcPartonHistory.cxx.

458 {
460 "TruthBoson", "TruthBosonsWithDecayParticles",
461 "CustomLinkedTruthBosonWithDecayParticles");
462}
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...

◆ linkTruthContainers()

StatusCode CP::CalcPartonHistory::linkTruthContainers ( const xAOD::TruthParticleContainer *& tp)
protectedvirtual

Definition at line 495 of file CalcPartonHistory.cxx.

496 {
497 const std::string key = m_prefix + "_TruthParticles";
499 const auto& collections =
500 m_configured ? m_config.truthCollections : m_truthCollections;
502 ANA_CHECK(evtStore()->retrieve(tp, key));
504 return StatusCode::SUCCESS;
505 }
506 ANA_CHECK(evtStore()->retrieve(tp, key));
507 return StatusCode::SUCCESS;
508}
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...
StatusCode linkBosonCollections()
currently in DAOD_PHYS TruthTop have links to Ws from the TruthBoson collection, which have no link t...
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition hcg.cxx:116

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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 }
MsgStream & msg() const
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition MsgLevel.cxx:19

◆ 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=()

CalcPartonHistory & CP::CalcPartonHistory::operator= ( const CalcPartonHistory & 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();
384 }
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)

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

◆ Retrievep4() [1/2]

bool CP::CalcPartonHistory::Retrievep4 ( const std::string & key,
PtEtaPhiMVector & p4 )

Definition at line 57 of file CalcPartonHistory.cxx.

58 {
59 return Retrievep4(key, p4, 0);
60}

◆ Retrievep4() [2/2]

bool CP::CalcPartonHistory::Retrievep4 ( const std::string & key,
PtEtaPhiMVector & p4,
const int & idx )

Definition at line 62 of file CalcPartonHistory.cxx.

63 {
64 const auto* v = findVector(m_particleMap, key);
65 if (!v || idx < 0)
66 return false;
67 const auto uidx = static_cast<std::size_t>(idx);
68 if (uidx >= v->size())
69 return false;
70 p4 = GetPtEtaPhiMfromTruth(v->at(uidx));
71 return true;
72}

◆ Retrievep4Gamma()

bool CP::CalcPartonHistory::Retrievep4Gamma ( PtEtaPhiMVector & p4,
int & parentpdgId )

Definition at line 74 of file CalcPartonHistory.cxx.

74 {
75 // Finds the highest-pT photon from any 'GammaRad' key in the m_particleMap.
76 const xAOD::TruthParticle* bestPhoton = nullptr;
77 for (const auto& [key, particles] : m_particleMap) {
78 if (key.find("GammaRad") != std::string::npos) {
79 auto it = std::max_element(
80 particles.begin(), particles.end(),
81 [](const auto* a, const auto* b) { return a->pt() < b->pt(); });
82 if (it != particles.end() &&
83 (!bestPhoton || (*it)->pt() > bestPhoton->pt()))
84 bestPhoton = *it;
85 }
86 }
87 if (!bestPhoton) {
88 parentpdgId = 0;
89 return false;
90 }
91 p4 = GetPtEtaPhiMfromTruth(bestPhoton);
92 parentpdgId = bestPhoton->nParents() > 0 ? bestPhoton->parent(0)->pdgId() : 0;
93 return true;
94}
static Double_t a
const TruthParticle_v1 * parent(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
size_t nParents() const
Number of parents of this particle.

◆ RetrieveParticleInfo() [1/5]

bool CP::CalcPartonHistory::RetrieveParticleInfo ( const std::string & prefix,
const std::string & alt_prefix,
PtEtaPhiMVector & particle,
int & pdgId )

Definition at line 160 of file CalcPartonHistory.cxx.

163 {
164 if (Retrievep4(prefix, particle) && RetrievepdgId(prefix, pdgId))
165 return true;
166 return Retrievep4(alt_prefix, particle) && RetrievepdgId(alt_prefix, pdgId);
167}
bool RetrievepdgId(const std::string &key, std::vector< int > &pdgIds)

◆ RetrieveParticleInfo() [2/5]

bool CP::CalcPartonHistory::RetrieveParticleInfo ( const std::string & prefix,
PtEtaPhiMVector & particle,
int & pdgId )

Definition at line 148 of file CalcPartonHistory.cxx.

150 {
151 return RetrieveParticleInfo(prefix, particle, pdgId, 0);
152}

◆ RetrieveParticleInfo() [3/5]

bool CP::CalcPartonHistory::RetrieveParticleInfo ( const std::string & prefix,
PtEtaPhiMVector & particle,
int & pdgId,
const int & idx )

Definition at line 154 of file CalcPartonHistory.cxx.

156 {
157 return Retrievep4(prefix, particle, idx) && RetrievepdgId(prefix, pdgId, idx);
158}

◆ RetrieveParticleInfo() [4/5]

bool CP::CalcPartonHistory::RetrieveParticleInfo ( const std::string & prefix,
std::vector< const xAOD::TruthParticle * > & particles )

Definition at line 124 of file CalcPartonHistory.cxx.

125 {
126 const auto* v = findVector(m_particleMap, prefix);
127 if (!v)
128 return false;
129 out.insert(out.end(), v->begin(), v->end());
130 return true;
131}

◆ RetrieveParticleInfo() [5/5]

bool CP::CalcPartonHistory::RetrieveParticleInfo ( const std::string & prefix,
std::vector< PtEtaPhiMVector > & particles,
std::vector< int > & pdgIds )

Definition at line 133 of file CalcPartonHistory.cxx.

135 {
136 const auto* v = findVector(m_particleMap, prefix);
137 if (!v)
138 return false;
139 particles.reserve(particles.size() + v->size());
140 pdgIds.reserve(pdgIds.size() + v->size());
141 for (const auto* p : *v) {
142 particles.push_back(GetPtEtaPhiMfromTruth(p));
143 pdgIds.push_back(p->pdgId());
144 }
145 return true;
146}

◆ RetrievepdgId() [1/3]

bool CP::CalcPartonHistory::RetrievepdgId ( const std::string & key,
int & pdgId )

Definition at line 96 of file CalcPartonHistory.cxx.

96 {
97 return RetrievepdgId(key, pdgId, 0);
98}

◆ RetrievepdgId() [2/3]

bool CP::CalcPartonHistory::RetrievepdgId ( const std::string & key,
int & pdgId,
const int & idx )

Definition at line 112 of file CalcPartonHistory.cxx.

113 {
114 const auto* v = findVector(m_particleMap, key);
115 if (!v || idx < 0)
116 return false;
117 const auto uidx = static_cast<std::size_t>(idx);
118 if (uidx >= v->size())
119 return false;
120 pdgId = v->at(uidx)->pdgId();
121 return true;
122}

◆ RetrievepdgId() [3/3]

bool CP::CalcPartonHistory::RetrievepdgId ( const std::string & key,
std::vector< int > & pdgIds )

Definition at line 100 of file CalcPartonHistory.cxx.

101 {
102 const auto* v = findVector(m_particleMap, key);
103 if (!v)
104 return false;
105 pdgIds.reserve(pdgIds.size() + v->size());
106 for (const auto* p : *v)
107 if (p)
108 pdgIds.push_back(p->pdgId());
109 return true;
110}

◆ runHistorySaver()

StatusCode CP::CalcPartonHistory::runHistorySaver ( const xAOD::TruthParticleContainer * truthParticles,
const xAOD::EventInfo * ttbarPartonHistory )
protectedvirtual

Definition at line 584 of file CalcPartonHistory.cxx.

586 {
587
588 // Register the EventInfo for this event; all m_dec.decorate*() calls
589 // will write to it automatically.
590 m_dec.setEventInfo(partonHistory);
591
592 TraceParticles(truthParticles);
593
594 for (const auto& op : m_config.specialFills) {
595 switch (op.type) {
598 break;
601 break;
604 break;
606 FillZPartonHistory(op.parent, op.count, op.mode);
607 break;
609 FillZtautauPartonHistory(op.parent, op.count, op.mode);
610 break;
612 FillWPartonHistory(op.parent, op.count, op.mode);
613 break;
615 FillHiggsPartonHistory(op.mode);
616 break;
618 FillGammaPartonHistory(op.parent);
619 break;
620 }
621 }
622
623 for (const auto& fill : m_config.genericFills) {
624 if (fill.isVector) {
625 FillGenericVectorPartonHistory(fill.retrievalKeys.at(0),
626 fill.decorationKey);
627 } else if (fill.retrievalKeys.size() == 1) {
628 FillGenericPartonHistory(fill.retrievalKeys.at(0), fill.decorationKey,
629 fill.idx);
630 } else {
631 FillGenericPartonHistory(fill.retrievalKeys, fill.decorationKey,
632 fill.idx);
633 }
634 }
635
636 return StatusCode::SUCCESS;
637}
void FillGenericVectorPartonHistory(const std::string &retrievalstring, const std::string &decorationstring)
void FillHiggsPartonHistory(const std::string &mode)
void FillGammaPartonHistory(const std::string &parent)
void FillZtautauPartonHistory(const std::string &parent, int nZs=1, const std::string &mode="resonant")
void TraceParticles(const xAOD::TruthParticleContainer *truthParticles)
@ Ttbar
FillTtbarPartonHistory.
@ Ztautau
FillZtautauPartonHistory(history, parent, dec, count, mode).
@ Higgs
FillHiggsPartonHistory(history, mode, dec).
@ Top
FillTopPartonHistory.
@ AntiTop
FillAntiTopPartonHistory.
@ Gamma
FillGammaPartonHistory(history, parent, dec).

◆ setHiggs()

void CP::CalcPartonHistory::setHiggs ( const std::string & fsr)

Definition at line 16 of file CalcHiggsPartonHistory.cxx.

16 {
17 PtEtaPhiMVector H;
18 PtEtaPhiMVector Wm, Wm_decay1, Wm_decay2;
19 PtEtaPhiMVector Wp, Wp_decay1, Wp_decay2;
20 int Wm_decay1_pdgId, Wm_decay2_pdgId;
21 int Wp_decay1_pdgId, Wp_decay2_pdgId;
22
23 // W+: pass full m_particleMap keys to getW; bare names to m_dec.*
24 bool has_Wp =
25 getW(m_prefix + "_" + "MC_lbar_" + fsr, m_prefix + "_" + "MC_nu_" + fsr,
26 Wp_decay1, Wp_decay1_pdgId, Wp_decay2, Wp_decay2_pdgId);
27 if (has_Wp) {
28 Wp = Wp_decay1 + Wp_decay2;
29 m_dec.decorateParticle("MC_Hdecay1_" + fsr, Wp, 24);
30 m_dec.decorateParticle("MC_Hdecay1_decay1_" + fsr, Wp_decay1,
31 Wp_decay1_pdgId);
32 m_dec.decorateParticle("MC_Hdecay1_decay2_" + fsr, Wp_decay2,
33 Wp_decay2_pdgId);
34 }
35 // W-
36 bool has_Wm =
37 getW(m_prefix + "_" + "MC_l_" + fsr, m_prefix + "_" + "MC_nubar_" + fsr,
38 Wm_decay1, Wm_decay1_pdgId, Wm_decay2, Wm_decay2_pdgId);
39 if (has_Wm) {
40 Wm = Wm_decay1 + Wm_decay2;
41 m_dec.decorateParticle("MC_Hdecay2_" + fsr, Wm, -24);
42 m_dec.decorateParticle("MC_Hdecay2_decay1_" + fsr, Wm_decay1,
43 Wm_decay1_pdgId);
44 m_dec.decorateParticle("MC_Hdecay2_decay2_" + fsr, Wm_decay2,
45 Wm_decay2_pdgId);
46 }
47 if (has_Wm && has_Wp) {
48 H = Wp + Wm;
49 m_dec.decorateParticle("MC_H_" + fsr, H, 25);
50 }
51}
#define H(x, y, z)
Definition MD5.cxx:114
bool getW(const std::string &str_lep, const std::string &str_nu, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)

◆ setW()

void CP::CalcPartonHistory::setW ( const std::string & fsr,
int nWs )

Definition at line 61 of file CalcWPartonHistory.cxx.

61 {
62 PtEtaPhiMVector W;
63 PtEtaPhiMVector Wm, Wm_decay1, Wm_decay2;
64 PtEtaPhiMVector Wp, Wp_decay1, Wp_decay2;
65 int Wm_decay1_pdgId, Wm_decay2_pdgId;
66 int Wp_decay1_pdgId, Wp_decay2_pdgId;
67
68 if (nWs == 1) {
69 // W+: pass full m_particleMap keys to getW; bare names to m_dec.*
70 bool has_Wp =
71 getW(m_prefix + "_" + "MC_lbar_" + fsr, m_prefix + "_" + "MC_nu_" + fsr,
72 Wp_decay1, Wp_decay1_pdgId, Wp_decay2, Wp_decay2_pdgId);
73 if (has_Wp) {
74 Wp = Wp_decay1 + Wp_decay2;
75 m_dec.decorateParticle("MC_W_" + fsr, Wp, 24);
76 m_dec.decorateParticle("MC_Wdecay1_" + fsr, Wp_decay1, Wp_decay1_pdgId);
77 m_dec.decorateParticle("MC_Wdecay2_" + fsr, Wp_decay2, Wp_decay2_pdgId);
78 }
79 // W-
80 bool has_Wm =
81 getW(m_prefix + "_" + "MC_l_" + fsr, m_prefix + "_" + "MC_nubar_" + fsr,
82 Wm_decay1, Wm_decay1_pdgId, Wm_decay2, Wm_decay2_pdgId);
83 if (has_Wm) {
84 Wm = Wm_decay1 + Wm_decay2;
85 m_dec.decorateParticle("MC_W_" + fsr, Wm, -24);
86 m_dec.decorateParticle("MC_Wdecay1_" + fsr, Wm_decay1, Wm_decay1_pdgId);
87 m_dec.decorateParticle("MC_Wdecay2_" + fsr, Wm_decay2, Wm_decay2_pdgId);
88 }
89 } else if (nWs == 2) {
90 // W+
91 bool has_Wp =
92 getW(m_prefix + "_" + "MC_lbar_" + fsr, m_prefix + "_" + "MC_nu_" + fsr,
93 Wp_decay1, Wp_decay1_pdgId, Wp_decay2, Wp_decay2_pdgId);
94 if (has_Wp) {
95 Wp = Wp_decay1 + Wp_decay2;
96 m_dec.decorateParticle("MC_W1_" + fsr, Wp, 24);
97 m_dec.decorateParticle("MC_W1decay1_" + fsr, Wp_decay1, Wp_decay1_pdgId);
98 m_dec.decorateParticle("MC_W1decay2_" + fsr, Wp_decay2, Wp_decay2_pdgId);
99 }
100 // W-
101 bool has_Wm =
102 getW(m_prefix + "_" + "MC_l_" + fsr, m_prefix + "_" + "MC_nubar_" + fsr,
103 Wm_decay1, Wm_decay1_pdgId, Wm_decay2, Wm_decay2_pdgId);
104 if (has_Wm) {
105 Wm = Wm_decay1 + Wm_decay2;
106 m_dec.decorateParticle("MC_W2_" + fsr, Wm, -24);
107 m_dec.decorateParticle("MC_W2decay1_" + fsr, Wm_decay1, Wm_decay1_pdgId);
108 m_dec.decorateParticle("MC_W2decay2_" + fsr, Wm_decay2, Wm_decay2_pdgId);
109 }
110 }
111}

◆ setZ()

void CP::CalcPartonHistory::setZ ( const std::string & fsr,
int nZs )

Definition at line 152 of file CalcZPartonHistory.cxx.

152 {
153 PtEtaPhiMVector Z, Z_decay1, Z_decay2;
154 int Z_decay1_pdgId, Z_decay2_pdgId;
155 m_dec.decorateCustom("MC_Z_IsOnShell", 0);
156 // getZ receives full m_particleMap keys; m_dec.decorate* receives bare names.
157 bool has_Z =
158 getZ(m_prefix + "_" + "MC_l_" + fsr, m_prefix + "_" + "MC_lbar_" + fsr,
159 Z_decay1, Z_decay1_pdgId, Z_decay2, Z_decay2_pdgId);
160 if (nZs == 1) {
161 if (has_Z) {
162 Z = Z_decay1 + Z_decay2;
163 m_dec.decorateParticle("MC_Z_" + fsr, Z, 23);
164 m_dec.decorateParticle("MC_Zdecay1_" + fsr, Z_decay1, Z_decay1_pdgId);
165 m_dec.decorateParticle("MC_Zdecay2_" + fsr, Z_decay2, Z_decay2_pdgId);
166 }
167 } else
168 ANA_MSG_ERROR("Reconstruction of multiple Zs is not supported yet!");
169}
#define ANA_MSG_ERROR(xmsg)
Macro printing error messages.
bool getZ(const std::string &str_lep1, const std::string &str_lep2, PtEtaPhiMVector &p1, int &pdgId1, PtEtaPhiMVector &p2, int &pdgId2)

◆ setZtautau()

void CP::CalcPartonHistory::setZtautau ( const std::string & fsr,
int nZs )

Definition at line 172 of file CalcZPartonHistory.cxx.

172 {
173 PtEtaPhiMVector Z, Zdecay1, Zdecay2;
174 PtEtaPhiMVector Zdecay1_decay1, Zdecay1_decay2, Zdecay1_decay3;
175 PtEtaPhiMVector Zdecay2_decay1, Zdecay2_decay2, Zdecay2_decay3;
176 int Zdecay1_pdgId = 0, Zdecay2_pdgId = 0;
177 int Zdecay1_decay1_pdgId = 0, Zdecay1_decay2_pdgId = 0,
178 Zdecay1_decay3_pdgId = 0;
179 int Zdecay2_decay1_pdgId = 0, Zdecay2_decay2_pdgId = 0,
180 Zdecay2_decay3_pdgId = 0;
181
182 bool has_Z =
183 getZFromTaus(fsr, Zdecay1, Zdecay1_pdgId, Zdecay2, Zdecay2_pdgId,
184 Zdecay1_decay1, Zdecay1_decay1_pdgId, Zdecay1_decay2,
185 Zdecay1_decay2_pdgId, Zdecay1_decay3, Zdecay1_decay3_pdgId,
186 Zdecay2_decay1, Zdecay2_decay1_pdgId, Zdecay2_decay2,
187 Zdecay2_decay2_pdgId, Zdecay2_decay3, Zdecay2_decay3_pdgId);
188 if (nZs == 1) {
189 if (has_Z) {
190 Z = Zdecay1 + Zdecay2;
191 m_dec.decorateParticle("MC_Z_" + fsr, Z, 23);
192 m_dec.decorateParticle("MC_Zdecay1_" + fsr, Zdecay1, Zdecay1_pdgId);
193 m_dec.decorateParticle("MC_Zdecay2_" + fsr, Zdecay2, Zdecay2_pdgId);
194 m_dec.decorateParticle("MC_Zdecay1_decay1_" + fsr, Zdecay1_decay1,
195 Zdecay1_decay1_pdgId);
196 m_dec.decorateParticle("MC_Zdecay2_decay1_" + fsr, Zdecay2_decay1,
197 Zdecay2_decay1_pdgId);
198 m_dec.decorateParticle("MC_Zdecay1_decay2_" + fsr, Zdecay1_decay2,
199 Zdecay1_decay2_pdgId);
200 m_dec.decorateParticle("MC_Zdecay2_decay2_" + fsr, Zdecay2_decay2,
201 Zdecay2_decay2_pdgId);
202 m_dec.decorateParticle("MC_Zdecay1_decay3_" + fsr, Zdecay1_decay3,
203 Zdecay1_decay3_pdgId);
204 m_dec.decorateParticle("MC_Zdecay2_decay3_" + fsr, Zdecay2_decay3,
205 Zdecay2_decay3_pdgId);
206 }
207 } else
208 ANA_MSG_ERROR("Reconstruction of multiple Zs is not supported yet!");
209}
bool getZFromTaus(const std::string &fsr, PtEtaPhiMVector &Zdecay1, int &Zdecay1_pdgId, PtEtaPhiMVector &Zdecay2, int &Zdecay2_pdgId, PtEtaPhiMVector &Zdecay1_decay1, int &Zdecay1_decay1_pdgId, PtEtaPhiMVector &Zdecay1_decay2, int &Zdecay1_decay2_pdgId, PtEtaPhiMVector &Zdecay1_decay3, int &Zdecay1_decay3_pdgId, PtEtaPhiMVector &Zdecay2_decay1, int &Zdecay2_decay1_pdgId, PtEtaPhiMVector &Zdecay2_decay2, int &Zdecay2_decay2_pdgId, PtEtaPhiMVector &Zdecay2_decay3, int &Zdecay2_decay3_pdgId)

◆ 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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

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

◆ TraceParticle()

void CP::CalcPartonHistory::TraceParticle ( const xAOD::TruthParticle * particle,
std::vector< const xAOD::TruthParticle * > & currentPath,
std::vector< std::vector< const xAOD::TruthParticle * > > & allPaths )

Definition at line 191 of file CalcPartonHistory.cxx.

193 {
194 // Recursively builds decay paths from p down to stable particles.
195 // Each completed root-to-leaf path is appended to allPaths and later
196 // processed by FillParticleMap to assign m_particleMap keys.
197 //
198 // FSR handling: a particle that radiates before decaying appears as a chain
199 // of identical PDG-ID nodes (e.g. t → t → t → W b). findAfterFSR() follows
200 // that chain to the last node before the actual decay vertex, so the path
201 // records the pre- and post-FSR instances rather than every intermediate.
202 //
203 // W linking (DAOD_PHYS only): TruthTop links to Ws in TruthBoson, which
204 // carry no decay products. When we encounter such a W (isAfterFSR &&
205 // |pdg|==24) we swap it for the corresponding entry in
206 // TruthBosonsWithDecayParticles via the
207 // "CustomLinkedTruthBosonWithDecayParticles" decoration so that the subsequent
208 // child traversal finds the W decay products.
210 return;
211
212 // If this W node has no identical child (i.e. it is the after-FSR instance)
213 // but lacks decay products, swap to the linked decay-product-bearing copy.
214 if (PartonHistoryUtils::isAfterFSR(p) && std::abs(p->pdgId()) == 24) {
216 p, "CustomLinkedTruthBosonWithDecayParticles");
217 }
218
219 path.push_back(p);
220
221 // Leaf node: record the completed path.
222 if (p->nChildren() == 0) {
223 allPaths.push_back(path);
224 path.pop_back();
225 return;
226 }
227
229 // Same W-linking fix for the after-FSR node reached by findAfterFSR().
230 if (std::abs(afterFSR->pdgId()) == 24) {
232 afterFSR, "CustomLinkedTruthBosonWithDecayParticles");
233 }
234
235 if (afterFSR != p) {
236 // There was FSR: continue the path from the post-FSR node.
237 TraceParticle(afterFSR, path, allPaths);
238 } else {
239 // No FSR: branch into each child (e.g. W→lν gives two sub-paths).
240 for (std::size_t i = 0; i < afterFSR->nChildren(); ++i) {
241 if (const auto* c = afterFSR->child(i))
242 TraceParticle(c, path, allPaths);
243 }
244 }
245 path.pop_back();
246}
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
void TraceParticle(const xAOD::TruthParticle *particle, std::vector< const xAOD::TruthParticle * > &currentPath, std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
const TruthParticle_v1 * child(size_t i) const
Retrieve the i-th mother (TruthParticle) of this TruthParticle.
size_t nChildren() const
Number of children of this particle.
const xAOD::TruthParticle * findAfterFSR(const xAOD::TruthParticle *particle)
Return particle after FSR (before the decay vertex).
bool isAfterFSR(const xAOD::TruthParticle *particle)
Determine whether particle is afterFSR.
bool isBrokenTop(const xAOD::TruthParticle *particle)
Looking for tops without children -> must be broken.
path
python interpreter configuration --------------------------------------—
Definition athena.py:130

◆ TraceParticles()

void CP::CalcPartonHistory::TraceParticles ( const xAOD::TruthParticleContainer * truthParticles)

Definition at line 378 of file CalcPartonHistory.cxx.

379 {
380 std::vector<std::vector<const xAOD::TruthParticle*>> allPaths;
381 allPaths.reserve(truthParticles->size());
382 for (const xAOD::TruthParticle* p : *truthParticles) {
384 continue;
385 std::vector<const xAOD::TruthParticle*> path;
386 path.reserve(16);
387 TraceParticle(p, path, allPaths);
388 }
389 FillParticleMap(allPaths);
390}
void FillParticleMap(std::vector< std::vector< const xAOD::TruthParticle * > > &allPaths)
size_type size() const noexcept
Returns the number of elements in the collection.
bool hasParticleIdenticalParent(const xAOD::TruthParticle *particle)
Return true when particle is a top before FSR.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_config

PartonSchemeConfig CP::CalcPartonHistory::m_config
protected

scheme configuration set via configure()

Definition at line 175 of file CalcPartonHistory.h.

◆ m_configured

bool CP::CalcPartonHistory::m_configured = false
protected

true after configure() has been called

Definition at line 176 of file CalcPartonHistory.h.

◆ m_dec

PartonDecorator CP::CalcPartonHistory::m_dec
protected

Definition at line 157 of file CalcPartonHistory.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_particleMap

std::map<std::string, std::vector<const xAOD::TruthParticle*> > CP::CalcPartonHistory::m_particleMap
protected

Definition at line 156 of file CalcPartonHistory.h.

◆ m_prefix

std::string CP::CalcPartonHistory::m_prefix
protected

prefix applied to all decorator and m_particleMap names

Definition at line 161 of file CalcPartonHistory.h.

◆ m_truthCollections

const std::vector<std::string> CP::CalcPartonHistory::m_truthCollections
protected

Definition at line 159 of file CalcPartonHistory.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: