1 |
pharris |
1.26 |
// $Id: JetIDMod.cc,v 1.25 2011/04/12 07:38:26 ceballos Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/JetIDMod.h"
|
4 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
loizides |
1.17 |
#include "MitAna/DataTree/interface/JetCol.h"
|
6 |
loizides |
1.4 |
#include "MitPhysics/Init/interface/ModNames.h"
|
7 |
ceballos |
1.18 |
#include "MitAna/DataTree/interface/CaloJetCol.h"
|
8 |
ceballos |
1.22 |
#include "MitAna/DataTree/interface/PFJetCol.h"
|
9 |
|
|
#include "MitPhysics/Utils/interface/JetTools.h"
|
10 |
loizides |
1.1 |
|
11 |
|
|
using namespace mithep;
|
12 |
|
|
|
13 |
|
|
ClassImp(mithep::JetIDMod)
|
14 |
|
|
|
15 |
|
|
//--------------------------------------------------------------------------------------------------
|
16 |
loizides |
1.5 |
JetIDMod::JetIDMod(const char *name, const char *title) :
|
17 |
loizides |
1.1 |
BaseMod(name,title),
|
18 |
bendavid |
1.14 |
fJetsName(ModNames::gkPubJetsName),
|
19 |
loizides |
1.4 |
fGoodJetsName(ModNames::gkGoodJetsName),
|
20 |
ceballos |
1.22 |
fVertexName(ModNames::gkGoodVertexesName),
|
21 |
ceballos |
1.8 |
fUseJetCorrection(kTRUE),
|
22 |
ceballos |
1.16 |
fJetPtCut(35.0),
|
23 |
ceballos |
1.18 |
fJetEtaMaxCut(5.0),
|
24 |
ceballos |
1.22 |
fJetEEMFractionMinCut(0.01),
|
25 |
|
|
fApplyBetaCut(kFALSE),
|
26 |
|
|
fVertices(0)
|
27 |
loizides |
1.1 |
{
|
28 |
|
|
// Constructor.
|
29 |
pharris |
1.26 |
fJetIDMVA = new JetIDMVA();
|
30 |
|
|
fJetIDMVA->Initialize(JetIDMVA::kLoose);
|
31 |
loizides |
1.1 |
}
|
32 |
|
|
|
33 |
ceballos |
1.18 |
//-------------------------------------------------------------------------------------------------
|
34 |
loizides |
1.1 |
void JetIDMod::Process()
|
35 |
|
|
{
|
36 |
|
|
// Process entries of the tree.
|
37 |
|
|
|
38 |
loizides |
1.15 |
const JetCol *inJets = GetObjThisEvt<JetCol>(fJetsName);
|
39 |
|
|
if (!inJets) {
|
40 |
|
|
SendError(kAbortModule, "Process",
|
41 |
|
|
"Pointer to input jet collection %s is null.",
|
42 |
|
|
fJetsName.Data());
|
43 |
|
|
return;
|
44 |
|
|
}
|
45 |
loizides |
1.5 |
|
46 |
|
|
JetOArr *GoodJets = new JetOArr;
|
47 |
|
|
GoodJets->SetName(fGoodJetsName);
|
48 |
loizides |
1.1 |
|
49 |
ceballos |
1.22 |
fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
|
50 |
|
|
|
51 |
loizides |
1.5 |
// loop over jets
|
52 |
bendavid |
1.14 |
for (UInt_t i=0; i<inJets->GetEntries(); ++i) {
|
53 |
|
|
const Jet *jet = inJets->At(i);
|
54 |
loizides |
1.5 |
|
55 |
ceballos |
1.16 |
if (jet->AbsEta() > fJetEtaMaxCut)
|
56 |
loizides |
1.5 |
continue;
|
57 |
ceballos |
1.20 |
|
58 |
bendavid |
1.13 |
Double_t jetpt;
|
59 |
loizides |
1.5 |
if (fUseJetCorrection)
|
60 |
bendavid |
1.13 |
jetpt = jet->Pt();
|
61 |
|
|
else
|
62 |
|
|
jetpt = jet->RawMom().Pt();
|
63 |
loizides |
1.5 |
|
64 |
ceballos |
1.10 |
if (jetpt < fJetPtCut)
|
65 |
loizides |
1.5 |
continue;
|
66 |
loizides |
1.1 |
|
67 |
ceballos |
1.18 |
Bool_t passEEMFractionMinCut = kTRUE;
|
68 |
|
|
if(fJetEEMFractionMinCut > 0){
|
69 |
ceballos |
1.21 |
const CaloJet *caloJet = dynamic_cast<const CaloJet*>(jet);
|
70 |
ceballos |
1.18 |
// The 2.6 value is hardcoded, no reason to change that value in CMS
|
71 |
ceballos |
1.19 |
if (caloJet && caloJet->AbsEta() < 2.6 &&
|
72 |
|
|
caloJet->EnergyFractionEm() < fJetEEMFractionMinCut)
|
73 |
ceballos |
1.18 |
passEEMFractionMinCut = kFALSE;
|
74 |
|
|
}
|
75 |
|
|
if(passEEMFractionMinCut == kFALSE)
|
76 |
|
|
continue;
|
77 |
|
|
|
78 |
sixie |
1.23 |
// Jet to vertex association cut
|
79 |
|
|
const PFJet *pfJet = dynamic_cast<const PFJet*>(jet);
|
80 |
ceballos |
1.22 |
Bool_t passBetaCut = kTRUE;
|
81 |
ceballos |
1.24 |
if (pfJet && fApplyBetaCut == kTRUE) {
|
82 |
sixie |
1.23 |
passBetaCut = JetTools::PassBetaVertexAssociationCut(dynamic_cast<const PFJet*>(jet), fVertices->At(0), fVertices, 0.2);
|
83 |
ceballos |
1.22 |
}
|
84 |
|
|
if(passBetaCut == kFALSE)
|
85 |
|
|
continue;
|
86 |
|
|
|
87 |
pharris |
1.26 |
if(fJetIDMVA->pass(pfJet,fVertices->At(0),fVertices)) continue;
|
88 |
|
|
|
89 |
loizides |
1.5 |
// add good jet to collection
|
90 |
ceballos |
1.25 |
GoodJets->Add(jet);
|
91 |
loizides |
1.5 |
}
|
92 |
loizides |
1.7 |
|
93 |
|
|
// sort according to pt
|
94 |
|
|
GoodJets->Sort();
|
95 |
loizides |
1.1 |
|
96 |
loizides |
1.5 |
// add to event for other modules to use
|
97 |
|
|
AddObjThisEvt(GoodJets);
|
98 |
loizides |
1.1 |
}
|
99 |
|
|
|