105 debug_(ps.getParameter<
int>(
"debugLevel")),
115 desc.
add<
bool>((
"doBarrel"),
true);
116 desc.
add<
bool>((
"doEndcaps"),
true);
119 desc.
add<
int>((
"clusEtaSize"), 3);
120 desc.
add<
int>((
"clusPhiSize"), 3);
121 desc.
add<
std::string>((
"barrelClusterCollection"),
"Simple3x3ClustersBarrel");
122 desc.
add<
std::string>((
"endcapClusterCollection"),
"Simple3x3ClustersEndcap");
123 desc.
add<
double>((
"clusSeedThr"), 0.5);
124 desc.
add<
double>((
"clusSeedThrEndCap"), 1.0);
125 desc.
add<
bool>((
"useRecoFlag"),
false);
126 desc.
add<
int>((
"flagLevelRecHitsToUse"), 1);
127 desc.
add<
bool>((
"useDBStatus"),
true);
128 desc.
add<
int>((
"statusLevelRecHitsToUse"), 1);
131 posCalcPSET.
add<
double>(
"T0_barl", 7.4);
132 posCalcPSET.
add<
double>(
"T0_endc", 3.1);
133 posCalcPSET.
add<
double>(
"T0_endcPresh", 1.2);
134 posCalcPSET.
add<
double>(
"W0", 4.2);
135 posCalcPSET.
add<
double>(
"X0", 0.89);
136 posCalcPSET.
add<
bool>(
"LogWeighted",
true);
139 desc.
add<
int>((
"maxNumberofSeeds"), 1000);
140 desc.
add<
int>((
"maxNumberofClusters"), 200);
141 desc.
add<
int>((
"debugLevel"), 0);
142 descriptions.
add((
"hltEgammaHLTNxNClusterProducer"), desc);
149 if (!barrelRecHitsHandle.
isValid()) {
150 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product eb hit!" << std::endl;
155 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer nEBrechits: " << evt.
id().
run() <<
" event " << evt.
id().
event()
156 <<
" " << hits_eb->
size() << std::endl;
164 if (!endcapRecHitsHandle.
isValid()) {
165 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product ee hit!" << std::endl;
170 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer nEErechits: " << evt.
id().
run() <<
" event " << evt.
id().
event()
171 <<
" " << hits_ee->
size() << std::endl;
184 if (flag != 0 && flag != 4)
187 if (flag != 0 && flag != 4 && flag != 6 && flag != 7)
210 std::vector<EcalRecHit> seeds;
212 double clusterSeedThreshold;
220 double energy = itt->energy();
223 if (energy > clusterSeedThreshold)
224 seeds.push_back(*itt);
237 std::unique_ptr<CaloSubdetectorTopology> topology_p;
240 topology_p = std::make_unique<EcalBarrelTopology>(*geoHandle);
243 topology_p = std::make_unique<EcalEndcapTopology>(*geoHandle);
249 std::vector<reco::BasicCluster>
clusters;
250 std::vector<DetId> usedXtals;
253 sort(seeds.begin(), seeds.end(), [](
auto const &
x,
auto const &
y) {
return (
x.energy() >
y.energy()); });
255 for (std::vector<EcalRecHit>::iterator itseed = seeds.begin(); itseed != seeds.end(); itseed++) {
256 DetId seed_id = itseed->id();
258 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(), usedXtals.end(), seed_id);
259 if (itdet != usedXtals.end())
263 std::vector<std::pair<DetId, float> > clus_used;
265 float clus_energy = 0;
267 for (std::vector<DetId>::iterator det = clus_v.begin(); det != clus_v.end(); det++) {
271 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(), usedXtals.end(), detid);
272 if (itdet != usedXtals.end())
276 if (hit == hits->
end())
282 usedXtals.push_back(detid);
283 clus_used.push_back(std::pair<DetId, float>(detid, 1.));
284 clus_energy += hit->energy();
288 if (clus_energy <= 0)
295 <<
" energy: " << clus_energy <<
" eta: " << clus_pos.Eta() <<
" phi: " << clus_pos.Phi()
296 <<
" nRecHits: " << clus_used.size() << std::endl;
307 auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
308 clusters_p->assign(clusters.begin(), clusters.end());
311 LogDebug(
"") <<
"nxnclusterProducer: " << clusters_p->size() <<
" made in barrel" << std::endl;
315 LogDebug(
"") <<
"nxnclusterProducer: " << clusters_p->size() <<
" made in endcap" << std::endl;
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
constexpr uint32_t rawId() const
get the raw id
std::vector< EcalRecHit >::const_iterator const_iterator
~EgammaHLTNxNClusterProducer() override
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const int statusLevelRecHitsToUse_
#define DEFINE_FWK_MODULE(type)
EgammaHLTNxNClusterProducer(const edm::ParameterSet &ps)
const double clusSeedThr_
const edm::EDGetTokenT< EcalRecHitCollection > endcapHitProducer_
const double clusSeedThrEndCap_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::string endcapClusterCollection_
PositionCalc posCalculator_
const_iterator end() const
DetId id() const
get the id
T const * product() const
XYZPointD XYZPoint
point in space with cartesian internal representation
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void produce(edm::Event &, const edm::EventSetup &) override
const int maxNumberofSeeds_
iterator find(key_type k)
void makeNxNClusters(edm::Event &evt, const edm::EventSetup &es, const EcalRecHitCollection *hits, const reco::CaloID::Detectors detector)
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=0)
bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
const std::string barrelClusterCollection_
const edm::EDGetTokenT< EcalRecHitCollection > barrelHitProducer_
const_iterator begin() const
const int maxNumberofClusters_
const int flagLevelRecHitsToUse_