CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
GlobalMuonProducer Class Reference

#include <GlobalMuonProducer.h>

Inheritance diagram for GlobalMuonProducer:
edm::stream::EDProducer<>

Public Member Functions

 GlobalMuonProducer (const edm::ParameterSet &)
 constructor with config More...
 
void produce (edm::Event &, const edm::EventSetup &) override
 reconstruct muons More...
 
 ~GlobalMuonProducer () override
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Private Member Functions

void setAlias (std::string alias)
 

Private Attributes

edm::EDGetTokenT< TrajTrackAssociationCollectionstaAssoMapToken
 
edm::EDGetTokenT< reco::TrackCollectionstaMuonsToken
 STA Tokens. More...
 
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
 
std::string theAlias
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
edm::InputTag theSTACollectionLabel
 
MuonTrackFindertheTrackFinder
 
edm::EDGetTokenT< reco::TrackToTrackMapupdatedStaAssoMapToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Global muon reconstructor: reconstructs muons using DT, CSC, RPC and tracker information,
starting from a standalone reonstructed muon.

Author
R.Bellan - INFN TO

Definition at line 32 of file GlobalMuonProducer.h.

Constructor & Destructor Documentation

GlobalMuonProducer::GlobalMuonProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 35 of file GlobalMuonProducer.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::getParameter(), label, LogTrace, MuonServiceProxy_cff::MuonServiceProxy, AlCaHLTBitMon_QueryRunRegistry::string, and cosmics_id::trackCollectionTag.

