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

Atlfast::FinalStateParticleDumper Class Reference

formatted output of collection of Reconstructed Particles from the TES for debugging purposes. More...

#include <FinalStateParticleDumper.h>

Collaboration diagram for Atlfast::FinalStateParticleDumper:

Collaboration graph
[legend]
List of all members.

Public Methods

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

virtual ~FinalStateParticleDumper ()
 Default Destructor.

virtual StatusCode initialize ()
 Standard Athena-Algorithm method.

virtual StatusCode execute ()
 Standard Athena-Algorithm method.

virtual StatusCode finalize ()
 Standard Athena-Algorithm method.


Private Methods

void DumpParticle (std::string, const HepMC::GenParticle *)
 extracts particles from the TES

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
 TES input location.

TesIO * m_tesIO
std::string m_selectorName
HepMC_helper::MCselectorWrapper * m_mcSelector
 helper class to select final state particles


Detailed Description

formatted output of collection of Reconstructed Particles from the TES for debugging purposes.

Definition at line 54 of file FinalStateParticleDumper.h.


Constructor & Destructor Documentation

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

Standard Athena-Algorithm Constructor.

Definition at line 47 of file FinalStateParticleDumper.cxx.

00048     : Algorithm( name, pSvcLocator ){
00049     
00050     
00051     // Default paths for entities in the TES
00052     m_inputLocation    = "/Event/McEventCollection";
00053     
00054     declareProperty( "InputLocation", m_inputLocation ) ;
00055     declareProperty( "SelectorName",  m_selectorName ) ;
00056     
00057   }

Atlfast::FinalStateParticleDumper::~FinalStateParticleDumper   [virtual]
 

Default Destructor.

Definition at line 60 of file FinalStateParticleDumper.cxx.

00060 {} 

Member Function Documentation

StatusCode Atlfast::FinalStateParticleDumper::initialize   [virtual]
 

Standard Athena-Algorithm method.

Definition at line 67 of file FinalStateParticleDumper.cxx.

References m_mcSelector, m_selectorName, and m_tesIO.

00068   {
00069     MsgStream log( messageService(), name() ) ;
00070     log<<MSG::DEBUG<<"Initialising "<<endreq;
00071     
00072     //set up MC selector.
00073     log<< "m_mcSelector  set to "<<m_selectorName<<endreq;
00074     if(m_selectorName == "All") {      
00075       m_mcSelector = 
00076         new HepMC_helper::MCselectorWrapper( new HepMC_helper::All() ) ;
00077     }else if(m_selectorName == "bSelector") {
00078       m_mcSelector =  
00079         new HepMC_helper::MCselectorWrapper( new 
00080                                              HepMC_helper::SelectJetTag 
00081                                              (ParticleCodes::BQUARK, 
00082                                               5.0, 
00083                                               2.5))
00084         ;
00085     }else if(m_selectorName == "Z0selector"){ 
00086       m_mcSelector =  
00087         new HepMC_helper::MCselectorWrapper( new 
00088                                            HepMC_helper::SelectZ0(0.0, FLT_MAX)
00089                                            )
00090      ;
00091     }else if(m_selectorName == "Unseen") {
00092 
00093       std::vector<int> requiredTypes;
00094       requiredTypes.push_back(66); //ERW's favorite LSP number.
00095       requiredTypes.push_back(ParticleCodes::NU_E);
00096       requiredTypes.push_back(ParticleCodes::NU_MU);
00097       requiredTypes.push_back(ParticleCodes::NU_TAU);
00098 
00099       HepMC_helper::IMCselector* unseen  = 
00100         new HepMC_helper::Unseen(requiredTypes);
00101 
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(unseen);
00108 
00109     
00110       HepMC_helper::NCutter* ncutter  = new  HepMC_helper::NCutter(selectors);
00111       m_mcSelector = new HepMC_helper::MCselectorWrapper(ncutter) ;
00112     
00113       delete unseen;
00114       delete finalStateSelector;
00115 
00116     }else{
00117       m_mcSelector = 
00118         new HepMC_helper::MCselectorWrapper(new HepMC_helper::IsFinalState() ) ;
00119     }
00120     //    m_tesIO = new TesIO(eventDataService());
00121     m_tesIO = new TesIO();
00122     return StatusCode::SUCCESS ;
00123   }

