CMS 3D CMS Logo

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

#include <L2MuonIsolationProducer.h>

Inheritance diagram for L2MuonIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void beginJob ()
 setup the job More...
 
 L2MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 Produce isolation maps. More...
 
virtual ~L2MuonIsolationProducer ()
 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 ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 ParameterSet descriptions. More...
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Attributes

bool optOutputDecision
 
bool optOutputIsolatorFloat
 
muonisolation::MuIsoBaseIsolatortheDepositIsolator
 
reco::isodeposit::IsoDepositExtractortheExtractor
 
edm::InputTag theSACollectionLabel
 
edm::EDGetTokenT
< reco::RecoChargedCandidateCollection
theSACollectionToken
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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

Author
J. Alcaraz

L2 HLT muon isolation producer

Author
J.Alcaraz

Definition at line 22 of file L2MuonIsolationProducer.h.

Constructor & Destructor Documentation

L2MuonIsolationProducer::L2MuonIsolationProducer ( const edm::ParameterSet par)

constructor with config

Definition at line 37 of file L2MuonIsolationProducer.cc.

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), LogDebug, optOutputDecision, optOutputIsolatorFloat, AlCaHLTBitMon_QueryRunRegistry::string, theDepositIsolator, theExtractor, theSACollectionLabel, and theSACollectionToken.

37  :
38  theSACollectionLabel(par.getParameter<edm::InputTag>("StandAloneCollectionLabel")),
39  theExtractor(0),
41 {
42  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer constructor called";
43 
44  theSACollectionToken = consumes<RecoChargedCandidateCollection>(theSACollectionLabel);
45 
46  //
47  // Extractor
48  //
49  edm::ParameterSet extractorPSet = par.getParameter<edm::ParameterSet>("ExtractorPSet");
50  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
51  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet, consumesCollector());
52 
53 
54  edm::ParameterSet isolatorPSet = par.getParameter<edm::ParameterSet>("IsolatorPSet");
55  bool haveIsolator = !isolatorPSet.empty();
56  optOutputDecision = haveIsolator;
57  if (optOutputDecision){
58  std::string type = isolatorPSet.getParameter<std::string>("ComponentName");
59  theDepositIsolator = MuonIsolatorFactory::get()->create(type, isolatorPSet, consumesCollector());
60  }
61  if (optOutputDecision) produces<edm::ValueMap<bool> >();
62  produces<reco::IsoDepositMap>();
63 
64  optOutputIsolatorFloat = par.getParameter<bool>("WriteIsolatorFloat");
65  if (optOutputIsolatorFloat && haveIsolator){
66  produces<edm::ValueMap<float> >();
67  }
68 }
#define LogDebug(id)
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:216
reco::isodeposit::IsoDepositExtractor * theExtractor
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theSACollectionToken
muonisolation::MuIsoBaseIsolator * theDepositIsolator
T get(const Candidate &c)
Definition: component.h:55
L2MuonIsolationProducer::~L2MuonIsolationProducer ( )
virtual

destructor

Definition at line 71 of file L2MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

71  {
72  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer destructor called";
73  if (theExtractor) delete theExtractor;
74 }
#define LogDebug(id)
reco::isodeposit::IsoDepositExtractor * theExtractor

Member Function Documentation

void L2MuonIsolationProducer::beginJob ( void  )
virtual

setup the job

beginJob

Reimplemented from edm::EDProducer.

Definition at line 125 of file L2MuonIsolationProducer.cc.

125  {
126 
127 }
void L2MuonIsolationProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

ParameterSet descriptions.

Definition at line 77 of file L2MuonIsolationProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), AlCaHLTBitMon_QueryRunRegistry::string, and groupFilesInBlocks::temp.

