ATLAS Offline Software
Loading...
Searching...
No Matches
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.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.

Private Member Functions

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

Private Attributes

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

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:
 ParticleCandidateList (const ParticleCandidateList &rhs)
 Copy constructor:
virtual ~ParticleCandidateList ()
 Destructor:
ParticleCandidateListoperator= (const ParticleCandidateList &rhs)
 Assignment operator:
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.
void dropList () const
const std::list< int > & list () const
 Return the wrapped STL list.

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
void clear ()
 forward the std::list<int>::clear() method
void addLeptons ()
 Non-const methods:
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

Definition at line 40 of file ParticleCandidateList.h.

◆ size_type

typedef std::list<int>::size_type ParticleCandidateList::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{}
AthMessaging()
Default constructor:

◆ 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}
void push_back(const int &id)
forward the std::list<int>::push_back() method

◆ 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}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_VERBOSE(x)
MsgStream & msg() const
The standard message stream.
const std::list< int > & list() const
Return the wrapped STL list.
void addLeptons()
Non-const methods:

◆ addBbarQuark()

void ParticleCandidateList::addBbarQuark ( )
inline

Definition at line 195 of file ParticleCandidateList.h.

196{
197 add( -MC::BQUARK ); //> b_bar
198}
void add(const int &partID)

◆ 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 !!" );
37 ATH_MSG_ERROR( error );
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}
#define endmsg

◆ 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 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)

◆ 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 163 of file AthMessaging.h.

164{
165 MsgStream* ms = m_msg_tls.get();
166 if (!ms) {
167 if (!m_initialized.test_and_set()) initMessaging();
168 ms = new MsgStream(m_imsg,m_nm);
169 m_msg_tls.reset( ms );
170 }
171
172 ms->setLevel (m_lvl);
173 return *ms;
174}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels)
void initMessaging() const
Initialize our message level and MessageSvc.

◆ 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 178 of file AthMessaging.h.

179{ 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_lvl <= lvl) {
154 msg() << lvl;
155 return true;
156 } else {
157 return false;
158 }
159}

◆ 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.

135{ nullptr };

◆ 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.

138{ MSG::NIL };

◆ 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: