test
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
GlobalMuonProducer Class Reference

#include <GlobalMuonProducer.h>

Inheritance diagram for GlobalMuonProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonProducer (const edm::ParameterSet &)
 constructor with config More...
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 reconstruct muons More...
 
virtual ~GlobalMuonProducer ()
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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
< TrajTrackAssociationCollection
staAssoMapToken
 
edm::EDGetTokenT
< reco::TrackCollection
staMuonsToken
 STA Tokens. More...
 
edm::EDGetTokenT< std::vector
< Trajectory > > 
staMuonsTrajToken
 
std::string theAlias
 
MuonServiceProxytheService
 the event setup proxy, it takes care the services update More...
 
edm::InputTag theSTACollectionLabel
 
MuonTrackFindertheTrackFinder
 
edm::EDGetTokenT
< reco::TrackToTrackMap
updatedStaAssoMapToken
 

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

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 32 of file GlobalMuonProducer.h.

Constructor & Destructor Documentation

GlobalMuonProducer::GlobalMuonProducer ( const edm::ParameterSet parameterSet)

constructor with config

Definition at line 35 of file GlobalMuonProducer.cc.

References edm::ParameterSet::addParameter(), edm::ParameterSet::getParameter(), diffTwoXMLs::label, LogTrace, MuonServiceProxy_cff::MuonServiceProxy, and AlCaHLTBitMon_QueryRunRegistry::string.

