122 auto rng_engine = &(rng->
getEngine(sid));
125 std::vector<edm::Handle<reco::TrackToTrackingParticleAssociator> >
associators;
127 associators.emplace_back();
128 auto& back = associators.back();
132 std::vector<float> generalTrackTimes, gsfTrackTimes;
149 std::vector<reco::RecoToSimCollection> associatedTracks, associatedTracksGsf;
151 associatedTracks.emplace_back(
associator->associateRecoToSim(TrackCollectionH, TPCollectionH));
152 associatedTracksGsf.emplace_back(
associator->associateRecoToSim(GsfTrackCollectionH, TPCollectionH));
161 std::vector<float>
times, resos;
162 std::vector<float> gsf_times, gsf_resos;
164 times.reserve(TrackCollection.
size());
165 resos.reserve(TrackCollection.
size());
166 gsf_times.reserve(GsfTrackCollection.
size());
167 gsf_resos.reserve(GsfTrackCollection.
size());
169 for(
unsigned i = 0;
i < TrackCollection.
size(); ++
i ) {
171 if(
edm::isFinite( generalTrackTimes[
i] ) && generalTrackTimes[
i] != 0.f) {
172 const float resolution = reso->getTimeResolution(tk);
173 times.push_back( CLHEP::RandGauss::shoot(rng_engine, generalTrackTimes[i], resolution) );
174 resos.push_back( resolution );
176 times.push_back( generalTrackTimes[i] );
177 resos.push_back( fakeBeamSpotTimeWidth );
181 for(
unsigned i = 0; i < GsfTrackCollection.
size(); ++
i ) {
183 if(
edm::isFinite( gsfTrackTimes[i] ) && gsfTrackTimes[
i] != 0.f ) {
184 const float resolution = reso->getTimeResolution(tk);
185 gsf_times.push_back( CLHEP::RandGauss::shoot(rng_engine, gsfTrackTimes[i], resolution) );
186 gsf_resos.push_back( resolution );
188 gsf_times.push_back( gsfTrackTimes[i] );
189 gsf_resos.push_back( fakeBeamSpotTimeWidth );
193 writeValueMap( evt, TrackCollectionH, times, generalTracksName+name );
194 writeValueMap( evt, TrackCollectionH, resos, generalTracksName+name+resolution );
195 writeValueMap( evt, GsfTrackCollectionH, gsf_times, gsfTracksName+name );
196 writeValueMap( evt, GsfTrackCollectionH, gsf_resos, gsfTracksName+name+resolution );
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< Track > TrackCollection
collection of Tracks
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
std::vector< std::unique_ptr< const ResolutionModel > > resolutions_
std::vector< GsfTrack > GsfTrackCollection
collection of GsfTracks
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticles_
const std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associators_
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_
const edm::EDGetTokenT< edm::View< reco::Track > > gsfTracks_
void calculateTrackTimes(const edm::View< reco::Track > &, const std::vector< reco::RecoToSimCollection > &, std::vector< float > &) const