44 #include <CLHEP/Random/RandFlat.h>
45 #include <CLHEP/Random/RandGauss.h>
50 produces<std::vector<reco::Muon> >();
59 std::vector<double> defEtaEdges;
60 defEtaEdges.push_back(-999999.);
61 defEtaEdges.push_back(999999.);
62 etaBinEdges_ =
pset.getUntrackedParameter<std::vector<double> >(
"EtaBinEdges", defEtaEdges);
66 std::vector<double> defDistortion;
67 defDistortion.push_back(0.);
70 pset.getUntrackedParameter<std::vector<double> >(
"ShiftOnOneOverPt", defDistortion);
72 for (
unsigned int i = 1;
i < ninputs_expected;
i++) {
79 for (
unsigned int i = 1;
i < ninputs_expected;
i++) {
85 pset.getUntrackedParameter<std::vector<double> >(
"UncertaintyOnOneOverPt", defDistortion);
87 for (
unsigned int i = 1;
i < ninputs_expected;
i++) {
94 for (
unsigned int i = 1;
i < ninputs_expected;
i++) {
100 std::vector<double> defEfficiencyRatio;
101 defEfficiencyRatio.push_back(1.);
103 pset.getUntrackedParameter<std::vector<double> >(
"EfficiencyRatioOverMC", defEfficiencyRatio);
105 for (
unsigned int i = 1;
i < ninputs_expected;
i++) {
115 if (effWrong and momWrong) {
117 <<
"WARNING: DistortedMuonProducer : Size of some parameters do not match the EtaBinEdges vector!!";
138 edm::LogError(
"") <<
">>> Muon collection does not exist !!!";
144 edm::LogError(
"") <<
">>> Muon-GenParticle match map does not exist !!!";
152 for (
unsigned int i = 0;
i < muonCollectionSize;
i++) {
155 double ptgen =
mu->pt();
156 double etagen =
mu->eta();
161 LogTrace(
"") <<
">>> Muon-GenParticle match found; ptmu= " <<
mu->pt() <<
", ptgen= " << ptgen;
163 LogTrace(
"") <<
">>> MUON-GENPARTICLE MATCH NOT FOUND!!!";
167 double effRatio = 0.;
177 for (
unsigned int j = 1;
j <=
nbins; ++
j) {
185 LogTrace(
"") <<
">>> etaBin: " <<
etaBin <<
", for etagen =" << etagen;
188 LogTrace(
"") <<
">>> Muon outside eta range: reject it; etagen = " << etagen;
195 LogTrace(
"") <<
"\tshiftOnOneOverPt= " << shift1 * 100 <<
" [%]";
196 LogTrace(
"") <<
"\trelativeShiftOnPt= " << shift2 * 100 <<
" [%]";
201 LogTrace(
"") <<
"\tuncertaintyOnOneOverPt= " << sigma1 <<
" [1/GeV]";
202 LogTrace(
"") <<
"\trelativeUncertaintyOnPt= " << sigma2 * 100 <<
" [%]";
206 LogTrace(
"") <<
"\tefficiencyRatioOverMC= " << effRatio;
209 double rndf = CLHEP::RandFlat::shoot();
214 double rndg1 = CLHEP::RandGauss::shoot();
215 double rndg2 = CLHEP::RandGauss::shoot();
218 double ptmu =
mu->pt();
219 ptmu += ptgen * (shift1 * ptgen + shift2 + sigma1 * rndg1 * ptgen + sigma2 * rndg2);