72 TFile* file_prefiringmaps_;
75 file_prefiringmaps_ =
new TFile(mapsfilepath.fullPath().c_str(),
"read");
77 std::cout <<
"File with maps not found. All prefiring weights set to 0. " << std::endl;
79 TString mapphotonfullname =
"L1prefiring_photonptvseta_" +
dataera_;
80 if (!file_prefiringmaps_->Get(mapphotonfullname) && !
skipwarnings_)
81 std::cout <<
"Photon map not found. All photons prefiring weights set to 0. " << std::endl;
85 if (!file_prefiringmaps_->Get(mapjetfullname) && !
skipwarnings_)
86 std::cout <<
"Jet map not found. All jets prefiring weights set to 0. " << std::endl;
87 h_prefmap_jet = (TH2F*)file_prefiringmaps_->Get(mapjetfullname);
88 file_prefiringmaps_->Close();
89 delete file_prefiringmaps_;
90 produces<double>(
"nonPrefiringProb").setBranchAlias(
"nonPrefiringProb");
91 produces<double>(
"nonPrefiringProbUp").setBranchAlias(
"nonPrefiringProbUp");
92 produces<double>(
"nonPrefiringProbDown").setBranchAlias(
"nonPrefiringProbDown");
113 double nonPrefiringProba[3] = {1., 1., 1.};
116 for (
const auto&
photon : *thePhotons) {
117 double pt_gam =
photon.pt();
118 double eta_gam =
photon.eta();
121 if (fabs(eta_gam) < 2.)
123 if (fabs(eta_gam) > 3.)
126 nonPrefiringProba[fluct] *= (1. - prefiringprob_gam);
130 for (
const auto&
jet : *theJets) {
131 double pt_jet =
jet.pt();
132 double eta_jet =
jet.eta();
133 double phi_jet =
jet.phi();
136 if (fabs(eta_jet) < 2.)
138 if (fabs(eta_jet) > 3.)
143 double nonprefiringprobfromoverlappingphotons = 1.;
144 for (
const auto&
photon : *thePhotons) {
145 double pt_gam =
photon.pt();
146 double eta_gam =
photon.eta();
147 double phi_gam =
photon.phi();
150 if (fabs(eta_gam) < 2.)
152 if (fabs(eta_gam) > 3.)
158 nonprefiringprobfromoverlappingphotons *= (1. - prefiringprob_gam);
162 pt_jet *= (
jet.neutralEmEnergyFraction() +
jet.chargedEmEnergyFraction());
165 if (nonprefiringprobfromoverlappingphotons == 1.) {
166 nonPrefiringProba[fluct] *= nonprefiringprobfromoverlappingjet;
169 else if (nonprefiringprobfromoverlappingphotons > nonprefiringprobfromoverlappingjet) {
170 if (nonprefiringprobfromoverlappingphotons != 0.) {
171 nonPrefiringProba[fluct] *= nonprefiringprobfromoverlappingjet / nonprefiringprobfromoverlappingphotons;
173 nonPrefiringProba[fluct] = 0.;
180 auto nonPrefiringProb = std::make_unique<double>(nonPrefiringProba[0]);
181 auto nonPrefiringProbUp = std::make_unique<double>(nonPrefiringProba[1]);
182 auto nonPrefiringProbDown = std::make_unique<double>(nonPrefiringProba[2]);
193 std::cout <<
"Prefiring map not found, setting prefiring rate to 0 " << std::endl;
194 if (h_prefmap ==
nullptr)
197 int nbinsy = h_prefmap->GetNbinsY();
198 double maxy = h_prefmap->GetYaxis()->GetBinLowEdge(nbinsy + 1);
201 int thebin = h_prefmap->FindBin(
eta,
pt);
203 double prefrate = h_prefmap->GetBinContent(thebin);
205 double statuncty = h_prefmap->GetBinError(thebin);
208 if (fluctuation ==
up)
210 if (fluctuation ==
down)
223 desc.add<
bool>(
"UseJetEMPt",
false);
224 desc.add<
double>(
"PrefiringRateSystematicUncty", 0.2);
225 desc.add<
double>(
"JetMaxMuonFraction", 0.5);
226 desc.add<
bool>(
"SkipWarnings",
true);
227 descriptions.
add(
"l1ECALPrefiringWeightProducer",
desc);