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

virtual void beginJob ()
 initialisation More...
 
 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 ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
double theTrackPt_Min
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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 18 of file L3MuonIsolationProducer.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 36 of file L3MuonIsolationProducer.cc.

References LogDebug, and optOutputIsoDeposits.

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  if (optOutputIsoDeposits) produces<reco::IsoDepositMap>();
46  produces<edm::ValueMap<bool> >();
47 }
#define LogDebug(id)
T getParameter(std::string const &) const
reco::isodeposit::IsoDepositExtractor * theExtractor
L3MuonIsolationProducer::~L3MuonIsolationProducer ( )
virtual

destructor

Definition at line 50 of file L3MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

50  {
51  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer DTOR";
52  if (theExtractor) delete theExtractor;
53 }
#define LogDebug(id)
reco::isodeposit::IsoDepositExtractor * theExtractor

Member Function Documentation

void L3MuonIsolationProducer::beginJob ( void  )
virtual

initialisation

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]

Reimplemented from edm::EDProducer.

Definition at line 55 of file L3MuonIsolationProducer.cc.

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

56 {
57 
58  //
59  // Extractor
60  //
61  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
63  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
64  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
65  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet);
66  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
67 
68  //
69  // Cuts
70  //
72  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
73  if (cutsName == "SimpleCuts") {
74  theCuts = Cuts(cutsPSet);
75  }
76  else if (
77 // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
78 // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
80  (cutsName== "L3NominalEfficiencyCuts_PXLS" )
81  || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
83  }
84  else {
85  LogError("L3MuonIsolationProducer::beginJob")
86  <<"cutsName: "<<cutsPSet<<" is not recognized:"
87  <<" theCuts not set!";
88  }
89  LogTrace("")<< theCuts.print();
90 
91  // (kludge) additional cut on the number of tracks
92  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
93  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
94 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T 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
#define LogTrace(id)
T get(const Candidate &c)
Definition: component.h:56
reco::isodeposit::IsoDepositExtractor * theExtractor
void L3MuonIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produce isolation maps.

Implements edm::EDProducer.

Definition at line 96 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, theTrackPt_Min, muonisolation::Cuts::CutSpec::threshold, relativeConstraints::value, and reco::IsoDeposit::veto().

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

edm::ParameterSet L3MuonIsolationProducer::theConfig
private

Definition at line 36 of file L3MuonIsolationProducer.h.

Referenced by beginJob().

muonisolation::Cuts L3MuonIsolationProducer::theCuts
private

Definition at line 42 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), and produce().

reco::isodeposit::IsoDepositExtractor* L3MuonIsolationProducer::theExtractor
private

Definition at line 48 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), produce(), and ~L3MuonIsolationProducer().

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 beginJob(), and produce().

edm::InputTag L3MuonIsolationProducer::theMuonCollectionLabel
private

Definition at line 39 of file L3MuonIsolationProducer.h.

Referenced by 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 beginJob(), and produce().