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
L3MuonCombinedRelativeIsolationProducer Class Reference

#include <L3MuonCombinedRelativeIsolationProducer.h>

Inheritance diagram for L3MuonCombinedRelativeIsolationProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 initialisation More...
 
 L3MuonCombinedRelativeIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 Produce isolation maps. More...
 
virtual ~L3MuonCombinedRelativeIsolationProducer ()
 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 &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Attributes

reco::isodeposit::IsoDepositExtractorcaloExtractor
 
bool optOutputIsoDeposits
 
bool printDebug
 
bool theApplyCutsORmaxNTracks
 apply or not the maxN cut on top of the sumPt (or nominall eff) < cuts More...
 
edm::InputTag theCaloDepsLabel
 
edm::ParameterSet theConfig
 
muonisolation::Cuts theCuts
 
int theMaxNTracks
 
edm::InputTag theMuonCollectionLabel
 
double theTrackPt_Min
 
reco::isodeposit::IsoDepositExtractortrkExtractor
 
bool useRhoCorrectedCaloDeps
 

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
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 18 of file L3MuonCombinedRelativeIsolationProducer.h.

Constructor & Destructor Documentation

L3MuonCombinedRelativeIsolationProducer::L3MuonCombinedRelativeIsolationProducer ( const edm::ParameterSet par)

constructor with config

Definition at line 36 of file L3MuonCombinedRelativeIsolationProducer.cc.

References LogDebug, optOutputIsoDeposits, and useRhoCorrectedCaloDeps.

36  :
37  theConfig(par),
38  theMuonCollectionLabel(par.getParameter<InputTag>("inputMuonCollection")),
39  optOutputIsoDeposits(par.getParameter<bool>("OutputMuIsoDeposits")),
40  useRhoCorrectedCaloDeps(par.existsAs<bool>("UseRhoCorrectedCaloDeposits") ?
41  par.getParameter<bool>("UseRhoCorrectedCaloDeposits") : false),
42  theCaloDepsLabel(par.existsAs<InputTag>("CaloDepositsLabel") ?
43  par.getParameter<InputTag>("CaloDepositsLabel") :
44  InputTag("hltL3CaloMuonCorrectedIsolations")),
45  caloExtractor(0),
46  trkExtractor(0),
47  theTrackPt_Min(-1),
48  printDebug (par.getParameter<bool>("printDebug"))
49  {
50  LogDebug("RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<" L3MuonCombinedRelativeIsolationProducer CTOR";
51 
53  produces<reco::IsoDepositMap>("trkIsoDeposits");
54  if( useRhoCorrectedCaloDeps==false ) // otherwise, calo deposits have been previously computed
55  produces<reco::IsoDepositMap>("caloIsoDeposits");
56  //produces<std::vector<double> >("combinedRelativeIsoDeposits");
57  produces<edm::ValueMap<double> >("combinedRelativeIsoDeposits");
58  }
59  produces<edm::ValueMap<bool> >();
60 
61 }
#define LogDebug(id)
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:187
L3MuonCombinedRelativeIsolationProducer::~L3MuonCombinedRelativeIsolationProducer ( )
virtual

destructor

Definition at line 64 of file L3MuonCombinedRelativeIsolationProducer.cc.

References caloExtractor, LogDebug, and trkExtractor.

64  {
65  LogDebug("RecoMuon|L3MuonCombinedRelativeIsolationProducer")<<" L3MuonCombinedRelativeIsolationProducer DTOR";
66  if (caloExtractor) delete caloExtractor;
67  if (trkExtractor) delete trkExtractor;
68 }
#define LogDebug(id)

Member Function Documentation

void L3MuonCombinedRelativeIsolationProducer::beginJob ( void  )
virtual

initialisation

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

Reimplemented from edm::EDProducer.

Definition at line 70 of file L3MuonCombinedRelativeIsolationProducer.cc.

References caloExtractor, L3NominalEfficiencyConfigurator::cuts(), reco::get(), edm::ParameterSet::getParameter(), LogTrace, muonisolation::Cuts::print(), theApplyCutsORmaxNTracks, theConfig, theCuts, theMaxNTracks, theTrackPt_Min, trkExtractor, and useRhoCorrectedCaloDeps.

