CMS 3D CMS Logo

Public Member Functions | Private Attributes

L3MuonIsolationProducer Class Reference

#include <L3MuonIsolationProducer.h>

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

List of all members.

Public Member Functions

virtual void beginJob ()
 initialisation
 L3MuonIsolationProducer (const edm::ParameterSet &)
 constructor with config
virtual void produce (edm::Event &, const edm::EventSetup &)
 Produce isolation maps.
virtual ~L3MuonIsolationProducer ()
 destructor

Private Attributes

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

Detailed Description

Definition at line 18 of file L3MuonIsolationProducer.h.


Constructor & Destructor Documentation

L3MuonIsolationProducer::L3MuonIsolationProducer ( const edm::ParameterSet par)

constructor with config

Definition at line 36 of file L3MuonIsolationProducer.cc.

References LogDebug, and optOutputIsoDeposits.

                                                                        :
  theConfig(par),
  theMuonCollectionLabel(par.getParameter<InputTag>("inputMuonCollection")),
  optOutputIsoDeposits(par.getParameter<bool>("OutputMuIsoDeposits")),
  theExtractor(0),
  theTrackPt_Min(-1)
  {
  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer CTOR";

  if (optOutputIsoDeposits) produces<reco::IsoDepositMap>();
  produces<edm::ValueMap<bool> >();
}
L3MuonIsolationProducer::~L3MuonIsolationProducer ( ) [virtual]

destructor

Definition at line 50 of file L3MuonIsolationProducer.cc.

References LogDebug, and theExtractor.

                                                 {
  LogDebug("RecoMuon|L3MuonIsolationProducer")<<" L3MuonIsolationProducer DTOR";
  if (theExtractor) delete theExtractor;
}

Member Function Documentation

void L3MuonIsolationProducer::beginJob ( void  ) [virtual]

initialisation

get min pt for the track to go into sumPt

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

Reimplemented from edm::EDProducer.

Definition at line 55 of file L3MuonIsolationProducer.cc.

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

{

  //
  // Extractor
  //
  edm::ParameterSet extractorPSet = theConfig.getParameter<edm::ParameterSet>("ExtractorPSet");
  theTrackPt_Min = theConfig.getParameter<double>("TrackPt_Min");
  std::string extractorName = extractorPSet.getParameter<std::string>("ComponentName");
  theExtractor = IsoDepositExtractorFactory::get()->create( extractorName, extractorPSet);
  std::string depositType = extractorPSet.getUntrackedParameter<std::string>("DepositLabel");
  
  //
  // Cuts
  //
  edm::ParameterSet cutsPSet = theConfig.getParameter<edm::ParameterSet>("CutsPSet");
  std::string cutsName = cutsPSet.getParameter<std::string>("ComponentName");
  if (cutsName == "SimpleCuts") {
    theCuts = Cuts(cutsPSet);
  } 
  else if (
//        (cutsName== "L3NominalEfficiencyCuts_PXLS" && depositType=="PXLS")
//     || (cutsName== "L3NominalEfficiencyCuts_TRKS" && depositType=="TRKS") 
           (cutsName== "L3NominalEfficiencyCuts_PXLS" )
           || (cutsName== "L3NominalEfficiencyCuts_TRKS") ) {
    theCuts = L3NominalEfficiencyConfigurator(cutsPSet).cuts();
  } 
  else {
    LogError("L3MuonIsolationProducer::beginJob")
      <<"cutsName: "<<cutsPSet<<" is not recognized:"
      <<" theCuts not set!";
  }
  LogTrace("")<< theCuts.print();

  // (kludge) additional cut on the number of tracks
  theMaxNTracks = cutsPSet.getParameter<int>("maxNTracks");
  theApplyCutsORmaxNTracks = cutsPSet.getParameter<bool>("applyCutsORmaxNTracks");
}
void L3MuonIsolationProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

Produce isolation maps.

Implements edm::EDProducer.

