ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/SelMods/src/DilepSelMod.cc
Revision: 1.4
Committed: Tue Oct 12 01:59:36 2010 UTC (14 years, 6 months ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.3: +22 -29 lines
Log Message:
some updates

File Contents

# User Rev Content
1 ceballos 1.4 // $Id: DilepSelMod.cc,v 1.3 2009/06/17 14:52:59 loizides 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     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 ceballos 1.4 if (fIgnoreCharge || (li->Charge()!=lj->Charge())) {
88     fElMuMass->Fill(mass);
89     ++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 loizides 1.1 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 loizides 1.1 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     fNLeptons->Fill(nLeps);
119     fNGPairs->Fill(nGoodPairs);
120     fNZPairs->Fill(nZPairs);
121     fNAccCounters->Fill(2);
122    
123     // cut on number of good pairs
124     if (nGoodPairs<1) {
125     SkipEvent();
126     return;
127     }
128    
129 ceballos 1.4 fNAccCounters->Fill(3);
130 loizides 1.1 for (UInt_t i=0; i<nLeps; ++i) {
131     const Particle *li = leptons->At(i);
132    
133     if (li->Pt()<fMinPt)
134     continue;
135    
136     for (UInt_t j=0; j<i; ++j) {
137     const Particle *lj = leptons->At(j);
138    
139     if (lj->Pt()<fMinPt)
140     continue;
141    
142     CompositeParticle dil;
143     dil.AddDaughter(li);
144     dil.AddDaughter(lj);
145     Double_t mass = dil.Mass();
146     if (mass<fDilMinMass)
147     continue;
148    
149     fAllDiLepMassAcc->Fill(mass);
150    
151     if (li->ObjType()!=lj->ObjType()) {
152 ceballos 1.4 if (li->Charge()!=lj->Charge()) {
153     fElMuMassAcc->Fill(mass);
154     }
155 loizides 1.1 continue;
156     }
157    
158     if (li->Is(kMuon)) {
159     if (li->Charge()!=lj->Charge()) {
160     fDiMuMassAcc->Fill(mass);
161 ceballos 1.4 }
162 loizides 1.1 continue;
163     }
164    
165     if (li->Is(kElectron)) {
166 ceballos 1.4 if (li->Charge()!=lj->Charge()) {
167 loizides 1.1 fDiElMassAcc->Fill(mass);
168     }
169     continue;
170     }
171     }
172     }
173     }
174    
175     //--------------------------------------------------------------------------------------------------
176     void DilepSelMod::SlaveBegin()
177     {
178     // Create and add histograms to the output list.
179    
180 ceballos 1.4 AddTH1(fNAccCounters,"hNAccCounters",";cut;#",4,-0.5,3.5);
181 loizides 1.1 if (1) {
182     TAxis *xa = fNAccCounters->GetXaxis();
183     for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
184     xa->SetBinLabel(i,"unused");
185     xa->SetBinLabel(1,"Enter");
186     xa->SetBinLabel(2,"Objs");
187     xa->SetBinLabel(3,"2Lep");
188 ceballos 1.4 xa->SetBinLabel(4,"GPair");
189     xa->SetRangeUser(0,3);
190 loizides 1.1 }
191     AddTH1(fAllDiLepMass,"hAllDiLepMass",";m_{ll} [GeV];#",150,0,300);
192     AddTH1(fDiElMass,"hDiElMass",";m_{ll} [GeV];#",150,0,300);
193     AddTH1(fDiMuMass,"hDiMuMass",";m_{ll} [GeV];#",150,0,300);
194     AddTH1(fElMuMass,"hElMuMass",";m_{ll} [GeV];#",150,0,300);
195     AddTH1(fAllDiLepMassAcc,"hAllDiLepMassAcc",";m_{ll} [GeV];#",150,0,300);
196     AddTH1(fDiElMassAcc,"hDiElMassAcc",";m_{ll} [GeV];#",150,0,300);
197     AddTH1(fDiMuMassAcc,"hDiMuMassAcc",";m_{ll} [GeV];#",150,0,300);
198     AddTH1(fElMuMassAcc,"hElMuMassAcc",";m_{ll} [GeV];#",150,0,300);
199     AddTH1(fNLeptons,"hNLeptons",";leptons;#",10,-0.5,9.5);
200     AddTH1(fNGPairs,"hNGoodPairs",";leptons;#",10,-0.5,9.5);
201     AddTH1(fNZPairs,"hNZPairs",";leptons;#",10,-0.5,9.5);
202     }