40 theMuonCollectionLabel(par.getParameter<
InputTag>(
"inputMuonCollection")),
41 optOutputIsoDeposits(par.getParameter<
bool>(
"OutputMuIsoDeposits")),
42 useCaloIso(par.existsAs<
bool>(
"UseCaloIso") ?
43 par.getParameter<
bool>(
"UseCaloIso") :
true),
44 useRhoCorrectedCaloDeps(par.existsAs<
bool>(
"UseRhoCorrectedCaloDeposits") ?
45 par.getParameter<
bool>(
"UseRhoCorrectedCaloDeposits") :
false),
46 theCaloDepsLabel(par.existsAs<
InputTag>(
"CaloDepositsLabel") ?
47 par.getParameter<
InputTag>(
"CaloDepositsLabel") :
48 InputTag(
"hltL3CaloMuonCorrectedIsolations")),
50 printDebug (par.getParameter<
bool>(
"printDebug"))
52 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<
" L3MuonCombinedRelativeIsolationProducer CTOR";
58 produces<reco::IsoDepositMap>(
"trkIsoDeposits");
60 produces<reco::IsoDepositMap>(
"caloIsoDeposits");
62 produces<edm::ValueMap<double> >(
"combinedRelativeIsoDeposits");
64 produces<edm::ValueMap<bool> >();
93 if (cutsName ==
"SimpleCuts") {
100 (cutsName==
"L3NominalEfficiencyCuts_PXLS" )
101 || (cutsName==
"L3NominalEfficiencyCuts_TRKS") ) {
105 LogError(
"L3MuonCombinedRelativeIsolationProducer::beginJob")
106 <<
"cutsName: "<<cutsPSet<<
" is not recognized:" 107 <<
" theCuts not set!";
119 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<
" L3MuonCombinedRelativeIsolationProducer DTOR";
125 desc.
add<
bool>(
"UseRhoCorrectedCaloDeposits",
false);
126 desc.
add<
bool>(
"UseCaloIso",
true);
129 desc.
add<
bool>(
"OutputMuIsoDeposits",
true);
130 desc.
add<
double>(
"TrackPt_Min",-1.0);
131 desc.
add<
bool>(
"printDebug",
false);
134 cutsPSet.
add<std::vector<double> >(
"ConeSizes",std::vector<double>(1, 0.24));
135 cutsPSet.add<
std::string>(
"ComponentName",
"SimpleCuts");
136 cutsPSet.add<std::vector<double> >(
"Thresholds",std::vector<double>(1, 0.1));
137 cutsPSet.add<
int>(
"maxNTracks",-1);
138 cutsPSet.add<std::vector<double> >(
"EtaBounds",std::vector<double>(1, 2.411));
139 cutsPSet.add<
bool>(
"applyCutsORmaxNTracks",
false);
144 trkExtractorPSet.
add<
double>(
"Chi2Prob_Min", -1.0);
145 trkExtractorPSet.add<
double>(
"Chi2Ndof_Max", 1.0E64);
146 trkExtractorPSet.add<
double>(
"Diff_z",0.2);
148 trkExtractorPSet.add<
double>(
"ReferenceRadius",6.0);
150 trkExtractorPSet.add<
std::string>(
"ComponentName",
"PixelTrackExtractor");
151 trkExtractorPSet.add<
double>(
"DR_Max",0.24);
152 trkExtractorPSet.add<
double>(
"Diff_r",0.1);
153 trkExtractorPSet.add<
bool>(
"VetoLeadingTrack",
true);
154 trkExtractorPSet.add<
double>(
"DR_VetoPt",0.025);
155 trkExtractorPSet.add<
double>(
"DR_Veto",0.01);
156 trkExtractorPSet.add<
unsigned int>(
"NHits_Min",0);
157 trkExtractorPSet.add<
double>(
"Pt_Min",-1.0);
158 trkExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"PXLS");
159 trkExtractorPSet.add<
std::string>(
"BeamlineOption",
"BeamSpotFromEvent");
160 trkExtractorPSet.add<
bool>(
"PropagateTracksToRadius",
true);
161 trkExtractorPSet.add<
double>(
"PtVeto_Min",2.0);
166 caloExtractorPSet.
add<
double>(
"DR_Veto_H",0.1);
167 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_Z",
false);
168 caloExtractorPSet.add<
double>(
"Threshold_H",0.5);
169 caloExtractorPSet.add<
std::string>(
"ComponentName",
"CaloExtractor");
170 caloExtractorPSet.add<
double>(
"Threshold_E",0.2);
171 caloExtractorPSet.add<
double>(
"DR_Max",0.24);
172 caloExtractorPSet.add<
double>(
"DR_Veto_E",0.07);
173 caloExtractorPSet.add<
double>(
"Weight_E",1.5);
174 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_XY",
false);
175 caloExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"EcalPlusHcal");
177 caloExtractorPSet.add<
double>(
"Weight_H",1.0);
180 descriptions.
add(
"hltL3MuonIsolations", desc);
188 <<
" BEGINING OF EVENT " <<
"================================" <<std::endl;
200 auto caloDepMap = std::make_unique<reco::IsoDepositMap>();
201 auto trkDepMap = std::make_unique<reco::IsoDepositMap>();
203 auto comboIsoDepMap = std::make_unique<edm::ValueMap<bool>>();
206 auto combinedRelativeDepMap = std::make_unique<edm::ValueMap<double>>();
212 unsigned int nMuons = muons->size();
214 IsoDeposit::Vetos trkVetos(nMuons);
215 std::vector<IsoDeposit> trkDeps(nMuons);
222 IsoDeposit::Vetos caloVetos;
223 std::vector<IsoDeposit> caloDeps;
224 std::vector<float> caloCorrDeps;
227 caloCorrDeps.resize(nMuons, 0.);
230 caloVetos.resize(nMuons);
231 caloDeps.resize(nMuons);
234 std::vector<double> combinedRelativeDeps(nMuons, 0.);
235 std::vector<bool> combinedRelativeIsos(nMuons,
false);
243 trkVetos[
i] = trkDeps[
i].veto();
246 caloCorrDeps[
i] = (*caloDepWithCorrMap)[candref];
250 caloVetos[
i] = caloDeps[
i].veto();
265 for(
unsigned int iMu=0; iMu <
nMuons; ++iMu){
271 const Cuts::CutSpec &
cut =
theCuts( mu->eta());
275 <<
"CUTDEBUG: Muon pt = " << mu->pt() << std::endl
276 <<
"CUTDEBUG: minEta = " << cut.etaRange.min() << std::endl
277 <<
"CUTDEBUG: maxEta = " << cut.etaRange.max() << std::endl
278 <<
"CUTDEBUG: consize = " << cut.conesize << std::endl
279 <<
"CUTDEBUG: thresho = " << cut.threshold << std::endl;
285 double caloIsoSum = 0.;
287 caloIsoSum = caloCorrDeps[iMu];
288 if(caloIsoSum<0.) caloIsoSum = 0.;
289 if(
printDebug)
std::cout <<
"Rho-corrected calo deposit (min. 0) = " << caloIsoSum << std::endl;
292 const IsoDeposit & caloDeposit = caloDeps[iMu];
294 caloIsoSum = caloDeposit.
depositWithin(cut.conesize, caloVetos);
297 double trkIsoSum = trkIsoSumAndCount.first;
298 int count = trkIsoSumAndCount.second;
300 double muPt = mu->pt();
301 if( muPt<1. ) muPt = 1.;
302 double combinedRelativeDeposit = ((trkIsoSum + caloIsoSum ) / muPt);
303 bool result = ( combinedRelativeDeposit < cut.threshold);
305 if (
printDebug)
std::cout <<
" trk dep in cone: " << trkIsoSum <<
" with count "<<count <<std::endl
306 <<
" calo dep in cone: " << caloIsoSum << std::endl
307 <<
" muPt: " << muPt << std::endl
308 <<
" relIso: " <<combinedRelativeDeposit << std::endl
309 <<
" is isolated: "<<result << std::endl;
311 combinedRelativeIsos[iMu] =
result;
313 combinedRelativeDeps[iMu] = combinedRelativeDeposit;
322 depFillerTrk.
insert(muons, trkDeps.begin(), trkDeps.end());
324 event.put(
std::move(trkDepMap),
"trkIsoDeposits");
328 depFillerCalo.
insert(muons, caloDeps.begin(), caloDeps.end());
329 depFillerCalo.
fill();
330 event.put(
std::move(caloDepMap),
"caloIsoDeposits");
335 depFillerCombRel.
insert(muons, combinedRelativeDeps.begin(), combinedRelativeDeps.end());
336 depFillerCombRel.
fill();
337 event.put(
std::move(combinedRelativeDepMap),
"combinedRelativeIsoDeposits");
341 isoFiller.
insert(muons, combinedRelativeIsos.begin(), combinedRelativeIsos.end());
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
T getParameter(std::string const &) const
edm::InputTag theMuonCollectionLabel
edm::EDGetTokenT< edm::ValueMap< float > > theCaloDepsToken
const std::string metname
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
void insert(const H &h, I begin, I end)
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > trkExtractor
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
std::string print() const
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterSet descriptions.
muonisolation::Cuts theCuts
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > caloExtractor
~L3MuonCombinedRelativeIsolationProducer() override
destructor
ParameterDescriptionBase * add(U const &iLabel, T const &value)
muonisolation::Cuts cuts() const
void produce(edm::Event &, const edm::EventSetup &) override
Produce isolation maps.
L3MuonCombinedRelativeIsolationProducer(const edm::ParameterSet &)
constructor with config
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool useCaloIso
flag to include or exclude calo iso from calculation
bool optOutputIsoDeposits
edm::InputTag theCaloDepsLabel
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.
std::string print() const
bool useRhoCorrectedCaloDeps
edm::ParameterSet theConfig
T get(const Candidate &c)