1 |
dkralph |
1.4 |
// $Id: PFTauIDMod.cc,v 1.3 2011/02/17 14:08:49 ceballos Exp $
|
2 |
ceballos |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/PFTauIDMod.h"
|
4 |
|
|
#include "MitPhysics/Init/interface/ModNames.h"
|
5 |
|
|
#include "MitAna/DataTree/interface/PFTauCol.h"
|
6 |
|
|
|
7 |
|
|
using namespace mithep;
|
8 |
|
|
|
9 |
|
|
ClassImp(mithep::PFTauIDMod)
|
10 |
|
|
|
11 |
|
|
//------------------------------------------------------------------------------
|
12 |
|
|
PFTauIDMod::PFTauIDMod(const char *name, const char *title) :
|
13 |
|
|
BaseMod(name,title),
|
14 |
|
|
fPFTausName(Names::gkPFTauBrn),
|
15 |
|
|
fGoodPFTausName(ModNames::gkGoodPFTausName),
|
16 |
|
|
fPtMin(15.0),
|
17 |
|
|
fPtLeadChargedHadronPFCandMin(5.0),
|
18 |
|
|
fIsoChargedHadronPtSumMax(2.0),
|
19 |
|
|
fIsoGammaEtSumMax(3.0),
|
20 |
|
|
fSignalMassMin(0.13),
|
21 |
|
|
fSignalMassMax(2.00),
|
22 |
ceballos |
1.3 |
fIsHPSSel(kFALSE),
|
23 |
dkralph |
1.4 |
fHPSIso("loose"),
|
24 |
ceballos |
1.1 |
fPFTaus(0)
|
25 |
|
|
{
|
26 |
|
|
// Constructor.
|
27 |
|
|
}
|
28 |
|
|
|
29 |
|
|
//------------------------------------------------------------------------------
|
30 |
|
|
void PFTauIDMod::Process()
|
31 |
|
|
{
|
32 |
|
|
// Process entries of the tree.
|
33 |
|
|
|
34 |
|
|
LoadBranch(fPFTausName);
|
35 |
|
|
|
36 |
|
|
PFTauOArr *GoodTaus = new PFTauOArr;
|
37 |
|
|
GoodTaus->SetName(fGoodPFTausName);
|
38 |
|
|
|
39 |
dkralph |
1.4 |
for (UInt_t i=0; i<fPFTaus->GetEntries(); ++i) {
|
40 |
|
|
const PFTau *tau = fPFTaus->At(i);
|
41 |
ceballos |
1.1 |
|
42 |
dkralph |
1.4 |
if(fIsHPSSel == kFALSE) {
|
43 |
|
|
if (tau->NSignalPFCands() == 0)
|
44 |
|
|
continue;
|
45 |
ceballos |
1.1 |
|
46 |
dkralph |
1.4 |
CompositeParticle tauSystem;
|
47 |
|
|
CompositeParticle tauChargedSystem;
|
48 |
|
|
UInt_t nTrk = 0;
|
49 |
|
|
for (UInt_t j=0; j<tau->NSignalPFCands(); ++j) {
|
50 |
|
|
tauSystem.AddDaughter(tau->SignalPFCand(j));
|
51 |
|
|
if(tau->SignalPFCand(j) != 0 &&
|
52 |
|
|
tau->SignalPFCand(j)->Charge() != 0){
|
53 |
|
|
nTrk++;
|
54 |
|
|
tauChargedSystem.AddDaughter(tau->SignalPFCand(j));
|
55 |
|
|
}
|
56 |
ceballos |
1.1 |
}
|
57 |
|
|
|
58 |
dkralph |
1.4 |
if (nTrk != 1 && nTrk != 3)
|
59 |
|
|
continue;
|
60 |
ceballos |
1.1 |
|
61 |
dkralph |
1.4 |
if (TMath::Abs(tau->Charge()) - 1.0 > 0.0001)
|
62 |
|
|
continue;
|
63 |
ceballos |
1.1 |
|
64 |
dkralph |
1.4 |
if (tauSystem.Pt() <= fPtMin)
|
65 |
|
|
continue;
|
66 |
ceballos |
1.1 |
|
67 |
ceballos |
1.3 |
if(!tau->LeadChargedHadronPFCand())
|
68 |
|
|
continue;
|
69 |
|
|
|
70 |
|
|
if(tau->LeadChargedHadronPFCand()->Pt() <= fPtLeadChargedHadronPFCandMin)
|
71 |
|
|
continue;
|
72 |
|
|
|
73 |
|
|
if (tau->IsoChargedHadronPtSum() >= fIsoChargedHadronPtSumMax)
|
74 |
|
|
continue;
|
75 |
|
|
|
76 |
|
|
if (tau->IsoGammaEtSum() >= fIsoGammaEtSumMax)
|
77 |
|
|
continue;
|
78 |
|
|
|
79 |
|
|
if (tauChargedSystem.Mass() <= fSignalMassMin || tauChargedSystem.Mass() >= fSignalMassMax)
|
80 |
|
|
continue;
|
81 |
|
|
}
|
82 |
dkralph |
1.4 |
else { // if we're doing hps selection:
|
83 |
|
|
if(tau->Pt() <= fPtMin)
|
84 |
|
|
continue;
|
85 |
|
|
if(tau->DiscriminationByDecayModeFinding() < 0.5)
|
86 |
ceballos |
1.3 |
continue;
|
87 |
dkralph |
1.4 |
if(tau->DiscriminationAgainstElectron() < 0.5)
|
88 |
ceballos |
1.3 |
continue;
|
89 |
dkralph |
1.4 |
if(tau->DiscriminationAgainstMuon() < 0.5)
|
90 |
ceballos |
1.3 |
continue;
|
91 |
dkralph |
1.4 |
// "loose" should be default, but others can be used
|
92 |
|
|
if(fHPSIso.Contains("loose",TString::kIgnoreCase)) {
|
93 |
|
|
if(tau->DiscriminationByLooseIsolation() < 0.5)
|
94 |
|
|
continue;
|
95 |
|
|
}
|
96 |
|
|
else if(fHPSIso.Contains("med",TString::kIgnoreCase)) {
|
97 |
|
|
if(tau->DiscriminationByMediumIsolation() < 0.5)
|
98 |
|
|
continue;
|
99 |
|
|
}
|
100 |
|
|
else if(fHPSIso.Contains("tight",TString::kIgnoreCase)) {
|
101 |
|
|
if(tau->DiscriminationByTightIsolation() < 0.5)
|
102 |
|
|
continue;
|
103 |
|
|
}
|
104 |
|
|
else {
|
105 |
|
|
SendError(kWarning,"Process","ERROR: HPS Isolation not properly defined!");
|
106 |
|
|
}
|
107 |
ceballos |
1.3 |
}
|
108 |
ceballos |
1.1 |
|
109 |
|
|
// add good tau to output collection
|
110 |
|
|
GoodTaus->Add(tau);
|
111 |
dkralph |
1.4 |
|
112 |
ceballos |
1.1 |
}
|
113 |
|
|
|
114 |
|
|
// sort according to pt
|
115 |
|
|
GoodTaus->Sort();
|
116 |
|
|
|
117 |
|
|
// add to event for other modules to use
|
118 |
|
|
AddObjThisEvt(GoodTaus);
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
//------------------------------------------------------------------------------
|
122 |
|
|
void PFTauIDMod::SlaveBegin()
|
123 |
|
|
{
|
124 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
125 |
|
|
// we just request the Tau collection branch.
|
126 |
dkralph |
1.5 |
|
127 |
|
|
// note: for safety, this overrides SetPFTausName
|
128 |
dkralph |
1.4 |
if(fIsHPSSel) {
|
129 |
|
|
fPFTausName = TString(Names::gkHPSTauBrn);
|
130 |
|
|
}
|
131 |
|
|
else
|
132 |
|
|
fPFTausName = TString(Names::gkPFTauBrn);
|
133 |
ceballos |
1.1 |
|
134 |
|
|
ReqBranch(fPFTausName, fPFTaus);
|
135 |
|
|
}
|