CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
L3MuonIsolationProducer Class Reference

#include <L3MuonIsolationProducer.h>

Inheritance diagram for L3MuonIsolationProducer:
edm::stream::EDProducer<>

Public Member Functions

 L3MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 Produce isolation maps. More...
 
 ~L3MuonIsolationProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Attributes

double optOutputIsoDeposits
 
bool theApplyCutsORmaxNTracks
 apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts More...
 
edm::ParameterSet theConfig
 
muonisolation::Cuts theCuts
 
std::unique_ptr< reco::isodeposit::IsoDepositExtractortheExtractor
 
int theMaxNTracks
 
edm::InputTag theMuonCollectionLabel
 
edm::EDGetTokenT< reco::RecoChargedCandidateCollectiontheMuonCollectionToken
 
double theTrackPt_Min
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 20 of file L3MuonIsolationProducer.h.

Constructor & Destructor Documentation

L3MuonIsolationProducer::L3MuonIsolationProducer ( const edm::ParameterSet par)

constructor with config

get min pt for the track to go into sumPt

test cutsName only. The depositType is informational only (has not been used so far) [VK]

Definition at line 36 of file L3MuonIsolationProducer.cc.

References L3NominalEfficiencyConfigurator::cuts(), reco::get(), edm::ParameterSet::getParameter(), LogDebug, LogTrace, optOutputIsoDeposits, muonisolation::Cuts::print(), AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theConfig, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, and theTrackPt_Min.

36  :
37  theConfig(par),
38  theMuonCollectionLabel(par.getParameter<InputTag>("inputMuonCollection")),
39  optOutputIsoDeposits(par.getParameter<bool>("OutputMuIsoDeposits")),
40  theTrackPt_Min(-1)
41  {
42  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer CTOR";
43 
44  theMuonCollectionToken = consumes<RecoChargedCandidateCollection>(theMuonCollectionLabel);
45 
46  if (optOutputIsoDeposits) produces<reco::IsoDepositMap>();
47  produces<edm::ValueMap<bool> >();
48 
49  //
50  // Extractor
51  //
52  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
54  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
55  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
56  theExtractor = std::unique_ptr<reco::isodeposit::IsoDepositExtractor>{IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector())};
57  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
58 
59  //
60  // Cuts
61  //
63  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
64  if (cutsName == "SimpleCuts") {
65  theCuts = Cuts(cutsPSet);
66  }
67  else if (
68 // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
69 // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
71  (cutsName== "L3NominalEfficiencyCuts_PXLS" )
72  || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
74  }
75  else {
76  LogError("L3MuonIsolationProducer::beginJob")
77  <<"cutsName: "<<cutsPSet<<" is not recognized:"
78  <<" theCuts not set!";
79  }
80  LogTrace("")<< theCuts.print();
81 
82  // (kludge) additional cut on the number of tracks
83  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
84  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
85 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::string print() const
Definition: Cuts.cc:55
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
#define LogTrace(id)
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
T get(const Candidate &c)
Definition: component.h:55
L3MuonIsolationProducer::~L3MuonIsolationProducer ( )
override

destructor

Definition at line 88 of file L3MuonIsolationProducer.cc.

References LogDebug.

88  {
89  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer DTOR";
90 }
#define LogDebug(id)

Member Function Documentation

void L3MuonIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

Produce isolation maps.

Definition at line 92 of file L3MuonIsolationProducer.cc.

