CMS 3D CMS Logo

Public Member Functions | Private Attributes

L2MuonIsolationProducer Class Reference

#include <L2MuonIsolationProducer.h>

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

List of all members.

Public Member Functions

virtual void beginJob ()
 setup the job
 L2MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config
virtual void produce (edm::Event &, const edm::EventSetup &)
 Produce isolation maps.
virtual ~L2MuonIsolationProducer ()
 destructor

Private Attributes

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

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, theDepositIsolator, and theExtractor.

                                                                        :
  theSACollectionLabel(par.getParameter<edm::InputTag>("StandAloneCollectionLabel")), 
  theExtractor(0),
  theDepositIsolator(0)
{
  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer constructor called";


  //
  // Extractor
  //
  edm::ParameterSet extractorPSet = par.getParameter<edm::ParameterSet>("ExtractorPSet");
  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet);  

  
  edm::ParameterSet isolatorPSet = par.getParameter<edm::ParameterSet>("IsolatorPSet");
  optOutputDecision = !isolatorPSet.empty();
  if (optOutputDecision){
    std::string type = isolatorPSet.getParameter<std::string>("ComponentName");
    theDepositIsolator = MuonIsolatorFactory::get()->create(type,isolatorPSet);
  }
  if (optOutputDecision) produces<edm::ValueMap<bool> >();
  produces<reco::IsoDepositMap>();
}
L2MuonIsolationProducer::~L2MuonIsolationProducer ( ) [virtual]

destructor

Definition at line 61 of file L2MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

                                                 {
  LogDebug("Muon|RecoMuon|L2MuonIsolationProducer")<<" L2MuonIsolationProducer destructor called";
  if (theExtractor) delete theExtractor;
}

Member Function Documentation

void L2MuonIsolationProducer::beginJob ( void  ) [virtual]

setup the job

beginJob

Reimplemented from edm::EDProducer.

Definition at line 67 of file L2MuonIsolationProducer.cc.

                                      {

}
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

Implements edm::EDProducer.

Definition at line 72 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, muonisolation::MuIsoBaseIsolator::result(), theDepositIsolator, theExtractor, theSACollectionLabel, and testEve_cfg::tracks.

                                                                               {
  std::string metname = "Muon|RecoMuon|L2MuonIsolationProducer";
  
  LogDebug(metname)<<" L2 Muon Isolation producing...";

  // Take the SA container
  LogDebug(metname)<<" Taking the StandAlone muons: "<<theSACollectionLabel;
  Handle<TrackCollection> tracks;
  event.getByLabel(theSACollectionLabel,tracks);

  // Find deposits and load into event
  LogDebug(metname)<<" Get energy around";
  std::auto_ptr<reco::IsoDepositMap> depMap( new reco::IsoDepositMap());
  std::auto_ptr<edm::ValueMap<bool> > isoMap( new edm::ValueMap<bool> ());

  theExtractor->fillVetos(event,eventSetup,*tracks);

  unsigned int nTracks = tracks->size();
  std::vector<IsoDeposit> deps(nTracks);
  std::vector<bool> isos(nTracks, false);

  for (unsigned int i=0; i<nTracks; i++) {
      TrackRef tk(tracks,i);

      deps[i] = theExtractor->deposit(event, eventSetup, *tk);

      if (optOutputDecision){
        muonisolation::MuIsoBaseIsolator::DepositContainer isoContainer(1,muonisolation::MuIsoBaseIsolator::DepositAndVetos(&deps[i]));
        isos[i] = theDepositIsolator->result( isoContainer, *tk ).valBool;
      }
  }

  

  reco::IsoDepositMap::Filler depFiller(*depMap);
  depFiller.insert(tracks, deps.begin(), deps.end());
  depFiller.fill();
  event.put(depMap);

  if (optOutputDecision){
    edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
    isoFiller.insert(tracks, isos.begin(), isos.end());
    isoFiller.fill();
    event.put(isoMap);
  }
  
  LogDebug(metname) <<" Event loaded"
                    <<"================================";
}

Member Data Documentation

Definition at line 42 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

Definition at line 48 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

Definition at line 39 of file L2MuonIsolationProducer.h.

Referenced by produce().