StatusCode Atlfast::FinalStateParticleDumper::execute   [virtual]
 

Standard Athena-Algorithm method.

Definition at line 142 of file FinalStateParticleDumper.cxx.

References DumpFlat(), m_mcSelector, and m_tesIO.

00143   {
00144     //................................
00145     // make a message logging stream
00146     
00147     MsgStream log( messageService(), name() ) ;
00148     log<<MSG::DEBUG<<"Executing "<<endreq;
00149     std::string mess;
00150     
00151     // read MC particles from TES
00152     MCparticleCollection  mcParticles ;
00153     const HepMC_helper::IMCselector* imcSelector = 
00154       m_mcSelector->asIMCselector();
00155     TesIoStat stat = m_tesIO->getMC( mcParticles, imcSelector) ;
00156     mess = stat? "Retrieved MC from TES ":"Failed MC retrieve from TES";
00157     log << MSG::DEBUG << mess << endreq;
00158     
00159     log<<MSG::INFO<<"Dumping  particles "<<endreq;
00160     log<<MSG::INFO<<"------------------- "<<endreq;
00161 
00162     std::sort(mcParticles.begin(), 
00163               mcParticles.end(), 
00164               HepMC_helper::AscendingEta());
00165 
00166     log<<MSG::INFO<<"Number particles found = "<<mcParticles.size()<<endreq;
00167 
00168     /*
00169     for(;ip!=mcParticles.end();++ip){
00170       string space = " ";
00171       this->DumpParticle(space, *ip);
00172     }
00173     */
00174 
00175     string space = " ";
00176     log<<MSG::INFO<<"Flat Dump"<<endreq<<endreq;
00177     this->DumpFlat(space, mcParticles.begin(), mcParticles.end() );
00178     //    log<<MSG::INFO<<"Tree Dump"<<endreq<<endreq;
00179     //    this->DumpTree(space, mcParticles.begin(), mcParticles.end() );
00180     //this->DumpTwoGenerations(space, mcParticles.begin(), mcParticles.end() );
00181     log<<MSG::INFO<<"End of execute "<<endreq;    
00182     return StatusCode::SUCCESS;
00183   }

StatusCode Atlfast::FinalStateParticleDumper::finalize   [virtual]
 

Standard Athena-Algorithm method.

Definition at line 129 of file FinalStateParticleDumper.cxx.

00130   {
00131     // .. put any finalisation in here...
00132     
00133     return StatusCode::SUCCESS ;
00134   }

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

extracts particles from the TES

Definition at line 184 of file FinalStateParticleDumper.cxx.

Referenced by DumpFlat(), DumpTree(), and DumpTwoGenerations().

00185                                                                         {
00186     cout<<setiosflags(ios::fixed);
00187     cout<<setprecision(3);
00188     cout<<s
00189       <<setw(8)<<setprecision(3)<<p->momentum().phi()<<" "
00190       <<setw(8)<<setprecision(3)<<p->momentum().pseudoRapidity()<<" "
00191       <<setw(8)<<setprecision(3)<<p->momentum().perp()<<" "
00192       <<setw(8)<<setprecision(3)<<p->momentum().e()<<" "
00193       <<setw(8)<<setprecision(3)<<p->pdg_id()<<" "
00194       <<"phi, eta, pt, e"
00195       <<endl;
00196     cout<<s
00197       <<setw(8)<<setprecision(3)<<p->momentum().px()<<" "
00198       <<setw(8)<<setprecision(3)<<p->momentum().py()<<" "
00199       <<setw(8)<<setprecision(3)<<p->momentum().pz()<<" "
00200       <<setw(8)<<setprecision(3)<<p->momentum().e()<<" "
00201       <<setw(8)<<setprecision(3)<<p->pdg_id()<<" "
00202       <<"  x,   y,  z, e"
00203       <<endl;
00204   }

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

