ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/FakeMods/src/FakeLeptonExampleAnaMod.cc
Revision: 1.6
Committed: Tue Aug 11 11:19:40 2009 UTC (15 years, 8 months ago) by phedex
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_029c, Mit_029b, Mit_029a, Mit_028a, Mit_028, Mit_027, Mit_027a, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012, Mit_011a, Mit_011, Mit_010a, HEAD
Changes since 1.5: +64 -64 lines
Log Message:
style corrections

File Contents

# Content
1 // $Id: FakeLeptonExampleAnaMod.cc,v 1.5 2009/08/11 09:16:01 loizides Exp $
2
3 #include "MitPhysics/FakeMods/interface/FakeLeptonExampleAnaMod.h"
4 #include "MitCommon/MathTools/interface/MathUtils.h"
5 #include "MitAna/DataUtil/interface/Debug.h"
6 #include "MitAna/DataTree/interface/Names.h"
7 #include "MitAna/DataTree/interface/ElectronCol.h"
8 #include "MitAna/DataTree/interface/GenJetCol.h"
9 #include "MitAna/DataTree/interface/MCParticleCol.h"
10 #include "MitAna/DataTree/interface/MetCol.h"
11 #include "MitAna/DataTree/interface/MuonCol.h"
12 #include "MitAna/DataTree/interface/TrackCol.h"
13 #include "MitPhysics/Init/interface/ModNames.h"
14 #include "MitPhysics/FakeMods/interface/FakeObject.h"
15 #include "MitPhysics/FakeMods/interface/FakeEventHeader.h"
16 #include <TH1D.h>
17 #include <TH2D.h>
18
19 using namespace mithep;
20
21 ClassImp(mithep::FakeLeptonExampleAnaMod)
22
23 //--------------------------------------------------------------------------------------------------
24 FakeLeptonExampleAnaMod::FakeLeptonExampleAnaMod(const char *name, const char *title) :
25 BaseMod(name,title),
26 fUseMCFake(kFALSE),
27 fPerformFakeMuonMetCorrection(kTRUE),
28 fSampleName("NotSet"),
29 fFakeEventHeaderName(ModNames::gkFakeEventHeadersName),
30 fElectronFakeableObjectsName(ModNames::gkElFakeableObjsName),
31 fMuonFakeableObjectsName(ModNames::gkMuFakeableObjsName),
32 fMCPartBranchName(Names::gkMCPartBrn),
33 fGenJetBranchName(Names::gkSC5GenJetBrn),
34 fTrackBranchName(Names::gkTrackBrn),
35 fMuonBranchName(Names::gkMuonBrn),
36 fMetName("NotSet"),
37 fCleanJetsName(ModNames::gkCleanJetsName),
38 fTriggerObjectsName("NotSet"),
39 fParticles(0),
40 fGenJets(0),
41 fTracks(0),
42 fMuons(0),
43 fMet(0)
44 {
45 // Constructor.
46 }
47
48 //--------------------------------------------------------------------------------------------------
49 void FakeLeptonExampleAnaMod::Process()
50 {
51 // Process entries of the tree.
52 LoadBranch(fTrackBranchName);
53 LoadBranch(fMuonBranchName);
54
55 //***********************************************************************************************
56 //Import Collections
57 //***********************************************************************************************
58
59 //Obtain all cleaned objects
60 MuonOArr *CleanMuons = dynamic_cast<MuonOArr* >
61 (FindObjThisEvt(ModNames::gkCleanMuonsName));
62 ParticleOArr *CleanLeptons = dynamic_cast<mithep::ParticleOArr*>
63 (FindObjThisEvt(ModNames::gkMergedLeptonsName));
64
65 //Get Met
66 if (!fMetName.IsNull()) {
67 fMet = GetObjThisEvt<MetCol>(fMetName);
68 }
69 const Met *originalCaloMet = 0;
70 if (fMet) {
71 originalCaloMet = fMet->At(0);
72 } else {
73 cout << "Error: Met Collection " << fMetName << " could not be loaded.\n";
74 }
75 ObjArray<Jet> *OriginalCleanJets = dynamic_cast<ObjArray<Jet>* >
76 (FindObjThisEvt(fCleanJetsName.Data()));
77
78 //Obtain the collection of fake objects
79 ElectronCol *ElectronFakeableObjects = 0;
80 if(!fElectronFakeableObjectsName.IsNull())
81 ElectronFakeableObjects = dynamic_cast<ElectronCol* >
82 (FindObjThisEvt(fElectronFakeableObjectsName.Data()));
83 MuonCol *MuonFakeableObjects = 0;
84 if (!fMuonFakeableObjectsName.IsNull())
85 MuonFakeableObjects = dynamic_cast<MuonCol* >
86 (FindObjThisEvt(fMuonFakeableObjectsName.Data()));
87 ChargedParticleOArr *FakeableObjects = new ChargedParticleOArr;
88 if (ElectronFakeableObjects) {
89 for (UInt_t i=0; i<ElectronFakeableObjects->GetEntries(); i++)
90 FakeableObjects->Add(ElectronFakeableObjects->At(i));
91 }
92 if (MuonFakeableObjects) {
93 for (UInt_t i=0; i<MuonFakeableObjects->GetEntries(); i++)
94 FakeableObjects->Add(MuonFakeableObjects->At(i));
95 }
96 Collection<FakeEventHeader> *FakeEventHeaders = 0;
97 if (!fUseMCFake) {
98 if (!fFakeEventHeaderName.IsNull()) {
99 FakeEventHeaders =
100 dynamic_cast<Collection<FakeEventHeader>* >(FindObjThisEvt(fFakeEventHeaderName.Data()));
101 if (!FakeEventHeaders) {
102 string errorMsg = "Error: FakeEventHeader with name " +
103 string(fFakeEventHeaderName.Data()) + "could not be loaded.\n";
104 Fatal("Process()",errorMsg.c_str());
105 }
106 } else
107 cout << "Error: FakeEventHeaders " << fFakeEventHeaderName.Data()
108 << " could not be loaded.\n";
109 }
110
111 //***********************************************************************************************
112 //If we use MC Fakes, then create a new FakeEventHeader containing no fakes with weight = 1
113 //This ensures that in the loop over FakeEventHeaders we do the correct thing.
114 //***********************************************************************************************
115 if (fUseMCFake) {
116 ObjArray <FakeEventHeader> *tmpFakeEventHeaders = new ObjArray <FakeEventHeader> ;
117 tmpFakeEventHeaders->SetOwner(kTRUE);
118
119 FakeEventHeader *initialFakeEvent = new FakeEventHeader();
120 for (UInt_t j=0;j<OriginalCleanJets->GetEntries();j++)
121 initialFakeEvent->AddJets(OriginalCleanJets->At(j));
122
123 tmpFakeEventHeaders->AddOwned(initialFakeEvent);
124 FakeEventHeaders = dynamic_cast<Collection<FakeEventHeader>* > (tmpFakeEventHeaders);
125 }
126
127 //***********************************************************************************************
128 //Loop over Fake Event Headers
129 //***********************************************************************************************
130 for (UInt_t i=0;i<FakeEventHeaders->GetEntries() ; i++) {
131
132 //Create leptons collection containing real leptons and fake leptons
133 ObjArray<Particle> *leptons = NULL;
134 if (fUseMCFake) {
135 leptons = CleanLeptons;
136 } else {
137 leptons = new ObjArray<Particle>;
138
139 for (UInt_t j=0;j<CleanLeptons->GetEntries() ; j++) {
140 leptons->Add(CleanLeptons->At(j));
141 }
142 for (UInt_t j=0;j<FakeEventHeaders->At(i)->FakeObjsSize() ; j++) {
143 leptons->Add(FakeEventHeaders->At(i)->FakeObj(j)->FakeParticle());
144 }
145 }
146 //we have to sort leptons
147 leptons->Sort();
148
149
150 //Construct the Clean Jet collection.
151 ObjArray<Jet> *CleanJets = NULL;
152 if (fUseMCFake) {
153 CleanJets = OriginalCleanJets;
154 } else {
155 CleanJets = new ObjArray<Jet>;
156 for (UInt_t j=0;j<FakeEventHeaders->At(i)->NJets() ; j++) {
157 CleanJets->Add(FakeEventHeaders->At(i)->UnfakedJet(j));
158 }
159 }
160
161 //Perform correction for potential fake muons
162 //have to add fake muon momentum to originalCaloMet;
163 const Met *caloMet = originalCaloMet;
164 Double_t FakeMuonMetCorrection_X = 0.0;
165 Double_t FakeMuonMetCorrection_Y = 0.0;
166 for (UInt_t j=0;j<FakeEventHeaders->At(i)->FakeObjsSize() ; j++) {
167 if (FakeEventHeaders->At(i)->FakeObj(j)->ObjType() == kMuon) {
168 FakeMuonMetCorrection_X += FakeEventHeaders->At(i)->FakeObj(j)->Px();
169 FakeMuonMetCorrection_Y += FakeEventHeaders->At(i)->FakeObj(j)->Py();
170 }
171 }
172
173 if (!fUseMCFake && fPerformFakeMuonMetCorrection) {
174 caloMet = new Met(originalCaloMet->Px()+FakeMuonMetCorrection_X,
175 originalCaloMet->Py()+FakeMuonMetCorrection_Y);
176 }
177
178 //*********************************************************************************************
179 //Construct the event weight using fake rate and corrections
180 //*********************************************************************************************
181 //fake rate has to be corrected by the amount lost when those denominators
182 //became fakes in data. If a denominator fakes a lepton in data, it goes in the 2lepton
183 //final state, and we don't count it in this prediction. So we have to add it back.
184 Double_t eventweight = FakeEventHeaders->At(i)->Weight();
185 if (FakeEventHeaders->At(i)->FakeObjsSize() > 0 && FakeEventHeaders->At(i)->Weight() < 1) {
186 eventweight = eventweight / (1.0 - FakeEventHeaders->At(i)->Weight());
187 }
188
189 //*********************************************************************************************
190 //another correction to account for events lost due to only the fake lepton firing the trigger
191 //The numbers need to be changed for your analysis.
192 //Given numbers are for the 2 lepton final state.
193 //*********************************************************************************************
194 if (CleanLeptons->GetEntries() >= 1 && FakeEventHeaders->At(i)->FakeObjsSize() >= 1) {
195 if (CleanLeptons->At(0)->ObjType() == kElectron &&
196 FakeEventHeaders->At(i)->FakeObj(0)->FakeParticle()->ObjType() == kElectron) {
197 eventweight = eventweight * 1.06;
198 } else if (CleanLeptons->At(0)->ObjType() == kMuon &&
199 FakeEventHeaders->At(i)->FakeObj(0)->FakeParticle()->ObjType() == kMuon) {
200 eventweight = eventweight * 1.12;
201 } else if (CleanLeptons->At(0)->ObjType() == kElectron &&
202 FakeEventHeaders->At(i)->FakeObj(0)->FakeParticle()->ObjType() == kMuon) {
203 eventweight = eventweight * 1.17;
204 } else if (CleanLeptons->At(0)->ObjType() == kMuon &&
205 FakeEventHeaders->At(i)->FakeObj(0)->FakeParticle()->ObjType() == kElectron) {
206 eventweight = eventweight * 1.17;
207 }
208 }
209
210 //*********************************************************************************************
211 //For FR method (fUseMCFake == kFALSE)
212 //Make analysis specific cuts.
213 //For example for 2 lepton final state we require that the event contains
214 //one and only one clean lepton with pt > 10 GeV.
215 //*********************************************************************************************
216 if (!fUseMCFake) {
217 if (CleanLeptons->GetEntries() != 1 || CleanLeptons->At(0)->Pt() <= 10.0)
218 continue;
219 }
220
221 //*********************************************************************************************
222 //Fill some distributions before preselection
223 //*********************************************************************************************
224
225 CompositeParticle *dilepton = NULL;
226
227 if (leptons->GetEntries()>=2) {
228
229 dilepton = new CompositeParticle();
230 dilepton->AddDaughter(leptons->At(0));
231 dilepton->AddDaughter(leptons->At(1));
232
233 //Dilepton Charge will be filled like this
234 // -2: -- , -1: -+, 1: +-, 2:++
235 if (dilepton->Charge() == 0) {
236 if (leptons->At(0)->Charge() == 1) {
237 fDileptonCharge->Fill(1.0,eventweight);
238 } else {
239 fDileptonCharge->Fill(-1.0,eventweight);
240 }
241 } else {
242 fDileptonCharge->Fill(dilepton->Charge(),eventweight);
243 }
244 }
245
246 //*********************************************************************************************
247 //Kinematic PreSelection
248 //Example given is for the two lepton final state
249 //*********************************************************************************************
250 //make sure 2nd highest pt lepton has Pt > 10
251 if (leptons->GetEntries() < 2 || leptons->At(1)->Pt() <= 10) continue;
252
253 //make sure the 3rd highest pt lepton has pt <= 10.
254 if (leptons->GetEntries() >= 3 && leptons->At(2)->Pt() > 10) continue;
255
256 //charge of the leptons should be opposite
257 if (dilepton->Charge() != 0) continue;
258
259 //*********************************************************************************************
260 //Get nonisolated soft muons
261 //*********************************************************************************************
262 ObjArray<Muon> *DirtyMuons = new ObjArray<Muon>;
263 for (UInt_t m=0; m<fMuons->GetEntries(); ++m) {
264 const Muon *mu = fMuons->At(m);
265 if(!mu->GlobalTrk()) continue;
266 if(mu->Pt() < 5.0) continue;
267
268 //remove the fake
269 Bool_t isFakedMuon = kFALSE;
270 for (UInt_t f=0;f<FakeEventHeaders->At(i)->FakeObjsSize() ; f++) {
271 if (mu->HasTrackerTrk() &&
272 (dynamic_cast<const mithep::ChargedParticle*>
273 (FakeEventHeaders->At(i)->FakeObj(f)->FakeParticle()))->TrackerTrk() &&
274 (dynamic_cast<const mithep::ChargedParticle*>
275 (FakeEventHeaders->At(i)->FakeObj(f)->FakeParticle()))->TrackerTrk() ==
276 mu->TrackerTrk()
277 )
278 isFakedMuon = kTRUE;
279 }
280
281 //remove clean muons
282 Bool_t isCleanMuon = kFALSE;
283 for (UInt_t j=0; j<CleanMuons->GetEntries(); j++) {
284 if(fMuons->At(m) == CleanMuons->At(j)) isCleanMuon = kTRUE;
285 }
286
287 if(!isCleanMuon
288 && !(isFakedMuon && !fUseMCFake)
289 ) DirtyMuons->Add(mu);
290 }
291
292 //*********************************************************************************************
293 //Get Clean Tracks excluding the good leptons
294 //*********************************************************************************************
295 ObjArray<Track> *CleanExtraTracks = new ObjArray<Track>;
296 Int_t nTracks = 0;
297
298 Double_t z0Average = ( (dynamic_cast<const mithep::ChargedParticle*>(leptons->At(0)))->Trk()->Z0()
299 + (dynamic_cast<const mithep::ChargedParticle*>(leptons->At(1)))->Trk()->Z0()) /2 ;
300
301 for (UInt_t t=0; t<fTracks->GetEntries(); ++t) {
302 Bool_t isLepton = kFALSE;
303
304 if (MathUtils::DeltaR(fTracks->At(t)->Phi(),fTracks->At(t)->Eta(),leptons->At(0)->Phi(),
305 leptons->At(0)->Eta()) > 0.01 &&
306 MathUtils::DeltaR(fTracks->At(t)->Phi(),fTracks->At(t)->Eta(),leptons->At(1)->Phi(),
307 leptons->At(1)->Eta()) > 0.01
308 ) {
309 } else {
310 isLepton = kTRUE;
311 }
312
313 MDB(kAnalysis, 8) {
314 cout << "Track " << t << " : " << fTracks->At(t)->Pt() << " " << fTracks->At(t)->Eta()
315 << " " << fTracks->At(t)->Phi() << " islepton=" << isLepton << endl;
316 }
317
318 if ( !isLepton && fTracks->At(t)->Pt() > 3.0
319 && fTracks->At(t)->NHits() >= 8
320 && fabs(z0Average - fTracks->At(t)->Z0()) < 0.5 ) {
321 CleanExtraTracks->Add(fTracks->At(t));
322 nTracks++;
323 }
324 }
325
326 //*********************************************************************************************
327 //The code below is an example analysis for the HWW analysis.
328 //*********************************************************************************************
329
330
331 //*********************************************************************************************
332 //Define Event Variables
333 //*********************************************************************************************
334 //delta phi between the 2 leptons in degrees
335 Double_t deltaPhiLeptons = MathUtils::DeltaPhi(leptons->At(0)->Phi(),
336 leptons->At(1)->Phi())* 360.0 / 2 / TMath::Pi();
337
338 Double_t deltaEtaLeptons = leptons->At(0)->Eta() - leptons->At(1)->Eta();
339
340 Double_t deltaPhiDileptonMet = MathUtils::DeltaPhi(caloMet->Phi(),
341 dilepton->Phi())*360.0 / 2 / TMath::Pi();
342
343 Double_t mtHiggs = TMath::Sqrt(2.0*dilepton->Pt() * caloMet->Pt()*
344 (1.0 - cos(deltaPhiDileptonMet * 2 * TMath::Pi() / 360.0)));
345
346 //angle between MET and closest lepton
347 Double_t deltaPhiMetLepton[2] = {MathUtils::DeltaPhi(caloMet->Phi(), leptons->At(0)->Phi()),
348 MathUtils::DeltaPhi(caloMet->Phi(), leptons->At(1)->Phi())};
349
350 Double_t mTW[2] = {TMath::Sqrt(2.0*leptons->At(0)->Pt()*caloMet->Pt()*
351 (1.0 - cos(deltaPhiMetLepton[0]))),
352 TMath::Sqrt(2.0*leptons->At(1)->Pt()*caloMet->Pt()*
353 (1.0 - cos(deltaPhiMetLepton[1])))};
354
355 Double_t minDeltaPhiMetLepton = (deltaPhiMetLepton[0] < deltaPhiMetLepton[1])?
356 deltaPhiMetLepton[0]:deltaPhiMetLepton[1];
357 minDeltaPhiMetLepton = minDeltaPhiMetLepton * 360.0 / 2 / TMath::Pi();
358
359 //count the number of central Jets for vetoing
360 Int_t nCentralJets = 0;
361 for (UInt_t j=0; j<CleanJets->GetEntries(); j++) {
362 if (fabs(CleanJets->At(j)->Eta()) < 2.5)
363 nCentralJets++;
364 }
365
366 //Lepton Type
367 Int_t finalstateType = -1;
368 if (leptons->At(0)->ObjType() == kMuon &&
369 leptons->At(1)->ObjType() == kMuon ){ // mumu
370 finalstateType = 10;
371 } else if(leptons->At(0)->ObjType() == kElectron &&
372 leptons->At(1)->ObjType() == kElectron ){ // ee
373 finalstateType = 11;
374 } else if((leptons->At(0)->ObjType() == kElectron && leptons->At(1)->ObjType() == kMuon) ||
375 (leptons->At(0)->ObjType() == kMuon && leptons->At(1)->ObjType() == kElectron)) {
376 finalstateType = 12;
377 } else {
378 cerr << "Error: finalstate lepton type not supported\n";
379 }
380
381 //*********************************************************************************************
382 //Define Cuts
383 //*********************************************************************************************
384 const Int_t nCuts = 9;
385 Bool_t passCut[nCuts] = {kFALSE, kFALSE, kFALSE, kFALSE,
386 kFALSE, kFALSE, kFALSE, kFALSE, kFALSE};
387
388 if(leptons->At(0)->Pt() > 20.0 &&
389 leptons->At(1)->Pt() > 10.0 &&
390 caloMet->Pt() > 30.0 &&
391 dilepton->Mass() > 12.0
392 ) passCut[0] = kTRUE;
393 //above cuts are for preselction to be fed into TMVA
394
395 if(nCentralJets < 1) passCut[1] = kTRUE;
396
397 if (finalstateType == 10){ // mumu
398 if(caloMet->Pt() > 50.0 &&
399 caloMet->Pt() < 200.0) passCut[2] = kTRUE;
400 if(deltaPhiLeptons < 45.0) passCut[3] = kTRUE;
401 if(dilepton->Mass() < 50.0) passCut[4] = kTRUE;
402 if(leptons->At(0)->Pt() > 35.0 &&
403 leptons->At(0)->Pt() < 55.0) passCut[5] = kTRUE;
404 if(leptons->At(1)->Pt() > 25.0) passCut[6] = kTRUE;
405 }
406 else if(finalstateType == 11 ){ // ee
407 if(caloMet->Pt() > 51.0 &&
408 caloMet->Pt() < 200.0) passCut[2] = kTRUE;
409 if(deltaPhiLeptons < 45.0) passCut[3] = kTRUE;
410 if(dilepton->Mass() < 40.0) passCut[4] = kTRUE;
411 if(leptons->At(0)->Pt() > 25.0 &&
412 leptons->At(0)->Pt() < 49.0) passCut[5] = kTRUE;
413 if(leptons->At(1)->Pt() > 25.0) passCut[6] = kTRUE;
414 }
415 else if(finalstateType == 12) { //emu
416 if(caloMet->Pt() > 45.0 &&
417 caloMet->Pt() < 105.0) passCut[2] = kTRUE;
418 if(deltaPhiLeptons < 70.0) passCut[3] = kTRUE;
419 if(dilepton->Mass() < 45.0) passCut[4] = kTRUE;
420 if(leptons->At(0)->Pt() > 25.0 &&
421 leptons->At(0)->Pt() < 50.0) passCut[5] = kTRUE;
422 if(leptons->At(1)->Pt() > 25.0) passCut[6] = kTRUE;
423 }
424
425 if (DirtyMuons->GetEntries() < 1) passCut[7] = kTRUE;
426 if (CleanExtraTracks->GetEntries() < 4) passCut[8] = kTRUE;
427
428 //*********************************************************************************************
429 //Final Decision
430 //*********************************************************************************************
431 Bool_t passAllCuts = kTRUE;
432 for(Int_t c=0; c<nCuts; c++) passAllCuts = passAllCuts & passCut[c];
433
434 //*****************************************************************************************
435 //Histograms after no cuts
436 //*****************************************************************************************
437 fLeptonPtMax->Fill(leptons->At(0)->Pt(),eventweight);
438 fLeptonPtMin->Fill(leptons->At(1)->Pt(),eventweight);
439 fMetPtHist->Fill(caloMet->Pt(),eventweight);
440 fDeltaPhiLeptons->Fill(deltaPhiLeptons,eventweight);
441 fDeltaEtaLeptons->Fill(deltaEtaLeptons,eventweight);
442 fDileptonMass->Fill(dilepton->Mass(),eventweight);
443
444 //*********************************************************************************************
445 // N-1 Histograms
446 //*********************************************************************************************
447
448 //N Jet Veto
449 Bool_t pass = kTRUE;
450 for (Int_t k=0;k<nCuts;k++) {
451 if (k != 1) {
452 pass = (pass && passCut[k]);
453 }
454 }
455 if (pass) {
456 fNCentralJets_NMinusOne->Fill(nCentralJets,eventweight);
457 }
458
459 //Met Cut
460 pass = kTRUE;
461 for (Int_t k=0;k<nCuts;k++) {
462 if (k != 2) {
463 pass = (pass && passCut[k]);
464 }
465 }
466 if (pass) {
467 fMetPtHist_NMinusOne->Fill(caloMet->Pt(),eventweight);
468 }
469
470 //DeltaPhiLeptons
471 pass = kTRUE;
472 for (Int_t k=0;k<nCuts;k++) {
473 if (k != 3) {
474 pass = (pass && passCut[k]);
475 }
476 }
477 if (pass) {
478 fDeltaPhiLeptons_NMinusOne->Fill(deltaPhiLeptons,eventweight);
479 }
480
481 //dilepton mass
482 pass = kTRUE;
483 for (Int_t k=0;k<nCuts;k++) {
484 if (k != 4)
485 pass = (pass && passCut[k]);
486 }
487 if (pass) {
488 fDileptonMass_NMinusOne->Fill(dilepton->Mass(),eventweight);
489 }
490
491 //Lepton Pt Max
492 pass = kTRUE;
493 for (Int_t k=0;k<nCuts;k++) {
494 if (k != 5) {
495 pass = (pass && passCut[k]);
496 }
497 }
498 if (pass) {
499 fLeptonPtMax_NMinusOne->Fill(leptons->At(0)->Pt(),eventweight);
500 }
501
502 //Lepton Pt Min
503 pass = kTRUE;
504 for (Int_t k=0;k<nCuts;k++) {
505 if (k != 6) {
506 pass = (pass && passCut[k]);
507 }
508 }
509 if (pass) {
510 fLeptonPtMin_NMinusOne->Fill(leptons->At(1)->Pt(),eventweight);
511 }
512
513 //NDirtyMuons
514 pass = kTRUE;
515 for (Int_t k=0;k<nCuts;k++) {
516 if (k != 7)
517 pass = (pass && passCut[k]);
518 }
519 if (pass) {
520 fNDirtyMuonsHist_NMinusOne->Fill(DirtyMuons->GetEntries(),eventweight);
521 }
522
523 //NCleanExtraTracks
524 pass = kTRUE;
525 for (Int_t k=0;k<nCuts;k++) {
526 if (k != 8)
527 pass = (pass && passCut[k]);
528 }
529 if (pass) {
530 fNCleanExtraTracksHist_NMinusOne->Fill(CleanExtraTracks->GetEntries(),
531 eventweight);
532 }
533
534 //*********************************************************************************************
535 //Plots after all Cuts
536 //*********************************************************************************************
537 if (passAllCuts) {
538 fMinDeltaPhiLeptonMet_afterCuts->Fill(minDeltaPhiMetLepton,eventweight);
539 fMtLepton1_afterCuts->Fill(mTW[0],eventweight);
540 fMtLepton2_afterCuts->Fill(mTW[1],eventweight);
541 fMtHiggs_afterCuts->Fill(mtHiggs,eventweight);
542 }
543
544 if (!fUseMCFake) {
545 delete leptons;
546 delete CleanJets;
547 delete caloMet;
548 }
549 delete dilepton;
550 delete DirtyMuons;
551 delete CleanExtraTracks;
552 }
553
554 delete FakeableObjects;
555 if (fUseMCFake) {
556 delete FakeEventHeaders;
557 }
558 return;
559 }
560
561 //--------------------------------------------------------------------------------------------------
562 void FakeLeptonExampleAnaMod::SlaveBegin()
563 {
564 // Run startup code on the computer (slave) doing the actual analysis. Here,
565 // we typically initialize histograms and other analysis objects and request
566 // branches. For this module, we request a branch of the MitTree.
567
568 ReqBranch(fTrackBranchName, fTracks);
569 ReqBranch(fMuonBranchName, fMuons);
570
571 //Create your histograms here
572
573
574 //***********************************************************************************************
575 // Before preselection
576 //***********************************************************************************************
577 AddTH1(fDileptonCharge, "hDileptonCharge", ";DileptonCharge;Number of Events", 5, -2.5, 2.5);
578 TAxis *xa = fDileptonCharge->GetXaxis();
579 xa->SetBinLabel(1,"--");
580 xa->SetBinLabel(2,"-+");
581 xa->SetBinLabel(4,"+-");
582 xa->SetBinLabel(5,"++");
583
584 //***********************************************************************************************
585 // Histograms after preselection
586 //***********************************************************************************************
587
588 AddTH1(fLeptonPtMax ,"hLeptonPtMax",";Lepton P_t Max;Number of Events",150,0.,150.);
589 AddTH1(fLeptonPtMin ,"hLeptonPtMin",";Lepton P_t Min;Number of Events",150,0.,150.);
590 AddTH1(fMetPtHist ,"hMetPtHist",";Met;Number of Events",150,0.,300.);
591 AddTH1(fDeltaPhiLeptons ,"hDeltaPhiLeptons",";#Delta#phi_{ll};Number of Events",90,0,180);
592 AddTH1(fDeltaEtaLeptons ,"hDeltaEtaLeptons",";#Delta#eta_{ll};Number of Events",100,-50.,5.0);
593 AddTH1(fDileptonMass ,"hDileptonMass",";Mass_{ll};Number of Events",150,0.,300.);
594
595 //***********************************************************************************************
596 // N-1 Histograms
597 //***********************************************************************************************
598 //All events
599 AddTH1(fLeptonPtMax_NMinusOne ,"hLeptonPtMax_NMinusOne",
600 ";Lepton P_t Max;Number of Events",150,0.,150.);
601 AddTH1(fLeptonPtMin_NMinusOne ,"hLeptonPtMin_NMinusOne",
602 ";Lepton P_t Min;Number of Events",150,0.,150.);
603 AddTH1(fMetPtHist_NMinusOne ,"hMetPtHist_NMinusOne",
604 ";Met;Number of Events",150,0.,300.);
605 AddTH1(fMetPhiHist_NMinusOne ,"hMetPhiHist_NMinusOne",
606 ";#phi;Number of Events",28,-3.5,3.5);
607 AddTH1(fMETdeltaPhilEtHist_NMinusOne ,"hMETdeltaPhilEtHist_NMinusOne",
608 ";METdeltaPhilEtHist;Number of Events",150,0.,300.);
609 AddTH1(fNCentralJets_NMinusOne ,"hNCentralJets_NMinusOne",
610 ";Number of Central Jets;Number of Events",6,-0.5,5.5);
611 AddTH1(fNDirtyMuonsHist_NMinusOne ,"hNDirtyMuonsHist_NMinusOne",
612 ";Number of Dirty Muons; Number of Events",6,-0.5,5.5);
613 AddTH1(fNCleanExtraTracksHist_NMinusOne ,"hNCleanExtraTracksHist_NMinusOne",
614 ";Number of Clean Extra Tracks; Number of Events",
615 15,-0.5,14.5);
616 AddTH1(fDeltaPhiLeptons_NMinusOne ,"hDeltaPhiLeptons_NMinusOne",
617 ";#Delta#phi_{ll};Number of Events",90,0,180);
618 AddTH1(fDeltaEtaLeptons_NMinusOne ,"hDeltaEtaLeptons_NMinusOne",
619 ";#Delta#eta_{ll};Number of Events",100,-5.0,5.0);
620 AddTH1(fDileptonMass_NMinusOne ,"hDileptonMass_NMinusOne",
621 ";Mass_{ll};Number of Events",150,0.,300.);
622 AddTH1(fMinDeltaPhiLeptonMet_NMinusOne ,"hMinDeltaPhiLeptonMet_NMinusOne",
623 ";Min #Delta#phi_{l,Met};Number of Events",90,0.,180);
624
625
626 //***********************************************************************************************
627 // After all cuts Histograms
628 //***********************************************************************************************
629
630 AddTH1(fMinDeltaPhiLeptonMet_afterCuts ,"hMinDeltaPhiLeptonMet_afterCuts",
631 ";Min #Delta#phi_{l,Met};Number of Events",90,0.,180);
632 AddTH1(fMtLepton1_afterCuts ,"hMtLepton1_afterCuts",
633 ";M_t (Lepton1,Met);Number of Events",100,0.,200.);
634 AddTH1(fMtLepton2_afterCuts ,"hMtLepton2_afterCuts",
635 ";M_t (Lepton2,Met);Number of Events",100,0.,200.);
636 AddTH1(fMtHiggs_afterCuts ,"hMtHiggs_afterCuts",
637 ";M_t (l1+l2+Met);Number of Events",150,0.,300.);
638
639 }