References KineDebug3::count(), TkAlMuonSelectors_cfi::cut, reco::IsoDeposit::depositAndCountWithin(), symbols::deps, reco::TrackBase::eta(), edm::helper::Filler< Map >::fill(), mps_fire::i, edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, eostools::move(), RPCpg::mu, extraflags_cff::muons, custom_jme_cff::nMuons, optOutputIsoDeposits, reco::IsoDeposit::print(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, theTrackPt_Min, and boostedElectronIsolation_cff::vetos.

92  {
93  std::string metname = "RecoMuon|L3MuonIsolationProducer";
94 
95  LogDebug(metname)<<" L3 Muon Isolation producing..."
96  <<" BEGINING OF EVENT " <<"================================";
97 
98  // Take the SA container
99  LogTrace(metname)<<" Taking the muons: "<<theMuonCollectionLabel;
101  event.getByToken(theMuonCollectionToken,muons);
102 
103  auto depMap = std::make_unique<reco::IsoDepositMap>();
104  auto isoMap = std::make_unique<edm::ValueMap<bool>>();
105 
106 
107  //
108  // get Vetos and deposits
109  //
110  unsigned int nMuons = muons->size();
111 
112  IsoDeposit::Vetos vetos(nMuons);
113 
114  std::vector<IsoDeposit> deps(nMuons);
115  std::vector<bool> isos(nMuons, false);
116 
117  for (unsigned int i=0; i<nMuons; i++) {
118  TrackRef mu(muons,i);
119  deps[i] = theExtractor->deposit(event, eventSetup, *mu);
120  vetos[i] = deps[i].veto();
121  }
122 
123  //
124  // add here additional vetos
125  //
126  //.....
127 
128  //
129  // actual cut step
130  //
131  for(unsigned int iMu=0; iMu < nMuons; ++iMu){
132  const reco::Track* mu = &(*muons)[iMu];
133 
134  const IsoDeposit & deposit = deps[iMu];
135  LogTrace(metname)<< deposit.print();
136 
137  const Cuts::CutSpec & cut = theCuts( mu->eta());
138  std::pair<double, int> sumAndCount = deposit.depositAndCountWithin(cut.conesize, vetos, theTrackPt_Min);
139 
140  double value = sumAndCount.first;
141  int count = sumAndCount.second;
142 
143  bool result = (value < cut.threshold);
144  if (theApplyCutsORmaxNTracks ) result |= count <= theMaxNTracks;
145  LogTrace(metname)<<"deposit in cone: "<<value<<"with count "<<count<<" is isolated: "<<result;
146 
147  isos[iMu] = result;
148  }
149 
150  //
151  // store
152  //
154  reco::IsoDepositMap::Filler depFiller(*depMap);
155  depFiller.insert(muons, deps.begin(), deps.end());
156  depFiller.fill();
157  event.put(std::move(depMap));
158  }
159  edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
160  isoFiller.insert(muons, isos.begin(), isos.end());
161  isoFiller.fill();
162  event.put(std::move(isoMap));
163 
164  LogTrace(metname) <<" END OF EVENT " <<"================================";
165 }
#define LogDebug(id)
const std::string metname
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:690
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
const int mu
Definition: Constants.h:22
Definition: value.py:1
#define LogTrace(id)
std::unique_ptr< reco::isodeposit::IsoDepositExtractor > theExtractor
std::pair< double, int > depositAndCountWithin(double coneSize, const Vetos &vetos=Vetos(), double threshold=-1e+36, bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:44
std::string print() const
Definition: IsoDeposit.cc:181
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

double L3MuonIsolationProducer::optOutputIsoDeposits
private

Definition at line 45 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

bool L3MuonIsolationProducer::theApplyCutsORmaxNTracks
private

apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts

Definition at line 59 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

edm::ParameterSet L3MuonIsolationProducer::theConfig
private

Definition at line 35 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer().

muonisolation::Cuts L3MuonIsolationProducer::theCuts
private

Definition at line 42 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

std::unique_ptr<reco::isodeposit::IsoDepositExtractor> L3MuonIsolationProducer::theExtractor
private

Definition at line 48 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

int L3MuonIsolationProducer::theMaxNTracks
private

max number of tracks to allow in the sum count <= maxN

Definition at line 56 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

edm::InputTag L3MuonIsolationProducer::theMuonCollectionLabel
private

Definition at line 38 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

edm::EDGetTokenT<reco::RecoChargedCandidateCollection> L3MuonIsolationProducer::theMuonCollectionToken
private

Definition at line 39 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

double L3MuonIsolationProducer::theTrackPt_Min
private

pt cut to consider track in sumPt after extracting iso deposit better split this off into a filter

Definition at line 52 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().