LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ReconstructedParticleImpl.cc
Go to the documentation of this file.
2 #include <algorithm>
3 #include "IMPL/ParticleIDImpl.h"
4 
5 
6 using namespace EVENT ;
7 
8 namespace IMPL{
9 
10 
11  ReconstructedParticleImpl::ReconstructedParticleImpl() :
12  _type(0) ,
13  _energy(0) ,
14  _mass(0) ,
15  _charge(0),
16  _pidUsed(0),
17  _goodnessOfPID(0),
18  _sv(0)
19  //_ev(0)
20  {
22  // for(int i=0 ; i < NCOVARIANCE ; i++ ) { _cov.push_back( 0.0 ) ; }
23  _momentum[0] = 0. ;
24  _momentum[1] = 0. ;
25  _momentum[2] = 0. ;
26  _reference[0] = 0. ;
27  _reference[1] = 0. ;
28  _reference[2] = 0. ;
29  }
30 
32  // delete the pids owned by this particle
33  for( ParticleIDVec::iterator iter = _pid.begin() ; iter != _pid.end() ; iter++){
34  delete *iter ;
35  }
36  }
37 
38  int ReconstructedParticleImpl::getType() const { return _type ; }
39 // bool ReconstructedParticleImpl::isPrimary() const { return _primary ;}
40 
41  const double* ReconstructedParticleImpl::getMomentum() const { return _momentum ; }
42  double ReconstructedParticleImpl::getEnergy() const { return _energy ; }
44  double ReconstructedParticleImpl::getMass() const { return _mass ; }
45  float ReconstructedParticleImpl::getCharge() const { return _charge ; }
46  const float* ReconstructedParticleImpl::getReferencePoint() const { return _reference ; }
47 
48 
50 
52  return _goodnessOfPID ;
53  }
55 
57 // const EVENT::FloatVec & ReconstructedParticleImpl::getParticleWeights() const { return _particleWeights ; }
58 
60 // const EVENT::FloatVec & ReconstructedParticleImpl::getClusterWeights() const { return _clusterWeights ; }
61 
63 // const EVENT::FloatVec & ReconstructedParticleImpl::getTrackWeights() const { return _trackWeights ; }
64 
65 // const EVENT::MCParticleVec& ReconstructedParticleImpl::getMCParticles() const { return _mcParticles ; }
66 // const EVENT::FloatVec & ReconstructedParticleImpl::getMCParticleWeights() const { return _mcParticleWeights ; }
67 
69 
70  //EVENT::Vertex * ReconstructedParticleImpl::getEndVertex() const { return _ev ; }
71 
73  if(getParticles().size()!=0){
74  return getParticles().at(0)->getStartVertex();
75  }
76  return NULL;
77  }
78 
80  checkAccess("ReconstructedParticleImpl::setStartVertex" );
81  _sv = sv;
82  }
83 
84  /*
85  void ReconstructedParticleImpl::setEndVertex( EVENT::Vertex *ev ){
86  checkAccess("ReconstructedParticleImpl::setEndVertex" );
87  _ev = ev;
88  }
89 */
90 
92  checkAccess("ReconstructedParticleImpl::setType" );
93  _type = type ;
94  }
95 
96 // void ReconstructedParticleImpl::setPrimary(bool primary){
97 // checkAccess("ReconstructedParticleImpl::setPrimary" );
98 // _primary = primary ;
99 // }
100 
101 // void ReconstructedParticleImpl::setTypeFlag( int typeFlag){
102 // checkAccess("ReconstructedParticleImpl::setTypeFlag" );
103 // _typeFlag = typeFlag ;
104 // }
105 
106  void ReconstructedParticleImpl::setMomentum( const float* momentum ){
107  checkAccess("ReconstructedParticleImpl::setMomentum" );
108  _momentum[0] = momentum[0] ;
109  _momentum[1] = momentum[1] ;
110  _momentum[2] = momentum[2] ;
111  }
112 
113  void ReconstructedParticleImpl::setMomentum( const double* momentum ){
114  checkAccess("ReconstructedParticleImpl::setMomentum" );
115  _momentum[0] = momentum[0] ;
116  _momentum[1] = momentum[1] ;
117  _momentum[2] = momentum[2] ;
118  }
119 
121  checkAccess("ReconstructedParticleImpl::setEnergy" );
122  _energy = energy ;
123  }
124 
125  void ReconstructedParticleImpl::setCovMatrix( const float* cov ){
126  checkAccess("ReconstructedParticleImpl::setCovMatrix" );
127  for(int i=0;i<NCOVARIANCE;i++) _cov[i] = cov[i] ;
128  }
129 
131  checkAccess("ReconstructedParticleImpl::" );
132  for(int i=0;i<NCOVARIANCE;i++) _cov[i] = cov[i] ;
133  }
134 
136  checkAccess("ReconstructedParticleImpl::setMass" );
137  _mass = mass ;
138  }
139 
141  checkAccess("ReconstructedParticleImpl::setCharge" );
142  _charge = charge ;
143  }
144 
145  void ReconstructedParticleImpl::setReferencePoint( const float* reference ){
146  checkAccess("ReconstructedParticleImpl::setReferencePoint" );
147  _reference[0] = reference[0] ;
148  _reference[1] = reference[1] ;
149  _reference[2] = reference[2] ;
150  }
151 
153  checkAccess("ReconstructedParticleImpl::setParticleIDUsed" );
154  _pidUsed = pidUsed ;
155  }
156 
158  checkAccess("ReconstructedParticleImpl::setGoodnessOfPID") ;
159  _goodnessOfPID = goodness ;
160  }
161 
163  // adding a PID should also be possible w/ read only data
164  // checkAccess("ReconstructedParticleImpl::addParticleID" );
165  _pid.push_back( pid ) ;
166  // sort wrt. probability
167  sort( _pid.begin() , _pid.end() , PIDSort() ) ;
168  }
169 
171  checkAccess("ReconstructedParticleImpl::addParticle" );
172  _particles.push_back( particle ) ;
173 // _particleWeights.push_back( weight ) ;
174  }
175 
177  checkAccess("ReconstructedParticleImpl::addCluster" );
178  _clusters.push_back( cluster ) ;
179 // _clusterWeights.push_back( weight ) ;
180  }
181 
183  checkAccess("ReconstructedParticleImpl::addTrack" );
184  _tracks.push_back( track ) ;
185 // _trackWeights.push_back( weight ) ;
186  }
187 
188 // void ReconstructedParticleImpl::addMCParticle( MCParticle* mcParticle , float weight ){
189 // checkAccess("ReconstructedParticleImpl::addMCParticle" );
190 // _mcParticles.push_back( mcParticle ) ;
191 // _mcParticleWeights.push_back( weight ) ;
192 // }
193 
194 
195 } // end namespace
The Vertex class for LCIO.
Definition: Vertex.h:34
void addParticleID(EVENT::ParticleID *pid)
Set the type of reconstructed particle, one of: ReconstructedParticle::SINGLE, ReconstructedParticl...
virtual EVENT::ParticleID * getParticleIDUsed() const
The particle Id used for the kinematics of this particle.
Helper class to sort ParticleIDs wrt.
virtual const float * getReferencePoint() const
Reference point of the reconstructedParticle parameters.
T end(T...args)
#define NCOVARIANCE
T resize(T...args)
void addParticle(EVENT::ReconstructedParticle *particle)
Add a particle that has been used to create this particle.
virtual int getType() const
Type of reconstructed particle.
T at(T...args)
virtual const double * getMomentum() const
The magnitude of the reconstructed particle&#39;s momentum,.
T push_back(T...args)
virtual double getMass() const
Mass of the reconstructed particle, set independently from four vector quantities.
virtual double getEnergy() const
Energy of the reconstructed particle.
EVENT::ReconstructedParticleVec _particles
virtual EVENT::Vertex * getStartVertex() const
The start vertex associated to this particle.
void setReferencePoint(const float *reference)
The LCIO cluster.
Definition: Cluster.h:30
The LCIO track class.
Definition: Track.h:33
virtual const EVENT::TrackVec & getTracks() const
The tracks that have been used for this particle.
virtual const EVENT::ReconstructedParticleVec & getParticles() const
The reconstructed particles that have been combined to this particle.
virtual EVENT::Vertex * getEndVertex() const
The vertex where the particle decays This method actually returns the start vertex from the first dau...
virtual const EVENT::FloatVec & getCovMatrix() const
Covariance matrix of the reconstructed particle&#39;s 4vector (10 parameters).
The LCIO reconstructedParticle.
Persistent interface for LCIO ParticleIDs.
Definition: ParticleID.h:28
void addTrack(EVENT::Track *track)
Add a track that has been used to create this particle.
virtual float getGoodnessOfPID() const
The overall goodness of the PID on a scale of [0;1].
virtual Vertex * getStartVertex() const =0
The start vertex associated to this particle.
void addCluster(EVENT::Cluster *cluster)
Add a cluster that has been used to create this particle.
virtual const EVENT::ClusterVec & getClusters() const
The clusters that have been used for this particle.
T begin(T...args)
virtual const EVENT::ParticleIDVec & getParticleIDs() const
The particle Id&#39;s sorted by their likelihood.
virtual float getCharge() const
Charge of the reconstructed particle.
void setMomentum(const float *momentum)
void setParticleIDUsed(EVENT::ParticleID *pid)
virtual ~ReconstructedParticleImpl()
Destructor.