00001
00002
00003
00004
00005
00006
00007
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
00020 #include "GaudiKernel/DataSvc.h"
00021
00022
00023
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
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
00055
00056
00057 StatusCode IKinematicDumper::initialize()
00058 {
00059 MsgStream log( messageService(), name() ) ;
00060 log<<MSG::DEBUG<<"Initialising "<<endreq;
00061
00062
00063 m_tesIO = new TesIO();
00064
00065 return StatusCode::SUCCESS ;
00066 }
00067
00068
00069
00070
00071
00072 StatusCode IKinematicDumper::finalize()
00073 {
00074
00075
00076 return StatusCode::SUCCESS ;
00077 }
00078
00079
00080
00081
00082
00083
00084
00085 StatusCode IKinematicDumper::execute( )
00086 {
00087
00088
00089
00090 MsgStream log( messageService(), name() ) ;
00091 log<<MSG::DEBUG<<"Executing "<<endreq;
00092
00093
00094
00095
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
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
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
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
00153
00154
00155
00156 };
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177