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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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
 
std::unique_ptr< MuonTrackFindertheTrackFinder
 
edm::EDGetTokenT< reco::TrackToTrackMapupdatedStaAssoMapToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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.

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

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  InputTag vertexCollectionTag = parameterSet.getParameter<InputTag>("VertexCollectionLabel");
43  trajectoryBuilderParameters.addParameter<InputTag>("VertexCollectionLabel", vertexCollectionTag);
44  bool selectHighPurity_ = parameterSet.getParameter<bool>("selectHighPurity");
45  trajectoryBuilderParameters.addParameter<bool>("selectHighPurity", selectHighPurity_);
46 
47  // STA Muon Collection Label
48  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
49  staMuonsToken = consumes<reco::TrackCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel"));
51  consumes<std::vector<Trajectory> >(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
53  consumes<TrajTrackAssociationCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
55  consumes<reco::TrackToTrackMap>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
56 
57  // service parameters
58  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
59 
60  // TrackLoader parameters
61  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
62 
63  // the services
64  theService = new MuonServiceProxy(serviceParameters, consumesCollector());
65 
66  // instantiate the concrete trajectory builder in the Track Finder
67  edm::ConsumesCollector iC = consumesCollector();
68  auto mtl = std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService);
69  auto gmtb = std::make_unique<GlobalMuonTrajectoryBuilder>(trajectoryBuilderParameters, theService, iC);
70 
71  theTrackFinder = std::make_unique<MuonTrackFinder>(std::move(gmtb), std::move(mtl), iC);
72 
73  setAlias(parameterSet.getParameter<std::string>("@module_label"));
74  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
75  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
76  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
77  produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories");
78  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap");
79  produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s");
80 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
#define LogTrace(id)
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
trackCollectionTag
Definition: cosmics_id.py:5
char const * label
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:135
std::unique_ptr< 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
def move(src, dest)
Definition: eostools.py:511
edm::InputTag theSTACollectionLabel

◆ ~GlobalMuonProducer()

GlobalMuonProducer::~GlobalMuonProducer ( )
override

destructor

Definition at line 85 of file GlobalMuonProducer.cc.

References LogTrace.

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

Member Function Documentation

◆ produce()

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< Tag >::end(), options_cfi::eventSetup, edm::AssociationMap< Tag >::find(), 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) &&
117  event.getByToken(updatedStaAssoMapToken, updatedStaAssoMap)) {
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)
128  tkUpdated = (*updatedStaAssoMap)[it->val];
129  }
130 
131  int etaFlip1 =
132  ((tkUpdated.isNonnull() && tkRegular.isNonnull()) && ((tkUpdated->eta() * tkRegular->eta()) < 0)) ? -1 : 1;
133 
134  const reco::TrackRef tk = (tkUpdated.isNonnull() && etaFlip1 == 1) ? tkUpdated : tkRegular;
135 
137  if (traj->isValid())
138  tkCand.first = &*traj;
139  staTrackCands.push_back(tkCand);
140  }
141  } else {
142  for (unsigned int position = 0; position != staMuons->size(); ++position) {
143  reco::TrackRef staTrackRef(staMuons, position);
145  staTrackCands.push_back(staCand);
146  }
147  }
148 
149  theTrackFinder->reconstruct(staTrackCands, event, eventSetup);
150 
151  LogTrace(metname) << "Event loaded"
152  << "================================" << endl
153  << endl;
154 }
std::pair< const Trajectory *, reco::TrackRef > TrackCand
const std::string metname
std::string const & instance() const
Definition: InputTag.h:37
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
key_type key() const
Accessor for product key.
Definition: Ref.h:250
const_iterator find(const key_type &k) const
find element with specified reference key
#define LogTrace(id)
const_iterator end() const
last iterator over the map (read only)
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
std::unique_ptr< MuonTrackFinder > theTrackFinder
const_iterator begin() const
first iterator over the map (read only)
static int position[264][3]
Definition: ReadPGInfo.cc:289
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
Definition: event.py:1
edm::InputTag theSTACollectionLabel

◆ setAlias()

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

Definition at line 62 of file GlobalMuonProducer.h.

References SiStripOfflineCRack_cfg::alias, and theAlias.

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

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

std::unique_ptr<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.