00001 #include "FastShowerUtils/ShowerDemoDumper.h"
00002
00003 #include <iostream>
00004 #include <strstream>
00005 #include <string>
00006 #include <assert.h>
00007
00008 using FastShower::IShowerDumper;
00009 using FastShower::ShowerDemoDumper;
00010
00011 int main(int argc, char* argv[1]){
00012
00013 istream* input;
00014
00015 switch (argc){
00016 case 1:
00017 case 2:
00018 case 3:
00019 case 4:
00020 case 5:
00021 case 6:
00022 cout<<"Need 6 args: nEvents, key, pdgId, minEta, maxEta, energy, got "<<argc<<endl;
00023 throw;
00024 case 7:
00025 input = new istrstream(argv[0]);
00026 break;
00027 default:
00028 cout<<"Need 6 args: nEvents, key, pdgId, minEta, maxEta, energy, got "<<argc<<endl;
00029 throw;
00030 }
00031
00032 for(int count = 0; count!=argc; ++count) cout<<argv[count]<<endl;
00033
00034 std::istrstream is1(argv[1]);
00035 std::istrstream is2(argv[2]);
00036 std::istrstream is3(argv[3]);
00037 std::istrstream is4(argv[4]);
00038 std::istrstream is5(argv[5]);
00039 std::istrstream is6(argv[6]);
00040
00041 int nEvents;
00042 is1>>nEvents;
00043
00044 std::string key;
00045 is2>>key;
00046
00047 int pdgId;
00048 is3>>pdgId;
00049 if (pdgId!=11 && pdgId!=22 && pdgId!=211) {
00050 cout<<"ERROR: pdgId invalid [11, 22, 211]: "<<pdgId<<endl;
00051 throw;
00052 }
00053
00054 double minEta;
00055 is4>>minEta;
00056
00057 if (minEta<-10.0 || minEta>10.0) {
00058 cout<<"ERROR: invalid minEta (eta range=[-3.2, 3.2]): "<<minEta<<endl;
00059 throw;
00060 }
00061
00062 double maxEta;
00063 is5>>maxEta;
00064 if (maxEta>3.2 || maxEta<-3.2) {
00065 cout<<"ERROR: invalid maxEta (eta range=[-3.2, 3.2]): "<<maxEta<<endl;
00066 throw;
00067 }
00068 if (minEta>maxEta) {
00069 cout<<"ERROR: invalid eta range: min>max: "<<minEta<<">"<<maxEta<<endl;
00070 throw;
00071 }
00072
00073 double energy;
00074 is6>>energy;
00075
00076 cout<<"Event: "<<nEvents
00077 <<", key: "<<key
00078 <<", pdgId: "<<pdgId
00079 <<", minEta: "<<minEta
00080 <<", maxEta: "<<maxEta
00081 <<", energy: "<<energy
00082 <<endl;
00083
00084
00085 IShowerDumper* dumper = new ShowerDemoDumper(nEvents, key, pdgId, minEta, maxEta, energy);
00086 dumper->initialise(key);
00087 dumper->execute();
00088 dumper->finalise();
00089 return 0;
00090 }
00091
00092