test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
48 #include <vector>
49 #include "TH2D.h"
50 
51 
54 {
55 
56  SACollectionTag = pset.getParameter<edm::InputTag>( "SATrackCollectionTag" );
57 
58  //Products
59  produces<std::vector<Trajectory> >();
60  produces<TrajTrackAssociationCollection>();
61 
62 }
63 
64 // Destructor
66 {
67 }
68 
69 
71 {
72 
73  //Get collections from the event
74 
76  event.getByLabel( SACollectionTag, tracksSA );
77 
79  eventSetup.get<IdealMagneticFieldRecord>().get( theMGField );
80 
81  edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry;
82  eventSetup.get<GlobalTrackingGeometryRecord>().get( theTrackingGeometry );
83 
84  edm::RefProd<std::vector<Trajectory> > trajectoryCollectionRefProd
85  = event.getRefBeforePut<std::vector<Trajectory> >();
86 
87  //Allocate collection of tracks
88  auto trajectoryCollection = std::make_unique<std::vector<Trajectory>>();
89  // Association map between Trajectory and Track
90  auto trajTrackMap = std::make_unique<TrajTrackAssociationCollection>();
91 
92 
93  //Create the propagator
94 
95  std::map<edm::Ref<std::vector<Trajectory> >::key_type, edm::Ref<reco::TrackCollection>::key_type> trajToTrack_map;
96 
97  edm::Ref<std::vector<Trajectory> >::key_type trajectoryIndex = 0;
98 
99  reco::TrackRef::key_type trackIndex = 0;
100 
101  for (reco::TrackCollection::const_iterator trackSA = tracksSA->begin(); trackSA != tracksSA->end(); ++trackSA ) {
102 
103  reco::TransientTrack tTrackSA( *trackSA, &*theMGField, theTrackingGeometry );
104 
105  //Create an empty trajectory
106  Trajectory myTraj;
107 
109 
110 
111  for(trackingRecHit_iterator theHit = tTrackSA.recHitsBegin(); theHit != tTrackSA.recHitsEnd(); ++theHit) {
112 
113  TrackingRecHit *myClone = (*theHit)->clone();
114  const GeomDet* myDet = theTrackingGeometry->idToDet( (*theHit)->geographicalId() );
116  myTraj.push(myMeas);
117 
118  }
119 
120  trajectoryCollection->push_back(myTraj);
121  trajToTrack_map[trajectoryIndex] = trackIndex;
122  ++trajectoryIndex;
123  ++trackIndex;
124  }
125 
126  edm::OrphanHandle<std::vector<Trajectory> > trajsRef = event.put(std::move(trajectoryCollection));
127 
128  for( trajectoryIndex = 0; trajectoryIndex < tracksSA->size(); ++trajectoryIndex)
129  {
130  edm::Ref<reco::TrackCollection>::key_type trackCounter = trajToTrack_map[trajectoryIndex];
131  trajTrackMap->insert(edm::Ref<std::vector<Trajectory> >(trajsRef, trajectoryIndex), edm::Ref<reco::TrackCollection>(tracksSA, trackCounter));
132  }
133 
134  event.put(std::move(trajTrackMap));
135 
136 }
137 
138 
139 
141 
142 
143 
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void produce(edm::Event &event, const edm::EventSetup &eventSetup)
TrajectoryStateOnSurface innermostMeasurementState() const
virtual ~MuonMillepedeTrackRefitter()
Destructor.
def move
Definition: eostools.py:510
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
trackingRecHit_iterator recHitsEnd() const
last iterator to RecHits
virtual TrackingRecHit * clone() const =0
const T & get() const
Definition: EventSetup.h:56
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
void push(const TrajectoryMeasurement &tm)
Definition: Trajectory.cc:50
trackingRecHit_iterator recHitsBegin() const
first iterator to RecHits
MuonMillepedeTrackRefitter(const edm::ParameterSet &pset)
Constructor.
boost::remove_cv< typename boost::remove_reference< argument_type >::type >::type key_type
Definition: Ref.h:168
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection