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

42 : asg::AsgTool(name), m_truthCollections(truthCollection) {
43 declareProperty("prefix", m_prefix = "",
44 "Prefix to apply to all names to avoid overwriting");
45}
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 34 of file CalcPartonHistory.h.

34{};

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

253 {
254 if (!ExistsInKey(key, p))
255 m_particleMap[key].push_back(p);
256}
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 413 of file CalcPartonHistory.cxx.

415 {
416 // In DAOD_PHYS there is no single TruthParticles collection, so we merge
417 // several dedicated collections (e.g. TruthTop,
418 // TruthBosonsWithDecayParticles) into one working container stored in the
419 // event store.
420 //
421 // The merge must avoid double-counting: the same particle can appear in
422 // multiple collections (e.g. the b from a top appears in both TruthTop and
423 // TruthBottom). We therefore keep only "root" particles — those that are not
424 // a descendant of any other candidate in the merged pool. TraceParticles then
425 // walks down from these roots, naturally visiting all descendants regardless
426 // of which original collection they came from.
427 ConstDataVector<DataVector<xAOD::TruthParticle_v1>>* out_cont =
428 new ConstDataVector<DataVector<xAOD::TruthParticle_v1>>(
430 std::vector<const xAOD::TruthParticle*> p_candidates;
431 std::vector<const xAOD::TruthParticle*> p_parents;
432
433 for (const std::string& collection : collections) {
434 const xAOD::TruthParticleContainer* cont = nullptr;
435 ANA_CHECK(evtStore()->retrieve(cont, collection));
436 p_candidates.insert(p_candidates.end(), cont->begin(), cont->end());
437 }
438 // Retain only particles that have no ancestor among the other candidates.
439 for (const xAOD::TruthParticle* potential_parent : p_candidates) {
440 if (PartonHistoryUtils::isQuarkFromPDF(potential_parent)) {
441 continue;
442 }
443
444 if (std::none_of(p_candidates.begin(), p_candidates.end(),
445 [&](const xAOD::TruthParticle* other_candidate) {
446 return other_candidate != potential_parent &&
447 !PartonHistoryUtils::isQuarkFromPDF(
448 other_candidate) &&
449 PartonHistoryUtils::isChildOf(other_candidate,
450
451 potential_parent);
452 }))
453 p_parents.push_back(potential_parent);
454 }
455 out_cont->insert(out_cont->end(), p_parents.begin(), p_parents.end());
456 StatusCode save = TDS()->record(out_cont, out_contName);
457 if (!save)
458 return StatusCode::FAILURE;
459 return StatusCode::SUCCESS;
460}
#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 514 of file CalcPartonHistory.cxx.

514 {
516 m_configured = true;
517}
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 468 of file CalcPartonHistory.cxx.

470 {
471 const SG::Decorator<const xAOD::TruthParticle*> dec(nameOfDecoration);
472 const xAOD::TruthParticleContainer* cont1 = nullptr;
473 const xAOD::TruthParticleContainer* cont2 = nullptr;
474 ANA_CHECK(evtStore()->retrieve(cont1, collectionToDecorate));
475 ANA_CHECK(evtStore()->retrieve(cont2, collectionToLink));
476 for (const auto* p : *cont1) {
477 const xAOD::TruthParticle* link = nullptr;
478 for (const auto* q : *cont2) {
479 if (p->pdgId() == q->pdgId() && p->uid() == q->uid()) {
480 link = q;
481 break;
482 }
483 }
484 dec(*p) = link;
485 }
486 return StatusCode::SUCCESS;
487}
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 402 of file CalcPartonHistory.cxx.

402 {
403 const xAOD::TruthParticleContainer* truthParticles{nullptr};
404 ANA_CHECK(linkTruthContainers(truthParticles));
405
406 const xAOD::EventInfo* partonHistory = nullptr;
407 ANA_CHECK(evtStore()->retrieve(partonHistory, "EventInfo"));
408
409 ANA_CHECK(runHistorySaver(truthParticles, partonHistory));
410 return StatusCode::SUCCESS;
411}
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 52 of file CalcPartonHistory.cxx.

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

◆ ExistsInMap()

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

Definition at line 47 of file CalcPartonHistory.cxx.

47 {
48 // Checks whether a given key exists in the particle map.
49 return m_particleMap.find(key) != m_particleMap.end();
50}

◆ 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 23 of file CalcTopPartonHistory.cxx.

23 {
24 FillGenericPartonHistory("MC_tbar_beforeFSR", "MC_tbar_beforeFSR", 0);
25 FillGenericPartonHistory("MC_tbar_bbar_beforeFSR",
26 "MC_bbar_beforeFSR_from_tbar", 0);
27 FillGenericPartonHistory("MC_tbar_afterFSR", "MC_tbar_afterFSR", 0);
28 FillGenericPartonHistory("MC_tbar_bbar_afterFSR",
29 "MC_bbar_afterFSR_from_tbar", 0);
30 FillWPartonHistory("tbar");
31}
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 15 of file CalcPhotonPartonHistory.cxx.

15 {
16 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
17 PtEtaPhiMVector gamma;
18 int gamma_origin = -1;
19
20 m_dec.decorateDefault("MC_gamma" + parentstring);
21 m_dec.decorateCustom("MC_gamma_origin", 0);
22
23 if (Retrievep4Gamma(gamma, gamma_origin))
24 m_dec.decorateParticle("MC_gamma" + parentstring, gamma);
25
26 m_dec.decorateCustom("MC_gamma_origin", gamma_origin);
27}
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 15 of file CalcGenericPartonHistory.cxx.

17 {
18 PtEtaPhiMVector v;
19 int pdgId = 0;
20 m_dec.decorateDefault(decorationstring);
21 if (RetrieveParticleInfo(m_prefix + "_" + retrievalstring, v, pdgId, idx))
22 m_dec.decorateParticle(decorationstring, v, pdgId);
23}
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 39 of file CalcGenericPartonHistory.cxx.

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

◆ FillGenericPartonHistory() [3/3]

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

Definition at line 25 of file CalcGenericPartonHistory.cxx.

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

◆ FillGenericVectorPartonHistory()

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

Definition at line 45 of file CalcGenericPartonHistory.cxx.

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

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

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

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

◆ FillTtbarPartonHistory()

void CP::CalcPartonHistory::FillTtbarPartonHistory ( )

Definition at line 33 of file CalcTopPartonHistory.cxx.

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

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

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

276 {
277 std::string parentstring = parent.empty() ? "" : "_from_" + parent;
278 // mapPrefix: full key for ExistsInMap (used indirectly via
279 // FillZPartonHistory).
280 std::string mapPrefix =
281 m_prefix + "_" + "MC_" + (parent.empty() ? "Z" : parent + "_Z");
282 // decPrefix: bare suffix for FillGenericPartonHistory retrieval strings.
283 std::string decPrefix = "MC_" + (parent.empty() ? "Z" : parent + "_Z");
284
285 FillZPartonHistory(parent, nZs, mode);
286 m_dec.decorateCustom("MC_Z_IsOnShell",
287 0); // default; overwritten to 1 below if resonant
288 if (mode == "resonant") {
289 if (nZs == 1) {
290 m_dec.decorateCustom("MC_Z_IsOnShell", 1);
292 decPrefix + "Decay1_Decay1_beforeFSR",
293 "MC_Zdecay1_decay1" + parentstring + "_beforeFSR", 0);
295 decPrefix + "Decay1_Decay2_beforeFSR",
296 "MC_Zdecay1_decay2" + parentstring + "_beforeFSR", 0);
298 decPrefix + "Decay1_Decay3_beforeFSR",
299 "MC_Zdecay1_decay3" + parentstring + "_beforeFSR", 0);
300 FillGenericPartonHistory(decPrefix + "Decay1_Decay1_afterFSR",
301 "MC_Zdecay1_decay1" + parentstring + "_afterFSR",
302 0);
303 FillGenericPartonHistory(decPrefix + "Decay1_Decay2_afterFSR",
304 "MC_Zdecay1_decay2" + parentstring + "_afterFSR",
305 0);
306 FillGenericPartonHistory(decPrefix + "Decay1_Decay3_afterFSR",
307 "MC_Zdecay1_decay3" + parentstring + "_afterFSR",
308 0);
309 } else {
310 for (int idx = 0; idx < nZs; idx++) {
311 const std::string idxStr = std::to_string(idx + 1);
312 m_dec.decorateCustom("MC_Z" + idxStr + "_IsOnShell", 1);
314 decPrefix + "Decay1_Decay1_beforeFSR",
315 "MC_Z" + idxStr + "decay1_decay1" + parentstring + "_beforeFSR",
316 idx);
318 decPrefix + "Decay1_Decay2_beforeFSR",
319 "MC_Z" + idxStr + "decay1_decay2" + parentstring + "_beforeFSR",
320 idx);
322 decPrefix + "Decay1_Decay3_beforeFSR",
323 "MC_Z" + idxStr + "decay1_decay3" + parentstring + "_beforeFSR",
324 idx);
326 decPrefix + "Decay1_Decay1_afterFSR",
327 "MC_Z" + idxStr + "decay1_decay1" + parentstring + "_afterFSR",
328 idx);
330 decPrefix + "Decay1_Decay2_afterFSR",
331 "MC_Z" + idxStr + "decay1_decay2" + parentstring + "_afterFSR",
332 idx);
334 decPrefix + "Decay1_Decay3_afterFSR",
335 "MC_Z" + idxStr + "decay1_decay3" + parentstring + "_afterFSR",
336 idx);
337 }
338 }
339 } else if (mode == "non_resonant") {
340 setZtautau("beforeFSR", nZs);
341 setZtautau("afterFSR", nZs);
342 }
343}
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::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

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

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

