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::EDProducer 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 &)
 Produce isolation maps. More...
 
virtual ~L3MuonIsolationProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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 37 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.

37  :
38  theConfig(par),
39  theMuonCollectionLabel(par.getParameter<InputTag>("inputMuonCollection")),
40  optOutputIsoDeposits(par.getParameter<bool>("OutputMuIsoDeposits")),
41  theExtractor(0),
42  theTrackPt_Min(-1)
43  {
44  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer CTOR";
45 
46  theMuonCollectionToken = consumes<RecoChargedCandidateCollection>(theMuonCollectionLabel);
47 
48  if (optOutputIsoDeposits) produces<reco::IsoDepositMap>();
49  produces<edm::ValueMap<bool> >();
50 
51  //
52  // Extractor
53  //
54  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
56  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
57  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
58  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector());
59  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
60 
61  //
62  // Cuts
63  //
65  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
66  if (cutsName == "SimpleCuts") {
67  theCuts = Cuts(cutsPSet);
68  }
69  else if (
70 // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
71 // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
73  (cutsName== "L3NominalEfficiencyCuts_PXLS" )
74  || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
76  }
77  else {
78  LogError("L3MuonIsolationProducer::beginJob")
79  <<"cutsName: "<<cutsPSet<<" is not recognized:"
80  <<" theCuts not set!";
81  }
82  LogTrace("")<< theCuts.print();
83 
84  // (kludge) additional cut on the number of tracks
85  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
86  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
87 }
#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 90 of file L3MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

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

Member Function Documentation

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

Produce isolation maps.

Implements edm::EDProducer.

Definition at line 95 of file L3MuonIsolationProducer.cc.

References muonisolation::Cuts::CutSpec::conesize, 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, muonisolation::Cuts::CutSpec::threshold, relativeConstraints::value, and reco::IsoDeposit::veto().

95  {
96  std::string metname = "RecoMuon|L3MuonIsolationProducer";
97 
98  LogDebug(metname)<<" L3 Muon Isolation producing..."
99  <<" BEGINING OF EVENT " <<"================================";
100 
101  // Take the SA container
102  LogTrace(metname)<<" Taking the muons: "<<theMuonCollectionLabel;
104  event.getByToken(theMuonCollectionToken,muons);
105 
106  std::auto_ptr<reco::IsoDepositMap> depMap( new reco::IsoDepositMap());
107  std::auto_ptr<edm::ValueMap<bool> > isoMap( new edm::ValueMap<bool> ());
108 
109 
110  //
111  // get Vetos and deposits
112  //
113  unsigned int nMuons = muons->size();
114 
115  IsoDeposit::Vetos vetos(nMuons);
116 
117  std::vector<IsoDeposit> deps(nMuons);
118  std::vector<bool> isos(nMuons, false);
119 
120  for (unsigned int i=0; i<nMuons; i++) {
121  TrackRef mu(muons,i);
122  deps[i] = theExtractor->deposit(event, eventSetup, *mu);
123  vetos[i] = deps[i].veto();
124  }
125 
126  //
127  // add here additional vetos
128  //
129  //.....
130 
131  //
132  // actual cut step
133  //
134  for(unsigned int iMu=0; iMu < nMuons; ++iMu){
135  const reco::Track* mu = &(*muons)[iMu];
136 
137  const IsoDeposit & deposit = deps[iMu];
138  LogTrace(metname)<< deposit.print();
139 
140  const Cuts::CutSpec & cut = theCuts( mu->eta());
141  std::pair<double, int> sumAndCount = deposit.depositAndCountWithin(cut.conesize, vetos, theTrackPt_Min);
142 
143  double value = sumAndCount.first;
144  int count = sumAndCount.second;
145 
146  bool result = (value < cut.threshold);
147  if (theApplyCutsORmaxNTracks ) result |= count <= theMaxNTracks;
148  LogTrace(metname)<<"deposit in cone: "<<value<<"with count "<<count<<" is isolated: "<<result;
149 
150  isos[iMu] = result;
151  }
152 
153  //
154  // store
155  //
157  reco::IsoDepositMap::Filler depFiller(*depMap);
158  depFiller.insert(muons, deps.begin(), deps.end());
159  depFiller.fill();
160  event.put(depMap);
161  }
162  edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
163  isoFiller.insert(muons, isos.begin(), isos.end());
164  isoFiller.fill();
165  event.put(isoMap);
166 
167  LogTrace(metname) <<" END OF EVENT " <<"================================";
168 }
#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:699
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().