Atlfast::FinalStateParticleDumper Class Reference

Dumps information about truth particles selected by specified selector. More...

#include <FinalStateParticleDumper.h>

Collaboration diagram for Atlfast::FinalStateParticleDumper:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FinalStateParticleDumper (const std::string &name, ISvcLocator *pSvcLocator)
virtual ~FinalStateParticleDumper ()
virtual StatusCode initialize ()
virtual StatusCode execute ()
virtual StatusCode finalize ()

Private Member Functions

void DumpParticle (std::string, const HepMC::GenParticle *)
void DumpFlat (std::string space, MCparticleCollection::const_iterator ib, MCparticleCollection::const_iterator ie)
void DumpTwoGenerations (std::string space, MCparticleCollection::const_iterator ib, MCparticleCollection::const_iterator ie)
void DumpTree (std::string space, MCparticleCollection::const_iterator ib, MCparticleCollection::const_iterator ie)
void DumpTree (std::string space, HepMC::GenVertex::particle_iterator ib, HepMC::GenVertex::particle_iterator ie)

Private Attributes

std::string m_inputLocation
TesIOm_tesIO
std::string m_mcLocation
std::string m_selectorName
HepMC_helper::MCselectorWrapperm_mcSelector

Detailed Description

Dumps information about truth particles selected by specified selector.

The particle selector used is decided by the input string SelectorName and is one of the main selectors used in Atlfast.

Definition at line 58 of file FinalStateParticleDumper.h.


Constructor & Destructor Documentation

Atlfast::FinalStateParticleDumper::FinalStateParticleDumper ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Standard Athena-Algorithm Constructor

Definition at line 41 of file FinalStateParticleDumper.cxx.

00042     : Algorithm( name, pSvcLocator ){
00043     
00044     
00045     // Default paths for entities in the TES
00046     m_inputLocation  = "/Event/McEventCollection";
00047     m_selectorName   = "All";
00048     
00049     declareProperty( "InputLocation", m_inputLocation ) ;
00050     declareProperty( "SelectorName",  m_selectorName ) ;
00051     
00052   }

Atlfast::FinalStateParticleDumper::~FinalStateParticleDumper (  )  [virtual]

Default Destructor

Definition at line 55 of file FinalStateParticleDumper.cxx.

00055 {} 


Member Function Documentation

StatusCode Atlfast::FinalStateParticleDumper::initialize (  )  [virtual]

Standard Athena-Algorithm method

Definition at line 62 of file FinalStateParticleDumper.cxx.

