////////////////////////////////////////////////////////////////////////// // ================================================ // TheAnalysis // ================================================ // // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT // // Namespace MyAnalysis // // Header include #include "MyAnalysis/TheAnalysis.h" #include "MyAnalysis/Selectors.h" // Other stuff #include "GaudiKernel/MsgStream.h" #include "HepMC/GenParticle.h" #include "HepMC/GenEvent.h" #include "GeneratorObjects/McEventCollection.h" //#include "GaudiKernel/ObjectVector.h" #include "AtlfastUtils/TesIO.h" #include "AtlfastUtils/HepMC_helper/HepMC_helper.h" #include "AtlfastEvent/MsgStreamDefs.h" #include "AtlfastEvent/ReconstructedParticle.h" #include "AtlfastEvent/MCparticleCollection.h" #include "AtlfastEvent/CollectionDefs.h" namespace MyAnalysis { TheAnalysis:: TheAnalysis(const std::string& name, ISvcLocator* pSvcLocator): Algorithm(name,pSvcLocator){ } //__________________________________________________________________________ TheAnalysis::~TheAnalysis() { MsgStream log( messageService(), name() ) ; log << MSG::INFO << "TheAnalysis destructor called" << endreq; } //__________________________________________________________________________ StatusCode TheAnalysis::initialize() { MsgStream log( messageService(), name() ); log << MSG::INFO <<"Initializing" << endreq; m_tesIO = new Atlfast::TesIO; return StatusCode::SUCCESS; } //_________________________________________________________________________ StatusCode TheAnalysis::finalize() { MsgStream log( messageService(), name() ); log << MSG::INFO <<"finalizing" << endreq; return StatusCode::SUCCESS; } //_________________________________________________________________________ StatusCode TheAnalysis::execute() { //............................................. MsgStream log( messageService(), name() ); log << MSG::DEBUG << "TheAnalysis execute()" << endreq; //========================================= // get MC particles using Atlfast::TesIO //========================================= log << MSG::DEBUG << "TheAnalysis execute() stage 1: retrieve McEventCollection" << endreq; Atlfast::MCparticleCollection myMCparticles; log << MSG::DEBUG << "TheAnalysis execute() stage 2: Copy particles" << endreq; //--------------------------------------- //Either copy all particles //--------------------------------------- Atlfast::TesIoStat sc = m_tesIO->getMC( myMCparticles) ; //--------------------------------------- //OR copy just photons //--------------------------------------- /** const HepMC_helper::SelectType phoSelector(22); Atlfast::TesIoStat sc = m_tesIO->getMC( myMCparticles,&phoSelector) ; **/ //========================================== //print the particle pdg_id //========================================== log << MSG::DEBUG << "TheAnalysis execute() stage 3: Print momentum" << endreq; if (!sc){ log << MSG::DEBUG << "Could not retrieve MC events" << endreq; }else{ std::vector::const_iterator src; for(src = myMCparticles.begin() ; src != myMCparticles.end() ; ++src) { log << MSG::DEBUG << "Particle momentum " << (*src)->momentum() << endreq; } } //========================================== //Get Atlfast Isolated Photons //========================================== log << MSG::DEBUG << "TheAnalysis execute() stage 4: Get Atlfast Photons" << endreq; std::vector photons; Atlfast::TesIoStat stat = m_tesIO->copy(photons,"/Event/AtlfastIsolatedPhotons"); if (!stat){ log << MSG::DEBUG << "Could not retrieve Atlfast Photons" << endreq; }else{ std::vector::const_iterator iter; for(iter = photons.begin(); iter!=photons.end(); ++iter) { log << MSG::DEBUG << "Atlfast Photon momentum " << (*iter)->momentum() << endreq; } } return StatusCode::SUCCESS; } } // end of namespace bracket