ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/DilepSelMod.cc
Revision: 1.3
Committed: Wed Jun 17 14:52:59 2009 UTC (15 years, 10 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: 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, Mit_010, Mit_009c
Changes since 1.2: +2 -2 lines
Log Message:
Adjust counters

File Contents

# Content
1 // $Id: DilepSelMod.cc,v 1.2 2009/06/15 15:00:22 loizides Exp $
2
3 #include "MitPhysics/SelMods/interface/DilepSelMod.h"
4 #include "MitAna/DataCont/interface/ObjArray.h"
5 #include "MitAna/DataTree/interface/CompositeParticle.h"
6 #include "MitAna/DataTree/interface/ParticleCol.h"
7 #include "MitPhysics/Init/interface/ModNames.h"
8 #include "MitCommon/MathTools/interface/MathUtils.h"
9 #include <TH1D.h>
10
11 using namespace mithep;
12
13 ClassImp(mithep::DilepSelMod)
14
15 //--------------------------------------------------------------------------------------------------
16 DilepSelMod::DilepSelMod(const char *name, const char *title) :
17 BaseMod(name,title),
18 fCleanLeptonsName(ModNames::gkMergedLeptonsName),
19 fMinPt(10),
20 fDilMinMass(12),
21 fMinZMass(70),
22 fMaxZMass(110),
23 fIgnoreElCharge(kTRUE),
24 fNAccCounters(0),
25 fAllDiLepMass(0),
26 fDiElMass(0),
27 fDiMuMass(0),
28 fElMuMass(0),
29 fAllDiLepMassAcc(0),
30 fDiElMassAcc(0),
31 fDiMuMassAcc(0),
32 fElMuMassAcc(0),
33 fNLeptons(0),
34 fNGPairs(0),
35 fNZPairs(0)
36 {
37 // Constructor.
38 }
39
40 //--------------------------------------------------------------------------------------------------
41 void DilepSelMod::Process()
42 {
43 // Process entries of the tree.
44
45 fNAccCounters->Fill(0);
46
47 const ParticleCol *leptons = GetObjThisEvt<ParticleCol>(fCleanLeptonsName);
48 if (!leptons) {
49 SkipEvent();
50 return;
51 }
52
53 fNAccCounters->Fill(1);
54
55 // make sure have found at least 2 leptons
56 if (leptons->GetEntries()<2) {
57 SkipEvent();
58 return;
59 }
60
61 UInt_t nLeps = leptons->GetEntries();
62 UInt_t nZPairs = 0;
63 UInt_t nGoodPairs = 0;
64
65 for (UInt_t i=0; i<nLeps; ++i) {
66 const Particle *li = leptons->At(i);
67
68 if (li->Pt()<fMinPt)
69 continue;
70
71 for (UInt_t j=0; j<i; ++j) {
72 const Particle *lj = leptons->At(j);
73
74 if (lj->Pt()<fMinPt)
75 continue;
76
77 CompositeParticle dil;
78 dil.AddDaughter(li);
79 dil.AddDaughter(lj);
80 Double_t mass = dil.Mass();
81 if (mass<fDilMinMass)
82 continue;
83
84 fAllDiLepMass->Fill(mass);
85
86 if (li->ObjType()!=lj->ObjType()) {
87 fElMuMass->Fill(mass);
88 ++nGoodPairs;
89 continue;
90 }
91
92 if (li->Is(kMuon)) {
93 if (li->Charge()!=lj->Charge()) {
94 fDiMuMass->Fill(mass);
95 if ((mass>fMinZMass) && (mass<fMaxZMass)) {
96 ++nZPairs;
97 continue;
98 }
99 }
100 ++nGoodPairs;
101 continue;
102 }
103
104 if (li->Is(kElectron)) {
105 if (fIgnoreElCharge || (li->Charge()!=lj->Charge())) {
106 fDiElMass->Fill(mass);
107 if ((mass>fMinZMass) && (mass<fMaxZMass)) {
108 ++nZPairs;
109 continue;
110 }
111 }
112 ++nGoodPairs;
113 continue;
114 }
115 }
116 }
117
118 fNLeptons->Fill(nLeps);
119 fNGPairs->Fill(nGoodPairs);
120 fNZPairs->Fill(nZPairs);
121 fNAccCounters->Fill(2);
122
123 // cut on number of Z pairs
124 if (nZPairs>=1) {
125 SkipEvent();
126 return;
127 }
128
129 fNAccCounters->Fill(3);
130
131 // cut on number of good pairs
132 if (nGoodPairs<1) {
133 SkipEvent();
134 return;
135 }
136
137 fNAccCounters->Fill(4);
138 for (UInt_t i=0; i<nLeps; ++i) {
139 const Particle *li = leptons->At(i);
140
141 if (li->Pt()<fMinPt)
142 continue;
143
144 for (UInt_t j=0; j<i; ++j) {
145 const Particle *lj = leptons->At(j);
146
147 if (lj->Pt()<fMinPt)
148 continue;
149
150 CompositeParticle dil;
151 dil.AddDaughter(li);
152 dil.AddDaughter(lj);
153 Double_t mass = dil.Mass();
154 if (mass<fDilMinMass)
155 continue;
156
157 fAllDiLepMassAcc->Fill(mass);
158
159 if (li->ObjType()!=lj->ObjType()) {
160 fElMuMassAcc->Fill(mass);
161 continue;
162 }
163
164 if (li->Is(kMuon)) {
165 if (li->Charge()!=lj->Charge()) {
166 fDiMuMassAcc->Fill(mass);
167 continue;
168 }
169 }
170
171 if (li->Is(kElectron)) {
172 if (fIgnoreElCharge || (li->Charge()!=lj->Charge())) {
173 fDiElMassAcc->Fill(mass);
174 }
175 continue;
176 }
177 }
178 }
179 }
180
181 //--------------------------------------------------------------------------------------------------
182 void DilepSelMod::SlaveBegin()
183 {
184 // Create and add histograms to the output list.
185
186 AddTH1(fNAccCounters,"hNAccCounters",";cut;#",6,-0.5,5.5);
187 if (1) {
188 TAxis *xa = fNAccCounters->GetXaxis();
189 for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
190 xa->SetBinLabel(i,"unused");
191 xa->SetBinLabel(1,"Enter");
192 xa->SetBinLabel(2,"Objs");
193 xa->SetBinLabel(3,"2Lep");
194 xa->SetBinLabel(4,"ZPair");
195 xa->SetBinLabel(5,"GPair");
196 xa->SetRangeUser(0,4);
197 }
198 AddTH1(fAllDiLepMass,"hAllDiLepMass",";m_{ll} [GeV];#",150,0,300);
199 AddTH1(fDiElMass,"hDiElMass",";m_{ll} [GeV];#",150,0,300);
200 AddTH1(fDiMuMass,"hDiMuMass",";m_{ll} [GeV];#",150,0,300);
201 AddTH1(fElMuMass,"hElMuMass",";m_{ll} [GeV];#",150,0,300);
202 AddTH1(fAllDiLepMassAcc,"hAllDiLepMassAcc",";m_{ll} [GeV];#",150,0,300);
203 AddTH1(fDiElMassAcc,"hDiElMassAcc",";m_{ll} [GeV];#",150,0,300);
204 AddTH1(fDiMuMassAcc,"hDiMuMassAcc",";m_{ll} [GeV];#",150,0,300);
205 AddTH1(fElMuMassAcc,"hElMuMassAcc",";m_{ll} [GeV];#",150,0,300);
206 AddTH1(fNLeptons,"hNLeptons",";leptons;#",10,-0.5,9.5);
207 AddTH1(fNGPairs,"hNGoodPairs",";leptons;#",10,-0.5,9.5);
208 AddTH1(fNZPairs,"hNZPairs",";leptons;#",10,-0.5,9.5);
209 }