36 const std::string ClusterType__Mustache(
"Mustache");
39 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
40 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
49 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
51 superClusterAlgo_.setTokens(iConfig,consumesCollector());
54 if( _typename == ClusterType__BOX ) {
56 }
else if ( _typename == ClusterType__Mustache ) {
60 <<
"You have not chosen a valid clustering type,"
61 <<
" please choose from \"Box\" or \"Mustache\"!";
65 if( _weightname == EnergyWeight__Raw ) {
67 }
else if ( _weightname == EnergyWeight__CalibratedNoPS ) {
69 }
else if ( _weightname == EnergyWeight__CalibratedTotal) {
73 <<
"You have not chosen a valid energy weighting scheme,"
74 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
75 <<
" \"CalibratedTotal\"!";
80 bool seedThresholdIsET = iConfig.
getParameter<
bool>(
"seedThresholdIsET");
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");
96 double threshPFClusterES = iConfig.
getParameter<
double>(
"thresh_PFClusterES");
101 double doSatelliteClusterMerge =
103 double satelliteClusterSeedThreshold =
104 iConfig.
getParameter<
double>(
"satelliteClusterSeedThreshold");
105 double satelliteMajorityFraction =
106 iConfig.
getParameter<
double>(
"satelliteMajorityFraction");
108 superClusterAlgo_.setVerbosityLevel(verbose_);
109 superClusterAlgo_.setClusteringType(_theclusteringtype);
110 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
111 superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
112 superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
114 superClusterAlgo_.setThreshSuperClusterEt( iConfig.
getParameter<
double>(
"thresh_SCEt") );
116 superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
117 superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
119 superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
120 superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
122 superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
123 superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
125 superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
126 superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
128 superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
130 superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
131 superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
132 superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
137 thePFEnergyCalibration_ =
139 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
140 superClusterAlgo_.setUsePS(iConfig.
getParameter<
bool>(
"use_preshower"));
142 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
143 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
145 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
146 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
148 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
149 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
151 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
152 PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
154 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
155 PFClusterAssociationES_ =
"PFClusterAssociationES";
157 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
158 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
159 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
160 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
161 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
162 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationEBEE_);
163 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationES_);
172 superClusterAlgo_.update(iE);
180 superClusterAlgo_.loadAndSortPFClusters(iEvent);
181 superClusterAlgo_.run();
188 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
189 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
190 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
193 for(
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
195 if (!pfClusterMapEB.count(*pfclus)) {
197 caloClustersEB->push_back(caloclus);
198 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
202 <<
"Found an EB pfcluster matched to more than one EB supercluster!"
203 << std::dec << std::endl;
207 for(
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
209 if (!pfClusterMapEE.count(*pfclus)) {
211 caloClustersEE->push_back(caloclus);
212 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
216 <<
"Found an EE pfcluster matched to more than one EE supercluster!"
217 << std::dec << std::endl;
221 if (!pfClusterMapES.count(*pfclus)) {
223 caloClustersES->push_back(caloclus);
224 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
228 <<
"Found an ES pfcluster matched to more than one EE supercluster!"
229 << std::dec << std::endl;
239 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
240 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
241 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
249 for(
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
251 ebsc.setSeed(seedptr);
255 int caloclusidx = pfClusterMapEB[*pfclus];
258 clusptrsEB[caloclusidx] = *pfclus;
260 ebsc.setClusters(clusters);
262 for(
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
264 eesc.setSeed(seedptr);
268 int caloclusidx = pfClusterMapEE[*pfclus];
271 clusptrsEE[caloclusidx] = *pfclus;
273 eesc.setClusters(clusters);
277 int caloclusidx = pfClusterMapES[*pfclus];
280 clusptrsES[caloclusidx] = *pfclus;
282 eesc.setPreshowerClusters(psclusters);
287 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
288 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
292 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
296 iEvent.
put(pfClusterAssociationEBEE,PFClusterAssociationEBEE_);
297 iEvent.
put(pfClusterAssociationES,PFClusterAssociationES_);
298 iEvent.
put(superClusterAlgo_.getEBOutputSCCollection(),
299 PFSuperClusterCollectionBarrel_);
300 iEvent.
put(superClusterAlgo_.getEEOutputSCCollection(),
301 PFSuperClusterCollectionEndcapWithPreshower_);
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
virtual void produce(edm::Event &, const edm::EventSetup &)
void push_back(Ptr< T > const &iPtr)
void insert(const H &h, I begin, I end)
PFECALSuperClusterProducer(const edm::ParameterSet &)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
std::vector< CaloCluster > CaloClusterCollection
collection of CaloCluster objects
~PFECALSuperClusterProducer()
virtual void beginLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)