00001
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;
00036
00037 }
00038
00039 return *this;
00040 }
00041
00042 Cell::Cell(const Cell& otherCell) :
00043 ContainedObject(),
00044 IKinematic(),
00045 AssociationManager(){
00046 *this=otherCell;
00047
00048 }
00049
00050 HepLorentzVector Cell::momentum() const{
00051
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
00082
00083
00084 return m_particles;
00085 }
00086
00087 }
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097