1 |
// $Id: JetIDMod.cc,v 1.15 2009/03/23 14:23:06 loizides Exp $
|
2 |
|
3 |
#include "MitPhysics/Mods/interface/JetIDMod.h"
|
4 |
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
#include "MitPhysics/Init/interface/ModNames.h"
|
6 |
|
7 |
using namespace mithep;
|
8 |
|
9 |
ClassImp(mithep::JetIDMod)
|
10 |
|
11 |
//--------------------------------------------------------------------------------------------------
|
12 |
JetIDMod::JetIDMod(const char *name, const char *title) :
|
13 |
BaseMod(name,title),
|
14 |
fJetsName(ModNames::gkPubJetsName),
|
15 |
fGoodJetsName(ModNames::gkGoodJetsName),
|
16 |
fUseJetCorrection(kTRUE),
|
17 |
fJetPtCut(35.0),
|
18 |
fJetEtaMaxCut(5.0)
|
19 |
{
|
20 |
// Constructor.
|
21 |
}
|
22 |
|
23 |
//--------------------------------------------------------------------------------------------------
|
24 |
void JetIDMod::Process()
|
25 |
{
|
26 |
// Process entries of the tree.
|
27 |
|
28 |
const JetCol *inJets = GetObjThisEvt<JetCol>(fJetsName);
|
29 |
if (!inJets) {
|
30 |
SendError(kAbortModule, "Process",
|
31 |
"Pointer to input jet collection %s is null.",
|
32 |
fJetsName.Data());
|
33 |
return;
|
34 |
}
|
35 |
|
36 |
JetOArr *GoodJets = new JetOArr;
|
37 |
GoodJets->SetName(fGoodJetsName);
|
38 |
|
39 |
// loop over jets
|
40 |
for (UInt_t i=0; i<inJets->GetEntries(); ++i) {
|
41 |
const Jet *jet = inJets->At(i);
|
42 |
|
43 |
if (jet->AbsEta() > fJetEtaMaxCut)
|
44 |
continue;
|
45 |
|
46 |
Double_t jetpt;
|
47 |
if (fUseJetCorrection)
|
48 |
jetpt = jet->Pt();
|
49 |
else
|
50 |
jetpt = jet->RawMom().Pt();
|
51 |
|
52 |
if (jetpt < fJetPtCut)
|
53 |
continue;
|
54 |
|
55 |
// add good jet to collection
|
56 |
GoodJets->Add(jet);
|
57 |
}
|
58 |
|
59 |
// sort according to pt
|
60 |
GoodJets->Sort();
|
61 |
|
62 |
// add to event for other modules to use
|
63 |
AddObjThisEvt(GoodJets);
|
64 |
}
|
65 |
|