#include <RecoMuon/MuonIdentification/plugins/MuonProducer.h>
Public Member Functions | |
MuonProducer (const edm::ParameterSet &) | |
Constructor. | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
reconstruct muons | |
virtual | ~MuonProducer () |
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 |
Definition at line 22 of file MuonProducer.h.
MuonProducer::MuonProducer | ( | const edm::ParameterSet & | pSet | ) |
Constructor.
Definition at line 31 of file MuonProducer.cc.
References edm::ParameterSet::getParameter(), setAlias(), theAlias, and theLinksCollectionLabel.
00031 { 00032 00033 theLinksCollectionLabel = pSet.getParameter<InputTag>("InputObjects"); 00034 00035 setAlias(pSet.getParameter<std::string>("@module_label")); 00036 produces<reco::MuonCollection>().setBranchAlias(theAlias + "s"); 00037 }
MuonProducer::~MuonProducer | ( | ) | [virtual] |
void MuonProducer::printTrackRecHits | ( | const reco::Track & | track, | |
edm::ESHandle< GlobalTrackingGeometry > | trackingGeometry | |||
) | const [private] |
Definition at line 44 of file MuonProducer.cc.
References lat::endl(), reco::Track::found(), i, LogTrace, reco::Track::lost(), GloballyPositioned< T >::position(), r, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), GeomDet::surface(), GeomDet::toGlobal(), and z.
Referenced by produce().
00045 { 00046 00047 const std::string metname = "Muon|RecoMuon|MuonIdentification|MuonProducer"; 00048 00049 LogTrace(metname) << "Valid RecHits: "<<track.found() << " invalid RecHits: " << track.lost(); 00050 00051 int i = 0; 00052 for(trackingRecHit_iterator recHit = track.recHitsBegin(); recHit != track.recHitsEnd(); ++recHit) 00053 if((*recHit)->isValid()){ 00054 const GeomDet* geomDet = trackingGeometry->idToDet((*recHit)->geographicalId()); 00055 double r = geomDet->surface().position().perp(); 00056 double z = geomDet->toGlobal((*recHit)->localPosition()).z(); 00057 LogTrace(metname) << i++ <<" r: "<< r <<" z: "<<z <<" "<<geomDet->toGlobal((*recHit)->localPosition()) 00058 <<std::endl; 00059 } 00060 }
void MuonProducer::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
reconstruct muons
Implements edm::EDProducer.
Definition at line 65 of file MuonProducer.cc.
References relval_parameters_module::energy, edm::EventSetup::get(), LogTrace, metsig::muon, p4, printTrackRecHits(), reco::Particle::setCharge(), reco::Muon::setCombined(), reco::Particle::setP4(), reco::Muon::setStandAlone(), reco::Muon::setTrack(), reco::Particle::setVertex(), funct::sqrt(), and theLinksCollectionLabel.
00065 { 00066 00067 const std::string metname = "Muon|RecoMuon|MuonIdentification|MuonProducer"; 00068 00069 // the muon collection, it will be loaded in the event 00070 std::auto_ptr<reco::MuonCollection> muonCollection(new reco::MuonCollection()); 00071 00072 00073 Handle<reco::MuonTrackLinksCollection> linksCollection; 00074 event.getByLabel(theLinksCollectionLabel,linksCollection); 00075 00076 if(linksCollection->empty()) { 00077 event.put(muonCollection); 00078 return; 00079 } 00080 00081 00082 // Global Tracking Geometry 00083 ESHandle<GlobalTrackingGeometry> trackingGeometry; 00084 eventSetup.get<GlobalTrackingGeometryRecord>().get(trackingGeometry); 00085 00086 for(reco::MuonTrackLinksCollection::const_iterator links = linksCollection->begin(); 00087 links != linksCollection->end(); ++links){ 00088 00089 // some temporary print-out 00090 LogTrace(metname) << "trackerTrack"; 00091 printTrackRecHits(*(links->trackerTrack()),trackingGeometry); 00092 LogTrace(metname) << "standAloneTrack"; 00093 printTrackRecHits(*(links->standAloneTrack()),trackingGeometry); 00094 LogTrace(metname) << "globalTrack"; 00095 printTrackRecHits(*(links->globalTrack()),trackingGeometry); 00096 00097 // Fill the muon 00098 reco::Muon muon; 00099 muon.setStandAlone(links->standAloneTrack()); 00100 muon.setTrack(links->trackerTrack()); 00101 muon.setCombined(links->globalTrack()); 00102 00103 // FIXME: can this break in case combined info cannot be added to some tracks? 00104 muon.setCharge(links->globalTrack()->charge()); 00105 00106 //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV 00107 double energy = sqrt(links->globalTrack()->p() * links->globalTrack()->p() + 0.011163691); 00108 math::XYZTLorentzVector p4(links->globalTrack()->px(), 00109 links->globalTrack()->py(), 00110 links->globalTrack()->pz(), 00111 energy); 00112 00113 muon.setP4(p4); 00114 muon.setVertex(links->globalTrack()->vertex()); 00115 00116 muonCollection->push_back(muon); 00117 00118 } 00119 00120 event.put(muonCollection); 00121 }
void MuonProducer::setAlias | ( | std::string | alias | ) | [inline, private] |
Definition at line 40 of file MuonProducer.h.
References theAlias.
Referenced by MuonProducer().
00040 { 00041 alias.erase( alias.size() - 1, alias.size() ); 00042 theAlias=alias; 00043 }
std::string MuonProducer::theAlias [private] |