ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetIDMod.cc
Revision: 1.25
Committed: Tue Apr 12 07:38:26 2011 UTC (14 years ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b
Changes since 1.24: +2 -2 lines
Log Message:
minor update

File Contents

# Content
1 // $Id: JetIDMod.cc,v 1.24 2011/03/11 15:13:09 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 }
30
31 //-------------------------------------------------------------------------------------------------
32 void JetIDMod::Process()
33 {
34 // Process entries of the tree.
35
36 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
44 JetOArr *GoodJets = new JetOArr;
45 GoodJets->SetName(fGoodJetsName);
46
47 fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
48
49 // loop over jets
50 for (UInt_t i=0; i<inJets->GetEntries(); ++i) {
51 const Jet *jet = inJets->At(i);
52
53 if (jet->AbsEta() > fJetEtaMaxCut)
54 continue;
55
56 Double_t jetpt;
57 if (fUseJetCorrection)
58 jetpt = jet->Pt();
59 else
60 jetpt = jet->RawMom().Pt();
61
62 if (jetpt < fJetPtCut)
63 continue;
64
65 Bool_t passEEMFractionMinCut = kTRUE;
66 if(fJetEEMFractionMinCut > 0){
67 const CaloJet *caloJet = dynamic_cast<const CaloJet*>(jet);
68 // The 2.6 value is hardcoded, no reason to change that value in CMS
69 if (caloJet && caloJet->AbsEta() < 2.6 &&
70 caloJet->EnergyFractionEm() < fJetEEMFractionMinCut)
71 passEEMFractionMinCut = kFALSE;
72 }
73 if(passEEMFractionMinCut == kFALSE)
74 continue;
75
76 // Jet to vertex association cut
77 const PFJet *pfJet = dynamic_cast<const PFJet*>(jet);
78 Bool_t passBetaCut = kTRUE;
79 if (pfJet && fApplyBetaCut == kTRUE) {
80 passBetaCut = JetTools::PassBetaVertexAssociationCut(dynamic_cast<const PFJet*>(jet), fVertices->At(0), fVertices, 0.2);
81 }
82 if(passBetaCut == kFALSE)
83 continue;
84
85 // add good jet to collection
86 GoodJets->Add(jet);
87 }
88
89 // sort according to pt
90 GoodJets->Sort();
91
92 // add to event for other modules to use
93 AddObjThisEvt(GoodJets);
94 }
95