1 |
pharris |
1.1 |
// $Id: FillerCaloMet.cc,v 1.14 2010/03/18 20:21:00 bendavid Exp $
|
2 |
|
|
|
3 |
|
|
#include "MitProd/TreeFiller/interface/FillerEmbedWeight.h"
|
4 |
|
|
#include "MitAna/DataTree/interface/Names.h"
|
5 |
|
|
#include "MitAna/DataTree/interface/EmbedWeightCol.h"
|
6 |
|
|
#include "MitProd/ObjectService/interface/ObjectService.h"
|
7 |
|
|
|
8 |
|
|
using namespace std;
|
9 |
|
|
using namespace edm;
|
10 |
|
|
using namespace mithep;
|
11 |
|
|
|
12 |
|
|
//--------------------------------------------------------------------------------------------------
|
13 |
|
|
FillerEmbedWeight::FillerEmbedWeight(const ParameterSet &cfg, const char *name, bool active) :
|
14 |
|
|
BaseFiller(cfg,name,active),
|
15 |
|
|
edmName_(Conf().getUntrackedParameter<string>("edmName","generator_weight")),
|
16 |
|
|
mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkEmbedWeightBrn)),
|
17 |
|
|
embedWeight_(new mithep::EmbedWeightArr)
|
18 |
|
|
{
|
19 |
|
|
// Constructor.
|
20 |
|
|
}
|
21 |
|
|
|
22 |
|
|
//--------------------------------------------------------------------------------------------------
|
23 |
|
|
FillerEmbedWeight::~FillerEmbedWeight()
|
24 |
|
|
{
|
25 |
|
|
// Destructor.
|
26 |
|
|
|
27 |
|
|
delete embedWeight_;
|
28 |
|
|
}
|
29 |
|
|
|
30 |
|
|
//--------------------------------------------------------------------------------------------------
|
31 |
|
|
void FillerEmbedWeight::BookDataBlock(TreeWriter &tws)
|
32 |
|
|
{
|
33 |
|
|
// Add mets branch to tree.
|
34 |
|
|
|
35 |
|
|
tws.AddBranch(mitName_,&embedWeight_);
|
36 |
|
|
OS()->add<mithep::EmbedWeightArr>(embedWeight_,mitName_);
|
37 |
|
|
}
|
38 |
|
|
|
39 |
|
|
//--------------------------------------------------------------------------------------------------
|
40 |
|
|
void FillerEmbedWeight::FillDataBlock(const edm::Event &event,
|
41 |
|
|
const edm::EventSetup &setup)
|
42 |
|
|
{
|
43 |
|
|
// Fill missing energy from edm collection into our collection.
|
44 |
|
|
|
45 |
|
|
Handle<double> hEmbedWeight;
|
46 |
|
|
//GetProduct(edmName_, hEmbedWeight, event);
|
47 |
|
|
event.getByLabel(edm::InputTag(edmName_,"weight","EmbeddedRECO"),hEmbedWeight);
|
48 |
|
|
|
49 |
|
|
const double inEmbedWeight = *(hEmbedWeight.product());
|
50 |
|
|
mithep::EmbedWeight *embedWeight = embedWeight_->Allocate();
|
51 |
|
|
new (embedWeight) mithep::EmbedWeight(inEmbedWeight);
|
52 |
|
|
//embedWeight->SetWeight(inEmbedWeight);
|
53 |
|
|
embedWeight_->Trim();
|
54 |
|
|
}
|