4 |
|
#include "MitAna/DataTree/interface/Names.h" |
5 |
|
#include "MitAna/DataTree/interface/EmbedWeightCol.h" |
6 |
|
#include "MitProd/ObjectService/interface/ObjectService.h" |
7 |
+ |
#include "SimDataFormats/GeneratorProducts/interface/GenFilterInfo.h" |
8 |
|
|
9 |
|
using namespace std; |
10 |
|
using namespace edm; |
14 |
|
FillerEmbedWeight::FillerEmbedWeight(const ParameterSet &cfg, const char *name, bool active) : |
15 |
|
BaseFiller(cfg,name,active), |
16 |
|
edmName_(Conf().getUntrackedParameter<string>("edmName","generator_weight")), |
17 |
+ |
genInfo_(Conf().getUntrackedParameter<bool> ("useGenInfo","True")), |
18 |
|
mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkEmbedWeightBrn)), |
19 |
|
embedWeight_(new mithep::EmbedWeightArr) |
20 |
|
{ |
44 |
|
{ |
45 |
|
// Fill missing energy from edm collection into our collection. |
46 |
|
embedWeight_->Delete(); |
47 |
< |
Handle<double> hEmbedWeight; |
48 |
< |
//GetProduct(edmName_, hEmbedWeight, event); |
49 |
< |
event.getByLabel(edm::InputTag(edmName_,"weight","EmbeddedRECO"),hEmbedWeight); |
50 |
< |
|
51 |
< |
const double inEmbedWeight = *(hEmbedWeight.product()); |
47 |
> |
|
48 |
> |
double inEmbedWeightValue = 0; |
49 |
> |
if(!genInfo_) { |
50 |
> |
Handle<double> hEmbedWeight; |
51 |
> |
event.getByLabel(edm::InputTag(edmName_,"weight","EmbeddedRECO"),hEmbedWeight); |
52 |
> |
inEmbedWeightValue = *(hEmbedWeight.product()); |
53 |
> |
} else { |
54 |
> |
edm::Handle<GenFilterInfo> hGenFilterInfo; |
55 |
> |
event.getByLabel(edm::InputTag(edmName_, "minVisPtFilter", "EmbeddedRECO"), hGenFilterInfo); |
56 |
> |
inEmbedWeightValue = hGenFilterInfo->filterEfficiency(); |
57 |
> |
} |
58 |
> |
const double inEmbedWeight = inEmbedWeightValue; |
59 |
|
mithep::EmbedWeight *embedWeight = embedWeight_->Allocate(); |
60 |
|
new (embedWeight) mithep::EmbedWeight(inEmbedWeight); |
61 |
|
//embedWeight->SetWeight(inEmbedWeight); |