Definition at line 119 of file AsgTool.cxx.

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

◆ getName()

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

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

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

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

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

Definition at line 106 of file AsgTool.cxx.

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

◆ GetParticleType()

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

Definition at line 173 of file CalcPartonHistory.cxx.

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

491 {
493 if (!acc.isAvailable(*part))
494 return part;
495 const xAOD::TruthParticle* link = acc(*part);
496 return link ? link : part;
497}
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 16 of file CalcWPartonHistory.cxx.

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

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

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

◆ handleDecay()

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

Definition at line 280 of file CalcPartonHistory.cxx.

281 {
282 const bool fromH = PartonHistoryUtils::hasParentAbsPdgId(p, 25) &&
284 const bool fromW = PartonHistoryUtils::hasParentAbsPdgId(p, 24) &&
286 const bool fromZ = PartonHistoryUtils::hasParentAbsPdgId(p, 23) &&
288 if (!fromH && !fromW && !fromZ)
289 return false;
290
291 const std::string decayStr = "Decay" + std::to_string(decayID);
292 key += decayStr;
293 AddToParticleMap(p, key + kBeforeFSR);
295 AddToParticleMap(p, key + kAfterFSR);
296 return true;
297}
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 304 of file CalcPartonHistory.cxx.

306 {
307 AddToParticleMap(particle, key + newKey);
308 key += newKey;
309}

