CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GlobalMuonToMuonProducer Class Reference

#include <GlobalMuonToMuonProducer.h>

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

List of all members.

Public Member Functions

 GlobalMuonToMuonProducer (const edm::ParameterSet &)
 Constructor.
virtual void produce (edm::Event &, const edm::EventSetup &)
 reconstruct muons
virtual ~GlobalMuonToMuonProducer ()
 Destructor.

Private Member Functions

void printTrackRecHits (const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
void setAlias (std::string alias)

Private Attributes

std::string theAlias
edm::InputTag theLinksCollectionLabel

Detailed Description

No description available.

Date:
2011/05/31 14:44:35
Revision:
1.1
Author:
R. Bellan - INFN Torino <riccardo.bellan@cern.ch>

Definition at line 22 of file GlobalMuonToMuonProducer.h.


Constructor & Destructor Documentation

GlobalMuonToMuonProducer::GlobalMuonToMuonProducer ( const edm::ParameterSet pSet)

Constructor.

Definition at line 29 of file GlobalMuonToMuonProducer.cc.

References edm::ParameterSet::getParameter(), setAlias(), theAlias, and theLinksCollectionLabel.

                                                                             {

  theLinksCollectionLabel = pSet.getParameter<edm::InputTag>("InputObjects");

  setAlias(pSet.getParameter<std::string>("@module_label"));
  produces<reco::MuonCollection>().setBranchAlias(theAlias + "s");
}
GlobalMuonToMuonProducer::~GlobalMuonToMuonProducer ( ) [virtual]

Destructor.

Definition at line 38 of file GlobalMuonToMuonProducer.cc.

                                                   {

}

Member Function Documentation

void GlobalMuonToMuonProducer::printTrackRecHits ( const reco::Track track,
edm::ESHandle< GlobalTrackingGeometry trackingGeometry 
) const [private]

Definition at line 42 of file GlobalMuonToMuonProducer.cc.

References reco::Track::found(), i, LogTrace, reco::Track::lost(), metname, GloballyPositioned< T >::position(), alignCSCRings::r, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), GeomDet::surface(), GeomDet::toGlobal(), and z.

Referenced by produce().

                                                                                                {

  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";

  LogTrace(metname) << "Valid RecHits: "<<track.found() << " invalid RecHits: " << track.lost();
  
  int i = 0;
  for(trackingRecHit_iterator recHit = track.recHitsBegin(); recHit != track.recHitsEnd(); ++recHit)
    if((*recHit)->isValid()){
      const GeomDet* geomDet = trackingGeometry->idToDet((*recHit)->geographicalId());
      double r = geomDet->surface().position().perp();
      double z = geomDet->toGlobal((*recHit)->localPosition()).z();
      LogTrace(metname) << i++ <<" r: "<< r <<" z: "<<z <<" "<<geomDet->toGlobal((*recHit)->localPosition())
                        <<std::endl;
    }
}
void GlobalMuonToMuonProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
) [virtual]

reconstruct muons

Implements edm::EDProducer.

Definition at line 63 of file GlobalMuonToMuonProducer.cc.

References relval_parameters_module::energy, edm::EventSetup::get(), LogTrace, metname, metsig::muon, p4, printTrackRecHits(), reco::LeafCandidate::setCharge(), reco::Muon::setCombined(), reco::LeafCandidate::setP4(), reco::Muon::setStandAlone(), reco::Muon::setTrack(), reco::LeafCandidate::setVertex(), mathSSE::sqrt(), and theLinksCollectionLabel.

                                                                                      {

   const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";

   // the muon collection, it will be loaded in the event
   std::auto_ptr<reco::MuonCollection> muonCollection(new reco::MuonCollection());
   

   edm::Handle<reco::MuonTrackLinksCollection> linksCollection; 
   event.getByLabel(theLinksCollectionLabel,linksCollection);

   if(linksCollection->empty()) {
     event.put(muonCollection);
     return;
   }
   

   // Global Tracking Geometry
   edm::ESHandle<GlobalTrackingGeometry> trackingGeometry; 
   eventSetup.get<GlobalTrackingGeometryRecord>().get(trackingGeometry); 
   
   for(reco::MuonTrackLinksCollection::const_iterator links = linksCollection->begin();
       links != linksCollection->end(); ++links){

     // some temporary print-out
     LogTrace(metname) << "trackerTrack";
     printTrackRecHits(*(links->trackerTrack()),trackingGeometry);
     LogTrace(metname) << "standAloneTrack";
     printTrackRecHits(*(links->standAloneTrack()),trackingGeometry);
     LogTrace(metname) << "globalTrack";
     printTrackRecHits(*(links->globalTrack()),trackingGeometry);
    
     // Fill the muon 
     reco::Muon muon;
     muon.setStandAlone(links->standAloneTrack());
     muon.setTrack(links->trackerTrack());
     muon.setCombined(links->globalTrack());
     
     // FIXME: can this break in case combined info cannot be added to some tracks?
     muon.setCharge(links->globalTrack()->charge());

     //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV 
     double energy = sqrt(links->globalTrack()->p() * links->globalTrack()->p() + 0.011163691);
     math::XYZTLorentzVector p4(links->globalTrack()->px(),
                                links->globalTrack()->py(),
                                links->globalTrack()->pz(),
                                energy);

     muon.setP4(p4);
     muon.setVertex(links->globalTrack()->vertex());
       
    muonCollection->push_back(muon);
     
   }

   event.put(muonCollection);
}
void GlobalMuonToMuonProducer::setAlias ( std::string  alias) [inline, private]

Definition at line 40 of file GlobalMuonToMuonProducer.h.

References theAlias.

Referenced by GlobalMuonToMuonProducer().

                                  {
    alias.erase( alias.size() - 1, alias.size() );
    theAlias=alias;
  }

Member Data Documentation

std::string GlobalMuonToMuonProducer::theAlias [private]

Definition at line 38 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and setAlias().

Definition at line 52 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and produce().