1 |
// $Id: LeptonPlusIsoTrackSelMod.cc,v 1.2 2009/06/15 15:00:22 loizides Exp $
|
2 |
|
3 |
#include "MitPhysics/SelMods/interface/LeptonPlusIsoTrackSelMod.h"
|
4 |
#include "MitPhysics/Utils/interface/IsolationTools.h"
|
5 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
6 |
#include "MitAna/DataTree/interface/PhotonCol.h"
|
7 |
#include "MitAna/DataTree/interface/TrackCol.h"
|
8 |
#include <TH1D.h>
|
9 |
|
10 |
using namespace mithep;
|
11 |
|
12 |
ClassImp(mithep::LeptonPlusIsoTrackSelMod)
|
13 |
|
14 |
//--------------------------------------------------------------------------------------------------
|
15 |
mithep::LeptonPlusIsoTrackSelMod::LeptonPlusIsoTrackSelMod(const char *name, const char *title) :
|
16 |
BaseSelMod(name,title),
|
17 |
fLeptonColName("SetMe"),
|
18 |
fTrackerTrackColName("SetMe"),
|
19 |
fGsfTrackColName("SetMe"),
|
20 |
fLeptonPtMin(0),
|
21 |
fLeptonPtMax(5000),
|
22 |
fLeptonEtaMin(-10),
|
23 |
fLeptonEtaMax(10),
|
24 |
fTrackPtMin(0),
|
25 |
fTrackPtMax(5000),
|
26 |
fTrackEtaMin(-10),
|
27 |
fTrackEtaMax(10),
|
28 |
fLeptonCol(0),
|
29 |
fTrackerTrackCol(0),
|
30 |
fGsfTrackCol(0)
|
31 |
{
|
32 |
// Constructor.
|
33 |
}
|
34 |
|
35 |
//--------------------------------------------------------------------------------------------------
|
36 |
void mithep::LeptonPlusIsoTrackSelMod::Process()
|
37 |
{
|
38 |
// Process entries of the tree.
|
39 |
|
40 |
//load the track branches
|
41 |
LoadBranch(GetTrackerTrackColName());
|
42 |
LoadBranch(GetGsfTrackColName());
|
43 |
|
44 |
fNAccCounters->Fill(0);
|
45 |
|
46 |
fLeptonCol = GetObjThisEvt<Collection<Particle> >(GetLeptonColName());
|
47 |
if (!fLeptonCol ) {
|
48 |
this->SendError(kAbortModule, "Process",
|
49 |
"Could not obtain collection with name %s!", GetLeptonColName());
|
50 |
return;
|
51 |
}
|
52 |
|
53 |
if (!fLeptonCol && !fGsfTrackCol) {
|
54 |
this->SendError(kAbortModule, "Process",
|
55 |
"Could not obtain either collections with names %s , %s!",
|
56 |
GetTrackerTrackColName(), GetGsfTrackColName());
|
57 |
return;
|
58 |
}
|
59 |
|
60 |
fNAccCounters->Fill(1);
|
61 |
|
62 |
UInt_t LeptonCounter = 0;
|
63 |
for(UInt_t i=0;i<fLeptonCol->GetEntries();++i) {
|
64 |
if (fLeptonCol->At(i)->Pt() >= fLeptonPtMin &&
|
65 |
fLeptonCol->At(i)->Pt() <= fLeptonPtMax &&
|
66 |
fLeptonCol->At(i)->Eta() >= fLeptonEtaMin &&
|
67 |
fLeptonCol->At(i)->Eta() <= fLeptonEtaMax)
|
68 |
LeptonCounter++;
|
69 |
}
|
70 |
if (LeptonCounter == 0) {
|
71 |
this->SkipEvent();
|
72 |
return;
|
73 |
}
|
74 |
|
75 |
fNAccCounters->Fill(2);
|
76 |
|
77 |
UInt_t TrackCounter = 0;
|
78 |
for(UInt_t i=0;i<fTrackerTrackCol->GetEntries();++i) {
|
79 |
const Track *trk = fTrackerTrackCol->At(i);
|
80 |
if (trk->Pt() >= fTrackPtMin &&
|
81 |
trk->Pt() <= fTrackPtMax &&
|
82 |
trk->Eta() >= fTrackEtaMin &&
|
83 |
trk->Eta() <= fTrackEtaMax) {
|
84 |
Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
|
85 |
if (iso < 10.0) {
|
86 |
//require that the track is not the same object as one of the leptons
|
87 |
if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
|
88 |
fLeptonCol->At(0)->Phi(),
|
89 |
fLeptonCol->At(0)->Eta()) >= 0.3)
|
90 |
TrackCounter++;
|
91 |
}
|
92 |
}
|
93 |
}
|
94 |
for(UInt_t i=0;i<fGsfTrackCol->GetEntries();++i) {
|
95 |
const Track *trk = fGsfTrackCol->At(i);
|
96 |
if (trk->Pt() >= fTrackPtMin &&
|
97 |
trk->Pt() <= fTrackPtMax &&
|
98 |
trk->Eta() >= fTrackEtaMin &&
|
99 |
trk->Eta() <= fTrackEtaMax) {
|
100 |
Double_t iso = IsolationTools::TrackIsolation(trk,0.3, 0.015,1.0,1000.0,fTrackerTrackCol);
|
101 |
if (iso < 10.0) {
|
102 |
if (MathUtils::DeltaR(trk->Phi(), trk->Eta(),
|
103 |
fLeptonCol->At(0)->Phi(), fLeptonCol->At(0)->Eta()) >= 0.3)
|
104 |
TrackCounter++;
|
105 |
}
|
106 |
}
|
107 |
}
|
108 |
|
109 |
if (TrackCounter == 0) {
|
110 |
this->SkipEvent();
|
111 |
return;
|
112 |
}
|
113 |
|
114 |
fNAccCounters->Fill(3);
|
115 |
}
|
116 |
|
117 |
//--------------------------------------------------------------------------------------------------
|
118 |
void mithep::LeptonPlusIsoTrackSelMod::SlaveBegin()
|
119 |
{
|
120 |
// Setup acceptence histogram.
|
121 |
ReqBranch(GetTrackerTrackColName(), fTrackerTrackCol);
|
122 |
ReqBranch(GetGsfTrackColName(), fGsfTrackCol);
|
123 |
|
124 |
AddTH1(fNAccCounters,"hNAccCounters",";cut;#",5,-0.5,4.5);
|
125 |
if (1) {
|
126 |
TAxis *xa = fNAccCounters->GetXaxis();
|
127 |
for(Int_t i=1;i<=fNAccCounters->GetNbinsX();++i)
|
128 |
xa->SetBinLabel(i,"unused");
|
129 |
xa->SetBinLabel(1,"Enter");
|
130 |
xa->SetBinLabel(2,"Objs");
|
131 |
xa->SetBinLabel(3,"AtLeastOneLepton");
|
132 |
xa->SetBinLabel(4,"IsolatedTrack");
|
133 |
xa->SetRangeUser(0,3);
|
134 |
}
|
135 |
}
|