00001 #include "IMPL/ClusterImpl.h"
00002 #include <algorithm>
00003 #include "IMPL/ParticleIDImpl.h"
00004
00005
00006 using namespace EVENT ;
00007
00008 namespace IMPL{
00009
00010
00011 ClusterImpl::ClusterImpl() :
00012 _type(0),
00013 _energy(0),
00014 _theta(0),
00015 _phi(0) {
00016
00017 _errpos.resize( NERRPOS ) ;
00018 _errdir.resize( NERRDIR ) ;
00019
00020
00021 _position[0] = 0. ;
00022 _position[1] = 0. ;
00023 _position[2] = 0. ;
00024 }
00025
00026 ClusterImpl::~ClusterImpl(){
00027
00028 for( ParticleIDVec::iterator iter = _pid.begin() ; iter != _pid.end() ; iter++){
00029 delete *iter ;
00030 }
00031 }
00032
00033 int ClusterImpl::getType() const{ return _type.to_ulong() ;
00034 }
00035
00036
00037
00038
00039
00040 float ClusterImpl::getEnergy() const{ return _energy; }
00041 const float* ClusterImpl::getPosition() const{ return _position ; }
00042 const FloatVec & ClusterImpl::getPositionError() const{ return _errpos ; }
00043 float ClusterImpl::getITheta() const{ return _theta ; }
00044 float ClusterImpl::getIPhi() const{ return _phi ; }
00045 const FloatVec & ClusterImpl::getDirectionError() const{ return _errdir ; }
00046 const FloatVec & ClusterImpl::getShape() const{ return _shape ; }
00047
00048 const EVENT::ParticleIDVec & ClusterImpl::getParticleIDs() const { return _pid ; }
00049
00050 const ClusterVec & ClusterImpl::getClusters() const{
00051 return _clusters ;
00052 }
00053 const EVENT::CalorimeterHitVec & ClusterImpl::getCalorimeterHits() const {
00054 return _hits ;
00055 }
00056 const EVENT::FloatVec & ClusterImpl::getHitContributions() const {
00057 return _weights ;
00058 }
00059 const EVENT::FloatVec& ClusterImpl::getSubdetectorEnergies() const {
00060 return _subdetectorEnergies ;
00061 }
00062
00063
00064 void ClusterImpl::setType(int type ) {
00065 checkAccess("ClusterImpl::setType") ;
00066 _type = type ;
00067 }
00068 void ClusterImpl::setEnergy(float energy ) {
00069 checkAccess("ClusterImpl::setEnergy") ;
00070 _energy = energy ;
00071 }
00072 void ClusterImpl::setPosition(float* position) {
00073 checkAccess("ClusterImpl::setPosition") ;
00074 for(int i=0;i<3;i++) { _position[i] = position[i] ; }
00075 }
00076 void ClusterImpl::setPositionError(const FloatVec &errpos) {
00077 checkAccess("ClusterImpl::setPosition") ;
00078 for(int i=0;i<NERRPOS;i++) { _errpos[i] = errpos[i] ; }
00079 }
00080 void ClusterImpl::setPositionError(const float* errpos) {
00081 checkAccess("ClusterImpl::setPositionError") ;
00082 for(int i=0;i<NERRPOS;i++) { _errpos[i] = errpos[i] ; }
00083 }
00084 void ClusterImpl::setITheta(float theta) {
00085 checkAccess("ClusterImpl::setITheta") ;
00086 _theta = theta ;
00087 }
00088 void ClusterImpl::setIPhi(float phi){
00089 checkAccess("ClusterImpl::setIPhi") ;
00090 _phi = phi ;
00091 }
00092 void ClusterImpl::setDirectionError(const FloatVec &errdir) {
00093 checkAccess("ClusterImpl::setDirectionError") ;
00094 for(int i=0;i<NERRDIR;i++) { _errdir[i] = errdir[i] ; }
00095 }
00096 void ClusterImpl::setDirectionError(const float* errdir) {
00097 checkAccess("ClusterImpl::setDirectionError") ;
00098 for(int i=0;i<NERRDIR;i++) { _errdir[i] = errdir[i] ; }
00099 }
00100
00101
00102
00103
00104 void ClusterImpl::setShape(const FloatVec &shape) {
00105 checkAccess("ClusterImpl::setShape") ;
00106
00107 copy( shape.begin() , shape.end() , back_inserter( _shape ) ) ;
00108
00109
00110 }
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125 void ClusterImpl::addParticleID( ParticleID* pid ){
00126 checkAccess("ClusterImpl::addParticleID" );
00127 _pid.push_back( pid ) ;
00128
00129 sort( _pid.begin() , _pid.end() , PIDSort() ) ;
00130 }
00131
00132 void ClusterImpl::addCluster(EVENT::Cluster* cluster){
00133 checkAccess("ClusterImpl::addCluster") ;
00134 _clusters.push_back( cluster ) ;
00135 }
00136
00137
00138 void ClusterImpl::addHit(EVENT::CalorimeterHit* hit , float contribution) {
00139 _hits.push_back( hit ) ;
00140 _weights.push_back( contribution ) ;
00141 }
00142
00143 void ClusterImpl::setTypeBit( int index, bool val){
00144 checkAccess("ClusterImpl::setTypeBit") ;
00145 _type.set( index, val ) ;
00146 }
00147
00148 EVENT::FloatVec& ClusterImpl::subdetectorEnergies(){
00149 checkAccess("ClusterImpl::subdetectorEnergies") ;
00150 return _subdetectorEnergies ;
00151 }
00152
00153 }