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