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
 
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< 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
 
GlobalMuonRefittertheRefitter
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
MuonTrackLoadertheTrackLoader
 

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

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

Constructor & Destructor Documentation

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

constructor with config

Definition at line 35 of file TevMuonProducer.cc.

References edm::ParameterSet::getParameter(), GlobalMuonRefitter_cff::GlobalMuonRefitter, LogDebug, and MuonServiceProxy_cff::MuonServiceProxy.

35  {
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 = new MuonServiceProxy(serviceParameters);
48  edm::ConsumesCollector iC = consumesCollector();
49 
50  // TrackRefitter parameters
51  ParameterSet refitterParameters = parameterSet.getParameter<ParameterSet>("RefitterParameters");
52  theRefitter = new GlobalMuonRefitter(refitterParameters, theService, iC);
53 
54  // TrackLoader parameters
55  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
56  theTrackLoader = new MuonTrackLoader(trackLoaderParameters, iC, theService);
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 }
#define LogDebug(id)
T getParameter(std::string const &) const
std::vector< int > theRefitIndex
edm::EDGetTokenT< std::vector< Trajectory > > glbMuonsTrajToken
edm::InputTag theGLBCollectionLabel
STA Label.
std::vector< std::string > theRefits
GlobalMuonRefitter * theRefitter
std::string const & label() const
Definition: InputTag.h:36
MuonTrackLoader * theTrackLoader
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
TevMuonProducer::~TevMuonProducer ( )
override

destructor

Definition at line 76 of file TevMuonProducer.cc.

References LogTrace.

76  {
77  LogTrace("Muon|RecoMuon|TevMuonProducer") << "destructor called" << endl;
78  if (theService)
79  delete theService;
80  if (theRefitter)
81  delete theRefitter;
82  if (theTrackLoader)
83  delete theTrackLoader;
84 }
#define LogTrace(id)
GlobalMuonRefitter * theRefitter
MuonTrackLoader * theTrackLoader
MuonServiceProxy * theService
the event setup proxy, it takes care the services update

Member Function Documentation

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

reconstruct muons

Definition at line 89 of file TevMuonProducer.cc.

References trigObjTnPSource_cfi::filler, edm::EventSetup::get(), LogDebug, LogTrace, metname, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), HLT_2018_cff::track, and FastTrackerRecHitMaskProducer_cfi::trajectories.

89  {
90  const string metname = "Muon|RecoMuon|TevMuonProducer";
91  LogTrace(metname) << endl << endl;
92  LogTrace(metname) << "TeV Muon Reconstruction started" << endl;
93 
94  // Update the services
95  theService->update(eventSetup);
96 
97  theRefitter->setEvent(event);
98 
99  theRefitter->setServices(theService->eventSetup());
100 
101  //Retrieve tracker topology from geometry
103  eventSetup.get<TrackerTopologyRcd>().get(tTopoHand);
104  const TrackerTopology* tTopo = tTopoHand.product();
105 
106  // Take the GLB muon container(s)
108  event.getByToken(glbMuonsToken, glbMuons);
109 
110  auto dytInfo = std::make_unique<DYTestimators>();
111  DYTestimators::Filler filler(*dytInfo);
112  size_t GLBmuonSize = glbMuons->size();
113  vector<DYTInfo> dytTmp(GLBmuonSize);
114 
115  Handle<vector<Trajectory> > glbMuonsTraj;
116 
117  LogTrace(metname) << "Taking " << glbMuons->size() << " Global Muons " << theGLBCollectionLabel << endl;
118 
119  vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
120 
121  event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
122 
123  const reco::TrackCollection* glbTracks = glbMuons.product();
124 
125  for (unsigned int ww = 0; ww < theRefits.size(); ww++) {
126  LogDebug(metname) << "TeVRefit for Refit: " << theRefitIndex[ww];
127  std::vector<std::pair<Trajectory*, reco::TrackRef> > miniMap;
128  vector<Trajectory*> trajectories;
129  reco::TrackRef::key_type trackIndex = 0;
130  int glbCounter = 0;
131  for (reco::TrackCollection::const_iterator track = glbTracks->begin(); track != glbTracks->end();
132  track++, ++trackIndex) {
133  reco::TrackRef glbRef(glbMuons, trackIndex);
134 
135  vector<Trajectory> refitted = theRefitter->refit(*track, theRefitIndex[ww], tTopo);
136 
137  if (theRefits[ww] == "dyt")
138  dytTmp[glbCounter] = *theRefitter->getDYTInfo();
139  glbCounter++;
140 
141  if (!refitted.empty()) {
142  Trajectory* refit = new Trajectory(refitted.front());
143  LogDebug(metname) << "TeVTrackLoader for Refit: " << theRefits[ww];
144  trajectories.push_back(refit);
145  std::pair<Trajectory*, reco::TrackRef> thisPair(refit, glbRef);
146  miniMap.push_back(thisPair);
147  }
148  }
149  theTrackLoader->loadTracks(trajectories, event, miniMap, glbMuons, *tTopo, theRefits[ww]);
150  }
151 
152  filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
153  filler.fill();
154  event.put(std::move(dytInfo), "dytInfo");
155 
156  LogTrace(metname) << "Done." << endl;
157 }
#define LogDebug(id)
const reco::DYTInfo * getDYTInfo()
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
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
void setServices(const edm::EventSetup &)
set the services needed by the TrackTransformer
edm::EDGetTokenT< std::vector< Trajectory > > glbMuonsTrajToken
edm::OrphanHandle< reco::TrackCollection > loadTracks(const TrajectoryContainer &, edm::Event &, const TrackerTopology &ttopo, const std::string &="", bool=true)
Convert the trajectories into tracks and load the tracks in the event.
edm::InputTag theGLBCollectionLabel
STA Label.
#define LogTrace(id)
virtual void setEvent(const edm::Event &)
pass the Event to the algo at each event
std::vector< std::string > theRefits
T const * product() const
Definition: Handle.h:69
GlobalMuonRefitter * theRefitter
T get() const
Definition: EventSetup.h:73
MuonTrackLoader * theTrackLoader
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
T const * product() const
Definition: ESHandle.h:86
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
def move(src, dest)
Definition: eostools.py:511
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
void TevMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 71 of file TevMuonProducer.h.

References SiStripOfflineCRack_cfg::alias.

71  {
72  alias.erase(alias.size() - 1, alias.size());
73  theAlias = alias;
74  }
std::string theAlias

Member Data Documentation

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

Definition at line 57 of file TevMuonProducer.h.

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

Definition at line 58 of file TevMuonProducer.h.

std::string TevMuonProducer::theAlias
private

Definition at line 67 of file TevMuonProducer.h.

edm::InputTag TevMuonProducer::theGLBCollectionLabel
private

STA Label.

Definition at line 56 of file TevMuonProducer.h.

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

Definition at line 69 of file TevMuonProducer.h.

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

Definition at line 68 of file TevMuonProducer.h.

GlobalMuonRefitter* TevMuonProducer::theRefitter
private

Definition at line 63 of file TevMuonProducer.h.

MuonServiceProxy* TevMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 61 of file TevMuonProducer.h.

MuonTrackLoader* TevMuonProducer::theTrackLoader
private

Definition at line 65 of file TevMuonProducer.h.