Definition at line 96 of file L3MuonIsolationProducer.cc.

References muonisolation::Cuts::CutSpec::conesize, prof2calltree::count, align_tpl::cut, reco::isodeposit::IsoDepositExtractor::deposit(), reco::IsoDeposit::depositAndCountWithin(), reco::TrackBase::eta(), edm::helper::Filler< Map >::fill(), i, edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, RPCpg::mu, patZpeak::muons, optOutputIsoDeposits, reco::IsoDeposit::print(), query::result, theApplyCutsORmaxNTracks, theCuts, theExtractor, theMaxNTracks, theMuonCollectionLabel, theTrackPt_Min, muonisolation::Cuts::CutSpec::threshold, relativeConstraints::value, and reco::IsoDeposit::veto().

                                                                               {
  std::string metname = "RecoMuon|L3MuonIsolationProducer";
  
  LogDebug(metname)<<" L3 Muon Isolation producing..."
                    <<" BEGINING OF EVENT " <<"================================";

  // Take the SA container
  LogTrace(metname)<<" Taking the muons: "<<theMuonCollectionLabel;
  Handle<TrackCollection> muons;
  event.getByLabel(theMuonCollectionLabel,muons);

  std::auto_ptr<reco::IsoDepositMap> depMap( new reco::IsoDepositMap());
  std::auto_ptr<edm::ValueMap<bool> > isoMap( new edm::ValueMap<bool> ());


  //
  // get Vetos and deposits
  //
  unsigned int nMuons = muons->size();

  IsoDeposit::Vetos vetos(nMuons);
  
  std::vector<IsoDeposit> deps(nMuons);
  std::vector<bool> isos(nMuons, false);

  for (unsigned int i=0; i<nMuons; i++) {
    TrackRef mu(muons,i);
    deps[i] = theExtractor->deposit(event, eventSetup, *mu);
    vetos[i] = deps[i].veto();
  }

  //
  // add here additional vetos
  //
  //.....

  //
  // actual cut step
  //
  for(unsigned int iMu=0; iMu < nMuons; ++iMu){
    const reco::Track* mu = &(*muons)[iMu];

    const IsoDeposit & deposit = deps[iMu];
    LogTrace(metname)<< deposit.print();

    const Cuts::CutSpec & cut = theCuts( mu->eta());
    std::pair<double, int> sumAndCount = deposit.depositAndCountWithin(cut.conesize, vetos, theTrackPt_Min);

    double value = sumAndCount.first;
    int count = sumAndCount.second;

    bool result = (value < cut.threshold); 
    if (theApplyCutsORmaxNTracks ) result |= count <= theMaxNTracks;
    LogTrace(metname)<<"deposit in cone: "<<value<<"with count "<<count<<" is isolated: "<<result;

    isos[iMu] = result;
  }

  //
  // store
  //
  if (optOutputIsoDeposits){
    reco::IsoDepositMap::Filler depFiller(*depMap);
    depFiller.insert(muons, deps.begin(), deps.end());
    depFiller.fill();
    event.put(depMap);
  }
  edm::ValueMap<bool> ::Filler isoFiller(*isoMap);
  isoFiller.insert(muons, isos.begin(), isos.end());
  isoFiller.fill();
  event.put(isoMap);

  LogTrace(metname) <<" END OF EVENT " <<"================================";
}

Member Data Documentation

Definition at line 45 of file L3MuonIsolationProducer.h.

Referenced by L3MuonIsolationProducer(), and produce().

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

Definition at line 59 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), and produce().

Definition at line 36 of file L3MuonIsolationProducer.h.

Referenced by beginJob().

Definition at line 42 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), and produce().

Definition at line 48 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), produce(), and ~L3MuonIsolationProducer().

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

Definition at line 56 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), and produce().

Definition at line 39 of file L3MuonIsolationProducer.h.

Referenced by produce().

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

Definition at line 52 of file L3MuonIsolationProducer.h.

Referenced by beginJob(), and produce().