35  {
36 
37  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "constructor called" << endl;
38 
39  // Parameter set for the Builder
40  ParameterSet trajectoryBuilderParameters = parameterSet.getParameter<ParameterSet>("GLBTrajBuilderParameters");
41  InputTag trackCollectionTag = parameterSet.getParameter<InputTag>("TrackerCollectionLabel");
42  trajectoryBuilderParameters.addParameter<InputTag>("TrackerCollectionLabel",trackCollectionTag);
43 
44  // STA Muon Collection Label
45  theSTACollectionLabel = parameterSet.getParameter<InputTag>("MuonCollectionLabel");
46  staMuonsToken=consumes<reco::TrackCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel"));
47  staMuonsTrajToken=consumes<std::vector<Trajectory> >(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
48  staAssoMapToken=consumes<TrajTrackAssociationCollection>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
49  updatedStaAssoMapToken=consumes<reco::TrackToTrackMap>(parameterSet.getParameter<InputTag>("MuonCollectionLabel").label());
50 
51 
52 
53  // service parameters
54  ParameterSet serviceParameters = parameterSet.getParameter<ParameterSet>("ServiceParameters");
55 
56  // TrackLoader parameters
57  ParameterSet trackLoaderParameters = parameterSet.getParameter<ParameterSet>("TrackLoaderParameters");
58 
59  // the services
60  theService = new MuonServiceProxy(serviceParameters);
61 
62  // instantiate the concrete trajectory builder in the Track Finder
64  MuonTrackLoader* mtl = new MuonTrackLoader(trackLoaderParameters,iC,theService);
65  GlobalMuonTrajectoryBuilder* gmtb = new GlobalMuonTrajectoryBuilder(trajectoryBuilderParameters, theService,iC);
66 
67  theTrackFinder = new MuonTrackFinder(gmtb, mtl);
68 
69  setAlias(parameterSet.getParameter<std::string>("@module_label"));
70  produces<reco::TrackCollection>().setBranchAlias(theAlias + "Tracks");
71  produces<TrackingRecHitCollection>().setBranchAlias(theAlias + "RecHits");
72  produces<reco::TrackExtraCollection>().setBranchAlias(theAlias + "TrackExtras");
73  produces<vector<Trajectory> >().setBranchAlias(theAlias + "Trajectories") ;
74  produces<TrajTrackAssociationCollection>().setBranchAlias(theAlias + "TrajTrackMap");
75  produces<reco::MuonTrackLinksCollection>().setBranchAlias(theAlias + "s");
76 }
T getParameter(std::string const &) const
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void addParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:144
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
void setAlias(std::string alias)
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
edm::InputTag theSTACollectionLabel
GlobalMuonProducer::~GlobalMuonProducer ( )
virtual

destructor

Definition at line 82 of file GlobalMuonProducer.cc.

References LogTrace.

82  {
83 
84  LogTrace("Muon|RecoMuon|GlobalMuonProducer") << "destructor called" << endl;
85  if (theService) delete theService;
86  if (theTrackFinder) delete theTrackFinder;
87 
88 }
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
MuonServiceProxy * theService
the event setup proxy, it takes care the services update

Member Function Documentation

void GlobalMuonProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

reconstruct muons

Implements edm::stream::EDProducerBase.

Definition at line 94 of file GlobalMuonProducer.cc.

References edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, edm::AssociationMap< edm::OneToOne< reco::TrackCollection, reco::TrackCollection > >::const_iterator, edm::Event::getByToken(), edm::Ref< C, T, F >::isNonnull(), edm::Ref< C, T, F >::key(), LogTrace, metname, and position.

94  {
95  const string metname = "Muon|RecoMuon|GlobalMuonProducer";
96  LogTrace(metname)<<endl<<endl<<endl;
97  LogTrace(metname)<<"Global Muon Reconstruction started"<<endl;
98 
99  // Update the services
100  theService->update(eventSetup);
101 
102  // Take the STA muon container(s)
104  event.getByToken(staMuonsToken,staMuons);
105 
106  Handle<vector<Trajectory> > staMuonsTraj;
107 
108  LogTrace(metname) << "Taking " << staMuons->size() << " Stand Alone Muons "<<endl;
109 
110  vector<MuonTrajectoryBuilder::TrackCand> staTrackCands;
111 
113 
114  edm::Handle<reco::TrackToTrackMap> updatedStaAssoMap;
115 
116  if( event.getByToken(staMuonsTrajToken, staMuonsTraj) && event.getByToken(staAssoMapToken,staAssoMap) && event.getByToken(updatedStaAssoMapToken,updatedStaAssoMap) ) {
117 
118  for(TrajTrackAssociationCollection::const_iterator it = staAssoMap->begin(); it != staAssoMap->end(); ++it){
119  const Ref<vector<Trajectory> > traj = it->key;
120  const reco::TrackRef tkRegular = it->val;
121  reco::TrackRef tkUpdated;
124  if ( theSTACollectionLabel.instance() == "UpdatedAtVtx") {
125  iEnd = updatedStaAssoMap->end();
126  iii = updatedStaAssoMap->find(it->val);
127  if (iii != iEnd ) tkUpdated = (*updatedStaAssoMap)[it->val] ;
128  }
129 
130  int etaFlip1 = ((tkUpdated.isNonnull() && tkRegular.isNonnull()) && ( (tkUpdated->eta() * tkRegular->eta() ) < 0)) ? -1 : 1;
131 
132  const reco::TrackRef tk = ( tkUpdated.isNonnull() && etaFlip1==1 ) ? tkUpdated : tkRegular ;
133 
135  if( traj->isValid() ) tkCand.first = &*traj ;
136  staTrackCands.push_back(tkCand);
137  }
138  } else {
139  for ( unsigned int position = 0; position != staMuons->size(); ++position ) {
140  reco::TrackRef staTrackRef(staMuons,position);
142  staTrackCands.push_back(staCand);
143  }
144  }
145 
146  theTrackFinder->reconstruct(staTrackCands, event, eventSetup);
147 
148 
149  LogTrace(metname)<<"Event loaded"
150  <<"================================"
151  <<endl<<endl;
152 
153 }
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:252
std::pair< const Trajectory *, reco::TrackRef > TrackCand
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
const std::string metname
key_type key() const
Accessor for product key.
Definition: Ref.h:264
edm::EDGetTokenT< TrajTrackAssociationCollection > staAssoMapToken
edm::EDGetTokenT< reco::TrackToTrackMap > updatedStaAssoMapToken
edm::EDGetTokenT< reco::TrackCollection > staMuonsToken
STA Tokens.
#define LogTrace(id)
MuonTrackFinder * theTrackFinder
static int position[264][3]
Definition: ReadPGInfo.cc:509
MuonServiceProxy * theService
the event setup proxy, it takes care the services update
edm::OrphanHandle< reco::TrackCollection > reconstruct(const edm::Handle< edm::View< TrajectorySeed > > &, edm::Event &, const edm::EventSetup &)
reconstruct standalone tracks starting from a collection of seeds
edm::EDGetTokenT< std::vector< Trajectory > > staMuonsTrajToken
std::string const & instance() const
Definition: InputTag.h:37
edm::InputTag theSTACollectionLabel
void GlobalMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 65 of file GlobalMuonProducer.h.

References HLT_25ns10e33_v2_cff::alias, and theAlias.

65  {
66  alias.erase( alias.size() - 1, alias.size() );
68  }

Member Data Documentation

edm::EDGetTokenT<TrajTrackAssociationCollection> GlobalMuonProducer::staAssoMapToken
private

Definition at line 52 of file GlobalMuonProducer.h.

edm::EDGetTokenT<reco::TrackCollection> GlobalMuonProducer::staMuonsToken
private

STA Tokens.

Definition at line 50 of file GlobalMuonProducer.h.

edm::EDGetTokenT<std::vector<Trajectory> > GlobalMuonProducer::staMuonsTrajToken
private

Definition at line 51 of file GlobalMuonProducer.h.

std::string GlobalMuonProducer::theAlias
private

Definition at line 63 of file GlobalMuonProducer.h.

Referenced by setAlias().

MuonServiceProxy* GlobalMuonProducer::theService
private

the event setup proxy, it takes care the services update

Definition at line 61 of file GlobalMuonProducer.h.

edm::InputTag GlobalMuonProducer::theSTACollectionLabel
private

Definition at line 48 of file GlobalMuonProducer.h.

MuonTrackFinder* GlobalMuonProducer::theTrackFinder
private

Definition at line 58 of file GlobalMuonProducer.h.

edm::EDGetTokenT<reco::TrackToTrackMap> GlobalMuonProducer::updatedStaAssoMapToken
private

Definition at line 53 of file GlobalMuonProducer.h.