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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 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);
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
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:43
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 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 
)
overridevirtual

reconstruct muons

Implements edm::stream::EDProducerBase.

Definition at line 91 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(), edm::ESHandle< class >::product(), and HLT_25ns14e33_v1_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  std::auto_ptr<DYTestimators> dytInfo(new 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.size()>0) {
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,theRefits[ww]);
152  }
153 
154  filler.insert(glbMuons, dytTmp.begin(), dytTmp.end());
155  filler.fill();
156  event.put(dytInfo, "dytInfo");
157 
158  LogTrace(metname) << "Done." << endl;
159 }
#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:13
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
T const * product() const
Definition: Handle.h:81
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
GlobalMuonRefitter * theRefitter
MuonTrackLoader * theTrackLoader
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
std::vector< Trajectory > refit(const reco::Track &globalTrack, const int theMuonHitsOption, const TrackerTopology *tTopo) const
build combined trajectory from sta Track and tracker RecHits
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168
edm::EDGetTokenT< reco::TrackCollection > glbMuonsToken
void TevMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 72 of file TevMuonProducer.h.

References HLT_25ns14e33_v1_cff::alias, and theAlias.

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.

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.