00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <iostream>
00021 #include "HepMC/PythiaWrapper.h"
00022 #include "CascadeWrapper.h"
00023 #include "MyCascadeWrapper.h"
00024 #include "HepMC/IO_HEPEVT.h"
00025 #include "HepMC/IO_Ascii.h"
00026 #include "HepMC/IO_GenEvent.h"
00027 #include "HepMC/GenEvent.h"
00028 #include "PythiaHelper.h"
00029
00030 #include <stdio.h>
00031 #include "HepMC/IO_AsciiParticles.h"
00032 #include "HepMC/SimpleVector.h"
00033
00034 #include "TH1.h"
00035 #include "TFile.h"
00036 #include "TMath.h"
00037 #include <TCanvas.h>
00038
00039 #include "TF1.h"
00040 #include <TH2.h>
00041 #include <TStyle.h>
00042 #include "TLegend.h"
00043 #include <TTree.h>
00044 #include <TString.h>
00045
00046 using namespace std;
00047
00048
00049 #include "../../include/Configuration.h"
00050 #include "../../include/JetFinder.h"
00051 #include "../../include/TopAnalysis.h"
00052 #include "../../include/TauAnalysis.h"
00053 #include "../../include/DiJetAnalysis.h"
00054 #include "../../include/WplusJetAnalysis.h"
00055 #include "../../include/ZAnalysis.h"
00056 #include "../../include/UEAnalysis.h"
00057 #include "../../include/EtMissAnalysis.h"
00058 #include "../../include/ElasScatAnalysis.h"
00059 #include "../../include/UserAnalysis.h"
00060 #include "readCascadeConfigFile.h"
00061
00062 extern "C" {
00063 extern struct {
00064 int Nevent;
00065 } steer1_;
00066 }
00067 #define steer1 steer1_
00068
00069 int main(int argc, const char* argv[]) {
00070
00071 if(argc <= 1 ) {
00072 std::cout << "Usage: " << argv[0] << " <Configuration File>" << std::endl;
00073 return 0;
00074 }
00075
00076
00077 Configuration* currentconfig = new Configuration();
00078 if(currentconfig->read(argv[1]))
00079 {
00080 std::cout << " ... skip !" << std::endl;
00081 return 0;
00082 }
00083
00084 JetFinder FindJet;
00085 FindJet.Init(currentconfig->max_eta,currentconfig->min_pt);
00086 FindJet.InitJetFinder(currentconfig->coneRadius,currentconfig->overlapThreshold,currentconfig->jet_ptmin,currentconfig->lepton_ptmin,currentconfig->DeltaR_lepton_track);
00087
00088
00089 std::vector<baseAnalysis*> analysis;
00090
00091
00092 if (currentconfig->dijet) {
00093 std::cout << "Adding module DiJetAnalysis" << std::endl;
00094 analysis.push_back(new DiJetAnalysis);
00095 }
00096 if (currentconfig->wplusjet) {
00097 std::cout << "Adding module WplusJetAnalysis" << std::endl;
00098 analysis.push_back(new WplusJetAnalysis);
00099 }
00100 if(currentconfig->z){
00101 std::cout << "Adding module ZAnalysis" << std::endl;
00102 analysis.push_back(new ZAnalysis);
00103 }
00104 if(currentconfig->tau){
00105 std::cout << "Adding module TauAnalysis" << std::endl;
00106 analysis.push_back(new TauAnalysis);
00107 }
00108 if(currentconfig->top){
00109 std::cout << "Adding module TopAnalysis" << std::endl;
00110 analysis.push_back(new TopAnalysis);
00111 }
00112 if(currentconfig->ue){
00113 std::cout << "Adding module UEAnalysis" << std::endl;
00114 analysis.push_back(new UEAnalysis);
00115 }
00116 if(currentconfig->etmiss){
00117 std::cout << "Adding module EtMissAnalysis" << std::endl;
00118 analysis.push_back(new EtMissAnalysis);
00119 }
00120 if(currentconfig->elasScat){
00121 std::cout << "Adding module ElasScatAnalysis" << std::endl;
00122 analysis.push_back(new ElasScatAnalysis);
00123 }
00124 if(currentconfig->user){
00125 std::cout << "Adding module UserAnalysis" << std::endl;
00126 analysis.push_back(new UserAnalysis);
00127 }
00128
00129
00130
00131 for (std::vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
00132 (*i)->Init(currentconfig->max_eta,currentconfig->min_pt);
00133 (*i)->InitJetFinder(currentconfig->coneRadius,currentconfig->overlapThreshold,currentconfig->jet_ptmin,currentconfig->lepton_ptmin,currentconfig->DeltaR_lepton_track);
00134 }
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146 pyjets.n=0;
00147 call_pyhepc(1);
00148
00149 HepMC::HEPEVT_Wrapper::set_max_number_entries(10000);
00150 HepMC::HEPEVT_Wrapper::set_sizeof_real(8);
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161 call_casini();
00162
00163
00164
00165
00166
00167 call_cascha();
00168
00169
00170 std::vector< std::string > cascade_commands;
00171
00172 for (unsigned int files=0; files<(currentconfig->ConfigFileNames).size(); files++)
00173 readConfigFile((currentconfig->ConfigFileNames)[files]);
00174
00175
00176 call_pytcha();
00177
00178
00179 call_cascade();
00180
00181
00182 call_caend(1);
00183
00184
00185
00186
00187
00188 HepMC::IO_HEPEVT hepevtio;
00189
00190
00191
00192
00193
00194
00195
00196 int Nevent = currentconfig->nevents;
00197
00198 for ( int iEvent = 1; iEvent <= Nevent; iEvent++ ) {
00199 if ( iEvent==1 || iEvent%100==0 ) std::cout << "Processing Event Number "
00200 << iEvent << std::endl;
00201 call_event();
00202
00203
00204 call_pyhepc( 1 );
00205 HepMC::GenEvent* hepmcevt = hepevtio.read_next_event();
00206
00207
00208 hepmcevt->set_event_number(iEvent);
00209 hepmcevt->set_signal_process_id(11);
00210
00211
00212 vector<fastjet::PseudoJet> inclusive_jets = FindJet.GetJet(hepmcevt);
00213
00214
00215 int ret_all = true;
00216 for (std::vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
00217 (*i)->SetJet(&inclusive_jets);
00218 int ret = (*i)->Process(hepmcevt);
00219 if (ret == false) ret_all = false;
00220 }
00221
00222 if (ret_all==false) {
00223 std::cout << "Processing event number " << iEvent << std::endl;
00224 std::cout << "throw FAILURE"<<std::endl;
00225
00226
00227
00228 std::cout<<std::endl;
00229 }
00230
00231
00232
00233
00234
00235 FindJet.ClearEvent(hepmcevt);
00236
00237
00238 delete hepmcevt;
00239
00240 }
00241
00242
00243 call_caend(2);
00244
00245
00246
00247 TFile* f = new TFile(currentconfig->OutputFileName.c_str(),"RECREATE");
00248 for (std::vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
00249 (*i)->Finalize(f);
00250 }
00251
00252
00253 for (std::vector<baseAnalysis*>::const_iterator i(analysis.begin()); i != analysis.end(); ++i) {
00254 delete (*i);
00255 }
00256 analysis.resize(0);
00257
00258
00259 delete currentconfig;
00260
00261 std::cout<<"cascade: program ends"<<std::endl;
00262 f->Close();
00263
00264 std::cout<<"Run successfully!"<<std::endl;
00265 return 0;
00266 }