00001 #include "FastShowerUtils/ShowerDemoDumper.h"
00002 #include "FastShowerUtils/Gridlet.h"
00003 #include "FastShowerUtils/GridletForger.h"
00004 #include "FastShowerUtils/IConfigurer.h"
00005
00006 #include "FastShowerUtils/ParticleInfo.h"
00007 #include "FastShowerUtils/Pinger/ComplexPinger.h"
00008 #include "FastShowerUtils/Pinger/ComplexArmer.h"
00009 #include "FastShowerUtils/Pinger/ComplexStatsCollector.h"
00010 #include "FastShowerUtils/ProcessedFlat.h"
00011 #include "FastShowerUtils/LinearProcessor.h"
00012
00013 #include<cmath>
00014 namespace FastShower{
00015 ShowerDemoDumper::ShowerDemoDumper(int nEvents,
00016 std::string key, int pdgId,
00017 double minEta, double maxEta,
00018 double energy):
00019 m_nEvents(nEvents), m_pdgId(pdgId),
00020 m_minEta(minEta), m_maxEta(maxEta), m_energy(energy){
00021 cout<<"ShowerDemoDumper(int nEvents, string key, int pdgId, "
00022 <<"double minEta, double maxEta, double energy): "<<m_nEvents<<" "
00023 <<m_key<<" "<<m_pdgId<<" "<<m_minEta<<" "<<m_maxEta<<" "<<m_energy<<endl;
00024 }
00025
00026
00027 void ShowerDemoDumper::initialise(const std::string s){
00028 cout<<"ShowerDemoDumper - initialising"<<endl;
00029 m_gridletForger = new GridletForger(s);
00030 cout<<"*****************************************"<<endl;
00031 cout<<"* GridletForger Structure *"<<endl;
00032 cout<<"*****************************************"<<endl;
00033 ComplexPinger p;
00034 IDebug* gfDbg = gridletForger();
00035 gfDbg->ping(p);
00036 }
00037
00038
00039 void ShowerDemoDumper::execute(){
00040 std::string eFile("Test.txt");
00041 std::fstream ofile;
00042 ofile.open(eFile.c_str(), ios::out);
00043 cout<<"*****************************************"<<endl;
00044 cout<<"* ShowerDemoDumper Execute *"<<endl;
00045 cout<<"*****************************************"<<endl;
00046
00047 for(int ievt = 0; ievt!=m_nEvents; ++ievt){
00048 cout<<"DEMO Event: "<<ievt<<endl<<endl;
00049 ofile<<"DEMO Event: "<<ievt<<endl<<endl;
00050
00051 ParticleInfo pi = makePI(m_pdgId, m_energy);
00052 ofile<<pi;
00053
00054 Gridlet* g = gridletForger()->makeGridlet(pi);
00055 cout<<*g;
00056 ofile<<*g;
00057 delete g;
00058
00059
00060
00061
00062
00063
00064
00065
00066 }
00067 }
00068
00069
00070 void ShowerDemoDumper::finalise() const{
00071 cout<<"ShowerDemoDumper: Finalise "<<endl;
00072 ComplexStatsCollector sc;
00073 IDebug* gfDbg = gridletForger();
00074 gfDbg->ping( sc );
00075 }
00076
00077
00078 GridletForger* ShowerDemoDumper::gridletForger() const{
00079 return m_gridletForger;
00080 }
00081
00082
00083 ParticleInfo ShowerDemoDumper::makePI(int pdgId, double energy) const {
00084 ProcessedFlat pf;
00085 LinearProcessor etaLp( (m_maxEta-m_minEta), m_minEta );
00086 LinearProcessor phiLp( 2*M_PI, -M_PI );
00087 double eta = pf.sample(&etaLp);
00088 double phi = pf.sample(&phiLp);
00089 ParticleInfo pi(phi,eta,energy,pdgId);
00090 return pi;
00091 }
00092 }
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103