00063   {
00064 
00065     MsgStream log( messageService(), name() ) ;
00066     log<<MSG::DEBUG<<"Initialising "<<endreq;
00067     
00068     //set up MC selector.
00069     log<< "m_mcSelector  set to "<<m_selectorName<<endreq;
00070     GlobalEventData* ged = GlobalEventData::Instance();
00071     if(m_selectorName == "All") {      
00072       m_mcSelector = 
00073         new HepMC_helper::MCselectorWrapper( new HepMC_helper::All() ) ;
00074     }else if(m_selectorName == "bSelector") {
00075       m_mcSelector =  
00076         new HepMC_helper::MCselectorWrapper( new 
00077                                              HepMC_helper::SelectJetTag 
00078                                              (ParticleCodes::BQUARK, 
00079                                               5.0*GeV, 
00080                                               2.5))
00081         ;
00082     }else if(m_selectorName == "ElectronSelector"){ 
00083       HepMC_helper::IMCselector* pidSelector =  
00084         new HepMC_helper::SelectPid(0.0, FLT_MAX, ParticleCodes::ELECTRON);
00085       HepMC_helper::IMCselector* finalStateSelector = 
00086         new HepMC_helper::IsFinalState();
00087 
00088       vector<HepMC_helper::IMCselector*> selectors;
00089       selectors.push_back(finalStateSelector);
00090       selectors.push_back(pidSelector);
00091 
00092     
00093       HepMC_helper::NCutter* ncutter  = new  HepMC_helper::NCutter(selectors);
00094       m_mcSelector = new HepMC_helper::MCselectorWrapper(ncutter) ;
00095     
00096       delete pidSelector;
00097       delete finalStateSelector;
00098 
00099     }else if(m_selectorName == "PhotonSelector"){ 
00100       HepMC_helper::IMCselector* pidSelector =  
00101         new HepMC_helper::SelectPid(0.0, FLT_MAX, ParticleCodes::PHOTON);
00102       HepMC_helper::IMCselector* finalStateSelector = 
00103         new HepMC_helper::IsFinalState();
00104 
00105       vector<HepMC_helper::IMCselector*> selectors;
00106       selectors.push_back(finalStateSelector);
00107       selectors.push_back(pidSelector);
00108 
00109     
00110       HepMC_helper::NCutter* ncutter  = new  HepMC_helper::NCutter(selectors);
00111       m_mcSelector = new HepMC_helper::MCselectorWrapper(ncutter) ;
00112     
00113       delete pidSelector;
00114       delete finalStateSelector;
00115 
00116     }else if(m_selectorName == "MuonSelector"){ 
00117       HepMC_helper::IMCselector* pidSelector =  
00118         new HepMC_helper::SelectPid(0.0, FLT_MAX, ParticleCodes::MUON);
00119       HepMC_helper::IMCselector* finalStateSelector = 
00120         new HepMC_helper::IsFinalState();
00121 
00122       vector<HepMC_helper::IMCselector*> selectors;
00123       selectors.push_back(finalStateSelector);
00124       selectors.push_back(pidSelector);
00125 
00126     
00127       HepMC_helper::NCutter* ncutter  = new  HepMC_helper::NCutter(selectors);
00128       m_mcSelector = new HepMC_helper::MCselectorWrapper(ncutter) ;
00129     
00130       delete pidSelector;
00131       delete finalStateSelector;
00132 
00133     }else if(m_selectorName == "Z0selector"){ 
00134       m_mcSelector =  
00135         new HepMC_helper::MCselectorWrapper( new 
00136                                            HepMC_helper::SelectZ0(0.0, FLT_MAX)
00137                                            )
00138      ;
00139 
00140     }else if(m_selectorName == "Unseen") {
00141 
00142       std::vector<int> requiredTypes;
00143       requiredTypes.push_back(66); //ERW's favorite LSP number.
00144       requiredTypes.push_back(ParticleCodes::NU_E);
00145       requiredTypes.push_back(ParticleCodes::NU_MU);
00146       requiredTypes.push_back(ParticleCodes::NU_TAU);
00147 
00148       HepMC_helper::IMCselector* unseen  = 
00149         new HepMC_helper::Unseen(requiredTypes);
00150 
00151       HepMC_helper::IMCselector* finalStateSelector = 
00152         new HepMC_helper::IsFinalState();
00153 
00154       vector<HepMC_helper::IMCselector*> selectors;
00155       selectors.push_back(finalStateSelector);
00156       selectors.push_back(unseen);
00157 
00158     
00159       HepMC_helper::NCutter* ncutter  = new  HepMC_helper::NCutter(selectors);
00160       m_mcSelector = new HepMC_helper::MCselectorWrapper(ncutter) ;
00161     
00162       delete unseen;
00163       delete finalStateSelector;
00164 
00165     }else if(m_selectorName ==  "VisibleToCal"){
00166       m_mcSelector = 
00167         new HepMC_helper::MCselectorWrapper(ged -> visibleToCal());
00168     }else{
00169       m_mcSelector = 
00170         new HepMC_helper::MCselectorWrapper(new HepMC_helper::IsFinalState() ) ;
00171     }
00172     m_mcLocation       = ged -> mcLocation();
00173     //    m_tesIO = new TesIO(eventDataService());
00174     m_tesIO = new TesIO(m_mcLocation, ged->justHardScatter());
00175     return StatusCode::SUCCESS ;
00176   }

StatusCode Atlfast::FinalStateParticleDumper::execute (  )  [virtual]

Standard Athena-Algorithm method

Definition at line 195 of file FinalStateParticleDumper.cxx.

