ATLAS Offline Software
TruthParticleBase.cxx
Go to the documentation of this file.
1 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 // TruthParticleBase.cxx
8 // Implementation file for class TruthParticleBase
9 // Author: S.Binet<binet@cern.ch>
11 
12 
13 // STL includes
14 #include <ostream>
15 #include <sstream>
16 #include <iomanip>
17 
18 // McParticleEvent includes
20 
22 // Public methods:
24 
25 // Constructors
27 
29  m_charge ( -999. ),
30  m_genParticle( 0 ),
31  m_abc ()
32 {}
33 
35  m_charge ( rhs.m_charge ),
36  m_genParticle( rhs.m_genParticle ),
37  m_abc ( rhs.m_abc)
38 {}
39 
42 {
43  if ( this != &rhs ) {
44  m_charge = rhs.m_charge;
46  m_abc = rhs.m_abc;
47  }
48  return *this;
49 }
50 
52  m_charge ( -999. ),
53  m_genParticle( mc ),
54  m_abc ()
55 {}
56 
57 
58 // Destructor
60 
62 {}
63 
65 // Const methods:
67 
68 const Trk::RecVertex*
70 {
71  return 0;
72 }
73 
77 {
78  static const ElementLink<VxContainer> origin;
79  return origin;
80 }
81 
82 
83 std::ostream& TruthParticleBase::dump( std::ostream& out ) const
84 {
85  std::stringstream buf;
86  buf << "[dataType] = " << this->dataType() << "\n"
87 
88  << "[charge ] = "
89  << std::setw(5) << std::boolalpha << this->hasCharge()
90  << std::scientific << std::right << std::setw(16) << std::setprecision(8)
91  << this->charge() << "\n"
92 
93  << "[pdg-Id ] = " << std::setw(5) << std::boolalpha << this->hasPdgId()
94  << std::fixed << std::right << std::setw(16) << std::setprecision(8)
95  << this->pdgId() << "\n"
96 
97  << "[origin ] = --Null ptr-- ";
98 
99  out << buf.str();
100 
101  //Dump the AthenaBarCode Part
102  m_abc.dump(out);
103 
104  return out;
105 }
106 
108 // I/O functions
110 std::ostream& operator<<( std::ostream& out, const TruthParticleBase& o )
111 {
112  return o.dump( out );
113 }
TruthParticleBase::m_abc
AthenaBarCodeImpl m_abc
The AthenaBarCodeImpl held to provide unique identification throughout the whole Atlas EDM.
Definition: TruthParticleBase.h:141
TruthParticleBase::operator=
TruthParticleBase & operator=(const TruthParticleBase &rhs)
Assignment operator:
Definition: TruthParticleBase.cxx:41
TruthParticleBase::hasPdgId
bool hasPdgId() const
method to check if particle id information is available
Definition: TruthParticleBase.h:168
TruthParticleBase::dump
std::ostream & dump(std::ostream &out) const
Print IParticle content.
Definition: TruthParticleBase.cxx:83
TruthParticleBase::m_genParticle
HepMC::ConstGenParticlePtr m_genParticle
The HepMC::GenParticle we are proxying.
Definition: TruthParticleBase.h:137
HepMC::GenParticlePtr
GenParticle * GenParticlePtr
Definition: GenParticle.h:37
TruthParticleBase.h
TruthParticleBase
Definition: TruthParticleBase.h:34
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
TruthParticleBase::~TruthParticleBase
~TruthParticleBase()
Destructor:
Definition: TruthParticleBase.cxx:61
operator<<
std::ostream & operator<<(std::ostream &out, const TruthParticleBase &o)
Definition: TruthParticleBase.cxx:110
TruthParticleBase::pdgId
int pdgId() const
Return eparticle id.
Definition: TruthParticleBase.h:174
Trk::RecVertex
Trk::RecVertex inherits from Trk::Vertex.
Definition: RecVertex.h:44
TruthParticleBase::charge
ChargeType charge() const
returns charge as a typedef ChargeType currently Charge Type is a double for jets this may be changed...
Definition: TruthParticleBase.h:162
mc
Definition: mc.PG_single_nu_valid.py:1
TruthParticleBase::hasCharge
bool hasCharge() const
method to check if charge information is available
Definition: TruthParticleBase.h:156
TruthParticleBase::TruthParticleBase
TruthParticleBase()
Default constructor:
Definition: TruthParticleBase.cxx:28
TruthParticleBase::origin
const Trk::RecVertex * origin() const
Return a RecVertex corresponding to particle Origin
Definition: TruthParticleBase.cxx:69
TruthParticleBase::dataType
ParticleDataType::DataType dataType() const
Return enum indicating real data, fast, or full simulation Return Type has a DataType enum with the f...
Definition: TruthParticleBase.h:150
TruthParticleBase::originLink
const ElementLink< VxContainer > & originLink() const
Return the ElementLink to particle Origin
Definition: TruthParticleBase.cxx:76
TruthParticleBase::m_charge
ChargeType m_charge
The charge of this TruthParticle.
Definition: TruthParticleBase.h:134
AthenaBarCodeImpl::dump
std::ostream & dump(std::ostream &out) const
Definition: AthenaBarCodeImpl.cxx:172