ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/mstein/triggerStudy/triggerStudy.h
Revision: 1.1
Committed: Thu Nov 22 15:32:47 2012 UTC (12 years, 5 months ago) by mstein
Content type: text/plain
Branch: MAIN
CVS Tags: v1
Log Message:
first skeleton

File Contents

# Content
1 #ifndef triggerStudy_h
2 #define triggerStudy_h
3
4 #include <iostream>
5 #include <iomanip>
6 #include <fstream>
7 #include <vector>
8 #include <map>
9 // #include <algorithm>
10 #include <Math/LorentzVector.h>
11 // #include "TROOT.h"
12 #include "TFile.h"
13 //#include "TStyle.h"
14 #include "TH2D.h"
15 #include "TH2.h"
16 //#include "TF1.h"
17 //#include "TCanvas.h"
18 // #include "TLorentzVector.h"
19 // #include "TLine.h"
20 //#include "TLegend.h"
21 //#include "TSystem.h"
22 //#include "Math/VectorUtil_Cint.h"
23
24 //#include "plotMaker.h"
25 #include "tools.h"
26 //#include "plotRange.h"
27 #include "timing.h"
28 //#include "define.h"
29
30
31 // #ifdef __MAKECINT__
32 // #pragma link C++ class ROOT::Math::PtEtaPhiM4D<float>+;
33 // #endif
34
35 // #ifdef __MAKECINT__
36 // #pragma link C++ class pair<string,string>+;
37 // #pragma link C++ class pair<string,bool>+;
38 // #pragma link C++ class ROOT::Math::PtEtaPhiM4D<float>+;
39 // #pragma link C++ class ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiM4D<float> >+;
40 // #pragma link C++ class ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<double> >+;
41 // #pragma link C++ class ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<float> >+;
42 // #pragma link C++ class ROOT::Math::PositionVector3D<ROOT::Math::Cartesian3D<double> >+;
43 // #pragma link C++ class ROOT::Math::Cartesian3D<float>+;
44 // //#pragma link C++ class pair<string,int>+;
45 // #endif
46
47 //================================================================================= class: triggerStudy
48 class triggerStudy{
49 //--------------------------------------------------- leafs to read
50
51
52 //--------------------------------------------------- variables
53 timing timer;
54
55 //--------------------------------------------------- functions
56 void configuration();
57
58 virtual void Init();
59 //void initVariables(Long64_t jentry);
60
61 void Loop();
62 void mainProgram();
63
64 void makeHistograms(TString suffix);
65
66 void printError(Int_t number, ostream& os=cout);
67 void printEventInfo(ostream& os=cout);
68
69 void printJetP4(ostream& os=cout);
70 void printMuonP4(ostream& os=cout);
71 void printP4(LorentzV p, ostream& os=cout);
72 void printP4Head(ostream& os=cout);
73
74 void saveHistograms();
75 void SetConfigFromCommandLine();
76 void SetIntelligentIO();
77 template<typename T>
78 void SwitchOn(TString name, T **pt, TChain* tree);
79
80 triggerStudy(TString configFromCommandLine);
81 virtual ~triggerStudy();
82
83
84 };
85
86
87 //================================================================================= constructor: triggerStudy
88 triggerStudy::triggerStudy(TString configFromCommandLine){
89 TH1::SetDefaultSumw2();
90 TH2::SetDefaultSumw2();
91 cout<<"Data2011Flg = " << Data2011Flg << endl;
92 commandLine = configFromCommandLine;
93 timer.Start("Over All time");
94 configuration();
95
96
97 }
98
99
100 // //================================================================================= SwitchOn
101 // template<typename T>
102 // void triggerStudy::SwitchOn(TString name, T **pt, TChain* tree){
103 // tools::enterFcn("SwitchOn",2);
104 // TBranch* branch = tree->GetBranch(name);
105 // if(!branch){
106 // cerr<<"Branch "<< name <<" is undefined in tree: "<<tree->GetName()<<endl;
107 // exit(0);
108 // }
109 // tree->SetBranchStatus(name+"*",1);
110 // // special treatment for Lorentz and 3D vectors
111 // TBranch* fCoordinates = branch->FindBranch("fCoordinates");
112 // if(fCoordinates!=0){
113 // branch->SetBit(kDoNotProcess,0);
114 // fCoordinates->SetBit(kDoNotProcess,0);
115 // TBranch* fX;
116 // TBranch* fY;
117 // TBranch* fZ;
118 // TBranch* fT;
119 // if(!Data2011Flg){
120 // fX = fCoordinates->FindBranch("fX");
121 // fY = fCoordinates->FindBranch("fY");
122 // fZ = fCoordinates->FindBranch("fZ");
123 // fT = fCoordinates->FindBranch("fT");
124 // }
125 // else{
126 // fX = fCoordinates->FindBranch("fPt");
127 // fY = fCoordinates->FindBranch("fEta");
128 // fZ = fCoordinates->FindBranch("fPhi");
129 // fT = fCoordinates->FindBranch("fM");
130 // }
131 // if(fX!=0) fX->SetBit(kDoNotProcess,0);
132 // if(fY!=0) fY->SetBit(kDoNotProcess,0);
133 // if(fZ!=0) fZ->SetBit(kDoNotProcess,0);
134 // if(fT!=0) fT->SetBit(kDoNotProcess,0);
135 // }
136 // tree->SetBranchAddress(name, &(*pt));
137 // skimData->Branch(name, &(*pt));
138 // tools::exitFcn("SwitchOn",2);
139 // }
140
141
142 //================================================================================= init
143 void triggerStudy::Init(){
144 tools::enterFcn("Init",1);
145
146 outputData = 0;
147 outputData = new TTree("output_data","output_data");
148
149
150 fChain ->SetBranchStatus("*",0);
151
152
153 metP4AK5=0;
154 fChain->SetBranchStatus("metP4AK5*", 1);
155 fChain->SetBranchAddress("metP4AK5", &metP4AK5);
156 metP4Calo=0;
157 fChain->SetBranchStatus("metP4Calo*", 1);
158 fChain->SetBranchAddress("metP4Calo", &metP4Calo);
159 metP4PF=0;
160 fChain->SetBranchStatus("metP4PF*", 1);
161 fChain->SetBranchAddress("metP4PF", &metP4PF);
162 }
163
164 //SwitchOn("metP4AK5", fChain);
165
166
167 tools::exitFcn("Init",1);
168 }
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184 //================================================================================= destructor: triggerStudy
185 triggerStudy::~triggerStudy(){
186 tools::enterFcn("destructor",1);
187 //delete fChain->GetCurrentFile();
188 //outputData->Delete();
189 //skimData ->Delete();
190
191 //delete ak5JetCorrectedP4;
192
193 tools::exitFcn("destructor",1);
194 }
195
196
197 // //================================================================================= SetIntelligentIO
198 // void triggerStudy::SetIntelligentIO(){
199 // tools::enterFcn("SetIntelligentIO",1);
200 // if(outputPath==""){
201 // if(localFlg) outputPath = "/home/mstein/scripts/susy/output";
202 // else outputPath = "/afs/naf.desy.de/user/m/mstein/CMSSW_3_8_5/src/UserCode/mstein/susy/output/";
203 // if(runMode==1) outputPath = "/afs/naf.desy.de/user/m/mstein/jobs/";
204 // //else outputPath = "/scratch/hh/current/cms/user/mstein/output/";
205 // }
206 //
207 // pileupName = dataset;
208 // pileupName += "_vertex";
209 // if(intelligentIOFlg){
210 // outputPath += dataset;
211 // outputPath += "/";
212 // //outputPath += (int)cut_flg;
213 // }
214 // tools::createDir(outputPath);
215 //
216 // outputName = dataset;
217 // outputName += "_";
218 // outputName += selectionName[cut_flg];
219 //
220 // // if(cut_flg==60 || cut_flg==61){
221 // // outputName +="_algo";
222 // // outputName +=LepFromBJetAlgo;
223 // // }
224 //
225 // if(runMode==1){
226 // outputName = pileupName;
227 // }
228 // outputName += outputNameSuffix;
229 // outputName += ".root";
230 // //cout<<"outputName = " << outputName << endl;
231 // tools::exitFcn("SetIntelligentIO",1);
232 // }
233
234
235 // //================================================================================= SetConfigFromCommandLine
236 // void triggerStudy::SetConfigFromCommandLine(){
237 // tools::enterFcn("SetConfigFromCommandLine",1);
238 // map<TString, TString> config = tools::splitToWords(commandLine, "+", "=");
239 // cout<<endl;
240 // for(map<TString, TString>::iterator it=config.begin(); it != config.end(); ++it){
241 // if(it->first=="dataset") dataset = it->second;
242 // if(it->first=="outputPath") outputPath = it->second;
243 // if(it->first=="outputNameSuffix") outputNameSuffix = it->second;
244 // if(it->first=="cut_flg") cut_flg = it->second.Atoi();
245 // if(it->first=="startFile") startFile = it->second.Atoi();
246 // if(it->first=="endFile") endFile = it->second.Atoi();
247 // if(it->first=="runOverFilesFlg") runOverFilesFlg = it->second.Atoi();
248 // if(it->first=="LepFromBJetAlgo") LepFromBJetAlgo = it->second.Atoi();
249 // if(it->first=="runOverSingleEventsFlg") runOverSingleEventsFlg = it->second.Atoi();
250 // if(it->first=="nentries") nentries = it->second.Atoi();
251 // if(it->first=="startEvent") startEvent = it->second.Atoi();
252 // if(it->first=="localFlg") localFlg = it->second.Atoi();
253 // if(it->first=="Lumi") Lumi = it->second.Atof();
254 // if(it->first=="mc_flg") mcFlg = it->second.Atoi();
255 // // if(it->first=="quickFlg") quickFlg = it->second.Atoi();
256 // if(it->first=="verbosity") verbosity = it->second.Atoi();
257 // cout<<setw(30)<<it->first << " = " << it->second <<endl;
258 // }
259 // tools::exitFcn("SetConfigFromCommandLine",1);
260 // }
261
262
263
264
265
266
267
268
269 #endif
270
271
272
273
274