#include <RecoMuon/GlobalMuonProducer/src/GlobalMuonProducer.h>
Public Member Functions | |
GlobalMuonProducer (const edm::ParameterSet &) | |
constructor with config | |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
reconstruct muons | |
virtual | ~GlobalMuonProducer () |
destructor | |
Private Member Functions | |
void | setAlias (std::string alias) |
Private Attributes | |
std::string | theAlias |
MuonServiceProxy * | theService |
the event setup proxy, it takes care the services update | |
edm::InputTag | theSTACollectionLabel |
STA Label. | |
MuonTrackFinder * | theTrackFinder |
Definition at line 25 of file GlobalMuonProducer.h.
GlobalMuonProducer::GlobalMuonProducer | ( | const edm::ParameterSet & | parameterSet | ) |
constructor with config
Definition at line 45 of file GlobalMuonProducer.cc.
References edm::ParameterSet::addParameter(), lat::endl(), edm::ParameterSet::getParameter(), LogTrace, MuonServiceProxy_cff::MuonServiceProxy, setAlias(), theAlias, theService, theSTACollectionLabel, and theTrackFinder.
00045 { 00046 00047 LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl; 00048 00049 // Parameter set for the Builder 00050 ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters"); 00051 InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel"); 00052 trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel",trackCollectionTag); 00053 00054 // STA Muon Collection Label 00055 theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel"); 00056 00057 // service parameters 00058 ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters"); 00059 00060 // TrackLoader parameters 00061 ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters"); 00062 00063 // the services 00064 theService = new MuonServiceProxy(serviceParameters); 00065 00066 // instantiate the concrete trajectory builder in the Track Finder 00067 MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,theService); 00068 GlobalMuonTrajectoryBuilder* gmtb = new GlobalMuonTrajectoryBuilder(trajectoryBuilderParameters, theService); 00069 00070 theTrackFinder = new MuonTrackFinder(gmtb, mtl); 00071 00072 setAlias(parameterSet.getParameter<std::string>("@module_label")); 00073 produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks"); 00074 produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits"); 00075 produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras"); 00076 produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories") ; 00077 produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap"); 00078 produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s"); 00079 }
GlobalMuonProducer::~GlobalMuonProducer | ( | ) | [virtual] |
destructor
Definition at line 85 of file GlobalMuonProducer.cc.
References lat::endl(), LogTrace, theService, and theTrackFinder.
00085 { 00086 00087 LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl; 00088 if (theService) delete theService; 00089 if (theTrackFinder) delete theTrackFinder; 00090 00091 }
void GlobalMuonProducer::produce | ( | edm::Event & | event, | |
const edm::EventSetup & | eventSetup | |||
) | [virtual] |
reconstruct muons
Implements edm::EDProducer.
Definition at line 97 of file GlobalMuonProducer.cc.
References lat::endl(), edm::Event::getByLabel(), edm::InputTag::instance(), edm::Ref< C, T, F >::isNonnull(), it, edm::InputTag::label(), LogTrace, MuonTrackFinder::reconstruct(), theService, theSTACollectionLabel, and theTrackFinder.
00097 { 00098 const string metname = "Muon|RecoMuon|GlobalMuonProducer"; 00099 LogTrace(metname)<<endl<<endl<<endl; 00100 LogTrace(metname)<<"Global Muon Reconstruction started"<<endl; 00101 00102 // Update the services 00103 theService->update(eventSetup); 00104 00105 // Take the STA muon container(s) 00106 Handle<reco::TrackCollection> staMuons; 00107 event.getByLabel(theSTACollectionLabel,staMuons); 00108 00109 Handle<vector<Trajectory> > staMuonsTraj; 00110 00111 LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons "<<theSTACollectionLabel<<endl; 00112 00113 vector<MuonTrajectoryBuilder::TrackCand> staTrackCands; 00114 00115 edm::Handle<TrajTrackAssociationCollection> staAssoMap; 00116 00117 edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap; 00118 00119 if( event.getByLabel(theSTACollectionLabel.label(), staMuonsTraj) && event.getByLabel(theSTACollectionLabel.label(),staAssoMap) && event.getByLabel(theSTACollectionLabel.label(),updatedStaAssoMap) ) { 00120 00121 for(TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it){ 00122 const Ref<vector<Trajectory> > traj = it->key; 00123 const reco::TrackRef tkRegular = it->val; 00124 reco::TrackRef tkUpdated; 00125 reco::TrackToTrackMap::const_iterator iEnd; 00126 reco::TrackToTrackMap::const_iterator iii; 00127 if ( theSTACollectionLabel.instance() == "UpdatedAtVtx") { 00128 iEnd = updatedStaAssoMap->end(); 00129 iii = updatedStaAssoMap->find(it->val); 00130 if (iii != iEnd ) tkUpdated = (*updatedStaAssoMap)[it->val] ; 00131 } 00132 00133 const reco::TrackRef tk = ( tkUpdated.isNonnull() ) ? tkUpdated : tkRegular ; 00134 00135 MuonTrajectoryBuilder::TrackCand tkCand = MuonTrajectoryBuilder::TrackCand(0,tk); 00136 if( traj->isValid() ) tkCand.first = &*traj ; 00137 staTrackCands.push_back(tkCand); 00138 } 00139 } else { 00140 for ( unsigned int position = 0; position != staMuons->size(); ++position ) { 00141 reco::TrackRef staTrackRef(staMuons,position); 00142 MuonTrajectoryBuilder::TrackCand staCand = MuonTrajectoryBuilder::TrackCand(0,staTrackRef); 00143 staTrackCands.push_back(staCand); 00144 } 00145 } 00146 00147 theTrackFinder->reconstruct(staTrackCands, event); 00148 00149 00150 LogTrace(metname)<<"Event loaded" 00151 <<"================================" 00152 <<endl<<endl; 00153 00154 }
void GlobalMuonProducer::setAlias | ( | std::string | alias | ) | [inline, private] |
Definition at line 50 of file GlobalMuonProducer.h.
References theAlias.
Referenced by GlobalMuonProducer().
00050 { 00051 alias.erase( alias.size() - 1, alias.size() ); 00052 theAlias=alias; 00053 }
std::string GlobalMuonProducer::theAlias [private] |
Definition at line 48 of file GlobalMuonProducer.h.
Referenced by GlobalMuonProducer(), and setAlias().
MuonServiceProxy* GlobalMuonProducer::theService [private] |
the event setup proxy, it takes care the services update
Definition at line 46 of file GlobalMuonProducer.h.
Referenced by GlobalMuonProducer(), produce(), and ~GlobalMuonProducer().
STA Label.
Definition at line 41 of file GlobalMuonProducer.h.
Referenced by GlobalMuonProducer(), and produce().
Definition at line 43 of file GlobalMuonProducer.h.
Referenced by GlobalMuonProducer(), produce(), and ~GlobalMuonProducer().