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")),
52 printDebug (par.getParameter<bool>(
"printDebug"))
54 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<
" L3MuonCombinedRelativeIsolationProducer CTOR";
60 produces<reco::IsoDepositMap>(
"trkIsoDeposits");
62 produces<reco::IsoDepositMap>(
"caloIsoDeposits");
64 produces<edm::ValueMap<double> >(
"combinedRelativeIsoDeposits");
66 produces<edm::ValueMap<bool> >();
95 if (cutsName ==
"SimpleCuts") {
102 (cutsName==
"L3NominalEfficiencyCuts_PXLS" )
103 || (cutsName==
"L3NominalEfficiencyCuts_TRKS") ) {
107 LogError(
"L3MuonCombinedRelativeIsolationProducer::beginJob")
108 <<
"cutsName: "<<cutsPSet<<
" is not recognized:" 109 <<
" theCuts not set!";
121 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<
" L3MuonCombinedRelativeIsolationProducer DTOR";
129 desc.
add<
bool>(
"UseRhoCorrectedCaloDeposits",
false);
130 desc.
add<
bool>(
"UseCaloIso",
true);
133 desc.
add<
bool>(
"OutputMuIsoDeposits",
true);
134 desc.
add<
double>(
"TrackPt_Min",-1.0);
135 desc.
add<
bool>(
"printDebug",
false);
138 cutsPSet.
add<std::vector<double> >(
"ConeSizes",std::vector<double>(1, 0.24));
139 cutsPSet.add<
std::string>(
"ComponentName",
"SimpleCuts");
140 cutsPSet.add<std::vector<double> >(
"Thresholds",std::vector<double>(1, 0.1));
141 cutsPSet.add<
int>(
"maxNTracks",-1);
142 cutsPSet.add<std::vector<double> >(
"EtaBounds",std::vector<double>(1, 2.411));
143 cutsPSet.add<
bool>(
"applyCutsORmaxNTracks",
false);
148 trkExtractorPSet.
add<
double>(
"Chi2Prob_Min", -1.0);
149 trkExtractorPSet.add<
double>(
"Chi2Ndof_Max", 1.0E64);
150 trkExtractorPSet.add<
double>(
"Diff_z",0.2);
152 trkExtractorPSet.add<
double>(
"ReferenceRadius",6.0);
154 trkExtractorPSet.add<
std::string>(
"ComponentName",
"PixelTrackExtractor");
155 trkExtractorPSet.add<
double>(
"DR_Max",0.24);
156 trkExtractorPSet.add<
double>(
"Diff_r",0.1);
157 trkExtractorPSet.add<
bool>(
"VetoLeadingTrack",
true);
158 trkExtractorPSet.add<
double>(
"DR_VetoPt",0.025);
159 trkExtractorPSet.add<
double>(
"DR_Veto",0.01);
160 trkExtractorPSet.add<
unsigned int>(
"NHits_Min",0);
161 trkExtractorPSet.add<
double>(
"Pt_Min",-1.0);
162 trkExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"PXLS");
163 trkExtractorPSet.add<
std::string>(
"BeamlineOption",
"BeamSpotFromEvent");
164 trkExtractorPSet.add<
bool>(
"PropagateTracksToRadius",
true);
165 trkExtractorPSet.add<
double>(
"PtVeto_Min",2.0);
170 caloExtractorPSet.
add<
double>(
"DR_Veto_H",0.1);
171 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_Z",
false);
172 caloExtractorPSet.add<
double>(
"Threshold_H",0.5);
173 caloExtractorPSet.add<
std::string>(
"ComponentName",
"CaloExtractor");
174 caloExtractorPSet.add<
double>(
"Threshold_E",0.2);
175 caloExtractorPSet.add<
double>(
"DR_Max",0.24);
176 caloExtractorPSet.add<
double>(
"DR_Veto_E",0.07);
177 caloExtractorPSet.add<
double>(
"Weight_E",1.5);
178 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_XY",
false);
179 caloExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"EcalPlusHcal");
181 caloExtractorPSet.add<
double>(
"Weight_H",1.0);
184 descriptions.
add(
"hltL3MuonIsolations", desc);
192 <<
" BEGINING OF EVENT " <<
"================================" <<std::endl;
204 auto caloDepMap = std::make_unique<reco::IsoDepositMap>();
205 auto trkDepMap = std::make_unique<reco::IsoDepositMap>();
207 auto comboIsoDepMap = std::make_unique<edm::ValueMap<bool>>();
210 auto combinedRelativeDepMap = std::make_unique<edm::ValueMap<double>>();
216 unsigned int nMuons = muons->size();
218 IsoDeposit::Vetos trkVetos(nMuons);
219 std::vector<IsoDeposit> trkDeps(nMuons);
226 IsoDeposit::Vetos caloVetos;
227 std::vector<IsoDeposit> caloDeps;
228 std::vector<float> caloCorrDeps;
231 caloCorrDeps.resize(nMuons, 0.);
234 caloVetos.resize(nMuons);
235 caloDeps.resize(nMuons);
238 std::vector<double> combinedRelativeDeps(nMuons, 0.);
239 std::vector<bool> combinedRelativeIsos(nMuons,
false);
241 for (
unsigned int i=0;
i<nMuons;
i++) {
247 trkVetos[
i] = trkDeps[
i].
veto();
250 caloCorrDeps[
i] = (*caloDepWithCorrMap)[candref];
254 caloVetos[
i] = caloDeps[
i].
veto();
269 for(
unsigned int iMu=0; iMu < nMuons; ++iMu){
275 const Cuts::CutSpec &
cut =
theCuts( mu->eta());
279 <<
"CUTDEBUG: Muon pt = " << mu->pt() << std::endl
280 <<
"CUTDEBUG: minEta = " << cut.etaRange.min() << std::endl
281 <<
"CUTDEBUG: maxEta = " << cut.etaRange.max() << std::endl
282 <<
"CUTDEBUG: consize = " << cut.conesize << std::endl
283 <<
"CUTDEBUG: thresho = " << cut.threshold << std::endl;
289 double caloIsoSum = 0.;
291 caloIsoSum = caloCorrDeps[iMu];
292 if(caloIsoSum<0.) caloIsoSum = 0.;
293 if(
printDebug)
std::cout <<
"Rho-corrected calo deposit (min. 0) = " << caloIsoSum << std::endl;
296 const IsoDeposit & caloDeposit = caloDeps[iMu];
298 caloIsoSum = caloDeposit.
depositWithin(cut.conesize, caloVetos);
301 double trkIsoSum = trkIsoSumAndCount.first;
302 int count = trkIsoSumAndCount.second;
304 double muPt = mu->pt();
305 if( muPt<1. ) muPt = 1.;
306 double combinedRelativeDeposit = ((trkIsoSum + caloIsoSum ) / muPt);
307 bool result = ( combinedRelativeDeposit < cut.threshold);
309 if (
printDebug)
std::cout <<
" trk dep in cone: " << trkIsoSum <<
" with count "<<count <<std::endl
310 <<
" calo dep in cone: " << caloIsoSum << std::endl
311 <<
" muPt: " << muPt << std::endl
312 <<
" relIso: " <<combinedRelativeDeposit << std::endl
313 <<
" is isolated: "<<result << std::endl;
315 combinedRelativeIsos[iMu] =
result;
317 combinedRelativeDeps[iMu] = combinedRelativeDeposit;
326 depFillerTrk.
insert(muons, trkDeps.begin(), trkDeps.end());
328 event.put(
std::move(trkDepMap),
"trkIsoDeposits");
332 depFillerCalo.
insert(muons, caloDeps.begin(), caloDeps.end());
333 depFillerCalo.
fill();
334 event.put(
std::move(caloDepMap),
"caloIsoDeposits");
339 depFillerCombRel.
insert(muons, combinedRelativeDeps.begin(), combinedRelativeDeps.end());
340 depFillerCombRel.
fill();
341 event.put(
std::move(combinedRelativeDepMap),
"combinedRelativeIsoDeposits");
345 isoFiller.
insert(muons, combinedRelativeIsos.begin(), combinedRelativeIsos.end());
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
T getParameter(std::string const &) const
edm::InputTag theMuonCollectionLabel
const Veto & veto() const
Get veto area.
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)
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.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
muonisolation::Cuts theCuts
virtual ~L3MuonCombinedRelativeIsolationProducer()
destructor
ParameterDescriptionBase * add(U const &iLabel, T const &value)
muonisolation::Cuts cuts() const
virtual 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
reco::isodeposit::IsoDepositExtractor * trkExtractor
bool useRhoCorrectedCaloDeps
edm::ParameterSet theConfig
T get(const Candidate &c)
reco::isodeposit::IsoDepositExtractor * caloExtractor