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

Atlfast::CellMaker Class Reference

Maker class which reads Monte Carlo information form the TES and causes a calorimeter simulation of their energy deposits.
This results in a collection of hit Cell entities to be written to the TES. More...

#include <CellMaker.h>

Collaboration diagram for Atlfast::CellMaker:

Collaboration graph
[legend]
List of all members.

Public Methods

 CellMaker (const std::string &name, ISvcLocator *pSvcLocator)
 Standard Athena-Algorithm Constructor.

 ~CellMaker ()
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()

Private Attributes

Calorimeterm_calorimeter
ICellSelectorm_cellSelector
HepMC_helper::IMCselector * m_mcSelector
EPileupMapm_epileupMap
 EPileupMap contains the pileup energy distribution to be put into calorimeter.

ISmearerm_smearer
 CellSmearer, smears cells pt before put into CellCollection.

double m_etaCoverage
double m_minETCell
double m_barrelForwardEta
bool m_fieldOn
bool m_doSmearing
 warning! not fully tested. Should not be used if JetSmearing == true

bool m_fastShower
 flag to control if FastShower is to run

double m_granBarrelEta
double m_granBarrelPhi
double m_granForwardEta
double m_granForwardPhi
std::string m_inputLocation
std::string m_outputLocation
TesIO * m_tesIO
MagFieldm_magField

Detailed Description

Maker class which reads Monte Carlo information form the TES and causes a calorimeter simulation of their energy deposits.
This results in a collection of hit Cell entities to be written to the TES.

Definition at line 39 of file CellMaker.h.


Constructor & Destructor Documentation

Atlfast::CellMaker::CellMaker const std::string &    name,
ISvcLocator *    pSvcLocator
 

Standard Athena-Algorithm Constructor.

This doSmearing is still in experimental phase and should NOT be set to true by any user

WARNING!! DoSmearing should not be changed from default of false

Definition at line 41 of file CellMaker.cxx.

References m_doSmearing, m_etaCoverage, m_fastShower, m_granBarrelEta, m_granBarrelPhi, m_granForwardEta, m_granForwardPhi, m_inputLocation, m_minETCell, and m_outputLocation.

00041                                                                       :
00042     Algorithm(name,pSvcLocator){
00043     
00044     //default paths for entities in the TES
00045     m_inputLocation       = "/Event/McEventCollection";
00046     m_outputLocation      = "/Event/AtlfastCells" ;
00047     
00048     // default parameters to build the calorimeter
00049     m_etaCoverage        = 5.0;
00050     m_minETCell          = 0.0;
00051     m_granBarrelEta      = 0.1;
00052     m_granBarrelPhi      = 0.1;
00053     m_granForwardEta     = 0.2;
00054     m_granForwardPhi     = 0.2;
00057     m_doSmearing         = false;
00058     m_fastShower         = false;
00059     
00060     declareProperty("InputLocation",      m_inputLocation);
00061     declareProperty("OutputLocation",     m_outputLocation);
00062     declareProperty("EtaCoverage",        m_etaCoverage);
00063     declareProperty("MinETCell",          m_minETCell);
00064     declareProperty("GranBarrelEta",      m_granBarrelEta);
00065     declareProperty("GranBarrelPhi",      m_granBarrelPhi);
00066     declareProperty("GranForwardEta",     m_granForwardEta);
00067     declareProperty("GranForwardPhi",     m_granForwardPhi);
00069     declareProperty("DoSmearing",     m_doSmearing);
00070     declareProperty("FastShower",     m_fastShower);
00071     
00072   }
  

Atlfast::CellMaker::~CellMaker  
 

Definition at line 75 of file CellMaker.cxx.

References m_calorimeter, m_cellSelector, m_magField, and m_tesIO.

