Cell.cxx

Go to the documentation of this file.
00001 // Cell implementation
00002 //
00003 
00004 #include "AtlfastEvent/Cell.h"
00005 #include "AtlfastEvent/IAOOvisitor.h"
00006 #include <iomanip>
00007 
00008 namespace Atlfast {
00010   Cell::Cell(): 
00011     AODNavigationImp(),
00012     m_id(),
00013     m_ptSum(0.),
00014     m_momentum(0.),
00015     m_particles(){
00016   }
00018   Cell::Cell(const CellDescriptor& cellID) :
00019     AODNavigationImp(),
00020     m_id(cellID),
00021     m_ptSum(0.),
00022     m_momentum(0.),
00023     m_particles(){
00024 
00025   }
00026   
00028   Cell& Cell::operator=(const Cell& otherCell){
00029 
00030     if (this!=&otherCell){
00031       AODNavigationImp::operator=(otherCell);
00032       this->m_id=otherCell.m_id;
00033       this->m_ptSum=otherCell.m_ptSum;
00034       this->m_particles=otherCell.m_particles;//shallow copy
00035     }
00036     
00037     return *this;
00038   }
00039   
00041   Cell::Cell(const Cell& otherCell): 
00042     Atlfast::IAOO(otherCell),
00043     INavigable(otherCell),
00044     I4Momentum(otherCell),
00045     INavigable4Momentum(otherCell),
00046     Atlfast::IKinematic(otherCell),
00047     Atlfast::IAODNavigation(otherCell),
00048     Atlfast::ICell(otherCell),
00049     AODNavigationImp(otherCell){
00050     *this=otherCell; //shallow copy
00051   }
00052   
00054   HepLorentzVector Cell::momentum() const{
00055     //sum momentum calculated as if all particles hit cell center 
00056     double px,py,pz,e;
00057     px=pT()*cos(m_id.phi());
00058     py=pT()*sin(m_id.phi());
00059     pz=pT()*sinh(m_id.eta());
00060     e=pT()*cosh(m_id.eta());
00061     HepLorentzVector vec(px,py,pz,e);
00062     return vec;
00063   }
00065   //IAOO interface
00066   void Cell::accept(IAOOvisitor* iaPtr) const{
00067     iaPtr->process(this);
00068   }
00070   void Cell::newHit(const HepMC::GenParticle* part){
00071     m_ptSum += part->momentum().perp();
00072     this->addParticle(part);
00073   }    
00075     void Cell::newHit(const HepLorentzVector momentum){
00076     m_ptSum += momentum.perp();
00077   }    
00079   void Cell::newHit(double pT){
00080     //    cerr<<"Cell::newHit(double pT) "<<pT<<endl;
00081     m_ptSum += pT;
00082   }    
00084 
00085   void Cell::newHit(const EPileupDeposit* part){
00086     m_ptSum += part->energyDeposit();
00087   }
00089   void Cell::resetCell(){
00090     m_ptSum=0.0;
00091     m_particles.erase(m_particles.begin(), m_particles.end());
00092   }
00094   void Cell::setPt(HepLorentzVector& vec){
00095     m_ptSum=vec.perp(); 
00096   } 
00097 
00099   std::vector<const GenParticle*> Cell::particles() const {
00100     return m_particles;
00101   }
00103   double Cell::eta() const {return m_id.eta();}
00105   double Cell::phi() const {return m_id.phi();} 
00107   double Cell::pT()  const {return m_ptSum;}
00109   double Cell::eT() const {return m_ptSum;} 
00111   double Cell::mT() const {return 0;}
00113   IKinematic* Cell::clone() const{
00114     IKinematic* ik = new Cell(*this);
00115     return ik;
00116   }
00118   void Cell::addParticle(const HepMC::GenParticle* part){
00119     if(find(m_particles.begin(), m_particles.end(), part)==m_particles.end()){
00120       m_particles.push_back(part);
00121     }    
00122   }
00124   void Cell::print(const std::string& coor, std::string t) const{
00125     AODNavigationImp::print(coor, t);
00126     std::cout<<t<<"Number of particles: "
00127              <<std::setw(6)<<m_particles.size()
00128              <<std::string(45,' ')
00129              <<" Cell"<<std::endl;
00130   }
00131 } // end of namespace bracket
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 

Generated on Fri Sep 21 13:00:09 2007 for AtlfastEvent by  doxygen 1.5.1