35  {
36 
37  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl;
38 
39  // Parameter set for the Builder
40  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
41  InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
42  trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel",trackCollectionTag);
43 
44  // STA Muon Collection Label
45  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
46  staMuonsToken=consumes<reco::TrackCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel"));
47  staMuonsTrajToken=consumes<std::vector<Trajectory> >(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
48  staAssoMapToken=consumes<TrajTrackAssociationCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
49  updatedStaAssoMapToken=consumes<reco::TrackToTrackMap>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
50 
51 
52 
53  // service parameters
54  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
55 
56  // TrackLoader parameters
57  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
58 
59  // the services
60  theService = new MuonServiceProxy(serviceParameters);
61 
62  // instantiate the concrete trajectory builder in the Track Finder
63  edm::ConsumesCollector iC = consumesCollector();
64  MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,iC,theService);
65  GlobalMuonTrajectoryBuilder* gmtb = new GlobalMuonTrajectoryBuilder(trajectoryBuilderParameters, theService,iC);
66 
67  theTrackFinder = new MuonTrackFinder(gmtb, mtl);
68 
69  setAlias(parameterSet.getParameter<std::string>("@module_label"));
70  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
71  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
72  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
73  produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories") ;
74  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap");
75  produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s");
76 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
trackCollectionTag
Definition: cosmics_id.py:6
char const * label
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:143
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
void setAlias(std::string alias)
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
edm::InputTag theSTACollectionLabel
GlobalMuonProducer::~GlobalMuonProducer ( )
override

destructor

Definition at line 82 of file GlobalMuonProducer.cc.

References LogTrace.

82  {
83 
84  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl;
85  if (theService) delete theService;
86  if (theTrackFinder) delete theTrackFinder;
87 
88 }
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
MuonServiceProxy * theService
the event setup proxy, it takes care the services update

Member Function Documentation

void GlobalMuonProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
override

reconstruct muons

Definition at line 94 of file GlobalMuonProducer.cc.

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > >::const_iterator, edm::AssociationMap< Tag >::end(), edm::AssociationMap< Tag >::find(), edm::Event::getByToken(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), LogTrace, metname, and position.

94  {
95  const string metname = "Muon|RecoMuon|GlobalMuonProducer";
96  LogTrace(metname)<<endl<<endl<<endl;
97  LogTrace(metname)<<"Global Muon Reconstruction started"<<endl;
98 
99  // Update the services
100  theService->update(eventSetup);
101 
102  // Take the STA muon container(s)
104  event.getByToken(staMuonsToken,staMuons);
105 
106  Handle<vector<Trajectory> > staMuonsTraj;
107 
108  LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons "<<endl;
109 
110  vector<MuonTrajectoryBuilder::TrackCand> staTrackCands;
111 
113 
114  edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap;
115 
116  if( event.getByToken(staMuonsTrajToken, staMuonsTraj) && event.getByToken(staAssoMapToken,staAssoMap) && event.getByToken(updatedStaAssoMapToken,updatedStaAssoMap) ) {
117 
118  for(TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it){
119  const Ref<vector<Trajectory> > traj = it->key;
120  const reco::TrackRef tkRegular = it->val;
121  reco::TrackRef tkUpdated;
124  if ( theSTACollectionLabel.instance() == "UpdatedAtVtx") {
125  iEnd = updatedStaAssoMap->end();
126  iii = updatedStaAssoMap->find(it->val);
127  if (iii != iEnd ) tkUpdated = (*updatedStaAssoMap)[it->val] ;
128  }
129 
130  int etaFlip1 = ((tkUpdated.isNonnull() && tkRegular.isNonnull()) && ( (tkUpdated->eta() * tkRegular->eta() ) < 0)) ? -1 : 1;
131 
132  const reco::TrackRef tk = ( tkUpdated.isNonnull() && etaFlip1==1 ) ? tkUpdated : tkRegular ;
133 
135  if( traj->isValid() ) tkCand.first = &*traj ;
136  staTrackCands.push_back(tkCand);
137  }
138  } else {
139  for ( unsigned int position = 0; position != staMuons->size(); ++position ) {
140  reco::TrackRef staTrackRef(staMuons,position);
142  staTrackCands.push_back(staCand);
143  }
144  }
145 
146  theTrackFinder->reconstruct(staTrackCands, event, eventSetup);
147 
148 
149  LogTrace(metname)<<"Event loaded"
150  <<"================================"
151  <<endl<<endl;
152 
153 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:253
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
const std::string metname
const_iterator find(const key_type &k) const
find element with specified reference key
key_type key() const
Accessor for product key.
Definition: Ref.h:265
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
static int position[264][3]
Definition: ReadPGInfo.cc:509
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
const_iterator begin() const
first iterator over the map (read only)
edm::OrphanHandle< reco::TrackCollection > reconstruct(const edm::Handle< edm::View< TrajectorySeed > > &, edm::Event &, const edm::EventSetup &)
reconstruct standalone tracks starting from a collection of seeds
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
std::string const & instance() const
Definition: InputTag.h:37
edm::InputTag theSTACollectionLabel
void GlobalMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 65 of file GlobalMuonProducer.h.

References met_cff::alias.

65  {
66  alias.erase( alias.size() - 1, alias.size() );
68  }

Member Data Documentation

edm::EDGetTokenT<TrajTrackAssociationCollection> GlobalMuonProducer::staAssoMapToken
private

Definition at line 52 of file GlobalMuonProducer.h.

edm::EDGetTokenT<reco::TrackCollection> GlobalMuonProducer::staMuonsToken
private

STA Tokens.

Definition at line 50 of file GlobalMuonProducer.h.

edm::EDGetTokenT<std::vector<Trajectory> > GlobalMuonProducer::staMuonsTrajToken
private

Definition at line 51 of file GlobalMuonProducer.h.

std::string GlobalMuonProducer::theAlias
private

Definition at line 63 of file GlobalMuonProducer.h.

MuonServiceProxy* GlobalMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 61 of file GlobalMuonProducer.h.

edm::InputTag GlobalMuonProducer::theSTACollectionLabel
private

Definition at line 48 of file GlobalMuonProducer.h.

MuonTrackFinder* GlobalMuonProducer::theTrackFinder
private

Definition at line 58 of file GlobalMuonProducer.h.

edm::EDGetTokenT<reco::TrackToTrackMap> GlobalMuonProducer::updatedStaAssoMapToken
private

Definition at line 53 of file GlobalMuonProducer.h.