1 #ifndef __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__ 2 #define __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__ 51 std::unique_ptr<HGCalClusteringAlgoBase>
algo;
66 timeOffset(ps.getParameter<double>(
"timeOffset")) {
89 produces<std::vector<reco::BasicCluster> >();
90 produces<std::vector<reco::BasicCluster> >(
"sharing");
92 produces< Density >();
107 desc.
add<
bool>(
"doSharing",
false);
112 desc.
add<
double>(
"timeOffset", 0.0);
113 descriptions.
add(
"hgcalLayerClusters", desc);
124 std::unique_ptr<std::vector<reco::BasicCluster> >
clusters(
new std::vector<reco::BasicCluster> ),
125 clusters_sharing(
new std::vector<reco::BasicCluster> );
126 auto density = std::make_unique<Density>();
130 algo->getEventSetup(es);
135 std::unordered_map<uint32_t, float> hitmap;
140 algo->populate(*ee_hits);
141 for(
auto const& it: *ee_hits) hitmap[it.detid().rawId()] = it.time();
147 algo->populate(*fh_hits);
148 for(
auto const& it: *fh_hits) hitmap[it.detid().rawId()] = it.time();
149 }
else if ( bh_hits.
isValid() ) {
150 algo->populate(*bh_hits);
155 algo->populate(*ee_hits);
156 for(
auto const& it: *ee_hits){
157 hitmap[it.detid().rawId()] = it.time();
160 algo->populate(*fh_hits);
161 for(
auto const& it: *fh_hits){
162 hitmap[it.detid().rawId()] = it.time();
165 algo->populate(*bh_hits);
170 algo->makeClusters();
173 *clusters_sharing =
algo->getClusters(
true);
176 auto clusterHandleSharing = evt.
put(
std::move(clusters_sharing),
"sharing");
179 *density =
algo->getDensity();
184 std::vector<float>
times;
185 times.reserve(clusterHandle->size());
187 for(
unsigned i = 0;
i < clusterHandle->size(); ++
i ) {
194 std::vector<float> timeClhits;
198 if(
finder == hitmap.end())
continue;
201 float rhTime =
finder->second;
202 if(rhTime < 0.)
continue;
207 times.push_back(timeCl);
210 auto timeCl = std::make_unique<edm::ValueMap<float>>();
212 filler.insert(clusterHandle, times.begin(), times.end());
217 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
def create(alignables, pedeDump, additionalData, outputFile, config)
reco::CaloCluster::AlgoId algoId
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< DetId, float > Density
void push_back(Ptr< T > const &iPtr)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
std::unique_ptr< HGCalClusteringAlgoBase > algo
edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token
hgcal_clustering::Density Density
#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 &)
size_t size() const
size in number of hits (e.g. in crystals for ECAL)
edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token
T get(const Candidate &c)