ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerCaloMet.cc
Revision: 1.14
Committed: Thu Mar 18 20:21:00 2010 UTC (15 years, 1 month ago) by bendavid
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_032, Mit_031, Mit_025c_branch2, Mit_025c_branch1, Mit_030, Mit_029c, Mit_029b, Mit_030_pre1, Mit_029a, Mit_029, Mit_029_pre1, Mit_028a, Mit_025c_branch0, Mit_028, Mit_027a, Mit_027, Mit_026, Mit_025e, Mit_025d, Mit_025c, Mit_025b, Mit_025a, Mit_025, Mit_025pre2, Mit_024b, Mit_025pre1, Mit_024a, Mit_024, Mit_023, Mit_022a, Mit_022, Mit_020d, TMit_020d, Mit_020c, Mit_021, Mit_021pre2, Mit_021pre1, Mit_020b, Mit_020a, Mit_020, Mit_020pre1, Mit_018, Mit_017, Mit_017pre3, Mit_017pre2, Mit_017pre1, Mit_016, Mit_015b, Mit_015a, Mit_015, Mit_014e, Mit_014d, Mit_014c, Mit_014b, Mit_014a, Mit_014, Mit_014pre3, Mit_014pre2, Mit_014pre1, Mit_013d, Mit_013c, Mit_013b, Mit_013a, Mit_013, HEAD
Branch point for: Mit_025c_branch
Changes since 1.13: +2 -2 lines
Error occurred while calculating annotation data.
Log Message:
Fix beginrun,beginjob mess

File Contents

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