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
GlobalMuonToMuonProducer Class Reference

#include <GlobalMuonToMuonProducer.h>

Inheritance diagram for GlobalMuonToMuonProducer:
edm::global::EDProducer<> edm::global::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonToMuonProducer (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::StreamID, edm::Event &, const edm::EventSetup &) const override
 reconstruct muons More...
 
virtual ~GlobalMuonToMuonProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::global::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::global::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
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 printTrackRecHits (const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
 
void setAlias (std::string alias)
 

Private Attributes

std::string theAlias
 
edm::InputTag theLinksCollectionLabel
 
edm::EDGetTokenT
< reco::MuonTrackLinksCollection
trackLinkToken_
 

Additional Inherited Members

- Public Types inherited from edm::global::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::global::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

No description available.

Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 23 of file GlobalMuonToMuonProducer.h.

Constructor & Destructor Documentation

GlobalMuonToMuonProducer::GlobalMuonToMuonProducer ( const edm::ParameterSet pSet)

Constructor.

Definition at line 24 of file GlobalMuonToMuonProducer.cc.

References edm::ParameterSet::getParameter(), setAlias(), AlCaHLTBitMon_QueryRunRegistry::string, theAlias, theLinksCollectionLabel, and trackLinkToken_.

24  {
25 
26  theLinksCollectionLabel = pSet.getParameter<edm::InputTag>("InputObjects");
27 
28  setAlias(pSet.getParameter<std::string>("@module_label"));
29  produces<reco::MuonCollection>().setBranchAlias(theAlias + "s");
30  trackLinkToken_ = consumes<reco::MuonTrackLinksCollection>(theLinksCollectionLabel);
31 
32 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
void setAlias(std::string alias)
GlobalMuonToMuonProducer::~GlobalMuonToMuonProducer ( )
virtual

Destructor.

Definition at line 35 of file GlobalMuonToMuonProducer.cc.

35  {
36 
37 }

Member Function Documentation

void GlobalMuonToMuonProducer::printTrackRecHits ( const reco::Track track,
edm::ESHandle< GlobalTrackingGeometry trackingGeometry 
) const
private

Definition at line 39 of file GlobalMuonToMuonProducer.cc.

References reco::Track::found(), i, LogTrace, reco::Track::lost(), metname, PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), alignCSCRings::r, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), AlCaHLTBitMon_QueryRunRegistry::string, GeomDet::surface(), GeomDet::toGlobal(), and detailsBasic3DVector::z.

Referenced by produce().

40  {
41 
42  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";
43 
44  LogTrace(metname) << "Valid RecHits: "<<track.found() << " invalid RecHits: " << track.lost();
45 
46  int i = 0;
47  for(trackingRecHit_iterator recHit = track.recHitsBegin(); recHit != track.recHitsEnd(); ++recHit)
48  if((*recHit)->isValid()){
49  const GeomDet* geomDet = trackingGeometry->idToDet((*recHit)->geographicalId());
50  double r = geomDet->surface().position().perp();
51  double z = geomDet->toGlobal((*recHit)->localPosition()).z();
52  LogTrace(metname) << i++ <<" r: "<< r <<" z: "<<z <<" "<<geomDet->toGlobal((*recHit)->localPosition())
53  <<std::endl;
54  }
55 }
int i
Definition: DBlmapReader.cc:9
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:199
T perp() const
Definition: PV3DBase.h:72
const std::string metname
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
float float float z
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:104
#define LogTrace(id)
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:194
const PositionType & position() const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:109
void GlobalMuonToMuonProducer::produce ( edm::StreamID  ,
edm::Event event,
const edm::EventSetup eventSetup 
) const
overridevirtual

reconstruct muons

Implements edm::global::EDProducerBase.

Definition at line 60 of file GlobalMuonToMuonProducer.cc.

