39 const std::string ClusterType__Mustache(
"Mustache");
42 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
43 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
52 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
54 isOOTCollection_ = iConfig.
getParameter<
bool>(
"isOOTCollection");
55 superClusterAlgo_.setIsOOTCollection(isOOTCollection_);
57 superClusterAlgo_.setTokens(iConfig,consumesCollector());
60 if( _typename == ClusterType__BOX ) {
62 }
else if ( _typename == ClusterType__Mustache ) {
66 <<
"You have not chosen a valid clustering type," 67 <<
" please choose from \"Box\" or \"Mustache\"!";
71 if( _weightname == EnergyWeight__Raw ) {
73 }
else if ( _weightname == EnergyWeight__CalibratedNoPS ) {
75 }
else if ( _weightname == EnergyWeight__CalibratedTotal) {
79 <<
"You have not chosen a valid energy weighting scheme," 80 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or" 81 <<
" \"CalibratedTotal\"!";
88 bool useDynamicDPhi = iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow");
90 double threshPFClusterSeedBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedBarrel");
91 double threshPFClusterBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterBarrel");
93 double threshPFClusterSeedEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedEndcap");
94 double threshPFClusterEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterEndcap");
96 double phiwidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterBarrel");
97 double etawidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"etawidth_SuperClusterBarrel");
99 double phiwidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterEndcap");
100 double etawidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"etawidth_SuperClusterEndcap");
102 double threshPFClusterES = iConfig.
getParameter<
double>(
"thresh_PFClusterES");
110 iConfig.
getParameter<
double>(
"satelliteClusterSeedThreshold");
112 iConfig.
getParameter<
double>(
"satelliteMajorityFraction");
114 superClusterAlgo_.setVerbosityLevel(verbose_);
115 superClusterAlgo_.setClusteringType(_theclusteringtype);
116 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
117 superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
118 superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
120 superClusterAlgo_.setThreshSuperClusterEt( iConfig.
getParameter<
double>(
"thresh_SCEt") );
122 superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
123 superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
125 superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
126 superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
128 superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
129 superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
131 superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
132 superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
134 superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
136 superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
137 superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
138 superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
143 thePFEnergyCalibration_ =
145 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
146 superClusterAlgo_.setUsePS(iConfig.
getParameter<
bool>(
"use_preshower"));
148 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
149 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
151 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
152 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
154 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
155 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
157 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
158 PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
160 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
161 PFClusterAssociationES_ =
"PFClusterAssociationES";
163 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
164 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
165 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
166 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
167 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
168 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationEBEE_);
169 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationES_);
178 superClusterAlgo_.update(iE);
186 superClusterAlgo_.loadAndSortPFClusters(iEvent);
187 superClusterAlgo_.run();
190 auto caloClustersEB = std::make_unique<reco::CaloClusterCollection>();
191 auto caloClustersEE = std::make_unique<reco::CaloClusterCollection>();
192 auto caloClustersES = std::make_unique<reco::CaloClusterCollection>();
194 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
195 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
196 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
199 for(
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
201 if (!pfClusterMapEB.count(*pfclus)) {
203 caloClustersEB->push_back(caloclus);
204 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
208 <<
"Found an EB pfcluster matched to more than one EB supercluster!" 213 for(
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
215 if (!pfClusterMapEE.count(*pfclus)) {
217 caloClustersEE->push_back(caloclus);
218 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
222 <<
"Found an EE pfcluster matched to more than one EE supercluster!" 227 if (!pfClusterMapES.count(*pfclus)) {
229 caloClustersES->push_back(caloclus);
230 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
234 <<
"Found an ES pfcluster matched to more than one EE supercluster!" 241 auto pfClusterAssociationEBEE = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
242 auto pfClusterAssociationES = std::make_unique<edm::ValueMap<reco::CaloClusterPtr>>();
245 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
246 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
247 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
255 for(
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
257 ebsc.setSeed(seedptr);
261 int caloclusidx = pfClusterMapEB[*pfclus];
264 clusptrsEB[caloclusidx] = *pfclus;
266 ebsc.setClusters(clusters);
268 for(
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
270 eesc.setSeed(seedptr);
274 int caloclusidx = pfClusterMapEE[*pfclus];
277 clusptrsEE[caloclusidx] = *pfclus;
279 eesc.setClusters(clusters);
283 int caloclusidx = pfClusterMapES[*pfclus];
286 clusptrsES[caloclusidx] = *pfclus;
288 eesc.setPreshowerClusters(psclusters);
293 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
294 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
298 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
302 iEvent.
put(
std::move(pfClusterAssociationEBEE),PFClusterAssociationEBEE_);
303 iEvent.
put(
std::move(pfClusterAssociationES),PFClusterAssociationES_);
304 iEvent.
put(
std::move(superClusterAlgo_.getEBOutputSCCollection()),
305 PFSuperClusterCollectionBarrel_);
306 iEvent.
put(
std::move(superClusterAlgo_.getEEOutputSCCollection()),
307 PFSuperClusterCollectionEndcapWithPreshower_);
312 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
313 desc.
add<
bool>(
"doSatelliteClusterMerge",
false);
314 desc.
add<
double>(
"thresh_PFClusterBarrel",0.0);
315 desc.
add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
316 desc.
add<
bool>(
"useRegression",
true);
317 desc.
add<
double>(
"satelliteMajorityFraction",0.5);
318 desc.
add<
double>(
"thresh_PFClusterEndcap",0.0);
320 desc.
add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
321 desc.
add<
bool>(
"use_preshower",
true);
323 desc.
add<
double>(
"thresh_SCEt",4.0);
324 desc.
add<
double>(
"etawidth_SuperClusterEndcap",0.04);
325 desc.
add<
double>(
"phiwidth_SuperClusterEndcap",0.6);
326 desc.
add<
bool>(
"useDynamicDPhiWindow",
true);
327 desc.
add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
330 psd0.
add<
bool>(
"isHLT",
false);
333 psd0.
add<
std::string>(
"regressionKeyEB",
"pfscecal_EBCorrection_offline_v1");
334 psd0.
add<
std::string>(
"regressionKeyEE",
"pfscecal_EECorrection_offline_v1");
335 psd0.
add<
std::string>(
"uncertaintyKeyEB",
"pfscecal_EBUncertainty_offline_v1");
336 psd0.
add<
std::string>(
"uncertaintyKeyEE",
"pfscecal_EEUncertainty_offline_v1");
338 psd0.
add<
double>(
"eRecHitThreshold", 1.);
341 desc.
add<
bool>(
"applyCrackCorrections",
false);
342 desc.
add<
double>(
"satelliteClusterSeedThreshold",50.0);
343 desc.
add<
double>(
"etawidth_SuperClusterBarrel",0.04);
344 desc.
add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
346 desc.
add<
double>(
"thresh_PFClusterSeedBarrel",1.0);
350 desc.
add<
double>(
"thresh_PFClusterSeedEndcap",1.0);
351 desc.
add<
double>(
"phiwidth_SuperClusterBarrel",0.6);
352 desc.
add<
double>(
"thresh_PFClusterES",0.0);
353 desc.
add<
bool>(
"seedThresholdIsET",
true);
354 desc.
add<
bool>(
"isOOTCollection",
false);
357 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcapWithPreshower",
"particleFlowSuperClusterECALEndcapWithPreshower");
358 descriptions.
add(
"particleFlowSuperClusterECALMustache",desc);
T getParameter(std::string const &) const
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)
void push_back(Ptr< T > const &iPtr)
satelliteClusterSeedThreshold
void insert(const H &h, I begin, I end)
PFECALSuperClusterProducer(const edm::ParameterSet &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
satelliteMajorityFraction
virtual void produce(edm::Event &, const edm::EventSetup &) override
void add(std::string const &label, ParameterSetDescription const &psetDescription)
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
~PFECALSuperClusterProducer()