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 |
// $Id: runPhysicsExample.C,v 1.3 2010/05/10 16:17:02 bendavid Exp $
|
4 |
|
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 |
#include "MitAna/PhysicsMod/interface/RunLumiSelectionMod.h"
|
14 |
#include "MitPhysics/Init/interface/ModNames.h"
|
15 |
#include "MitPhysics/Mods/interface/GeneratorMod.h"
|
16 |
#include "MitPhysics/Mods/interface/PDFProducerMod.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 |
#include "MitAna/DataTree/interface/CaloJetCol.h"
|
32 |
#include "MitAna/DataTree/interface/MetCol.h"
|
33 |
#include "MitAna/DataTree/interface/CaloMetCol.h"
|
34 |
#include "MitAna/PhysicsMod/interface/FullExampleMod.h"
|
35 |
#endif
|
36 |
|
37 |
//--------------------------------------------------------------------------------------------------
|
38 |
void runPhysicsExample(const char *catalogDir = "/home/mitprod/catalog",
|
39 |
const char *book = "cern/filler/013",
|
40 |
const char *dataset = "p10-ggwwll-v26",
|
41 |
const char *fileset = "0000",
|
42 |
const char *skim = "noskim",
|
43 |
const char *outputName = "histo",
|
44 |
int sampleID = -1,
|
45 |
int nEvents = 1000)
|
46 |
{
|
47 |
//------------------------------------------------------------------------------------------------
|
48 |
// some global setups
|
49 |
//------------------------------------------------------------------------------------------------
|
50 |
using namespace mithep;
|
51 |
gDebugMask = Debug::kAnalysis;
|
52 |
gDebugLevel = 1;
|
53 |
|
54 |
//------------------------------------------------------------------------------------------------
|
55 |
// set up information
|
56 |
//------------------------------------------------------------------------------------------------
|
57 |
Bool_t useHLTE29 = kFALSE;
|
58 |
Bool_t applyISRFilter = kFALSE;
|
59 |
Bool_t applyMllGenCut = kFALSE;
|
60 |
Bool_t isData = kFALSE;
|
61 |
|
62 |
// RunLumiSelectionMod *runLumiSelectionMod = new RunLumiSelectionMod;
|
63 |
// runLumiSelectionMod->SetAcceptMC(kTRUE);
|
64 |
// runLumiSelectionMod->AddJSONFile("Cert_132440-133511_StreamExpress_Commissioning10-Express_DQM_JSON.txt");
|
65 |
|
66 |
if(sampleID > 1000) isData = kTRUE;
|
67 |
|
68 |
//------------------------------------------------------------------------------------------------
|
69 |
// generator information
|
70 |
//------------------------------------------------------------------------------------------------
|
71 |
GeneratorMod *generatorMod = new GeneratorMod;
|
72 |
generatorMod->SetPrintDebug(kFALSE);
|
73 |
generatorMod->SetPtLeptonMin(0.0);
|
74 |
generatorMod->SetEtaLeptonMax(2.7);
|
75 |
generatorMod->SetPtPhotonMin(15.0);
|
76 |
generatorMod->SetEtaPhotonMax(2.7);
|
77 |
generatorMod->SetPtRadPhotonMin(10.0);
|
78 |
generatorMod->SetEtaRadPhotonMax(2.7);
|
79 |
generatorMod->SetIsData(isData);
|
80 |
generatorMod->SetFillHist(!isData);
|
81 |
if(applyMllGenCut == kTRUE){
|
82 |
generatorMod->SetPdgIdCut(23);
|
83 |
generatorMod->SetMassMaxCut(50.);
|
84 |
}
|
85 |
generatorMod->SetApplyISRFilter(applyISRFilter);
|
86 |
|
87 |
//------------------------------------------------------------------------------------------------
|
88 |
// HLT information
|
89 |
//------------------------------------------------------------------------------------------------
|
90 |
HLTMod *hltmod = new HLTMod;
|
91 |
if(useHLTE29 == false) {
|
92 |
hltmod->AddTrigger("HLT_Ele10_SW_L1R");
|
93 |
hltmod->AddTrigger("HLT_Ele15_SW_LooseTrackIso_L1R");
|
94 |
hltmod->AddTrigger("HLT_Ele15_SW_EleId_L1R");
|
95 |
hltmod->AddTrigger("HLT_Ele15_LW_L1R");
|
96 |
hltmod->AddTrigger("HLT_Ele15_SC10_LW_L1R");
|
97 |
hltmod->AddTrigger("HLT_Ele20_SW_L1R");
|
98 |
hltmod->AddTrigger("HLT_IsoMu9");
|
99 |
hltmod->AddTrigger("HLT_Mu9");
|
100 |
hltmod->AddTrigger("HLT_Ele10_LW_EleId_L1R");
|
101 |
hltmod->AddTrigger("HLT_Ele15_SW_EleId_L1R");
|
102 |
} else {
|
103 |
hltmod->AddTrigger("HLT_Mu9");
|
104 |
hltmod->AddTrigger("HLT_Ele10_LW_EleId_L1R");
|
105 |
hltmod->AddTrigger("HLT_Ele15_SW_EleId_L1R");
|
106 |
hltmod->SetBitsName("HLTBits_E29");
|
107 |
}
|
108 |
hltmod->SetTrigObjsName("myhltobjs");
|
109 |
|
110 |
//------------------------------------------------------------------------------------------------
|
111 |
// publisher Mod
|
112 |
//------------------------------------------------------------------------------------------------
|
113 |
PublisherMod<CaloJet,Jet> *pubJet = new PublisherMod<CaloJet,Jet>("JetPub");
|
114 |
pubJet->SetInputName("AKt5Jets");
|
115 |
pubJet->SetOutputName("PubAKt5Jets");
|
116 |
|
117 |
PublisherMod<Met,Met> *pubMet = new PublisherMod<Met,Met>("MetPub");
|
118 |
pubMet->SetInputName("TCMet");
|
119 |
pubMet->SetOutputName("PubTCMet");
|
120 |
|
121 |
PublisherMod<CaloMet> *pubCaloMet = new PublisherMod<CaloMet>;
|
122 |
pubCaloMet->SetName("CaloMetPub");
|
123 |
pubCaloMet->SetInputName("CorMuonMet");
|
124 |
pubCaloMet->SetOutputName("pubCaloMet");
|
125 |
|
126 |
//------------------------------------------------------------------------------------------------
|
127 |
// Apply Jet Corrections
|
128 |
//------------------------------------------------------------------------------------------------
|
129 |
JetCorrectionMod *jetCorr = new JetCorrectionMod;
|
130 |
jetCorr->AddCorrectionFromRelease("CondFormats/JetMETObjects/data/Summer09_7TeV_ReReco332_L2Relative_AK5Calo.txt");
|
131 |
jetCorr->AddCorrectionFromRelease("CondFormats/JetMETObjects/data/Summer09_7TeV_ReReco332_L3Absolute_AK5Calo.txt");
|
132 |
jetCorr->SetInputName(pubJet->GetOutputName());
|
133 |
jetCorr->SetCorrectedName("CorrectedJets");
|
134 |
|
135 |
//------------------------------------------------------------------------------------------------
|
136 |
// Apply Met Corrections
|
137 |
//------------------------------------------------------------------------------------------------
|
138 |
CaloMetCorrectionMod *metCaloCorr = new CaloMetCorrectionMod;
|
139 |
metCaloCorr->SetInputName(pubCaloMet->GetOutputName());
|
140 |
metCaloCorr->SetCorrectedJetsName(jetCorr->GetOutputName());
|
141 |
metCaloCorr->SetOutputName("pubCaloCorrectedMet");
|
142 |
|
143 |
//------------------------------------------------------------------------------------------------
|
144 |
// object id and cleaning sequence
|
145 |
//------------------------------------------------------------------------------------------------
|
146 |
MuonIDMod *muonID = new MuonIDMod;
|
147 |
ElectronIDMod *electronID = new ElectronIDMod;
|
148 |
PhotonIDMod *photonID = new PhotonIDMod;
|
149 |
TauIDMod *tauID = new TauIDMod;
|
150 |
JetIDMod *jetID = new JetIDMod;
|
151 |
jetID->SetInputName(jetCorr->GetOutputName());
|
152 |
jetID->SetPtCut(20.0);
|
153 |
jetID->SetEtaMaxCut(5.0);
|
154 |
jetID->SetJetEEMFractionMinCut(0.01);
|
155 |
jetID->SetOutputName("GoodJets");
|
156 |
|
157 |
ElectronCleaningMod *electronCleaning = new ElectronCleaningMod;
|
158 |
PhotonCleaningMod *photonCleaning = new PhotonCleaningMod;
|
159 |
TauCleaningMod *tauCleaning = new TauCleaningMod;
|
160 |
JetCleaningMod *jetCleaning = new JetCleaningMod;
|
161 |
jetCleaning->SetGoodJetsName("GoodJets");
|
162 |
jetCleaning->SetCleanJetsName("CleanJets");
|
163 |
|
164 |
//------------------------------------------------------------------------------------------------
|
165 |
// merge modules
|
166 |
//------------------------------------------------------------------------------------------------
|
167 |
MergeLeptonsMod *mergeLeptonsMod = new MergeLeptonsMod;
|
168 |
mergeLeptonsMod->SetMuonsName(muonID->GetOutputName());
|
169 |
mergeLeptonsMod->SetElectronsName(electronCleaning->GetOutputName());
|
170 |
|
171 |
//------------------------------------------------------------------------------------------------
|
172 |
// analyses modules
|
173 |
//------------------------------------------------------------------------------------------------
|
174 |
FullExampleMod *analysisMod = new FullExampleMod;
|
175 |
analysisMod->SetMuonName(muonID->GetOutputName());
|
176 |
analysisMod->SetMuonsFromBranch(kFALSE);
|
177 |
analysisMod->SetElectronName(electronID->GetOutputName());
|
178 |
analysisMod->SetElectronsFromBranch(kFALSE);
|
179 |
|
180 |
//------------------------------------------------------------------------------------------------
|
181 |
// making analysis chain
|
182 |
//------------------------------------------------------------------------------------------------
|
183 |
generatorMod->Add(hltmod);
|
184 |
hltmod->Add(muonID);
|
185 |
muonID->Add(electronID);
|
186 |
electronID->Add(photonID);
|
187 |
photonID->Add(tauID);
|
188 |
tauID->Add(pubJet);
|
189 |
pubJet->Add(pubMet);
|
190 |
pubMet->Add(pubCaloMet);
|
191 |
pubCaloMet->Add(jetCorr);
|
192 |
jetCorr->Add(metCaloCorr);
|
193 |
metCaloCorr->Add(jetID);
|
194 |
jetID->Add(electronCleaning);
|
195 |
electronCleaning->Add(photonCleaning);
|
196 |
photonCleaning->Add(tauCleaning);
|
197 |
tauCleaning->Add(jetCleaning);
|
198 |
jetCleaning->Add(mergeLeptonsMod);
|
199 |
mergeLeptonsMod->Add(analysisMod);
|
200 |
|
201 |
//------------------------------------------------------------------------------------------------
|
202 |
// setup analysis
|
203 |
//------------------------------------------------------------------------------------------------
|
204 |
Analysis *ana = new Analysis;
|
205 |
ana->SetUseHLT(kTRUE);
|
206 |
ana->SetKeepHierarchy(kFALSE);
|
207 |
if (nEvents >= 0)
|
208 |
ana->SetProcessNEvents(nEvents);
|
209 |
ana->SetSuperModule(generatorMod);
|
210 |
ana->SetPrintScale(100);
|
211 |
if(useHLTE29 == true){
|
212 |
ana->SetHLTTreeName("HLT_E29");
|
213 |
ana->SetHLTObjsName("HLTObjects_E29");
|
214 |
}
|
215 |
|
216 |
//------------------------------------------------------------------------------------------------
|
217 |
// organize input
|
218 |
//------------------------------------------------------------------------------------------------
|
219 |
printf("\nRely on Catalog: %s\n",catalogDir);
|
220 |
printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n\n",book,dataset,skim,fileset);
|
221 |
Catalog *c = new Catalog(catalogDir);
|
222 |
TString skimdataset = TString(dataset)+TString("/") +TString(skim);
|
223 |
Dataset *d = NULL;
|
224 |
if (TString(skim).CompareTo("noskim") == 0)
|
225 |
d = c->FindDataset(book,dataset,fileset);
|
226 |
else
|
227 |
d = c->FindDataset(book,skimdataset.Data(),fileset);
|
228 |
ana->AddDataset(d);
|
229 |
//ana->AddFile("root://castorcms//castor/cern.ch/user/p/paus/filler/011/s09-ttbar-7-mc3/*.root");
|
230 |
//ana->AddFile("/build/bendavid/XX-MITDATASET-XX_000-valskim-Run132605.root");
|
231 |
|
232 |
//------------------------------------------------------------------------------------------------
|
233 |
// organize output
|
234 |
//------------------------------------------------------------------------------------------------
|
235 |
TString rootFile = TString(outputName);
|
236 |
rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim);
|
237 |
if (TString(fileset) != TString(""))
|
238 |
rootFile += TString("_") + TString(fileset);
|
239 |
rootFile += TString(".root");
|
240 |
printf("\nRoot output: %s\n\n",rootFile.Data());
|
241 |
ana->SetOutputName(rootFile.Data());
|
242 |
|
243 |
ana->SetCacheSize(64*1024*1024);
|
244 |
//------------------------------------------------------------------------------------------------
|
245 |
// run the analysis after successful initialisation
|
246 |
//------------------------------------------------------------------------------------------------
|
247 |
ana->Run(!gROOT->IsBatch());
|
248 |
|
249 |
return;
|
250 |
}
|