◆ handleFSR()

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

Definition at line 258 of file CalcPartonHistory.cxx.

259 {
261 key += newKey;
262
263 if (p->nParents() == 0) {
264 AddToParticleMap(p, key + kBeforeFSR);
266 AddToParticleMap(p, key + kAfterFSR);
267 return true;
268 }
269
271 AddToParticleMap(p, key + kAfterFSR);
272 } else {
273 AddToParticleMap(p, key + kBeforeFSR);
275 AddToParticleMap(p, key + kAfterFSR);
276 }
277 return true;
278}

◆ handleSameAsParent()

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

Definition at line 299 of file CalcPartonHistory.cxx.

300 {
301 AddToParticleMap(particle, key);
302}

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

396 {
397 m_dec.setPrefix(m_prefix);
399 return StatusCode::SUCCESS;
400}
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 519 of file CalcPartonHistory.cxx.

519 {
520 if (!m_configured)
521 return;
522
523 for (const auto& group : m_config.decoratorGroups) {
524 switch (group) {
527 break;
530 break;
533 break;
536 break;
539 break;
542 break;
545 break;
548 break;
551 break;
554 break;
557 break;
560 break;
563 break;
566 break;
567 }
568 }
569
570 for (const auto& zw : m_config.decoratorZWs) {
571 if (zw.type == DecoratorZW::Z)
572 InitializeZDecorators(zw.count, zw.extended);
573 else
574 InitializeWDecorators(zw.count);
575 }
576
577 for (const auto& fill : m_config.genericFills) {
578 if (fill.isVector) {
579 m_dec.initializeVectorPtEtaPhiMDecorator(fill.decorationKey);
580 m_dec.initializeVectorIntDecorator(fill.decorationKey + "_pdgId");
581 } else {
582 m_dec.initializePtEtaPhiMDecorator(fill.decorationKey);
583 m_dec.initializeIntDecorator(fill.decorationKey + "_pdgId");
584 }
585 }
586}
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 462 of file CalcPartonHistory.cxx.