77  {
79  desc.add<edm::InputTag>("StandAloneCollectionLabel",edm::InputTag("hltL2MuonCandidates"));
80  edm::ParameterSetDescription extractorPSet;
81  {
82  extractorPSet.add<double>("DR_Veto_H",0.1);
83  extractorPSet.add<bool>("Vertex_Constraint_Z",false);
84  extractorPSet.add<double>("Threshold_H",0.5);
85  extractorPSet.add<std::string>("ComponentName","CaloExtractor");
86  extractorPSet.add<double>("Threshold_E",0.2);
87  extractorPSet.add<double>("DR_Max",1.0);
88  extractorPSet.add<double>("DR_Veto_E",0.07);
89  extractorPSet.add<double>("Weight_E",1.5);
90  extractorPSet.add<bool>("Vertex_Constraint_XY",false);
91  extractorPSet.addUntracked<std::string>("DepositLabel","EcalPlusHcal");
92  extractorPSet.add<edm::InputTag>("CaloTowerCollectionLabel",edm::InputTag("towerMaker"));
93  extractorPSet.add<double>("Weight_H",1.0);
94  }
95  desc.add<edm::ParameterSetDescription>("ExtractorPSet",extractorPSet);
96  edm::ParameterSetDescription isolatorPSet;
97  {
98  std::vector<double> temp;
99  isolatorPSet.add<std::vector<double> >("ConeSizesRel",std::vector<double>(1, 0.3));
100  isolatorPSet.add<double>("EffAreaSFEndcap",1.0);
101  isolatorPSet.add<bool>("CutAbsoluteIso",true);
102  isolatorPSet.add<bool>("AndOrCuts",true);
103  isolatorPSet.add<edm::InputTag>("RhoSrc",edm::InputTag("hltKT6CaloJetsForMuons","rho"));
104  isolatorPSet.add<std::vector<double> >("ConeSizes",std::vector<double>(1, 0.3));
105  isolatorPSet.add<std::string>("ComponentName","CutsIsolatorWithCorrection");
106  isolatorPSet.add<bool>("ReturnRelativeSum",false);
107  isolatorPSet.add<double>("RhoScaleBarrel",1.0);
108  isolatorPSet.add<double>("EffAreaSFBarrel",1.0);
109  isolatorPSet.add<bool>("CutRelativeIso",false);
110  isolatorPSet.add<std::vector<double> >("EtaBounds",std::vector<double>(1, 2.411));
111  isolatorPSet.add<std::vector<double> >("Thresholds",std::vector<double>(1, 9.9999999E7));
112  isolatorPSet.add<bool>("ReturnAbsoluteSum",true);
113  isolatorPSet.add<std::vector<double> >("EtaBoundsRel",std::vector<double>(1, 2.411));
114  isolatorPSet.add<std::vector<double> >("ThresholdsRel",std::vector<double>(1, 9.9999999E7));
115  isolatorPSet.add<double>("RhoScaleEndcap",1.0);
116  isolatorPSet.add<double>("RhoMax",9.9999999E7);
117  isolatorPSet.add<bool>("UseRhoCorrection",true);
118  }
119  desc.add<edm::ParameterSetDescription>("IsolatorPSet",isolatorPSet);
120  desc.add<bool>("WriteIsolatorFloat",false);
121  descriptions.add("hltL2MuonIsolations", desc);
122 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void L2MuonIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

Produce isolation maps.

build deposits

do the business of filling iso map

annoying – I will forget it at some point

annoying – I will forget it at some point

Implements edm::EDProducer.

Definition at line 130 of file L2MuonIsolationProducer.cc.

References reco::isodeposit::IsoDepositExtractor::deposit(), edm::helper::Filler< Map >::fill(), reco::isodeposit::IsoDepositExtractor::fillVetos(), i, edm::helper::Filler< Map >::insert(), LogDebug, metname, patZpeak::muons, optOutputDecision, optOutputIsolatorFloat, muonisolation::MuIsoBaseIsolator::result(), AlCaHLTBitMon_QueryRunRegistry::string, theDepositIsolator, theExtractor, theSACollectionLabel, theSACollectionToken, muonisolation::MuIsoBaseIsolator::Result::valBool, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

130  {
131  std::string metname = "Muon|RecoMuon|L2MuonIsolationProducer";
132 
133  LogDebug(metname)<<" L2 Muon Isolation producing...";
134 
135  // Take the SA container
136  LogDebug(metname)<<" Taking the StandAlone muons: "<<theSACollectionLabel;
138  event.getByToken(theSACollectionToken,muons);
139 
140  // Find deposits and load into event
141  LogDebug(metname)<<" Get energy around";
142  std::auto_ptr<reco::IsoDepositMap> depMap( new reco::IsoDepositMap());
143  std::auto_ptr<edm::ValueMap<bool> > isoMap( new edm::ValueMap<bool> ());
144  std::auto_ptr<edm::ValueMap<float> > isoFloatMap( new edm::ValueMap<float> ());
145 
146  unsigned int nMuons = muons->size();
147  std::vector<IsoDeposit> deps(nMuons);
148  std::vector<bool> isos(nMuons, false);
149  std::vector<float> isoFloats(nMuons, 0);
150 
151  // fill track collection to use for vetos calculation
152  TrackCollection muonTracks;
153  for (unsigned int i=0; i<nMuons; i++) {
154  TrackRef tk = (*muons)[i].track();
155  muonTracks.push_back(*tk);
156  }
157 
158  theExtractor->fillVetos(event,eventSetup,muonTracks);
159 
160  for (unsigned int i=0; i<nMuons; i++) {
161  TrackRef tk = (*muons)[i].track();
162 
163  deps[i] = theExtractor->deposit(event, eventSetup, *tk);
164 
165  if (optOutputDecision){
167  muonisolation::MuIsoBaseIsolator::Result isoResult = theDepositIsolator->result( isoContainer, *tk, &event );
168  isos[i] = isoResult.valBool;
169  isoFloats[i] = isoResult.valFloat;
170  }
171  }
172 
173 
174 
176  reco::IsoDepositMap::Filler depFiller(*depMap);
177  depFiller.insert(muons, deps.begin(), deps.end());
178  depFiller.fill();
179  event.put(depMap);
180 
181  if (optOutputDecision){
182  edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
183  isoFiller.insert(muons, isos.begin(), isos.end());
184  isoFiller.fill();
185  event.put(isoMap);
186 
188  edm::ValueMap<float> ::Filler isoFloatFiller(*isoFloatMap);
189  isoFloatFiller.insert(muons, isoFloats.begin(), isoFloats.end());
190  isoFloatFiller.fill();
191  event.put(isoFloatMap);
192  }
193  }
194 
195  LogDebug(metname) <<" Event loaded"
196  <<"================================";
197 }
#define LogDebug(id)
reco::isodeposit::IsoDepositExtractor * theExtractor
int i
Definition: DBlmapReader.cc:9
const std::string metname
virtual Result result(const DepositContainer &deposits, const edm::Event *=0) const =0
Compute and return the isolation variable.
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:10
virtual void fillVetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks)=0
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > theSACollectionToken
std::vector< DepositAndVetos > DepositContainer
tuple muons
Definition: patZpeak.py:38
muonisolation::MuIsoBaseIsolator * theDepositIsolator
virtual reco::IsoDeposit deposit(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const =0

Member Data Documentation

bool L2MuonIsolationProducer::optOutputDecision
private

Definition at line 49 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

bool L2MuonIsolationProducer::optOutputIsolatorFloat
private

Definition at line 52 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

muonisolation::MuIsoBaseIsolator* L2MuonIsolationProducer::theDepositIsolator
private

Definition at line 58 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

reco::isodeposit::IsoDepositExtractor* L2MuonIsolationProducer::theExtractor
private
edm::InputTag L2MuonIsolationProducer::theSACollectionLabel
private

Definition at line 45 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

edm::EDGetTokenT<reco::RecoChargedCandidateCollection> L2MuonIsolationProducer::theSACollectionToken
private

Definition at line 46 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().