229 auto resultTracksters = std::make_unique<std::vector<Trackster>>();
230 auto resultTrackstersMerged = std::make_unique<std::vector<Trackster>>();
231 auto linkedResultTracksters = std::make_unique<std::vector<std::vector<unsigned int>>>();
240 const auto &
tracks = *tracks_h;
246 inputTimingView = (*inputTiming_h).const_view();
254 std::vector<float> original_global_mask(
layerClusters.size(), 1.f);
257 for (
unsigned int j = 0;
j < tmp_mask.size(); ++
j) {
258 original_global_mask[
j] *= tmp_mask[
j];
262 auto resultMask = std::make_unique<std::vector<float>>(original_global_mask);
269 generalTrackstersManager.addVector(*general_tracksters_h[
i]);
272 std::vector<edm::Handle<std::vector<std::vector<unsigned>>>> general_tracksterlinks_h(
274 std::vector<std::vector<unsigned>> generalTracksterLinksGlobalId;
277 for (
unsigned int j = 0;
j < general_tracksterlinks_h[
i]->size(); ++
j) {
278 generalTracksterLinksGlobalId.emplace_back();
279 auto &links_vector = generalTracksterLinksGlobalId.back();
280 links_vector.resize((*general_tracksterlinks_h[
i])[
j].
size());
281 for (
unsigned int k = 0;
k < links_vector.size(); ++
k) {
282 links_vector[
k] = generalTrackstersManager.getGlobalIndex(
i, (*general_tracksterlinks_h[
i])[
j][
k]);
287 std::vector<bool> maskTracks;
288 maskTracks.resize(
tracks.size());
295 generalTrackstersManager,
296 generalTracksterLinksGlobalId,
300 auto resultCandidates = std::make_unique<std::vector<TICLCandidate>>();
301 std::vector<int> trackstersInTrackIndices(
tracks.size(), -1);
312 std::vector<bool> maskTracksters(resultTracksters->size(),
true);
315 for (
size_t iTrack = 0; iTrack <
tracks.size(); iTrack++) {
316 if (maskTracks[iTrack]) {
317 auto const tracksterId = trackstersInTrackIndices[iTrack];
319 if (tracksterId != -1 and !maskTracksters.empty()) {
322 resultCandidates->push_back(chargedCandidate);
323 maskTracksters[tracksterId] =
false;
331 if (muonRef.
isNonnull() and muonRef->isGlobalMuon()) {
333 chargedCandidate.setPdgId(13 * trackPtr.get()->charge());
335 resultCandidates->push_back(chargedCandidate);
341 for (
size_t iTrackster = 0; iTrackster < maskTracksters.size(); iTrackster++) {
342 if (maskTracksters[iTrackster]) {
346 resultCandidates->push_back(neutralCandidate);
360 float pathlength =
propagator->propagateWithPath(stateAtBeamspot, surf_inn.surface()).
second;
363 const auto &t_inn_out =
propagator->propagateWithPath(fts_inn, surf_out.surface());
365 if (t_inn_out.first.isValid()) {
366 pathlength += t_inn_out.second;
368 std::pair<float, float> rMinMax =
hgcons_->
rangeR(zVal,
true);
371 float zSide = (iSide == 0) ? (-1. * zVal) : zVal;
372 const auto &disk = std::make_unique<GeomDet>(
377 const auto &tsos =
propagator->propagateWithPath(fts_out, disk->surface());
379 if (tsos.first.isValid()) {
380 pathlength += tsos.second;
386 <<
"Not able to use the track to compute the path length. A straight line will be used instead.";
static DiskPointer build(Args &&... args)
static int muAssocToTrack(const reco::TrackRef &trackref, const reco::MuonCollection &muons)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool get(ProductID const &oid, Handle< PROD > &result) const
const StringCutObjectSelector< reco::Track > cutTk_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
void assignTimeToCandidates(std::vector< TICLCandidate > &resultCandidates, edm::Handle< std::vector< reco::Track >> track_h, MtdHostCollection::ConstView &inputTimingView, F func) const
Global3DPoint GlobalPoint
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::EDGetTokenT< std::vector< reco::Track > > tracks_token_
static std::string const input
edm::ESHandle< Propagator > propagator_
U second(std::pair< T, U > const &p)
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry_
T const * product() const
edm::Ref< MuonCollection > MuonRef
presistent reference to a Muon
std::vector< edm::EDGetTokenT< std::vector< Trackster > > > general_tracksters_tokens_
std::pair< double, double > rangeR(double z, bool reco) const
hgcal::RecHitTools rhtools_
typename Layout::ConstView ConstView
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const HGCalDDDConstants * hgcons_
std::vector< edm::EDGetTokenT< std::vector< std::vector< unsigned > > > > general_tracksterlinks_tokens_
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool computeLocalTime=false, bool energyWeight=true)
edm::EDGetTokenT< MtdHostCollection > inputTimingToken_
std::vector< edm::EDGetTokenT< std::vector< float > > > original_masks_tokens_
std::unique_ptr< TICLInterpretationAlgoBase< reco::Track > > generalInterpretationAlgo_
Log< level::Warning, false > LogWarning
edm::ESHandle< MagneticField > bfield_
void filterTracks(edm::Handle< std::vector< reco::Track >> tkH, const edm::Handle< std::vector< reco::Muon >> &muons_h, const StringCutObjectSelector< reco::Track > cutTk_, const float tkEnergyCut_, std::vector< bool > &maskTracks)
const edm::EDGetTokenT< std::vector< reco::Muon > > muons_token_
Global3DVector GlobalVector