4 #include <cp3_llbb/Framework/interface/Producer.h>
5 #include <cp3_llbb/Framework/interface/PUReweighter.h>
6 #include <cp3_llbb/Framework/interface/GenInfoAndWeights.h>
8 #include <SimDataFormats/PileupSummaryInfo/interface/PileupSummaryInfo.h>
10 #include <DataFormats/DetId/interface/DetIdCollection.h>
14 EventProducer(
const std::string& name,
const ROOT::TreeGroup&
tree,
const edm::ParameterSet& config):
18 if (config.getUntrackedParameter<
bool>(
"compute_pu_weights",
true)) {
19 std::string puProfileString = config.getUntrackedParameter<std::string>(
"pu_profile");
20 Framework::PUProfile puProfile = Framework::stringToPUProfile(puProfileString);
21 m_pu_reweighter = std::make_shared<Framework::PUReweighter>(config.getParameterSet(
"pu_reweighter"), puProfile);
22 m_pu_reweighter_up = std::make_shared<Framework::PUReweighter>(config.getParameterSet(
"pu_reweighter_up"), puProfile);
23 m_pu_reweighter_down = std::make_shared<Framework::PUReweighter>(config.getParameterSet(
"pu_reweighter_down"), puProfile);
29 virtual void doConsumes(
const edm::ParameterSet& config, edm::ConsumesCollector&& collector)
override {
30 m_rho_token = collector.consumes<
double>(config.getUntrackedParameter<edm::InputTag>(
"rho", edm::InputTag(
"fixedGridRhoFastjetAll")));
31 m_pu_info_token = collector.consumes<std::vector<PileupSummaryInfo>>(config.getUntrackedParameter<edm::InputTag>(
"pu_summary", edm::InputTag(
"addPileupInfo")));
33 m_genInfoWeightsToken = collector.consumes<
Framework::GenInfoAndWeights>(config.getUntrackedParameter<edm::InputTag>(
"genInfoWeights", edm::InputTag(
"genInfoEventWeights")));
35 m_dupECALClusters_token = collector.consumes<
bool>(edm::InputTag(
"particleFlowEGammaGSFixed",
"dupECALClusters"));
36 m_hitsNotReplaced_token = collector.consumes<DetIdCollection>(edm::InputTag(
"ecalMultiAndGSGlobalRecHitEB",
"hitsNotReplaced"));
39 virtual void produce(edm::Event& event,
const edm::EventSetup& eventSetup)
override;
44 edm::EDGetTokenT<double> m_rho_token;
45 edm::EDGetTokenT<std::vector<PileupSummaryInfo>> m_pu_info_token;
47 edm::EDGetTokenT<Framework::GenInfoAndWeights> m_genInfoWeightsToken;
50 edm::EDGetTokenT<bool> m_dupECALClusters_token;
51 edm::EDGetTokenT<DetIdCollection> m_hitsNotReplaced_token;
53 std::shared_ptr<Framework::PUReweighter> m_pu_reweighter;
54 std::shared_ptr<Framework::PUReweighter> m_pu_reweighter_up;
55 std::shared_ptr<Framework::PUReweighter> m_pu_reweighter_down;
60 BRANCH(run, ULong64_t);
61 BRANCH(lumi, ULong64_t);
62 BRANCH(event, ULong64_t);
63 BRANCH(is_data,
bool);
68 BRANCH(true_interactions,
float);
69 BRANCH(pu_weight,
float);
70 BRANCH(pu_weight_up,
float);
71 BRANCH(pu_weight_down,
float);
74 BRANCH(dupECALClusters,
bool);
75 BRANCH(hitsNotReplacedEmpty,
bool);
77 BRANCH(pt_hat,
float);
79 BRANCH(weight,
float);
81 BRANCH(alpha_QCD,
float);
82 BRANCH(alpha_QED,
float);
83 BRANCH(q_scale,
float);
84 uint32_t& pdf_set =
tree[
"pdf_set"].write<uint32_t>(
false);
85 BRANCH(pdf_id, std::pair<int, int>);
86 BRANCH(pdf_x, std::pair<float, float>);
87 BRANCH(pdf_weight,
float);
88 BRANCH(pdf_weight_up,
float);
89 BRANCH(pdf_weight_down,
float);
90 BRANCH(hdamp_weight_up,
float);
91 BRANCH(hdamp_weight_down,
float);
93 BRANCH(initial_state, uint8_t);
95 BRANCH(pdf_weight_gg,
float);
96 BRANCH(pdf_weight_gg_up,
float);
97 BRANCH(pdf_weight_gg_down,
float);
99 BRANCH(pdf_weight_qq,
float);
100 BRANCH(pdf_weight_qq_up,
float);
101 BRANCH(pdf_weight_qq_down,
float);
103 BRANCH(pdf_weight_qg,
float);
104 BRANCH(pdf_weight_qg_up,
float);
105 BRANCH(pdf_weight_qg_down,
float);
107 BRANCH(n_ME_partons,
int);
108 BRANCH(n_ME_partons_filtered,
int);
110 BRANCH(lhe_originalXWGTUP,
float);
111 BRANCH(lhe_SCALUP,
float);
112 TRANSIENT_BRANCH(lhe_weights, std::vector<std::pair<std::string, float>>);
114 BRANCH(scale_weights, std::vector<float>);
Definition: EventProducer.h:12
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Main method of the producer, called for each event.
Definition: EventProducer.cc:3
virtual void doConsumes(const edm::ParameterSet &config, edm::ConsumesCollector &&collector) override
Hook for the CMSSW consumes interface.
Definition: EventProducer.h:29
Base class for Framework producers.
Definition: Producer.h:33
ROOT::TreeGroup tree
Access point to output tree.
Definition: Producer.h:132
Producer(const std::string &name, const ROOT::TreeGroup &tree_, const edm::ParameterSet &config)
Base constructor.
Definition: Producer.h:46
Definition: GenInfoAndWeights.h:17