151 auto result = std::make_unique<TracksterCollection>();
152 auto output_mask = std::make_unique<std::vector<float>>();
153 auto result_fromCP = std::make_unique<TracksterCollection>();
154 auto output_mask_fromCP = std::make_unique<std::vector<float>>();
155 auto cpToSc_SimTrackstersMap = std::make_unique<std::map<uint, std::vector<uint>>>();
171 result->reserve(num_simclusters);
173 result_fromCP->reserve(num_caloparticles);
175 for (
const auto& [
key, lcVec] : caloParticlesToRecoColl) {
176 auto const&
cp = *(
key);
179 auto regr_energy =
cp.energy();
180 std::vector<uint> scSimTracksterIdx;
181 scSimTracksterIdx.reserve(
cp.simClusters().size());
184 if (
cp.g4Tracks()[0].crossedBoundary()) {
185 regr_energy =
cp.g4Tracks()[0].getMomentumAtBoundary().energy();
199 for (
const auto& scRef :
cp.simClusters()) {
200 const auto& it = simClustersToRecoColl.find(scRef);
201 if (it == simClustersToRecoColl.end())
203 const auto& lcVec = it->val;
204 auto const& sc = *(scRef);
211 sc.g4Tracks()[0].getMomentumAtBoundary().energy(),
222 if (
std::find(scSimTracksterIdx.begin(), scSimTracksterIdx.end(),
index) == scSimTracksterIdx.end()) {
223 scSimTracksterIdx.emplace_back(
index);
226 scSimTracksterIdx.shrink_to_fit();
242 if (result_fromCP->empty())
244 const auto index = result_fromCP->size() - 1;
245 if (cpToSc_SimTrackstersMap->find(
index) == cpToSc_SimTrackstersMap->end()) {
246 (*cpToSc_SimTrackstersMap)[
index] = scSimTracksterIdx;
255 result_fromCP->shrink_to_fit();
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool get(ProductID const &oid, Handle< PROD > &result) const
void addTrackster(const int &index, const std::vector< std::pair< edm::Ref< reco::CaloClusterCollection >, std::pair< float, float >>> &lcVec, const std::vector< float > &inputClusterMask, const float &fractionCut_, const float &energy, const int &pdgId, const int &charge, const edm::ProductID &seed, const Trackster::IterationIndex iter, std::vector< float > &output_mask, std::vector< Trackster > &result)
const edm::EDGetTokenT< hgcal::SimToRecoCollectionWithSimClusters > associatorMapSimClusterToReco_token_
const edm::EDGetTokenT< std::vector< float > > filtered_layerclusters_mask_token_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geom_token_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const double fractionCut_
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
const edm::EDGetTokenT< std::vector< CaloParticle > > caloparticles_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
bool getData(T &iHolder) const
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
const edm::EDGetTokenT< hgcal::SimToRecoCollection > associatorMapCaloParticleToReco_token_
const edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
hgcal::RecHitTools rhtools_