ATLAS Offline Software
Loading...
Searching...
No Matches
Base.h
Go to the documentation of this file.
1
2
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
23#include "VxVertex/RecVertex.h"
24
25// AthenaBarCode includes
27#include "AthLinks/ElementLink.h"
28
29// Forward declaration
30
31namespace ParticleEvent {
32
33class 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
55
58 virtual ~Base();
59
61 // Const methods:
63
66
71
73 const Trk::RecVertex* origin() const;
74
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
99
101 // 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
146
149
150
151};
152
154// I/O functions
156std::ostream& operator<<( std::ostream& out, const Base& base );
157
159// Inline methods:
161
162inline
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
173inline
174Base::Base( const Base& rhs ) :
175 m_dataType ( rhs.m_dataType ),
176 m_origin ( rhs.m_origin ),
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
184inline
186{
187 if ( this != &rhs ) {
189 m_origin = rhs.m_origin;
191 m_charge = rhs.m_charge;
193 m_pdgId = rhs.m_pdgId;
194 m_abc = rhs.m_abc;
195 }
196 return *this;
197}
198
199inline
202
205{
206 return m_dataType;
207}
208
209inline const Trk::RecVertex*
211{
212 return (!m_origin.isValid())
213 ? 0
214 : &(**m_origin).recVertex();
215}
216
217inline bool
219{
220 return m_hasCharge;
221}
222
223inline ChargeType
225{
226 return m_charge;
227}
228
229inline bool
231{
232 return m_hasPdgId;
233}
234
235inline int
237{
238 return m_pdgId;
239}
240
241// --------------------
242// non-const interface
243// --------------------
244
245inline
246void
251
252inline
253void
255{
256 m_charge = x;
257 m_hasCharge = true;
258}
259
260inline
261void
263{
264 m_pdgId = x;
265 m_hasPdgId = true;
266}
267
268inline
269void
271{
272 m_hasCharge = false;
273}
274
275inline
276void
278{
279 m_hasPdgId = false;
280}
281
282inline
283void
284Base::set_origin( const VxContainer* theContainer, int index )
285{
286 m_origin = ElementLink< VxContainer >(*theContainer, index);
287}
288
289inline
290void
291Base::set_origin( const VxContainer* theContainer,
292 const Trk::VxCandidate * vertex )
293{
295 ((vertex),*theContainer );
296}
297
298inline
299void
304
305} //> end namespace ParticleEvent
306
307#endif //> PARTICLEEVENT_PARTICLEEVENTBASE_H
double ChargeType
typedef ChargeType used to anticipate changes here
#define x
bool hasCharge() const
method to check if charge information is available
Definition Base.h:218
int m_pdgId
Value for the PDG identity (this has real meaning, only if hasPdgId() returns true)
Definition Base.h:145
void set_charge(ChargeType x)
Definition Base.h:254
void set_dataType(ParticleDataType::DataType x)
Definition Base.h:247
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
AthenaBarCodeImpl m_abc
The AthenaBarCode Part.
Definition Base.h:148
ParticleDataType::DataType m_dataType
the enum storing the (data) type of this particle
Definition Base.h:123
Base & operator=(const Base &rhs)
Assignment operator:
Definition Base.h:185
void set_origin(const VxContainer *theContainer, int index)
Definition Base.h:284
AthenaBarCodeImpl & getAthenaBarCodeImpl()
Definition Base.h:115
void reset_charge()
Definition Base.h:270
Base()
Default constructor:
Definition Base.h:163
void set_pdgId(int x)
Definition Base.h:262
virtual ~Base()
Constructor with parameters:
Definition Base.h:200
bool m_hasCharge
Switch to tell if this particle has a charge.
Definition Base.h:131
ChargeType m_charge
Value of the charge of the particle (this has real meaning, only if hasCharge() returns true)
Definition Base.h:136
const AthenaBarCodeImpl & getAthenaBarCodeImpl() const
Definition Base.h:96
const Trk::RecVertex * origin() const
Return a RecVertex corresponding to particle Origin.
Definition Base.h:210
const ElementLink< VxContainer > & originLink() const
Return the ElementLink to particle Origin.
Definition Base.cxx:38
ElementLink< VxContainer > m_origin
Persistent pointer to the origin of this particle.
Definition Base.h:127
bool hasPdgId() const
method to check if particle id information is available
Definition Base.h:230
bool m_hasPdgId
Switch to tell if this particle has a PDG Identity.
Definition Base.h:140
int pdgId() const
Return enum indicating particle id the enum file is available in Event/EventKernel/PdtPdg....
Definition Base.h:236
void reset_pdgId()
Definition Base.h:277
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
Trk::RecVertex inherits from Trk::Vertex.
Definition RecVertex.h:44
std::string base
Definition hcg.cxx:81
std::ostream & operator<<(std::ostream &out, const Base &base)
Definition Base.cxx:71
-event-from-file
Definition index.py:1