88 const std::string ClusterType__Mustache(
"Mustache");
91 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
92 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
98 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
100 isOOTCollection_ = iConfig.
getParameter<
bool>(
"isOOTCollection");
101 superClusterAlgo_.setIsOOTCollection(isOOTCollection_);
104 if (_typename == ClusterType__BOX) {
106 }
else if (_typename == ClusterType__Mustache) {
109 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid clustering type,"
110 <<
" please choose from \"Box\" or \"Mustache\"!";
112 superClusterAlgo_.setClusteringType(_theclusteringtype);
113 superClusterAlgo_.setUseDynamicDPhi(iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow"));
115 superClusterAlgo_.setTokens(iConfig, consumesCollector());
118 if (_weightname == EnergyWeight__Raw) {
120 }
else if (_weightname == EnergyWeight__CalibratedNoPS) {
122 }
else if (_weightname == EnergyWeight__CalibratedTotal) {
125 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid energy weighting scheme,"
126 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
127 <<
" \"CalibratedTotal\"!";
133 double threshPFClusterSeedBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedBarrel");
134 double threshPFClusterBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterBarrel");
136 double threshPFClusterSeedEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedEndcap");
137 double threshPFClusterEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterEndcap");
139 double phiwidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterBarrel");
140 double etawidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"etawidth_SuperClusterBarrel");
142 double phiwidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterEndcap");
143 double etawidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"etawidth_SuperClusterEndcap");
150 superClusterAlgo_.setVerbosityLevel(verbose_);
151 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
152 superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
154 superClusterAlgo_.setThreshSuperClusterEt(iConfig.
getParameter<
double>(
"thresh_SCEt"));
156 superClusterAlgo_.setThreshPFClusterSeedBarrel(threshPFClusterSeedBarrel);
157 superClusterAlgo_.setThreshPFClusterBarrel(threshPFClusterBarrel);
159 superClusterAlgo_.setThreshPFClusterSeedEndcap(threshPFClusterSeedEndcap);
160 superClusterAlgo_.setThreshPFClusterEndcap(threshPFClusterEndcap);
162 superClusterAlgo_.setPhiwidthSuperClusterBarrel(phiwidthSuperClusterBarrel);
163 superClusterAlgo_.setEtawidthSuperClusterBarrel(etawidthSuperClusterBarrel);
165 superClusterAlgo_.setPhiwidthSuperClusterEndcap(phiwidthSuperClusterEndcap);
166 superClusterAlgo_.setEtawidthSuperClusterEndcap(etawidthSuperClusterEndcap);
168 superClusterAlgo_.setSatelliteMerging(doSatelliteClusterMerge);
169 superClusterAlgo_.setSatelliteThreshold(satelliteClusterSeedThreshold);
170 superClusterAlgo_.setMajorityFraction(satelliteMajorityFraction);
171 superClusterAlgo_.setDropUnseedable(dropUnseedable);
174 thePFEnergyCalibration_ = std::make_shared<PFEnergyCalibration>();
175 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
177 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
178 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
180 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
181 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
183 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
184 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
186 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
187 PFSuperClusterCollectionEndcapWithPreshower_ =
188 iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
190 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
191 PFClusterAssociationES_ =
"PFClusterAssociationES";
193 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
194 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
195 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
196 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
197 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
198 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationEBEE_);
199 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationES_);
205 superClusterAlgo_.update(iE);
210 superClusterAlgo_.updateSCParams(iSetup);
212 superClusterAlgo_.loadAndSortPFClusters(iEvent);
213 superClusterAlgo_.run();
216 auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
217 auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
218 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
220 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
221 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
222 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
225 for (
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
227 if (!pfClusterMapEB.count(*pfclus)) {
229 caloClustersEB->push_back(caloclus);
230 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
233 <<
"Found an EB pfcluster matched to more than one EB supercluster!" <<
std::dec << std::endl;
237 for (
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
239 if (!pfClusterMapEE.count(*pfclus)) {
241 caloClustersEE->push_back(caloclus);
242 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
245 <<
"Found an EE pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
250 if (!pfClusterMapES.count(*pfclus)) {
252 caloClustersES->push_back(caloclus);
253 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
256 <<
"Found an ES pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
262 auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
263 auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
266 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
267 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
268 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
272 iEvent.
put(
std::move(caloClustersEB), PFBasicClusterCollectionBarrel_);
274 iEvent.
put(
std::move(caloClustersEE), PFBasicClusterCollectionEndcap_);
276 iEvent.
put(
std::move(caloClustersES), PFBasicClusterCollectionPreshower_);
279 for (
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
281 ebsc.setSeed(seedptr);
285 int caloclusidx = pfClusterMapEB[*pfclus];
288 clusptrsEB[caloclusidx] = *pfclus;
290 ebsc.setClusters(clusters);
292 for (
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
294 eesc.setSeed(seedptr);
298 int caloclusidx = pfClusterMapEE[*pfclus];
301 clusptrsEE[caloclusidx] = *pfclus;
303 eesc.setClusters(clusters);
308 int caloclusidx = pfClusterMapES[*pfclus];
311 clusptrsES[caloclusidx] = *pfclus;
313 eesc.setPreshowerClusters(psclusters);
318 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
319 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
323 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
327 iEvent.
put(
std::move(pfClusterAssociationEBEE), PFClusterAssociationEBEE_);
328 iEvent.
put(
std::move(pfClusterAssociationES), PFClusterAssociationES_);
329 iEvent.
put(
std::move(superClusterAlgo_.getEBOutputSCCollection()), PFSuperClusterCollectionBarrel_);
330 iEvent.
put(
std::move(superClusterAlgo_.getEEOutputSCCollection()), PFSuperClusterCollectionEndcapWithPreshower_);
335 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
336 desc.
add<
bool>(
"doSatelliteClusterMerge",
false);
337 desc.
add<
double>(
"thresh_PFClusterBarrel", 0.0);
338 desc.
add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
339 desc.
add<
bool>(
"useRegression",
true);
340 desc.
add<
double>(
"satelliteMajorityFraction", 0.5);
341 desc.
add<
double>(
"thresh_PFClusterEndcap", 0.0);
343 desc.
add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
344 desc.
add<
bool>(
"use_preshower",
true);
346 desc.
add<
double>(
"thresh_SCEt", 4.0);
347 desc.
add<
double>(
"etawidth_SuperClusterEndcap", 0.04);
348 desc.
add<
double>(
"phiwidth_SuperClusterEndcap", 0.6);
349 desc.
add<
bool>(
"useDynamicDPhiWindow",
true);
350 desc.
add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
352 desc.
add<
bool>(
"applyCrackCorrections",
false);
353 desc.
add<
double>(
"satelliteClusterSeedThreshold", 50.0);
354 desc.
add<
double>(
"etawidth_SuperClusterBarrel", 0.04);
355 desc.
add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
357 desc.
add<
double>(
"thresh_PFClusterSeedBarrel", 1.0);
361 desc.
add<
double>(
"thresh_PFClusterSeedEndcap", 1.0);
362 desc.
add<
double>(
"phiwidth_SuperClusterBarrel", 0.6);
363 desc.
add<
double>(
"thresh_PFClusterES", 0.0);
364 desc.
add<
bool>(
"seedThresholdIsET",
true);
365 desc.
add<
bool>(
"isOOTCollection",
false);
368 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcapWithPreshower",
369 "particleFlowSuperClusterECALEndcapWithPreshower");
370 desc.
add<
bool>(
"dropUnseedable",
false);
371 descriptions.
add(
"particleFlowSuperClusterECALMustache", desc);
T getUntrackedParameter(std::string const &, T const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
PFECALSuperClusterAlgo::clustering_type _theclusteringtype
#define DEFINE_FWK_MODULE(type)
void push_back(Ptr< T > const &iPtr)
void insert(const H &h, I begin, I end)
std::string PFBasicClusterCollectionEndcap_
std::string PFClusterAssociationEBEE_
std::shared_ptr< PFEnergyCalibration > thePFEnergyCalibration_
tuple satelliteMajorityFraction
tuple doSatelliteClusterMerge
PFECALSuperClusterProducer(const edm::ParameterSet &)
PFECALSuperClusterAlgo superClusterAlgo_
clustering algorithm
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::string PFSuperClusterCollectionBarrel_
std::string PFBasicClusterCollectionPreshower_
PFECALSuperClusterAlgo::energy_weight _theenergyweight
~PFECALSuperClusterProducer() override
static edm::ParameterSetDescription makePSetDescription()
void produce(edm::Event &, const edm::EventSetup &) override
T getParameter(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
\ Algorithm for box particle flow super clustering in the ECAL
void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
tuple satelliteClusterSeedThreshold
std::string PFClusterAssociationES_
std::string PFSuperClusterCollectionEndcapWithPreshower_
std::string PFSuperClusterCollectionEndcap_
std::string PFBasicClusterCollectionBarrel_