40 theMuonCollectionLabel(par.getParameter<
InputTag>(
"inputMuonCollection")),
41 optOutputIsoDeposits(par.getParameter<
bool>(
"OutputMuIsoDeposits")),
42 useCaloIso(par.existsAs<
bool>(
"UseCaloIso") ? par.getParameter<
bool>(
"UseCaloIso") :
true),
43 useRhoCorrectedCaloDeps(par.existsAs<
bool>(
"UseRhoCorrectedCaloDeposits")
44 ? par.getParameter<
bool>(
"UseRhoCorrectedCaloDeposits")
46 theCaloDepsLabel(par.existsAs<
InputTag>(
"CaloDepositsLabel") ? par.getParameter<
InputTag>(
"CaloDepositsLabel")
47 :
InputTag(
"hltL3CaloMuonCorrectedIsolations")),
50 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer") <<
" L3MuonCombinedRelativeIsolationProducer CTOR";
56 produces<reco::IsoDepositMap>(
"trkIsoDeposits");
58 produces<reco::IsoDepositMap>(
"caloIsoDeposits");
60 produces<edm::ValueMap<double>>(
"combinedRelativeIsoDeposits");
62 produces<edm::ValueMap<bool>>();
73 caloExtractor = std::unique_ptr<reco::isodeposit::IsoDepositExtractor>{
84 trkExtractor = std::unique_ptr<reco::isodeposit::IsoDepositExtractor>{
93 if (cutsName ==
"SimpleCuts") {
99 (cutsName ==
"L3NominalEfficiencyCuts_PXLS") || (cutsName ==
"L3NominalEfficiencyCuts_TRKS")) {
102 LogError(
"L3MuonCombinedRelativeIsolationProducer::beginJob") <<
"cutsName: " << cutsPSet <<
" is not recognized:" 103 <<
" theCuts not set!";
114 LogDebug(
"RecoMuon|L3MuonCombinedRelativeIsolationProducer") <<
" L3MuonCombinedRelativeIsolationProducer DTOR";
120 desc.add<
bool>(
"UseRhoCorrectedCaloDeposits",
false);
121 desc.add<
bool>(
"UseCaloIso",
true);
124 desc.add<
bool>(
"OutputMuIsoDeposits",
true);
125 desc.add<
double>(
"TrackPt_Min", -1.0);
126 desc.add<
bool>(
"printDebug",
false);
129 cutsPSet.
add<std::vector<double>>(
"ConeSizes", std::vector<double>(1, 0.24));
130 cutsPSet.add<
std::string>(
"ComponentName",
"SimpleCuts");
131 cutsPSet.add<std::vector<double>>(
"Thresholds", std::vector<double>(1, 0.1));
132 cutsPSet.add<
int>(
"maxNTracks", -1);
133 cutsPSet.add<std::vector<double>>(
"EtaBounds", std::vector<double>(1, 2.411));
134 cutsPSet.add<
bool>(
"applyCutsORmaxNTracks",
false);
139 trkExtractorPSet.
add<
double>(
"Chi2Prob_Min", -1.0);
140 trkExtractorPSet.add<
double>(
"Chi2Ndof_Max", 1.0E64);
141 trkExtractorPSet.add<
double>(
"Diff_z", 0.2);
143 trkExtractorPSet.add<
double>(
"ReferenceRadius", 6.0);
145 trkExtractorPSet.add<
std::string>(
"ComponentName",
"PixelTrackExtractor");
146 trkExtractorPSet.add<
double>(
"DR_Max", 0.24);
147 trkExtractorPSet.add<
double>(
"Diff_r", 0.1);
148 trkExtractorPSet.add<
bool>(
"VetoLeadingTrack",
true);
149 trkExtractorPSet.add<
double>(
"DR_VetoPt", 0.025);
150 trkExtractorPSet.add<
double>(
"DR_Veto", 0.01);
151 trkExtractorPSet.add<
unsigned int>(
"NHits_Min", 0);
152 trkExtractorPSet.add<
double>(
"Pt_Min", -1.0);
153 trkExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"PXLS");
154 trkExtractorPSet.add<
std::string>(
"BeamlineOption",
"BeamSpotFromEvent");
155 trkExtractorPSet.add<
bool>(
"PropagateTracksToRadius",
true);
156 trkExtractorPSet.add<
double>(
"PtVeto_Min", 2.0);
161 caloExtractorPSet.
add<
double>(
"DR_Veto_H", 0.1);
162 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_Z",
false);
163 caloExtractorPSet.add<
double>(
"Threshold_H", 0.5);
164 caloExtractorPSet.add<
std::string>(
"ComponentName",
"CaloExtractor");
165 caloExtractorPSet.add<
double>(
"Threshold_E", 0.2);
166 caloExtractorPSet.add<
double>(
"DR_Max", 0.24);
167 caloExtractorPSet.add<
double>(
"DR_Veto_E", 0.07);
168 caloExtractorPSet.add<
double>(
"Weight_E", 1.5);
169 caloExtractorPSet.add<
bool>(
"Vertex_Constraint_XY",
false);
170 caloExtractorPSet.addUntracked<
std::string>(
"DepositLabel",
"EcalPlusHcal");
172 caloExtractorPSet.add<
double>(
"Weight_H", 1.0);
175 descriptions.
add(
"hltL3MuonIsolations",
desc);
182 std::cout <<
" L3 Muon Isolation producing..." 183 <<
" BEGINING OF EVENT " 184 <<
"================================" << std::endl;
197 auto caloDepMap = std::make_unique<reco::IsoDepositMap>();
198 auto trkDepMap = std::make_unique<reco::IsoDepositMap>();
200 auto comboIsoDepMap = std::make_unique<edm::ValueMap<bool>>();
203 auto combinedRelativeDepMap = std::make_unique<edm::ValueMap<double>>();
210 IsoDeposit::Vetos trkVetos(
nMuons);
211 std::vector<IsoDeposit> trkDeps(
nMuons);
217 IsoDeposit::Vetos caloVetos;
218 std::vector<IsoDeposit> caloDeps;
219 std::vector<float> caloCorrDeps;
222 caloCorrDeps.resize(
nMuons, 0.);
228 std::vector<double> combinedRelativeDeps(
nMuons, 0.);
229 std::vector<bool> combinedRelativeIsos(
nMuons,
false);
231 for (
unsigned int i = 0;
i <
nMuons;
i++) {
236 trkVetos[
i] = trkDeps[
i].veto();
239 caloCorrDeps[
i] = (*caloDepWithCorrMap)[candref];
242 caloVetos[
i] = caloDeps[
i].veto();
256 std::cout <<
"Looping over deposits...." << std::endl;
257 for (
unsigned int iMu = 0; iMu <
nMuons; ++iMu) {
259 std::cout <<
"Muon number = " << iMu << std::endl;
266 std::cout <<
"CUTDEBUG: Muon eta = " <<
mu->eta() << std::endl
267 <<
"CUTDEBUG: Muon pt = " <<
mu->pt() << std::endl
268 <<
"CUTDEBUG: minEta = " <<
cut.etaRange.min() << std::endl
269 <<
"CUTDEBUG: maxEta = " <<
cut.etaRange.max() << std::endl
270 <<
"CUTDEBUG: consize = " <<
cut.conesize << std::endl
271 <<
"CUTDEBUG: thresho = " <<
cut.threshold << std::endl;
278 double caloIsoSum = 0.;
280 caloIsoSum = caloCorrDeps[iMu];
284 std::cout <<
"Rho-corrected calo deposit (min. 0) = " << caloIsoSum << std::endl;
286 const IsoDeposit& caloDeposit = caloDeps[iMu];
292 double trkIsoSum = trkIsoSumAndCount.first;
293 int count = trkIsoSumAndCount.second;
295 double muPt =
mu->pt();
298 double combinedRelativeDeposit = ((trkIsoSum + caloIsoSum) / muPt);
299 bool result = (combinedRelativeDeposit <
cut.threshold);
303 std::cout <<
" trk dep in cone: " << trkIsoSum <<
" with count " <<
count << std::endl
304 <<
" calo dep in cone: " << caloIsoSum << std::endl
305 <<
" muPt: " << muPt << std::endl
306 <<
" relIso: " << combinedRelativeDeposit << std::endl
307 <<
" is isolated: " <<
result << std::endl;
309 combinedRelativeIsos[iMu] =
result;
311 combinedRelativeDeps[iMu] = combinedRelativeDeposit;
319 depFillerTrk.
insert(
muons, trkDeps.begin(), trkDeps.end());
321 event.put(
std::move(trkDepMap),
"trkIsoDeposits");
325 depFillerCalo.
insert(
muons, caloDeps.begin(), caloDeps.end());
326 depFillerCalo.
fill();
327 event.put(
std::move(caloDepMap),
"caloIsoDeposits");
332 depFillerCombRel.
insert(
muons, combinedRelativeDeps.begin(), combinedRelativeDeps.end());
333 depFillerCombRel.
fill();
334 event.put(
std::move(combinedRelativeDepMap),
"combinedRelativeIsoDeposits");
337 isoFiller.
insert(
muons, combinedRelativeIsos.begin(), combinedRelativeIsos.end());
343 <<
"================================";
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
edm::InputTag theMuonCollectionLabel
T getParameter(std::string const &) const
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
muonisolation::Cuts cuts() const
Log< level::Error, false > LogError
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)
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
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)
std::string print() const
bool useCaloIso
flag to include or exclude calo iso from calculation
bool optOutputIsoDeposits
edm::InputTag theCaloDepsLabel
bool useRhoCorrectedCaloDeps
edm::ParameterSet theConfig
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.