ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/rootEWKanalyzer/src/analysisClass_template.C
Revision: 1.2
Committed: Wed Oct 6 12:26:21 2010 UTC (14 years, 6 months ago) by jueugste
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +82 -254 lines
Error occurred while calculating annotation data.
Log Message:
cleaned up template

File Contents

# Content
1 #define analysisClass_cxx
2 #include "analysisClass.h"
3 #include <TH2.h>
4 #include <TH1F.h>
5 #include <TStyle.h>
6 #include <TCanvas.h>
7 #include <TLorentzVector.h>
8 #include <TVector2.h>
9 #include <TVector3.h>
10
11 analysisClass::analysisClass(string * inputList, string * cutFile, string * treeName, string * outputFileName, string * cutEfficFile)
12 :baseClass(inputList, cutFile, treeName, outputFileName, cutEfficFile)
13 {
14 std::cout << "analysisClass::analysisClass(): begins " << std::endl;
15
16 std::cout << "analysisClass::analysisClass(): ends " << std::endl;
17 }
18
19 analysisClass::~analysisClass()
20 {
21 std::cout << "analysisClass::~analysisClass(): begins " << std::endl;
22
23 std::cout << "analysisClass::~analysisClass(): ends " << std::endl;
24 }
25
26 void analysisClass::Loop()
27 {
28 std::cout << "analysisClass::Loop() begins" <<std::endl;
29
30 if (fChain == 0) return;
31
32
33 // --------------------------------------------------------------------------------------------------------------------
34 // Analysis input parameters
35 // --------------------------------------------------------------------------------------------------------------------
36 double sampleSize=-1;
37
38
39
40 // --------------------------------------------------------------------------------------------------------------------
41 // book histos here
42 // --------------------------------------------------------------------------------------------------------------------
43
44 TH1D *h_ElPt = new TH1D("ElPt", "ElPt", 200, 0, 200);
45
46 // --------------------------------------------------------------------------------------------------------------------
47
48 // --------------------------------------------------------------------------------------------------------------------
49 // number of events
50 // this histogram is filled for normalization purposes i.e. to keep track of the MC sample sizes
51 // --------------------------------------------------------------------------------------------------------------------
52 TH1I *h_numberOfEvents;
53 h_numberOfEvents=new TH1I("numberOfEvents", "numberOfEvents", 1, -0.01, 1.01);
54 // --------------------------------------------------------------------------------------------------------------------
55
56
57
58 // --------------------------------------------------------------------------------------------------------------------
59 // 2D histograms
60 // --------------------------------------------------------------------------------------------------------------------
61 // --------------------------------------------------------------------------------------------------------------------
62
63 // --------------------------------------------------------------------------------------------------------------------
64 //initialize variables
65 // --------------------------------------------------------------------------------------------------------------------
66 // --------------------------------------------------------------------------------------------------------------------
67
68
69
70 Long64_t nentries = fChain->GetEntriesFast();
71 std::cout << "analysisClass::Loop(): nentries = " << nentries << std::endl;
72
73 ////// The following ~7 lines have been taken from rootNtupleClass->Loop() /////
74 ////// If the root version is updated and rootNtupleClass regenerated, /////
75 ////// these lines may need to be updated. /////
76 Long64_t nb = 0;
77
78 for (Long64_t jentry=0; jentry<nentries;jentry++) { // loop over all events (entries) in the tree/chain
79
80 Long64_t ientry = LoadTree(jentry); // ientry: this is a counter over each single file in the input list
81 if (ientry < 0) break;
82 nb = fChain->GetEntry(jentry);
83
84 if(jentry < 10 || jentry%1000 == 0) std::cout << "analysisClass::Loop(): jentry = " << jentry << std::endl;
85
86 if(sampleSize!=-1 && sampleSize==jentry) {
87 goto END;
88 }
89 h_numberOfEvents->Fill(1);
90
91 ////////////////////////////////////////////////////////////////////
92 ////////////////////// User's code starts here /////////////////////
93 ////////////////////////////////////////////////////////////////////
94
95 // check the methods defined in baseClass and clean it up!!
96
97
98 // --------------------------------------------------------------------------------
99 // loop over all electrons in one event
100 // --------------------------------------------------------------------------------
101 for(int i=0; i<NEles; i++) {
102
103
104 h_ElPt->Fill(ElPt[i]);
105
106 }
107
108 // --------------------------------------------------------------------------------------------------------------------
109
110
111
112
113
114 int BSC_techbit = 0;
115 int BeamHalo = 0;
116
117 //Event Selections....
118 // for (int ii = 40; ii<=41; ii++)
119 // if(l1techbits->at(ii)==1) { BSC_techbit = 1; break; }
120 // if (BSC_techbit==0) continue;
121
122 // for (int ii = 0; ii < int(BeamHaloSummaryId->size()); ii++)
123 // if(BeamHaloSummaryId->at(ii) < 11) {BeamHalo = 1; break; }
124 // if(BeamHalo==0) continue;
125
126 // if(run==122314)
127 // if(ls<24 || ls >37) continue;
128 //Event selections ends
129
130 //#################################################
131
132
133 ////////////////////////////////////////////////////////////////////
134 ////////////////////// User's code ends here ///////////////////////
135 ////////////////////////////////////////////////////////////////////
136
137
138
139 } // End loop over events
140
141 END:
142 cerr<<"Program ended after "<<sampleSize<<" events ..."<<endl;
143
144
145
146 // --------------------------------------------------------------------------------------------------------------------
147 // write histos
148 // --------------------------------------------------------------------------------------------------------------------
149 h_ElPt->Write();
150 // --------------------------------------------------------------------------------------------------------------------
151
152 std::cout << "analysisClass::Loop() ends" <<std::endl;
153 }
154
155