1 |
ceballos |
1.2 |
// $Id: MVAMetMod.cc,v 1.1 2012/04/07 10:25:15 pharris Exp $
|
2 |
pharris |
1.1 |
|
3 |
|
|
#include "MitPhysics/Mods/interface/MVAMetMod.h"
|
4 |
|
|
#include "MitCommon/MathTools/interface/MathUtils.h"
|
5 |
|
|
#include "MitAna/DataTree/interface/MetCol.h"
|
6 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
7 |
|
|
#include "MitPhysics/Init/interface/ModNames.h"
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
using namespace mithep;
|
11 |
|
|
|
12 |
|
|
ClassImp(mithep::MVAMetMod)
|
13 |
|
|
|
14 |
|
|
//--------------------------------------------------------------------------------------------------
|
15 |
|
|
MVAMetMod::MVAMetMod(const char *name, const char *title) :
|
16 |
|
|
BaseMod(name,title),
|
17 |
|
|
fMVAMetName("MVAMet"),
|
18 |
ceballos |
1.2 |
fJetsName ("dummy"),
|
19 |
pharris |
1.1 |
fPFCandName(Names::gkPFCandidatesBrn),
|
20 |
|
|
fVertexName(ModNames::gkGoodVertexesName),
|
21 |
|
|
fPFMetName ("PFMet"),
|
22 |
|
|
fJets(0),
|
23 |
|
|
fCands(0),
|
24 |
|
|
fVertices(0),
|
25 |
ceballos |
1.2 |
fPFMet(0)
|
26 |
pharris |
1.1 |
{
|
27 |
ceballos |
1.2 |
}
|
28 |
pharris |
1.1 |
|
29 |
|
|
//-------------------------------------------------------------------------------------------------
|
30 |
|
|
void MVAMetMod::Process()
|
31 |
|
|
{
|
32 |
|
|
// Process entries of the tree.
|
33 |
|
|
|
34 |
ceballos |
1.2 |
fJets = GetObjThisEvt<PFJetCol> (fJetsName); //corrected Jets
|
35 |
pharris |
1.1 |
fCands = GetObjThisEvt<PFCandidateCol>(fPFCandName);
|
36 |
|
|
fVertices = GetObjThisEvt<VertexOArr> (fVertexName);
|
37 |
|
|
fPFMet = GetObjThisEvt<PFMetCol> (fPFMetName);
|
38 |
ceballos |
1.2 |
|
39 |
|
|
if (!fJets || !fCands || !fVertices || !fPFMet) {
|
40 |
pharris |
1.1 |
SendError(kAbortModule, "Process",
|
41 |
|
|
"Pointer to input jet collection %s is null.",
|
42 |
|
|
fJetsName.Data());
|
43 |
|
|
return;
|
44 |
|
|
}
|
45 |
|
|
//Random lepton selection
|
46 |
|
|
Float_t lPt0 = 0; Float_t lEta0 = 0; Float_t lPhi0 = 0;
|
47 |
|
|
Float_t lPt1 = 0; Float_t lEta1 = 0; Float_t lPhi1 = 0;
|
48 |
|
|
|
49 |
|
|
MetOArr *MVAMet = new MetOArr;
|
50 |
|
|
MVAMet->SetName(fMVAMetName);
|
51 |
|
|
Met lMVAMet = fMVAMet->GetMet( false,
|
52 |
|
|
lPt0,lPhi0,lEta0,
|
53 |
|
|
lPt1,lPhi1,lEta1,
|
54 |
|
|
fPFMet->At(0),
|
55 |
|
|
fCands,fVertices->At(0),fVertices,
|
56 |
|
|
fJets,
|
57 |
|
|
int(fVertices->GetEntries()));
|
58 |
|
|
|
59 |
|
|
MVAMet->Add(&lMVAMet);
|
60 |
ceballos |
1.2 |
|
61 |
pharris |
1.1 |
// sort according to pt
|
62 |
|
|
MVAMet->Sort();
|
63 |
|
|
|
64 |
|
|
// add to event for other modules to use
|
65 |
|
|
AddObjThisEvt(MVAMet);
|
66 |
|
|
}
|
67 |
|
|
|
68 |
ceballos |
1.2 |
//--------------------------------------------------------------------------------------------------
|
69 |
|
|
void MVAMetMod::SlaveBegin()
|
70 |
|
|
{
|
71 |
|
|
// Run startup code on the computer (slave) doing the actual analysis. Here,
|
72 |
|
|
// we typically initialize histograms and other analysis objects and request
|
73 |
|
|
// branches. For this module, we request a branch of the MitTree.
|
74 |
|
|
|
75 |
|
|
fMVAMet = new MVAMet();
|
76 |
|
|
fMVAMet->Initialize(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_lowpt.weights.xml"))),
|
77 |
|
|
TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_highpt.weights.xml"))),
|
78 |
|
|
TString(getenv("CMSSW_BASE")+string("/src/MitPhysics/Utils/python/JetIdParams_cfi.py")),
|
79 |
|
|
TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmet.root"))),
|
80 |
|
|
TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmetphi.root")))
|
81 |
|
|
);
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
//--------------------------------------------------------------------------------------------------
|
85 |
|
|
void MVAMetMod::SlaveTerminate()
|
86 |
|
|
{
|
87 |
|
|
delete fMVAMet;
|
88 |
|
|
}
|