ATLAS Offline Software
Base.h
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // Base.h
8 // Header file for class Base
9 // Author: S.Binet<binet@cern.ch>
11 #ifndef PARTICLEEVENT_PARTICLEEVENTBASE_H
12 #define PARTICLEEVENT_PARTICLEEVENTBASE_H
13 
14 // STL includes
15 #include <iosfwd>
16 
17 // EventKernel includes
18 #include "EventKernel/IParticle.h" // for {Charge,ParticleDataType::Data}Type
19 
20 // VxVertex includes
21 #include "VxVertex/VxContainer.h"
22 #include "VxVertex/VxCandidate.h"
23 #include "VxVertex/RecVertex.h"
24 
25 // AthenaBarCode includes
27 #include "AthLinks/ElementLink.h"
28 
29 // Forward declaration
30 
31 namespace ParticleEvent {
32 
33 class Base
34 {
35 
37  // Public methods:
39  public:
40 
43  Base();
44 
47  explicit Base( const Base& rhs );
48 
51  Base& operator=( const Base& rhs );
52 
58  virtual ~Base();
59 
61  // Const methods:
63 
71 
73  const Trk::RecVertex* origin() const;
74 
76  const ElementLink<VxContainer>& originLink() const;
77 
79  bool hasCharge() const;
80 
84  ChargeType charge() const;
85 
87  bool hasPdgId() const;
88 
91  int pdgId() const;
92 
94  std::ostream& dump( std::ostream& out ) const;
95 
96  const AthenaBarCodeImpl& getAthenaBarCodeImpl() const {return m_abc;}
100  // Non-const methods:
103 
104  // Set functions (for IParticle)
106  void set_charge( ChargeType x );
107  void set_pdgId( int x );
108  void reset_charge();
109  void reset_pdgId();
110  void set_origin( const VxContainer* theContainer, int index );
111  void set_origin( const VxContainer* theContainer,
112  const Trk::VxCandidate * vertex );
114 
117  // Protected data:
119  private:
120 
124 
128 
132 
137 
141 
145  int m_pdgId;
146 
149 
150 
151 };
152 
154 // I/O functions
156 std::ostream& operator<<( std::ostream& out, const Base& base );
157 
159 // Inline methods:
161 
162 inline
164  m_dataType ( ),
165  m_origin ( ),
166  m_hasCharge( false ),
167  m_charge ( 0. ),
168  m_hasPdgId ( false ),
169  m_pdgId ( 0 ),
170  m_abc ()
171 {}
172 
173 inline
174 Base::Base( const Base& rhs ) :
175  m_dataType ( rhs.m_dataType ),
176  m_origin ( rhs.m_origin ),
177  m_hasCharge( rhs.m_hasCharge ),
178  m_charge ( rhs.m_charge ),
179  m_hasPdgId ( rhs.m_hasPdgId ),
180  m_pdgId ( rhs.m_pdgId ),
181  m_abc ( rhs.m_abc)
182 {}
183 
184 inline
185 Base& Base::operator=( const Base& rhs )
186 {
187  if ( this != &rhs ) {
188  m_dataType = rhs.m_dataType;
189  m_origin = rhs.m_origin;
190  m_hasCharge = rhs.m_hasCharge;
191  m_charge = rhs.m_charge;
192  m_hasPdgId = rhs.m_hasPdgId;
193  m_pdgId = rhs.m_pdgId;
194  m_abc = rhs.m_abc;
195  }
196  return *this;
197 }
198 
199 inline
201 {}
202 
205 {
206  return m_dataType;
207 }
208 
209 inline const Trk::RecVertex*
211 {
212  return (!m_origin.isValid())
213  ? 0
214  : &(**m_origin).recVertex();
215 }
216 
217 inline bool
219 {
220  return m_hasCharge;
221 }
222 
223 inline ChargeType
224 Base::charge() const
225 {
226  return m_charge;
227 }
228 
229 inline bool
231 {
232  return m_hasPdgId;
233 }
234 
235 inline int
236 Base::pdgId() const
237 {
238  return m_pdgId;
239 }
240 
241 // --------------------
242 // non-const interface
243 // --------------------
244 
245 inline
246 void
248 {
249  m_dataType = x;
250 }
251 
252 inline
253 void
255 {
256  m_charge = x;
257  m_hasCharge = true;
258 }
259 
260 inline
261 void
263 {
264  m_pdgId = x;
265  m_hasPdgId = true;
266 }
267 
268 inline
269 void
271 {
272  m_hasCharge = false;
273 }
274 
275 inline
276 void
278 {
279  m_hasPdgId = false;
280 }
281 
282 inline
283 void
284 Base::set_origin( const VxContainer* theContainer, int index )
285 {
286  m_origin = ElementLink< VxContainer >(*theContainer, index);
287 }
288 
289 inline
290 void
291 Base::set_origin( const VxContainer* theContainer,
292  const Trk::VxCandidate * vertex )
293 {
295  ((vertex),*theContainer );
296 }
297 
298 inline
299 void
301 {
302  m_origin = origin;
303 }
304 
305 } //> end namespace ParticleEvent
306 
307 #endif //> PARTICLEEVENT_PARTICLEEVENTBASE_H
RecVertex.h
base
std::string base
Definition: hcg.cxx:78
AthenaBarCodeImpl.h
ParticleEvent::Base::getAthenaBarCodeImpl
AthenaBarCodeImpl & getAthenaBarCodeImpl()
Definition: Base.h:115
ParticleEvent::Base::reset_charge
void reset_charge()
Definition: Base.h:270
ParticleEvent::Base::m_charge
ChargeType m_charge
Value of the charge of the particle (this has real meaning, only if hasCharge() returns true)
Definition: Base.h:136
ParticleEvent::Base::m_hasPdgId
bool m_hasPdgId
Switch to tell if this particle has a PDG Identity.
Definition: Base.h:140
ParticleEvent::Base::m_pdgId
int m_pdgId
Value for the PDG identity (this has real meaning, only if hasPdgId() returns true)
Definition: Base.h:145
ParticleEvent::Base::set_dataType
void set_dataType(ParticleDataType::DataType x)
Definition: Base.h:247
AthenaBarCodeImpl
Definition: AthenaBarCodeImpl.h:37
ParticleEvent::Base::reset_pdgId
void reset_pdgId()
Definition: Base.h:277
index
Definition: index.py:1
ParticleEvent
Definition: Base.h:31
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
ParticleEvent::Base::hasCharge
bool hasCharge() const
method to check if charge information is available
Definition: Base.h:218
IParticle.h
ParticleEvent::Base::m_hasCharge
bool m_hasCharge
Switch to tell if this particle has a charge.
Definition: Base.h:131
ParticleEvent::Base::charge
ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
Definition: Base.h:224
x
#define x
ParticleDataType::DataType
DataType
Definition: Event/EventKernel/EventKernel/IParticle.h:36
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
ParticleEvent::Base::m_origin
ElementLink< VxContainer > m_origin
Persistent pointer to the origin of this particle.
Definition: Base.h:127
ParticleEvent::Base::set_charge
void set_charge(ChargeType x)
Definition: Base.h:254
ParticleEvent::Base::m_dataType
ParticleDataType::DataType m_dataType
the enum storing the (data) type of this particle
Definition: Base.h:123
ParticleEvent::Base::pdgId
int pdgId() const
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....
Definition: Base.h:236
ParticleEvent::Base::operator=
Base & operator=(const Base &rhs)
Assignment operator:
Definition: Base.h:185
ParticleEvent::Base
Definition: Base.h:34
ParticleEvent::Base::~Base
virtual ~Base()
Constructor with parameters:
Definition: Base.h:200
VxContainer.h
VxContainer
Definition: VxContainer.h:28
VxCandidate.h
ParticleEvent::Base::getAthenaBarCodeImpl
const AthenaBarCodeImpl & getAthenaBarCodeImpl() const
Definition: Base.h:96
ParticleEvent::Base::m_abc
AthenaBarCodeImpl m_abc
The AthenaBarCode Part.
Definition: Base.h:148
ParticleEvent::Base::hasPdgId
bool hasPdgId() const
method to check if particle id information is available
Definition: Base.h:230
ChargeType
double ChargeType
typedef ChargeType used to anticipate changes here
Definition: Event/EventKernel/EventKernel/IParticle.h:40
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
ParticleEvent::Base::Base
Base()
Default constructor:
Definition: Base.h:163
Trk::VxCandidate
Definition: VxCandidate.h:27
ParticleEvent::operator<<
std::ostream & operator<<(std::ostream &out, const Base &base)
Definition: Base.cxx:71
ParticleEvent::Base::dataType
ParticleDataType::DataType dataType() const
Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the f...
Definition: Base.h:204
ParticleEvent::Base::dump
std::ostream & dump(std::ostream &out) const
Print IParticle content.
Definition: Base.cxx:44
ParticleEvent::Base::set_origin
void set_origin(const VxContainer *theContainer, int index)
Definition: Base.h:284
ParticleEvent::Base::origin
const Trk::RecVertex * origin() const
Return a RecVertex corresponding to particle Origin
Definition: Base.h:210
ParticleEvent::Base::set_pdgId
void set_pdgId(int x)
Definition: Base.h:262
ParticleEvent::Base::originLink
const ElementLink< VxContainer > & originLink() const
Return the ElementLink to particle Origin
Definition: Base.cxx:38