ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/DilepSelMod.cc
Revision: 1.1
Committed: Wed Apr 29 15:07:12 2009 UTC (16 years ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_009a
Log Message:
Added Dilepton Selection module from MitHiggs.

File Contents

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