113 std::vector<edm::Handle<reco::TrackToTrackingParticleAssociator>>
associators;
115 associators.emplace_back();
116 auto &back = associators.back();
120 std::vector<float> generalTrackTimes;
139 std::vector<reco::RecoToSimCollection> associatedTracks;
141 associatedTracks.emplace_back(
associator->associateRecoToSim(TrackCollectionH, TPCollectionH));
144 double sumSimTime = 0.;
145 double sumSimTimeSq = 0.;
148 if (puinfo.getBunchCrossing() == 0) {
149 for (
const float &
time : puinfo.getPU_times()) {
150 double simtime =
time;
151 sumSimTime += simtime;
152 sumSimTimeSq += simtime * simtime;
159 double meanSimTime = sumSimTime / double(nsim);
160 double varSimTime = sumSimTimeSq / double(nsim) - meanSimTime * meanSimTime;
162 std::normal_distribution<float> gausSimTime(meanSimTime, rmsSimTime);
165 unsigned int runNum_uint =
static_cast<unsigned int>(evt.
id().
run());
166 unsigned int lumiNum_uint =
static_cast<unsigned int>(evt.
id().
luminosityBlock());
167 unsigned int evNum_uint =
static_cast<unsigned int>(evt.
id().
event());
168 unsigned int tkChi2_uint = uint32_t(TrackCollection.
empty() ? 0 : TrackCollection.
refAt(0)->chi2() / 0.01);
169 std::uint32_t
seed = tkChi2_uint + (lumiNum_uint << 10) + (runNum_uint << 20) + evNum_uint;
170 std::mt19937 rng(seed);
172 for (
unsigned itk = 0; itk < TrackCollection.
size(); ++itk) {
173 const auto tkref = TrackCollection.
refAt(itk);
182 if (track_tps != associatedTracks.back().end() && track_tps->val.size() == 1) {
185 generalTrackTimes.push_back(time);
187 float rndtime = gausSimTime(rng);
188 generalTrackTimes.push_back(rndtime);
189 if (track_tps != associatedTracks.back().end() && track_tps->val.size() > 1) {
190 LogDebug(
"TooManyTracks") <<
"track matched to " << track_tps->val.size() <<
" tracking particles!" 198 std::vector<float>
times, resos;
200 times.reserve(TrackCollection.
size());
201 resos.reserve(TrackCollection.
size());
203 for (
unsigned i = 0;
i < TrackCollection.
size(); ++
i) {
206 bool inAcceptance = absEta < etaMax_ && absEta >=
etaMin_ && tk.
p() >
pMin_ &&
209 const float resolution = reso->getTimeResolution(tk);
210 std::normal_distribution<float> gausGeneralTime(generalTrackTimes[
i], resolution);
211 times.push_back(gausGeneralTime(rng));
212 resos.push_back(resolution);
214 times.push_back(0.0
f);
215 resos.push_back(-1.);
double p() const
momentum vector magnitude
EventNumber_t event() const
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< Track > TrackCollection
collection of Tracks
reco::TransientTrack build(const reco::Track *p) const
const std::string tracksName_
LuminosityBlockNumber_t luminosityBlock() const
std::vector< std::unique_ptr< const ResolutionModel > > resolutions_
RefToBase< value_type > refAt(size_type i) const
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
float extractTrackVertexTime(const TrackingParticle &, const reco::TransientTrack &) const
const edm::EDGetTokenT< TrackingParticleCollection > trackingParticles_
const float etaMaxForPtThreshold_
const std::vector< edm::EDGetTokenT< reco::TrackToTrackingParticleAssociator > > associators_
const edm::EDGetTokenT< edm::View< reco::Track > > tracks_
const edm::EDGetTokenT< std::vector< PileupSummaryInfo > > pileupSummaryInfo_