92 : doBarrel_(ps.getParameter<bool>(
"doBarrel")),
93 doEndcaps_(ps.getParameter<bool>(
"doEndcaps")),
98 clusEtaSize_(ps.getParameter<
int>(
"clusEtaSize")),
99 clusPhiSize_(ps.getParameter<
int>(
"clusPhiSize")),
100 barrelClusterCollection_(ps.getParameter<
std::string>(
"barrelClusterCollection")),
101 endcapClusterCollection_(ps.getParameter<
std::string>(
"endcapClusterCollection")),
102 clusSeedThr_(ps.getParameter<
double>(
"clusSeedThr")),
103 clusSeedThrEndCap_(ps.getParameter<
double>(
"clusSeedThrEndCap")),
104 useRecoFlag_(ps.getParameter<
bool>(
"useRecoFlag")),
105 flagLevelRecHitsToUse_(ps.getParameter<
int>(
"flagLevelRecHitsToUse")),
106 useDBStatus_(ps.getParameter<
bool>(
"useDBStatus")),
107 statusLevelRecHitsToUse_(ps.getParameter<
int>(
"statusLevelRecHitsToUse")),
108 maxNumberofSeeds_(ps.getParameter<
int>(
"maxNumberofSeeds")),
109 maxNumberofClusters_(ps.getParameter<
int>(
"maxNumberofClusters")),
110 debug_(ps.getParameter<
int>(
"debugLevel")),
112 produces<reco::BasicClusterCollection>(barrelClusterCollection_);
113 produces<reco::BasicClusterCollection>(endcapClusterCollection_);
120 desc.
add<
bool>((
"doBarrel"),
true);
121 desc.
add<
bool>((
"doEndcaps"),
true);
124 desc.
add<
int>((
"clusEtaSize"), 3);
125 desc.
add<
int>((
"clusPhiSize"), 3);
126 desc.
add<
std::string>((
"barrelClusterCollection"),
"Simple3x3ClustersBarrel");
127 desc.
add<
std::string>((
"endcapClusterCollection"),
"Simple3x3ClustersEndcap");
128 desc.
add<
double>((
"clusSeedThr"), 0.5);
129 desc.
add<
double>((
"clusSeedThrEndCap"), 1.0);
130 desc.
add<
bool>((
"useRecoFlag"),
false);
131 desc.
add<
int>((
"flagLevelRecHitsToUse"), 1);
132 desc.
add<
bool>((
"useDBStatus"),
true);
133 desc.
add<
int>((
"statusLevelRecHitsToUse"), 1);
136 posCalcPSET.
add<
double>(
"T0_barl", 7.4);
137 posCalcPSET.
add<
double>(
"T0_endc", 3.1);
138 posCalcPSET.
add<
double>(
"T0_endcPresh", 1.2);
139 posCalcPSET.
add<
double>(
"W0", 4.2);
140 posCalcPSET.
add<
double>(
"X0", 0.89);
141 posCalcPSET.
add<
bool>(
"LogWeighted",
true);
144 desc.
add<
int>((
"maxNumberofSeeds"), 1000);
145 desc.
add<
int>((
"maxNumberofClusters"), 200);
146 desc.
add<
int>((
"debugLevel"), 0);
147 descriptions.
add((
"hltEgammaHLTNxNClusterProducer"), desc);
154 if (!barrelRecHitsHandle.
isValid()) {
155 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product eb hit!" << std::endl;
160 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer nEBrechits: " << evt.
id().
run() <<
" event " << evt.
id().
event()
161 <<
" " << hits_eb->
size() << std::endl;
169 if (!endcapRecHitsHandle.
isValid()) {
170 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product ee hit!" << std::endl;
175 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer nEErechits: " << evt.
id().
run() <<
" event " << evt.
id().
event()
176 <<
" " << hits_ee->
size() << std::endl;
189 if (flag != 0 && flag != 4)
192 if (flag != 0 && flag != 4 && flag != 6 && flag != 7)
197 int status = int(channelStatus[rh.
id().
rawId()].getStatusCode());
216 std::vector<EcalRecHit>
seeds;
218 double clusterSeedThreshold;
225 for (
auto const itt : hits) {
226 double energy = itt.energy();
229 if (energy > clusterSeedThreshold)
230 seeds.push_back(itt);
242 std::unique_ptr<CaloSubdetectorTopology> topology_p;
245 topology_p = std::make_unique<EcalBarrelTopology>(caloGeometry);
248 topology_p = std::make_unique<EcalEndcapTopology>(caloGeometry);
254 std::vector<reco::BasicCluster>
clusters;
255 std::vector<DetId> usedXtals;
258 sort(seeds.begin(), seeds.end(), [](
auto const &
x,
auto const &
y) {
return (
x.energy() >
y.energy()); });
260 for (std::vector<EcalRecHit>::iterator itseed = seeds.begin(); itseed != seeds.end(); itseed++) {
261 DetId seed_id = itseed->id();
263 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(), usedXtals.end(), seed_id);
264 if (itdet != usedXtals.end())
268 std::vector<std::pair<DetId, float> > clus_used;
270 float clus_energy = 0;
272 for (
auto const &detid : clus_v) {
274 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(), usedXtals.end(), detid);
275 if (itdet != usedXtals.end())
279 if (hit == hits.end())
285 usedXtals.push_back(detid);
286 clus_used.push_back(std::pair<DetId, float>(detid, 1.));
287 clus_energy += hit->energy();
291 if (clus_energy <= 0)
298 <<
" energy: " << clus_energy <<
" eta: " << clus_pos.Eta() <<
" phi: " << clus_pos.Phi()
299 <<
" nRecHits: " << clus_used.size() << std::endl;
310 auto clusters_p = std::make_unique<reco::BasicClusterCollection>();
311 clusters_p->assign(clusters.begin(), clusters.end());
314 LogDebug(
"") <<
"nxnclusterProducer: " << clusters_p->size() <<
" made in barrel" << std::endl;
318 LogDebug(
"") <<
"nxnclusterProducer: " << clusters_p->size() <<
" made in endcap" << std::endl;
EventNumber_t event() const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
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_
bool getData(T &iHolder) const
EgammaHLTNxNClusterProducer(const edm::ParameterSet &ps)
const double clusSeedThr_
const edm::EDGetTokenT< EcalRecHitCollection > endcapHitProducer_
const double clusSeedThrEndCap_
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const std::string endcapClusterCollection_
PositionCalc posCalculator_
void makeNxNClusters(edm::Event &evt, const edm::EventSetup &es, const EcalRecHitCollection &hits, const reco::CaloID::Detectors detector)
const edm::ESGetToken< EcalChannelStatus, EcalChannelStatusRcd > ecalChannelStatusToken_
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_
bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
const std::string barrelClusterCollection_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
const edm::EDGetTokenT< EcalRecHitCollection > barrelHitProducer_
const int maxNumberofClusters_
const int flagLevelRecHitsToUse_