LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClusterImpl.cc
Go to the documentation of this file.
1 #include "IMPL/ClusterImpl.h"
2 #include <algorithm>
3 #include "IMPL/ParticleIDImpl.h"
4 
5 
6 using namespace EVENT ;
7 
8 namespace IMPL{
9 
10 
11  ClusterImpl::ClusterImpl() :
12  _errpos( NERRPOS ),
13  _errdir( NERRDIR ){
14  }
15 
17  // delete the pids owned by this cluster
18  for( ParticleIDVec::iterator iter = _pid.begin() ; iter != _pid.end() ; iter++){
19  delete *iter ;
20  }
21  }
22 
23  int ClusterImpl::getType() const{ return _type.to_ulong() ; //return _type ;
24  }
25 
26 // bool ClusterImpl::testType(int bitIndex) const {
27 // return _type.test( bitIndex ) ;
28 // }
29 
30  float ClusterImpl::getEnergy() const{ return _energy; }
31  float ClusterImpl::getEnergyError() const{ return _energyError; }
32  const float* ClusterImpl::getPosition() const{ return _position ; }
33  const FloatVec & ClusterImpl::getPositionError() const{ return _errpos ; }
34  float ClusterImpl::getITheta() const{ return _theta ; }
35  float ClusterImpl::getIPhi() const{ return _phi ; }
36  const FloatVec & ClusterImpl::getDirectionError() const{ return _errdir ; }
37  const FloatVec & ClusterImpl::getShape() const{ return _shape ; }
38 // const FloatVec & ClusterImpl::getParticleType() const{ return _particletype ; }
40 
42  return _clusters ;
43  }
45  return _hits ;
46  }
48  return _weights ;
49  }
51  return _subdetectorEnergies ;
52  }
53 
54 
55  void ClusterImpl::setType(int type ) {
56  checkAccess("ClusterImpl::setType") ;
57  _type = type ;
58  }
59  void ClusterImpl::setEnergy(float energy ) {
60  checkAccess("ClusterImpl::setEnergy") ;
61  _energy = energy ;
62  }
63  void ClusterImpl::setEnergyError(float energyError ) {
64  checkAccess("ClusterImpl::setEnergyError") ;
65  _energyError = energyError ;
66  }
67  void ClusterImpl::setPosition(const float* position) {
68  checkAccess("ClusterImpl::setPosition") ;
69  for(int i=0;i<3;i++) { _position[i] = position[i] ; }
70  }
71  void ClusterImpl::setPositionError(const FloatVec &errpos) {
72  checkAccess("ClusterImpl::setPosition") ;
73  for(int i=0;i<NERRPOS;i++) { _errpos[i] = errpos[i] ; }
74  }
75  void ClusterImpl::setPositionError(const float* errpos) {
76  checkAccess("ClusterImpl::setPositionError") ;
77  for(int i=0;i<NERRPOS;i++) { _errpos[i] = errpos[i] ; }
78  }
79  void ClusterImpl::setITheta(float theta) {
80  checkAccess("ClusterImpl::setITheta") ;
81  _theta = theta ;
82  }
83  void ClusterImpl::setIPhi(float phi){
84  checkAccess("ClusterImpl::setIPhi") ;
85  _phi = phi ;
86  }
88  checkAccess("ClusterImpl::setDirectionError") ;
89  for(int i=0;i<NERRDIR;i++) { _errdir[i] = errdir[i] ; }
90  }
91  void ClusterImpl::setDirectionError(const float* errdir) {
92  checkAccess("ClusterImpl::setDirectionError") ;
93  for(int i=0;i<NERRDIR;i++) { _errdir[i] = errdir[i] ; }
94  }
95 // void ClusterImpl::setShape(const float* shape) {
96 // checkAccess("ClusterImpl::setShape") ;
97 // for(int i=0;i<NSHAPE;i++) { _shape[i] = shape[i] ; }
98 // }
99  void ClusterImpl::setShape(const FloatVec &shape) {
100  checkAccess("ClusterImpl::setShape") ;
101 
102  copy( shape.begin() , shape.end() , back_inserter( _shape ) ) ;
103 // _shape.resize( shape.size() ) ;
104 // for(unsigned int i=0;i<shape.size();i++) { _shape[i] = shape[i] ; }
105  }
106 
107 // void ClusterImpl::setEMWeight(float emWeight ) {
108 // checkAccess("ClusterImpl::setEMWeight") ;
109 // _particletype[0] = emWeight ;
110 // }
111 // void ClusterImpl::setHADWeight(float hadWeight ) {
112 // checkAccess("ClusterImpl::setHADWeight") ;
113 // _particletype[1] = hadWeight ;
114 // }
115 // void ClusterImpl::setMuonWeight(float muonWeight ) {
116 // checkAccess("ClusterImpl::setMuonWeight") ;
117 // _particletype[2] = muonWeight ;
118 // }
119 
121  checkAccess("ClusterImpl::addParticleID" );
122  _pid.push_back( pid ) ;
123  // sort wrt. probability
124  sort( _pid.begin() , _pid.end() , PIDSort() ) ;
125  }
126 
128  checkAccess("ClusterImpl::addCluster") ;
129  _clusters.push_back( cluster ) ;
130  }
131 
132 
133  void ClusterImpl::addHit(EVENT::CalorimeterHit* hit , float contribution) {
134  _hits.push_back( hit ) ;
135  _weights.push_back( contribution ) ;
136  }
137 
138  void ClusterImpl::setTypeBit( int index, bool val){
139  checkAccess("ClusterImpl::setTypeBit") ;
140  _type.set( index, val ) ;
141  }
142 
144  checkAccess("ClusterImpl::subdetectorEnergies") ;
145  return _subdetectorEnergies ;
146  }
147 
148 } // end namespace
#define NERRDIR
Definition: ClusterImpl.h:11
void setEnergyError(float energyError)
Definition: ClusterImpl.cc:63
EVENT::FloatVec _subdetectorEnergies
Definition: ClusterImpl.h:159
EVENT::FloatVec & subdetectorEnergies()
To be used for modifying the subdetector energies, e.g.
Definition: ClusterImpl.cc:143
virtual ~ClusterImpl()
Destructor.
Definition: ClusterImpl.cc:16
virtual const EVENT::FloatVec & getSubdetectorEnergies() const
A vector that holds the energy observed in a particular subdetectors.
Definition: ClusterImpl.cc:50
void setPositionError(const EVENT::FloatVec &errpos)
Definition: ClusterImpl.cc:71
void setDirectionError(const EVENT::FloatVec &errdir)
Definition: ClusterImpl.cc:87
EVENT::FloatVec _shape
Definition: ClusterImpl.h:154
EVENT::ParticleIDVec _pid
Definition: ClusterImpl.h:155
virtual float getEnergyError() const
Returns the error on the energy of the cluster.
Definition: ClusterImpl.cc:31
virtual float getIPhi() const
Intrinsic direction of cluster at position: Phi.
Definition: ClusterImpl.cc:35
void addCluster(EVENT::Cluster *cluster)
Definition: ClusterImpl.cc:127
virtual int getType() const
Flagword that defines the type of cluster.
Definition: ClusterImpl.cc:23
T to_ulong(T...args)
Helper class to sort ParticleIDs wrt.
virtual const EVENT::ParticleIDVec & getParticleIDs() const
Type hypotheses: 3 Parameters: compatible with EM, HAD, muon cluster.
Definition: ClusterImpl.cc:39
T end(T...args)
virtual const EVENT::FloatVec & getDirectionError() const
Covariance matrix of the direction (3 Parameters)
Definition: ClusterImpl.cc:36
void setEnergy(float energy)
Definition: ClusterImpl.cc:59
void setTypeBit(int index, bool val=true)
Definition: ClusterImpl.cc:138
#define NERRPOS
Definition: ClusterImpl.h:10
T push_back(T...args)
vector< level > position
Definition: lsh.cc:64
virtual const EVENT::FloatVec & getPositionError() const
Covariance matrix of the position (6 Parameters)
Definition: ClusterImpl.cc:33
void addParticleID(EVENT::ParticleID *pid)
Definition: ClusterImpl.cc:120
void addHit(EVENT::CalorimeterHit *hit, float contribution)
Definition: ClusterImpl.cc:133
EVENT::CalorimeterHitVec _hits
Definition: ClusterImpl.h:157
The LCIO cluster.
Definition: Cluster.h:30
virtual float getITheta() const
Intrinsic direction of cluster at position: Theta.
Definition: ClusterImpl.cc:34
std::bitset< 32 > _type
Definition: ClusterImpl.h:146
virtual const EVENT::FloatVec & getHitContributions() const
Returns the energy contribution of the hits Runs parallel to the CalorimeterHitVec from getCalorimete...
Definition: ClusterImpl.cc:47
virtual const float * getPosition() const
Position of the cluster.
Definition: ClusterImpl.cc:32
virtual const EVENT::ClusterVec & getClusters() const
The clusters that have been combined to this cluster.
Definition: ClusterImpl.cc:41
void setType(int type)
Definition: ClusterImpl.cc:55
Persistent interface for LCIO ParticleIDs.
Definition: ParticleID.h:28
T set(T...args)
EVENT::FloatVec _weights
Definition: ClusterImpl.h:158
T begin(T...args)
void setIPhi(float phi)
Definition: ClusterImpl.cc:83
virtual float getEnergy() const
Energy of the cluster.
Definition: ClusterImpl.cc:30
EVENT::FloatVec _errpos
Definition: ClusterImpl.h:150
The generic calorimeter hit - created from SimCalorimeterHit or RawCalorimeterHit.
void setShape(const EVENT::FloatVec &shape)
Definition: ClusterImpl.cc:99
virtual const EVENT::CalorimeterHitVec & getCalorimeterHits() const
The hits that have been combined to this cluster.
Definition: ClusterImpl.cc:44
EVENT::ClusterVec _clusters
Definition: ClusterImpl.h:156
void setITheta(float theta)
Definition: ClusterImpl.cc:79
float _position[3]
Definition: ClusterImpl.h:149
EVENT::FloatVec _errdir
Definition: ClusterImpl.h:153
virtual const EVENT::FloatVec & getShape() const
Shape parameters - check/set collection parameter ClusterShapeParameters for size and names of parame...
Definition: ClusterImpl.cc:37
void setPosition(const float *position)
Definition: ClusterImpl.cc:67