ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/JetIDMod.cc
Revision: 1.21
Committed: Tue Nov 3 11:07:01 2009 UTC (15 years, 6 months ago) by ceballos
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, Mit_013pre1, Mit_012i, Mit_012g, Mit_012f, Mit_012e, Mit_012d, Mit_012c, Mit_012b, Mit_012a, Mit_012
Changes since 1.20: +2 -3 lines
Log Message:
avoid making a non needed copy

File Contents

# Content
1 // $Id: JetIDMod.cc,v 1.20 2009/11/03 09:13:28 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
9 using namespace mithep;
10
11 ClassImp(mithep::JetIDMod)
12
13 //--------------------------------------------------------------------------------------------------
14 JetIDMod::JetIDMod(const char *name, const char *title) :
15 BaseMod(name,title),
16 fJetsName(ModNames::gkPubJetsName),
17 fGoodJetsName(ModNames::gkGoodJetsName),
18 fUseJetCorrection(kTRUE),
19 fJetPtCut(35.0),
20 fJetEtaMaxCut(5.0),
21 fJetEEMFractionMinCut(0.01)
22 {
23 // Constructor.
24 }
25
26 //-------------------------------------------------------------------------------------------------
27 void JetIDMod::Process()
28 {
29 // Process entries of the tree.
30
31 const JetCol *inJets = GetObjThisEvt<JetCol>(fJetsName);
32 if (!inJets) {
33 SendError(kAbortModule, "Process",
34 "Pointer to input jet collection %s is null.",
35 fJetsName.Data());
36 return;
37 }
38
39 JetOArr *GoodJets = new JetOArr;
40 GoodJets->SetName(fGoodJetsName);
41
42 // loop over jets
43 for (UInt_t i=0; i<inJets->GetEntries(); ++i) {
44 const Jet *jet = inJets->At(i);
45
46 if (jet->AbsEta() > fJetEtaMaxCut)
47 continue;
48
49 Double_t jetpt;
50 if (fUseJetCorrection)
51 jetpt = jet->Pt();
52 else
53 jetpt = jet->RawMom().Pt();
54
55 if (jetpt < fJetPtCut)
56 continue;
57
58 Bool_t passEEMFractionMinCut = kTRUE;
59 if(fJetEEMFractionMinCut > 0){
60 const CaloJet *caloJet = dynamic_cast<const CaloJet*>(jet);
61 // The 2.6 value is hardcoded, no reason to change that value in CMS
62 if (caloJet && caloJet->AbsEta() < 2.6 &&
63 caloJet->EnergyFractionEm() < fJetEEMFractionMinCut)
64 passEEMFractionMinCut = kFALSE;
65 }
66 if(passEEMFractionMinCut == kFALSE)
67 continue;
68
69 // add good jet to collection
70 GoodJets->Add(jet);
71 }
72
73 // sort according to pt
74 GoodJets->Sort();
75
76 // add to event for other modules to use
77 AddObjThisEvt(GoodJets);
78 }
79