CMS 3D CMS Logo

Public Member Functions | Private Attributes

L3MuonCandidateProducerFromMuons Class Reference

#include <L3MuonCandidateProducerFromMuons.h>

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

List of all members.

Public Member Functions

 L3MuonCandidateProducerFromMuons (const edm::ParameterSet &)
 constructor with config
virtual void produce (edm::Event &, const edm::EventSetup &)
 produce candidates
virtual ~L3MuonCandidateProducerFromMuons ()
 destructor

Private Attributes

edm::InputTag m_L3CollectionLabel

Detailed Description

This class takes the tracker muons (which are reco::Muons) and creates the correspondent reco::RecoChargedCandidate.

Intermediate step in the L3 muons selection. This class takes the tracker muons (which are reco::Muons) and creates the correspondent reco::RecoChargedCandidate.

Definition at line 17 of file L3MuonCandidateProducerFromMuons.h.


Constructor & Destructor Documentation

L3MuonCandidateProducerFromMuons::L3MuonCandidateProducerFromMuons ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 37 of file L3MuonCandidateProducerFromMuons.cc.

References category(), and LogTrace.

                                                                                                   :
  m_L3CollectionLabel( parameterSet.getParameter<InputTag>("InputObjects") )       // standAlone Collection Label
{
  LogTrace(category)<<" constructor called";
  produces<RecoChargedCandidateCollection>();
}
L3MuonCandidateProducerFromMuons::~L3MuonCandidateProducerFromMuons ( ) [virtual]

destructor

Definition at line 45 of file L3MuonCandidateProducerFromMuons.cc.

References category(), and LogTrace.

                                                                   {
  LogTrace(category)<<" L3MuonCandidateProducerFromMuons destructor called";
}

Member Function Documentation

void L3MuonCandidateProducerFromMuons::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

produce candidates

reconstruct muons

Implements edm::EDProducer.

Definition at line 51 of file L3MuonCandidateProducerFromMuons.cc.

References abs, category(), i, edm::HandleBase::isValid(), edm::InputTag::label(), LogTrace, m_L3CollectionLabel, ExpressReco_HICollisions_FallBack::muons, p4, evf::utils::pid, lumiQueryAPI::q, reco::RecoChargedCandidate::setTrack(), and edm::HandleBase::whyFailed().

                                                                                        {
  // Create a RecoChargedCandidate collection
  LogTrace(category)<<" Creating the RecoChargedCandidate collection";
  auto_ptr<RecoChargedCandidateCollection> candidates( new RecoChargedCandidateCollection());

  // Take the L3 container
  LogTrace(category)<<" Taking the L3/GLB muons: "<<m_L3CollectionLabel.label();
  Handle<reco::MuonCollection> muons;
  event.getByLabel(m_L3CollectionLabel,muons);

  if (not muons.isValid()) {
    LogError(category) << muons.whyFailed()->what();
  } else { 
    for (unsigned int i=0; i<muons->size(); i++) {
      TrackRef tkref = (*muons)[i].innerTrack();

      Particle::Charge q = tkref->charge();
      Particle::LorentzVector p4(tkref->px(), tkref->py(), tkref->pz(), tkref->p());
      Particle::Point vtx(tkref->vx(),tkref->vy(), tkref->vz());

      int pid = 13;
      if (abs(q)==1) 
        pid = q < 0 ? 13 : -13;
      else 
        LogWarning(category) << "L3MuonCandidate has charge = " << q;
      RecoChargedCandidate cand(q, p4, vtx, pid);

      cand.setTrack(tkref);
      candidates->push_back(cand);
    }
  }
  event.put(candidates);
}

Member Data Documentation

Definition at line 33 of file L3MuonCandidateProducerFromMuons.h.

Referenced by produce().