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::GlobalMuonProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 35 of file GlobalMuonProducer.cc.

35  {
36  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl;
37 
38  // Parameter set for the Builder
39  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
40  InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
41  trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel", trackCollectionTag);
42 
43  // STA Muon Collection Label
44  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
45  staMuonsToken = consumes<reco::TrackCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel"));
47  consumes<std::vector<Trajectory> >(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
49  consumes<TrajTrackAssociationCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
51  consumes<reco::TrackToTrackMap>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
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, consumesCollector());
61 
62  // instantiate the concrete trajectory builder in the Track Finder
63  edm::ConsumesCollector iC = consumesCollector();
64  auto mtl = std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService);
65  auto gmtb = std::make_unique<GlobalMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService, iC);
66 
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 }

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

◆ ~GlobalMuonProducer()

GlobalMuonProducer::~GlobalMuonProducer ( )
override

destructor

Definition at line 81 of file GlobalMuonProducer.cc.

81  {
82  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl;
83  if (theService)
84  delete theService;
85  if (theTrackFinder)
86  delete theTrackFinder;
87 }

References LogTrace.

Member Function Documentation

◆ produce()

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

reconstruct muons

Definition at line 92 of file GlobalMuonProducer.cc.

92  {
93  const string metname = "Muon|RecoMuon|GlobalMuonProducer";
94  LogTrace(metname) << endl << endl << endl;
95  LogTrace(metname) << "Global Muon Reconstruction started" << endl;
96 
97  // Update the services
98  theService->update(eventSetup);
99 
100  // Take the STA muon container(s)
102  event.getByToken(staMuonsToken, staMuons);
103 
104  Handle<vector<Trajectory> > staMuonsTraj;
105 
106  LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons " << endl;
107 
108  vector<MuonTrajectoryBuilder::TrackCand> staTrackCands;
109 
111 
112  edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap;
113 
114  if (event.getByToken(staMuonsTrajToken, staMuonsTraj) && event.getByToken(staAssoMapToken, staAssoMap) &&
115  event.getByToken(updatedStaAssoMapToken, updatedStaAssoMap)) {
116  for (TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it) {
117  const Ref<vector<Trajectory> > traj = it->key;
118  const reco::TrackRef tkRegular = it->val;
119  reco::TrackRef tkUpdated;
122  if (theSTACollectionLabel.instance() == "UpdatedAtVtx") {
123  iEnd = updatedStaAssoMap->end();
124  iii = updatedStaAssoMap->find(it->val);
125  if (iii != iEnd)
126  tkUpdated = (*updatedStaAssoMap)[it->val];
127  }
128 
129  int etaFlip1 =
130  ((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())
136  tkCand.first = &*traj;
137  staTrackCands.push_back(tkCand);
138  }
139  } else {
140  for (unsigned int position = 0; position != staMuons->size(); ++position) {
141  reco::TrackRef staTrackRef(staMuons, position);
143  staTrackCands.push_back(staCand);
144  }
145  }
146 
147  theTrackFinder->reconstruct(staTrackCands, event, eventSetup);
148 
149  LogTrace(metname) << "Event loaded"
150  << "================================" << endl
151  << endl;
152 }

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::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), LogTrace, metname, and position.

◆ setAlias()

void GlobalMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 62 of file GlobalMuonProducer.h.

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

References SiStripOfflineCRack_cfg::alias, and theAlias.

Member Data Documentation

◆ staAssoMapToken

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

Definition at line 52 of file GlobalMuonProducer.h.

◆ staMuonsToken

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

STA Tokens.

Definition at line 50 of file GlobalMuonProducer.h.

◆ staMuonsTrajToken

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

Definition at line 51 of file GlobalMuonProducer.h.

◆ theAlias

std::string GlobalMuonProducer::theAlias
private

Definition at line 60 of file GlobalMuonProducer.h.

Referenced by setAlias().

◆ theService

MuonServiceProxy* GlobalMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 58 of file GlobalMuonProducer.h.

◆ theSTACollectionLabel

edm::InputTag GlobalMuonProducer::theSTACollectionLabel
private

Definition at line 48 of file GlobalMuonProducer.h.

◆ theTrackFinder

MuonTrackFinder* GlobalMuonProducer::theTrackFinder
private

Definition at line 55 of file GlobalMuonProducer.h.

◆ updatedStaAssoMapToken

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

Definition at line 53 of file GlobalMuonProducer.h.

GlobalMuonProducer::updatedStaAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
Definition: GlobalMuonProducer.h:53
GlobalMuonProducer::theAlias
std::string theAlias
Definition: GlobalMuonProducer.h:60
edm::AssociationMap::find
const_iterator find(const key_type &k) const
find element with specified reference key
Definition: AssociationMap.h:173
GlobalMuonProducer::theSTACollectionLabel
edm::InputTag theSTACollectionLabel
Definition: GlobalMuonProducer.h:48
GlobalMuonProducer::theTrackFinder
MuonTrackFinder * theTrackFinder
Definition: GlobalMuonProducer.h:55
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
cosmics_id.trackCollectionTag
trackCollectionTag
Definition: cosmics_id.py:6
MuonTrackFinder::reconstruct
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
Definition: MuonTrackFinder.cc:67
edm::Handle< reco::TrackCollection >
GlobalMuonProducer::staMuonsToken
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
Definition: GlobalMuonProducer.h:50
MuonServiceProxy_cff.MuonServiceProxy
MuonServiceProxy
Definition: MuonServiceProxy_cff.py:15
edm::Ref
Definition: AssociativeIterator.h:58
GlobalMuonProducer::theService
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
Definition: GlobalMuonProducer.h:58
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
edm::AssociationMap::end
const_iterator end() const
last iterator over the map (read only)
Definition: AssociationMap.h:171
GlobalMuonProducer::staAssoMapToken
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
Definition: GlobalMuonProducer.h:52
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator
friend struct const_iterator
Definition: AssociationMap.h:274
edm::ParameterSet
Definition: ParameterSet.h:36
GlobalMuonProducer::staMuonsTrajToken
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
Definition: GlobalMuonProducer.h:51
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
edm::ParameterSet::addParameter
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:124
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
Trajectory
Definition: Trajectory.h:38
SiStripOfflineCRack_cfg.alias
alias
Definition: SiStripOfflineCRack_cfg.py:129
edm::AssociationMap::begin
const_iterator begin() const
first iterator over the map (read only)
Definition: AssociationMap.h:169
edm::parameterSet
ParameterSet const & parameterSet(Provenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
MuonTrajectoryBuilder::TrackCand
std::pair< const Trajectory *, reco::TrackRef > TrackCand
Definition: MuonTrajectoryBuilder.h:25
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
MuonTrackFinder
Definition: MuonTrackFinder.h:31
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
event
Definition: event.py:1
edm::AssociationMap::const_iterator
const iterator
Definition: AssociationMap.h:76
GlobalMuonProducer::setAlias
void setAlias(std::string alias)
Definition: GlobalMuonProducer.h:62
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
label
const char * label
Definition: PFTauDecayModeTools.cc:11
metname
const std::string metname
Definition: MuonSeedOrcaPatternRecognition.cc:43