ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitPhysics/Mods/src/MVAMetMod.cc
Revision: 1.1
Committed: Sat Apr 7 10:25:15 2012 UTC (13 years, 1 month ago) by pharris
Content type: text/plain
Branch: MAIN
Log Message:
Met examples

File Contents

# User Rev Content
1 pharris 1.1 // $Id: JetIDMod.cc,v 1.27 2012/04/07 09:36:32 pharris Exp $
2    
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     fJetsName (ModNames::gkGoodJetsName),
19     fPFCandName(Names::gkPFCandidatesBrn),
20     fVertexName(ModNames::gkGoodVertexesName),
21     fPFMetName ("PFMet"),
22     fJets(0),
23     fCands(0),
24     fVertices(0),
25     fPFMet(0),
26     fMuons(0)
27     {
28     // Constructor.
29     fMVAMet = new MVAMet();
30     fMVAMet->Initialize(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_lowpt.weights.xml"))),
31     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/mva_JetID_highpt.weights.xml"))),
32     TString(getenv("CMSSW_BASE")+string("/src/MitPhysics/Utils/python/JetIdParams_cfi.py")),
33     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmet.root"))),
34     TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/gbrmetphi.root")))
35     );
36    
37     }
38    
39     //-------------------------------------------------------------------------------------------------
40     void MVAMetMod::Process()
41     {
42     // Process entries of the tree.
43    
44     fJets = GetObjThisEvt<PFJetCol> (fJetsName); //corrected Jets
45     fCands = GetObjThisEvt<PFCandidateCol>(fPFCandName);
46     fVertices = GetObjThisEvt<VertexOArr> (fVertexName);
47     fPFMet = GetObjThisEvt<PFMetCol> (fPFMetName);
48     //fMuons = GetObjThisEvt<MuonCol> (fMuons); //Random lepton selection
49     if (!fJets || !fCands || !fVertices || !fPFMet || !fMuons) {
50     SendError(kAbortModule, "Process",
51     "Pointer to input jet collection %s is null.",
52     fJetsName.Data());
53     return;
54     }
55     //Random lepton selection
56     Float_t lPt0 = 0; Float_t lEta0 = 0; Float_t lPhi0 = 0;
57     Float_t lPt1 = 0; Float_t lEta1 = 0; Float_t lPhi1 = 0;
58    
59     //const Muon *lMuon0 = 0; if(fMuons->GetEntries() > 0) lMuon0 = fMuons->At(0);
60     //const Muon *lMuon1 = 0; if(fMuons->GetEntries() > 1) lMuon1 = fMuons->At(1);
61     //lPt0 = lMuon0->Pt();
62     //lEta0 = lMuon0->Eta();
63     //lPhi0 = lMuon0->Phi();
64    
65     //lPt1 = lMuon1->Pt();
66     //lEta1 = lMuon1->Eta();
67     //lPhi1 = lMuon1->Phi();
68    
69    
70     MetOArr *MVAMet = new MetOArr;
71     MVAMet->SetName(fMVAMetName);
72     Met lMVAMet = fMVAMet->GetMet( false,
73     lPt0,lPhi0,lEta0,
74     lPt1,lPhi1,lEta1,
75     fPFMet->At(0),
76     fCands,fVertices->At(0),fVertices,
77     fJets,
78     int(fVertices->GetEntries()));
79    
80     MVAMet->Add(&lMVAMet);
81    
82     // sort according to pt
83     MVAMet->Sort();
84    
85     // add to event for other modules to use
86     AddObjThisEvt(MVAMet);
87     }
88