Atlfast::CalSection Class Reference

Provides rudimentary geometry information for a calorimeter section. More...

#include <CalSection.h>

Collaboration diagram for Atlfast::CalSection:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CalSection (MsgStream &log, const double minEta, const double maxEta, const double granEta, const double granPhi, const double minPhi=-M_PI, const double maxPhi=M_PI)
 CalSection (const CalSection &c)
 ~CalSection ()
void reset ()
void deposit (ITransportedParticleCollectionIter &, ITransportedParticleCollectionIter &)
void deposit (std::vector< Atlfast::EPileupDeposit * >::iterator &, std::vector< Atlfast::EPileupDeposit * >::iterator &)
void depositEcal (std::vector< const GridletElement * >::iterator &, std::vector< const GridletElement * >::iterator &)
void depositHcal (std::vector< const GridletElement * >::iterator &, std::vector< const GridletElement * >::iterator &)
void depositEgen (std::vector< const Gridlet * >::iterator &, std::vector< const Gridlet * >::iterator &)
void giveHits (const ICellSelector *, ITwoCptCellCollection *) const
void smearCells (ISmearer *)

Private Member Functions

void newHit (const ITransportedParticle *)
void newHit (const EPileupDeposit *)
void newEHit (const GridletElement *)
void newHHit (const GridletElement *)
void setEgen (const Gridlet *)
int index (const Gridlet *) const
int index (const GridletElement *) const
int index (const ITransportedParticle *) const
int index (const Atlfast::EPileupDeposit *) const
int iindex (double phi, double eta) const

Private Attributes

MsgStream & m_log
const double m_minEta
const double m_maxEta
const double m_minPhi
const double m_maxPhi
double m_granEta
double m_granPhi
int m_nPhi
CalSectionReject m_calSectionReject
std::vector< ITwoCptCell * > m_cells
std::map< int, ITwoCptCell *,
std::less< int > > 
m_hitCells

Detailed Description

Provides rudimentary geometry information for a calorimeter section.

It is used by the Calorimeter object to deposit HepMc particles

Definition at line 43 of file CalSection.h.


Constructor & Destructor Documentation

Atlfast::CalSection::CalSection ( MsgStream &  log,
const double  minEta,
const double  maxEta,
const double  granEta,
const double  granPhi,
const double  minPhi = -M_PI,
const double  maxPhi = M_PI 
)

Constructor takes sensitivity parameters

Definition at line 34 of file CalSection.cxx.

