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

#include <L2MuonIsolationProducer.h>

Inheritance diagram for L2MuonIsolationProducer:
edm::EDProducer edm::ProducerBase 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 ()
 
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

bool optOutputDecision
 
bool optOutputIsolatorFloat
 
muonisolation::MuIsoBaseIsolatortheDepositIsolator
 
reco::isodeposit::IsoDepositExtractortheExtractor
 
edm::InputTag theSACollectionLabel
 

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

Author
J. Alcaraz

L2 HLT muon isolation producer

Author
J.Alcaraz

Definition at line 19 of file L2MuonIsolationProducer.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 34 of file L2MuonIsolationProducer.cc.

References edm::ParameterSet::empty(), reco::get(), edm::ParameterSet::getParameter(), LogDebug, optOutputDecision, optOutputIsolatorFloat, theDepositIsolator, and theExtractor.

34  :
35  theSACollectionLabel(par.getParameter<edm::InputTag>("StandAloneCollectionLabel")),
36  theExtractor(0),
38 {
39  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer constructor called";
40 
41 
42  //
43  // Extractor
44  //
45  edm::ParameterSet extractorPSet = par.getParameter<edm::ParameterSet>("ExtractorPSet");
46  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
47  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet);
48 
49 
50  edm::ParameterSet isolatorPSet = par.getParameter<edm::ParameterSet>("IsolatorPSet");
51  bool haveIsolator = !isolatorPSet.empty();
52  optOutputDecision = haveIsolator;
53  if (optOutputDecision){
54  std::string type = isolatorPSet.getParameter<std::string>("ComponentName");
55  theDepositIsolator = MuonIsolatorFactory::get()->create(type,isolatorPSet);
56  }
57  if (optOutputDecision) produces<edm::ValueMap<bool> >();
58  produces<reco::IsoDepositMap>();
59 
60  optOutputIsolatorFloat = par.getParameter<bool>("WriteIsolatorFloat");
61  if (optOutputIsolatorFloat && haveIsolator){
62  produces<edm::ValueMap<float> >();
63  }
64 }
#define LogDebug(id)
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
bool empty() const
Definition: ParameterSet.h:219
reco::isodeposit::IsoDepositExtractor * theExtractor
muonisolation::MuIsoBaseIsolator * theDepositIsolator
T get(const Candidate &c)
Definition: component.h:56
L2MuonIsolationProducer::~L2MuonIsolationProducer ( )
virtual

destructor

Definition at line 67 of file L2MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

67  {
68  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer destructor called";
69  if (theExtractor) delete theExtractor;
70 }
#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 73 of file L2MuonIsolationProducer.cc.

73  {
74 
75 }
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 78 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, optOutputDecision, optOutputIsolatorFloat, muonisolation::MuIsoBaseIsolator::result(), theDepositIsolator, theExtractor, theSACollectionLabel, testEve_cfg::tracks, muonisolation::MuIsoBaseIsolator::Result::valBool, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

78  {
79  std::string metname = "Muon|RecoMuon|L2MuonIsolationProducer";
80 
81  LogDebug(metname)<<" L2 Muon Isolation producing...";
82 
83  // Take the SA container
84  LogDebug(metname)<<" Taking the StandAlone muons: "<<theSACollectionLabel;
86  event.getByLabel(theSACollectionLabel,tracks);
87 
88  // Find deposits and load into event
89  LogDebug(metname)<<" Get energy around";
90  std::auto_ptr<reco::IsoDepositMap> depMap( new reco::IsoDepositMap());
91  std::auto_ptr<edm::ValueMap<bool> > isoMap( new edm::ValueMap<bool> ());
92  std::auto_ptr<edm::ValueMap<float> > isoFloatMap( new edm::ValueMap<float> ());
93 
94  theExtractor->fillVetos(event,eventSetup,*tracks);
95 
96  unsigned int nTracks = tracks->size();
97  std::vector<IsoDeposit> deps(nTracks);
98  std::vector<bool> isos(nTracks, false);
99  std::vector<float> isoFloats(nTracks, 0);
100 
101  for (unsigned int i=0; i<nTracks; i++) {
102  TrackRef tk(tracks,i);
103 
104  deps[i] = theExtractor->deposit(event, eventSetup, *tk);
105 
106  if (optOutputDecision){
108  muonisolation::MuIsoBaseIsolator::Result isoResult = theDepositIsolator->result( isoContainer, *tk, &event );
109  isos[i] = isoResult.valBool;
110  isoFloats[i] = isoResult.valFloat;
111  }
112  }
113 
114 
115 
117  reco::IsoDepositMap::Filler depFiller(*depMap);
118  depFiller.insert(tracks, deps.begin(), deps.end());
119  depFiller.fill();
120  event.put(depMap);
121 
122  if (optOutputDecision){
123  edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
124  isoFiller.insert(tracks, isos.begin(), isos.end());
125  isoFiller.fill();
126  event.put(isoMap);
127 
129  edm::ValueMap<float> ::Filler isoFloatFiller(*isoFloatMap);
130  isoFloatFiller.insert(tracks, isoFloats.begin(), isoFloats.end());
131  isoFloatFiller.fill();
132  event.put(isoFloatMap);
133  }
134  }
135 
136  LogDebug(metname) <<" Event loaded"
137  <<"================================";
138 }
#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.
virtual void fillVetos(const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackCollection &tracks)=0
std::vector< DepositAndVetos > DepositContainer
tuple tracks
Definition: testEve_cfg.py:39
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 42 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

bool L2MuonIsolationProducer::optOutputIsolatorFloat
private

Definition at line 45 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

muonisolation::MuIsoBaseIsolator* L2MuonIsolationProducer::theDepositIsolator
private

Definition at line 51 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

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

Definition at line 39 of file L2MuonIsolationProducer.h.

Referenced by produce().