/data3/calcul/jacquem/working_dir/Micromegas/micromegasFrameWork/lcio/src/cpp/src/IMPL/ClusterImpl.cc

Go to the documentation of this file.
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 //     for(int i=0 ; i < NERRPOS ; i++ ) { _errpos.push_back( 0.0 ) ;  }
00020 //     for(int i=0 ; i < NERRDIR ; i++ ) { _errdir.push_back( 0.0 ) ;  }
00021     _position[0] = 0. ;
00022     _position[1] = 0. ;
00023     _position[2] = 0. ;
00024   }
00025 
00026   ClusterImpl::~ClusterImpl(){
00027     // delete the pids owned by this cluster
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() ; //return _type ; 
00034   }
00035 
00036 //   bool ClusterImpl::testType(int bitIndex) const {
00037 //     return _type.test( bitIndex ) ;
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 //   const FloatVec & ClusterImpl::getParticleType() const{ return _particletype ;  }
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 //   void ClusterImpl::setShape(const float* shape) { 
00101 //     checkAccess("ClusterImpl::setShape") ;
00102 //     for(int i=0;i<NSHAPE;i++) { _shape[i] = shape[i]  ;  }
00103 //   }
00104   void ClusterImpl::setShape(const FloatVec &shape) { 
00105     checkAccess("ClusterImpl::setShape") ;
00106 
00107     copy( shape.begin() , shape.end() , back_inserter( _shape ) ) ;
00108 //     _shape.resize( shape.size() ) ;
00109 //     for(unsigned int i=0;i<shape.size();i++) { _shape[i] = shape[i]  ;  }
00110   }
00111 
00112 //   void ClusterImpl::setEMWeight(float emWeight ) { 
00113 //     checkAccess("ClusterImpl::setEMWeight") ;
00114 //     _particletype[0] = emWeight ; 
00115 //   }
00116 //   void ClusterImpl::setHADWeight(float hadWeight ) {
00117 //     checkAccess("ClusterImpl::setHADWeight") ;
00118 //     _particletype[1] = hadWeight ; 
00119 //   }
00120 //   void ClusterImpl::setMuonWeight(float muonWeight ) {
00121 //     checkAccess("ClusterImpl::setMuonWeight") ;
00122 //     _particletype[2] = muonWeight ;
00123 //   }
00124   
00125   void ClusterImpl::addParticleID( ParticleID* pid ){
00126     checkAccess("ClusterImpl::addParticleID" );
00127     _pid.push_back( pid ) ;
00128     // sort wrt. probability
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 } // end namespace

Generated on Mon Jan 7 13:15:21 2013 for MicromegasFramework by  doxygen 1.4.7