ATLAS Offline Software
ParticleCandidateList.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // ParticleCandidateList.cxx
7 // Implementation file for class ParticleCandidateList
8 // Author: S.Binet<binet@cern.ch>
10 
11 // Framework includes
12 #include "GaudiKernel/GaudiException.h"
13 
14 // AnalysisUtils includes
17 
18 
20  : AthMessaging ("ParticleCandidateList")
21 {}
22 
24  : AthMessaging ("ParticleCandidateList"),
25  m_list(rhs.m_list)
26 {}
27 
28 
29 bool ParticleCandidateList::hasInList( const int& pdgID,
30  const bool tightMatch ) const
31 {
32  ATH_MSG_VERBOSE( "In ParticleCandidateList::hasInList( pdgID ) : " << this
33  << endmsg
34  << "Size of List = " << size() );
35  if ( size() <= unsigned(0) ) {
36  static const std::string error( "List size <=0 !!" );
38  throw GaudiException( error, "ParticleCandidateList",
39  StatusCode::FAILURE );
40  }
41 
42  for ( auto itrPart = m_list.begin();
43  itrPart != m_list.end();
44  ++itrPart ) {//> Loop over the list of intern particles
45  ATH_MSG_VERBOSE( "in loop over list of intern particle candidates"
46  << "\t>>>Comparing pid-s..." );
47  if ( tightMatch && ( (*itrPart) == pdgID ) ) {
48  ATH_MSG_VERBOSE( ">>> " << pdgID << " is in list (" << (*itrPart) << ")" );
49  return true;
50  } else if ( !tightMatch &&
51  std::abs( (*itrPart) ) == std::abs( pdgID ) ) {
52  return true;
53  }
54  }//> end loop over the list of intern particles
55 
56  return false;
57 }
58 
60 {
61  ATH_MSG_VERBOSE("---------------------------------------------------\n"
62  << "Added those particles : " );
63  for ( auto itrPart = m_list.begin();
64  itrPart != m_list.end();
65  ++itrPart ) {
66  ATH_MSG_VERBOSE( "\tpdgID= " << (*itrPart) );
67  }
68 
69  ATH_MSG_VERBOSE ("---------------------------------------------------" );
70 }
71 
76 {
77  m_list.push_back( MC::ELECTRON ); //>e-
78  m_list.push_back( MC::POSITRON ); //>e+
79  m_list.push_back( MC::NU_E ); //>nu_e
80  m_list.push_back( -MC::NU_E ); //>nu_e_bar
81 
82  m_list.push_back( MC::MUON ); //>mu-
83  m_list.push_back( -MC::MUON ); //>mu+
84  m_list.push_back( MC::NU_MU ); //>nuMu
85  m_list.push_back( -MC::NU_MU ); //>nuMu_bar
86 
87  m_list.push_back( MC::TAU ); //>tau-
88  m_list.push_back( -MC::TAU ); //>tau+
89  m_list.push_back( MC::NU_TAU ); //>nuTau
90  m_list.push_back( -MC::NU_TAU ); //>nuTau_bar
91 }
92 
94 {
98  m_list.push_back( 0 ); //> untagged jet : so taken light
99 
100  m_list.push_back( MC::DQUARK ); //> d
101  m_list.push_back( -MC::DQUARK ); //> d_bar
102  m_list.push_back( MC::UQUARK ); //> u
103  m_list.push_back( -MC::UQUARK ); //> u_bar
104  m_list.push_back( MC::CQUARK ); //> c
105  m_list.push_back( -MC::CQUARK ); //> c_bar
106  m_list.push_back( MC::SQUARK ); //> s
107  m_list.push_back( -MC::SQUARK ); //> s_bar
108 }
109 
111 {
112  m_list.push_back( MC::DQUARK ); //> d
113  m_list.push_back( -MC::DQUARK ); //> d_bar
114  m_list.push_back( MC::UQUARK ); //> u
115  m_list.push_back( -MC::UQUARK ); //> u_bar
116  m_list.push_back( MC::CQUARK ); //> c
117  m_list.push_back( -MC::CQUARK ); //> c_bar
118  m_list.push_back( MC::SQUARK ); //> s
119  m_list.push_back( -MC::SQUARK ); //> s_bar
120 }
121 
122 void ParticleCandidateList::add( const std::string& list )
123 {
124  ATH_MSG_VERBOSE( "add( " << list << " )" );
125  if ( list == "LightQuarks" ) addLightQuarks();
126  else if ( list == "BQuark" ) addBQuark();
127  else if ( list == "BbarQuark" ) addBbarQuark();
128  else if ( list == "BQuarks" ) addBQuarks();
129  else if ( list == "Bjet" ||
130  list == "BJet" ) addBjet();
131  else if ( list == "Leptons" ||
132  list == "leptons" ) addLeptons();
133  else if ( list == "W+/-" ) addWBosons();
134  else if ( list == "Z0" ) addZBoson();
135  else {
136  static const std::string error( "Unknown Candidate List Name !!" );
137  ATH_MSG_ERROR( error );
138  throw GaudiException( error, "ParticleCandidateList",
139  StatusCode::FAILURE );
140  }
141 
142  if ( msg().level() <= MSG::VERBOSE ) { dropList();
143  }
144 
145 }
ParticleCandidateList::m_list
std::list< int > m_list
Definition: ParticleCandidateList.h:120
ParticleCandidateList::addLightJets
void addLightJets()
Definition: ParticleCandidateList.cxx:93
ParticleCandidateList::dropList
void dropList() const
Definition: ParticleCandidateList.cxx:59
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ParticleCandidateList::addBbarQuark
void addBbarQuark()
Definition: ParticleCandidateList.h:195
ParticleCandidateList::ParticleCandidateList
ParticleCandidateList()
Default constructor:
Definition: ParticleCandidateList.cxx:19
ParticleCandidateList::list
const std::list< int > & list() const
Return the wrapped STL list.
Definition: ParticleCandidateList.h:140
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
ParticleCandidateList::addZBoson
void addZBoson()
Definition: ParticleCandidateList.h:218
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
ParticleCandidateList::addBQuarks
void addBQuarks()
Definition: ParticleCandidateList.h:200
ParticleCandidateList::addBjet
void addBjet()
Definition: ParticleCandidateList.h:206
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
AthMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AthMessaging.h:164
ParticleCandidateList::addLeptons
void addLeptons()
Non-const methods:
Definition: ParticleCandidateList.cxx:75
ParticleCandidateList::addWBosons
void addWBosons()
Definition: ParticleCandidateList.h:212
ParticleCandidateList::addLightQuarks
void addLightQuarks()
Definition: ParticleCandidateList.cxx:110
ParticleCandidateList::hasInList
bool hasInList(const int &pdgID, const bool tightMatch=false) const
Tells if a given particle or pID is in the list if tightMatch = false : look only if std::abs() of pa...
Definition: ParticleCandidateList.cxx:29
ParticleCandidateList::size
size_type size() const
Definition: ParticleCandidateList.h:160
ParticleCandidateList.h
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
ParticleCandidateList
A simple wrapper for std::list<int> to model a list of particle identity candidates.
Definition: ParticleCandidateList.h:31
get_generator_info.error
error
Definition: get_generator_info.py:40
error
Definition: IImpactPoint3dEstimator.h:70
ParticleCandidateList::add
void add(const int &partID)
Definition: ParticleCandidateList.h:185
ParticleCandidateList::addBQuark
void addBQuark()
Definition: ParticleCandidateList.h:190
HepMCHelpers.h