00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00012
00013
00014
00015 #include <cstdio>
00016 #include <cstdlib>
00017 #include <iostream>
00018 #include <fstream>
00019
00020 #include "SFHMarana/SFHMarEvent.h"
00021 #include "SFHMarana/MaranaEventLoop.h"
00022 #include "jbltools/sfh/FloatFun.h"
00023 #include "jbltools/sfh/h1/H1HatVariables.h"
00024
00025 #include <TROOT.h>
00026 #include <TCanvas.h>
00027 #include <TPostScript.h>
00028 #include <TStyle.h>
00029
00030
00031 TROOT the_root("EXEMPLE","Exemple analysis");
00032
00033
00034 using namespace std;
00035
00036 int main(int argc, char *argv[])
00037 {
00038
00039 if (argc <2) {
00040 cout << "Usage:" <<endl;
00041 cout << "NCSelection input_parameters " <<endl;
00042 exit(1);
00043 }
00044
00045
00046 TRunHisto run(argv[1]);
00047
00048
00049 SFHMarEvent event(&run);
00050
00051
00052 Char_t OutputTextFile[200];
00053
00054
00055
00056 MaranaEventLoop evtLoop(run,"NCHistos","NCEvents.txt");
00057
00058
00059 printf("Nb events before hat selection: %d \n",gH1Tree->GetEntries());
00060 H1Tree::Instance()->SelectHat("Q2e>500.");
00061 printf("Nb events after hat selection: %d \n",gH1Tree->GetEntries());
00062
00063
00064 cout << "\n>>> start loop \n"<<endl;
00065
00066 event.find_ElePho=kTRUE;
00067 event.PtMinEle=0;
00068 event.ThetaMinEle=5;
00069 event.ThetaMaxEle=175;
00070
00071 event.find_Muon=kTRUE;
00072 event.PtMinMu=2;
00073 event.ThetaMinMu=10;
00074 event.ThetaMaxMu=160;
00075 event.DTrTrMinMu=0.5;
00076
00077
00078 event.find_Jet=kFALSE;
00079 event.find_NP=kFALSE;
00080
00081
00082
00083 while (event.Next(run)) {
00084 if (event.num%5000==0)cout << "--> process event "<< event.num<<endl;
00085
00086 if (!(event.MCFlag)) {
00087 static H1ShortPtr RunQuality("RunQ");
00088 if (*RunQuality==3&&!event.IsData2003()) {
00089 printf("Poor Quality run rejected \n");
00090 continue;
00091 }
00092 }
00093
00094 if(!event.IsHV()||event.IsCosmic()) continue;
00095
00096 if((fabs(event.Vertex[2])>35)||event.Vertex[2]==0) continue;
00097
00098
00099 if(event.IsTimingOk() == kFALSE) continue;
00100
00101
00102
00103 evtLoop.Fill();
00104 }
00105
00106
00107 gROOT->SetStyle("Plain");
00108 gStyle->SetOptTitle(1);
00109 gStyle->SetHistLineWidth(2);
00110 gStyle->SetCanvasBorderMode(0);
00111 gStyle->SetPadBorderMode(0);
00112 gStyle->SetPadColor(0);
00113 gStyle->SetCanvasColor(0);
00114 gStyle->SetTitleColor(1);
00115 gStyle->SetStatColor(0);
00116 gStyle->SetOptFit(1);
00117 gStyle->SetOptStat(1);
00118
00119 TPostScript *ps = new TPostScript("NC.ps", 111);
00120 TCanvas *c = new TCanvas("NC", "NCSelection", 600, 800);
00121 evtLoop.Draw(c, ps, "E0", false, 1, 3, false, false);
00122 ps->Close();
00123 cout << "Postscript written to NC.ps" << endl;
00124
00125 cout << "\n>>>>>>>> End of events loop : " << event.num << " Events <<<<<<<<<" << endl;
00126
00127 return 0;
00128
00129 }
00130
00131
00132
00133
00134
00135