462 {
464 "TruthBoson", "TruthBosonsWithDecayParticles",
465 "CustomLinkedTruthBosonWithDecayParticles");
466}
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 499 of file CalcPartonHistory.cxx.

500 {
501 const std::string key = m_prefix + "_TruthParticles";
503 const auto& collections =
504 m_configured ? m_config.truthCollections : m_truthCollections;
506 ANA_CHECK(evtStore()->retrieve(tp, key));
508 return StatusCode::SUCCESS;
509 }
510 ANA_CHECK(evtStore()->retrieve(tp, key));
511 return StatusCode::SUCCESS;
512}
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:114

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

62 {
63 return Retrievep4(key, p4, 0);
64}

◆ Retrievep4() [2/2]

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

Definition at line 66 of file CalcPartonHistory.cxx.

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

◆ Retrievep4Gamma()

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

Definition at line 78 of file CalcPartonHistory.cxx.

78 {
79 // Finds the highest-pT photon from any 'GammaRad' key in the m_particleMap.
80 const xAOD::TruthParticle* bestPhoton = nullptr;
81 for (const auto& [key, particles] : m_particleMap) {
82 if (key.find("GammaRad") != std::string::npos) {
83 auto it = std::max_element(
84 particles.begin(), particles.end(),
85 [](const auto* a, const auto* b) { return a->pt() < b->pt(); });
86 if (it != particles.end() &&
87 (!bestPhoton || (*it)->pt() > bestPhoton->pt()))
88 bestPhoton = *it;
89 }
90 }
91 if (!bestPhoton) {
92 parentpdgId = 0;
93 return false;
94 }
95 p4 = GetPtEtaPhiMfromTruth(bestPhoton);
96 parentpdgId = bestPhoton->nParents() > 0 ? bestPhoton->parent(0)->pdgId() : 0;
97 return true;
98}
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 164 of file CalcPartonHistory.cxx.

167 {
168 if (Retrievep4(prefix, particle) && RetrievepdgId(prefix, pdgId))
169 return true;
170 return Retrievep4(alt_prefix, particle) && RetrievepdgId(alt_prefix, pdgId);
171}
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 152 of file CalcPartonHistory.cxx.

154 {
155 return RetrieveParticleInfo(prefix, particle, pdgId, 0);
156}

◆ RetrieveParticleInfo() [3/5]

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

Definition at line 158 of file CalcPartonHistory.cxx.

160 {
161 return Retrievep4(prefix, particle, idx) && RetrievepdgId(prefix, pdgId, idx);
162}

◆ RetrieveParticleInfo() [4/5]

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

Definition at line 128 of file CalcPartonHistory.cxx.

129 {
130 const auto* v = findVector(m_particleMap, prefix);
131 if (!v)
132 return false;
133 out.insert(out.end(), v->begin(), v->end());
134 return true;
135}

◆ RetrieveParticleInfo() [5/5]

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

Definition at line 137 of file CalcPartonHistory.cxx.

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

