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 superClusterAlgo_.setTokens(iConfig,consumesCollector());
57 if( _typename == ClusterType__BOX ) {
59 }
else if ( _typename == ClusterType__Mustache ) {
63 <<
"You have not chosen a valid clustering type,"
64 <<
" please choose from \"Box\" or \"Mustache\"!";
68 if( _weightname == EnergyWeight__Raw ) {
70 }
else if ( _weightname == EnergyWeight__CalibratedNoPS ) {
72 }
else if ( _weightname == EnergyWeight__CalibratedTotal) {
76 <<
"You have not chosen a valid energy weighting scheme,"
77 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
78 <<
" \"CalibratedTotal\"!";
85 bool useDynamicDPhi = iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow");
87 double threshPFClusterSeedBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedBarrel");
88 double threshPFClusterBarrel = iConfig.
getParameter<
double>(
"thresh_PFClusterBarrel");
90 double threshPFClusterSeedEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterSeedEndcap");
91 double threshPFClusterEndcap = iConfig.
getParameter<
double>(
"thresh_PFClusterEndcap");
93 double phiwidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterBarrel");
94 double etawidthSuperClusterBarrel = iConfig.
getParameter<
double>(
"etawidth_SuperClusterBarrel");
96 double phiwidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"phiwidth_SuperClusterEndcap");
97 double etawidthSuperClusterEndcap = iConfig.
getParameter<
double>(
"etawidth_SuperClusterEndcap");
99 double threshPFClusterES = iConfig.
getParameter<
double>(
"thresh_PFClusterES");
107 iConfig.
getParameter<
double>(
"satelliteClusterSeedThreshold");
109 iConfig.
getParameter<
double>(
"satelliteMajorityFraction");
111 superClusterAlgo_.setVerbosityLevel(verbose_);
112 superClusterAlgo_.setClusteringType(_theclusteringtype);
113 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
114 superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
115 superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
117 superClusterAlgo_.setThreshSuperClusterEt( iConfig.
getParameter<
double>(
"thresh_SCEt") );
119 superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
120 superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
122 superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
123 superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
125 superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
126 superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
128 superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
129 superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
131 superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
133 superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
134 superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
135 superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
140 thePFEnergyCalibration_ =
142 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
143 superClusterAlgo_.setUsePS(iConfig.
getParameter<
bool>(
"use_preshower"));
145 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
146 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
148 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
149 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
151 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
152 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
154 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
155 PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
157 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
158 PFClusterAssociationES_ =
"PFClusterAssociationES";
160 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
161 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
162 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
163 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
164 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
165 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationEBEE_);
166 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationES_);
175 superClusterAlgo_.update(iE);
183 superClusterAlgo_.loadAndSortPFClusters(iEvent);
184 superClusterAlgo_.run();
191 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
192 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
193 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
196 for(
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
198 if (!pfClusterMapEB.count(*pfclus)) {
200 caloClustersEB->push_back(caloclus);
201 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
205 <<
"Found an EB pfcluster matched to more than one EB supercluster!"
210 for(
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
212 if (!pfClusterMapEE.count(*pfclus)) {
214 caloClustersEE->push_back(caloclus);
215 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
219 <<
"Found an EE pfcluster matched to more than one EE supercluster!"
224 if (!pfClusterMapES.count(*pfclus)) {
226 caloClustersES->push_back(caloclus);
227 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
231 <<
"Found an ES pfcluster matched to more than one EE supercluster!"
242 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
243 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
244 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
252 for(
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
254 ebsc.setSeed(seedptr);
258 int caloclusidx = pfClusterMapEB[*pfclus];
261 clusptrsEB[caloclusidx] = *pfclus;
263 ebsc.setClusters(clusters);
265 for(
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
267 eesc.setSeed(seedptr);
271 int caloclusidx = pfClusterMapEE[*pfclus];
274 clusptrsEE[caloclusidx] = *pfclus;
276 eesc.setClusters(clusters);
280 int caloclusidx = pfClusterMapES[*pfclus];
283 clusptrsES[caloclusidx] = *pfclus;
285 eesc.setPreshowerClusters(psclusters);
290 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
291 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
295 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
299 iEvent.
put(pfClusterAssociationEBEE,PFClusterAssociationEBEE_);
300 iEvent.
put(pfClusterAssociationES,PFClusterAssociationES_);
301 iEvent.
put(superClusterAlgo_.getEBOutputSCCollection(),
302 PFSuperClusterCollectionBarrel_);
303 iEvent.
put(superClusterAlgo_.getEEOutputSCCollection(),
304 PFSuperClusterCollectionEndcapWithPreshower_);
309 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcap",
"particleFlowSuperClusterECALEndcap");
310 desc.
add<
bool>(
"doSatelliteClusterMerge",
false);
311 desc.
add<
double>(
"thresh_PFClusterBarrel",0.0);
312 desc.
add<
std::string>(
"PFBasicClusterCollectionBarrel",
"particleFlowBasicClusterECALBarrel");
313 desc.
add<
bool>(
"useRegression",
true);
314 desc.
add<
double>(
"satelliteMajorityFraction",0.5);
315 desc.
add<
double>(
"thresh_PFClusterEndcap",0.0);
317 desc.
add<
std::string>(
"PFBasicClusterCollectionPreshower",
"particleFlowBasicClusterECALPreshower");
318 desc.
add<
bool>(
"use_preshower",
true);
320 desc.
add<
double>(
"thresh_SCEt",4.0);
321 desc.
add<
double>(
"etawidth_SuperClusterEndcap",0.04);
322 desc.
add<
double>(
"phiwidth_SuperClusterEndcap",0.6);
323 desc.
add<
bool>(
"useDynamicDPhiWindow",
true);
324 desc.
add<
std::string>(
"PFSuperClusterCollectionBarrel",
"particleFlowSuperClusterECALBarrel");
327 psd0.
add<
bool>(
"isHLT",
false);
330 psd0.
add<
std::string>(
"regressionKeyEB",
"pfscecal_EBCorrection_offline_v1");
331 psd0.
add<
std::string>(
"regressionKeyEE",
"pfscecal_EECorrection_offline_v1");
332 psd0.
add<
std::string>(
"uncertaintyKeyEB",
"pfscecal_EBUncertainty_offline_v1");
333 psd0.
add<
std::string>(
"uncertaintyKeyEE",
"pfscecal_EEUncertainty_offline_v1");
335 psd0.
add<
double>(
"etRecHitThreshold", 1.);
338 desc.
add<
bool>(
"applyCrackCorrections",
false);
339 desc.
add<
double>(
"satelliteClusterSeedThreshold",50.0);
340 desc.
add<
double>(
"etawidth_SuperClusterBarrel",0.04);
341 desc.
add<
std::string>(
"PFBasicClusterCollectionEndcap",
"particleFlowBasicClusterECALEndcap");
343 desc.
add<
double>(
"thresh_PFClusterSeedBarrel",1.0);
347 desc.
add<
double>(
"thresh_PFClusterSeedEndcap",1.0);
348 desc.
add<
double>(
"phiwidth_SuperClusterBarrel",0.6);
349 desc.
add<
double>(
"thresh_PFClusterES",0.0);
350 desc.
add<
bool>(
"seedThresholdIsET",
true);
351 desc.
add<
std::string>(
"PFSuperClusterCollectionEndcapWithPreshower",
"particleFlowSuperClusterECALEndcapWithPreshower");
352 descriptions.
add(
"particleFlowSuperClusterECALMustache",desc);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void push_back(Ptr< T > const &iPtr)
void insert(const H &h, I begin, I end)
tuple satelliteMajorityFraction
tuple doSatelliteClusterMerge
PFECALSuperClusterProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
ParameterDescriptionBase * add(U const &iLabel, T const &value)
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()
tuple satelliteClusterSeedThreshold