#include <DefaultReconstructedParticleMaker.h>
Collaboration diagram for Atlfast::DefaultReconstructedParticleMaker:
Public Methods | |
DefaultReconstructedParticleMaker (const std::string &name, ISvcLocator *pSvcLocator) | |
Standard Athena-Algorithm Constructor. | |
virtual | ~DefaultReconstructedParticleMaker () |
Default Destructor. | |
virtual StatusCode | initialize () |
Standard Athena-Algorithm method. | |
virtual StatusCode | execute () |
Standard Athena-Algorithm method. | |
virtual StatusCode | finalize () |
Standard Athena-Algorithm method. | |
Private Types | |
typedef std::vector< HepMC::GenParticle * > | t_MC_particleCollection |
typedef std::vector< HepMC::GenParticle * >::iterator | t_MC_particleIterator |
Private Methods | |
void | getSmearer (int lumi, int seed, MsgStream &log) |
Creates ReconstructedParticle from MC particles. | |
virtual ReconstructedParticle * | create (MsgStream &, const HepMC::GenParticle *) |
Creates ReconstructedParticle from MC particles. | |
virtual bool | isAcceptable (MsgStream &, const ReconstructedParticle *) |
Applies acceptance cuts. | |
Private Attributes | |
int | m_particleType |
Species to process. | |
double | m_mcPtMin |
Minimum transverse momentum required. | |
double | m_mcEtaMax |
Maximum required eta. | |
double | m_PtMin |
minimum transverse momentum post construction | |
double | m_EtaMax |
Maximum eta. | |
bool | m_doSmearing |
Flag to switch off smearing for debugging purposes. | |
std::string | m_MC_eventLocation |
TES location of HepMC::GenParticles. | |
std::string | m_outputLocation |
TES output location. | |
int | m_muSmearKey |
Muon smearing key. | |
HepMC_helper::IMCselector * | m_ncutter |
Used to select HepMC::GenParticles by type 1. | |
ISmearer * | m_smearer |
Smearer object which specialises the algorithm for a specific particle species 1. | |
ReconstructedParticle * | lnkReconstructedParticle |
0..* | |
TesIO * | m_tesIO |
Gets MC particles from TES. |
The ReconstructedParticle is created with a smeared energy which can be different for different species.
The ReconstructedParticles are written to the TES
Definition at line 86 of file DefaultReconstructedParticleMaker.h.
|
Definition at line 121 of file DefaultReconstructedParticleMaker.h. |
|
Definition at line 122 of file DefaultReconstructedParticleMaker.h. |
|
Standard Athena-Algorithm Constructor.
Definition at line 49 of file DefaultReconstructedParticleMaker.cxx.
00050 : Algorithm( name, pSvcLocator ){ 00051 00052 // Set the parameter defaults. 00053 m_particleType = 11; 00054 m_mcPtMin = 0.0; 00055 m_mcEtaMax = 100.0; 00056 m_PtMin = 5.0; 00057 m_EtaMax = 2.5; 00058 m_doSmearing = true; 00059 m_muSmearKey = 1; 00060 m_MC_eventLocation = "/Event/McEventCollection" ; 00061 m_outputLocation = "/Event/AtlfastReconstructedParticle" ; 00062 00063 // Declare the paramemters to Gaudi so that 00064 // they can be over-written via the job options file 00065 declareProperty( "ParticleType", m_particleType ) ; 00066 declareProperty( "mcMinimumPt", m_mcPtMin ) ; 00067 declareProperty( "mcMaximumEta", m_mcEtaMax ) ; 00068 declareProperty( "MinimumPt", m_PtMin ) ; 00069 declareProperty( "MaximumEta", m_EtaMax ) ; 00070 declareProperty( "DoSmearing",m_doSmearing ); 00071 declareProperty( "MC_eventLocation", m_MC_eventLocation ) ; 00072 declareProperty( "OutputLocation", m_outputLocation ) ; 00073 declareProperty( "MuonSmearKey",m_muSmearKey ); 00074 00075 } |
|
Default Destructor.
Definition at line 81 of file DefaultReconstructedParticleMaker.cxx. References m_ncutter, m_smearer, and m_tesIO.
00081 { 00082 MsgStream log( messageService(), name() ) ; 00083 log << MSG::INFO << "Destructor Called" << endreq; 00084 00085 if (m_smearer) { 00086 log << MSG::INFO << "Deleting smearer" << endreq; 00087 delete m_smearer; 00088 } 00089 if (m_tesIO) { 00090 log << MSG::INFO << "Deleting smearer" << endreq; 00091 delete m_tesIO; 00092 } 00093 if (m_ncutter) { 00094 log << MSG::INFO << "Deleting smearer" << endreq; 00095 delete m_ncutter; 00096 } 00097 } |
|
Standard Athena-Algorithm method.
Definition at line 104 of file DefaultReconstructedParticleMaker.cxx. References getSmearer(), Atlfast::GlobalEventData::lumi(), m_doSmearing, m_EtaMax, m_MC_eventLocation, m_mcEtaMax, m_mcPtMin, m_muSmearKey, m_ncutter, m_outputLocation, m_particleType, m_PtMin, m_smearer, m_tesIO, and Atlfast::GlobalEventData::randSeed().
00105 { 00106 MsgStream log( messageService(), name() ) ; 00107 00108 // This method is called by Athena once only, after all 00109 // properties have been set. 00110 00111 // Set up NCutter to select the required HepMC::GenParticles 00112 typedef HepMC_helper::IMCselector Selector; 00113 00114 Selector* typeSelector = new HepMC_helper::SelectType( m_particleType); 00115 Selector* kineSelector = new HepMC_helper::MCCuts(m_mcPtMin, m_mcEtaMax); 00116 Selector* fstaSelector = new HepMC_helper::IsFinalState(); 00117 00118 vector<HepMC_helper::IMCselector*> selectors; 00119 selectors.push_back(fstaSelector); 00120 selectors.push_back(typeSelector); 00121 selectors.push_back(kineSelector); 00122 00123 m_ncutter = new HepMC_helper::NCutter(selectors); 00124 00125 delete typeSelector; 00126 delete fstaSelector; 00127 delete kineSelector; 00128 //======================================================= 00129 00130 00131 // m_tesIO = new TesIO(eventDataService()); 00132 m_tesIO = new TesIO(); 00133 //===================== 00134 00135 00136 //get the Global Event Data using singleton pattern 00137 GlobalEventData* ged = GlobalEventData::Instance(); 00138 int lumi = ged->lumi(); 00139 log << MSG::DEBUG << "got lumi " << endreq; 00140 int randSeed = ged->randSeed() ; 00141 if (m_doSmearing) this->getSmearer(lumi, randSeed, log); 00142 else m_smearer = NULL; 00143 00144 HeaderPrinter hp("Atlfast ReconstructedParticle Maker:", log); 00145 hp.add("Particle Type ", m_particleType); 00146 hp.add("Luminosity ", lumi); 00147 hp.add("Minimum four-vector Pt ", m_mcPtMin); 00148 hp.add("Maximum four-vector Eta ", m_mcEtaMax); 00149 hp.add("Minimum particle Pt ", m_PtMin); 00150 hp.add("Maximum particle Eta ", m_EtaMax); 00151 hp.add("Do Smearing ", m_doSmearing); 00152 hp.add("Muon Smearing Flag ", m_muSmearKey); 00153 hp.add("Random Number Seed ", randSeed); 00154 hp.add("MC location ", m_MC_eventLocation); 00155 hp.add("Output Location ", m_outputLocation); 00156 hp.print(); 00157 00158 00159 00160 00161 00162 // We have to build an appropriate smearer object here. 00163 // The code which follows is to be regarded as a temporary fix to 00164 // get around the fact that Algorithms cannot be specialised by 00165 // constructor arguments. 00166 // When tools become avialable we will probably instead just pass 00167 // an appropriate tool via job options 00168 return StatusCode::SUCCESS ; 00169 } |
|
Standard Athena-Algorithm method.
Definition at line 207 of file DefaultReconstructedParticleMaker.cxx. References create(), isAcceptable(), m_ncutter, m_outputLocation, and m_tesIO.
00208 { 00209 00210 MsgStream log( messageService(), name() ) ; 00211 std::string mess; 00212 log << MSG::DEBUG << "Execute() " << endreq; 00213 00214 00215 //............................. 00216 // Obtain the truth HepMC::GenParticles which we want to process. 00217 // We fill a local collection with pointers to these Particles. 00218 // The private method which is used applies selection criteria 00219 // to the HepMC::GenParticles before placing them in the collection 00220 00221 MCparticleCollection my_MC_particles ; 00222 MCparticleCollectionCIter src ; 00223 00224 TesIoStat stat = m_tesIO->getMC( my_MC_particles, m_ncutter ) ; 00225 mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES"; 00226 log << MSG::DEBUG << mess << endreq; 00227 00228 // ...................... 00229 // Make a container object which will store pointers to all 00230 // ReconstructedParticles which are successfully created. 00231 // Since it is going into the TES, it has to be a special Athena type 00232 // of container. This is defined in an include file. 00233 00234 ReconstructedParticleCollection* myReconstructedParticles 00235 = new ReconstructedParticleCollection ; 00236 00237 00238 //......................................................... 00239 // From each mc truth Particle, create a ReconstructedParticle candidate. 00240 // If it satisfies requirements add to the output collection 00241 00242 ReconstructedParticle* candidate ; 00243 00244 for(src = my_MC_particles.begin() ; src != my_MC_particles.end() ; ++src){ 00245 00246 00247 candidate = this->create( log, *src ); 00248 00249 if( this->isAcceptable( log, candidate ) ) { 00250 myReconstructedParticles->push_back( candidate ) ; 00251 }else{ 00252 delete candidate ; 00253 } 00254 00255 } 00256 00257 00258 //..................................... 00259 // Sort into ascending order of pT 00260 00261 if( myReconstructedParticles->size() > 0 ){ 00262 sort( myReconstructedParticles->begin(), 00263 myReconstructedParticles->end(), 00264 SortAttribute::DescendingPT() 00265 ) ; 00266 } 00267 00268 00269 //...................................... 00270 // Deal with resulting ReconstructedParticles (if any) 00271 00272 stat =m_tesIO->store( myReconstructedParticles, m_outputLocation ); 00273 mess = stat? "Store to TES success":"Store to TES failure"; 00274 log << MSG::DEBUG << mess << endreq; 00275 00276 log << MSG::DEBUG << "Ending<-------- " << endreq; 00277 00278 StatusCode sc=StatusCode::SUCCESS; 00279 return sc ; 00280 00281 } |
|
Standard Athena-Algorithm method.
Definition at line 175 of file DefaultReconstructedParticleMaker.cxx.
00176 { 00177 00178 MsgStream log( messageService(), name() ) ; 00179 00180 log << MSG::INFO << "Finalizing" << endreq; 00181 00182 return StatusCode::SUCCESS ; 00183 } |
|
Creates ReconstructedParticle from MC particles.
Definition at line 386 of file DefaultReconstructedParticleMaker.cxx. References m_muSmearKey, m_particleType, and m_smearer. Referenced by initialize().
00388 { 00389 00390 if (m_particleType == 11) 00391 { 00392 log << MSG::DEBUG << "instantiating an ElectronSmearer" << endreq; 00393 m_smearer = new ElectronSmearer(randSeed, lumi); 00394 } 00395 else if (m_particleType == 13) 00396 { 00397 log << MSG::DEBUG << "instantiating a MuonSmearer" << endreq; 00398 m_smearer = new MuonSmearer(randSeed, lumi, m_muSmearKey); 00399 } 00400 else if (m_particleType == 22) 00401 { 00402 log << MSG::DEBUG << "instantiating a PhotonSmearer" << endreq; 00403 m_smearer = new PhotonSmearer(randSeed, lumi); 00404 } 00405 else 00406 { 00407 log << MSG::ERROR 00408 << "No specific smearer known for particle type " 00409 << m_particleType 00410 << " using a default which is probably not what you need!" 00411 << endreq; 00412 m_smearer = new DefaultSmearer(randSeed); 00413 } 00414 } |
|
Creates ReconstructedParticle from MC particles.
Definition at line 298 of file DefaultReconstructedParticleMaker.cxx. References m_smearer, and Atlfast::ISmearer::smear(). Referenced by execute().
00300 { 00301 00302 ReconstructedParticle* candidate ; 00303 00304 if (m_doSmearing) { 00305 00306 // Ask our Smearer make a smeared 4-vector 00307 HepLorentzVector evec = m_smearer->smear( src->momentum() ); 00308 00309 log << MSG::DEBUG 00310 << "\n\t" 00311 << "Unsmeared four-vector: " 00312 << src->momentum() 00313 << "\n\t" 00314 << "Smeared four-vector : " 00315 << evec 00316 << endreq; 00317 00318 // Note:It would really make sense to apply the kinematic cuts here. 00319 // rather than in isAcceptable method. 00320 // However we leave this to next design phase as we also need to 00321 // consider where to put Isolation cuts. 00322 00323 //Make a new ReconstructedParticle with smeared 4-vector 00324 //RMS Fix unsigned pdg_id 00325 candidate = new ReconstructedParticle 00326 (src->pdg_id() /*m_particleType*/, evec, src ) ; 00327 }else{ 00328 // Just use the original unsmeared four-momentum 00329 candidate = new ReconstructedParticle 00330 ( src->pdg_id() /*m_particleType*/, src->momentum(), src ); 00331 } 00332 00333 00334 log << MSG::DEBUG 00335 << "Created ReconstructedParticle: \n\t " 00336 << candidate 00337 << endreq; 00338 00339 return candidate ; 00340 00341 } |
|
Applies acceptance cuts.
Definition at line 352 of file DefaultReconstructedParticleMaker.cxx. Referenced by execute().
00352 { 00353 00354 // Apply kinematic criteria to the candidate DefaultReconstructedParticle 00355 00356 if( candidate->pT() < m_PtMin ) { 00357 log << MSG::DEBUG 00358 << "Candidate failed pt cut: pt was " 00359 << candidate->pT() 00360 << " cut was " 00361 << m_PtMin 00362 << endreq; 00363 return false ; 00364 } 00365 00366 if( abs(candidate->eta()) > m_EtaMax ) { 00367 log << MSG::DEBUG 00368 << "Candidate failed max eta cut: eta was " 00369 << candidate->eta() 00370 << " cut was " 00371 << m_EtaMax 00372 << endreq; 00373 return false ; 00374 } 00375 00376 log << MSG::DEBUG 00377 << "Candidate passed selection cuts " 00378 << endreq ; 00379 00380 return true ; 00381 } |
|
Species to process.
Definition at line 131 of file DefaultReconstructedParticleMaker.h. Referenced by getSmearer(), and initialize(). |
|
Minimum transverse momentum required.
Definition at line 133 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
Maximum required eta.
Definition at line 135 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
minimum transverse momentum post construction
Definition at line 139 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
Maximum eta.
Definition at line 141 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
Flag to switch off smearing for debugging purposes.
Definition at line 144 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
TES location of HepMC::GenParticles.
Definition at line 148 of file DefaultReconstructedParticleMaker.h. Referenced by initialize(). |
|
TES output location.
Definition at line 150 of file DefaultReconstructedParticleMaker.h. Referenced by execute(), and initialize(). |
|
Muon smearing key.
Definition at line 154 of file DefaultReconstructedParticleMaker.h. Referenced by getSmearer(), and initialize(). |
|
Used to select HepMC::GenParticles by type 1.
Definition at line 161 of file DefaultReconstructedParticleMaker.h. Referenced by execute(), initialize(), and ~DefaultReconstructedParticleMaker(). |
|
Smearer object which specialises the algorithm for a specific particle species 1.
Definition at line 172 of file DefaultReconstructedParticleMaker.h. Referenced by create(), getSmearer(), initialize(), and ~DefaultReconstructedParticleMaker(). |
|
0..*
Definition at line 177 of file DefaultReconstructedParticleMaker.h. |
|
Gets MC particles from TES.
Definition at line 184 of file DefaultReconstructedParticleMaker.h. Referenced by execute(), initialize(), and ~DefaultReconstructedParticleMaker(). |