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