CMS 3D CMS Logo

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

#include <TevMuonProducer.h>

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

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 reconstruct muons More...
 
 TevMuonProducer (const edm::ParameterSet &)
 constructor with config More...
 
 ~TevMuonProducer () 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< reco::TrackCollectionglbMuonsToken
 
edm::EDGetTokenT< std::vector< Trajectory > > glbMuonsTrajToken
 
std::string theAlias
 
edm::InputTag theGLBCollectionLabel
 STA Label. More...
 
std::vector< int > theRefitIndex
 
std::vector< std::string > theRefits
 
std::unique_ptr< GlobalMuonRefittertheRefitter
 
std::unique_ptr< MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
std::unique_ptr< MuonTrackLoadertheTrackLoader
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken
 

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

TeV muon reconstructor:

Author
Piotr Traczyk (SINS Warsaw)

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 39 of file TevMuonProducer.h.

Constructor & Destructor Documentation

◆ TevMuonProducer()

TevMuonProducer::TevMuonProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 35 of file TevMuonProducer.cc.

References edm::ParameterSet::getParameter(), glbMuonsToken, glbMuonsTrajToken, edm::InputTag::label(), LogDebug, edm::parameterSet(), theGLBCollectionLabel, theRefitIndex, theRefits, theRefitter, theService, and theTrackLoader.

35  : tTopoToken(esConsumes()) {
36  LogDebug("Muon|RecoMuon|TevMuonProducer") << "constructor called" << endl;
37 
38  // GLB Muon Collection Label
39  theGLBCollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
40  glbMuonsToken = consumes<reco::TrackCollection>(theGLBCollectionLabel);
41  glbMuonsTrajToken = consumes<std::vector<Trajectory> >(theGLBCollectionLabel.label());
42 
43  // service parameters
44  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
45 
46  // the services
47  theService = std::make_unique<MuonServiceProxy>(serviceParameters, consumesCollector());
48  edm::ConsumesCollector iC = consumesCollector();
49 
50  // TrackRefitter parameters
51  ParameterSet refitterParameters = parameterSet.getParameter<ParameterSet>("RefitterParameters");
52  theRefitter = std::make_unique<GlobalMuonRefitter>(refitterParameters, theService.get(), iC);
53 
54  // TrackLoader parameters
55  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
56  theTrackLoader = std::make_unique<MuonTrackLoader>(trackLoaderParameters, iC, theService.get());
57 
58  theRefits = parameterSet.getParameter<std::vector<std::string> >("Refits");
59  theRefitIndex = parameterSet.getParameter<std::vector<int> >("RefitIndex");
60 
61  for (unsigned int ww = 0; ww < theRefits.size(); ww++) {
62  LogDebug("Muon|RecoMuon|TevMuonProducer") << "Refit " << theRefits[ww];
63  produces<reco::TrackCollection>(theRefits[ww]);
64  produces<TrackingRecHitCollection>(theRefits[ww]);
65  produces<reco::TrackExtraCollection>(theRefits[ww]);
66  produces<vector<Trajectory> >(theRefits[ww]);
67  produces<TrajTrackAssociationCollection>(theRefits[ww]);
68  produces<reco::TrackToTrackMap>(theRefits[ww]);
69  }
70  produces<DYTestimators>("dytInfo");
71 }
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< int > theRefitIndex
std::string const & label() const
Definition: InputTag.h:36
edm::EDGetTokenT< std::vector< Trajectory > > glbMuonsTrajToken
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
edm::InputTag theGLBCollectionLabel
STA Label.
std::vector< std::string > theRefits
std::unique_ptr< MuonTrackLoader > theTrackLoader
std::unique_ptr< GlobalMuonRefitter > theRefitter
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
#define LogDebug(id)

◆ ~TevMuonProducer()

TevMuonProducer::~TevMuonProducer ( )
override

destructor

Definition at line 76 of file TevMuonProducer.cc.

References LogTrace.

76 { LogTrace("Muon|RecoMuon|TevMuonProducer") << "destructor called" << endl; }
#define LogTrace(id)

Member Function Documentation

◆ produce()

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

reconstruct muons

Definition at line 81 of file TevMuonProducer.cc.

References options_cfi::eventSetup, trigObjTnPSource_cfi::filler, glbMuonsToken, glbMuonsTrajToken, LogDebug, LogTrace, metname, eostools::move(), edm::Handle< T >::product(), theGLBCollectionLabel, theRefitIndex, theRefits, theRefitter, theService, theTrackLoader, HLT_2023v12_cff::track, FastTrackerRecHitMaskProducer_cfi::trajectories, and tTopoToken.