00075                        {
00076 
00077     MsgStream log( messageService(), name() );
00078     log<<MSG::DEBUG<<"CellMaker destructor starts "<<endreq;
00079 
00080     if (m_calorimeter) {
00081       delete m_calorimeter;
00082     }
00083     if (m_tesIO) {
00084       delete m_tesIO;
00085     }
00086     if (m_cellSelector) {
00087       delete m_cellSelector;
00088     }
00089     if (m_magField) {
00090       delete m_magField;
00091     }
00092     log<<MSG::DEBUG<<"CellMaker destructor ends "<<endreq;
00093   }

Member Function Documentation

StatusCode Atlfast::CellMaker::initialize  
 

NOTE!! Smearing should not be switched on

if we want to perform cell level smearing, must make a CellSmearer and a Energy Pileup map

Definition at line 95 of file CellMaker.cxx.

References Atlfast::GlobalEventData::fieldOn(), Atlfast::GlobalEventData::lumi(), m_barrelForwardEta, m_calorimeter, m_cellSelector, m_doSmearing, m_epileupMap, m_etaCoverage, m_fastShower, m_fieldOn, m_granBarrelEta, m_granBarrelPhi, m_granForwardEta, m_granForwardPhi, m_inputLocation, m_magField, m_mcSelector, m_minETCell, m_outputLocation, m_smearer, m_tesIO, and Atlfast::GlobalEventData::randSeed().

00096   {
00097     
00098     MsgStream log( messageService(), name() );
00099 
00100     //set up objects used to determine particle charge,
00101     // and to select input MC 4-vectors.
00102     m_cellSelector  = new CellsAboveThreshold(m_minETCell);
00103     
00104     //    m_tesIO = new TesIO(eventDataService());
00105     m_tesIO = new TesIO();
00106 
00107     //get the Global Event Data using singleton pattern
00108     GlobalEventData* ged = GlobalEventData::Instance();
00109     m_fieldOn          = ged->fieldOn();
00110     m_mcSelector       = ged -> visibleToCal();
00111     m_barrelForwardEta = ged -> barrelForwardEta();
00112     m_magField      = new MagField(m_fieldOn);
00113     if (fabs(m_etaCoverage) < fabs(m_barrelForwardEta) ) {
00114       log << MSG::ERROR 
00115           << "asked to makecalo with max extent " 
00116           << m_etaCoverage 
00117           << "but barrel-forward boundary at " 
00118           << m_barrelForwardEta << endreq;
00119       return StatusCode::FAILURE;
00120     }
00121     m_calorimeter = new Calorimeter(
00122                                     log,
00123                                     m_fastShower,
00124                                     m_etaCoverage, 
00125                                     m_barrelForwardEta,
00126                                     m_granBarrelEta, 
00127                                     m_granBarrelPhi, 
00128                                     m_granForwardEta, 
00129                                     m_granForwardPhi
00130                                     );
00134     if(m_doSmearing == true){
00135       m_epileupMap = new EPileupMap(ged->lumi());
00136       m_smearer = new CellSmearer(ged->randSeed(),m_barrelForwardEta);
00137     }else{
00138       m_epileupMap = NULL;
00139       m_smearer = NULL;
00140     }
00141 
00142     HeaderPrinter hp("Atlfast Cell Maker:", log);
00143     
00144     hp.add("min Cell ET             ", m_minETCell);  
00145     hp.add("Magnetic Field is on?   ", m_fieldOn);
00146     hp.add("Input Location          ", m_inputLocation);    
00147     hp.add("Output Location         ", m_outputLocation);
00148     hp.add(" DoSmearing             ", m_doSmearing);    
00149     hp.add(" Run FastShower         ", m_fastShower);    
00150     hp.add("Calorimeter Geometry:   ");
00151     hp.add(" Total Eta Range        ", m_etaCoverage);
00152     hp.add(" Barrel Eta Range       ", m_barrelForwardEta);
00153     hp.add(" Barrel Eta Granularity ", m_granBarrelEta);
00154     hp.add(" Barrel Phi Granularity ", m_granBarrelPhi);
00155     hp.add(" Forward Eta Granularity", m_granForwardEta);
00156     hp.add(" Forward Phi Granularity", m_granForwardPhi);
00157     hp.print();
00158 
00159 
00160       
00161     return StatusCode::SUCCESS; 
00162   }

