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

IKinematicDumper.cxx

Go to the documentation of this file.
00001 // ================================================
00002 //IKinematicDumper class Implementation
00003 // ================================================
00004 //
00005 // THIS TEXT TO BE REPLACED BY ATLAS STANDARD FORMAT
00006 //
00007 // Namespace Atlfast::
00008 //
00009 #include "AtlfastAlgs/IKinematicDumper.h"
00010 #include "AtlfastEvent/Cluster.h"
00011 #include "AtlfastEvent/Jet.h"
00012 #include "AtlfastEvent/CollectionDefs.h"
00013 #include "AtlfastEvent/ReconstructedParticle.h"
00014 #include "AtlfastUtils/FunctionObjects.h"
00015 
00016 #include <cmath> 
00017 #include <algorithm>
00018 #include <iomanip.h>
00019 // Gaudi includes
00020 #include "GaudiKernel/DataSvc.h"
00021 
00022 //--------------------------------
00023 // Constructors and destructors
00024 //--------------------------------
00025 
00026 namespace Atlfast {
00027   using std::cout;
00028   using std::endl;
00029   using std::ios;
00030 
00031   IKinematicDumper::IKinematicDumper
00032   ( const std::string& name, ISvcLocator* pSvcLocator ) 
00033     : Algorithm( name, pSvcLocator ){
00034     
00035     
00036     // Default paths for entities in the TES
00037     m_clusterLocation    = "/Event/AtlfastClusters";
00038     m_jetLocation        = "/Event/AtlfastJets";
00039     m_imuonLocation      = "/Event/AtlfastIsolatedMuons";
00040     m_nimuonLocation      = "/Event/AtlfastNonIsolatedMuons";
00041 
00042     declareProperty( "clusterLocation", m_clusterLocation ) ;
00043     declareProperty( "jetLocation",     m_jetLocation ) ;
00044     declareProperty( "imuonLocation",   m_imuonLocation ) ;
00045     declareProperty( "nimuonLocation",  m_nimuonLocation ) ;
00046     
00047   }
00048   
00049   
00050   IKinematicDumper::~IKinematicDumper() {} 
00051   
00052   
00053   //---------------------------------
00054   // initialise() 
00055   //---------------------------------
00056   
00057   StatusCode IKinematicDumper::initialize()
00058   {
00059     MsgStream log( messageService(), name() ) ;
00060     log<<MSG::DEBUG<<"Initialising "<<endreq;
00061     //set up TesIO
00062     //    m_tesIO = new TesIO(eventDataService());
00063     m_tesIO = new TesIO();
00064     
00065     return StatusCode::SUCCESS ;
00066   }
00067   
00068   //---------------------------------
00069   // finalise() 
00070   //---------------------------------
00071   
00072   StatusCode IKinematicDumper::finalize()
00073   {
00074     // .. put any finalisation in here...
00075     
00076     return StatusCode::SUCCESS ;
00077   }
00078   
00079   
00080   //----------------------------------------------
00081   // execute() method called once per event
00082   //----------------------------------------------
00083   //
00084   
00085   StatusCode IKinematicDumper::execute( )
00086   {
00087     //................................
00088     // make a message logging stream
00089     
00090     MsgStream log( messageService(), name() ) ;
00091     log<<MSG::DEBUG<<"Executing "<<endreq;
00092     
00093 
00094 
00095     //IsolatedMuons: read from TES and dump
00096     std::vector<ReconstructedParticle*> imuons;
00097     m_tesIO->copy<ReconstructedParticleCollection>(imuons, m_imuonLocation);
00098     std::sort(imuons.begin(), imuons.end(), SortAttribute::AscendingEta());
00099     log<<MSG::INFO<<"Dumping  Isolated Muons "<<imuons.size()<<endreq;
00100     log<<MSG::INFO<<"----------------------- "<<endreq;    
00101     std::vector<ReconstructedParticle*>::const_iterator 
00102       rp_iter = imuons.begin();
00103     this->header();
00104     for(;rp_iter!=imuons.end();++rp_iter) this->dump(*rp_iter);
00105 
00106     //NonIsolatedMuons: read from TES and dump
00107     std::vector<ReconstructedParticle*> nimuons;
00108     m_tesIO->copy<ReconstructedParticleCollection> (nimuons, m_nimuonLocation);
00109     std::sort(nimuons.begin(), nimuons.end(), SortAttribute::AscendingEta());
00110     log<<MSG::INFO<<"Dumping  NonIsolated Muons "<<nimuons.size()<<endreq;
00111     log<<MSG::INFO<<"-------------------------- "<<endreq;    
00112     rp_iter = nimuons.begin();
00113     this->header();
00114     for(;rp_iter!=nimuons.end();++rp_iter) this->dump(*rp_iter);
00115     //Clusters: read from TES and dump
00116     std::vector<Cluster*> clusters;
00117     m_tesIO->copy<ClusterCollection> (clusters, m_clusterLocation);
00118     std::sort(clusters.begin(), clusters.end(), SortAttribute::AscendingEta());
00119     log<<MSG::INFO<<"Dumping  Clusters "<<clusters.size()<<endreq;
00120     log<<MSG::INFO<<"------------------- "<<endreq;    
00121     std::vector<Cluster*>::const_iterator cl_iter = clusters.begin();
00122     this->header();
00123     for(;cl_iter!=clusters.end();++cl_iter) this->dump(*cl_iter);
00124     //Jets: read from TES and dump
00125     std::vector<Jet*> jets;
00126     m_tesIO->copy<JetCollection>(jets, m_jetLocation);
00127     std::sort(jets.begin(), jets.end(), SortAttribute::AscendingEta());
00128     log<<MSG::INFO<<"Dumping  Jets "<<jets.size()<<endreq;
00129     log<<MSG::INFO<<"------------------- "<<endreq;    
00130     std::vector<Jet*>::const_iterator jet_iter = jets.begin();
00131     this->header();
00132     for(;jet_iter!=jets.end();++jet_iter) this->dump(*jet_iter);
00133 
00134     log<<MSG::INFO<<"End of execute "<<endreq;    
00135     return StatusCode::SUCCESS;
00136   }
00137   
00138   void IKinematicDumper::header()const{
00139     cout<<"     eta      phi       pt        e"<<endl;
00140     cout<<"-----------------------------------"<<endl;
00141   }
00142   void IKinematicDumper::dump(const IKinematic* p)const{
00143     cout<<setiosflags(ios::fixed);
00144     cout<<setprecision(3);
00145     cout
00146         <<setw(8)<<setprecision(3)<<p->momentum().pseudoRapidity()<<" "
00147         <<setw(8)<<setprecision(3)<<p->momentum().phi()<<" "
00148         <<setw(8)<<setprecision(3)<<p->momentum().perp()<<" "
00149         <<setw(8)<<setprecision(3)<<p->momentum().e()<<" "
00150         <<endl;
00151   }
00152   //  template <class T>
00153   //  std::vector<T*> assocs(Jet j, T type){
00154   //    std::vector<T*> v = j->associations(T);
00155   //    return v;
00156 };  // end of namespace bracket
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 

Generated on Tue Mar 18 11:18:23 2003 for AtlfastAlgs by doxygen1.3-rc1