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

Atlfast::CalSection Class Reference

This class 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 Methods

 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.

 CalSection (const CalSection &c)
 ~CalSection ()
void reset ()
 Resets the contents of the calorimeter section.

void deposit (TransportedParticleCollectionIter &, TransportedParticleCollectionIter &)
 Takes the TransportedParticle (transported through mag field) and deposits it within the calorimeter section.

void deposit (std::vector< Atlfast::EPileupDeposit * >::iterator &, std::vector< Atlfast::EPileupDeposit * >::iterator &)
 Takes the Energy pileup map and deposits it within the calorimeter section.

void giveHits (const ICellSelector *, CellCollection *) const
 Returns a list of hit cells within the calorimeter section.

void smearCells (ISmearer *)
 Smear the cells resolution.


Private Methods

void newHit (const TransportedParticleCollectionCIter &)
 Registers a new hit in the calorimeter section.

void newHit (const std::vector< Atlfast::EPileupDeposit * >::iterator &)
 Registers a new energy pileup in the calorimeter section.


Private Attributes

const double m_minEta
 minimum Eta sensitivity

const double m_maxEta
 maximum Eta sensitivity

const double m_minPhi
 minimum phi sensitivity

const double m_maxPhi
 maximum phi sensitivity

double m_granEta
 granularity in eta

double m_granPhi
 granularity in phi

int m_nPhi
 number of cells in phi space

CalSectionReject m_calSectionReject
 Calorimeter selection object.

std::vector< Cell * > m_cells
 Cells owned by calorimeter section.

std::map< int, Cell *, std::less<
int > > 
m_hitCells
Cell * lnkCell
 0..*


Detailed Description

This class provides rudimentary geometry information for a calorimeter section.

It is used by the Calorimeter object to deposit HepMc particles

Definition at line 41 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 31 of file CalSection.cxx.

References m_calSectionReject, m_cells, m_granEta, m_granPhi, m_maxPhi, m_minPhi, and m_nPhi.

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

Atlfast::CalSection::CalSection const CalSection &    c
 

Definition at line 82 of file CalSection.cxx.

References m_cells.

00082                                            :
00083     m_minEta(c.m_minEta),
00084     m_maxEta(c.m_maxEta),
00085     m_minPhi(c.m_minPhi),
00086     m_maxPhi(c.m_maxPhi),
00087     m_calSectionReject(c.m_calSectionReject){
00088     std::vector<Cell*>::const_iterator i=c.m_cells.begin();
00089     for(;i<c.m_cells.end();++i) m_cells.push_back(new Cell(*(*i)));
00090   }
  //----------------------------------------------------------------

Atlfast::CalSection::~CalSection  
 

Definition at line 78 of file CalSection.cxx.

References m_cells.

00078                          {
00079     std::vector<Cell*>::iterator i=m_cells.begin();
00080     for(;i<m_cells.end();++i) delete *i;
00081   }

Member Function Documentation

void Atlfast::CalSection::reset  
 

Resets the contents of the calorimeter section.

Definition at line 194 of file CalSection.cxx.

References m_hitCells.

Referenced by Atlfast::Calorimeter::reset().

00194                         {
00195     //reset the cells of this CalSection
00196 
00197     std::map<int, Cell*>::const_iterator i = m_hitCells.begin();
00198     for(;i!=m_hitCells.end();++i) (*i).second->resetCell();
00199     m_hitCells.erase(m_hitCells.begin(), m_hitCells.end());
00200   }

void Atlfast::CalSection::deposit TransportedParticleCollectionIter  ,
TransportedParticleCollectionIter  
 

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

Definition at line 92 of file CalSection.cxx.

References m_calSectionReject, newHit(), Atlfast::TransportedParticleCollectionCIter, and Atlfast::TransportedParticleCollectionIter.

00093                                                                 {
00094     // remove particles not in acceptance
00095     TransportedParticleCollectionIter divider;
00096     divider = std::partition(f, l, m_calSectionReject);
00097 
00098     // fill cells 
00099     TransportedParticleCollectionCIter i=divider;
00100     for(; i<l; ++i) newHit(i);
00101 
00102     // assume sections do not overlap: do not reprocess.
00103     // hits processed here: set last to end of unprocessed hits
00104     l=divider;
00105   }

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 133 of file CalSection.cxx.

References m_calSectionReject, and newHit().

00134                                                                         {
00135     // remove pileup deposits not in acceptance
00136     std::vector<Atlfast::EPileupDeposit*>::iterator divider;
00137     divider = std::partition(f, l, m_calSectionReject);
00138 
00139     // fill cells 
00140     std::vector<Atlfast::EPileupDeposit*>::iterator  i=divider;
00141     for(; i<l; ++i) newHit(i);
00142 
00143     // assume sections do not overlap: do not reprocess.
00144     // hits processed here: set last to end of unprocessed hits
00145     l=divider;
00146   }

void Atlfast::CalSection::giveHits const ICellSelector  ,
CellCollection *   
const
 

Returns a list of hit cells within the calorimeter section.

Definition at line 167 of file CalSection.cxx.

Referenced by Atlfast::Calorimeter::giveHitCells().

