ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
ParticleCandidateList Class Reference

A simple wrapper for std::list<int> to model a list of particle identity candidates. More...

#include <ParticleCandidateList.h>

Inheritance diagram for ParticleCandidateList:
Collaboration diagram for ParticleCandidateList:

Public Member Functions

bool msgLvl (const MSG::Level lvl) const
 Test the output level. More...
 
MsgStream & msg () const
 The standard message stream. More...
 
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream. More...
 
void setLevel (MSG::Level lvl)
 Change the current logging level. More...
 

Private Member Functions

void initMessaging () const
 Initialize our message level and MessageSvc. More...
 

Private Attributes

std::string m_nm
 Message source name. More...
 
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels) More...
 
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer. More...
 
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level. More...
 
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging) More...
 

list typedefs: it behaves like a std::list<int>

typedef std::list< int >::iterator iterator
 
typedef std::list< int >::const_iterator const_iterator
 
typedef std::list< int >::size_type size_type
 
 ParticleCandidateList ()
 Default constructor: More...
 
 ParticleCandidateList (const ParticleCandidateList &rhs)
 Copy constructor: More...
 
virtual ~ParticleCandidateList ()
 Destructor: More...
 
ParticleCandidateListoperator= (const ParticleCandidateList &rhs)
 Assignment operator: More...
 
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 particle data group id-s matches. More...
 
void dropList () const
 
const std::list< int > & list () const
 Return the wrapped STL list. More...
 

forward some of the std::list<int> const methods

std::list< int > m_list
 
const_iterator begin () const
 
const_iterator end () const
 
bool empty () const
 
size_type size () const
 
size_type max_size () const
 
void push_back (const int &id)
 forward the std::list<int>::push_back() method More...
 
void clear ()
 forward the std::list<int>::clear() method More...
 
void addLeptons ()
 Non-const methods:
More...
 
void addLightJets ()
 
void addLightQuarks ()
 
void addBQuark ()
 
void addBbarQuark ()
 
void addBQuarks ()
 
void addBjet ()
 
void addWBosons ()
 
void addZBoson ()
 
void add (const int &partID)
 
void add (const std::string &listOfParticlesName="LightQuarks")
 

Detailed Description

A simple wrapper for std::list<int> to model a list of particle identity candidates.

This candidate list is used by the PdgIdFilter and McVtxFilter to select for particles which might fulfill some criterion (well in our case this is its Particle Data Group identity.

Definition at line 29 of file ParticleCandidateList.h.

Member Typedef Documentation

◆ const_iterator

Definition at line 41 of file ParticleCandidateList.h.

◆ iterator

typedef std::list<int>::iterator ParticleCandidateList::iterator

Definition at line 40 of file ParticleCandidateList.h.

◆ size_type

Definition at line 42 of file ParticleCandidateList.h.

Constructor & Destructor Documentation

◆ ParticleCandidateList() [1/2]

ParticleCandidateList::ParticleCandidateList ( )

Default constructor:

Definition at line 19 of file ParticleCandidateList.cxx.

20  : AthMessaging ("ParticleCandidateList")
21 {}

◆ ParticleCandidateList() [2/2]

ParticleCandidateList::ParticleCandidateList ( const ParticleCandidateList rhs)

Copy constructor:

Definition at line 23 of file ParticleCandidateList.cxx.

24  : AthMessaging ("ParticleCandidateList"),
25  m_list(rhs.m_list)
26 {}

◆ ~ParticleCandidateList()

ParticleCandidateList::~ParticleCandidateList ( )
inlinevirtual

Destructor:

Definition at line 124 of file ParticleCandidateList.h.

125 {}

Member Function Documentation

◆ add() [1/2]

void ParticleCandidateList::add ( const int &  partID)
inline

Definition at line 185 of file ParticleCandidateList.h.

186 {
187  push_back( partID );
188 }

◆ add() [2/2]

void ParticleCandidateList::add ( const std::string &  listOfParticlesName = "LightQuarks")

Definition at line 122 of file ParticleCandidateList.cxx.

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 }

◆ addBbarQuark()

void ParticleCandidateList::addBbarQuark ( )
inline

Definition at line 195 of file ParticleCandidateList.h.

196 {
197  add( -MC::BQUARK ); //> b_bar
198 }

◆ addBjet()

void ParticleCandidateList::addBjet ( )
inline

Definition at line 206 of file ParticleCandidateList.h.

207 {
208  add( MC::BQUARK ); //> b
209  add( -MC::BQUARK ); //> b_bar
210 }

◆ addBQuark()

void ParticleCandidateList::addBQuark ( )
inline

Definition at line 190 of file ParticleCandidateList.h.

191 {
192  add( MC::BQUARK ); //> b
193 }

◆ addBQuarks()

void ParticleCandidateList::addBQuarks ( )
inline

Definition at line 200 of file ParticleCandidateList.h.

201 {
202  add( MC::BQUARK ); //> b
203  add( -MC::BQUARK ); //> b_bar
204 }

◆ addLeptons()

void ParticleCandidateList::addLeptons ( )

Non-const methods:

Definition at line 75 of file ParticleCandidateList.cxx.

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 }

◆ addLightJets()

void ParticleCandidateList::addLightJets ( )

To cope with Full Reconstruction scheme : a light-jet, is a jet which could not have been tagged One has also to add PDG::null to the matching list

Definition at line 93 of file ParticleCandidateList.cxx.

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 }

◆ addLightQuarks()

void ParticleCandidateList::addLightQuarks ( )

Definition at line 110 of file ParticleCandidateList.cxx.

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 }

◆ addWBosons()

void ParticleCandidateList::addWBosons ( )
inline

Definition at line 212 of file ParticleCandidateList.h.

