ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitEwk/macros/runEwkExample.C
Revision: 1.17
Committed: Tue Jun 16 11:27:20 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009c
Changes since 1.16: +2 -8 lines
Log Message:
Int work

File Contents

# User Rev Content
1 loizides 1.17 // $Id: runEwkExample.C,v 1.16 2009/06/16 10:45:53 loizides Exp $
2 loizides 1.1
3     #if !defined(__CINT__) || defined(__MAKECINT__)
4     #include <TROOT.h>
5     #include <TSystem.h>
6     #include "MitAna/DataUtil/interface/Debug.h"
7     #include "MitAna/Utils/interface/SimpleTable.h"
8     #include "MitAna/TreeMod/interface/Analysis.h"
9     #include "MitAna/TreeMod/interface/HLTMod.h"
10 loizides 1.7 #include "MitAna/PhysicsMod/interface/FilterMod.h"
11 loizides 1.1 #include "MitAna/PhysicsMod/interface/PlotKineMod.h"
12     #include "MitAna/PhysicsMod/interface/PublisherMod.h"
13 loizides 1.6 #include "MitAna/PhysicsMod/interface/HLTExampleMod.h"
14 loizides 1.1 #include "MitPhysics/Init/interface/ModNames.h"
15     #include "MitPhysics/SelMods/interface/GenericSelMod.h"
16     #include "MitPhysics/Mods/interface/ElectronIDMod.h"
17     #include "MitPhysics/Mods/interface/ElectronCleaningMod.h"
18     #include "MitPhysics/Mods/interface/GeneratorMod.h"
19     #include "MitPhysics/Mods/interface/JetCleaningMod.h"
20     #include "MitPhysics/Mods/interface/JetIDMod.h"
21     #include "MitPhysics/Mods/interface/MergeLeptonsMod.h"
22     #include "MitPhysics/Mods/interface/MuonIDMod.h"
23     #include "MitEwk/GenMods/interface/ZGenMod.h"
24 loizides 1.9 #include "MitEwk/GenMods/interface/ZmmAccMod.h"
25 loizides 1.1 #include "MitEwk/ZAnaMods/interface/ZmmCandAnaMod.h"
26 loizides 1.13 #include "MitEwk/ZAnaMods/interface/ZmmSelMod.h"
27 loizides 1.7 #include "MitEwk/ZAnaMods/interface/ZmmTagAndProbeMod.h"
28     #include "MitEwk/ZAnaMods/interface/ZxxTagAndProbeMod.h"
29 loizides 1.1 #endif
30    
31 loizides 1.15 using namespace mithep;
32    
33     //--------------------------------------------------------------------------------------------------
34     ZmmAccMod *CreateZmmAccMod(Double_t emin, Double_t emax, Double_t ptmin,
35     Double_t minz, Double_t maxz, const char *pref="ZmmAccMod")
36     {
37     ZmmAccMod *mod = new ZmmAccMod(Form("%s%.0fto%0.fGeV",pref,minz,maxz));
38     mod->SetMinMuEta(emin);
39     mod->SetMaxMuEta(emax);
40     mod->SetMinMuPt(ptmin);
41     mod->SetMinMass(minz);
42     mod->SetMaxMass(maxz);
43     return mod;
44     }
45    
46 loizides 1.1 //--------------------------------------------------------------------------------------------------
47 loizides 1.15
48    
49 loizides 1.1 void runEwkExample(Bool_t mcomp = 1,
50     const char *files = 0,
51     UInt_t nev = 0)
52     {
53     gDebugMask = Debug::kAnalysis;
54     gDebugLevel = 1;
55     gErrorIgnoreLevel = kInfo;
56    
57 loizides 1.10 const Double_t ptMin = 15;
58     const Double_t etaMin = -2;
59     const Double_t etaMax = +2;
60     const Double_t minCandM = 40;
61     const Double_t maxCandM = 200;
62 loizides 1.15 const Double_t minZM = 65;
63     const Double_t maxZM = 115;
64 loizides 1.10
65 loizides 1.9 const char *muInput = Names::gkMuonBrn;
66 loizides 1.3
67 loizides 1.1 // setup analysis object
68     Analysis *ana = new Analysis;
69 loizides 1.3 ana->SetUseHLT(1);
70 loizides 1.1 if (nev>0)
71     ana->SetProcessNEvents(nev);
72     TString ofname(gSystem->Getenv("MIT_OUTPUTFILE"));
73     if (ofname.IsNull())
74 loizides 1.2 ana->SetOutputName("ewk-hists.root");
75 loizides 1.1 else
76     ana->SetOutputName(ofname);
77    
78     if (files)
79     ana->AddFile(files);
80    
81     // setup modules
82 loizides 1.3 if (mcomp) {
83     GeneratorMod *genMod = new GeneratorMod;
84     genMod->SetFillHist(1);
85 loizides 1.9 genMod->SetPdgIdCut(23);
86 loizides 1.3 ana->AddSuperModule(genMod);
87    
88     ZGenMod *zgMod = new ZGenMod;
89 loizides 1.9 zgMod->SetMinMuEta(etaMin);
90     zgMod->SetMaxMuEta(etaMax);
91     zgMod->SetMinMuPt(ptMin);
92 loizides 1.15 zgMod->SetMinMass(minCandM);
93     zgMod->SetMaxMass(maxCandM);
94 loizides 1.3 genMod->Add(zgMod);
95     }
96    
97 loizides 1.7 HLTMod *hltmod = new HLTMod;
98     hltmod->SetPrintTable(kFALSE);
99     hltmod->AddTrigger("HLT_IsoMu15");
100     hltmod->SetTrigObjsName("HltIsoMu15");
101     ana->AddSuperModule(hltmod);
102 loizides 1.5
103 loizides 1.12 FilterMod<Muon> *filMuons = new FilterMod<Muon>("FilterMuons");
104     filMuons->SetInputName(muInput);
105     filMuons->SetOutputName("FilteredMuons");
106     filMuons->SetEtaMin(etaMin);
107     filMuons->SetEtaMax(etaMax);
108     filMuons->SetPtMin(ptMin);
109 loizides 1.16 filMuons->SetEntriesMax(25);
110 loizides 1.12 hltmod->Add(filMuons);
111    
112     MuonIDMod *amuCl = new MuonIDMod("AllIsoMuons");
113     amuCl->SetInputName(filMuons->GetOutputName());
114     amuCl->AddEventObject(filMuons->GetOutputName(),kFALSE);
115     amuCl->SetOutputName("AllIsoMuons");
116     amuCl->SetPtMin(ptMin);
117     amuCl->SetClassType("All");
118     amuCl->SetIDType("Loose");
119     amuCl->SetIsoType("TrackCaloCombined");
120     amuCl->SetCombIsoCut(3);
121     amuCl->SetD0Cut(0.05);
122     filMuons->Add(amuCl);
123 loizides 1.10
124 loizides 1.8 MuonIDMod *gmuCl = new MuonIDMod("GlobalIsoMuons");
125 loizides 1.12 gmuCl->SetInputName(amuCl->GetOutputName());
126     gmuCl->AddEventObject(amuCl->GetOutputName(),kFALSE);
127 loizides 1.8 gmuCl->SetOutputName("GlobalIsoMuons");
128     gmuCl->SetPtMin(ptMin);
129     gmuCl->SetClassType("Global");
130     gmuCl->SetIDType("Loose");
131     gmuCl->SetIsoType("TrackCaloCombined");
132     gmuCl->SetCombIsoCut(3);
133     gmuCl->SetD0Cut(0.05);
134 loizides 1.14 amuCl->Add(gmuCl);
135 loizides 1.8
136     MuonIDMod *gmuClNonIso = new MuonIDMod("GlobalMuons");
137 loizides 1.12 gmuClNonIso->SetInputName(filMuons->GetOutputName());
138     gmuClNonIso->AddEventObject(filMuons->GetOutputName(),kFALSE);
139 loizides 1.8 gmuClNonIso->SetOutputName("GlobalMuons");
140     gmuClNonIso->SetPtMin(ptMin);
141     gmuClNonIso->SetClassType("Global");
142     gmuClNonIso->SetIDType("Loose");
143     gmuClNonIso->SetIsoType("NoIso");
144     gmuClNonIso->SetD0Cut(0.05);
145 loizides 1.12 filMuons->Add(gmuClNonIso);
146    
147 loizides 1.14 ZmmSelMod *preselMod = new ZmmSelMod("ZmmPreSelMod");
148     preselMod->SetMuonsName(amuCl->GetOutputName());
149     preselMod->SetTrigsName(hltmod->GetTrigObjsName());
150     preselMod->SetMinMass(minCandM);
151     preselMod->SetMaxMass(maxCandM);
152     hltmod->Add(preselMod);
153    
154     ZmmCandAnaMod *zmmCandMod = new ZmmCandAnaMod("ZmmCandLoose");
155     zmmCandMod->SetMuonsName(amuCl->GetOutputName());
156     zmmCandMod->SetTrigsName(hltmod->GetTrigObjsName());
157     zmmCandMod->SetMinMass(minCandM);
158     zmmCandMod->SetMaxMass(maxCandM);
159 loizides 1.15 zmmCandMod->SetZCandName("ZLoose");
160 loizides 1.14 preselMod->Add(zmmCandMod);
161    
162     ZmmCandAnaMod *zmmCandMod2 = new ZmmCandAnaMod("ZmmCandTight");
163     zmmCandMod2->SetMuonsName(amuCl->GetOutputName());
164     zmmCandMod2->SetTrigsName(hltmod->GetTrigObjsName());
165     zmmCandMod2->SetMinMass(minZM);
166     zmmCandMod2->SetMaxMass(maxZM);
167 loizides 1.15 zmmCandMod2->SetZCandName("ZTight");
168 loizides 1.14 preselMod->Add(zmmCandMod2);
169 loizides 1.12
170 loizides 1.17
171 loizides 1.13 if (mcomp) {
172 loizides 1.15 ZmmAccMod *zm1 = CreateZmmAccMod(etaMin,etaMax,ptMin,minCandM,maxCandM);
173     zm1->SetRecoName(zmmCandMod->GetZCandName());
174     zmmCandMod->Add(zm1);
175     ZmmAccMod *zm2 = CreateZmmAccMod(etaMin,etaMax,ptMin,minZM,maxZM);
176     zm2->SetRecoName(zmmCandMod2->GetZCandName());
177     zmmCandMod2->Add(zm2);
178     for (Double_t m=minCandM+10;m<120;m+=10) {
179     ZmmAccMod *zm = CreateZmmAccMod(etaMin,etaMax,ptMin,m,maxCandM);
180     zm->SetRecoName(zmmCandMod->GetZCandName());
181     zmmCandMod->Add(zm);
182     }
183 loizides 1.13 }
184    
185 loizides 1.12 // run the analysis after successful initialisation
186     ana->Run(!gROOT->IsBatch());
187     }
188    
189    
190     #if 0
191 loizides 1.11
192 loizides 1.7 ZmmTagAndProbeMod *zmmTPMod = new ZmmTagAndProbeMod("ZmmTP");
193 loizides 1.8 zmmTPMod->SetMuonsName(amuCl->GetOutputName());
194 loizides 1.7 zmmTPMod->SetTrigsName(hltmod->GetTrigObjsName());
195 loizides 1.10 zmmTPMod->SetMinMatch(minZM);
196     zmmTPMod->SetMaxMatch(maxZM);
197 loizides 1.8 zmmCandMod->Add(zmmTPMod);
198 loizides 1.7
199 loizides 1.10 ZmmCandAnaMod *zmmCandMod2 = new ZmmCandAnaMod("ZmmSel");
200     zmmCandMod2->SetMuonsName(amuCl->GetOutputName());
201     zmmCandMod2->SetTrigsName(hltmod->GetTrigObjsName());
202     zmmCandMod2->SetMinMass(minZM);
203     zmmCandMod2->SetMaxMass(maxZM);
204     zmmCandMod->Add(zmmCandMod2);
205 loizides 1.12 #endif