81  {
82  const string metname = "Muon|RecoMuon|TevMuonProducer";
83  LogTrace(metname) << endl << endl;
84  LogTrace(metname) << "TeV Muon Reconstruction started" << endl;
85 
86  // Update the services
87  theService->update(eventSetup);
88 
89  theRefitter->setEvent(event);
90 
91  theRefitter->setServices(theService->eventSetup());
92 
93  //Retrieve tracker topology from geometry
94  const TrackerTopology* tTopo = &eventSetup.getData(tTopoToken);
95 
96  // Take the GLB muon container(s)
98  event.getByToken(glbMuonsToken, glbMuons);
99 
100  auto dytInfo = std::make_unique<DYTestimators>();
101  DYTestimators::Filler filler(*dytInfo);
102  size_t GLBmuonSize = glbMuons->size();
103  vector<DYTInfo> dytTmp(GLBmuonSize);
104 
105  Handle<vector<Trajectory> > glbMuonsTraj;
106 
107  LogTrace(metname) << "Taking " << glbMuons->size() << " Global Muons " << theGLBCollectionLabel << endl;
108 
109  vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
110 
111  event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
112 
113  const reco::TrackCollection* glbTracks = glbMuons.product();
114 
115  for (unsigned int ww = 0; ww < theRefits.size(); ww++) {
116  LogDebug(metname) << "TeVRefit for Refit: " << theRefitIndex[ww];
117  std::vector<std::pair<Trajectory*, reco::TrackRef> > miniMap;
119  reco::TrackRef::key_type trackIndex = 0;
120  int glbCounter = 0;
121  for (reco::TrackCollection::const_iterator track = glbTracks->begin(); track != glbTracks->end();
122  track++, ++trackIndex) {
123  reco::TrackRef glbRef(glbMuons, trackIndex);
124 
125  vector<Trajectory> refitted = theRefitter->refit(*track, theRefitIndex[ww], tTopo);
126 
127  if (theRefits[ww] == "dyt")
128  dytTmp[glbCounter] = *theRefitter->getDYTInfo();
129  glbCounter++;
130 
131  if (!refitted.empty()) {
132  auto refit = std::make_unique<Trajectory>(refitted.front());
133  LogDebug(metname) << "TeVTrackLoader for Refit: " << theRefits[ww];
134  std::pair<Trajectory*, reco::TrackRef> thisPair(refit.get(), glbRef);
135  miniMap.push_back(thisPair);
136  trajectories.push_back(std::move(refit));
137  }
138  }
139  theTrackLoader->loadTracks(trajectories, event, miniMap, glbMuons, *tTopo, theRefits[ww]);
140  }
141 
142  filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
143  filler.fill();
144  event.put(std::move(dytInfo), "dytInfo");
145 
146  LogTrace(metname) << "Done." << endl;
147 }
std::unique_ptr< MuonServiceProxy > theService
the event setup proxy, it takes care the services update
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
const std::string metname
std::vector< int > theRefitIndex
T const * product() const
Definition: Handle.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< std::vector< Trajectory > > glbMuonsTrajToken
#define LogTrace(id)
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
edm::InputTag theGLBCollectionLabel
STA Label.
MuonCandidate::TrajectoryContainer TrajectoryContainer
std::vector< std::string > theRefits
std::unique_ptr< MuonTrackLoader > theTrackLoader
std::unique_ptr< GlobalMuonRefitter > theRefitter
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
#define LogDebug(id)

◆ setAlias()

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

Definition at line 68 of file TevMuonProducer.h.

References SiStripOfflineCRack_cfg::alias, and theAlias.

68  {
69  alias.erase(alias.size() - 1, alias.size());
70  theAlias = alias;
71  }
std::string theAlias

Member Data Documentation

◆ glbMuonsToken

edm::EDGetTokenT<reco::TrackCollection> TevMuonProducer::glbMuonsToken
private

Definition at line 53 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ glbMuonsTrajToken

edm::EDGetTokenT<std::vector<Trajectory> > TevMuonProducer::glbMuonsTrajToken
private

Definition at line 54 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theAlias

std::string TevMuonProducer::theAlias
private

Definition at line 64 of file TevMuonProducer.h.

Referenced by setAlias().

◆ theGLBCollectionLabel

edm::InputTag TevMuonProducer::theGLBCollectionLabel
private

STA Label.

Definition at line 52 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theRefitIndex

std::vector<int> TevMuonProducer::theRefitIndex
private

Definition at line 66 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theRefits

std::vector<std::string> TevMuonProducer::theRefits
private

Definition at line 65 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theRefitter

std::unique_ptr<GlobalMuonRefitter> TevMuonProducer::theRefitter
private

Definition at line 60 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theService

std::unique_ptr<MuonServiceProxy> TevMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 58 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ theTrackLoader

std::unique_ptr<MuonTrackLoader> TevMuonProducer::theTrackLoader
private

Definition at line 62 of file TevMuonProducer.h.

Referenced by produce(), and TevMuonProducer().

◆ tTopoToken

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TevMuonProducer::tTopoToken
private

Definition at line 55 of file TevMuonProducer.h.

Referenced by produce().