28 doBarrel_ (ps.getParameter<bool>(
"doBarrel")),
29 doEndcaps_ (ps.getParameter<bool>(
"doEndcaps")),
32 clusEtaSize_ (ps.getParameter<int> (
"clusEtaSize")),
33 clusPhiSize_ (ps.getParameter<int> (
"clusPhiSize")),
34 barrelClusterCollection_(ps.getParameter<std::
string>(
"barrelClusterCollection")),
35 endcapClusterCollection_(ps.getParameter<std::
string>(
"endcapClusterCollection")),
36 clusSeedThr_ (ps.getParameter<double> (
"clusSeedThr")),
37 clusSeedThrEndCap_ (ps.getParameter<double> (
"clusSeedThrEndCap")),
38 useRecoFlag_ (ps.getParameter<bool>(
"useRecoFlag")),
39 flagLevelRecHitsToUse_ (ps.getParameter<int>(
"flagLevelRecHitsToUse")),
40 useDBStatus_ (ps.getParameter<bool>(
"useDBStatus")),
41 statusLevelRecHitsToUse_(ps.getParameter<int>(
"statusLevelRecHitsToUse")),
42 maxNumberofSeeds_ (ps.getParameter<int> (
"maxNumberofSeeds")),
43 maxNumberofClusters_ (ps.getParameter<int> (
"maxNumberofClusters")),
44 debug_ (ps.getParameter<int> (
"debugLevel")),
58 desc.
add<
bool>((
"doBarrel"),
true);
59 desc.
add<
bool>((
"doEndcaps"),
true);
62 desc.
add<
int>((
"clusEtaSize"), 3);
63 desc.
add<
int>((
"clusPhiSize"), 3);
64 desc.
add<
std::string>((
"barrelClusterCollection"),
"Simple3x3ClustersBarrel");
65 desc.
add<
std::string>((
"endcapClusterCollection"),
"Simple3x3ClustersEndcap");
66 desc.
add<
double>((
"clusSeedThr"), 0.5);
67 desc.
add<
double>((
"clusSeedThrEndCap"), 1.0);
68 desc.
add<
bool>((
"useRecoFlag"),
false);
69 desc.
add<
int>((
"flagLevelRecHitsToUse"), 1);
70 desc.
add<
bool>((
"useDBStatus"),
true);
71 desc.
add<
int>((
"statusLevelRecHitsToUse"), 1);
74 posCalcPSET.
add<
double>(
"T0_barl", 7.4);
75 posCalcPSET.
add<
double>(
"T0_endc", 3.1);
76 posCalcPSET.
add<
double>(
"T0_endcPresh", 1.2);
77 posCalcPSET.
add<
double>(
"W0", 4.2);
78 posCalcPSET.
add<
double>(
"X0", 0.89);
79 posCalcPSET.
add<
bool>(
"LogWeighted",
true);
82 desc.
add<
int>((
"maxNumberofSeeds"), 1000);
83 desc.
add<
int>((
"maxNumberofClusters"), 200);
84 desc.
add<
int>((
"debugLevel"), 0);
85 descriptions.
add((
"hltEgammaHLTNxNClusterProducer"), desc);
93 if (!barrelRecHitsHandle.
isValid()) {
94 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product eb hit!" << std::endl;
99 LogDebug(
"")<<
"EgammaHLTNxNClusterProducer nEBrechits: "<< evt.
id().
run()<<
" event "<<evt.
id().
event() <<
" "<< hits_eb->
size()<<std::endl;
109 if (!endcapRecHitsHandle.
isValid()) {
110 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product ee hit!" << std::endl;
115 LogDebug(
"")<<
"EgammaHLTNxNClusterProducer nEErechits: "<< evt.
id().
run()<<
" event "<<evt.
id().
event() <<
" "<< hits_ee->
size()<<std::endl;
127 if( flag != 0)
return false;
130 if( flag !=0 && flag != 4 )
return false;
133 if( flag !=0 && flag != 4 && flag != 6 && flag != 7)
return false;
137 int status = int(channelStatus[rh.
id().
rawId()].getStatusCode());
158 std::vector<EcalRecHit> seeds;
160 double clusterSeedThreshold ;
169 double energy = itt->energy();
171 if (energy > clusterSeedThreshold ) seeds.push_back(*itt);
184 std::unique_ptr<CaloSubdetectorTopology> topology_p;
198 std::vector<reco::BasicCluster>
clusters;
199 std::vector<DetId> usedXtals;
206 for (std::vector<EcalRecHit>::iterator itseed=seeds.begin(); itseed!=seeds.end(); itseed++) {
207 DetId seed_id = itseed->id();
208 std::vector<DetId>::const_iterator usedIds;
210 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(),usedXtals.end(),seed_id);
211 if(itdet != usedXtals.end())
continue;
214 std::vector<std::pair<DetId, float> > clus_used;
216 float clus_energy = 0;
218 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
222 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(),usedXtals.end(),
detid);
223 if(itdet != usedXtals.end())
continue;
226 if( hit == hits->
end())
continue;
230 usedXtals.push_back(detid);
231 clus_used.push_back(std::pair<DetId, float>(detid, 1.) );
232 clus_energy += hit->energy();
236 if( clus_energy <= 0 )
continue;
240 if (
debug_>=2 )
LogDebug(
"")<<
"nxn_cluster in run "<< evt.
id().
run()<<
" event "<<evt.
id().
event()<<
" energy: "<<clus_energy <<
" eta: "<< clus_pos.Eta()<<
" phi: "<< clus_pos.Phi()<<
" nRecHits: "<< clus_used.size() <<std::endl;
253 clusters_p->assign(clusters.begin(), clusters.end());
255 if(
debug_>=1)
LogDebug(
"")<<
"nxnclusterProducer: "<<clusters_p->size() <<
" made in barrel"<<std::endl;
259 if(
debug_>=1)
LogDebug(
"")<<
"nxnclusterProducer: "<<clusters_p->size() <<
" made in endcap"<<std::endl;
EventNumber_t event() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< EcalRecHit >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const int statusLevelRecHitsToUse_
uint32_t rawId() const
get the raw id
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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)
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
void produce(edm::Event &, const edm::EventSetup &) override
~EgammaHLTNxNClusterProducer()
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_