ATLAS Offline Software
Loading...
Searching...
No Matches
AnalysisConfig_Ntuple.cxx File Reference

Go to the source code of this file.

Macros

#define endmsg   endmsg

Functions

std::string date ()
 sadly, includes a return at the end
HepMC::ConstGenParticlePtr fromParent (int pdg_id, HepMC::ConstGenParticlePtr p, bool printout=false)
template<class T>
void remove_duplicates (std::vector< T > &vecvec)

Detailed Description

Author
mark sutton

Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration

Definition in file AnalysisConfig_Ntuple.cxx.

Macro Definition Documentation

◆ endmsg

#define endmsg   endmsg

Definition at line 54 of file AnalysisConfig_Ntuple.cxx.

Function Documentation

◆ date()

std::string date ( )

sadly, includes a return at the end

Definition at line 58 of file AnalysisConfig_Ntuple.cxx.

58 {
59 time_t t;
60 time(&t);
61 char buf[26];
62 std::string mtime = ctime_r(&t, buf);
63 mtime.erase( std::remove(mtime.begin(), mtime.end(), '\n'), mtime.end() );
64 return mtime;
65}
time(flags, cells_name, *args, **kw)
DataModel_detail::iterator< DVL > remove(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end, const T &value)
Specialization of remove for DataVector/List.

◆ fromParent()

HepMC::ConstGenParticlePtr fromParent ( int pdg_id,
HepMC::ConstGenParticlePtr p,
bool printout = false )

recursive stopping conditions

recursive stopping conditions

useful debug

recursive stopping conditions

Definition at line 69 of file AnalysisConfig_Ntuple.cxx.

69 {
70
71 if ( p==0 ) return 0;
72 if (std::abs(p->pdg_id())==11 || std::abs(p->pdg_id())==13 ) return 0; //don't want light leptons from tau decays
73 if ( std::abs(p->pdg_id())==pdg_id ) return p;
74
75 auto vertex = p->production_vertex();
76 if ( !vertex) return 0; // has no production vertex !!!
77
78 if ( vertex->particles_in().size() < 1 ) return 0;
79
81 // if ( printout ) {
82 // TruthParticle t(p);
83 // std::cout << "particle " << *p << " " << t.pdgId() << "\tparent " << p << std::endl;
84 // }
85
86 for ( auto in: vertex->particles_in()) {
87 auto parent = fromParent( pdg_id, in, printout );
88 TruthParticle t(in);
89 if ( parent && std::abs(parent->pdg_id())==pdg_id) {
90 return parent;
91 }
92 }
93 return 0;
94}
HepMC::ConstGenParticlePtr fromParent(int pdg_id, HepMC::ConstGenParticlePtr p, bool printout=false)

◆ remove_duplicates()

template<class T>
void remove_duplicates ( std::vector< T > & vec)

Definition at line 99 of file AnalysisConfig_Ntuple.cxx.

99 {
100 std::sort(vec.begin(), vec.end());
101 vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
102}
std::vector< size_t > vec
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.