70 TFile* file_prefiringmaps_;
73 file_prefiringmaps_ =
new TFile(mapsfilepath.fullPath().c_str(),
"read");
75 std::cout <<
"File with maps not found. All prefiring weights set to 0. " << std::endl;
77 TString mapphotonfullname =
"L1prefiring_photonptvseta_" +
dataera_;
78 if (!file_prefiringmaps_->Get(mapphotonfullname) && !
skipwarnings_)
79 std::cout <<
"Photon map not found. All photons prefiring weights set to 0. " << std::endl;
83 if (!file_prefiringmaps_->Get(mapjetfullname) && !
skipwarnings_)
84 std::cout <<
"Jet map not found. All jets prefiring weights set to 0. " << std::endl;
85 h_prefmap_jet = (TH2F*)file_prefiringmaps_->Get(mapjetfullname);
86 file_prefiringmaps_->Close();
87 delete file_prefiringmaps_;
88 produces<double>(
"nonPrefiringProb").setBranchAlias(
"nonPrefiringProb");
89 produces<double>(
"nonPrefiringProbUp").setBranchAlias(
"nonPrefiringProbUp");
90 produces<double>(
"nonPrefiringProbDown").setBranchAlias(
"nonPrefiringProbDown");
111 double nonPrefiringProba[3] = {1., 1., 1.};
114 for (
const auto&
photon : *thePhotons) {
115 double pt_gam =
photon.pt();
116 double eta_gam =
photon.eta();
119 if (fabs(eta_gam) < 2.)
121 if (fabs(eta_gam) > 3.)
124 nonPrefiringProba[fluct] *= (1. - prefiringprob_gam);
128 for (
const auto&
jet : *theJets) {
129 double pt_jet =
jet.pt();
130 double eta_jet =
jet.eta();
131 double phi_jet =
jet.phi();
134 if (fabs(eta_jet) < 2.)
136 if (fabs(eta_jet) > 3.)
140 double nonprefiringprobfromoverlappingphotons = 1.;
141 for (
const auto&
photon : *thePhotons) {
142 double pt_gam =
photon.pt();
143 double eta_gam =
photon.eta();
144 double phi_gam =
photon.phi();
147 if (fabs(eta_gam) < 2.)
149 if (fabs(eta_gam) > 3.)
155 nonprefiringprobfromoverlappingphotons *= (1. - prefiringprob_gam);
159 pt_jet *= (
jet.neutralEmEnergyFraction() +
jet.chargedEmEnergyFraction());
162 if (nonprefiringprobfromoverlappingphotons == 1.) {
163 nonPrefiringProba[fluct] *= nonprefiringprobfromoverlappingjet;
166 else if (nonprefiringprobfromoverlappingphotons > nonprefiringprobfromoverlappingjet) {
167 if (nonprefiringprobfromoverlappingphotons != 0.) {
168 nonPrefiringProba[fluct] *= nonprefiringprobfromoverlappingjet / nonprefiringprobfromoverlappingphotons;
170 nonPrefiringProba[fluct] = 0.;
177 auto nonPrefiringProb = std::make_unique<double>(nonPrefiringProba[0]);
178 auto nonPrefiringProbUp = std::make_unique<double>(nonPrefiringProba[1]);
179 auto nonPrefiringProbDown = std::make_unique<double>(nonPrefiringProba[2]);
190 std::cout <<
"Prefiring map not found, setting prefiring rate to 0 " << std::endl;
191 if (h_prefmap ==
nullptr)
194 int nbinsy = h_prefmap->GetNbinsY();
195 double maxy = h_prefmap->GetYaxis()->GetBinLowEdge(nbinsy + 1);
198 int thebin = h_prefmap->FindBin(
eta,
pt);
200 double prefrate = h_prefmap->GetBinContent(thebin);
202 double statuncty = h_prefmap->GetBinError(thebin);
205 if (fluctuation ==
up)
207 if (fluctuation ==
down)
220 desc.add<
bool>(
"UseJetEMPt",
false);
221 desc.add<
double>(
"PrefiringRateSystematicUncty", 0.2);
222 desc.add<
bool>(
"SkipWarnings",
true);
223 descriptions.
add(
"l1ECALPrefiringWeightProducer",
desc);