ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/DilepSelMod.cc
Revision: 1.5
Committed: Tue Oct 12 07:07:06 2010 UTC (14 years, 6 months ago) by ceballos
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, HEAD
Changes since 1.4: +80 -72 lines
Log Message:
added getfillhist

File Contents

# User Rev Content
1 ceballos 1.5 // $Id: DilepSelMod.cc,v 1.4 2010/10/12 01:59:36 ceballos Exp $
2 loizides 1.1
3     #include "MitPhysics/SelMods/interface/DilepSelMod.h"
4     #include "MitAna/DataCont/interface/ObjArray.h"
5 loizides 1.2 #include "MitAna/DataTree/interface/CompositeParticle.h"
6     #include "MitAna/DataTree/interface/ParticleCol.h"
7 loizides 1.1 #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 ceballos 1.4 fDilMinMass(2),
21     fMinZMass(60),
22     fMaxZMass(120),
23     fIgnoreCharge(kTRUE),
24 loizides 1.1 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 ceballos 1.5 if (GetFillHist()) fNAccCounters->Fill(0);
46 loizides 1.1
47     const ParticleCol *leptons = GetObjThisEvt<ParticleCol>(fCleanLeptonsName);
48     if (!leptons) {
49     SkipEvent();
50     return;
51     }
52    
53 ceballos 1.5 if (GetFillHist()) fNAccCounters->Fill(1);
54 loizides 1.1
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 ceballos 1.5 if (GetFillHist()) fAllDiLepMass->Fill(mass);
85 loizides 1.1
86     if (li->ObjType()!=lj->ObjType()) {
87 ceballos 1.4 if (fIgnoreCharge || (li->Charge()!=lj->Charge())) {
88 ceballos 1.5 if (GetFillHist()) fElMuMass->Fill(mass);
89 ceballos 1.4 ++nGoodPairs;
90     }
91 loizides 1.1 continue;
92     }
93    
94     if (li->Is(kMuon)) {
95 ceballos 1.4 if (fIgnoreCharge || (li->Charge()!=lj->Charge())) {
96 ceballos 1.5 if (GetFillHist()) fDiMuMass->Fill(mass);
97 ceballos 1.4 ++nGoodPairs;
98 loizides 1.1 if ((mass>fMinZMass) && (mass<fMaxZMass)) {
99     ++nZPairs;
100     }
101     }
102     continue;
103     }
104    
105     if (li->Is(kElectron)) {
106 ceballos 1.4 if (fIgnoreCharge || (li->Charge()!=lj->Charge())) {
107 ceballos 1.5 if (GetFillHist()) fDiElMass->Fill(mass);
108 ceballos 1.4 ++nGoodPairs;
109 loizides 1.1 if ((mass>fMinZMass) && (mass<fMaxZMass)) {
110     ++nZPairs;
111     }
112     }
113     continue;
114     }
115     }
116     }
117    
118 ceballos 1.5 if (GetFillHist()) {
119     fNLeptons->Fill(nLeps);
120     fNGPairs->Fill(nGoodPairs);
121     fNZPairs->Fill(nZPairs);
122     fNAccCounters->Fill(2);
123     }
124 loizides 1.1
125     // cut on number of good pairs
126     if (nGoodPairs<1) {
127     SkipEvent();
128     return;
129     }
130    
131 ceballos 1.5 if (GetFillHist()) {
132    
133     fNAccCounters->Fill(3);
134    
135     for (UInt_t i=0; i<nLeps; ++i) {
136     const Particle *li = leptons->At(i);
137    
138     if (li->Pt()<fMinPt)
139     continue;
140    
141     for (UInt_t j=0; j<i; ++j) {
142     const Particle *lj = leptons->At(j);
143    
144     if (lj->Pt()<fMinPt)
145     continue;
146    
147     CompositeParticle dil;
148     dil.AddDaughter(li);
149     dil.AddDaughter(lj);
150     Double_t mass = dil.Mass();
151     if (mass<fDilMinMass)
152     continue;
153    
154     fAllDiLepMassAcc->Fill(mass);
155    
156     if (li->ObjType()!=lj->ObjType()) {
157     if (li->Charge()!=lj->Charge()) {
158     fElMuMassAcc->Fill(mass);
159     }
160     continue;
161     }
162 loizides 1.1
163 ceballos 1.5 if (li->Is(kMuon)) {
164     if (li->Charge()!=lj->Charge()) {
165     fDiMuMassAcc->Fill(mass);
166     }
167     continue;
168     }
169 loizides 1.1
170 ceballos 1.5 if (li->Is(kElectron)) {
171     if (li->Charge()!=lj->Charge()) {
172     fDiElMassAcc->Fill(mass);
173     }
174     continue;
175     }
176 loizides 1.1 }
177     }
178     }
179     }
180    
181     //--------------------------------------------------------------------------------------------------
182     void DilepSelMod::SlaveBegin()
183     {
184     // Create and add histograms to the output list.
185    
186 ceballos 1.5 if (GetFillHist()) {
187     AddTH1(fNAccCounters,"hNAccCounters",";cut;#",4,-0.5,3.5);
188     if (1) {
189     TAxis *xa = fNAccCounters->GetXaxis();
190     for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
191     xa->SetBinLabel(i,"unused");
192     xa->SetBinLabel(1,"Enter");
193     xa->SetBinLabel(2,"Objs");
194     xa->SetBinLabel(3,"2Lep");
195     xa->SetBinLabel(4,"GPair");
196     xa->SetRangeUser(0,3);
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     }
210 loizides 1.1 }