1 |
sixie |
1.23 |
// $Id: JetIDMod.cc,v 1.22 2011/02/21 13:50:20 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 |
|
|
}
|
30 |
|
|
|
31 |
ceballos |
1.18 |
//-------------------------------------------------------------------------------------------------
|
32 |
loizides |
1.1 |
void JetIDMod::Process()
|
33 |
|
|
{
|
34 |
|
|
// Process entries of the tree.
|
35 |
|
|
|
36 |
loizides |
1.15 |
const JetCol *inJets = GetObjThisEvt<JetCol>(fJetsName);
|
37 |
|
|
if (!inJets) {
|
38 |
|
|
SendError(kAbortModule, "Process",
|
39 |
|
|
"Pointer to input jet collection %s is null.",
|
40 |
|
|
fJetsName.Data());
|
41 |
|
|
return;
|
42 |
|
|
}
|
43 |
loizides |
1.5 |
|
44 |
|
|
JetOArr *GoodJets = new JetOArr;
|
45 |
|
|
GoodJets->SetName(fGoodJetsName);
|
46 |
loizides |
1.1 |
|
47 |
ceballos |
1.22 |
fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
|
48 |
|
|
|
49 |
loizides |
1.5 |
// loop over jets
|
50 |
bendavid |
1.14 |
for (UInt_t i=0; i<inJets->GetEntries(); ++i) {
|
51 |
|
|
const Jet *jet = inJets->At(i);
|
52 |
loizides |
1.5 |
|
53 |
ceballos |
1.16 |
if (jet->AbsEta() > fJetEtaMaxCut)
|
54 |
loizides |
1.5 |
continue;
|
55 |
ceballos |
1.20 |
|
56 |
bendavid |
1.13 |
Double_t jetpt;
|
57 |
loizides |
1.5 |
if (fUseJetCorrection)
|
58 |
bendavid |
1.13 |
jetpt = jet->Pt();
|
59 |
|
|
else
|
60 |
|
|
jetpt = jet->RawMom().Pt();
|
61 |
loizides |
1.5 |
|
62 |
ceballos |
1.10 |
if (jetpt < fJetPtCut)
|
63 |
loizides |
1.5 |
continue;
|
64 |
loizides |
1.1 |
|
65 |
ceballos |
1.18 |
Bool_t passEEMFractionMinCut = kTRUE;
|
66 |
|
|
if(fJetEEMFractionMinCut > 0){
|
67 |
ceballos |
1.21 |
const CaloJet *caloJet = dynamic_cast<const CaloJet*>(jet);
|
68 |
ceballos |
1.18 |
// The 2.6 value is hardcoded, no reason to change that value in CMS
|
69 |
ceballos |
1.19 |
if (caloJet && caloJet->AbsEta() < 2.6 &&
|
70 |
|
|
caloJet->EnergyFractionEm() < fJetEEMFractionMinCut)
|
71 |
ceballos |
1.18 |
passEEMFractionMinCut = kFALSE;
|
72 |
|
|
}
|
73 |
|
|
if(passEEMFractionMinCut == kFALSE)
|
74 |
|
|
continue;
|
75 |
|
|
|
76 |
sixie |
1.23 |
// Jet to vertex association cut
|
77 |
|
|
const PFJet *pfJet = dynamic_cast<const PFJet*>(jet);
|
78 |
ceballos |
1.22 |
Bool_t passBetaCut = kTRUE;
|
79 |
sixie |
1.23 |
if (pfJet) {
|
80 |
|
|
passBetaCut = JetTools::PassBetaVertexAssociationCut(dynamic_cast<const PFJet*>(jet), fVertices->At(0), fVertices, 0.2);
|
81 |
ceballos |
1.22 |
}
|
82 |
|
|
if(passBetaCut == kFALSE)
|
83 |
|
|
continue;
|
84 |
|
|
|
85 |
loizides |
1.5 |
// add good jet to collection
|
86 |
|
|
GoodJets->Add(jet);
|
87 |
|
|
}
|
88 |
loizides |
1.7 |
|
89 |
|
|
// sort according to pt
|
90 |
|
|
GoodJets->Sort();
|
91 |
loizides |
1.1 |
|
92 |
loizides |
1.5 |
// add to event for other modules to use
|
93 |
|
|
AddObjThisEvt(GoodJets);
|
94 |
loizides |
1.1 |
}
|
95 |
|
|
|