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
bool optOutputIsolatorFloat
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, optOutputIsolatorFloat, 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");
  bool haveIsolator = !isolatorPSet.empty();
  optOutputDecision = haveIsolator;
  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>();

  optOutputIsolatorFloat = par.getParameter<bool>("WriteIsolatorFloat");
  if (optOutputIsolatorFloat && haveIsolator){
    produces<edm::ValueMap<float> >();
  }
}
L2MuonIsolationProducer::~L2MuonIsolationProducer ( ) [virtual]

destructor

Definition at line 67 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 73 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

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.

                                                                               {
  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> ());
  std::auto_ptr<edm::ValueMap<float> > isoFloatMap( new edm::ValueMap<float> ());

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

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

  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]));
        muonisolation::MuIsoBaseIsolator::Result isoResult = theDepositIsolator->result( isoContainer, *tk, &event );
        isos[i] = isoResult.valBool;
        isoFloats[i] = isoResult.valFloat;
      }
  }

  

  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);

    if (optOutputIsolatorFloat){
      edm::ValueMap<float> ::Filler isoFloatFiller(*isoFloatMap);
      isoFloatFiller.insert(tracks, isoFloats.begin(), isoFloats.end());
      isoFloatFiller.fill();
      event.put(isoFloatMap);
    }
  }
  
  LogDebug(metname) <<" Event loaded"
                    <<"================================";
}

Member Data Documentation

Definition at line 42 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

Definition at line 45 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

Definition at line 51 of file L2MuonIsolationProducer.h.

Referenced by L2MuonIsolationProducer(), and produce().

Definition at line 39 of file L2MuonIsolationProducer.h.

Referenced by produce().