CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 reconstruct muons More...
 
 TevMuonProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual ~TevMuonProducer ()
 destructor More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void setAlias (std::string alias)
 

Private Attributes

edm::EDGetTokenT
< reco::TrackCollection
glbMuonsToken
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 35 of file TevMuonProducer.cc.

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

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

destructor

Definition at line 78 of file TevMuonProducer.cc.

References LogTrace.

78  {
79 
80  LogTrace("Muon|RecoMuon|TevMuonProducer") << "destructor called" << endl;
81  if (theService) delete theService;
82  if (theRefitter) delete theRefitter;
83  if (theTrackLoader) 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 
)
overridevirtual

reconstruct muons

Implements edm::stream::EDProducerBase.

Definition at line 90 of file TevMuonProducer.cc.

References edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::helper::Filler< Map >::insert(), LogDebug, LogTrace, metname, edm::Handle< T >::product(), and edm::ESHandle< class >::product().

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

Definition at line 72 of file TevMuonProducer.h.

References theAlias.

72  {
73  alias.erase( alias.size() - 1, alias.size() );
74  theAlias=alias;
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.

Referenced by setAlias().

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.