1 |
bendavid |
1.14 |
// $Id: FillerCaloMet.cc,v 1.13 2009/09/25 08:42:50 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitProd/TreeFiller/interface/FillerCaloMet.h"
|
4 |
|
|
#include "DataFormats/METReco/interface/CaloMET.h"
|
5 |
loizides |
1.12 |
#include "DataFormats/METReco/interface/CaloMETCollection.h"
|
6 |
|
|
#include "MitAna/DataTree/interface/CaloMetCol.h"
|
7 |
loizides |
1.1 |
#include "MitAna/DataTree/interface/Names.h"
|
8 |
loizides |
1.12 |
#include "MitProd/ObjectService/interface/ObjectService.h"
|
9 |
loizides |
1.1 |
|
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 |
loizides |
1.5 |
BaseFiller(cfg,name,active),
|
17 |
loizides |
1.4 |
edmName_(Conf().getUntrackedParameter<string>("edmName","met")),
|
18 |
ksung |
1.6 |
mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkCaloMetBrn)),
|
19 |
bendavid |
1.10 |
caloMets_(new mithep::CaloMetArr)
|
20 |
loizides |
1.1 |
{
|
21 |
|
|
// Constructor.
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
//--------------------------------------------------------------------------------------------------
|
25 |
|
|
FillerCaloMet::~FillerCaloMet()
|
26 |
|
|
{
|
27 |
|
|
// Destructor.
|
28 |
|
|
|
29 |
ksung |
1.6 |
delete caloMets_;
|
30 |
loizides |
1.1 |
}
|
31 |
|
|
|
32 |
|
|
//--------------------------------------------------------------------------------------------------
|
33 |
bendavid |
1.14 |
void FillerCaloMet::BookDataBlock(TreeWriter &tws)
|
34 |
loizides |
1.1 |
{
|
35 |
|
|
// Add mets branch to tree.
|
36 |
|
|
|
37 |
loizides |
1.11 |
tws.AddBranch(mitName_,&caloMets_);
|
38 |
|
|
OS()->add<mithep::CaloMetArr>(caloMets_,mitName_);
|
39 |
loizides |
1.1 |
}
|
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 |
bendavid |
1.9 |
caloMets_->Delete();
|
48 |
loizides |
1.1 |
|
49 |
ksung |
1.6 |
Handle<reco::CaloMETCollection> hCaloMetProduct;
|
50 |
|
|
GetProduct(edmName_, hCaloMetProduct, event);
|
51 |
loizides |
1.1 |
|
52 |
ksung |
1.6 |
const reco::CaloMETCollection inCaloMets = *(hCaloMetProduct.product());
|
53 |
loizides |
1.1 |
|
54 |
|
|
// loop through all mets
|
55 |
ksung |
1.6 |
for (reco::CaloMETCollection::const_iterator inCaloMet = inCaloMets.begin();
|
56 |
|
|
inCaloMet != inCaloMets.end(); ++inCaloMet) {
|
57 |
loizides |
1.1 |
|
58 |
bendavid |
1.10 |
mithep::CaloMet *caloMet = caloMets_->Allocate();
|
59 |
|
|
new (caloMet) mithep::CaloMet(inCaloMet->px(), inCaloMet->py());
|
60 |
ksung |
1.6 |
|
61 |
loizides |
1.11 |
// fill Met base class data
|
62 |
ksung |
1.6 |
caloMet->SetSumEt(inCaloMet->sumEt());
|
63 |
loizides |
1.8 |
caloMet->SetElongitudinal(inCaloMet->e_longitudinal());
|
64 |
ksung |
1.6 |
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 |
loizides |
1.11 |
// fill CaloMet class data
|
70 |
bendavid |
1.10 |
caloMet->SetCaloMetSig(inCaloMet->metSignificance());
|
71 |
ksung |
1.6 |
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 |
loizides |
1.1 |
}
|
89 |
ksung |
1.6 |
caloMets_->Trim();
|
90 |
loizides |
1.1 |
}
|