ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/macros/examples/runHgg2012.C
Revision: 1.15
Committed: Tue Jul 24 15:47:05 2012 UTC (12 years, 9 months ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, HEAD
Changes since 1.14: +65 -49 lines
Log Message:
update macros for consistency with new shower scaling

File Contents

# User Rev Content
1 bendavid 1.15 // $Id: runHgg2012.C,v 1.14 2012/06/26 23:24:57 bendavid Exp $
2 bendavid 1.1 #if !defined(__CINT__) || defined(__MAKECINT__)
3     #include <TSystem.h>
4     #include <TProfile.h>
5     #include "MitAna/DataUtil/interface/Debug.h"
6     #include "MitAna/Catalog/interface/Catalog.h"
7     #include "MitAna/TreeMod/interface/Analysis.h"
8     #include "MitAna/TreeMod/interface/HLTMod.h"
9     #include "MitAna/PhysicsMod/interface/RunLumiSelectionMod.h"
10     #include "MitAna/PhysicsMod/interface/MCProcessSelectionMod.h"
11     #include "MitAna/PhysicsMod/interface/PublisherMod.h"
12     #include "MitAna/DataTree/interface/JetCol.h"
13     #include "MitAna/DataTree/interface/PFJetCol.h"
14     #include "MitPhysics/Init/interface/ModNames.h"
15     #include "MitPhysics/Mods/interface/GoodPVFilterMod.h"
16     #include "MitPhysics/Mods/interface/MuonIDMod.h"
17     #include "MitPhysics/Mods/interface/ElectronIDMod.h"
18     #include "MitPhysics/Mods/interface/ElectronCleaningMod.h"
19     #include "MitPhysics/Mods/interface/PhotonIDMod.h"
20     #include "MitPhysics/Mods/interface/PhotonPairSelector.h"
21     #include "MitPhysics/Mods/interface/PhotonTreeWriter.h"
22     #include "MitPhysics/Mods/interface/PhotonCleaningMod.h"
23     #include "MitPhysics/Mods/interface/MergeLeptonsMod.h"
24     #include "MitPhysics/Mods/interface/JetCorrectionMod.h"
25     #include "MitPhysics/Mods/interface/PhotonMvaMod.h"
26     #include "MitPhysics/Mods/interface/MVASystematicsMod.h"
27    
28     #endif
29    
30     //--------------------------------------------------------------------------------------------------
31     void runHgg2012(const char *fileset = "0000",
32     const char *skim = "noskim",
33     //const char *dataset = "f11--h120gg-gf-v14b-pu",
34     //const char *dataset = "r11a-pho-j16-v1",
35 bendavid 1.13 //const char *dataset = "meridiani2012-diphoj-v9",
36 bendavid 1.15 //const char *dataset = "s12-h125gg-gf-v9",
37 bendavid 1.1 //const char *dataset = "s12-pj40-2em-v9",
38 bendavid 1.15 const char *dataset = "s12-diphoj-3-v9",
39 bendavid 1.1 //const char *dataset = "s12-zllm50-v9",
40     //const char *dataset = "f11--h121gg-gf-v14b-pu",
41 mingyang 1.4 //const char *dataset = "r12a-pho-pr-v1",
42 bendavid 1.6 //const char *dataset = "s12-pj40-2em-v9",
43 bendavid 1.1 const char *book = "t2mit/filefi/028",
44     const char *catalogDir = "/home/cmsprod/catalog",
45     const char *outputName = "hgg",
46 bendavid 1.15 int nEvents = 500)
47 bendavid 1.1 {
48     //------------------------------------------------------------------------------------------------
49     // some parameters get passed through the environment
50     //------------------------------------------------------------------------------------------------
51     char json[1024], overlap[1024];
52     float overlapCut = -1;
53    
54     if (gSystem->Getenv("MIT_PROD_JSON"))
55     sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON"));
56     else {
57     sprintf(json, "%s", "~");
58     //printf(" JSON file was not properly defined. EXIT!\n");
59     //return;
60     }
61    
62 bendavid 1.12 TString jsonFile = TString("/home/bendavid/cms/json/") + TString(json);
63     //TString jsonFile = TString("/home/bendavid/cms/json/") + TString("Cert_136033-149442_7TeV_Dec22ReReco_Collisions10_JSON_v4.txt");
64     Bool_t isData = ( (jsonFile.CompareTo("/home/bendavid/cms/json/~") != 0) );
65 bendavid 1.1
66     if (gSystem->Getenv("MIT_PROD_OVERLAP")) {
67     sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP"));
68     if (EOF == sscanf(overlap,"%f",&overlapCut)) {
69     printf(" Overlap was not properly defined. EXIT!\n");
70     return;
71     }
72     }
73     else {
74     sprintf(overlap,"%s", "-1.0");
75     //printf(" OVERLAP file was not properly defined. EXIT!\n");
76     //return;
77     }
78    
79     printf("\n Initialization worked. \n\n");
80    
81     //------------------------------------------------------------------------------------------------
82     // some global setups
83     //------------------------------------------------------------------------------------------------
84     using namespace mithep;
85     gDebugMask = Debug::kGeneral;
86     gDebugLevel = 3;
87    
88     //------------------------------------------------------------------------------------------------
89     // set up information
90     //------------------------------------------------------------------------------------------------
91     RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod;
92     runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted
93    
94     MCProcessSelectionMod *mcselmod = new MCProcessSelectionMod;
95    
96     MVASystematicsMod *sysMod = new MVASystematicsMod;
97     sysMod->SetMCR9Scale(1.0035, 1.0035);
98     sysMod->SetIsData(isData);
99    
100     // only select on run- and lumisection numbers when valid json file present
101 bendavid 1.12 if ((jsonFile.CompareTo("/home/bendavid/cms/json/~") != 0) &&
102     (jsonFile.CompareTo("/home/bendavid/cms/json/-") != 0) ) {
103 bendavid 1.1 runLumiSel->AddJSONFile(jsonFile.Data());
104     }
105 bendavid 1.12 if ((jsonFile.CompareTo("/home/bendavid/cms/json/-") == 0) ) {
106 bendavid 1.1 printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n");
107     runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file
108     }
109    
110     printf("\n Run lumi worked. \n\n");
111    
112     //------------------------------------------------------------------------------------------------
113     // HLT information
114     //------------------------------------------------------------------------------------------------
115     HLTMod *hltModM = new HLTMod("HLTModM");
116     hltModM->AddTrigger("HLT_Mu9");
117     hltModM->AddTrigger("HLT_Mu11");
118     hltModM->AddTrigger("HLT_Mu15_v1");
119     hltModM->SetTrigObjsName("MyHltMuonObjs");
120     hltModM->SetAbortIfNotAccepted(kFALSE);
121    
122     HLTMod *hltModE = new HLTMod("HLTModE");
123     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v1",150000,161176);
124     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v2",161179,163261);
125     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v3",163262,164237);
126     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v4",165085,165888);
127     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v5",165900,166967);
128     hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v6",166968,170053);
129     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v6",170054,170759);
130     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v7",170760,173198);
131     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v8",173199,178380);
132     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v9",178381,179889);
133     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v10",179890,189999);
134     hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v*",190000,999999);
135     hltModE->SetTrigObjsName("MyHltElecObjs");
136     hltModE->SetAbortIfNotAccepted(isData);
137    
138     HLTMod *hltModES = new HLTMod("HLTModES");
139     hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v*",160000,189999);
140     hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v2",160000,189999);
141     hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v3",160000,189999);
142     hltModES->AddTrigger("HLT_Ele25_WP80_PFMT40_v*",160000,189999);
143     hltModES->AddTrigger("HLT_Ele27_WP80_PFMT50_v*",160000,189999);
144     hltModES->AddTrigger("HLT_Ele27_WP80_v*",190000,999999);
145     hltModES->SetTrigObjsName("MyHltElecSObjs");
146     hltModES->SetAbortIfNotAccepted(isData);
147    
148     HLTMod *hltModP = new HLTMod("HLTModP");
149    
150 bendavid 1.6 hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",160000,161176);
151 bendavid 1.1
152     hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",161216,165633);
153     hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",161216,165633);
154     hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",161216,165633);
155     hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v*",161216,165633);
156    
157     hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",165970,173198);
158     hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",165970,173198);
159     hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",165970,173198);
160     hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",165970,173198);
161     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",165970,173198);
162     hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",165970,173198);
163     hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",165970,173198);
164    
165     hltModP->AddTrigger("HLT_Photon36_CaloId_IsoVL_Photon22_R9Id_v*",165970,166967);
166     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",167039,173198);
167    
168     hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_v*",173236,178380);
169     hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9Id_v*",173236,178380);
170     hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdXL_IsoXL_v*",173236,178380);
171     hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",173236,178380);
172     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",173236,178380);
173     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",173236,178380);
174     hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",173236,178380);
175     hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",173236,178380);
176    
177     hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,189999);
178     hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9IdT_Mass60_v*",178420,189999);
179     hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,189999);
180     hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_R9IdT_Mass60_v*",178420,189999);
181     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",178420,189999);
182     hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",178420,189999);
183     hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",178420,189999);
184 bendavid 1.6 hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",178420,189999);
185 mingyang 1.4
186     hltModP->AddTrigger("HLT_Photon26_CaloId10_Iso50_Photon18_CaloId10_Iso50_Mass60_v*",190000,999999);
187     hltModP->AddTrigger("HLT_Photon26_CaloId10_Iso50_Photon18_R9Id85_Mass60_v*",190000,999999);
188     hltModP->AddTrigger("HLT_Photon26_R9Id85_OR_CaloId10_Iso50_Photon18_R9Id85_OR_CaloId10_Iso50_Mass60_v*",190000,999999);
189 bendavid 1.14 hltModP->AddTrigger("HLT_Photon26_R9Id85_OR_CaloId10_Iso50_Photon18_R9Id85_OR_CaloId10_Iso50_Mass70_v*",190000,999999);
190 mingyang 1.4 hltModP->AddTrigger("HLT_Photon26_R9Id85_Photon18_CaloId10_Iso50_Mass60_v*",190000,999999);
191     hltModP->AddTrigger("HLT_Photon26_R9Id85_Photon18_R9Id85_Mass60_v*",190000,999999);
192     hltModP->AddTrigger("HLT_Photon36_CaloId10_Iso50_Photon22_CaloId10_Iso50_v*",190000,999999);
193     hltModP->AddTrigger("HLT_Photon36_CaloId10_Iso50_Photon22_R9Id85_v*",190000,999999);
194     hltModP->AddTrigger("HLT_Photon36_R9Id85_OR_CaloId10_Iso50_Photon22_R9Id85_OR_CaloId10_Iso50_v*",190000,999999);
195     hltModP->AddTrigger("HLT_Photon36_R9Id85_Photon22_CaloId10_Iso50_v*",190000,999999);
196     hltModP->AddTrigger("HLT_Photon36_R9Id85_Photon22_R9Id85_v*",190000,999999);
197 bendavid 1.1
198     hltModP->SetTrigObjsName("MyHltPhotObjs");
199     hltModP->SetAbortIfNotAccepted(isData);
200    
201     //------------------------------------------------------------------------------------------------
202     // select events with a good primary vertex
203     //------------------------------------------------------------------------------------------------
204     GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod;
205     goodPVFilterMod->SetMinVertexNTracks(0);
206     goodPVFilterMod->SetMinNDof (4.0);
207     goodPVFilterMod->SetMaxAbsZ (24.0);
208     goodPVFilterMod->SetMaxRho (2.0);
209     goodPVFilterMod->SetAbortIfNotAccepted(kFALSE);
210     goodPVFilterMod->SetIsMC(!isData);
211    
212     GoodPVFilterMod *goodPVFilterModE = new GoodPVFilterMod("GoodPVFilterModE");
213     goodPVFilterModE->SetOutputName("GoodVertexesE");
214     goodPVFilterModE->SetMinVertexNTracks(0);
215     goodPVFilterModE->SetMinNDof (4.0);
216     goodPVFilterModE->SetMaxAbsZ (24.0);
217     goodPVFilterModE->SetMaxRho (2.0);
218     goodPVFilterModE->SetIsMC(!isData);
219    
220     GoodPVFilterMod *goodPVFilterModES = new GoodPVFilterMod("GoodPVFilterModES");
221     goodPVFilterModES->SetOutputName("GoodVertexesES");
222     goodPVFilterModES->SetMinVertexNTracks(0);
223     goodPVFilterModES->SetMinNDof (4.0);
224     goodPVFilterModES->SetMaxAbsZ (24.0);
225     goodPVFilterModES->SetMaxRho (2.0);
226    
227    
228     //------------------------------------------------------------------------------------------------
229     // object id and cleaning sequence
230     //------------------------------------------------------------------------------------------------
231     MuonIDMod *muonId = new MuonIDMod;
232     muonId->SetClassType ("Global");
233     muonId->SetIDType ("ZMuId");
234     muonId->SetIsoType ("TrackCaloSliding");
235     muonId->SetApplyD0Cut(kTRUE);
236    
237    
238     PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub");
239     pubJet->SetInputName("AKt5PFJets");
240     pubJet->SetOutputName("PubAKt5PFJets");
241    
242     PublisherMod<PFJet,Jet> *pubJetOpen = new PublisherMod<PFJet,Jet>("JetPubOpen");
243     pubJetOpen->SetInputName("AKt5PFJets");
244     pubJetOpen->SetOutputName("PubAKt5PFJetsOpen");
245    
246     JetCorrectionMod *jetCorr = new JetCorrectionMod;
247     if(isData){
248 bendavid 1.10 jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L1FastJet_AK5PF.txt")).Data()));
249     jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L2Relative_AK5PF.txt")).Data()));
250     jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L3Absolute_AK5PF.txt")).Data()));
251     jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L2L3Residual_AK5PF.txt")).Data()));
252 bendavid 1.6 }
253     else {
254 bendavid 1.10 jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L1FastJet_AK5PF.txt")).Data()));
255     jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L2Relative_AK5PF.txt")).Data()));
256     jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L3Absolute_AK5PF.txt")).Data()));
257 bendavid 1.1 }
258     jetCorr->SetInputName(pubJet->GetOutputName());
259     jetCorr->SetCorrectedName("CorrectedJets");
260    
261    
262     Bool_t excludedoubleprompt = kFALSE;
263     if (TString(dataset).Contains("-pj")) {
264     mcselmod->ExcludeProcess(18);
265     mcselmod->ExcludeProcess(114);
266 bendavid 1.9 excludedoubleprompt = kTRUE;
267 bendavid 1.1 }
268    
269     if (TString(dataset).Contains("-qcd2em") || TString(dataset).Contains("-qcd-2em")) {
270 bendavid 1.9 excludedoubleprompt = kTRUE;
271 bendavid 1.1 }
272    
273     Bool_t is25 = kFALSE;
274     if (TString(book).Contains("025")) is25 = kTRUE;
275    
276     PhotonMvaMod *photreg = new PhotonMvaMod;
277     photreg->SetRegressionVersion(3);
278     photreg->SetRegressionWeights(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/gbrv3ph_52x.root")).Data()));
279     photreg->SetOutputName("GoodPhotonsRegr");
280 bendavid 1.13 photreg->SetApplyShowerRescaling(kTRUE);
281 bendavid 1.1 photreg->SetIsData(isData);
282    
283    
284     PhotonPairSelector *photcic = new PhotonPairSelector("PhotonPairSelectorCiC");
285     photcic->SetOutputName("GoodPhotonsCIC");
286     photcic->SetOutputVtxName("OutVtxCiC");
287     photcic->SetPhotonSelType("CiCPFSelection");
288 bendavid 1.9 photcic->SetVertexSelType("CiCMVA2012Selection");
289 bendavid 1.6 //photcic->SetUseSingleLegConversions(kTRUE);
290 bendavid 1.1 photcic->DoMCSmear(kTRUE);
291 bendavid 1.12 photcic->DoDataEneCorr(kTRUE);
292 bendavid 1.1 photcic->SetPhotonsFromBranch(kFALSE);
293     photcic->SetInputPhotonsName(photreg->GetOutputName());
294 bendavid 1.14 //2012 ICHEP promptreco 5.3/fb
295 bendavid 1.15 photcic->SetMCSmearFactors(0.00825,0.01035,0.0116,0.0222,0.0138,0.0292,0.0275,0.0322,0.0310);
296     photcic->AddEnCorrPerRun(190450, 190781, 0.9944, 0.9944, 1.0006, 0.9948, 1.0083, 0.9881, 0.9956, 0.9878, 0.9991);
297     photcic->AddEnCorrPerRun(190782, 190949, 1.0085, 1.0085, 1.0146, 0.9858, 0.9993, 1.0047, 1.0120, 0.9962, 1.0074);
298     photcic->AddEnCorrPerRun(190950, 191833, 0.9939, 0.9939, 1.0001, 0.9879, 1.0014, 0.9906, 0.9981, 0.9874, 0.9986);
299     photcic->AddEnCorrPerRun(191834, 193686, 0.9916, 0.9916, 0.9978, 0.9855, 0.9990, 0.9907, 0.9982, 0.9893, 1.0005);
300     photcic->AddEnCorrPerRun(193746, 194210, 0.9921, 0.9921, 0.9983, 0.9834, 0.9970, 0.9921, 0.9996, 0.9883, 0.9995);
301     photcic->AddEnCorrPerRun(194211, 194479, 0.9926, 0.9926, 0.9988, 0.9845, 0.9980, 0.9928, 1.0003, 0.9895, 1.0007);
302     photcic->AddEnCorrPerRun(194480, 195147, 0.9927, 0.9927, 0.9989, 0.9862, 0.9998, 0.9954, 1.0028, 0.9891, 1.0003);
303     photcic->AddEnCorrPerRun(195148, 195350, 0.9928, 0.9928, 0.9990, 0.9852, 0.9988, 1.0007, 1.0081, 0.9943, 1.0054);
304     photcic->AddEnCorrPerRun(195351, 195395, 0.9931, 0.9931, 0.9992, 0.9861, 0.9996, 0.9933, 1.0008, 0.9900, 1.0012);
305     photcic->AddEnCorrPerRun(195396, 195530, 0.9932, 0.9932, 0.9994, 0.9861, 0.9996, 0.9951, 1.0025, 0.9869, 0.9982);
306     photcic->AddEnCorrPerRun(195531, 999999, 0.9924, 0.9924, 0.9986, 0.9857, 0.9992, 0.9962, 1.0036, 0.9885, 0.9997);
307    
308 bendavid 1.14
309 mingyang 1.11 // photcic->SetDoMCR9Scaling(kTRUE);
310     // photcic->SetMCR9Scale(1.0035, 1.0035);
311 mingyang 1.8 photcic->SetDoShowerShapeScaling(kTRUE);
312     photcic->SetShowerShapeType("2012ShowerShape");
313 bendavid 1.13 //photcic->SetDoMCErrScaling(kTRUE);
314 mingyang 1.11 //photcic->SetMCErrScale(1.07, 1.045);
315 bendavid 1.13 //photcic->SetMCErrScale(1, 1); //ming:scale(sigE/E)
316 bendavid 1.1 photcic->SetJetsName(jetCorr->GetOutputName());
317 bendavid 1.15 //photcic->SetRescaledBeamspotWidth(5.0);
318 bendavid 1.1 photcic->SetIsData(isData);
319 mingyang 1.11
320 bendavid 1.1 PhotonPairSelector *photcicnoeleveto = new PhotonPairSelector("PhotonPairSelectorCiCInvertEleVeto");
321     photcicnoeleveto->SetOutputName("GoodPhotonsCICNoEleVeto");
322     photcicnoeleveto->SetOutputVtxName("OutVtxCiCInvertEleVeto");
323     photcicnoeleveto->SetPhotonSelType("CiCPFSelection");
324 bendavid 1.9 photcicnoeleveto->SetVertexSelType("CiCMVA2012Selection");
325 bendavid 1.6 //photcicnoeleveto->SetUseSingleLegConversions(kTRUE);
326 bendavid 1.1 photcicnoeleveto->DoMCSmear(kTRUE);
327 bendavid 1.12 photcicnoeleveto->DoDataEneCorr(kTRUE);
328 bendavid 1.1 photcicnoeleveto->SetPhotonsFromBranch(kFALSE);
329     photcicnoeleveto->SetInputPhotonsName(photreg->GetOutputName());
330 bendavid 1.15 photcicnoeleveto->SetMCSmearFactors(0.00825,0.01035,0.0116,0.0222,0.0138,0.0292,0.0275,0.0322,0.0310);
331     photcicnoeleveto->AddEnCorrPerRun(190450, 190781, 0.9944, 0.9944, 1.0006, 0.9948, 1.0083, 0.9881, 0.9956, 0.9878, 0.9991);
332     photcicnoeleveto->AddEnCorrPerRun(190782, 190949, 1.0085, 1.0085, 1.0146, 0.9858, 0.9993, 1.0047, 1.0120, 0.9962, 1.0074);
333     photcicnoeleveto->AddEnCorrPerRun(190950, 191833, 0.9939, 0.9939, 1.0001, 0.9879, 1.0014, 0.9906, 0.9981, 0.9874, 0.9986);
334     photcicnoeleveto->AddEnCorrPerRun(191834, 193686, 0.9916, 0.9916, 0.9978, 0.9855, 0.9990, 0.9907, 0.9982, 0.9893, 1.0005);
335     photcicnoeleveto->AddEnCorrPerRun(193746, 194210, 0.9921, 0.9921, 0.9983, 0.9834, 0.9970, 0.9921, 0.9996, 0.9883, 0.9995);
336     photcicnoeleveto->AddEnCorrPerRun(194211, 194479, 0.9926, 0.9926, 0.9988, 0.9845, 0.9980, 0.9928, 1.0003, 0.9895, 1.0007);
337     photcicnoeleveto->AddEnCorrPerRun(194480, 195147, 0.9927, 0.9927, 0.9989, 0.9862, 0.9998, 0.9954, 1.0028, 0.9891, 1.0003);
338     photcicnoeleveto->AddEnCorrPerRun(195148, 195350, 0.9928, 0.9928, 0.9990, 0.9852, 0.9988, 1.0007, 1.0081, 0.9943, 1.0054);
339     photcicnoeleveto->AddEnCorrPerRun(195351, 195395, 0.9931, 0.9931, 0.9992, 0.9861, 0.9996, 0.9933, 1.0008, 0.9900, 1.0012);
340     photcicnoeleveto->AddEnCorrPerRun(195396, 195530, 0.9932, 0.9932, 0.9994, 0.9861, 0.9996, 0.9951, 1.0025, 0.9869, 0.9982);
341     photcicnoeleveto->AddEnCorrPerRun(195531, 999999, 0.9924, 0.9924, 0.9986, 0.9857, 0.9992, 0.9962, 1.0036, 0.9885, 0.9997);
342 mingyang 1.8 //photcicnoeleveto->SetDoMCR9Scaling(kTRUE);
343     //photcicnoeleveto->SetMCR9Scale(1.0035, 1.0035);
344     photcicnoeleveto->SetDoShowerShapeScaling(kTRUE);
345     photcicnoeleveto->SetShowerShapeType("2012ShowerShape");
346 bendavid 1.13 //photcicnoeleveto->SetDoMCErrScaling(kTRUE);
347 mingyang 1.11 //photcicnoeleveto->SetMCErrScale(1.07, 1.045);
348 bendavid 1.13 //photcicnoeleveto->SetMCErrScale(1, 1);
349 bendavid 1.1 photcicnoeleveto->SetApplyEleVeto(kFALSE);
350 bendavid 1.14 photcicnoeleveto->SetInvertElectronVeto(kFALSE);
351 bendavid 1.1 photcicnoeleveto->SetJetsName(jetCorr->GetOutputName());
352 bendavid 1.15 //photcicnoeleveto->SetRescaledBeamspotWidth(5.0);
353 bendavid 1.1 photcicnoeleveto->SetIsData(isData);
354    
355    
356     PhotonPairSelector *photpresel = new PhotonPairSelector("PhotonPairSelectorPresel");
357     photpresel->SetOutputName("GoodPhotonsPresel");
358     photpresel->SetPhotonSelType("MITPFSelection");
359 bendavid 1.9 photpresel->SetVertexSelType("CiCMVA2012Selection");
360 bendavid 1.6 //photpresel->SetUseSingleLegConversions(kTRUE);
361 mingyang 1.3 photpresel->SetIdMVAType("2012IdMVA_globe");
362 bendavid 1.1 //photpresel->SetVertexSelType("MetSigSelection");
363     photpresel->DoMCSmear(kTRUE);
364 bendavid 1.12 photpresel->DoDataEneCorr(kTRUE);
365 bendavid 1.1 photpresel->SetPhotonsFromBranch(kFALSE);
366     photpresel->SetInputPhotonsName(photreg->GetOutputName());
367 bendavid 1.15 photpresel->SetMCSmearFactors(0.00825,0.01035,0.0116,0.0222,0.0138,0.0292,0.0275,0.0322,0.0310);
368     photpresel->AddEnCorrPerRun(190450, 190781, 0.9944, 0.9944, 1.0006, 0.9948, 1.0083, 0.9881, 0.9956, 0.9878, 0.9991);
369     photpresel->AddEnCorrPerRun(190782, 190949, 1.0085, 1.0085, 1.0146, 0.9858, 0.9993, 1.0047, 1.0120, 0.9962, 1.0074);
370     photpresel->AddEnCorrPerRun(190950, 191833, 0.9939, 0.9939, 1.0001, 0.9879, 1.0014, 0.9906, 0.9981, 0.9874, 0.9986);
371     photpresel->AddEnCorrPerRun(191834, 193686, 0.9916, 0.9916, 0.9978, 0.9855, 0.9990, 0.9907, 0.9982, 0.9893, 1.0005);
372     photpresel->AddEnCorrPerRun(193746, 194210, 0.9921, 0.9921, 0.9983, 0.9834, 0.9970, 0.9921, 0.9996, 0.9883, 0.9995);
373     photpresel->AddEnCorrPerRun(194211, 194479, 0.9926, 0.9926, 0.9988, 0.9845, 0.9980, 0.9928, 1.0003, 0.9895, 1.0007);
374     photpresel->AddEnCorrPerRun(194480, 195147, 0.9927, 0.9927, 0.9989, 0.9862, 0.9998, 0.9954, 1.0028, 0.9891, 1.0003);
375     photpresel->AddEnCorrPerRun(195148, 195350, 0.9928, 0.9928, 0.9990, 0.9852, 0.9988, 1.0007, 1.0081, 0.9943, 1.0054);
376     photpresel->AddEnCorrPerRun(195351, 195395, 0.9931, 0.9931, 0.9992, 0.9861, 0.9996, 0.9933, 1.0008, 0.9900, 1.0012);
377     photpresel->AddEnCorrPerRun(195396, 195530, 0.9932, 0.9932, 0.9994, 0.9861, 0.9996, 0.9951, 1.0025, 0.9869, 0.9982);
378     photpresel->AddEnCorrPerRun(195531, 999999, 0.9924, 0.9924, 0.9986, 0.9857, 0.9992, 0.9962, 1.0036, 0.9885, 0.9997);
379    
380 bendavid 1.12 //photcicnoeleveto->SetDoMCR9Scaling(kTRUE);
381 mingyang 1.8 photpresel->SetDoShowerShapeScaling(kTRUE);
382     photpresel->SetShowerShapeType("2012ShowerShape");
383 bendavid 1.13 //photpresel->SetDoMCErrScaling(kTRUE);
384 mingyang 1.11 //photpresel->SetMCErrScale(1.07, 1.045);
385 bendavid 1.13 //photpresel->SetMCErrScale(1, 1);
386 bendavid 1.15 photpresel->SetJetsName(jetCorr->GetOutputName());
387     //photpresel->SetRescaledBeamspotWidth(5.0);
388 bendavid 1.1 photpresel->SetIsData(isData);
389    
390     PhotonPairSelector *photpreselinverteleveto = new PhotonPairSelector("PhotonPairSelectorPreselInvertEleVeto");
391     photpreselinverteleveto->SetOutputName("GoodPhotonsPreselInvertEleVeto");
392     photpreselinverteleveto->SetOutputVtxName("OutVtxPreselInvertEleVeto");
393     photpreselinverteleveto->SetPhotonSelType("MITPFSelection");
394 mingyang 1.3 photpreselinverteleveto->SetIdMVAType("2012IdMVA_globe");
395 bendavid 1.9 photpreselinverteleveto->SetVertexSelType("CiCMVA2012Selection");
396 bendavid 1.6 //photpreselinverteleveto->SetUseSingleLegConversions(kTRUE);
397 bendavid 1.1 photpreselinverteleveto->DoMCSmear(kTRUE);
398 bendavid 1.12 photpreselinverteleveto->DoDataEneCorr(kTRUE);
399 bendavid 1.1 photpreselinverteleveto->SetPhotonsFromBranch(kFALSE);
400     photpreselinverteleveto->SetInputPhotonsName(photreg->GetOutputName());
401 bendavid 1.15 photpreselinverteleveto->SetMCSmearFactors(0.00825,0.01035,0.0116,0.0222,0.0138,0.0292,0.0275,0.0322,0.0310);
402     photpreselinverteleveto->AddEnCorrPerRun(190450, 190781, 0.9944, 0.9944, 1.0006, 0.9948, 1.0083, 0.9881, 0.9956, 0.9878, 0.9991);
403     photpreselinverteleveto->AddEnCorrPerRun(190782, 190949, 1.0085, 1.0085, 1.0146, 0.9858, 0.9993, 1.0047, 1.0120, 0.9962, 1.0074);
404     photpreselinverteleveto->AddEnCorrPerRun(190950, 191833, 0.9939, 0.9939, 1.0001, 0.9879, 1.0014, 0.9906, 0.9981, 0.9874, 0.9986);
405     photpreselinverteleveto->AddEnCorrPerRun(191834, 193686, 0.9916, 0.9916, 0.9978, 0.9855, 0.9990, 0.9907, 0.9982, 0.9893, 1.0005);
406     photpreselinverteleveto->AddEnCorrPerRun(193746, 194210, 0.9921, 0.9921, 0.9983, 0.9834, 0.9970, 0.9921, 0.9996, 0.9883, 0.9995);
407     photpreselinverteleveto->AddEnCorrPerRun(194211, 194479, 0.9926, 0.9926, 0.9988, 0.9845, 0.9980, 0.9928, 1.0003, 0.9895, 1.0007);
408     photpreselinverteleveto->AddEnCorrPerRun(194480, 195147, 0.9927, 0.9927, 0.9989, 0.9862, 0.9998, 0.9954, 1.0028, 0.9891, 1.0003);
409     photpreselinverteleveto->AddEnCorrPerRun(195148, 195350, 0.9928, 0.9928, 0.9990, 0.9852, 0.9988, 1.0007, 1.0081, 0.9943, 1.0054);
410     photpreselinverteleveto->AddEnCorrPerRun(195351, 195395, 0.9931, 0.9931, 0.9992, 0.9861, 0.9996, 0.9933, 1.0008, 0.9900, 1.0012);
411     photpreselinverteleveto->AddEnCorrPerRun(195396, 195530, 0.9932, 0.9932, 0.9994, 0.9861, 0.9996, 0.9951, 1.0025, 0.9869, 0.9982);
412     photpreselinverteleveto->AddEnCorrPerRun(195531, 999999, 0.9924, 0.9924, 0.9986, 0.9857, 0.9992, 0.9962, 1.0036, 0.9885, 0.9997);
413 mingyang 1.11 photpreselinverteleveto->SetShowerShapeType("2012ShowerShape");
414     photpreselinverteleveto->SetDoShowerShapeScaling(kTRUE);
415 bendavid 1.13 //photpreselinverteleveto->SetDoMCErrScaling(kTRUE);
416 mingyang 1.11 //photpreselinverteleveto->SetMCErrScale(1.07, 1.045);
417 bendavid 1.13 //photpreselinverteleveto->SetMCErrScale(1, 1);
418 mingyang 1.11 photpreselinverteleveto->SetApplyEleVeto(kFALSE);
419 bendavid 1.14 photpreselinverteleveto->SetInvertElectronVeto(kFALSE);
420 mingyang 1.11 photpreselinverteleveto->SetJetsName(jetCorr->GetOutputName());
421 bendavid 1.15 //photpreselinverteleveto->SetRescaledBeamspotWidth(5.0);
422 mingyang 1.11 photpreselinverteleveto->SetIsData(isData);
423    
424     PhotonPairSelector *photpreselnosmear = new PhotonPairSelector("PhotonPairSelectorPreselNoSmear");
425     photpreselnosmear->SetOutputName("GoodPhotonsPreselNoSmear");
426     photpreselnosmear->SetPhotonSelType("MITPFSelection");
427     photpreselnosmear->SetVertexSelType("CiCMVA2012Selection");
428     //photpreselnosmear->SetUseSingleLegConversions(kTRUE);
429     photpreselnosmear->SetIdMVAType("2012IdMVA_globe");
430     photpreselnosmear->SetShowerShapeType("2012ShowerShape");
431     photpreselnosmear->SetDoShowerShapeScaling(kTRUE);
432     photpreselnosmear->SetPhotonsFromBranch(kFALSE);
433     photpreselnosmear->SetInputPhotonsName(photreg->GetOutputName());
434     photpreselnosmear->SetJetsName(jetCorr->GetOutputName());
435     photpreselnosmear->SetOutputVtxName("OutVtxNoSmear");
436 bendavid 1.15 photpreselnosmear->SetLeadingPtMin(30.);
437     photpreselnosmear->SetTrailingPtMin(22.);
438     //photpreselnosmear->SetRescaledBeamspotWidth(5.0);
439 mingyang 1.11 photpreselnosmear->SetIsData(isData);
440    
441    
442     PhotonTreeWriter *phottreecic = new PhotonTreeWriter("PhotonTreeWriterCiC");
443     phottreecic->SetPhotonsFromBranch(kFALSE);
444     phottreecic->SetInputPhotonsName(photcic->GetOutputName());
445     phottreecic->SetEnableJets(kTRUE);
446     phottreecic->SetApplyJetId(kTRUE);
447     phottreecic->SetPFJetsFromBranch(kFALSE);
448     phottreecic->SetPFJetName(jetCorr->GetOutputName());
449     phottreecic->SetExcludeDoublePrompt(excludedoubleprompt);
450     phottreecic->SetIsData(isData);
451     if (is25) phottreecic->SetEnablePFPhotons(kFALSE);
452    
453 bendavid 1.1 PhotonTreeWriter *phottreecicnoeleveto = new PhotonTreeWriter("PhotonTreeWriterCiCInvertEleVeto");
454     phottreecicnoeleveto->SetPhotonsFromBranch(kFALSE);
455     phottreecicnoeleveto->SetInputPhotonsName(photcicnoeleveto->GetOutputName());
456     phottreecicnoeleveto->SetEnableJets(kTRUE);
457 bendavid 1.6 phottreecicnoeleveto->SetApplyJetId(kTRUE);
458 bendavid 1.1 phottreecicnoeleveto->SetPFJetsFromBranch(kFALSE);
459     phottreecicnoeleveto->SetPFJetName(jetCorr->GetOutputName());
460     phottreecicnoeleveto->SetApplyElectronVeto(kFALSE);
461     phottreecicnoeleveto->SetExcludeDoublePrompt(excludedoubleprompt);
462     phottreecicnoeleveto->SetIsData(isData);
463     if (is25) phottreecicnoeleveto->SetEnablePFPhotons(kFALSE);
464    
465     PhotonTreeWriter *phottreepresel = new PhotonTreeWriter("PhotonTreeWriterPresel");
466     phottreepresel->SetPhotonsFromBranch(kFALSE);
467     phottreepresel->SetInputPhotonsName(photpresel->GetOutputName());
468     phottreepresel->SetEnableJets(kTRUE);
469 bendavid 1.6 phottreepresel->SetApplyJetId(kTRUE);
470 bendavid 1.1 phottreepresel->SetPFJetsFromBranch(kFALSE);
471     phottreepresel->SetPFJetName(jetCorr->GetOutputName());
472     phottreepresel->SetExcludeDoublePrompt(excludedoubleprompt);
473     phottreepresel->SetIsData(isData);
474     if (is25) phottreepresel->SetEnablePFPhotons(kFALSE);
475    
476     PhotonTreeWriter *phottreepreselinverteleveto = new PhotonTreeWriter("PhotonTreeWriterPreselInvertEleVeto");
477     phottreepreselinverteleveto->SetPhotonsFromBranch(kFALSE);
478     phottreepreselinverteleveto->SetInputPhotonsName(photpreselinverteleveto->GetOutputName());
479     phottreepreselinverteleveto->SetEnableJets(kTRUE);
480 bendavid 1.6 phottreepreselinverteleveto->SetApplyJetId(kTRUE);
481 bendavid 1.1 phottreepreselinverteleveto->SetPFJetsFromBranch(kFALSE);
482     phottreepreselinverteleveto->SetPFJetName(jetCorr->GetOutputName());
483     phottreepreselinverteleveto->SetApplyElectronVeto(kFALSE);
484     phottreepreselinverteleveto->SetExcludeDoublePrompt(excludedoubleprompt);
485     phottreepreselinverteleveto->SetIsData(isData);
486     if (is25) phottreepreselinverteleveto->SetEnablePFPhotons(kFALSE);
487    
488     PhotonTreeWriter *phottreepreselnosmear = new PhotonTreeWriter("PhotonTreeWriterPreselNoSmear");
489     phottreepreselnosmear->SetPhotonsFromBranch(kFALSE);
490     phottreepreselnosmear->SetInputPhotonsName(photpreselnosmear->GetOutputName());
491     phottreepreselnosmear->SetEnableJets(kTRUE);
492 bendavid 1.6 phottreepreselnosmear->SetApplyJetId(kTRUE);
493 bendavid 1.1 phottreepreselnosmear->SetPFJetsFromBranch(kFALSE);
494     phottreepreselnosmear->SetPFJetName(jetCorr->GetOutputName());
495     phottreepreselnosmear->SetExcludeDoublePrompt(excludedoubleprompt);
496     phottreepreselnosmear->SetIsData(isData);
497     if (is25) phottreepreselnosmear->SetEnablePFPhotons(kFALSE);
498    
499     PhotonIDMod *photidpresel = new PhotonIDMod("PhotonIDModPresel");
500     photidpresel->SetPtMin(25.0);
501     photidpresel->SetOutputName("GoodPhotonsPreselid");
502     photidpresel->SetIDType("MITPFSelection");
503     photidpresel->SetApplyElectronVeto(kTRUE);
504     photidpresel->SetIsData(isData);
505    
506     PhotonIDMod *photidpreselinvert = new PhotonIDMod("PhotonIDModPreselInvert");
507     photidpreselinvert->SetPtMin(25.0);
508     photidpreselinvert->SetOutputName("GoodPhotonsPreselidInvert");
509     photidpreselinvert->SetIDType("MITPFSelection");
510     photidpreselinvert->SetApplyElectronVeto(kFALSE);
511     photidpreselinvert->SetInvertElectronVeto(kTRUE);
512     photidpreselinvert->SetIsData(isData);
513    
514     PhotonTreeWriter *phottreesingle = new PhotonTreeWriter("PhotonTreeWriterSingle");
515     phottreesingle->SetWriteDiphotonTree(kFALSE);
516     phottreesingle->SetPhotonsFromBranch(kFALSE);
517     phottreesingle->SetInputPhotonsName(photidpresel->GetOutputName());
518     phottreesingle->SetEnableJets(kTRUE);
519     phottreesingle->SetPFJetsFromBranch(kFALSE);
520     phottreesingle->SetPFJetName(jetCorr->GetOutputName());
521 bendavid 1.15 phottreesingle->SetBeamspotWidth(5.0);
522 bendavid 1.1 phottreesingle->SetIsData(isData);
523     if (is25) phottreesingle->SetEnablePFPhotons(kFALSE);
524    
525     PhotonTreeWriter *phottreesingleinvert = new PhotonTreeWriter("PhotonTreeWriterSingleInvert");
526     phottreesingleinvert->SetWriteDiphotonTree(kTRUE);
527     phottreesingleinvert->SetPhotonsFromBranch(kFALSE);
528     phottreesingleinvert->SetInputPhotonsName(photidpreselinvert->GetOutputName());
529     phottreesingleinvert->SetEnableJets(kTRUE);
530     phottreesingleinvert->SetPFJetsFromBranch(kFALSE);
531     phottreesingleinvert->SetPFJetName(pubJetOpen->GetOutputName());
532     phottreesingleinvert->SetApplyElectronVeto(kFALSE);
533 bendavid 1.15 phottreesingleinvert->SetBeamspotWidth(5.0);
534 bendavid 1.1 phottreesingleinvert->SetIsData(isData);
535     if (is25) phottreesingleinvert->SetEnablePFPhotons(kFALSE);
536    
537    
538     //------------------------------------------------------------------------------------------------
539     // making analysis chain
540     //------------------------------------------------------------------------------------------------
541     // this is how it always starts
542     runLumiSel ->Add(mcselmod);
543    
544     if (TString(dataset).Contains("-h")) {
545     mcselmod ->Add(sysMod);
546     }
547    
548     // high level trigger is always first
549     //mcselmod ->Add(hltModES);
550 mingyang 1.4 //mcselmod ->Add(hltModE);
551 bendavid 1.13
552     if (!TString(dataset).Contains("meridiani")) {
553     mcselmod ->Add(hltModP);
554     hltModP ->Add(goodPVFilterMod);
555     }
556     else {
557     mcselmod->Add(goodPVFilterMod);
558     }
559 mingyang 1.4 //hltModE ->Add(goodPVFilterModE);
560 bendavid 1.1 //hltModES ->Add(goodPVFilterModES);
561    
562     //goodPVFilterMod ->Add(muonId);
563     goodPVFilterMod->Add(photreg);
564     photreg->Add(pubJet);
565     pubJet->Add(jetCorr);
566    
567     // simple object id modules
568 mingyang 1.4 //goodPVFilterModE -> Add(pubJetOpen);
569     //pubJetOpen -> Add(photidpreselinvert);
570 bendavid 1.1 //goodPVFilterModES ->Add(elecIdS);
571    
572    
573 bendavid 1.6 jetCorr ->Add(photcic);
574 bendavid 1.13 //jetCorr ->Add(photcicnoeleveto);
575 bendavid 1.1 jetCorr ->Add(photpresel);
576     jetCorr ->Add(photpreselinverteleveto);
577 bendavid 1.15 jetCorr ->Add(photpreselnosmear);
578 bendavid 1.1
579 bendavid 1.6 photcic ->Add(phottreecic);
580     photcicnoeleveto ->Add(phottreecicnoeleveto);
581 bendavid 1.1 photpresel ->Add(phottreepresel);
582     photpreselinverteleveto ->Add(phottreepreselinverteleveto);
583 bendavid 1.6 photpreselnosmear ->Add(phottreepreselnosmear);
584 bendavid 1.1
585    
586 mingyang 1.3 //jetCorr ->Add(photidpresel);
587     //photidpresel ->Add(phottreesingle);
588 bendavid 1.1
589 mingyang 1.3 //photidpreselinvert ->Add(phottreesingleinvert);
590 bendavid 1.1 //elecIdS->Add(phottreeES);
591    
592    
593 bendavid 1.12 //TFile::SetOpenTimeout(0);
594 bendavid 1.1 //TFile::SetCacheFileDir("./rootfilecache",kTRUE,kTRUE);
595     TFile::SetReadaheadSize(128*1024*1024);
596    
597     //------------------------------------------------------------------------------------------------
598     // setup analysis
599     //------------------------------------------------------------------------------------------------
600     Analysis *ana = new Analysis;
601     ana->SetUseHLT(kTRUE);
602     ana->SetKeepHierarchy(kTRUE);
603     ana->SetSuperModule(runLumiSel);
604     ana->SetPrintScale(100);
605     if (nEvents >= 0)
606     ana->SetProcessNEvents(nEvents);
607    
608 bendavid 1.13 if (TString(dataset).Contains("meridiani")) {
609     ana->SetUseHLT(kFALSE);
610     }
611    
612 bendavid 1.1 //------------------------------------------------------------------------------------------------
613     // organize input
614     //------------------------------------------------------------------------------------------------
615     Catalog *c = new Catalog(catalogDir);
616     TString skimdataset = TString(dataset)+TString("/") +TString(skim);
617     Dataset *d = NULL;
618     TString bookstr = book;
619     //if (TString(dataset).Contains("s11-h")) bookstr.ReplaceAll("local","t2mit");
620     if (TString(skim).CompareTo("noskim") == 0)
621     d = c->FindDataset(bookstr,dataset,fileset);
622     else
623     d = c->FindDataset(bookstr,skimdataset.Data(),fileset);
624     ana->AddDataset(d);
625 bendavid 1.9 //ana->AddFile("/scratch/bendavid/root/DA2D6D6F-BB95-E111-9564-001A92971B7E.root");
626 bendavid 1.1
627     //------------------------------------------------------------------------------------------------
628     // organize output
629     //------------------------------------------------------------------------------------------------
630     TString rootFile = TString(outputName);
631     rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
632     if (TString(fileset) != TString(""))
633     rootFile += TString("_") + TString(fileset);
634     rootFile += TString(".root");
635     ana->SetOutputName(rootFile.Data());
636     //ana->SetCacheSize(64*1024*1024);
637     ana->SetCacheSize(0);
638    
639     //------------------------------------------------------------------------------------------------
640     // Say what we are doing
641     //------------------------------------------------------------------------------------------------
642     printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n");
643     printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap);
644     printf("\n Rely on Catalog: %s\n",catalogDir);
645     printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset);
646     printf("\n Root output: %s\n\n",rootFile.Data());
647     printf("\n========================================\n");
648    
649     //------------------------------------------------------------------------------------------------
650     // run the analysis after successful initialisation
651     //------------------------------------------------------------------------------------------------
652     ana->Run(!gROOT->IsBatch());
653    
654     return;
655     }