ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MVAMetMod.cc
Revision: 1.4
Committed: Sat Apr 7 13:55:35 2012 UTC (13 years, 1 month ago) by ceballos
Content type: text/plain
Branch: MAIN
Changes since 1.3: +9 -6 lines
Log Message:
another fix

File Contents

# User Rev Content
1 ceballos 1.4 // $Id: MVAMetMod.cc,v 1.3 2012/04/07 12:25:26 ceballos 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 ceballos 1.3 fMVAMetName("MetMVA"),
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.4 fJets = GetObjThisEvt<JetCol> (fJetsName); //corrected Jets
35     LoadBranch(fPFCandName);
36     fVertices = GetObjThisEvt<VertexOArr>(fVertexName);
37     LoadBranch(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 ceballos 1.4 dynamic_cast<const PFJetCol*>(fJets),
57 pharris 1.1 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 ceballos 1.4 ReqBranch(fPFCandName, fCands);
76     ReqBranch(fPFMetName, fPFMet);
77    
78 ceballos 1.2 fMVAMet = new MVAMet();
79     fMVAMet->Initialize(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_lowpt.weights.xml"))),
80     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_highpt.weights.xml"))),
81     TString(getenv("CMSSW_BASE")+string("/src/MitPhysics/Utils/python/JetIdParams_cfi.py")),
82     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmet.root"))),
83     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmetphi.root")))
84     );
85     }
86    
87     //--------------------------------------------------------------------------------------------------
88     void MVAMetMod::SlaveTerminate()
89     {
90     delete fMVAMet;
91     }