71 {
72 
73  //
74  // Extractor
75  //
76  // Calorimeters (ONLY if not previously computed)
77  //
78  if( useRhoCorrectedCaloDeps==false ) {
79  edm::ParameterSet caloExtractorPSet = theConfig.getParameter<edm::ParameterSet>("CaloExtractorPSet");
80 
81  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
82  std::string caloExtractorName = caloExtractorPSet.getParameter<std::string>("ComponentName");
83  caloExtractor = IsoDepositExtractorFactory::get()->create( caloExtractorName, caloExtractorPSet);
84  //std::string caloDepositType = caloExtractorPSet.getUntrackedParameter<std::string>("DepositLabel"); // N.B. Not used in the following!
85  }
86 
87  // Tracker
88  //
89  edm::ParameterSet trkExtractorPSet = theConfig.getParameter<edm::ParameterSet>("TrkExtractorPSet");
90 
91  std::string trkExtractorName = trkExtractorPSet.getParameter<std::string>("ComponentName");
92  trkExtractor = IsoDepositExtractorFactory::get()->create( trkExtractorName, trkExtractorPSet);
93  //std::string trkDepositType = trkExtractorPSet.getUntrackedParameter<std::string>("DepositLabel"); // N.B. Not used in the following!
94 
95 
96 
97  //
98  // Cuts for track isolation
99  //
101  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
102  if (cutsName == "SimpleCuts") {
103  theCuts = Cuts(cutsPSet);
104  }
105  else if (
106  // (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
107  // || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS")
109  (cutsName== "L3NominalEfficiencyCuts_PXLS" )
110  || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
112  }
113  else {
114  LogError("L3MuonCombinedRelativeIsolationProducer::beginJob")
115  <<"cutsName: "<<cutsPSet<<" is not recognized:"
116  <<" theCuts not set!";
117  }
118  LogTrace("")<< theCuts.print();
119 
120  // (kludge) additional cut on the number of tracks
121  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
122  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
123 }
T getParameter(std::string const &) const
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) &lt; cuts
std::string print() const
Definition: Cuts.cc:55
#define LogTrace(id)
T get(const Candidate &c)
Definition: component.h:56
void L3MuonCombinedRelativeIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produce isolation maps.

Implements edm::EDProducer.

Definition at line 125 of file L3MuonCombinedRelativeIsolationProducer.cc.

References caloExtractor, muonisolation::Cuts::CutSpec::conesize, prof2calltree::count, gather_cfg::cout, GOODCOLL_filter_cfg::cut, reco::isodeposit::IsoDepositExtractor::deposit(), reco::IsoDeposit::depositAndCountWithin(), reco::IsoDeposit::depositWithin(), reco::TrackBase::eta(), muonisolation::Cuts::CutSpec::etaRange, edm::helper::Filler< Map >::fill(), i, edm::helper::Filler< Map >::insert(), muonisolation::Range< T >::max(), metname, muonisolation::Range< T >::min(), RPCpg::mu, patZpeak::muons, optOutputIsoDeposits, reco::IsoDeposit::print(), printDebug, reco::TrackBase::pt(), query::result, theApplyCutsORmaxNTracks, theCaloDepsLabel, theCuts, theMaxNTracks, theMuonCollectionLabel, theTrackPt_Min, muonisolation::Cuts::CutSpec::threshold, trkExtractor, useRhoCorrectedCaloDeps, and reco::IsoDeposit::veto().

