ATLAS Offline Software
Macros | Functions
AnalysisConfig_Ntuple.cxx File Reference
#include <cstdio>
#include <sys/time.h>
#include "McParticleEvent/TruthParticleContainer.h"
#include "GeneratorObjects/McEventCollection.h"
#include "AtlasHepMC/GenEvent.h"
#include "AtlasHepMC/GenVertex.h"
#include "AtlasHepMC/GenParticle.h"
#include "EventInfo/EventInfo.h"
#include "EventInfo/EventID.h"
#include "xAODEventInfo/EventInfo.h"
#include "TrigInDetAnalysis/TIDDirectory.h"
#include "TrigInDetAnalysisUtils/TIDARoiDescriptorBuilder.h"
#include "TrigInDetAnalysis/Filter_AcceptAll.h"
#include "TrigInDetAnalysisUtils/Filter_etaPT.h"
#include "TrigInDetAnalysisUtils/Filter_RoiSelector.h"
#include "TrigInDetAnalysisUtils/Filters.h"
#include "TrigInDetAnalysisExample/AnalysisConfig_Ntuple.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTrack/Track.h"
#include "VxVertex/VxContainer.h"
#include "muonEvent/MuonContainer.h"
#include "egammaEvent/ElectronContainer.h"
#include "tauEvent/TauJetContainer.h"
#include "TrigSteeringEvent/HLTResult.h"
#include "TrigDecisionTool/ExpertMethods.h"
#include "TrigSteeringEvent/TrigRoiDescriptorCollection.h"
#include "xAODTracking/TrackParticle.h"
#include "xAODTracking/TrackParticleContainer.h"

Go to the source code of this file.

Macros

#define endmsg   endmsg
 

Functions

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

Detailed Description

Author
mark sutton

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

Definition in file AnalysisConfig_Ntuple.cxx.

Macro Definition Documentation

◆ endmsg

#define endmsg   endmsg

Definition at line 64 of file AnalysisConfig_Ntuple.cxx.

Function Documentation

◆ date()

std::string date ( )

sadly, includes a return at the end

Definition at line 67 of file AnalysisConfig_Ntuple.cxx.

67  {
68  time_t t;
69  time(&t);
70  char buf[26];
71  std::string mtime = ctime_r(&t, buf);
72  mtime.erase( std::remove(mtime.begin(), mtime.end(), '\n'), mtime.end() );
73  return mtime;
74 }

◆ fromParent()

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

recursive stopping conditions

recursive stopping conditions

recursive stopping conditions

Definition at line 78 of file AnalysisConfig_Ntuple.cxx.

78  {
79 
80  if ( p==0 ) return 0;
81  if (std::abs(p->pdg_id())==11 || std::abs(p->pdg_id())==13 ) return 0; //don't want light leptons from tau decays
82  if ( std::abs(p->pdg_id())==pdg_id ) return p;
83 
84  auto vertex = p->production_vertex();
85  if ( !vertex) return 0; // has no production vertex !!!
86 
87 #ifdef HEPMC3
88  if ( vertex->particles_in().size() < 1 ) return 0;
89 
91  // if ( printout ) {
92  // TruthParticle t(p);
93  // std::cout << "particle " << *p << " " << t.pdgId() << "\tparent " << p << std::endl;
94  // }
95 
96  for ( auto in: vertex->particles_in()) {
97  auto parent = fromParent( pdg_id, in, printout );
98  TruthParticle t(in);
99  if ( parent && std::abs(parent->pdg_id())==pdg_id) {
100  return parent;
101  }
102  }
103 #else
104  if ( vertex->particles_in_size() < 1 ) return 0;
105 
106  HepMC::GenVertex::particles_in_const_iterator in = vertex->particles_in_const_begin();
107  HepMC::GenVertex::particles_in_const_iterator end = vertex->particles_in_const_end();
108  while ( in!=end ) {
109  const HepMC::GenParticle* parent = fromParent( pdg_id, *in, printout );
110  TruthParticle t(*in);
111  // if ( printout ) std::cout << "\tvalue for particle " << *in << " " << t.pdgId() << "\tparent " << parent << std::endl;
112  if ( parent && std::abs(parent->pdg_id())==pdg_id) {
113  //if ( printout ) std::cout << "found tau! - in parents" << std::endl;
114  return parent;
115  }
116  in++;
117  }
118 #endif
119 
120  return 0;
121 }

◆ remove_duplicates()

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

Definition at line 126 of file AnalysisConfig_Ntuple.cxx.

126  {
127  std::sort(vec.begin(), vec.end());
128  vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
129 }
fromParent
HepMC::ConstGenParticlePtr fromParent(int pdg_id, HepMC::ConstGenParticlePtr p, bool printout=false)
Definition: AnalysisConfig_Ntuple.cxx:78
TruthParticle
Definition: PhysicsAnalysis/TruthParticleID/McParticleEvent/McParticleEvent/TruthParticle.h:58
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
PixelModuleFeMask_create_db.remove
string remove
Definition: PixelModuleFeMask_create_db.py:83
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
python.DecayParser.buf
buf
print ("=> [%s]"cmd)
Definition: DecayParser.py:27
test_pyathena.parent
parent
Definition: test_pyathena.py:15
taskman.mtime
mtime
Definition: taskman.py:313
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
GenParticle
@ GenParticle
Definition: TruthClasses.h:30