StatusCode Atlfast::CellMaker::execute  
 

randomly fill the map from a text file

deposit energy pileup into EM calorimeter

deposit energy pileup into EM calorimeter

pass pointer to smearer as well, if not NULL, then cells pT is smeared before the ITwoCellCollection is filled

Definition at line 173 of file CellMaker.cxx.

References Atlfast::TransportedParticleCollection::begin(), Atlfast::Calorimeter::deposit(), Atlfast::TransportedParticleCollection::end(), Atlfast::EPileupMap::fillMap(), Atlfast::EPileupMap::getEMMap(), Atlfast::EPileupMap::getHadMap(), Atlfast::Calorimeter::giveHitCells(), m_calorimeter, m_cellSelector, m_epileupMap, m_mcSelector, m_outputLocation, m_smearer, m_tesIO, Atlfast::Calorimeter::reset(), Atlfast::Calorimeter::smearCells(), and Atlfast::TransportedParticleCollectionIter.

00174   {
00175     //.............................................
00176     
00177     MsgStream log( messageService(), name() );
00178     log << MSG::DEBUG << "CellMaker execute()" << endreq;
00179 
00180     std::string mess;
00181     
00182 
00183     // read MC particles from TES
00184     MCparticleCollection  mcParticles ;
00185     TesIoStat stat = m_tesIO->getMC( mcParticles, m_mcSelector ) ;
00186     mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES";
00187     log << MSG::DEBUG << mess << endreq;
00188     
00189     // calculate phi after the bending in the magnetic field, 
00190     TransportedParticleCollection particlesAtCal;
00191     (*m_magField)(mcParticles, particlesAtCal);
00192     log << MSG::DEBUG << "bend" << endreq;
00193     
00194     //    return stat;
00195     // give to calorimeter (iseq gives the interval [begin,end)
00196     TransportedParticleCollectionIter fpart = particlesAtCal.begin();
00197     TransportedParticleCollectionIter lpart = particlesAtCal.end();
00198     m_calorimeter->deposit(fpart, lpart);
00199 
00200 
00201     // Add in the energy pileup 
00202     if(m_doSmearing){
00203       //Smear the cells resolution first
00204       m_calorimeter->smearCells(m_smearer);
00205       log << MSG::DEBUG << "Doing Smearing" << endreq;
00207       m_epileupMap->fillMap();
00208       log << MSG::DEBUG 
00209           << "Size of EM EPileup vector: " 
00210           << m_epileupMap->getEMMap()->size() 
00211           << endreq;
00212       std::vector<Atlfast::EPileupDeposit*>::iterator fdep = 
00213         m_epileupMap->getEMMap()->begin();
00214       std::vector<Atlfast::EPileupDeposit*>::iterator ldep = 
00215         m_epileupMap->getEMMap()->end();
00217       m_calorimeter->deposit(fdep, ldep);
00218       log << MSG::DEBUG << "ECAL pileup deposited" << endreq;
00219       log << MSG::DEBUG << "Size of HAD EPileup vector: " 
00220           << m_epileupMap->getHadMap()->size() 
00221           << endreq;
00222       fdep = m_epileupMap->getHadMap()->begin();
00223       ldep = m_epileupMap->getHadMap()->end();
00225       m_calorimeter->deposit(fdep, ldep);
00226       log << MSG::DEBUG << "HCAL pileup deposited" << endreq;
00227     }
00228 
00229     log << MSG::DEBUG << "deposit" << endreq;
00230     
00231     // ask for Cells passing selection criteria of m_cellSelector (=Et).
00232     //************************
00233     //this worked 23/12 PS
00234     ITwoCptCellCollection* cells = new ITwoCptCellCollection;
00235     //************************
00238     m_calorimeter->giveHitCells(m_cellSelector, cells);
00239     log << MSG::DEBUG << "hit cells retrieved, " << cells->size() 
00240         << " cells were hit this event " << endreq;
00241 
00242     //    return stat;
00243 
00244     // finished with the calorimeter
00245     m_calorimeter->reset();
00246     log << MSG::DEBUG << "calorimeter reset" << endreq;
00247     //    return stat;
00248     //    return stat;
00249     
00250     // then store and return
00251     stat = m_tesIO->store(cells, m_outputLocation );  
00252     mess = stat? " Stored cells to TES":" Failed store cells to TES";
00253     log << MSG::DEBUG << mess << endreq;
00254 
00255     return stat;
00256   }

