39 const std::string ClusterType__Mustache(
"Mustache");
42 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
43 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
49 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
51 isOOTCollection_ = iConfig.
getParameter<
bool>(
"isOOTCollection");
52 superClusterAlgo_.setIsOOTCollection(isOOTCollection_);
55 if (_typename == ClusterType__BOX) {
57 }
else if (_typename == ClusterType__Mustache) {
60 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid clustering type,"
61 <<
" please choose from \"Box\" or \"Mustache\"!";
63 superClusterAlgo_.setClusteringType(_theclusteringtype);
64 superClusterAlgo_.setUseDynamicDPhi(iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow"));
66 superClusterAlgo_.setTokens(iConfig, consumesCollector());
69 if (_weightname == EnergyWeight__Raw) {
71 }
else if (_weightname == EnergyWeight__CalibratedNoPS) {
73 }
else if (_weightname == EnergyWeight__CalibratedTotal) {
76 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid energy weighting scheme,"
77 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
78 <<
" \"CalibratedTotal\"!";
84 double threshPFClusterSeedBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedBarrel");
85 double threshPFClusterBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterBarrel");
87 double threshPFClusterSeedEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedEndcap");
88 double threshPFClusterEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterEndcap");
90 double phiwidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterBarrel");
91 double etawidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"etawidth_SuperClusterBarrel");
93 double phiwidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterEndcap");
94 double etawidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"etawidth_SuperClusterEndcap");
104 superClusterAlgo_.setVerbosityLevel(verbose_);
105 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
108 superClusterAlgo_.setThreshSuperClusterEt(iConfig.
getParameter<
double>(
"thresh_SCEt"));
110 superClusterAlgo_.setThreshPFClusterSeedBarrel(threshPFClusterSeedBarrel);
111 superClusterAlgo_.setThreshPFClusterBarrel(threshPFClusterBarrel);
113 superClusterAlgo_.setThreshPFClusterSeedEndcap(threshPFClusterSeedEndcap);
114 superClusterAlgo_.setThreshPFClusterEndcap(threshPFClusterEndcap);
116 superClusterAlgo_.setPhiwidthSuperClusterBarrel(phiwidthSuperClusterBarrel);
117 superClusterAlgo_.setEtawidthSuperClusterBarrel(etawidthSuperClusterBarrel);
119 superClusterAlgo_.setPhiwidthSuperClusterEndcap(phiwidthSuperClusterEndcap);
120 superClusterAlgo_.setEtawidthSuperClusterEndcap(etawidthSuperClusterEndcap);
130 thePFEnergyCalibration_ = std::make_shared<PFEnergyCalibration>();
131 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
133 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
134 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
136 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
137 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
139 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
140 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
142 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
143 PFSuperClusterCollectionEndcapWithPreshower_ =
144 iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
146 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
147 PFClusterAssociationES_ =
"PFClusterAssociationES";
149 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
150 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
151 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
152 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
153 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
154 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationEBEE_);
155 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationES_);
161 superClusterAlgo_.update(iE);
166 superClusterAlgo_.updateSCParams(iSetup);
168 superClusterAlgo_.loadAndSortPFClusters(
iEvent);
169 superClusterAlgo_.run();
172 auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
173 auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
174 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
176 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
177 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
178 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
181 for (
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
183 if (!pfClusterMapEB.count(*pfclus)) {
185 caloClustersEB->push_back(caloclus);
186 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
189 <<
"Found an EB pfcluster matched to more than one EB supercluster!" <<
std::dec << std::endl;
193 for (
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
195 if (!pfClusterMapEE.count(*pfclus)) {
197 caloClustersEE->push_back(caloclus);
198 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
201 <<
"Found an EE pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
206 if (!pfClusterMapES.count(*pfclus)) {
208 caloClustersES->push_back(caloclus);
209 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
212 <<
"Found an ES pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
218 auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
219 auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
222 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
223 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
224 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
228 iEvent.put(
std::move(caloClustersEB), PFBasicClusterCollectionBarrel_);
230 iEvent.put(
std::move(caloClustersEE), PFBasicClusterCollectionEndcap_);
232 iEvent.put(
std::move(caloClustersES), PFBasicClusterCollectionPreshower_);
235 for (
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
237 ebsc.setSeed(seedptr);
241 int caloclusidx = pfClusterMapEB[*pfclus];
244 clusptrsEB[caloclusidx] = *pfclus;
248 for (
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
250 eesc.setSeed(seedptr);
254 int caloclusidx = pfClusterMapEE[*pfclus];
257 clusptrsEE[caloclusidx] = *pfclus;
264 int caloclusidx = pfClusterMapES[*pfclus];
267 clusptrsES[caloclusidx] = *pfclus;
269 eesc.setPreshowerClusters(psclusters);
274 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
275 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
279 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
283 iEvent.put(
std::move(pfClusterAssociationEBEE), PFClusterAssociationEBEE_);
284 iEvent.put(
std::move(pfClusterAssociationES), PFClusterAssociationES_);
285 iEvent.put(
std::move(superClusterAlgo_.getEBOutputSCCollection()), PFSuperClusterCollectionBarrel_);
286 iEvent.put(
std::move(superClusterAlgo_.getEEOutputSCCollection()), PFSuperClusterCollectionEndcapWithPreshower_);
291 desc.add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
292 desc.add<
bool>(
"doSatelliteClusterMerge",
false);
293 desc.add<
double>(
"thresh_PFClusterBarrel", 0.0);
294 desc.add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
295 desc.add<
bool>(
"useRegression",
true);
296 desc.add<
double>(
"satelliteMajorityFraction", 0.5);
297 desc.add<
double>(
"thresh_PFClusterEndcap", 0.0);
299 desc.add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
300 desc.add<
bool>(
"use_preshower",
true);
301 desc.addUntracked<
bool>(
"verbose",
false);
302 desc.add<
double>(
"thresh_SCEt", 4.0);
303 desc.add<
double>(
"etawidth_SuperClusterEndcap", 0.04);
304 desc.add<
double>(
"phiwidth_SuperClusterEndcap", 0.6);
305 desc.add<
bool>(
"useDynamicDPhiWindow",
true);
306 desc.add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
309 psd0.
add<
bool>(
"isHLT",
false);
310 psd0.
add<
bool>(
"applySigmaIetaIphiBug",
false);
313 psd0.
add<
std::string>(
"regressionKeyEB",
"pfscecal_EBCorrection_offline_v2");
314 psd0.
add<
std::string>(
"regressionKeyEE",
"pfscecal_EECorrection_offline_v2");
315 psd0.
add<
std::string>(
"uncertaintyKeyEB",
"pfscecal_EBUncertainty_offline_v2");
316 psd0.
add<
std::string>(
"uncertaintyKeyEE",
"pfscecal_EEUncertainty_offline_v2");
318 psd0.
add<
double>(
"eRecHitThreshold", 1.);
321 desc.add<
bool>(
"applyCrackCorrections",
false);
322 desc.add<
double>(
"satelliteClusterSeedThreshold", 50.0);
323 desc.add<
double>(
"etawidth_SuperClusterBarrel", 0.04);
324 desc.add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
326 desc.add<
double>(
"thresh_PFClusterSeedBarrel", 1.0);
330 desc.add<
double>(
"thresh_PFClusterSeedEndcap", 1.0);
331 desc.add<
double>(
"phiwidth_SuperClusterBarrel", 0.6);
332 desc.add<
double>(
"thresh_PFClusterES", 0.0);
333 desc.add<
bool>(
"seedThresholdIsET",
true);
334 desc.add<
bool>(
"isOOTCollection",
false);
338 "particleFlowSuperClusterECALEndcapWithPreshower");
339 desc.add<
bool>(
"dropUnseedable",
false);
340 descriptions.
add(
"particleFlowSuperClusterECALMustache",
desc);