CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
L3MuonIsolationProducer Class Reference

#include <L3MuonIsolationProducer.h>

Inheritance diagram for L3MuonIsolationProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 L3MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 Produce isolation maps. More...
 
virtual ~L3MuonIsolationProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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
 
reco::isodeposit::IsoDepositExtractortheExtractor
 
int theMaxNTracks
 
edm::InputTag theMuonCollectionLabel
 
edm::EDGetTokenT
< reco::RecoChargedCandidateCollection
theMuonCollectionToken
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 edm::EDConsumerBase::consumesCollector(), 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  theExtractor(0),
41  theTrackPt_Min(-1)
42  {
43  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer CTOR";
44 
45  theMuonCollectionToken = consumes<RecoChargedCandidateCollection>(theMuonCollectionLabel);
46 
47  if (optOutputIsoDeposits) produces<reco::IsoDepositMap>();
48  produces<edm::ValueMap<bool> >();
49 
50  //
51  // Extractor
52  //
53  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
55  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
56  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
57  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector());
58  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
59 
60  //
61  // Cuts
62  //
64  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
65  if (cutsName == "SimpleCuts") {
66  theCuts = Cuts(cutsPSet);
67  }
68  else if (
69 // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
70 // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
72  (cutsName== "L3NominalEfficiencyCuts_PXLS" )
73  || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
75  }
76  else {
77  LogError("L3MuonIsolationProducer::beginJob")
78  <<"cutsName: "<<cutsPSet<<" is not recognized:"
79  <<" theCuts not set!";
80  }
81  LogTrace("")<< theCuts.print();
82 
83  // (kludge) additional cut on the number of tracks
84  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
85  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
86 }
#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) &lt; cuts
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theMuonCollectionToken
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
#define LogTrace(id)
T get(const Candidate &c)
Definition: component.h:55
reco::isodeposit::IsoDepositExtractor * theExtractor
L3MuonIsolationProducer::~L3MuonIsolationProducer ( )
virtual

destructor

Definition at line 89 of file L3MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

89  {
90  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer DTOR";
91  if (theExtractor) delete theExtractor;
92 }
#define LogDebug(id)
reco::isodeposit::IsoDepositExtractor * theExtractor

Member Function Documentation

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

Produce isolation maps.

Implements edm::stream::EDProducerBase.

Definition at line 94 of file L3MuonIsolationProducer.cc.

References prof2calltree::count, GOODCOLL_filter_cfg::cut, reco::isodeposit::IsoDepositExtractor::deposit(), reco::IsoDeposit::depositAndCountWithin(), reco::TrackBase::eta(), edm::helper::Filler< Map >::fill(), i, edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, RPCpg::mu, patZpeak::muons, optOutputIsoDeposits, reco::IsoDeposit::print(), query::result, AlCaHLTBitMon_QueryRunRegistry::string, theApplyCutsORmaxNTracks, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theMuonCollectionToken, theTrackPt_Min, relativeConstraints::value, and reco::IsoDeposit::veto().

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

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().

reco::isodeposit::IsoDepositExtractor* L3MuonIsolationProducer::theExtractor
private
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().