00196   {
00197     //................................
00198     // make a message logging stream
00199     
00200     MsgStream log( messageService(), name() ) ;
00201     log<<MSG::DEBUG<<"Executing "<<endreq;
00202     std::string mess;
00203     
00204     // read MC particles from TES
00205     MCparticleCollection  mcParticles ;
00206     const HepMC_helper::IMCselector* imcSelector = 
00207       m_mcSelector->asIMCselector();
00208     TesIoStat stat = m_tesIO->getMC( mcParticles, imcSelector) ;
00209     mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES";
00210     log << MSG::DEBUG << mess << endreq;
00211     
00212     std::cout<<"Dumping  particles "<<std::endl;
00213     cout<<"------------------- "<<std::endl;
00214 
00215     std::sort(mcParticles.begin(), 
00216               mcParticles.end(), 
00217               HepMC_helper::AscendingEta());
00218 
00219     cout<<"Number particles found = "<<mcParticles.size()<<std::endl;
00220 
00221     /*
00222     for(;ip!=mcParticles.end();++ip){
00223       string space = " ";
00224       this->DumpParticle(space, *ip);
00225     }
00226     */
00227 
00228     string space = " ";
00229     log<<MSG::INFO<<"Flat Dump"<<endreq<<endreq;
00230     this->DumpFlat(space, mcParticles.begin(), mcParticles.end() );
00231     //    log<<MSG::INFO<<"Tree Dump"<<endreq<<endreq;
00232     //    this->DumpTree(space, mcParticles.begin(), mcParticles.end() );
00233     //this->DumpTwoGenerations(space, mcParticles.begin(), mcParticles.end() );
00234     log<<MSG::INFO<<"End of execute "<<endreq;    
00235     return StatusCode::SUCCESS;
00236   }

StatusCode Atlfast::FinalStateParticleDumper::finalize (  )  [virtual]

Standard Athena-Algorithm method

Definition at line 182 of file FinalStateParticleDumper.cxx.

00183   {
00184     // .. put any finalisation in here...
00185     
00186     return StatusCode::SUCCESS ;
00187   }

void Atlfast::FinalStateParticleDumper::DumpParticle ( std::string  ,
const HepMC::GenParticle *   
) [private]

extracts particles from the TES

Definition at line 237 of file FinalStateParticleDumper.cxx.

00238                                                                         {
00239     cout<<setiosflags(ios::fixed);
00240     cout<<std::setprecision(3);
00241     cout<<s
00242       <<std::setw(15)<<std::setprecision(3)<<p->momentum().phi()<<" "
00243       <<std::setw(15)<<std::setprecision(3)<<p->momentum().pseudoRapidity()<<" "
00244       <<std::setw(15)<<std::setprecision(3)<<p->momentum().perp()<<" "
00245       <<std::setw(15)<<std::setprecision(3)<<p->momentum().e()<<" "
00246       <<std::setw(15)<<std::setprecision(3)<<p->pdg_id()<<" "
00247       <<"phi, eta, pt, e"
00248       <<std::endl;
00249     cout<<s
00250       <<std::setw(15)<<std::setprecision(3)<<p->momentum().px()<<" "
00251       <<std::setw(15)<<std::setprecision(3)<<p->momentum().py()<<" "
00252       <<std::setw(15)<<std::setprecision(3)<<p->momentum().pz()<<" "
00253       <<std::setw(15)<<std::setprecision(3)<<p->momentum().e()<<" "
00254       <<std::setw(15)<<std::setprecision(3)<<p->pdg_id()<<" "
00255       <<"  x,   y,  z, e"
00256       <<std::endl;
00257   }

void Atlfast::FinalStateParticleDumper::DumpFlat ( std::string  space,
MCparticleCollection::const_iterator  ib,
MCparticleCollection::const_iterator  ie 
) [private]

Definition at line 258 of file FinalStateParticleDumper.cxx.

00260                                                                                 {
00261     MCparticleCollection::const_iterator ip=ib;
00262     for(; ip!=ie; ++ip){
00263       this->DumpParticle(space, *ip);
00264     }
00265   }

void Atlfast::FinalStateParticleDumper::DumpTwoGenerations ( std::string  space,
MCparticleCollection::const_iterator  ib,
MCparticleCollection::const_iterator  ie 
) [private]

Definition at line 267 of file FinalStateParticleDumper.cxx.