00167                                                                     {
00168     std::map<int, Cell*, std::less<int> >::const_iterator i;
00169     for(i=m_hitCells.begin(); i!=m_hitCells.end(); ++i){
00170       //test cell before newing and filling vector
00171       if( (*p_cellselect) (((*i).second))){ 
00172         Cell* cell = new Cell(*((*i).second));
00173       //Need to copy cells because Athena deletes container AND POINTERS
00174       // AND POINTEES
00175         cells->push_back(cell);
00176       }
00177     }
00178 
00179   }

void Atlfast::CalSection::smearCells ISmearer  
 

Smear the cells resolution.

Definition at line 182 of file CalSection.cxx.

Referenced by Atlfast::Calorimeter::smearCells().

00182                           {
00183     std::map<int, Cell*, std::less<int> >::const_iterator i;
00184     for(i=m_hitCells.begin(); i!=m_hitCells.end(); ++i){
00185       if((*((*i).second)).momentum().e() > 0){
00186         HepLorentzVector temp = p_smearer->smear((*((*i).second)).momentum());
00187           (*((*i).second)).setPt(temp);
00188       }
00189     }
00190   }

void Atlfast::CalSection::newHit const TransportedParticleCollectionCIter   [private]
 

Registers a new hit in the calorimeter section.

Definition at line 107 of file CalSection.cxx.

References m_cells, m_granEta, m_granPhi, m_hitCells, m_minEta, m_minPhi, m_nPhi, and Atlfast::TransportedParticleCollectionCIter.

Referenced by deposit().

00107                                                                          {
00108     const HepMC::GenParticle* particle = (*tpPtr)->particle();
00109     const double eta = particle->momentum().pseudoRapidity();
00110     const double phi = (*tpPtr)->phi();
00111     //    if(eta <= m_minEta || eta > m_maxEta) return;   
00112     //    if(phi <= m_minPhi || phi > m_maxPhi) return false;
00113     
00114     int iphi = int((phi-m_minPhi)/m_granPhi);
00115     int ieta = int((eta-m_minEta)/m_granEta);
00116 
00117     int index = m_nPhi*ieta  + iphi;
00118     //check cell is reasonable
00119     Cell* cell = m_cells[index];
00120     assert(abs(eta-(cell->eta()))<m_granEta);
00121     assert(abs(phi-(cell->phi()))<m_granPhi);
00122     cell->newHit(particle);
00123     //use a map to store pointers to hit cells to avoid
00124     //duplicate entries if the cell is hit more than once.
00125     m_hitCells[index] = cell;
00126 
00127     return;
00128   }

void Atlfast::CalSection::newHit const std::vector< Atlfast::EPileupDeposit * >::iterator &    [private]
 

Registers a new energy pileup in the calorimeter section.

Definition at line 149 of file CalSection.cxx.

References m_cells, m_granEta, m_granPhi, m_hitCells, m_minEta, m_minPhi, and m_nPhi.

00149                                                                                 {
00150     const double eta = (*tpPtr)->eta();
00151     const double phi = (*tpPtr)->phi();
00152     int iphi = int((phi-m_minPhi)/m_granPhi);
00153     int ieta = int((eta-m_minEta)/m_granEta);
00154     int index = m_nPhi*ieta  + iphi;
00155     //check cell is reasonable
00156     Cell* cell = m_cells[index];
00157     assert(abs(eta-(cell->eta()))<m_granEta);
00158     assert(abs(phi-(cell->phi()))<m_granPhi);
00159     cell->newHit(*tpPtr);
00160      //use a map to store pointers to hit cells to avoid
00161     //duplicate entries if the cell is hit more than once.
00162     m_hitCells[index] = cell;
00163     return;
00164   }

Member Data Documentation

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

minimum Eta sensitivity

Definition at line 91 of file CalSection.h.

Referenced by newHit().

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

maximum Eta sensitivity

Definition at line 93 of file CalSection.h.

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

minimum phi sensitivity

Definition at line 95 of file CalSection.h.

Referenced by CalSection(), and newHit().

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

maximum phi sensitivity

Definition at line 97 of file CalSection.h.

Referenced by CalSection().

double Atlfast::CalSection::m_granEta [private]
 

granularity in eta

Definition at line 99 of file CalSection.h.

Referenced by CalSection(), and newHit().

double Atlfast::CalSection::m_granPhi [private]
 

granularity in phi

Definition at line 101 of file CalSection.h.

Referenced by CalSection(), and newHit().

int Atlfast::CalSection::m_nPhi [private]
 

number of cells in phi space

Definition at line 103 of file CalSection.h.

Referenced by CalSection(), and newHit().

CalSectionReject Atlfast::CalSection::m_calSectionReject [private]
 

Calorimeter selection object.

Definition at line 107 of file CalSection.h.

Referenced by CalSection(), and deposit().

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

Cells owned by calorimeter section.

Definition at line 111 of file CalSection.h.

Referenced by CalSection(), newHit(), and ~CalSection().

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

Definition at line 112 of file CalSection.h.

Referenced by newHit(), and reset().

Cell* Atlfast::CalSection::lnkCell [private]
 

0..*

Definition at line 120 of file CalSection.h.


The documentation for this class was generated from the following files:
Generated on Tue Jan 28 09:57:34 2003 for AtlfastAlgs by doxygen1.3-rc1