26 doBarrel_ (ps.getParameter<bool>(
"doBarrel")),
27 doEndcaps_ (ps.getParameter<bool>(
"doEndcaps")),
30 clusEtaSize_ (ps.getParameter<int> (
"clusEtaSize")),
31 clusPhiSize_ (ps.getParameter<int> (
"clusPhiSize")),
32 barrelClusterCollection_(ps.getParameter<std::
string>(
"barrelClusterCollection")),
33 endcapClusterCollection_(ps.getParameter<std::
string>(
"endcapClusterCollection")),
34 clusSeedThr_ (ps.getParameter<double> (
"clusSeedThr")),
35 clusSeedThrEndCap_ (ps.getParameter<double> (
"clusSeedThrEndCap")),
36 useRecoFlag_ (ps.getParameter<bool>(
"useRecoFlag")),
37 flagLevelRecHitsToUse_ (ps.getParameter<int>(
"flagLevelRecHitsToUse")),
38 useDBStatus_ (ps.getParameter<bool>(
"useDBStatus")),
39 statusLevelRecHitsToUse_(ps.getParameter<int>(
"statusLevelRecHitsToUse")),
40 maxNumberofSeeds_ (ps.getParameter<int> (
"maxNumberofSeeds")),
41 maxNumberofClusters_ (ps.getParameter<int> (
"maxNumberofClusters")),
42 debug_ (ps.getParameter<int> (
"debugLevel")),
56 desc.
add<
bool>((
"doBarrel"),
true);
57 desc.
add<
bool>((
"doEndcaps"),
true);
60 desc.
add<
int>((
"clusEtaSize"), 3);
61 desc.
add<
int>((
"clusPhiSize"), 3);
62 desc.
add<
std::string>((
"barrelClusterCollection"),
"Simple3x3ClustersBarrel");
63 desc.
add<
std::string>((
"endcapClusterCollection"),
"Simple3x3ClustersEndcap");
64 desc.
add<
double>((
"clusSeedThr"), 0.5);
65 desc.
add<
double>((
"clusSeedThrEndCap"), 1.0);
66 desc.
add<
bool>((
"useRecoFlag"),
false);
67 desc.
add<
int>((
"flagLevelRecHitsToUse"), 1);
68 desc.
add<
bool>((
"useDBStatus"),
true);
69 desc.
add<
int>((
"statusLevelRecHitsToUse"), 1);
72 posCalcPSET.
add<
double>(
"T0_barl", 7.4);
73 posCalcPSET.
add<
double>(
"T0_endc", 3.1);
74 posCalcPSET.
add<
double>(
"T0_endcPresh", 1.2);
75 posCalcPSET.
add<
double>(
"W0", 4.2);
76 posCalcPSET.
add<
double>(
"X0", 0.89);
77 posCalcPSET.
add<
bool>(
"LogWeighted",
true);
80 desc.
add<
int>((
"maxNumberofSeeds"), 1000);
81 desc.
add<
int>((
"maxNumberofClusters"), 200);
82 desc.
add<
int>((
"debugLevel"), 0);
83 descriptions.
add((
"hltEgammaHLTNxNClusterProducer"), desc);
91 if (!barrelRecHitsHandle.
isValid()) {
92 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product eb hit!" << std::endl;
97 LogDebug(
"")<<
"EgammaHLTNxNClusterProducer nEBrechits: "<< evt.
id().
run()<<
" event "<<evt.
id().
event() <<
" "<< hits_eb->
size()<<std::endl;
107 if (!endcapRecHitsHandle.
isValid()) {
108 LogDebug(
"") <<
"EgammaHLTNxNClusterProducer Error! can't get product ee hit!" << std::endl;
113 LogDebug(
"")<<
"EgammaHLTNxNClusterProducer nEErechits: "<< evt.
id().
run()<<
" event "<<evt.
id().
event() <<
" "<< hits_ee->
size()<<std::endl;
125 if( flag != 0)
return false;
128 if( flag !=0 && flag != 4 )
return false;
131 if( flag !=0 && flag != 4 && flag != 6 && flag != 7)
return false;
135 int status = int(channelStatus[rh.
id().
rawId()].getStatusCode());
156 std::vector<EcalRecHit> seeds;
158 double clusterSeedThreshold ;
167 double energy = itt->energy();
169 if (energy > clusterSeedThreshold ) seeds.push_back(*itt);
196 std::vector<reco::BasicCluster>
clusters;
197 std::vector<DetId> usedXtals;
204 for (std::vector<EcalRecHit>::iterator itseed=seeds.begin(); itseed!=seeds.end(); itseed++) {
205 DetId seed_id = itseed->id();
206 std::vector<DetId>::const_iterator usedIds;
208 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(),usedXtals.end(),seed_id);
209 if(itdet != usedXtals.end())
continue;
212 std::vector<std::pair<DetId, float> > clus_used;
214 float clus_energy = 0;
216 for (std::vector<DetId>::iterator det=clus_v.begin(); det!=clus_v.end(); det++) {
220 std::vector<DetId>::iterator itdet =
find(usedXtals.begin(),usedXtals.end(),
detid);
221 if(itdet != usedXtals.end())
continue;
224 if( hit == hits->
end())
continue;
228 usedXtals.push_back(detid);
229 clus_used.push_back(std::pair<DetId, float>(detid, 1.) );
230 clus_energy += hit->energy();
234 if( clus_energy <= 0 )
continue;
238 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;
251 clusters_p->assign(clusters.begin(), clusters.end());
253 if(
debug_>=1)
LogDebug(
"")<<
"nxnclusterProducer: "<<clusters_p->size() <<
" made in barrel"<<std::endl;
257 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
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) 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_