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_);
54 superClusterAlgo_.setTokens(iConfig, consumesCollector());
57 if (_typename == ClusterType__BOX) {
59 }
else if (_typename == ClusterType__Mustache) {
62 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid clustering type,"
63 <<
" please choose from \"Box\" or \"Mustache\"!";
67 if (_weightname == EnergyWeight__Raw) {
69 }
else if (_weightname == EnergyWeight__CalibratedNoPS) {
71 }
else if (_weightname == EnergyWeight__CalibratedTotal) {
74 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid energy weighting scheme,"
75 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
76 <<
" \"CalibratedTotal\"!";
82 bool useDynamicDPhi = iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow");
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_.setClusteringType(_theclusteringtype);
106 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
108 superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
110 superClusterAlgo_.setThreshSuperClusterEt(iConfig.
getParameter<
double>(
"thresh_SCEt"));
112 superClusterAlgo_.setThreshPFClusterSeedBarrel(threshPFClusterSeedBarrel);
113 superClusterAlgo_.setThreshPFClusterBarrel(threshPFClusterBarrel);
115 superClusterAlgo_.setThreshPFClusterSeedEndcap(threshPFClusterSeedEndcap);
116 superClusterAlgo_.setThreshPFClusterEndcap(threshPFClusterEndcap);
118 superClusterAlgo_.setPhiwidthSuperClusterBarrel(phiwidthSuperClusterBarrel);
119 superClusterAlgo_.setEtawidthSuperClusterBarrel(etawidthSuperClusterBarrel);
121 superClusterAlgo_.setPhiwidthSuperClusterEndcap(phiwidthSuperClusterEndcap);
122 superClusterAlgo_.setEtawidthSuperClusterEndcap(etawidthSuperClusterEndcap);
132 thePFEnergyCalibration_ = std::make_shared<PFEnergyCalibration>();
133 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
135 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
136 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
138 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
139 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
141 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
142 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
144 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
145 PFSuperClusterCollectionEndcapWithPreshower_ =
146 iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
148 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
149 PFClusterAssociationES_ =
"PFClusterAssociationES";
151 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
152 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
153 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
154 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
155 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
156 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationEBEE_);
157 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationES_);
163 superClusterAlgo_.update(iE);
168 superClusterAlgo_.updateSCParams(iSetup);
170 superClusterAlgo_.loadAndSortPFClusters(
iEvent);
171 superClusterAlgo_.run();
174 auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
175 auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
176 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
178 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
179 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
180 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
183 for (
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
185 if (!pfClusterMapEB.count(*pfclus)) {
187 caloClustersEB->push_back(caloclus);
188 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
191 <<
"Found an EB pfcluster matched to more than one EB supercluster!" <<
std::dec << std::endl;
195 for (
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
197 if (!pfClusterMapEE.count(*pfclus)) {
199 caloClustersEE->push_back(caloclus);
200 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
203 <<
"Found an EE pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
208 if (!pfClusterMapES.count(*pfclus)) {
210 caloClustersES->push_back(caloclus);
211 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
214 <<
"Found an ES pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
220 auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
221 auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
224 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
225 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
226 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
230 iEvent.put(
std::move(caloClustersEB), PFBasicClusterCollectionBarrel_);
232 iEvent.put(
std::move(caloClustersEE), PFBasicClusterCollectionEndcap_);
234 iEvent.put(
std::move(caloClustersES), PFBasicClusterCollectionPreshower_);
237 for (
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
239 ebsc.setSeed(seedptr);
243 int caloclusidx = pfClusterMapEB[*pfclus];
246 clusptrsEB[caloclusidx] = *pfclus;
250 for (
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
252 eesc.setSeed(seedptr);
256 int caloclusidx = pfClusterMapEE[*pfclus];
259 clusptrsEE[caloclusidx] = *pfclus;
266 int caloclusidx = pfClusterMapES[*pfclus];
269 clusptrsES[caloclusidx] = *pfclus;
271 eesc.setPreshowerClusters(psclusters);
276 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
277 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
281 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
285 iEvent.put(
std::move(pfClusterAssociationEBEE), PFClusterAssociationEBEE_);
286 iEvent.put(
std::move(pfClusterAssociationES), PFClusterAssociationES_);
287 iEvent.put(
std::move(superClusterAlgo_.getEBOutputSCCollection()), PFSuperClusterCollectionBarrel_);
288 iEvent.put(
std::move(superClusterAlgo_.getEEOutputSCCollection()), PFSuperClusterCollectionEndcapWithPreshower_);
293 desc.add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
294 desc.add<
bool>(
"doSatelliteClusterMerge",
false);
295 desc.add<
double>(
"thresh_PFClusterBarrel", 0.0);
296 desc.add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
297 desc.add<
bool>(
"useRegression",
true);
298 desc.add<
double>(
"satelliteMajorityFraction", 0.5);
299 desc.add<
double>(
"thresh_PFClusterEndcap", 0.0);
301 desc.add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
302 desc.add<
bool>(
"use_preshower",
true);
303 desc.addUntracked<
bool>(
"verbose",
false);
304 desc.add<
double>(
"thresh_SCEt", 4.0);
305 desc.add<
double>(
"etawidth_SuperClusterEndcap", 0.04);
306 desc.add<
double>(
"phiwidth_SuperClusterEndcap", 0.6);
307 desc.add<
bool>(
"useDynamicDPhiWindow",
true);
308 desc.add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
311 psd0.
add<
bool>(
"isHLT",
false);
312 psd0.
add<
bool>(
"applySigmaIetaIphiBug",
false);
315 psd0.
add<
std::string>(
"regressionKeyEB",
"pfscecal_EBCorrection_offline_v2");
316 psd0.
add<
std::string>(
"regressionKeyEE",
"pfscecal_EECorrection_offline_v2");
317 psd0.
add<
std::string>(
"uncertaintyKeyEB",
"pfscecal_EBUncertainty_offline_v2");
318 psd0.
add<
std::string>(
"uncertaintyKeyEE",
"pfscecal_EEUncertainty_offline_v2");
320 psd0.
add<
double>(
"eRecHitThreshold", 1.);
323 desc.add<
bool>(
"applyCrackCorrections",
false);
324 desc.add<
double>(
"satelliteClusterSeedThreshold", 50.0);
325 desc.add<
double>(
"etawidth_SuperClusterBarrel", 0.04);
326 desc.add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
328 desc.add<
double>(
"thresh_PFClusterSeedBarrel", 1.0);
332 desc.add<
double>(
"thresh_PFClusterSeedEndcap", 1.0);
333 desc.add<
double>(
"phiwidth_SuperClusterBarrel", 0.6);
334 desc.add<
double>(
"thresh_PFClusterES", 0.0);
335 desc.add<
bool>(
"seedThresholdIsET",
true);
336 desc.add<
bool>(
"isOOTCollection",
false);
340 "particleFlowSuperClusterECALEndcapWithPreshower");
341 desc.add<
bool>(
"dropUnseedable",
false);
342 descriptions.
add(
"particleFlowSuperClusterECALMustache",
desc);