CMS 3D CMS Logo

MuonMillepedeTrackRefitter.cc
Go to the documentation of this file.
1 
10 
11 // Collaborating Class Header
13 
18 
24 
27 
30 
36 
39 
43 
46 
47 #include <vector>
48 #include "TH2D.h"
49 
52  SACollectionTag = pset.getParameter<edm::InputTag>("SATrackCollectionTag");
53 
54  //Products
55  produces<std::vector<Trajectory>>();
56  produces<TrajTrackAssociationCollection>();
57 }
58 
59 // Destructor
61 
63  //Get collections from the event
64 
66  event.getByLabel(SACollectionTag, tracksSA);
67 
69  eventSetup.get<IdealMagneticFieldRecord>().get(theMGField);
70 
71  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
72  eventSetup.get<GlobalTrackingGeometryRecord>().get(theTrackingGeometry);
73 
74  edm::RefProd<std::vector<Trajectory>> trajectoryCollectionRefProd = event.getRefBeforePut<std::vector<Trajectory>>();
75 
76  //Allocate collection of tracks
77  auto trajectoryCollection = std::make_unique<std::vector<Trajectory>>();
78  // Association map between Trajectory and Track
79  auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
80 
81  //Create the propagator
82 
83  std::map<edm::Ref<std::vector<Trajectory>>::key_type, edm::Ref<reco::TrackCollection>::key_type> trajToTrack_map;
84 
85  edm::Ref<std::vector<Trajectory>>::key_type trajectoryIndex = 0;
86 
87  reco::TrackRef::key_type trackIndex = 0;
88 
89  for (reco::TrackCollection::const_iterator trackSA = tracksSA->begin(); trackSA != tracksSA->end(); ++trackSA) {
90  reco::TransientTrack tTrackSA(*trackSA, &*theMGField, theTrackingGeometry);
91 
92  //Create an empty trajectory
93  Trajectory myTraj;
94 
96 
97  for (trackingRecHit_iterator theHit = tTrackSA.recHitsBegin(); theHit != tTrackSA.recHitsEnd(); ++theHit) {
98  TrackingRecHit* myClone = (*theHit)->clone();
99  const GeomDet* myDet = theTrackingGeometry->idToDet((*theHit)->geographicalId());
100  TrajectoryMeasurement myMeas(innerTSOS,
102  myTraj.push(myMeas);
103  }
104 
105  trajectoryCollection->push_back(myTraj);
106  trajToTrack_map[trajectoryIndex] = trackIndex;
107  ++trajectoryIndex;
108  ++trackIndex;
109  }
110 
111  edm::OrphanHandle<std::vector<Trajectory>> trajsRef = event.put(std::move(trajectoryCollection));
112 
113  for (trajectoryIndex = 0; trajectoryIndex < tracksSA->size(); ++trajectoryIndex) {
114  edm::Ref<reco::TrackCollection>::key_type trackCounter = trajToTrack_map[trajectoryIndex];
115  trajTrackMap->insert(edm::Ref<std::vector<Trajectory>>(trajsRef, trajectoryIndex),
116  edm::Ref<reco::TrackCollection>(tracksSA, trackCounter));
117  }
118 
119  event.put(std::move(trajTrackMap));
120 }
121 
edm::RefProd
Definition: EDProductfwd.h:25
Propagator.h
MuonTransientTrackingRecHit::specificBuild
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
Definition: MuonTransientTrackingRecHit.h:75
Muon.h
Cylinder.h
GeomDet
Definition: GeomDet.h:27
MuonMillepedeTrackRefitter.h
ESHandle.h
SegmentToTrackAssociator.h
GlobalTrackingGeometryRecord
Definition: GlobalTrackingGeometryRecord.h:17
MuonTransientTrackingRecHit.h
TransientTrack.h
reco::TransientTrack::recHitsBegin
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
Definition: TransientTrack.h:126
edm::Handle< reco::TrackCollection >
edm::Ref
Definition: AssociativeIterator.h:58
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
Plane.h
TrajectoryStateOnSurface
Definition: TrajectoryStateOnSurface.h:16
MakerMacros.h
Track.h
MuonMillepedeTrackRefitter::SACollectionTag
edm::InputTag SACollectionTag
Definition: MuonMillepedeTrackRefitter.h:54
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
reco::TransientTrack::recHitsEnd
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
Definition: TransientTrack.h:128
MuonFwd.h
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
MuonMillepedeTrackRefitter
Definition: MuonMillepedeTrackRefitter.h:37
DTChamberId.h
TrajTrackAssociation.h
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
GlobalTrackingGeometryRecord.h
Cone.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
MagneticField.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
Trajectory::push
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
TrackingRecHit::clone
virtual TrackingRecHit * clone() const =0
edm::Ref::key_type
std::remove_cv< typename std::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:164
PropagationDirection.h
TrackingRecHit
Definition: TrackingRecHit.h:21
Trajectory.h
GeomDet.h
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
reco::TransientTrack
Definition: TransientTrack.h:19
Trajectory
Definition: Trajectory.h:38
Frameworkfwd.h
MuonTransientTrackingRecHitBuilder.h
TrackingComponentsRecord.h
GlobalTrackingGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: GlobalTrackingGeometry.cc:44
MuonMillepedeTrackRefitter::produce
void produce(edm::Event &event, const edm::EventSetup &eventSetup) override
Definition: MuonMillepedeTrackRefitter.cc:62
event
Definition: event.py:1
GlobalTrackingGeometry.h
edm::Event
Definition: Event.h:73
TrajectoryMeasurement
Definition: TrajectoryMeasurement.h:25
edm::InputTag
Definition: InputTag.h:15
MuonMillepedeTrackRefitter::~MuonMillepedeTrackRefitter
~MuonMillepedeTrackRefitter() override
Destructor.
Definition: MuonMillepedeTrackRefitter.cc:60
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
MuonMillepedeTrackRefitter::MuonMillepedeTrackRefitter
MuonMillepedeTrackRefitter(const edm::ParameterSet &pset)
Constructor.
Definition: MuonMillepedeTrackRefitter.cc:51
reco::TransientTrack::innermostMeasurementState
TrajectoryStateOnSurface innermostMeasurementState() const
Definition: TransientTrack.h:88