Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Cell.cxx

Go to the documentation of this file.
00001 // Cell implementation
00002 //
00003 
00004 #include "AtlfastEvent/Cell.h"
00005 #include "HepMC/GenParticle.h"
00006 #include "AtlfastEvent/EPileupDeposit.h"
00007 static ContainedObjectFactory < Atlfast::Cell > s_AtlfastCellFactory;
00008 const IFactory& AtlfastCellFactory = s_AtlfastCellFactory;
00009 
00010 
00011 namespace Atlfast {
00012 
00013   Cell::Cell(): 
00014     ContainedObject(), 
00015     AssociationManager(),
00016     m_id(),
00017     m_ptSum(0.),
00018     m_momentum(0.),
00019     m_particles(){
00020   }
00021   Cell::Cell(const CellDescriptor& cellID) :
00022     ContainedObject(),
00023     AssociationManager(),
00024     m_id(cellID),
00025     m_ptSum(0.),
00026     m_momentum(0.),
00027     m_particles(){
00028   }
00029   
00030   Cell& Cell::operator=(const Cell& otherCell){
00031 
00032     if (this!=&otherCell){
00033       this->m_id=otherCell.m_id;
00034       this->m_ptSum=otherCell.m_ptSum;
00035       this->m_particles=otherCell.m_particles;//m_particles is a 
00036       //ContainedObject therefore do not deep copy
00037     }
00038     
00039     return *this;
00040   }
00041   
00042   Cell::Cell(const Cell& otherCell) : 
00043     ContainedObject(), 
00044     IKinematic(),
00045     AssociationManager(){
00046     *this=otherCell; //no deep copy of vector of pointers as is a 
00047     //ContainedObject
00048   }
00049   
00050   HepLorentzVector Cell::momentum() const{
00051     //sum momentum calculated as if all particles hit cell center 
00052     double px,py,pz,e;
00053     px=pT()*cos(m_id.phi());
00054     py=pT()*sin(m_id.phi());
00055     pz=pT()*sinh(m_id.eta());
00056     e=pT()*cosh(m_id.eta());
00057     HepLorentzVector vec(px,py,pz,e);
00058     return vec;
00059   }
00060   
00061   
00062   void Cell::newHit(const HepMC::GenParticle* part){
00063     m_ptSum += part->momentum().perp();
00064     m_particles.push_back(part);
00065   }
00067   void Cell::newHit(const EPileupDeposit* part){
00068     m_ptSum += part->energyDeposit();
00069   }
00070   
00071   void Cell::reset(){
00072     m_ptSum=0.0;
00073     m_particles.erase(m_particles.begin(), m_particles.end());
00074   }
00075   void Cell::setPt(HepLorentzVector& vec){
00076     m_ptSum=vec.perp(); 
00077   } 
00078 
00079   std::vector<const GenParticle*> Cell::particles() const {
00080     std::vector<const GenParticle*> particles;
00081     //std::copy(m_particles.begin(),m_particles.end(),particles.begin());
00082     //for(DataVector<const GenParticle>::const_iterator itr = m_particles.begin();
00083     //  itr != m_particles.end();++itr) particles.push_back(*itr);
00084     return m_particles;
00085     }
00086 
00087 } // end of namespace bracket
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 

Generated on Fri Nov 29 12:55:11 2002 by doxygen1.3-rc1