Definition at line 205 of file FinalStateParticleDumper.cxx.

References DumpParticle().

Referenced by execute().

00207                                                                                 {
00208     MCparticleCollection::const_iterator ip=ib;
00209     for(; ip!=ie; ++ip){
00210       this->DumpParticle(space, *ip);
00211     }
00212   }

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

Definition at line 214 of file FinalStateParticleDumper.cxx.

References DumpParticle().

00217                                                                                      {
00218     std::string space2 = space +" ";
00219     MCparticleCollection::const_iterator ip=ib;
00220     HepMC::GenVertex::particle_iterator ip2; 
00221     cout<<"-------first"<<endl;
00222     cout << "******dopo first *******"<<endl;
00223 for(; ip!=ie; ++ip){
00224   cout << "****particle at ip *****" << endl;
00225   this->DumpParticle(space, *ip);
00226 
00227       if((*ip)->end_vertex()){
00228         HepMC::GenVertex::particle_iterator firstChild = 
00229           (*ip)->end_vertex()->particles_begin(HepMC::children);
00230         
00231         HepMC::GenVertex::particle_iterator endChild = 
00232           (*ip)->end_vertex()->particles_end(HepMC::children);
00233 
00234         cout<<"----------second"<<endl;
00235         for(ip2=firstChild; ip2!=endChild; ++ip2){
00236           this->DumpParticle(space2, *ip2);
00237         }       
00238         cout<<"-------first"<<endl;
00239       }
00240 }
00241   }

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

Definition at line 242 of file FinalStateParticleDumper.cxx.

References DumpParticle().

Referenced by DumpTree().

00244                                                                                 {
00245     MCparticleCollection::const_iterator ip=ib;
00246     space = space+" ";
00247     cout<<"-----------"<<endl;
00248     for(; ip!=ie; ++ip){
00249       this->DumpParticle(space, *ip);
00250 
00251       if((*ip)->end_vertex()){
00252         HepMC::GenVertex::particle_iterator firstChild = 
00253           (*ip)->end_vertex()->particles_begin(HepMC::children);
00254         
00255         HepMC::GenVertex::particle_iterator endChild = 
00256           (*ip)->end_vertex()->particles_end(HepMC::children);
00257         /*
00258         HepMC::GenVertex::particle_iterator secondChild = firstChild;
00259         ++secondChild;
00260         
00261         if(secondChild!=endChild) this->DumpTree(space,secondChild,endChild);
00262         */
00263         this->DumpTree(space, firstChild, endChild);    
00264       }
00265     }
00266   }

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

Definition at line 267 of file FinalStateParticleDumper.cxx.

References DumpParticle(), and DumpTree().

00269                                                                              {
00270     HepMC::GenVertex::particle_iterator ip=ib;
00271     space = space+" ";
00272     cout<<"-----------"<<endl;
00273     for(; ip!=ie; ++ip){
00274       this->DumpParticle(space, *ip);
00275       if((*ip)->end_vertex()){
00276         HepMC::GenVertex::particle_iterator firstChild = 
00277           (*ip)->end_vertex()->particles_begin(HepMC::children);
00278         
00279         HepMC::GenVertex::particle_iterator endChild = 
00280           (*ip)->end_vertex()->particles_end(HepMC::children);
00281 
00282         /*
00283         HepMC::GenVertex::particle_iterator secondChild = firstChild;
00284         ++secondChild;
00285 
00286         if(secondChild != endChild) this->DumpTree(space, secondChild, endChild);
00287         */
00288         this->DumpTree(space, firstChild, endChild);
00289       }
00290     }
00291   }   

Member Data Documentation

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

TES input location.

Definition at line 84 of file FinalStateParticleDumper.h.

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

Definition at line 85 of file FinalStateParticleDumper.h.

Referenced by execute(), and initialize().

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

Definition at line 101 of file FinalStateParticleDumper.h.

Referenced by initialize().

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

helper class to select final state particles

Definition at line 103 of file FinalStateParticleDumper.h.

Referenced by execute(), and initialize().


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