125  {
126  std::string metname = "RecoMuon|L3MuonCombinedRelativeIsolationProducer";
127 
128  if (printDebug) std::cout <<" L3 Muon Isolation producing..."
129  <<" BEGINING OF EVENT " <<"================================" <<std::endl;
130 
131  // Take the SA container
132  if (printDebug) std::cout <<" Taking the muons: "<<theMuonCollectionLabel << std::endl;
134  event.getByLabel(theMuonCollectionLabel,muons);
135 
136  // Take calo deposits with rho corrections (ONLY if previously computed)
137  Handle< edm::ValueMap<float> > caloDepWithCorrMap;
139  event.getByLabel(theCaloDepsLabel, caloDepWithCorrMap);
140 
141  std::auto_ptr<reco::IsoDepositMap> caloDepMap( new reco::IsoDepositMap());
142  std::auto_ptr<reco::IsoDepositMap> trkDepMap( new reco::IsoDepositMap());
143 
144  std::auto_ptr<edm::ValueMap<bool> > comboIsoDepMap( new edm::ValueMap<bool> ());
145 
146  //std::auto_ptr<std::vector<double> > combinedRelativeDeps(new std::vector<double>());
147  std::auto_ptr<edm::ValueMap<double> > combinedRelativeDepMap(new edm::ValueMap<double>());
148 
149 
150  //
151  // get Vetos and deposits
152  //
153  unsigned int nMuons = muons->size();
154 
155  IsoDeposit::Vetos trkVetos(nMuons);
156  std::vector<IsoDeposit> trkDeps(nMuons);
157 
158 
159  // IsoDeposit::Vetos caloVetos(nMuons);
160  // std::vector<IsoDeposit> caloDeps(nMuons);
161  // std::vector<float> caloCorrDeps(nMuons, 0.); // if calo deposits with corrections available
162 
163  IsoDeposit::Vetos caloVetos;
164  std::vector<IsoDeposit> caloDeps;
165  std::vector<float> caloCorrDeps; // if calo deposits with corrections available
166 
168  caloCorrDeps.resize(nMuons, 0.);
169  }
170  else {
171  caloVetos.resize(nMuons);
172  caloDeps.resize(nMuons);
173  }
174 
175  std::vector<double> combinedRelativeDeps(nMuons, 0.);
176  std::vector<bool> combinedRelativeIsos(nMuons, false);
177 
178  for (unsigned int i=0; i<nMuons; i++) {
179 
180  TrackRef mu(muons,i);
181 
182  trkDeps[i] = trkExtractor->deposit(event, eventSetup, *mu);
183  trkVetos[i] = trkDeps[i].veto();
184 
186  caloCorrDeps[i] = (*caloDepWithCorrMap)[mu];
187  }
188  else {
189  caloDeps[i] = caloExtractor->deposit(event, eventSetup, *mu);
190  caloVetos[i] = caloDeps[i].veto();
191  }
192 
193  }
194 
195  //
196  // add here additional vetos
197  //
198  //.....
199 
200  //
201  // actual cut step
202  //
203 
204  if (printDebug) std::cout << "Looping over deposits...." << std::endl;
205  for(unsigned int iMu=0; iMu < nMuons; ++iMu){
206 
207  if (printDebug) std::cout << "Muon number = " << iMu << std::endl;
208  const reco::Track* mu = &(*muons)[iMu];
209 
210  // cuts
211  const Cuts::CutSpec & cut = theCuts( mu->eta());
212 
213 
214  if (printDebug) std::cout << "CUTDEBUG: Muon eta = " << mu->eta() << std::endl
215  << "CUTDEBUG: Muon pt = " << mu->pt() << std::endl
216  << "CUTDEBUG: minEta = " << cut.etaRange.min() << std::endl
217  << "CUTDEBUG: maxEta = " << cut.etaRange.max() << std::endl
218  << "CUTDEBUG: consize = " << cut.conesize << std::endl
219  << "CUTDEBUG: thresho = " << cut.threshold << std::endl;
220 
221  const IsoDeposit & trkDeposit = trkDeps[iMu];
222  if (printDebug) std::cout << trkDeposit.print();
223  std::pair<double, int> trkIsoSumAndCount = trkDeposit.depositAndCountWithin(cut.conesize, trkVetos, theTrackPt_Min);
224 
225  double caloIsoSum = 0.;
227  caloIsoSum = caloCorrDeps[iMu];
228  if(caloIsoSum<0.) caloIsoSum = 0.;
229  if(printDebug) std::cout << "Rho-corrected calo deposit (min. 0) = " << caloIsoSum << std::endl;
230  }
231  else {
232  const IsoDeposit & caloDeposit = caloDeps[iMu];
233  if (printDebug) std::cout << caloDeposit.print();
234  caloIsoSum = caloDeposit.depositWithin(cut.conesize, caloVetos);
235  }
236 
237  double trkIsoSum = trkIsoSumAndCount.first;
238  int count = trkIsoSumAndCount.second;
239 
240  double muPt = mu->pt();
241  if( muPt<1. ) muPt = 1.;
242  double combinedRelativeDeposit = ((trkIsoSum + caloIsoSum ) / muPt);
243  bool result = ( combinedRelativeDeposit < cut.threshold);
244  if (theApplyCutsORmaxNTracks ) result |= count <= theMaxNTracks;
245  if (printDebug) std::cout <<" trk dep in cone: " << trkIsoSum << " with count "<<count <<std::endl
246  <<" calo dep in cone: " << caloIsoSum << std::endl
247  <<" muPt: " << muPt << std::endl
248  <<" relIso: " <<combinedRelativeDeposit << std::endl
249  <<" is isolated: "<<result << std::endl;
250 
251  combinedRelativeIsos[iMu] = result;
252  //combinedRelativeDeps->push_back(combinedRelativeDeposit);
253  combinedRelativeDeps[iMu] = combinedRelativeDeposit;
254  }
255 
256  //
257  // store
258  //
260 
261  reco::IsoDepositMap::Filler depFillerTrk(*trkDepMap);
262  depFillerTrk.insert(muons, trkDeps.begin(), trkDeps.end());
263  depFillerTrk.fill();
264  event.put(trkDepMap, "trkIsoDeposits");
265 
266  if( useRhoCorrectedCaloDeps==false ) {
267  reco::IsoDepositMap::Filler depFillerCalo(*caloDepMap);
268  depFillerCalo.insert(muons, caloDeps.begin(), caloDeps.end());
269  depFillerCalo.fill();
270  event.put(caloDepMap, "caloIsoDeposits");
271  }
272 
273  //event.put(combinedRelativeDeps, "combinedRelativeIsoDeposits");
274  edm::ValueMap<double>::Filler depFillerCombRel(*combinedRelativeDepMap);
275  depFillerCombRel.insert(muons, combinedRelativeDeps.begin(), combinedRelativeDeps.end());
276  depFillerCombRel.fill();
277  event.put(combinedRelativeDepMap, "combinedRelativeIsoDeposits");
278 
279  }
280  edm::ValueMap<bool>::Filler isoFiller(*comboIsoDepMap);
281  isoFiller.insert(muons, combinedRelativeIsos.begin(), combinedRelativeIsos.end());
282  isoFiller.fill();
283  event.put(comboIsoDepMap);
284 
285  if (printDebug) std::cout <<" END OF EVENT " <<"================================";
286 }
int i
Definition: DBlmapReader.cc:9
const T & max() const
Definition: Range.h:25
const Veto & veto() const
Get veto area.
Definition: IsoDeposit.h:73
const std::string metname
bool theApplyCutsORmaxNTracks
apply or not the maxN cut on top of the sumPt (or nominall eff) &lt; cuts
double depositWithin(double coneSize, const Vetos &vetos=Vetos(), bool skipDepositVeto=false) const
Get deposit.
Definition: IsoDeposit.cc:34
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
muonisolation::Range< double > etaRange
Definition: Cuts.h:15
double pt() const
track transverse momentum
Definition: TrackBase.h:131
tuple result
Definition: query.py:137
const int mu
Definition: Constants.h:23
const T & min() const
Definition: Range.h:23
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
tuple cout
Definition: gather_cfg.py:121
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const =0