00270                                                                                      {
00271     std::string space2 = space +" ";
00272     MCparticleCollection::const_iterator ip=ib;
00273     HepMC::GenVertex::particle_iterator ip2; 
00274     cout<<"-------first"<<std::endl;
00275     cout << "******dopo first *******"<<std::endl;
00276 for(; ip!=ie; ++ip){
00277   cout << "****particle at ip *****" << endl;
00278   this->DumpParticle(space, *ip);
00279 
00280       if((*ip)->end_vertex()){
00281         HepMC::GenVertex::particle_iterator firstChild = 
00282           (*ip)->end_vertex()->particles_begin(HepMC::children);
00283         
00284         HepMC::GenVertex::particle_iterator endChild = 
00285           (*ip)->end_vertex()->particles_end(HepMC::children);
00286 
00287         cout<<"----------second"<<std::endl;
00288         for(ip2=firstChild; ip2!=endChild; ++ip2){
00289           this->DumpParticle(space2, *ip2);
00290         }       
00291         cout<<"-------first"<<std::endl;
00292       }
00293 }
00294   }

void Atlfast::FinalStateParticleDumper::DumpTree ( std::string  space,
MCparticleCollection::const_iterator  ib,
MCparticleCollection::const_iterator  ie 
) [private]

Definition at line 295 of file FinalStateParticleDumper.cxx.

00297                                                                                 {
00298     MCparticleCollection::const_iterator ip=ib;
00299     space = space+" ";
00300     cout<<"-----------"<<endl;
00301     for(; ip!=ie; ++ip){
00302       this->DumpParticle(space, *ip);
00303 
00304       if((*ip)->end_vertex()){
00305         HepMC::GenVertex::particle_iterator firstChild = 
00306           (*ip)->end_vertex()->particles_begin(HepMC::children);
00307         
00308         HepMC::GenVertex::particle_iterator endChild = 
00309           (*ip)->end_vertex()->particles_end(HepMC::children);
00310         /*
00311         HepMC::GenVertex::particle_iterator secondChild = firstChild;
00312         ++secondChild;
00313         
00314         if(secondChild!=endChild) this->DumpTree(space,secondChild,endChild);
00315         */
00316         this->DumpTree(space, firstChild, endChild);    
00317       }
00318     }
00319   }

void Atlfast::FinalStateParticleDumper::DumpTree ( std::string  space,
HepMC::GenVertex::particle_iterator  ib,
HepMC::GenVertex::particle_iterator  ie 
) [private]

Definition at line 320 of file FinalStateParticleDumper.cxx.

00322                                                                              {
00323     HepMC::GenVertex::particle_iterator ip=ib;
00324     space = space+" ";
00325     cout<<"-----------"<<endl;
00326     for(; ip!=ie; ++ip){
00327       this->DumpParticle(space, *ip);
00328       if((*ip)->end_vertex()){
00329         HepMC::GenVertex::particle_iterator firstChild = 
00330           (*ip)->end_vertex()->particles_begin(HepMC::children);
00331         
00332         HepMC::GenVertex::particle_iterator endChild = 
00333           (*ip)->end_vertex()->particles_end(HepMC::children);
00334 
00335         /*
00336         HepMC::GenVertex::particle_iterator secondChild = firstChild;
00337         ++secondChild;
00338 
00339         if(secondChild != endChild) this->DumpTree(space, secondChild, endChild);
00340         */
00341         this->DumpTree(space, firstChild, endChild);
00342       }
00343     }
00344   }   


Member Data Documentation

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

TES input location

Definition at line 88 of file FinalStateParticleDumper.h.

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

Accesses the TES

Definition at line 91 of file FinalStateParticleDumper.h.

std::string Atlfast::FinalStateParticleDumper::m_mcLocation [private]

holds the Storegate MC location

Definition at line 94 of file FinalStateParticleDumper.h.

std::string Atlfast::FinalStateParticleDumper::m_selectorName [private]

Definition at line 110 of file FinalStateParticleDumper.h.

HepMC_helper::MCselectorWrapper* Atlfast::FinalStateParticleDumper::m_mcSelector [private]

helper class to select final state particles

Definition at line 112 of file FinalStateParticleDumper.h.


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