CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GlobalMuonToMuonProducer.cc
Go to the documentation of this file.
1 
10 
15 
19 
20 // tmp
26 
27 
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 }
36 
39 
40 }
41 
43  edm::ESHandle<GlobalTrackingGeometry> trackingGeometry) const{
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 }
59 
60 
61 
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 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
virtual void setCharge(Charge q) GCC11_FINAL
set electric charge
virtual ~GlobalMuonToMuonProducer()
Destructor.
GlobalMuonToMuonProducer(const edm::ParameterSet &)
Constructor.
unsigned short lost() const
Number of lost (=invalid) hits on track.
Definition: Track.h:102
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:47
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
float float float z
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
virtual void setStandAlone(const TrackRef &t)
Definition: Muon.cc:848
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:30
void setAlias(std::string alias)
T sqrt(T t)
Definition: SSEVec.h:48
double p4[4]
Definition: TauolaWrapper.h:92
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
Definition: Track.h:63
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
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:847
virtual void produce(edm::Event &, const edm::EventSetup &)
reconstruct muons
const T & get() const
Definition: EventSetup.h:55
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
unsigned short found() const
Number of valid hits on track.
Definition: Track.h:100
virtual void setCombined(const TrackRef &t)
Definition: Muon.cc:850
const PositionType & position() const
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
Definition: Track.h:65