47 const bool doNose_ =
false;
64 : detector_(ps.getParameter<std::
string>(
"detector")),
65 doNose_(detector_ ==
"HFNose"),
66 clusters_token_(consumes(ps.getParameter<edm::
InputTag>(
"layer_clusters"))),
67 clustersTime_token_(consumes(ps.getParameter<edm::
InputTag>(
"time_layerclusters"))),
68 filtered_layerclusters_mask_token_(consumes(ps.getParameter<edm::
InputTag>(
"filtered_mask"))),
69 simclusters_token_(consumes(ps.getParameter<edm::
InputTag>(
"simclusters"))),
70 caloparticles_token_(consumes(ps.getParameter<edm::
InputTag>(
"caloparticles"))),
71 associatorMapSimClusterToReco_token_(
72 consumes(ps.getParameter<edm::
InputTag>(
"layerClusterSimClusterAssociator"))),
73 associatorMapCaloParticleToReco_token_(
74 consumes(ps.getParameter<edm::
InputTag>(
"layerClusterCaloParticleAssociator"))),
76 fractionCut_(ps.getParameter<double>(
"fractionCut")) {
77 produces<TracksterCollection>();
78 produces<std::vector<float>>();
79 produces<TracksterCollection>(
"fromCPs");
80 produces<std::vector<float>>(
"fromCPs");
81 produces<std::map<uint, std::vector<uint>>>();
96 edm::InputTag(
"layerClusterCaloParticleAssociationProducer"));
97 desc.
add<
double>(
"fractionCut", 0.);
103 auto result = std::make_unique<TracksterCollection>();
104 auto output_mask = std::make_unique<std::vector<float>>();
105 auto result_fromCP = std::make_unique<TracksterCollection>();
106 auto output_mask_fromCP = std::make_unique<std::vector<float>>();
107 auto cpToSc_SimTrackstersMap = std::make_unique<std::map<uint, std::vector<uint>>>();
111 output_mask->resize(layerClusters.size(), 1.f);
112 output_mask_fromCP->resize(layerClusters.size(), 1.f);
123 result->reserve(num_simclusters);
125 result_fromCP->reserve(num_caloparticles);
127 for (
const auto& [
key, lcVec] : caloParticlesToRecoColl) {
128 auto const&
cp = *(
key);
131 auto regr_energy =
cp.energy();
132 std::vector<uint> scSimTracksterIdx;
133 scSimTracksterIdx.reserve(
cp.simClusters().size());
136 if (
cp.g4Tracks()[0].crossedBoundary()) {
137 regr_energy =
cp.g4Tracks()[0].getMomentumAtBoundary().energy();
150 for (
const auto& scRef :
cp.simClusters()) {
151 const auto& it = simClustersToRecoColl.find(scRef);
152 if (it == simClustersToRecoColl.end())
154 const auto& lcVec = it->val;
155 auto const& sc = *(scRef);
162 sc.g4Tracks()[0].getMomentumAtBoundary().energy(),
172 if (
std::find(scSimTracksterIdx.begin(), scSimTracksterIdx.end(),
index) == scSimTracksterIdx.end()) {
173 scSimTracksterIdx.emplace_back(
index);
176 scSimTracksterIdx.shrink_to_fit();
191 if (result_fromCP->empty())
193 const auto index = result_fromCP->size() - 1;
194 if (cpToSc_SimTrackstersMap->find(
index) == cpToSc_SimTrackstersMap->end()) {
195 (*cpToSc_SimTrackstersMap)[
index] = scSimTracksterIdx;
204 result_fromCP->shrink_to_fit();
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
#define DEFINE_FWK_MODULE(type)
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_
bool getData(T &iHolder) const
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
void produce(edm::Event &, const edm::EventSetup &) override
static 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, std::vector< float > &output_mask, std::vector< Trackster > &result)
tuple key
prepare the HTCondor submission files and eventually submit them
bool get(ProductID const &oid, Handle< PROD > &result) const
const edm::EDGetTokenT< std::vector< CaloParticle > > caloparticles_token_
const edm::EDGetTokenT< std::vector< reco::CaloCluster > > clusters_token_
const edm::EDGetTokenT< edm::ValueMap< std::pair< float, float > > > clustersTime_token_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const edm::EDGetTokenT< hgcal::SimToRecoCollection > associatorMapCaloParticleToReco_token_
SimTrackstersProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< std::vector< SimCluster > > simclusters_token_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
hgcal::RecHitTools rhtools_