40 const std::string ClusterType__Mustache(
"Mustache");
43 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
44 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
50 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
52 isOOTCollection_ = iConfig.
getParameter<
bool>(
"isOOTCollection");
53 superClusterAlgo_.setIsOOTCollection(isOOTCollection_);
56 if (_typename == ClusterType__BOX) {
58 }
else if (_typename == ClusterType__Mustache) {
61 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid clustering type,"
62 <<
" please choose from \"Box\" or \"Mustache\"!";
64 superClusterAlgo_.setClusteringType(_theclusteringtype);
65 superClusterAlgo_.setUseDynamicDPhi(iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow"));
67 superClusterAlgo_.setTokens(iConfig, consumesCollector());
70 if (_weightname == EnergyWeight__Raw) {
72 }
else if (_weightname == EnergyWeight__CalibratedNoPS) {
74 }
else if (_weightname == EnergyWeight__CalibratedTotal) {
77 throw cms::Exception(
"InvalidClusteringType") <<
"You have not chosen a valid energy weighting scheme,"
78 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
79 <<
" \"CalibratedTotal\"!";
85 double threshPFClusterSeedBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedBarrel");
86 double threshPFClusterBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterBarrel");
88 double threshPFClusterSeedEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedEndcap");
89 double threshPFClusterEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterEndcap");
91 double phiwidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterBarrel");
92 double etawidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"etawidth_SuperClusterBarrel");
94 double phiwidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterEndcap");
95 double etawidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"etawidth_SuperClusterEndcap");
105 superClusterAlgo_.setVerbosityLevel(verbose_);
106 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
109 superClusterAlgo_.setThreshSuperClusterEt(iConfig.
getParameter<
double>(
"thresh_SCEt"));
111 superClusterAlgo_.setThreshPFClusterSeedBarrel(threshPFClusterSeedBarrel);
112 superClusterAlgo_.setThreshPFClusterBarrel(threshPFClusterBarrel);
114 superClusterAlgo_.setThreshPFClusterSeedEndcap(threshPFClusterSeedEndcap);
115 superClusterAlgo_.setThreshPFClusterEndcap(threshPFClusterEndcap);
117 superClusterAlgo_.setPhiwidthSuperClusterBarrel(phiwidthSuperClusterBarrel);
118 superClusterAlgo_.setEtawidthSuperClusterBarrel(etawidthSuperClusterBarrel);
120 superClusterAlgo_.setPhiwidthSuperClusterEndcap(phiwidthSuperClusterEndcap);
121 superClusterAlgo_.setEtawidthSuperClusterEndcap(etawidthSuperClusterEndcap);
131 thePFEnergyCalibration_ = std::make_shared<PFEnergyCalibration>();
132 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
134 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
135 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
137 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
138 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
140 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
141 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
143 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
144 PFSuperClusterCollectionEndcapWithPreshower_ =
145 iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
147 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
148 PFClusterAssociationES_ =
"PFClusterAssociationES";
150 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
151 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
152 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
153 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
154 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
155 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationEBEE_);
156 produces<edm::ValueMap<reco::CaloClusterPtr>>(PFClusterAssociationES_);
162 superClusterAlgo_.update(iE);
167 superClusterAlgo_.updateSCParams(iSetup);
169 superClusterAlgo_.loadAndSortPFClusters(
iEvent);
170 superClusterAlgo_.run();
173 auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
174 auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
175 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
177 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
178 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
179 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
182 for (
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
184 if (!pfClusterMapEB.count(*pfclus)) {
186 caloClustersEB->push_back(caloclus);
187 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
190 <<
"Found an EB pfcluster matched to more than one EB supercluster!" <<
std::dec << std::endl;
194 for (
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
196 if (!pfClusterMapEE.count(*pfclus)) {
198 caloClustersEE->push_back(caloclus);
199 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
202 <<
"Found an EE pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
207 if (!pfClusterMapES.count(*pfclus)) {
209 caloClustersES->push_back(caloclus);
210 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
213 <<
"Found an ES pfcluster matched to more than one EE supercluster!" <<
std::dec << std::endl;
219 auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
220 auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
223 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
224 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
225 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
229 iEvent.put(
std::move(caloClustersEB), PFBasicClusterCollectionBarrel_);
231 iEvent.put(
std::move(caloClustersEE), PFBasicClusterCollectionEndcap_);
233 iEvent.put(
std::move(caloClustersES), PFBasicClusterCollectionPreshower_);
236 for (
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection())) {
238 ebsc.setSeed(seedptr);
242 int caloclusidx = pfClusterMapEB[*pfclus];
245 clusptrsEB[caloclusidx] = *pfclus;
249 for (
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection())) {
251 eesc.setSeed(seedptr);
255 int caloclusidx = pfClusterMapEE[*pfclus];
258 clusptrsEE[caloclusidx] = *pfclus;
265 int caloclusidx = pfClusterMapES[*pfclus];
268 clusptrsES[caloclusidx] = *pfclus;
270 eesc.setPreshowerClusters(psclusters);
275 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
276 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
280 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
284 iEvent.put(
std::move(pfClusterAssociationEBEE), PFClusterAssociationEBEE_);
285 iEvent.put(
std::move(pfClusterAssociationES), PFClusterAssociationES_);
286 iEvent.put(
std::move(superClusterAlgo_.getEBOutputSCCollection()), PFSuperClusterCollectionBarrel_);
287 iEvent.put(
std::move(superClusterAlgo_.getEEOutputSCCollection()), PFSuperClusterCollectionEndcapWithPreshower_);
292 desc.add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
293 desc.add<
bool>(
"doSatelliteClusterMerge",
false);
294 desc.add<
double>(
"thresh_PFClusterBarrel", 0.0);
295 desc.add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
296 desc.add<
bool>(
"useRegression",
true);
297 desc.add<
double>(
"satelliteMajorityFraction", 0.5);
298 desc.add<
double>(
"thresh_PFClusterEndcap", 0.0);
300 desc.add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
301 desc.add<
bool>(
"use_preshower",
true);
302 desc.addUntracked<
bool>(
"verbose",
false);
303 desc.add<
double>(
"thresh_SCEt", 4.0);
304 desc.add<
double>(
"etawidth_SuperClusterEndcap", 0.04);
305 desc.add<
double>(
"phiwidth_SuperClusterEndcap", 0.6);
306 desc.add<
bool>(
"useDynamicDPhiWindow",
true);
307 desc.add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
309 desc.add<
bool>(
"applyCrackCorrections",
false);
310 desc.add<
double>(
"satelliteClusterSeedThreshold", 50.0);
311 desc.add<
double>(
"etawidth_SuperClusterBarrel", 0.04);
312 desc.add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
314 desc.add<
double>(
"thresh_PFClusterSeedBarrel", 1.0);
318 desc.add<
double>(
"thresh_PFClusterSeedEndcap", 1.0);
319 desc.add<
double>(
"phiwidth_SuperClusterBarrel", 0.6);
320 desc.add<
double>(
"thresh_PFClusterES", 0.0);
321 desc.add<
bool>(
"seedThresholdIsET",
true);
322 desc.add<
bool>(
"isOOTCollection",
false);
326 "particleFlowSuperClusterECALEndcapWithPreshower");
327 desc.add<
bool>(
"dropUnseedable",
false);
328 descriptions.
add(
"particleFlowSuperClusterECALMustache",
desc);