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 hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () 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 36 of file GlobalMuonProducer.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 34 of file GlobalMuonProducer.cc.

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

34  {
35  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl;
36 
37  // Parameter set for the Builder
38  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
39  InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
40  trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel", trackCollectionTag);
41 
42  // STA Muon Collection Label
43  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
44  staMuonsToken = consumes<reco::TrackCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel"));
46  consumes<std::vector<Trajectory> >(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
48  consumes<TrajTrackAssociationCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
50  consumes<reco::TrackToTrackMap>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
51 
52  // service parameters
53  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
54 
55  // TrackLoader parameters
56  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
57 
58  // the services
59  theService = new MuonServiceProxy(serviceParameters);
60 
61  // instantiate the concrete trajectory builder in the Track Finder
62  edm::ConsumesCollector iC = consumesCollector();
63  MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters, iC, theService);
64  GlobalMuonTrajectoryBuilder* gmtb = new GlobalMuonTrajectoryBuilder(trajectoryBuilderParameters, theService, iC);
65 
66  theTrackFinder = new MuonTrackFinder(gmtb, mtl);
67 
68  setAlias(parameterSet.getParameter<std::string>("@module_label"));
69  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
70  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
71  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
72  produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories");
73  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap");
74  produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s");
75 }
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:124
#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 80 of file GlobalMuonProducer.cc.

References LogTrace.

80  {
81  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl;
82  if (theService)
83  delete theService;
84  if (theTrackFinder)
85  delete theTrackFinder;
86 }
#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 91 of file GlobalMuonProducer.cc.

References edm::AssociationMap< Tag >::begin(), edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::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.

91  {
92  const string metname = "Muon|RecoMuon|GlobalMuonProducer";
93  LogTrace(metname) << endl << endl << endl;
94  LogTrace(metname) << "Global Muon Reconstruction started" << endl;
95 
96  // Update the services
97  theService->update(eventSetup);
98 
99  // Take the STA muon container(s)
101  event.getByToken(staMuonsToken, staMuons);
102 
103  Handle<vector<Trajectory> > staMuonsTraj;
104 
105  LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons " << endl;
106 
107  vector<MuonTrajectoryBuilder::TrackCand> staTrackCands;
108 
110 
111  edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap;
112 
113  if (event.getByToken(staMuonsTrajToken, staMuonsTraj) && event.getByToken(staAssoMapToken, staAssoMap) &&
114  event.getByToken(updatedStaAssoMapToken, updatedStaAssoMap)) {
115  for (TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it) {
116  const Ref<vector<Trajectory> > traj = it->key;
117  const reco::TrackRef tkRegular = it->val;
118  reco::TrackRef tkUpdated;
121  if (theSTACollectionLabel.instance() == "UpdatedAtVtx") {
122  iEnd = updatedStaAssoMap->end();
123  iii = updatedStaAssoMap->find(it->val);
124  if (iii != iEnd)
125  tkUpdated = (*updatedStaAssoMap)[it->val];
126  }
127 
128  int etaFlip1 =
129  ((tkUpdated.isNonnull() && tkRegular.isNonnull()) && ((tkUpdated->eta() * tkRegular->eta()) < 0)) ? -1 : 1;
130 
131  const reco::TrackRef tk = (tkUpdated.isNonnull() && etaFlip1 == 1) ? tkUpdated : tkRegular;
132 
134  if (traj->isValid())
135  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  LogTrace(metname) << "Event loaded"
149  << "================================" << endl
150  << endl;
151 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
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:525
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:250
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:289
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 62 of file GlobalMuonProducer.h.

References SiStripOfflineCRack_cfg::alias.

62  {
63  alias.erase(alias.size() - 1, alias.size());
64  theAlias = alias;
65  }

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 60 of file GlobalMuonProducer.h.

MuonServiceProxy* GlobalMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 58 of file GlobalMuonProducer.h.

edm::InputTag GlobalMuonProducer::theSTACollectionLabel
private

Definition at line 48 of file GlobalMuonProducer.h.

MuonTrackFinder* GlobalMuonProducer::theTrackFinder
private

Definition at line 55 of file GlobalMuonProducer.h.

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

Definition at line 53 of file GlobalMuonProducer.h.