StatusCode Atlfast::CellMaker::finalize  
 

Definition at line 164 of file CellMaker.cxx.

00165   {
00166     
00167     MsgStream log( messageService(), name() );
00168     log<<MSG::INFO<<"Finalizing"<<endreq;
00169     return StatusCode::SUCCESS; 
00170   }

Member Data Documentation

Calorimeter* Atlfast::CellMaker::m_calorimeter [private]
 

Definition at line 51 of file CellMaker.h.

Referenced by execute(), initialize(), and ~CellMaker().

ICellSelector* Atlfast::CellMaker::m_cellSelector [private]
 

Definition at line 52 of file CellMaker.h.

Referenced by execute(), initialize(), and ~CellMaker().

HepMC_helper::IMCselector* Atlfast::CellMaker::m_mcSelector [private]
 

Definition at line 53 of file CellMaker.h.

Referenced by execute(), and initialize().

EPileupMap* Atlfast::CellMaker::m_epileupMap [private]
 

EPileupMap contains the pileup energy distribution to be put into calorimeter.

Definition at line 55 of file CellMaker.h.

Referenced by execute(), and initialize().

ISmearer* Atlfast::CellMaker::m_smearer [private]
 

CellSmearer, smears cells pt before put into CellCollection.

Definition at line 57 of file CellMaker.h.

Referenced by execute(), and initialize().

double Atlfast::CellMaker::m_etaCoverage [private]
 

Definition at line 60 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_minETCell [private]
 

Definition at line 61 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_barrelForwardEta [private]
 

Definition at line 62 of file CellMaker.h.

Referenced by initialize().

bool Atlfast::CellMaker::m_fieldOn [private]
 

Definition at line 63 of file CellMaker.h.

Referenced by initialize().

bool Atlfast::CellMaker::m_doSmearing [private]
 

warning! not fully tested. Should not be used if JetSmearing == true

Definition at line 66 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

bool Atlfast::CellMaker::m_fastShower [private]
 

flag to control if FastShower is to run

Definition at line 68 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_granBarrelEta [private]
 

Definition at line 72 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_granBarrelPhi [private]
 

Definition at line 73 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_granForwardEta [private]
 

Definition at line 74 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

double Atlfast::CellMaker::m_granForwardPhi [private]
 

Definition at line 75 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

std::string Atlfast::CellMaker::m_inputLocation [private]
 

Definition at line 78 of file CellMaker.h.

Referenced by CellMaker(), and initialize().

std::string Atlfast::CellMaker::m_outputLocation [private]
 

Definition at line 79 of file CellMaker.h.

Referenced by CellMaker(), execute(), and initialize().

TesIO* Atlfast::CellMaker::m_tesIO [private]
 

Definition at line 81 of file CellMaker.h.

Referenced by execute(), initialize(), and ~CellMaker().

MagField* Atlfast::CellMaker::m_magField [private]
 

Definition at line 82 of file CellMaker.h.

Referenced by initialize(), and ~CellMaker().


The documentation for this class was generated from the following files:
Generated on Tue Mar 18 11:18:53 2003 for AtlfastAlgs by doxygen1.3-rc1