00042                           :
00043     m_log(log),
00044     m_minEta(minEta), m_maxEta(maxEta),
00045     m_minPhi(minPhi), m_maxPhi(maxPhi),
00046     m_calSectionReject(minEta, maxEta, minPhi, maxPhi){
00047     
00048     log <<MSG::DEBUG<< "CalSection: construction. Eta range: "
00049         <<minEta<<" - "<<maxEta<<endreq; 
00050     log <<MSG::DEBUG<< "                          Phi range: "
00051         <<minPhi<<" - "<<maxPhi<<endreq; 
00052     log <<MSG::DEBUG<< " starting granularity Eta: "<<granEta
00053         << " phi: "<<granPhi
00054         <<endreq;
00055 
00056     log <<MSG::DEBUG<<"CalSectionReject parameters:"<<endreq;
00057     log <<MSG::DEBUG<<m_calSectionReject<<endreq;
00058 
00059     int nEta    = int(((maxEta-minEta)/granEta)+0.5);
00060     m_granEta   = (maxEta-minEta)/int(nEta);
00061     m_nPhi      = 1+int(((m_maxPhi-m_minPhi)/granPhi)+0.5);
00062     m_granPhi   = (m_maxPhi-m_minPhi)/double(m_nPhi); 
00063     log <<MSG::DEBUG<< " final granularity Eta: "<<m_granEta
00064         << " phi: "<<m_granPhi
00065         <<endreq; 
00066     log <<MSG::DEBUG<< " final Bins in Eta: "<<nEta
00067         << " phi: "<<m_nPhi
00068         <<endreq; 
00069 
00070     for (int ieta=0; ieta<nEta; ieta++){
00071       for (int iphi=0; iphi<m_nPhi; iphi++){
00072         
00073         double eta        = minEta+((double(ieta)+0.5)*double(m_granEta));
00074         double phi        = m_minPhi + ((double(iphi)+0.5)*double(m_granPhi));
00075         CellDescriptor id = CellDescriptor(eta,phi);
00076         ITwoCptCell* cell = new TwoCptCell(id);
00077         
00078         m_cells.push_back(cell);
00079       }
00080     }
00081   }
  CalSection::~CalSection(){

Atlfast::CalSection::CalSection ( const CalSection c  ) 

Definition at line 87 of file CalSection.cxx.

00087                                            :
00088     m_log(c.m_log),
00089     m_minEta(c.m_minEta),
00090     m_maxEta(c.m_maxEta),
00091     m_minPhi(c.m_minPhi),
00092     m_maxPhi(c.m_maxPhi),
00093     m_granEta(c.m_granEta),
00094     m_granPhi(c.m_granPhi),
00095     m_nPhi(c.m_nPhi),
00096     m_calSectionReject(c.m_calSectionReject){
00097     std::vector<ITwoCptCell*>::const_iterator i=c.m_cells.begin();
00098     for(;i<c.m_cells.end();++i) m_cells.push_back((*i)->cloneITCC());
00099   }
  //----------------------------------------------------------------

Atlfast::CalSection::~CalSection (  ) 

Definition at line 82 of file CalSection.cxx.

00082                          {
00083     m_log<<MSG::DEBUG<<"CalSection destructor starts "<<endreq;
00084     std::for_each(m_cells.begin(), m_cells.end(), DeleteObject());
00085     m_log<<MSG::DEBUG<<"CalSection destructor ends "<<endreq;
00086   }


Member Function Documentation

void Atlfast::CalSection::reset (  ) 

Resets the contents of the calorimeter section.

Definition at line 312 of file CalSection.cxx.

00312                         {
00313     //reset the cells of this CalSection
00314 
00315     std::map<int, ITwoCptCell*>::const_iterator i = m_hitCells.begin();
00316     for(;i!=m_hitCells.end();++i) (*i).second->resetCell();
00317     m_hitCells.erase(m_hitCells.begin(), m_hitCells.end());
00318   }

void Atlfast::CalSection::deposit ( ITransportedParticleCollectionIter ,
ITransportedParticleCollectionIter  
)

Takes the ITransportedParticle (transported through mag field) and deposits it within the calorimeter section.

Definition at line 101 of file CalSection.cxx.

00102                                                                  {
00103     // remove particles not in acceptance
00104     ITransportedParticleCollectionIter divider;
00105     divider = std::partition(f, l, m_calSectionReject);
00106     
00107     // fill cells 
00108     for(ITransportedParticleCollectionCIter i=divider; i<l; ++i){newHit(*i);}
00109 
00110     // assume sections do not overlap: do not reprocess.
00111     l=divider;
00112   }

void Atlfast::CalSection::deposit ( std::vector< Atlfast::EPileupDeposit * >::iterator &  ,
std::vector< Atlfast::EPileupDeposit * >::iterator &   
)

Takes the Energy pileup map and deposits it within the calorimeter section.

Definition at line 255 of file CalSection.cxx.

00256                                                                         {
00257     // remove pileup deposits not in acceptance
00258     std::vector<Atlfast::EPileupDeposit*>::iterator divider;
00259     divider = std::partition(f, l, m_calSectionReject);
00260 
00261     // fill cells 
00262     std::vector<Atlfast::EPileupDeposit*>::iterator  i=divider;
00263     for(; i<l; ++i) newHit(*i);
00264 
00265     // assume sections do not overlap: do not reprocess.
00266     // hits processed here: set last to end of unprocessed hits
00267     l=divider;
00268   }

void Atlfast::CalSection::depositEcal ( std::vector< const GridletElement * >::iterator &  ,
std::vector< const GridletElement * >::iterator &   
)

a deposit method into Ecal comaprtment (used with FastShower)

Definition at line 115 of file CalSection.cxx.

00117                            {
00118     //    cerr<<"Calsection depositEcal begin"<<endl;
00119   
00120     //    cerr<<"  no of elements on entry "<<l-f<<endl;
00121     std::vector<const GridletElement*>::iterator divider;
00122     divider = std::partition(f, l, m_calSectionReject);
00123     //    cerr<<"Calsection depositEcal after partition"<<endl;
00124   
00125     std::vector<const GridletElement*>::iterator i;
00126     for( i=divider; i<l; ++i){newEHit(*i);}
00127     //    cerr<<"Calsection depositEcal after newhit call"<<endl;
00128   
00129 
00130     // assume sections do not overlap: do not reprocess.
00131     l=divider;
00132     //    cerr<<"  no of elements on exit "<<l-f<<endl;
00133     //    cerr<<"Calsection depositEcal end"<<endl;
00134   }

void Atlfast::CalSection::depositHcal ( std::vector< const GridletElement * >::iterator &  ,
std::vector< const GridletElement * >::iterator &   
)

a deposit method into Hcal comaprtment (used with FastShower)

Definition at line 136 of file CalSection.cxx.

00138                                 {
00139     
00140     std::vector<const GridletElement*>::iterator divider;
00141     divider = std::partition(f, l, m_calSectionReject);
00142   
00143     std::vector<const GridletElement*>::iterator i;
00144     for( i=divider; i<l; ++i){newHHit(*i);}
00145 
00146     // assume sections do not overlap: do not reprocess.
00147     l=divider;
00148   }

void Atlfast::CalSection::depositEgen ( std::vector< const Gridlet * >::iterator &  ,
std::vector< const Gridlet * >::iterator &   
)

set Generated Energy (used with FastShower)

Definition at line 150 of file CalSection.cxx.

00152                                 {
00153     std::vector<const Gridlet*>::iterator divider;
00154     divider = std::partition(f, l, m_calSectionReject);
00155     
00156     
00157     std::vector<const Gridlet*>::iterator i;
00158     for( i=divider; i<l; ++i){setEgen(*i);}
00159     
00160     // assume sections do not overlap: do not reprocess.
00161     l=divider;
00162   }

void Atlfast::CalSection::giveHits ( const ICellSelector ,
ITwoCptCellCollection  
) const

Returns a list of hit cells within the calorimeter section.

Definition at line 285 of file CalSection.cxx.

00285                                                                            {
00286     std::map<int, ITwoCptCell*, std::less<int> >::const_iterator i;
00287     for(i=m_hitCells.begin(); i!=m_hitCells.end(); ++i){
00288       //test cell before newing and filling vector
00289       if( (*p_cellselect) (((*i).second))){ 
00290         ITwoCptCell* cell = ((*i).second)->cloneITCC();
00291       //Need to copy cells because Athena deletes container AND POINTERS
00292       // AND POINTEES
00293         cells->push_back(cell);
00294       }
00295     }
00296 
00297   }

void Atlfast::CalSection::smearCells ( ISmearer  ) 

Smear the cells resolution

Definition at line 300 of file CalSection.cxx.

00300                           {
00301     std::map<int, ITwoCptCell*, std::less<int> >::const_iterator i;
00302     for(i=m_hitCells.begin(); i!=m_hitCells.end(); ++i){
00303       if((*((*i).second)).momentum().e() > 0){
00304         HepLorentzVector temp = p_smearer->smear((*((*i).second)).momentum());
00305           (*((*i).second)).setPt(temp);
00306       }
00307     }
00308   }

void Atlfast::CalSection::newHit ( const ITransportedParticle  )  [private]

Registers a new hit in the calorimeter section.

Definition at line 165 of file CalSection.cxx.

00165                                                         {
00166     //check cell is reasonable
00167     const HepMC::GenParticle* particle = tp->particle();
00168     //const double eta = particle->momentum().pseudoRapidity();
00169     const double eta = tp->eta();
00170     const double phi = tp->phi();
00171     int ind = iindex(phi, eta);
00172     ITwoCptCell* cell = m_cells[ind];
00173     assert(std::abs( eta-(cell->eta()) ) <m_granEta);
00174     assert(std::abs( phi-(cell->phi()) ) <m_granPhi);
00175     cell->newHit(particle);
00176     //use a map to store pointers to hit cells to avoid
00177     //duplicate entries if the cell is hit more than once.
00178     m_hitCells[ind] = cell;
00179 
00180     return;
00181   }

void Atlfast::CalSection::newHit ( const EPileupDeposit  )  [private]

Registers a new energy pileup in the calorimeter section.

Definition at line 271 of file CalSection.cxx.

00271                                                          {
00272     //check cell is reasonable
00273     int ind = index(ep);
00274     ITwoCptCell* cell = m_cells[ind];
00275     assert(std::abs( (ep->eta()) - (cell->eta()) )<m_granEta);
00276     assert(std::abs( (ep->phi()) - (cell->phi()) )<m_granPhi);
00277     cell->newHit(ep);
00278      //use a map to store pointers to hit cells to avoid
00279     //duplicate entries if the cell is hit more than once.
00280     m_hitCells[ind] = cell;
00281     return;
00282   }

void Atlfast::CalSection::newEHit ( const GridletElement *   )  [private]

Registers a new deposit in the Ecal in the calorimeter section.

Definition at line 183 of file CalSection.cxx.

00183                                                    {
00184     int ind = index(ge);
00185     ITwoCptCell* cell = m_cells[ind];
00186     //    cerr<<"gridletEl, phi, eta, eT:     "
00187     //    <<ge->phi()<<" "<<ge->eta()<<" "<<ge->et()<<endl;
00188     //    cerr<<"cell, phi, eta, granularity: "<<cell->phi()<<" "<<cell->eta()
00189     //  <<" "<<m_granPhi<<" "<<m_granEta<<endl;
00190     assert(std::abs( (ge->eta()-cell->eta()) )<m_granEta);
00191     assert(std::abs( (ge->phi()-cell->phi()) )<m_granPhi);
00192     cell->depositEcal(ge->et());
00193     //use a map to store pointers to hit cells to avoid
00194     //duplicate entries if the cell is hit more than once.
00195     m_hitCells[ind] = cell;
00196 
00197     return;
00198   }

void Atlfast::CalSection::newHHit ( const GridletElement *   )  [private]

Registers a new deposit in the Ecal in the calorimeter section.

Definition at line 200 of file CalSection.cxx.

00200                                                    {
00201     int ind = index(ge);
00202     ITwoCptCell* cell = m_cells[ind];
00203 
00204     assert(std::abs( (ge->eta())-(cell->eta()) )<m_granEta);
00205     assert(std::abs( (ge->phi())-(cell->phi()) )<m_granPhi);
00206 
00207     cell->depositHcal(ge->et());
00208     //use a map to store pointers to hit cells to avoid
00209     //duplicate entries if the cell is hit more than once.
00210     m_hitCells[ind] = cell;
00211 
00212     return;
00213   }

void Atlfast::CalSection::setEgen ( const Gridlet *   )  [private]

find the cell index for a variety of input arguments

Definition at line 215 of file CalSection.cxx.

00215                                             {
00216     int ind = index(gr);
00217     ITwoCptCell* cell = m_cells[ind];
00218     cell->addEgen(gr->eGen());
00219     m_hitCells[ind] = cell;
00220     return;
00221   }

int Atlfast::CalSection::index ( const Gridlet *   )  const [private]

find the cell index for a variety of input arguments

Definition at line 223 of file CalSection.cxx.

00223                                                {
00224     int ind = this->iindex( gr->phi0(), gr->eta0() );
00225     return ind;
00226   }

int Atlfast::CalSection::index ( const GridletElement *   )  const [private]

Definition at line 228 of file CalSection.cxx.

00228                                                       {
00229     int ind = this->iindex( ge->phi(), ge->eta() );
00230     return ind;
00231   }

int Atlfast::CalSection::index ( const ITransportedParticle  )  const [private]

Definition at line 233 of file CalSection.cxx.

00233                                                              {
00234     const HepMC::GenParticle* particle = tp->particle();
00235     const double eta = particle->momentum().pseudoRapidity();
00236     const double phi = tp->phi();
00237     int ind = iindex(phi, eta);
00238     return ind;
00239   }

int Atlfast::CalSection::index ( const Atlfast::EPileupDeposit  )  const [private]

Definition at line 241 of file CalSection.cxx.

00241                                                              {
00242     int ind = iindex(ep->phi(),ep->eta());
00243     return ind;
00244   }

int Atlfast::CalSection::iindex ( double  phi,
double  eta 
) const [private]

Definition at line 246 of file CalSection.cxx.

00246                                                     {
00247     int iphi = int( (phi-m_minPhi)/m_granPhi );
00248     int ieta = int( (eta-m_minEta)/m_granEta );
00249     
00250     return  (m_nPhi*ieta  + iphi);
00251   }


Member Data Documentation

MsgStream& Atlfast::CalSection::m_log [private]

Definition at line 94 of file CalSection.h.

const double Atlfast::CalSection::m_minEta [private]

minimum Eta sensitivity

Definition at line 112 of file CalSection.h.

const double Atlfast::CalSection::m_maxEta [private]

maximum Eta sensitivity

Definition at line 114 of file CalSection.h.

const double Atlfast::CalSection::m_minPhi [private]

minimum phi sensitivity

Definition at line 116 of file CalSection.h.

const double Atlfast::CalSection::m_maxPhi [private]

maximum phi sensitivity

Definition at line 118 of file CalSection.h.

double Atlfast::CalSection::m_granEta [private]

granularity in eta

Definition at line 120 of file CalSection.h.

double Atlfast::CalSection::m_granPhi [private]

granularity in phi

Definition at line 122 of file CalSection.h.

int Atlfast::CalSection::m_nPhi [private]

number of cells in phi space

Definition at line 124 of file CalSection.h.

CalSectionReject Atlfast::CalSection::m_calSectionReject [private]

Calorimeter selection object.

Definition at line 128 of file CalSection.h.

std::vector<ITwoCptCell*> Atlfast::CalSection::m_cells [private]

Cells owned by calorimeter section.

Definition at line 132 of file CalSection.h.

std::map<int, ITwoCptCell*, std::less<int> > Atlfast::CalSection::m_hitCells [private]

Definition at line 133 of file CalSection.h.


The documentation for this class was generated from the following files:
Generated on Mon Sep 24 14:19:35 2007 for AtlfastAlgs by  doxygen 1.5.1