1 |
bendavid |
1.1 |
//root -l -q -b $CMSSW_BASE/src/MitHiggs/macros/runMacros/runHwwExampleAnalysis.C+\(\"0000\",\"noskim\",\"s8-h190ww2l-gf-mc3\",\"mit/filler/011\",\"/home/mitprod/catalog\",\"HwwExampleAnalysis\",1000,1\)
|
2 |
|
|
|
3 |
ceballos |
1.7 |
// $Id: runPhysicsExample.C,v 1.6 2010/10/05 06:50:20 ceballos Exp $
|
4 |
bendavid |
1.1 |
|
5 |
|
|
#if !defined(__CINT__) || defined(__MAKECINT__)
|
6 |
|
|
#include <TROOT.h>
|
7 |
|
|
#include <exception>
|
8 |
|
|
#include "MitAna/DataUtil/interface/Debug.h"
|
9 |
|
|
#include "MitAna/Catalog/interface/Catalog.h"
|
10 |
|
|
#include "MitAna/TreeMod/interface/Analysis.h"
|
11 |
|
|
#include "MitAna/TreeMod/interface/HLTMod.h"
|
12 |
|
|
#include "MitAna/PhysicsMod/interface/PublisherMod.h"
|
13 |
bendavid |
1.3 |
#include "MitAna/PhysicsMod/interface/RunLumiSelectionMod.h"
|
14 |
bendavid |
1.1 |
#include "MitPhysics/Init/interface/ModNames.h"
|
15 |
ceballos |
1.5 |
#include "MitPhysics/Mods/interface/GoodPVFilterMod.h"
|
16 |
bendavid |
1.1 |
#include "MitPhysics/Mods/interface/GeneratorMod.h"
|
17 |
|
|
#include "MitPhysics/Mods/interface/HKFactorProducer.h"
|
18 |
|
|
#include "MitPhysics/Mods/interface/JetCorrectionMod.h"
|
19 |
|
|
#include "MitPhysics/Mods/interface/CaloMetCorrectionMod.h"
|
20 |
|
|
#include "MitPhysics/Mods/interface/MuonIDMod.h"
|
21 |
|
|
#include "MitPhysics/Mods/interface/ElectronIDMod.h"
|
22 |
|
|
#include "MitPhysics/Mods/interface/PhotonIDMod.h"
|
23 |
|
|
#include "MitPhysics/Mods/interface/TauIDMod.h"
|
24 |
|
|
#include "MitPhysics/Mods/interface/JetIDMod.h"
|
25 |
|
|
#include "MitPhysics/Mods/interface/ElectronCleaningMod.h"
|
26 |
|
|
#include "MitPhysics/Mods/interface/PhotonCleaningMod.h"
|
27 |
|
|
#include "MitPhysics/Mods/interface/TauCleaningMod.h"
|
28 |
|
|
#include "MitPhysics/Mods/interface/JetCleaningMod.h"
|
29 |
|
|
#include "MitPhysics/Mods/interface/MergeLeptonsMod.h"
|
30 |
|
|
#include "MitAna/DataTree/interface/JetCol.h"
|
31 |
ceballos |
1.5 |
#include "MitAna/DataTree/interface/PFJetCol.h"
|
32 |
bendavid |
1.1 |
#include "MitAna/DataTree/interface/MetCol.h"
|
33 |
|
|
#include "MitAna/DataTree/interface/CaloMetCol.h"
|
34 |
ceballos |
1.5 |
#include "MitPhysics/SelMods/interface/HwwExampleAnalysisMod.h"
|
35 |
bendavid |
1.1 |
#endif
|
36 |
|
|
|
37 |
|
|
//--------------------------------------------------------------------------------------------------
|
38 |
ceballos |
1.5 |
void runPhysicsExample(const char *catalogDir = "/home/ceballos/catalog",
|
39 |
|
|
const char *book = "cern/filler/014a",
|
40 |
|
|
const char *dataset = "p10-ww2l-v26",
|
41 |
ceballos |
1.4 |
const char *fileset = "0000",
|
42 |
|
|
const char *skim = "noskim",
|
43 |
|
|
const char *outputName = "histo",
|
44 |
|
|
int sampleID = -1,
|
45 |
ceballos |
1.5 |
int nEvents = 10000)
|
46 |
bendavid |
1.1 |
{
|
47 |
|
|
//------------------------------------------------------------------------------------------------
|
48 |
|
|
// some global setups
|
49 |
|
|
//------------------------------------------------------------------------------------------------
|
50 |
|
|
using namespace mithep;
|
51 |
|
|
gDebugMask = Debug::kAnalysis;
|
52 |
ceballos |
1.5 |
gDebugLevel = 3;
|
53 |
bendavid |
1.1 |
|
54 |
|
|
//------------------------------------------------------------------------------------------------
|
55 |
|
|
// set up information
|
56 |
|
|
//------------------------------------------------------------------------------------------------
|
57 |
ceballos |
1.4 |
Bool_t applyISRFilter = kFALSE;
|
58 |
|
|
Bool_t applyMllGenCut = kFALSE;
|
59 |
|
|
Bool_t isData = kFALSE;
|
60 |
ceballos |
1.5 |
Bool_t isElData = kFALSE;
|
61 |
|
|
int processId = -999999999; // use 999 for MCatNLO MC sample, 102 for H->WW
|
62 |
ceballos |
1.7 |
TString fInputFilenameKF = "/home/ceballos/releases/CMSSW_3_8_5/src/MitPhysics/data/HWW_KFactors_160_10TeV.dat";
|
63 |
bendavid |
1.1 |
|
64 |
ceballos |
1.5 |
if(sampleID > 1000) isData = kTRUE;
|
65 |
|
|
if(sampleID > 2000) isElData = kTRUE;
|
66 |
ceballos |
1.4 |
|
67 |
bendavid |
1.1 |
//------------------------------------------------------------------------------------------------
|
68 |
|
|
// generator information
|
69 |
|
|
//------------------------------------------------------------------------------------------------
|
70 |
|
|
GeneratorMod *generatorMod = new GeneratorMod;
|
71 |
ceballos |
1.4 |
generatorMod->SetPrintDebug(kFALSE);
|
72 |
|
|
generatorMod->SetPtLeptonMin(0.0);
|
73 |
|
|
generatorMod->SetEtaLeptonMax(2.7);
|
74 |
|
|
generatorMod->SetPtPhotonMin(15.0);
|
75 |
|
|
generatorMod->SetEtaPhotonMax(2.7);
|
76 |
|
|
generatorMod->SetPtRadPhotonMin(10.0);
|
77 |
|
|
generatorMod->SetEtaRadPhotonMax(2.7);
|
78 |
|
|
generatorMod->SetIsData(isData);
|
79 |
|
|
generatorMod->SetFillHist(!isData);
|
80 |
|
|
if(applyMllGenCut == kTRUE){
|
81 |
|
|
generatorMod->SetPdgIdCut(23);
|
82 |
ceballos |
1.5 |
generatorMod->SetMassMinCut( 0.);
|
83 |
ceballos |
1.4 |
generatorMod->SetMassMaxCut(50.);
|
84 |
|
|
}
|
85 |
|
|
generatorMod->SetApplyISRFilter(applyISRFilter);
|
86 |
bendavid |
1.1 |
|
87 |
ceballos |
1.5 |
HKFactorProducer *hKFactorProducer = new HKFactorProducer;
|
88 |
|
|
hKFactorProducer->SetProcessID(processId);
|
89 |
|
|
hKFactorProducer->SetInputFilename(fInputFilenameKF);
|
90 |
|
|
hKFactorProducer->SetIsData(isData);
|
91 |
|
|
hKFactorProducer->SetFillHist(!isData);
|
92 |
|
|
|
93 |
|
|
//------------------------------------------------------------------------------------------------
|
94 |
|
|
// Run RunLumiSelectionMod
|
95 |
|
|
//------------------------------------------------------------------------------------------------
|
96 |
|
|
RunLumiSelectionMod *runLumiSelectionMod = new RunLumiSelectionMod;
|
97 |
|
|
runLumiSelectionMod->SetAcceptMC(!isData);
|
98 |
ceballos |
1.7 |
runLumiSelectionMod->AddJSONFile("/home/ceballos/releases/CMSSW_3_8_5/src/json/Cert_TopOct22_Merged_135821-148058_allPVT.txt");
|
99 |
ceballos |
1.5 |
|
100 |
|
|
//------------------------------------------------------------------------------------------------
|
101 |
|
|
// PV filter selection
|
102 |
|
|
//------------------------------------------------------------------------------------------------
|
103 |
|
|
GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod;
|
104 |
|
|
goodPVFilterMod->SetMinVertexNTracks(0);
|
105 |
|
|
goodPVFilterMod->SetMinNDof(5);
|
106 |
|
|
goodPVFilterMod->SetMaxAbsZ(24.0);
|
107 |
|
|
goodPVFilterMod->SetMaxRho(2.0);
|
108 |
|
|
|
109 |
bendavid |
1.1 |
//------------------------------------------------------------------------------------------------
|
110 |
|
|
// HLT information
|
111 |
|
|
//------------------------------------------------------------------------------------------------
|
112 |
|
|
HLTMod *hltmod = new HLTMod;
|
113 |
ceballos |
1.5 |
if (isData == kFALSE){
|
114 |
ceballos |
1.4 |
hltmod->AddTrigger("HLT_Mu9");
|
115 |
ceballos |
1.7 |
hltmod->AddTrigger("!HLT_Mu9");
|
116 |
ceballos |
1.5 |
}
|
117 |
|
|
else if(isElData == kFALSE){
|
118 |
ceballos |
1.7 |
hltmod->AddTrigger("HLT_Mu9",132440,147119);
|
119 |
|
|
hltmod->AddTrigger("HLT_Mu9&HLT_Photon10_L1R",132440,135058);
|
120 |
|
|
hltmod->AddTrigger("HLT_Mu9&HLT_Ele10_LW_L1R",135059,140041);
|
121 |
|
|
hltmod->AddTrigger("HLT_Mu9&HLT_Ele15_SW_L1R",140042,141900);
|
122 |
|
|
hltmod->AddTrigger("HLT_Mu9&HLT_Ele15_SW_CaloEleId_L1R",141901,146427);
|
123 |
|
|
hltmod->AddTrigger("HLT_Mu9&HLT_Ele17_SW_CaloEleId_L1R",146428,147119);
|
124 |
|
|
|
125 |
|
|
hltmod->AddTrigger("HLT_Mu15_v1",147120,999999);
|
126 |
|
|
hltmod->AddTrigger("HLT_Mu15_v1&HLT_Ele17_SW_TightCaloEleId_SC8HE_L1R_v1",147120,999999);
|
127 |
ceballos |
1.5 |
}
|
128 |
|
|
else {
|
129 |
ceballos |
1.7 |
hltmod->AddTrigger("!HLT_Mu9&HLT_Photon10_L1R",132440,135058);
|
130 |
|
|
hltmod->AddTrigger("!HLT_Mu9&HLT_Ele10_LW_L1R",135059,140041);
|
131 |
|
|
hltmod->AddTrigger("!HLT_Mu9&HLT_Ele15_SW_L1R",140042,141900);
|
132 |
|
|
hltmod->AddTrigger("!HLT_Mu9&HLT_Ele15_SW_CaloEleId_L1R",141901,146427);
|
133 |
|
|
hltmod->AddTrigger("!HLT_Mu9&HLT_Ele17_SW_CaloEleId_L1R",146428,147119);
|
134 |
|
|
|
135 |
|
|
hltmod->AddTrigger("!HLT_Mu15_v1&HLT_Ele17_SW_TightCaloEleId_SC8HE_L1R_v1",147120,999999);
|
136 |
bendavid |
1.1 |
}
|
137 |
|
|
hltmod->SetTrigObjsName("myhltobjs");
|
138 |
|
|
|
139 |
|
|
//------------------------------------------------------------------------------------------------
|
140 |
|
|
// publisher Mod
|
141 |
|
|
//------------------------------------------------------------------------------------------------
|
142 |
ceballos |
1.5 |
PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub");
|
143 |
|
|
pubJet->SetInputName("AKt5PFJets");
|
144 |
|
|
pubJet->SetOutputName("PubAKt5PFJets");
|
145 |
bendavid |
1.1 |
|
146 |
|
|
PublisherMod<Met,Met> *pubMet = new PublisherMod<Met,Met>("MetPub");
|
147 |
|
|
pubMet->SetInputName("TCMet");
|
148 |
|
|
pubMet->SetOutputName("PubTCMet");
|
149 |
|
|
|
150 |
ceballos |
1.4 |
PublisherMod<CaloMet> *pubCaloMet = new PublisherMod<CaloMet>;
|
151 |
|
|
pubCaloMet->SetName("CaloMetPub");
|
152 |
|
|
pubCaloMet->SetInputName("CorMuonMet");
|
153 |
|
|
pubCaloMet->SetOutputName("pubCaloMet");
|
154 |
|
|
|
155 |
bendavid |
1.1 |
//------------------------------------------------------------------------------------------------
|
156 |
ceballos |
1.4 |
// Apply Jet Corrections
|
157 |
bendavid |
1.1 |
//------------------------------------------------------------------------------------------------
|
158 |
bendavid |
1.3 |
JetCorrectionMod *jetCorr = new JetCorrectionMod;
|
159 |
ceballos |
1.5 |
jetCorr->AddCorrectionFromRelease("CondFormats/JetMETObjects/data/Spring10_L2Relative_AK5PF.txt");
|
160 |
|
|
jetCorr->AddCorrectionFromRelease("CondFormats/JetMETObjects/data/Spring10_L3Absolute_AK5PF.txt");
|
161 |
bendavid |
1.1 |
jetCorr->SetInputName(pubJet->GetOutputName());
|
162 |
ceballos |
1.4 |
jetCorr->SetCorrectedName("CorrectedJets");
|
163 |
bendavid |
1.1 |
|
164 |
ceballos |
1.4 |
//------------------------------------------------------------------------------------------------
|
165 |
|
|
// Apply Met Corrections
|
166 |
|
|
//------------------------------------------------------------------------------------------------
|
167 |
|
|
CaloMetCorrectionMod *metCaloCorr = new CaloMetCorrectionMod;
|
168 |
|
|
metCaloCorr->SetInputName(pubCaloMet->GetOutputName());
|
169 |
|
|
metCaloCorr->SetCorrectedJetsName(jetCorr->GetOutputName());
|
170 |
|
|
metCaloCorr->SetOutputName("pubCaloCorrectedMet");
|
171 |
bendavid |
1.1 |
|
172 |
|
|
//------------------------------------------------------------------------------------------------
|
173 |
|
|
// object id and cleaning sequence
|
174 |
|
|
//------------------------------------------------------------------------------------------------
|
175 |
ceballos |
1.4 |
MuonIDMod *muonID = new MuonIDMod;
|
176 |
ceballos |
1.5 |
muonID->SetClassType("Global");
|
177 |
|
|
muonID->SetIDType("Minimal");
|
178 |
|
|
muonID->SetIsoType("TrackCaloSliding");
|
179 |
|
|
muonID->SetApplyD0Cut(kTRUE);
|
180 |
|
|
|
181 |
ceballos |
1.4 |
ElectronIDMod *electronID = new ElectronIDMod;
|
182 |
ceballos |
1.5 |
electronID->SetIDType("VBTFWorkingPoint80Id");
|
183 |
|
|
electronID->SetIsoType("TrackJuraSliding");
|
184 |
|
|
electronID->SetApplyConversionFilterType1(kFALSE);
|
185 |
|
|
electronID->SetApplyConversionFilterType2(kTRUE);
|
186 |
|
|
electronID->SetChargeFilter(kFALSE);
|
187 |
|
|
electronID->SetApplyD0Cut(kTRUE);
|
188 |
|
|
electronID->SetNExpectedHitsInnerCut(0);
|
189 |
|
|
|
190 |
ceballos |
1.4 |
PhotonIDMod *photonID = new PhotonIDMod;
|
191 |
|
|
TauIDMod *tauID = new TauIDMod;
|
192 |
|
|
JetIDMod *jetID = new JetIDMod;
|
193 |
|
|
jetID->SetInputName(jetCorr->GetOutputName());
|
194 |
ceballos |
1.5 |
jetID->SetPtCut(25.0);
|
195 |
bendavid |
1.1 |
jetID->SetEtaMaxCut(5.0);
|
196 |
ceballos |
1.5 |
jetID->SetJetEEMFractionMinCut(0.0);
|
197 |
ceballos |
1.4 |
jetID->SetOutputName("GoodJets");
|
198 |
|
|
|
199 |
bendavid |
1.1 |
ElectronCleaningMod *electronCleaning = new ElectronCleaningMod;
|
200 |
|
|
PhotonCleaningMod *photonCleaning = new PhotonCleaningMod;
|
201 |
|
|
TauCleaningMod *tauCleaning = new TauCleaningMod;
|
202 |
|
|
JetCleaningMod *jetCleaning = new JetCleaningMod;
|
203 |
ceballos |
1.4 |
jetCleaning->SetGoodJetsName("GoodJets");
|
204 |
|
|
jetCleaning->SetCleanJetsName("CleanJets");
|
205 |
bendavid |
1.1 |
|
206 |
ceballos |
1.7 |
JetIDMod *jetIDNoPtCut = new JetIDMod;
|
207 |
|
|
jetIDNoPtCut->SetInputName(jetCorr->GetOutputName());
|
208 |
|
|
jetIDNoPtCut->SetPtCut(0.0);
|
209 |
|
|
jetIDNoPtCut->SetEtaMaxCut(5.0);
|
210 |
|
|
jetIDNoPtCut->SetJetEEMFractionMinCut(0.0);
|
211 |
|
|
jetIDNoPtCut->SetOutputName("GoodJetsNoPtCut");
|
212 |
|
|
|
213 |
|
|
JetCleaningMod *jetCleaningNoPtCut = new JetCleaningMod;
|
214 |
|
|
jetCleaningNoPtCut->SetGoodJetsName("GoodJetsNoPtCut");
|
215 |
|
|
jetCleaningNoPtCut->SetCleanJetsName("CleanJetsNoPtCut");
|
216 |
|
|
|
217 |
bendavid |
1.1 |
//------------------------------------------------------------------------------------------------
|
218 |
|
|
// merge modules
|
219 |
|
|
//------------------------------------------------------------------------------------------------
|
220 |
|
|
MergeLeptonsMod *mergeLeptonsMod = new MergeLeptonsMod;
|
221 |
|
|
mergeLeptonsMod->SetMuonsName(muonID->GetOutputName());
|
222 |
|
|
mergeLeptonsMod->SetElectronsName(electronCleaning->GetOutputName());
|
223 |
|
|
|
224 |
|
|
//------------------------------------------------------------------------------------------------
|
225 |
|
|
// analyses modules
|
226 |
|
|
//------------------------------------------------------------------------------------------------
|
227 |
ceballos |
1.5 |
HwwExampleAnalysisMod *analysisMod = new HwwExampleAnalysisMod;
|
228 |
|
|
analysisMod->SetMetName(pubMet->GetOutputName());
|
229 |
|
|
analysisMod->SetCleanJetsName(jetCleaning->GetOutputName());
|
230 |
ceballos |
1.7 |
analysisMod->SetCleanJetsNoPtCutName(jetCleaningNoPtCut->GetOutputName());
|
231 |
bendavid |
1.1 |
|
232 |
|
|
//------------------------------------------------------------------------------------------------
|
233 |
|
|
// making analysis chain
|
234 |
|
|
//------------------------------------------------------------------------------------------------
|
235 |
ceballos |
1.5 |
generatorMod->Add(hKFactorProducer);
|
236 |
|
|
hKFactorProducer->Add(runLumiSelectionMod);
|
237 |
|
|
runLumiSelectionMod->Add(goodPVFilterMod);
|
238 |
|
|
goodPVFilterMod->Add(hltmod);
|
239 |
ceballos |
1.4 |
hltmod->Add(muonID);
|
240 |
bendavid |
1.1 |
muonID->Add(electronID);
|
241 |
|
|
electronID->Add(photonID);
|
242 |
|
|
photonID->Add(tauID);
|
243 |
|
|
tauID->Add(pubJet);
|
244 |
bendavid |
1.3 |
pubJet->Add(pubMet);
|
245 |
ceballos |
1.4 |
pubMet->Add(pubCaloMet);
|
246 |
|
|
pubCaloMet->Add(jetCorr);
|
247 |
|
|
jetCorr->Add(metCaloCorr);
|
248 |
|
|
metCaloCorr->Add(jetID);
|
249 |
bendavid |
1.1 |
jetID->Add(electronCleaning);
|
250 |
|
|
electronCleaning->Add(photonCleaning);
|
251 |
|
|
photonCleaning->Add(tauCleaning);
|
252 |
|
|
tauCleaning->Add(jetCleaning);
|
253 |
ceballos |
1.7 |
jetCleaning->Add(jetIDNoPtCut);
|
254 |
|
|
jetIDNoPtCut->Add(jetCleaningNoPtCut);
|
255 |
|
|
jetCleaningNoPtCut->Add(mergeLeptonsMod);
|
256 |
bendavid |
1.1 |
mergeLeptonsMod->Add(analysisMod);
|
257 |
|
|
|
258 |
|
|
//------------------------------------------------------------------------------------------------
|
259 |
|
|
// setup analysis
|
260 |
|
|
//------------------------------------------------------------------------------------------------
|
261 |
|
|
Analysis *ana = new Analysis;
|
262 |
ceballos |
1.4 |
ana->SetUseHLT(kTRUE);
|
263 |
|
|
ana->SetKeepHierarchy(kFALSE);
|
264 |
bendavid |
1.1 |
if (nEvents >= 0)
|
265 |
|
|
ana->SetProcessNEvents(nEvents);
|
266 |
|
|
ana->SetSuperModule(generatorMod);
|
267 |
ceballos |
1.4 |
ana->SetPrintScale(100);
|
268 |
bendavid |
1.1 |
|
269 |
|
|
//------------------------------------------------------------------------------------------------
|
270 |
|
|
// organize input
|
271 |
|
|
//------------------------------------------------------------------------------------------------
|
272 |
|
|
printf("\nRely on Catalog: %s\n",catalogDir);
|
273 |
|
|
printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n\n",book,dataset,skim,fileset);
|
274 |
|
|
Catalog *c = new Catalog(catalogDir);
|
275 |
|
|
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
|
276 |
|
|
Dataset *d = NULL;
|
277 |
|
|
if (TString(skim).CompareTo("noskim") == 0)
|
278 |
|
|
d = c->FindDataset(book,dataset,fileset);
|
279 |
|
|
else
|
280 |
|
|
d = c->FindDataset(book,skimdataset.Data(),fileset);
|
281 |
bendavid |
1.2 |
ana->AddDataset(d);
|
282 |
bendavid |
1.1 |
|
283 |
|
|
//------------------------------------------------------------------------------------------------
|
284 |
|
|
// organize output
|
285 |
|
|
//------------------------------------------------------------------------------------------------
|
286 |
|
|
TString rootFile = TString(outputName);
|
287 |
|
|
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
|
288 |
|
|
if (TString(fileset) != TString(""))
|
289 |
|
|
rootFile += TString("_") + TString(fileset);
|
290 |
|
|
rootFile += TString(".root");
|
291 |
|
|
printf("\nRoot output: %s\n\n",rootFile.Data());
|
292 |
|
|
ana->SetOutputName(rootFile.Data());
|
293 |
ceballos |
1.5 |
ana->SetCacheSize(64*1024*1024);
|
294 |
bendavid |
1.1 |
|
295 |
|
|
//------------------------------------------------------------------------------------------------
|
296 |
|
|
// run the analysis after successful initialisation
|
297 |
|
|
//------------------------------------------------------------------------------------------------
|
298 |
|
|
ana->Run(!gROOT->IsBatch());
|
299 |
|
|
|
300 |
|
|
return;
|
301 |
|
|
}
|