References relval_parameters_module::energy, edm::EventSetup::get(), electronStore::links, LogTrace, metname, metsig::muon, p4, printTrackRecHits(), reco::LeafCandidate::setCharge(), reco::Muon::setCombined(), reco::LeafCandidate::setP4(), reco::Muon::setStandAlone(), reco::Muon::setTrack(), reco::LeafCandidate::setVertex(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, and trackLinkToken_.

60  {
61 
62  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";
63 
64  // the muon collection, it will be loaded in the event
65  std::auto_ptr<reco::MuonCollection> muonCollection(new reco::MuonCollection());
66 
67 
69  event.getByToken(trackLinkToken_,linksCollection);
70 
71  if(linksCollection->empty()) {
72  event.put(muonCollection);
73  return;
74  }
75 
76 
77  // Global Tracking Geometry
78  edm::ESHandle<GlobalTrackingGeometry> trackingGeometry;
79  eventSetup.get<GlobalTrackingGeometryRecord>().get(trackingGeometry);
80 
81  for(reco::MuonTrackLinksCollection::const_iterator links = linksCollection->begin();
82  links != linksCollection->end(); ++links){
83 
84  // some temporary print-out
85  LogTrace(metname) << "trackerTrack";
86  printTrackRecHits(*(links->trackerTrack()),trackingGeometry);
87  LogTrace(metname) << "standAloneTrack";
88  printTrackRecHits(*(links->standAloneTrack()),trackingGeometry);
89  LogTrace(metname) << "globalTrack";
90  printTrackRecHits(*(links->globalTrack()),trackingGeometry);
91 
92  // Fill the muon
94  muon.setStandAlone(links->standAloneTrack());
95  muon.setTrack(links->trackerTrack());
96  muon.setCombined(links->globalTrack());
97 
98  // FIXME: can this break in case combined info cannot be added to some tracks?
99  muon.setCharge(links->globalTrack()->charge());
100 
101  //FIXME: E = sqrt(p^2 + m^2), where m == 0.105658369(9)GeV
102  double energy = sqrt(links->globalTrack()->p() * links->globalTrack()->p() + 0.011163691);
103  math::XYZTLorentzVector p4(links->globalTrack()->px(),
104  links->globalTrack()->py(),
105  links->globalTrack()->pz(),
106  energy);
107 
108  muon.setP4(p4);
109  muon.setVertex(links->globalTrack()->vertex());
110 
111  muonCollection->push_back(muon);
112 
113  }
114 
115  event.put(muonCollection);
116 }
edm::EDGetTokenT< reco::MuonTrackLinksCollection > trackLinkToken_
const std::string metname
virtual void setCharge(Charge q)
set electric charge
Definition: LeafCandidate.h:93
virtual void setP4(const LorentzVector &p4)
set 4-momentum
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
virtual void setStandAlone(const TrackRef &t)
virtual void setCombined(const TrackRef &t)
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
virtual void setVertex(const Point &vertex)
set vertex
#define LogTrace(id)
void printTrackRecHits(const reco::Track &track, edm::ESHandle< GlobalTrackingGeometry > trackingGeometry) const
const T & get() const
Definition: EventSetup.h:55
virtual void setTrack(const TrackRef &t)
void GlobalMuonToMuonProducer::setAlias ( std::string  alias)
inlineprivate

Definition at line 41 of file GlobalMuonToMuonProducer.h.

References HLT_25ns14e33_v1_cff::alias, and theAlias.

Referenced by GlobalMuonToMuonProducer().

41  {
42  alias.erase( alias.size() - 1, alias.size() );
44  }

Member Data Documentation

std::string GlobalMuonToMuonProducer::theAlias
private

Definition at line 39 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and setAlias().

edm::InputTag GlobalMuonToMuonProducer::theLinksCollectionLabel
private

Definition at line 53 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer().

edm::EDGetTokenT<reco::MuonTrackLinksCollection> GlobalMuonToMuonProducer::trackLinkToken_
private

Definition at line 54 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and produce().