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::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Public Member Functions

 GlobalMuonToMuonProducer (const edm::ParameterSet &)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 reconstruct muons More...
 
virtual ~GlobalMuonToMuonProducer ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

No description available.

Date:
2011/05/31 14:44:35
Revision:
1.1
Author
R. Bellan - INFN Torino ricca.nosp@m.rdo..nosp@m.bella.nosp@m.n@ce.nosp@m.rn.ch

Definition at line 22 of file GlobalMuonToMuonProducer.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 29 of file GlobalMuonToMuonProducer.cc.

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

29  {
30 
31  theLinksCollectionLabel = pSet.getParameter<edm::InputTag>("InputObjects");
32 
33  setAlias(pSet.getParameter<std::string>("@module_label"));
34  produces<reco::MuonCollection>().setBranchAlias(theAlias + "s");
35 }
T getParameter(std::string const &) const
void setAlias(std::string alias)
GlobalMuonToMuonProducer::~GlobalMuonToMuonProducer ( )
virtual

Destructor.

Definition at line 38 of file GlobalMuonToMuonProducer.cc.

38  {
39 
40 }

Member Function Documentation

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

Definition at line 42 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(), GeomDet::surface(), GeomDet::toGlobal(), and detailsBasic3DVector::z.

Referenced by produce().

43  {
44 
45  const std::string metname = "Muon|RecoMuon|MuonIdentification|GlobalMuonToMuonProducer";
46 
47  LogTrace(metname) << "Valid RecHits: "<<track.found() << " invalid RecHits: " << track.lost();
48 
49  int i = 0;
50  for(trackingRecHit_iterator recHit = track.recHitsBegin(); recHit != track.recHitsEnd(); ++recHit)
51  if((*recHit)->isValid()){
52  const GeomDet* geomDet = trackingGeometry->idToDet((*recHit)->geographicalId());
53  double r = geomDet->surface().position().perp();
54  double z = geomDet->toGlobal((*recHit)->localPosition()).z();
55  LogTrace(metname) << i++ <<" r: "<< r <<" z: "<<z <<" "<<geomDet->toGlobal((*recHit)->localPosition())
56  <<std::endl;
57  }
58 }
int i
Definition: DBlmapReader.cc:9
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:102
T perp() const
Definition: PV3DBase.h:71
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:47
double double double z
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:63
#define LogTrace(id)
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:100
const PositionType & position() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:65
void GlobalMuonToMuonProducer::produce ( edm::Event event,
const edm::EventSetup eventSetup 
)
virtual

reconstruct muons

Implements edm::EDProducer.

Definition at line 63 of file GlobalMuonToMuonProducer.cc.

References relval_parameters_module::energy, edm::EventSetup::get(), 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(), and theLinksCollectionLabel.

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

Definition at line 40 of file GlobalMuonToMuonProducer.h.

References theAlias.

Referenced by GlobalMuonToMuonProducer().

40  {
41  alias.erase( alias.size() - 1, alias.size() );
42  theAlias=alias;
43  }

Member Data Documentation

std::string GlobalMuonToMuonProducer::theAlias
private

Definition at line 38 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and setAlias().

edm::InputTag GlobalMuonToMuonProducer::theLinksCollectionLabel
private

Definition at line 52 of file GlobalMuonToMuonProducer.h.

Referenced by GlobalMuonToMuonProducer(), and produce().