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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 39 of file TevMuonProducer.h.

Constructor & Destructor Documentation

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

constructor with config

Definition at line 36 of file TevMuonProducer.cc.

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

36  {
37 
38  LogDebug("Muon|RecoMuon|TevMuonProducer") << "constructor called" << endl;
39 
40  // GLB Muon Collection Label
41  theGLBCollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
42  glbMuonsToken=consumes<reco::TrackCollection>(theGLBCollectionLabel);
43  glbMuonsTrajToken=consumes<std::vector<Trajectory> >(theGLBCollectionLabel.label());
44 
45  // service parameters
46  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
47 
48  // the services
49  theService = new MuonServiceProxy(serviceParameters);
50  edm::ConsumesCollector iC = consumesCollector();
51 
52  // TrackRefitter parameters
53  ParameterSet refitterParameters = parameterSet.getParameter<ParameterSet>("RefitterParameters");
54  theRefitter = new GlobalMuonRefitter(refitterParameters, theService, iC);
55 
56  // TrackLoader parameters
57  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
58  theTrackLoader = new MuonTrackLoader(trackLoaderParameters,iC,theService);
59 
60  theRefits = parameterSet.getParameter< std::vector<std::string> >("Refits");
61  theRefitIndex = parameterSet.getParameter< std::vector<int> >("RefitIndex");
62 
63  for(unsigned int ww=0;ww<theRefits.size();ww++){
64  LogDebug("Muon|RecoMuon|TevMuonProducer") << "Refit " << theRefits[ww];
65  produces<reco::TrackCollection>(theRefits[ww]);
66  produces<TrackingRecHitCollection>(theRefits[ww]);
67  produces<reco::TrackExtraCollection>(theRefits[ww]);
68  produces<vector<Trajectory> >(theRefits[ww]) ;
69  produces<TrajTrackAssociationCollection>(theRefits[ww]);
70  produces<reco::TrackToTrackMap>(theRefits[ww]);
71  }
72  produces<DYTestimators> ("dytInfo");
73 }
#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 79 of file TevMuonProducer.cc.

References LogTrace.

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

References objects.autophobj::filler, edm::EventSetup::get(), LogDebug, LogTrace, metname, eostools::move(), edm::Handle< T >::product(), edm::ESHandle< T >::product(), HiIsolationCommonParameters_cff::track, and HiRegitMuonDetachedTripletStep_cff::trajectories.

91  {
92 
93  const string metname = "Muon|RecoMuon|TevMuonProducer";
94  LogTrace(metname)<< endl << endl;
95  LogTrace(metname)<< "TeV Muon Reconstruction started" << endl;
96 
97  // Update the services
98  theService->update(eventSetup);
99 
100  theRefitter->setEvent(event);
101 
102  theRefitter->setServices(theService->eventSetup());
103 
104  //Retrieve tracker topology from geometry
106  eventSetup.get<TrackerTopologyRcd>().get(tTopoHand);
107  const TrackerTopology *tTopo=tTopoHand.product();
108 
109 
110  // Take the GLB muon container(s)
112  event.getByToken(glbMuonsToken,glbMuons);
113 
114  auto dytInfo = std::make_unique<DYTestimators>();
115  DYTestimators::Filler filler(*dytInfo);
116  size_t GLBmuonSize = glbMuons->size();
117  vector<DYTInfo> dytTmp(GLBmuonSize);
118 
119  Handle<vector<Trajectory> > glbMuonsTraj;
120 
121  LogTrace(metname)<< "Taking " << glbMuons->size() << " Global Muons "<<theGLBCollectionLabel<<endl;
122 
123  vector<MuonTrajectoryBuilder::TrackCand> glbTrackCands;
124 
125  event.getByToken(glbMuonsTrajToken, glbMuonsTraj);
126 
127  const reco::TrackCollection *glbTracks = glbMuons.product();
128 
129  for(unsigned int ww=0;ww<theRefits.size();ww++) {
130  LogDebug(metname)<<"TeVRefit for Refit: " <<theRefitIndex[ww];
131  std::vector<std::pair<Trajectory*,reco::TrackRef> > miniMap;
132  vector<Trajectory*> trajectories;
133  reco::TrackRef::key_type trackIndex = 0;
134  int glbCounter = 0;
135  for (reco::TrackCollection::const_iterator track = glbTracks->begin(); track!=glbTracks->end(); track++ , ++trackIndex) {
136  reco::TrackRef glbRef(glbMuons,trackIndex);
137 
138  vector<Trajectory> refitted=theRefitter->refit(*track,theRefitIndex[ww],tTopo);
139 
140  if (theRefits[ww] == "dyt") dytTmp[glbCounter] = *theRefitter->getDYTInfo();
141  glbCounter++;
142 
143  if (!refitted.empty()) {
144  Trajectory *refit = new Trajectory(refitted.front());
145  LogDebug(metname)<<"TeVTrackLoader for Refit: " <<theRefits[ww];
146  trajectories.push_back(refit);
147  std::pair<Trajectory*,reco::TrackRef> thisPair(refit,glbRef);
148  miniMap.push_back(thisPair);
149  }
150  }
151  theTrackLoader->loadTracks(trajectories,event,miniMap,glbMuons, *tTopo, theRefits[ww]);
152  }
153 
154  filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
155  filler.fill();
156  event.put(std::move(dytInfo), "dytInfo");
157 
158  LogTrace(metname) << "Done." << endl;
159 }
#define LogDebug(id)
const reco::DYTInfo * getDYTInfo()
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:169
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:81
GlobalMuonRefitter * theRefitter
T get() const
Definition: EventSetup.h:63
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:510
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
void TevMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 72 of file TevMuonProducer.h.

References met_cff::alias.

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

Member Data Documentation

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

Definition at line 56 of file TevMuonProducer.h.

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

Definition at line 57 of file TevMuonProducer.h.

std::string TevMuonProducer::theAlias
private

Definition at line 68 of file TevMuonProducer.h.

edm::InputTag TevMuonProducer::theGLBCollectionLabel
private

STA Label.

Definition at line 55 of file TevMuonProducer.h.

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

Definition at line 70 of file TevMuonProducer.h.

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

Definition at line 69 of file TevMuonProducer.h.

GlobalMuonRefitter* TevMuonProducer::theRefitter
private

Definition at line 64 of file TevMuonProducer.h.

MuonServiceProxy* TevMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 62 of file TevMuonProducer.h.

MuonTrackLoader* TevMuonProducer::theTrackLoader
private

Definition at line 66 of file TevMuonProducer.h.