◆ RetrievepdgId() [1/3]

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

Definition at line 100 of file CalcPartonHistory.cxx.

100 {
101 return RetrievepdgId(key, pdgId, 0);
102}

◆ RetrievepdgId() [2/3]

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

Definition at line 116 of file CalcPartonHistory.cxx.

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

◆ RetrievepdgId() [3/3]

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

Definition at line 104 of file CalcPartonHistory.cxx.

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

◆ runHistorySaver()

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

Definition at line 588 of file CalcPartonHistory.cxx.

590 {
591
592 // Register the EventInfo for this event; all m_dec.decorate*() calls
593 // will write to it automatically.
594 m_dec.setEventInfo(partonHistory);
595
596 TraceParticles(truthParticles);
597
598 for (const auto& op : m_config.specialFills) {
599 switch (op.type) {
602 break;
605 break;
608 break;
610 FillZPartonHistory(op.parent, op.count, op.mode);
611 break;
613 FillZtautauPartonHistory(op.parent, op.count, op.mode);
614 break;
616 FillWPartonHistory(op.parent, op.count, op.mode);
617 break;
619 FillHiggsPartonHistory(op.mode);
620 break;
622 FillGammaPartonHistory(op.parent);
623 break;
624 }
625 }
626
627 for (const auto& fill : m_config.genericFills) {
628 if (fill.isVector) {
629 FillGenericVectorPartonHistory(fill.retrievalKeys.at(0),
630 fill.decorationKey);
631 } else if (fill.retrievalKeys.size() == 1) {
632 FillGenericPartonHistory(fill.retrievalKeys.at(0), fill.decorationKey,
633 fill.idx);
634 } else {
635 FillGenericPartonHistory(fill.retrievalKeys, fill.decorationKey,
636 fill.idx);
637 }
638 }
639
640 return StatusCode::SUCCESS;
641}
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 62 of file CalcWPartonHistory.cxx.

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

◆ setZ()

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

Definition at line 153 of file CalcZPartonHistory.cxx.

153 {
154 PtEtaPhiMVector Z, Z_decay1, Z_decay2;
155 int Z_decay1_pdgId, Z_decay2_pdgId;
156 m_dec.decorateCustom("MC_Z_IsOnShell", 0);
157 // getZ receives full m_particleMap keys; m_dec.decorate* receives bare names.
158 bool has_Z =
159 getZ(m_prefix + "_" + "MC_l_" + fsr, m_prefix + "_" + "MC_lbar_" + fsr,
160 Z_decay1, Z_decay1_pdgId, Z_decay2, Z_decay2_pdgId);
161 if (nZs == 1) {
162 if (has_Z) {
163 Z = Z_decay1 + Z_decay2;
164 m_dec.decorateParticle("MC_Z_" + fsr, Z, 23);
165 m_dec.decorateParticle("MC_Zdecay1_" + fsr, Z_decay1, Z_decay1_pdgId);
166 m_dec.decorateParticle("MC_Zdecay2_" + fsr, Z_decay2, Z_decay2_pdgId);
167 }
168 } else
169 ANA_MSG_ERROR("Reconstruction of multiple Zs is not supported yet!");
170}
#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 173 of file CalcZPartonHistory.cxx.

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

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

383 {
384 std::vector<std::vector<const xAOD::TruthParticle*>> allPaths;
385 allPaths.reserve(truthParticles->size());
386 for (const xAOD::TruthParticle* p : *truthParticles) {
388 continue;
389 std::vector<const xAOD::TruthParticle*> path;
390 path.reserve(16);
391 TraceParticle(p, path, allPaths);
392 }
393 FillParticleMap(allPaths);
394}
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 177 of file CalcPartonHistory.h.

◆ m_configured

bool CP::CalcPartonHistory::m_configured = false
protected

true after configure() has been called

Definition at line 178 of file CalcPartonHistory.h.

◆ m_dec

PartonDecorator CP::CalcPartonHistory::m_dec
protected

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

◆ m_truthCollections

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

Definition at line 161 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: