1 #ifndef __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__ 2 #define __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__ 50 std::unique_ptr<HGCalClusteringAlgoBase>
algo;
65 timeOffset(ps.getParameter<double>(
"timeOffset")) {
86 produces<std::vector<float>>(
"InitialLayerClustersMask");
87 produces<std::vector<reco::BasicCluster>>();
88 produces<std::vector<reco::BasicCluster>>(
"sharing");
103 desc.
add<
bool>(
"doSharing",
false);
108 desc.
add<
double>(
"timeOffset", 0.0);
109 descriptions.
add(
"hgcalLayerClusters", desc);
117 std::unique_ptr<std::vector<reco::BasicCluster>>
clusters(
new std::vector<reco::BasicCluster>),
118 clusters_sharing(
new std::vector<reco::BasicCluster>);
119 auto density = std::make_unique<Density>();
123 algo->getEventSetup(es);
128 std::unordered_map<uint32_t, float> hitmap;
133 algo->populate(*ee_hits);
134 for (
auto const& it : *ee_hits)
135 hitmap[it.detid().rawId()] = it.time();
141 algo->populate(*fh_hits);
142 for (
auto const& it : *fh_hits)
143 hitmap[it.detid().rawId()] = it.time();
144 }
else if (bh_hits.
isValid()) {
145 algo->populate(*bh_hits);
150 algo->populate(*ee_hits);
151 for (
auto const& it : *ee_hits) {
152 hitmap[it.detid().rawId()] = it.time();
155 algo->populate(*fh_hits);
156 for (
auto const& it : *fh_hits) {
157 hitmap[it.detid().rawId()] = it.time();
160 algo->populate(*bh_hits);
165 algo->makeClusters();
168 *clusters_sharing =
algo->getClusters(
true);
171 auto clusterHandleSharing = evt.
put(
std::move(clusters_sharing),
"sharing");
179 std::vector<float> times;
180 times.
reserve(clusterHandle->size());
182 for (
unsigned i = 0;
i < clusterHandle->size(); ++
i) {
188 if (sCl.
size() >= 3) {
189 std::vector<float> timeClhits;
193 if (
finder == hitmap.end())
197 float rhTime =
finder->second;
202 if (timeClhits.size() >= 3)
205 times.push_back(timeCl);
207 std::unique_ptr<std::vector<float>> layerClustersMask(
new std::vector<float>);
208 layerClustersMask->resize(clusterHandle->size(), 1.0);
209 evt.
put(
std::move(layerClustersMask),
"InitialLayerClustersMask");
211 auto timeCl = std::make_unique<edm::ValueMap<float>>();
213 filler.insert(clusterHandle, times.begin(), times.end());
218 for (
unsigned i = 0;
i < clusterHandleSharing->size(); ++
i) {
float fixSizeHighestDensity(std::vector< float > &t, float deltaT=0.210, float timeWidthBy=0.5)
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void produce(edm::Event &, const edm::EventSetup &) override
reco::CaloCluster::AlgoId algoId
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void push_back(Ptr< T > const &iPtr)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::unique_ptr< HGCalClusteringAlgoBase > algo
std::map< DetId, float > Density
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
hgcal_clustering::Density Density
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
#define DEFINE_FWK_MODULE(type)
~HGCalLayerClusterProducer() override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HGCalLayerClusterProducer(const edm::ParameterSet &)
void reserve(size_type n)
Reserve space for RefVector.
size_t size() const
size in number of hits (e.g. in crystals for ECAL)
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token