ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerCaloMet.cc
Revision: 1.7
Committed: Tue Sep 16 22:07:29 2008 UTC (16 years, 7 months ago) by ksung
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_006, Mit_005, Mit_004
Changes since 1.6: +4 -5 lines
Log Message:
Changed CaloMet to Met

File Contents

# User Rev Content
1 ksung 1.7 // $Id: FillerCaloMet.cc,v 1.6 2008/09/10 17:10:52 ksung Exp $
2 loizides 1.1
3     #include "MitProd/TreeFiller/interface/FillerCaloMet.h"
4     #include "FWCore/MessageLogger/interface/MessageLogger.h"
5     #include "DataFormats/Common/interface/Handle.h"
6     #include "DataFormats/METReco/interface/CaloMET.h"
7     #include "MitAna/DataTree/interface/Names.h"
8    
9     using namespace std;
10     using namespace edm;
11     using namespace mithep;
12    
13     //--------------------------------------------------------------------------------------------------
14     FillerCaloMet::FillerCaloMet(const ParameterSet &cfg, const char *name, bool active) :
15 loizides 1.5 BaseFiller(cfg,name,active),
16 loizides 1.4 edmName_(Conf().getUntrackedParameter<string>("edmName","met")),
17 ksung 1.6 mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkCaloMetBrn)),
18 ksung 1.7 caloMets_(new mithep::MetArr)
19 loizides 1.1 {
20     // Constructor.
21     }
22    
23     //--------------------------------------------------------------------------------------------------
24     FillerCaloMet::~FillerCaloMet()
25     {
26     // Destructor.
27    
28 ksung 1.6 delete caloMets_;
29 loizides 1.1 }
30    
31     //--------------------------------------------------------------------------------------------------
32     void FillerCaloMet::BookDataBlock(TreeWriter &tws)
33     {
34     // Add mets branch to tree.
35    
36 ksung 1.6 tws.AddBranch(mitName_.c_str(),&caloMets_);
37 loizides 1.1 }
38    
39     //--------------------------------------------------------------------------------------------------
40     void FillerCaloMet::FillDataBlock(const edm::Event &event,
41     const edm::EventSetup &setup)
42     {
43     // Fill missing energy from edm collection into our collection.
44    
45 ksung 1.6 caloMets_->Reset();
46 loizides 1.1
47 ksung 1.6 Handle<reco::CaloMETCollection> hCaloMetProduct;
48     GetProduct(edmName_, hCaloMetProduct, event);
49 loizides 1.1
50 ksung 1.6 const reco::CaloMETCollection inCaloMets = *(hCaloMetProduct.product());
51 loizides 1.1
52     // loop through all mets
53 ksung 1.6 for (reco::CaloMETCollection::const_iterator inCaloMet = inCaloMets.begin();
54     inCaloMet != inCaloMets.end(); ++inCaloMet) {
55 loizides 1.1
56 ksung 1.7 mithep::Met *caloMet = caloMets_->Allocate();
57     new (caloMet) mithep::Met(inCaloMet->px(), inCaloMet->py());
58 ksung 1.6
59     // Fill Met base class data
60     caloMet->SetSumEt(inCaloMet->sumEt());
61     caloMet->SetMetSig(inCaloMet->mEtSig());
62     caloMet->SetE_longitudinal(inCaloMet->e_longitudinal());
63     for(unsigned i=0; i<inCaloMet->mEtCorr().size(); i++) {
64     caloMet->PushCorrectionX(inCaloMet->mEtCorr()[i].mex);
65     caloMet->PushCorrectionY(inCaloMet->mEtCorr()[i].mey);
66     caloMet->PushCorrectionSumEt(inCaloMet->mEtCorr()[i].sumet);
67     }
68     // Fill CaloMet class data
69     caloMet->SetMaxEtInEmTowers(inCaloMet->maxEtInEmTowers());
70     caloMet->SetMaxEtInHadTowers(inCaloMet->maxEtInHadTowers());
71     caloMet->SetEtFractionHadronic(inCaloMet->etFractionHadronic());
72     caloMet->SetEmEtFraction(inCaloMet->emEtFraction());
73     caloMet->SetHadEtInHB(inCaloMet->hadEtInHB());
74     caloMet->SetHadEtInHO(inCaloMet->hadEtInHO());
75     caloMet->SetHadEtInHE(inCaloMet->hadEtInHE());
76     caloMet->SetHadEtInHF(inCaloMet->hadEtInHF());
77     caloMet->SetEmEtInEB(inCaloMet->emEtInEB());
78     caloMet->SetEmEtInEE(inCaloMet->emEtInEE());
79     caloMet->SetEmEtInHF(inCaloMet->emEtInHF());
80     caloMet->SetCaloSumEtInpHF(inCaloMet->CaloSETInpHF());
81     caloMet->SetCaloSumEtInmHF(inCaloMet->CaloSETInmHF());
82     caloMet->SetCaloMetInpHF(inCaloMet->CaloMETInpHF());
83     caloMet->SetCaloMetInmHF(inCaloMet->CaloMETInmHF());
84     caloMet->SetCaloMetPhiInpHF(inCaloMet->CaloMETPhiInpHF());
85     caloMet->SetCaloMetPhiInmHF(inCaloMet->CaloMETPhiInmHF());
86 loizides 1.1 }
87    
88 ksung 1.6 caloMets_->Trim();
89 loizides 1.1 }