228 auto resultTracksters = std::make_unique<std::vector<Trackster>>();
229 auto resultTrackstersMerged = std::make_unique<std::vector<Trackster>>();
230 auto linkedResultTracksters = std::make_unique<std::vector<std::vector<unsigned int>>>();
239 const auto &
tracks = *tracks_h;
245 inputTimingView = (*inputTiming_h).const_view();
253 std::vector<float> original_global_mask(
layerClusters.size(), 1.f);
256 for (
unsigned int j = 0;
j < tmp_mask.size(); ++
j) {
257 original_global_mask[
j] *= tmp_mask[
j];
261 auto resultMask = std::make_unique<std::vector<float>>(original_global_mask);
268 generalTrackstersManager.addVector(*general_tracksters_h[
i]);
271 std::vector<edm::Handle<std::vector<std::vector<unsigned>>>> general_tracksterlinks_h(
273 std::vector<std::vector<unsigned>> generalTracksterLinksGlobalId;
276 for (
unsigned int j = 0;
j < general_tracksterlinks_h[
i]->size(); ++
j) {
277 generalTracksterLinksGlobalId.emplace_back();
278 auto &links_vector = generalTracksterLinksGlobalId.back();
279 links_vector.resize((*general_tracksterlinks_h[
i])[
j].
size());
280 for (
unsigned int k = 0;
k < links_vector.size(); ++
k) {
281 links_vector[
k] = generalTrackstersManager.getGlobalIndex(
i, (*general_tracksterlinks_h[
i])[
j][
k]);
286 std::vector<bool> maskTracks;
287 maskTracks.resize(
tracks.size());
294 generalTrackstersManager,
295 generalTracksterLinksGlobalId,
299 auto resultCandidates = std::make_unique<std::vector<TICLCandidate>>();
300 std::vector<int> trackstersInTrackIndices(
tracks.size(), -1);
315 std::vector<bool> maskTracksters(resultTracksters->size(),
true);
318 for (
size_t iTrack = 0; iTrack <
tracks.size(); iTrack++) {
319 if (maskTracks[iTrack]) {
320 auto const tracksterId = trackstersInTrackIndices[iTrack];
322 if (tracksterId != -1 and !maskTracksters.empty()) {
325 resultCandidates->push_back(chargedCandidate);
326 maskTracksters[tracksterId] =
false;
334 if (muonRef.
isNonnull() and muonRef->isGlobalMuon()) {
336 chargedCandidate.setPdgId(13 * trackPtr.get()->charge());
338 resultCandidates->push_back(chargedCandidate);
344 for (
size_t iTrackster = 0; iTrackster < maskTracksters.size(); iTrackster++) {
345 if (maskTracksters[iTrackster]) {
349 resultCandidates->push_back(neutralCandidate);
364 float pathlength =
propagator->propagateWithPath(stateAtBeamspot, surf_inn.surface()).
second;
367 const auto &t_inn_out =
propagator->propagateWithPath(fts_inn, surf_out.surface());
369 if (t_inn_out.first.isValid()) {
370 pathlength += t_inn_out.second;
372 std::pair<float, float> rMinMax =
hgcons_->
rangeR(zVal,
true);
375 float zSide = (iSide == 0) ? (-1. * zVal) : zVal;
376 const auto &disk = std::make_unique<GeomDet>(
381 const auto &tsos =
propagator->propagateWithPath(fts_out, disk->surface());
383 if (tsos.first.isValid()) {
384 pathlength += tsos.second;
391 <<
"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.
void assignPCAtoTracksters(std::vector< Trackster > &tracksters, const std::vector< reco::CaloCluster > &layerClusters, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, bool computeLocalTime=false, bool energyWeight=true, bool clean=false, int minLayer=10, int maxLayer=10)
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_
edm::EDGetTokenT< MtdHostCollection > inputTimingToken_
std::vector< edm::EDGetTokenT< std::vector< float > > > original_masks_tokens_
std::unique_ptr< TICLInterpretationAlgoBase< reco::Track > > generalInterpretationAlgo_
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