ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetIDMod.cc
Revision: 1.26
Committed: Thu Apr 5 12:25:10 2012 UTC (13 years, 1 month ago) by pharris
Content type: text/plain
Branch: MAIN
Changes since 1.25: +5 -1 lines
Log Message:
Added MVA to JetIDMod

File Contents

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