213 {
214  add( MC::WPLUSBOSON ); //> W+
215  add( -MC::WPLUSBOSON ); //> W-
216  }

◆ addZBoson()

void ParticleCandidateList::addZBoson ( )
inline

Definition at line 218 of file ParticleCandidateList.h.

219 {
220  add( MC::Z0BOSON );
221 }

◆ begin()

ParticleCandidateList::const_iterator ParticleCandidateList::begin ( ) const
inline

Definition at line 145 of file ParticleCandidateList.h.

146 {
147  return m_list.begin();
148 }

◆ clear()

void ParticleCandidateList::clear ( )
inline

forward the std::list<int>::clear() method

Definition at line 180 of file ParticleCandidateList.h.

181 {
182  m_list.clear();
183 }

◆ dropList()

void ParticleCandidateList::dropList ( ) const

Definition at line 59 of file ParticleCandidateList.cxx.

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 }

◆ empty()

bool ParticleCandidateList::empty ( ) const
inline

Definition at line 155 of file ParticleCandidateList.h.

156 {
157  return m_list.empty();
158 }

◆ end()

ParticleCandidateList::const_iterator ParticleCandidateList::end ( ) const
inline

Definition at line 150 of file ParticleCandidateList.h.

151 {
152  return m_list.end();
153 }

◆ hasInList()

bool ParticleCandidateList::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 particle data group id-s matches.

Definition at line 29 of file ParticleCandidateList.cxx.

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 }

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40 {
42  m_lvl = m_imsg ?
43  static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
44  MSG::INFO;
45 }

◆ list()

const std::list< int > & ParticleCandidateList::list ( ) const
inline

Return the wrapped STL list.

Definition at line 140 of file ParticleCandidateList.h.

141 {
142  return m_list;
143 }

◆ max_size()

ParticleCandidateList::size_type ParticleCandidateList::max_size ( ) const
inline

Definition at line 165 of file ParticleCandidateList.h.

166 {
167  return m_list.max_size();
168 }

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 164 of file AthMessaging.h.

165 {
166  MsgStream* ms = m_msg_tls.get();
167  if (!ms) {
168  if (!m_initialized.test_and_set()) initMessaging();
169  ms = new MsgStream(m_imsg,m_nm);
170  m_msg_tls.reset( ms );
171  }
172 
173  ms->setLevel (m_lvl);
174  return *ms;
175 }

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level  lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 179 of file AthMessaging.h.

180 { return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152 {
153  if (!m_initialized.test_and_set()) initMessaging();
154  if (m_lvl <= lvl) {
155  msg() << lvl;
156  return true;
157  } else {
158  return false;
159  }
160 }

◆ operator=()

ParticleCandidateList & ParticleCandidateList::operator= ( const ParticleCandidateList rhs)
inline

Assignment operator:

Definition at line 129 of file ParticleCandidateList.h.

130 {
131  if ( this != &rhs ) {
132  m_list = rhs.m_list;
133  }
134  return *this;
135 }

◆ push_back()

void ParticleCandidateList::push_back ( const int &  id)
inline

forward the std::list<int>::push_back() method

Definition at line 175 of file ParticleCandidateList.h.

176 {
177  m_list.push_back( partID );
178 }

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level  lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29 {
30  m_lvl = lvl;
31 }

◆ size()

ParticleCandidateList::size_type ParticleCandidateList::size ( ) const
inline

Definition at line 160 of file ParticleCandidateList.h.

161 {
162  return m_list.size();
163 }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging)

Definition at line 141 of file AthMessaging.h.

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

◆ m_list

std::list<int> ParticleCandidateList::m_list
protected

Definition at line 120 of file ParticleCandidateList.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels)

Definition at line 132 of file AthMessaging.h.

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.


The documentation for this class was generated from the following files:
AthMessaging::m_lvl
std::atomic< MSG::Level > m_lvl
Current logging level.
Definition: AthMessaging.h:138
python.CreateTierZeroArgdict.partID
partID
Definition: CreateTierZeroArgdict.py:135
ParticleCandidateList::m_list
std::list< int > m_list
Definition: ParticleCandidateList.h:120
ParticleCandidateList::dropList
void dropList() const
Definition: ParticleCandidateList.cxx:59
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthMessaging::m_imsg
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
Definition: AthMessaging.h:135
python.SystemOfUnits.ms
int ms
Definition: SystemOfUnits.py:132
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
ParticleCandidateList::push_back
void push_back(const int &id)
forward the std::list<int>::push_back() method
Definition: ParticleCandidateList.h:175
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
ParticleCandidateList::addBbarQuark
void addBbarQuark()
Definition: ParticleCandidateList.h:195
AthMessaging::AthMessaging
AthMessaging()
Default constructor:
ParticleCandidateList::list
const std::list< int > & list() const
Return the wrapped STL list.
Definition: ParticleCandidateList.h:140
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
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
ParticleCandidateList::addBQuarks
void addBQuarks()
Definition: ParticleCandidateList.h:200
ParticleCandidateList::addBjet
void addBjet()
Definition: ParticleCandidateList.h:206
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
AthMessaging::m_nm
std::string m_nm
Message source name.
Definition: AthMessaging.h:129
ParticleCandidateList::size
size_type size() const
Definition: ParticleCandidateList.h:160
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
AthMessaging::initMessaging
void initMessaging() const
Initialize our message level and MessageSvc.
Definition: AthMessaging.cxx:39
get_generator_info.error
error
Definition: get_generator_info.py:40
AthMessaging::m_msg_tls
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
Definition: AthMessaging.h:132
error
Definition: IImpactPoint3dEstimator.h:70
ParticleCandidateList::add
void add(const int &partID)
Definition: ParticleCandidateList.h:185
ParticleCandidateList::addBQuark
void addBQuark()
Definition: ParticleCandidateList.h:190