Member Data Documentation

reco::isodeposit::IsoDepositExtractor* L3MuonCombinedRelativeIsolationProducer::caloExtractor
private
bool L3MuonCombinedRelativeIsolationProducer::optOutputIsoDeposits
private
bool L3MuonCombinedRelativeIsolationProducer::printDebug
private

Definition at line 68 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by produce().

bool L3MuonCombinedRelativeIsolationProducer::theApplyCutsORmaxNTracks
private

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

Definition at line 64 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by beginJob(), and produce().

edm::InputTag L3MuonCombinedRelativeIsolationProducer::theCaloDepsLabel
private

Definition at line 49 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by produce().

edm::ParameterSet L3MuonCombinedRelativeIsolationProducer::theConfig
private

Definition at line 36 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by beginJob().

muonisolation::Cuts L3MuonCombinedRelativeIsolationProducer::theCuts
private

Definition at line 42 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by beginJob(), and produce().

int L3MuonCombinedRelativeIsolationProducer::theMaxNTracks
private

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

Definition at line 61 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by beginJob(), and produce().

edm::InputTag L3MuonCombinedRelativeIsolationProducer::theMuonCollectionLabel
private

Definition at line 39 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by produce().

double L3MuonCombinedRelativeIsolationProducer::theTrackPt_Min
private

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

Definition at line 57 of file L3MuonCombinedRelativeIsolationProducer.h.

Referenced by beginJob(), and produce().

reco::isodeposit::IsoDepositExtractor* L3MuonCombinedRelativeIsolationProducer::trkExtractor
private
bool L3MuonCombinedRelativeIsolationProducer::useRhoCorrectedCaloDeps
private