#include <CellMaker.h>
Collaboration diagram for Atlfast::CellMaker:
Public Member Functions | |
CellMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
~CellMaker () | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
Private Member Functions | |
void | deflectParticles (ITransportedParticleCollection &) |
Private Attributes | |
Calorimeter * | m_calorimeter |
ICellSelector * | m_cellSelector |
HepMC_helper::IMCselector * | m_mcSelector |
EPileupMap * | m_epileupMap |
ISmearer * | m_smearer |
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_outputLocation |
std::string | m_outputLocation_IN4M |
std::string | m_mcLocation |
std::vector< int > | m_monopoleIDs |
TesIO * | m_tesIO |
MsgStream | m_log |
Maker class which reads Monte Carlo information from 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
CellMaker sequence
Definition at line 54 of file CellMaker.h.
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 39 of file CellMaker.cxx.
00039 : 00040 Algorithm(name,pSvcLocator), 00041 m_calorimeter(0), 00042 m_cellSelector(0), 00043 m_mcSelector(0), 00044 m_epileupMap(0), 00045 m_smearer(0), 00046 m_tesIO(0), 00047 m_log( messageService(), name ) 00048 { 00049 00050 //default paths for entities in the TES 00051 m_outputLocation = "/Event/AtlfastCells" ; 00052 m_outputLocation_IN4M = "/Event/AtlfastCellsIN4M"; 00053 00054 // default parameters to build the calorimeter 00055 m_etaCoverage = 5.0; 00056 m_minETCell = 0.0*GeV; 00057 m_granBarrelEta = 0.1; 00058 m_granBarrelPhi = 0.1; 00059 m_granForwardEta = 0.2; 00060 m_granForwardPhi = 0.2; 00063 m_doSmearing = false; 00064 m_fastShower = false; 00065 00066 declareProperty("OutputLocation", m_outputLocation); 00067 declareProperty("OutputLocationIN4M", m_outputLocation_IN4M); 00068 declareProperty("EtaCoverage", m_etaCoverage); 00069 declareProperty("MinETCell", m_minETCell); 00070 declareProperty("GranBarrelEta", m_granBarrelEta); 00071 declareProperty("GranBarrelPhi", m_granBarrelPhi); 00072 declareProperty("GranForwardEta", m_granForwardEta); 00073 declareProperty("GranForwardPhi", m_granForwardPhi); 00075 declareProperty("DoSmearing", m_doSmearing); 00076 declareProperty("FastShower", m_fastShower); 00077 00078 }
Atlfast::CellMaker::~CellMaker | ( | ) |
Default destructor
Definition at line 81 of file CellMaker.cxx.
00081 { 00082 00083 m_log<<MSG::DEBUG<<"CellMaker destructor starts "<<endreq; 00084 00085 m_log<<MSG::DEBUG<<"Deleting Calorimeter "<<endreq; 00086 if (m_calorimeter) delete m_calorimeter; 00087 00088 m_log<<MSG::DEBUG<<"Deleting TesIO "<<endreq; 00089 if (m_tesIO) delete m_tesIO; 00090 00091 m_log<<MSG::DEBUG<<"Deleting Cell Selector "<<endreq; 00092 if (m_cellSelector) delete m_cellSelector; 00093 00094 if (m_epileupMap) delete m_epileupMap; 00095 if (m_smearer) delete m_smearer; 00096 00097 m_log<<MSG::DEBUG<<"CellMaker destructor ends "<<endreq; 00098 }
StatusCode Atlfast::CellMaker::initialize | ( | ) |
Standard Athena-Algorithm 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 100 of file CellMaker.cxx.
00101 { 00102 00103 00104 //set up objects used to determine particle charge, 00105 // and to select input MC 4-vectors. 00106 m_cellSelector = new CellsAboveThreshold(m_minETCell); 00107 00108 00109 //get the Global Event Data using singleton pattern 00110 GlobalEventData* ged = GlobalEventData::Instance(); 00111 m_fieldOn = ged -> fieldOn(); 00112 m_mcSelector = ged -> visibleToCal(); 00113 m_barrelForwardEta = ged -> barrelForwardEta(); 00114 m_mcLocation = ged -> mcLocation(); 00115 m_monopoleIDs = ged -> monopoleIDs(); 00116 00117 // m_tesIO = new TesIO(eventDataService()); 00118 m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter()); 00119 00120 00121 if (fabs(m_etaCoverage) < fabs(m_barrelForwardEta) ) { 00122 m_log << MSG::ERROR 00123 << "asked to makecalo with max extent " 00124 << m_etaCoverage 00125 << "but barrel-forward boundary at " 00126 << m_barrelForwardEta << endreq; 00127 return StatusCode::FAILURE; 00128 } 00129 m_calorimeter = new Calorimeter( 00130 m_log, 00131 m_fastShower, 00132 m_etaCoverage, 00133 m_barrelForwardEta, 00134 m_granBarrelEta, 00135 m_granBarrelPhi, 00136 m_granForwardEta, 00137 m_granForwardPhi 00138 ); 00142 if(m_doSmearing == true){ 00143 m_epileupMap = new EPileupMap(ged->lumi()); 00144 m_smearer = new CellSmearer(ged->randSeed(),m_barrelForwardEta); 00145 }else{ 00146 m_epileupMap = NULL; 00147 m_smearer = NULL; 00148 } 00149 00150 HeaderPrinter hp("Atlfast Cell Maker:", m_log); 00151 00152 hp.add("Min Cell ET ", m_minETCell); 00153 hp.add("Magnetic Field is on? ", m_fieldOn); 00154 hp.add("MC Input Location ", m_mcLocation); 00155 hp.add("Output Location ", m_outputLocation); 00156 hp.add("INavigable4Momentum Output Location ", m_outputLocation_IN4M); 00157 hp.add("DoSmearing ", m_doSmearing); 00158 hp.add("Run FastShower ", m_fastShower); 00159 hp.add("Calorimeter Geometry: "); 00160 hp.add("Total Eta Range ", m_etaCoverage); 00161 hp.add("Barrel Eta Range ", m_barrelForwardEta); 00162 hp.add("Barrel Eta Granularity ", m_granBarrelEta); 00163 hp.add("Barrel Phi Granularity ", m_granBarrelPhi); 00164 hp.add("Forward Eta Granularity ", m_granForwardEta); 00165 hp.add("Forward Phi Granularity ", m_granForwardPhi); 00166 hp.print(); 00167 00168 00169 00170 return StatusCode::SUCCESS; 00171 }
StatusCode Atlfast::CellMaker::execute | ( | ) |
Standard Athena-Algorithm 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 181 of file CellMaker.cxx.
00182 { 00183 //............................................. 00184 00185 m_log << MSG::DEBUG << "CellMaker execute()" << endreq; 00186 00187 ITransportedParticleCollection particlesAtCal; 00188 deflectParticles(particlesAtCal); 00189 00190 // give to calorimeter (iseq gives the interval [begin,end) 00191 ITransportedParticleCollectionIter fpart = particlesAtCal.begin(); 00192 ITransportedParticleCollectionIter lpart = particlesAtCal.end(); 00193 m_calorimeter->deposit(fpart, lpart); 00194 00195 //Delete the the container of transported particles and its pointers 00196 containerDelete(particlesAtCal.begin(), particlesAtCal.end()); 00197 00198 00199 // Add in the energy pileup 00200 if(m_doSmearing){ 00201 00202 //Smear the cells resolution first 00203 m_calorimeter->smearCells(m_smearer); 00204 m_log << MSG::DEBUG << "Doing Smearing" << endreq; 00205 00207 m_epileupMap->fillMap(); 00208 m_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(); 00216 00218 m_calorimeter->deposit(fdep, ldep); 00219 m_log << MSG::DEBUG << "ECAL pileup deposited" << endreq; 00220 m_log << MSG::DEBUG << "Size of HAD EPileup vector: " 00221 << m_epileupMap->getHadMap()->size() 00222 << endreq; 00223 fdep = m_epileupMap->getHadMap()->begin(); 00224 ldep = m_epileupMap->getHadMap()->end(); 00225 00227 m_calorimeter->deposit(fdep, ldep); 00228 m_log << MSG::DEBUG << "HCAL pileup deposited" << endreq; 00229 } 00230 00231 m_log << MSG::DEBUG << "deposit" << endreq; 00232 00233 // Ask for Cells passing selection criteria of m_cellSelector (=Et). 00234 00235 // For now, we will make, fill and store two collections here 00236 // The first is to be used iternally by Atlfast Algorithms: 00237 ITwoCptCellCollection* cells = new ITwoCptCellCollection; 00238 // The second will be read in by the full jet reconstruction: 00239 INavigable4MomentumCollection *cells_IN4M = 00240 new INavigable4MomentumCollection(SG::VIEW_ELEMENTS); 00241 00242 00243 //************************ 00246 m_calorimeter->giveHitCells(m_cellSelector, cells); 00247 m_log << MSG::DEBUG << "hit cells retrieved, " << cells->size() 00248 << " cells were hit this event " << endreq; 00249 00250 // Fill the IN4M collection with pointers to the ITwoCptCells 00251 ITwoCptCellCollection::const_iterator cellItr = cells->begin(); 00252 for (;cellItr != cells->end(); ++cellItr){ 00253 INavigable4Momentum *cell_IN4M = *cellItr; 00254 cells_IN4M->push_back(cell_IN4M); 00255 } 00256 00257 // finished with the calorimeter 00258 m_calorimeter->reset(); 00259 m_log << MSG::DEBUG << "calorimeter reset" << endreq; 00260 00261 // then store and return 00262 TesIoStat stat = m_tesIO->store(cells, m_outputLocation ); 00263 std::string mess = stat ? "Stored cells in TES":"Failed store cells in TES"; 00264 m_log << MSG::DEBUG << mess << endreq; 00265 00266 stat = m_tesIO->store(cells_IN4M, m_outputLocation_IN4M ); 00267 if (stat) m_log << MSG::DEBUG << "Stored cells in TES as INavigable4MomentumCollection" << endreq; 00268 else m_log << MSG::ERROR << "Failed to store cells in TES as INavigable4MomentumCollection" << endreq; 00269 00270 return stat; 00271 00272 }
StatusCode Atlfast::CellMaker::finalize | ( | ) |
Standard Athena-Algorithm finalize
Definition at line 173 of file CellMaker.cxx.
00174 { 00175 00176 m_log<<MSG::INFO<<"Finalizing"<<endreq; 00177 return StatusCode::SUCCESS; 00178 }
void Atlfast::CellMaker::deflectParticles | ( | ITransportedParticleCollection & | ) | [private] |
Definition at line 274 of file CellMaker.cxx.
00274 { 00275 00276 m_log << MSG::DEBUG << "CellMaker deflectParticles()" << endreq; 00277 00278 // read MC particles from TES 00279 MCparticleCollection p; 00280 TesIoStat stat = m_tesIO->getMC( p, m_mcSelector ) ; 00281 std::string mess; 00282 mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES "; 00283 m_log << MSG::DEBUG << mess << p.size()<<endreq; 00284 00285 MCparticleCollectionCIter ip= p.begin(); 00286 for(; ip<p.end(); ++ip){ 00287 00288 // Factory comes back with the relevant TransportedParticle 00289 ITransportedParticle *itp = ITransportedParticleFactory::create(*ip,m_monopoleIDs); 00290 itp->deflect(); 00291 itpc.push_back(itp); 00292 00293 } 00294 00295 return; 00296 00297 }
Calorimeter* Atlfast::CellMaker::m_calorimeter [private] |
Definition at line 74 of file CellMaker.h.
ICellSelector* Atlfast::CellMaker::m_cellSelector [private] |
Definition at line 75 of file CellMaker.h.
Definition at line 76 of file CellMaker.h.
EPileupMap* Atlfast::CellMaker::m_epileupMap [private] |
EPileupMap contains the pileup energy distribution to be put into calorimeter
Definition at line 78 of file CellMaker.h.
ISmearer* Atlfast::CellMaker::m_smearer [private] |
CellSmearer, smears cells pt before put into CellCollection
Definition at line 80 of file CellMaker.h.
double Atlfast::CellMaker::m_etaCoverage [private] |
Definition at line 83 of file CellMaker.h.
double Atlfast::CellMaker::m_minETCell [private] |
Definition at line 84 of file CellMaker.h.
double Atlfast::CellMaker::m_barrelForwardEta [private] |
Definition at line 85 of file CellMaker.h.
bool Atlfast::CellMaker::m_fieldOn [private] |
Definition at line 86 of file CellMaker.h.
bool Atlfast::CellMaker::m_doSmearing [private] |
warning! not fully tested. Should not be used if JetSmearing == true
switch on cell smearing
Definition at line 89 of file CellMaker.h.
bool Atlfast::CellMaker::m_fastShower [private] |
double Atlfast::CellMaker::m_granBarrelEta [private] |
Definition at line 94 of file CellMaker.h.
double Atlfast::CellMaker::m_granBarrelPhi [private] |
Definition at line 95 of file CellMaker.h.
double Atlfast::CellMaker::m_granForwardEta [private] |
Definition at line 96 of file CellMaker.h.
double Atlfast::CellMaker::m_granForwardPhi [private] |
Definition at line 97 of file CellMaker.h.
std::string Atlfast::CellMaker::m_outputLocation [private] |
Definition at line 100 of file CellMaker.h.
std::string Atlfast::CellMaker::m_outputLocation_IN4M [private] |
Definition at line 101 of file CellMaker.h.
std::string Atlfast::CellMaker::m_mcLocation [private] |
Definition at line 104 of file CellMaker.h.
std::vector<int> Atlfast::CellMaker::m_monopoleIDs [private] |
Definition at line 107 of file CellMaker.h.
TesIO* Atlfast::CellMaker::m_tesIO [private] |
Definition at line 109 of file CellMaker.h.
MsgStream Atlfast::CellMaker::m_log [private] |
Definition at line 110 of file CellMaker.h.