37 const std::string ClusterType__Mustache(
"Mustache");
40 const std::string EnergyWeight__CalibratedNoPS(
"CalibratedNoPS");
41 const std::string EnergyWeight__CalibratedTotal(
"CalibratedTotal");
50 superClusterAlgo_.setUseRegression(iConfig.
getParameter<
bool>(
"useRegression"));
52 superClusterAlgo_.setTokens(iConfig,consumesCollector());
55 if( _typename == ClusterType__BOX ) {
57 }
else if ( _typename == ClusterType__Mustache ) {
61 <<
"You have not chosen a valid clustering type,"
62 <<
" please choose from \"Box\" or \"Mustache\"!";
66 if( _weightname == EnergyWeight__Raw ) {
68 }
else if ( _weightname == EnergyWeight__CalibratedNoPS ) {
70 }
else if ( _weightname == EnergyWeight__CalibratedTotal) {
74 <<
"You have not chosen a valid energy weighting scheme,"
75 <<
" please choose from \"Raw\", \"CalibratedNoPS\", or"
76 <<
" \"CalibratedTotal\"!";
81 bool seedThresholdIsET = iConfig.
getParameter<
bool>(
"seedThresholdIsET");
83 bool useDynamicDPhi = iConfig.
getParameter<
bool>(
"useDynamicDPhiWindow");
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");
97 double threshPFClusterES = iConfig.
getParameter<
double>(
"thresh_PFClusterES");
102 double doSatelliteClusterMerge =
104 double satelliteClusterSeedThreshold =
105 iConfig.
getParameter<
double>(
"satelliteClusterSeedThreshold");
106 double satelliteMajorityFraction =
107 iConfig.
getParameter<
double>(
"satelliteMajorityFraction");
109 superClusterAlgo_.setVerbosityLevel(verbose_);
110 superClusterAlgo_.setClusteringType(_theclusteringtype);
111 superClusterAlgo_.setEnergyWeighting(_theenergyweight);
112 superClusterAlgo_.setUseETForSeeding(seedThresholdIsET);
113 superClusterAlgo_.setUseDynamicDPhi(useDynamicDPhi);
115 superClusterAlgo_.setThreshSuperClusterEt( iConfig.
getParameter<
double>(
"thresh_SCEt") );
117 superClusterAlgo_.setThreshPFClusterSeedBarrel( threshPFClusterSeedBarrel );
118 superClusterAlgo_.setThreshPFClusterBarrel( threshPFClusterBarrel );
120 superClusterAlgo_.setThreshPFClusterSeedEndcap( threshPFClusterSeedEndcap );
121 superClusterAlgo_.setThreshPFClusterEndcap( threshPFClusterEndcap );
123 superClusterAlgo_.setPhiwidthSuperClusterBarrel( phiwidthSuperClusterBarrel );
124 superClusterAlgo_.setEtawidthSuperClusterBarrel( etawidthSuperClusterBarrel );
126 superClusterAlgo_.setPhiwidthSuperClusterEndcap( phiwidthSuperClusterEndcap );
127 superClusterAlgo_.setEtawidthSuperClusterEndcap( etawidthSuperClusterEndcap );
129 superClusterAlgo_.setThreshPFClusterES( threshPFClusterES );
131 superClusterAlgo_.setSatelliteMerging( doSatelliteClusterMerge );
132 superClusterAlgo_.setSatelliteThreshold( satelliteClusterSeedThreshold );
133 superClusterAlgo_.setMajorityFraction( satelliteMajorityFraction );
138 thePFEnergyCalibration_ =
140 superClusterAlgo_.setPFClusterCalibration(thePFEnergyCalibration_);
141 superClusterAlgo_.setUsePS(iConfig.
getParameter<
bool>(
"use_preshower"));
143 bool applyCrackCorrections_ = iConfig.
getParameter<
bool>(
"applyCrackCorrections");
144 superClusterAlgo_.setCrackCorrections(applyCrackCorrections_);
146 PFBasicClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionBarrel");
147 PFSuperClusterCollectionBarrel_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionBarrel");
149 PFBasicClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionEndcap");
150 PFSuperClusterCollectionEndcap_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcap");
152 PFBasicClusterCollectionPreshower_ = iConfig.
getParameter<
string>(
"PFBasicClusterCollectionPreshower");
153 PFSuperClusterCollectionEndcapWithPreshower_ = iConfig.
getParameter<
string>(
"PFSuperClusterCollectionEndcapWithPreshower");
155 PFClusterAssociationEBEE_ =
"PFClusterAssociationEBEE";
156 PFClusterAssociationES_ =
"PFClusterAssociationES";
158 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionBarrel_);
159 produces<reco::SuperClusterCollection>(PFSuperClusterCollectionEndcapWithPreshower_);
160 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionBarrel_);
161 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionEndcap_);
162 produces<reco::CaloClusterCollection>(PFBasicClusterCollectionPreshower_);
163 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationEBEE_);
164 produces<edm::ValueMap<reco::CaloClusterPtr> >(PFClusterAssociationES_);
173 superClusterAlgo_.update(iE);
181 superClusterAlgo_.loadAndSortPFClusters(iEvent);
182 superClusterAlgo_.run();
189 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEB;
190 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapEE;
191 std::map<reco::CaloClusterPtr, unsigned int> pfClusterMapES;
194 for(
const auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
196 if (!pfClusterMapEB.count(*pfclus)) {
198 caloClustersEB->push_back(caloclus);
199 pfClusterMapEB[*pfclus] = caloClustersEB->size() - 1;
203 <<
"Found an EB pfcluster matched to more than one EB supercluster!"
204 << std::dec << std::endl;
208 for(
const auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
210 if (!pfClusterMapEE.count(*pfclus)) {
212 caloClustersEE->push_back(caloclus);
213 pfClusterMapEE[*pfclus] = caloClustersEE->size() - 1;
217 <<
"Found an EE pfcluster matched to more than one EE supercluster!"
218 << std::dec << std::endl;
222 if (!pfClusterMapES.count(*pfclus)) {
224 caloClustersES->push_back(caloclus);
225 pfClusterMapES[*pfclus] = caloClustersES->size() - 1;
229 <<
"Found an ES pfcluster matched to more than one EE supercluster!"
230 << std::dec << std::endl;
240 std::vector<reco::CaloClusterPtr> clusptrsEB(caloClustersEB->size());
241 std::vector<reco::CaloClusterPtr> clusptrsEE(caloClustersEE->size());
242 std::vector<reco::CaloClusterPtr> clusptrsES(caloClustersES->size());
250 for(
auto& ebsc : *(superClusterAlgo_.getEBOutputSCCollection()) ) {
252 ebsc.setSeed(seedptr);
256 int caloclusidx = pfClusterMapEB[*pfclus];
259 clusptrsEB[caloclusidx] = *pfclus;
261 ebsc.setClusters(clusters);
263 for(
auto& eesc : *(superClusterAlgo_.getEEOutputSCCollection()) ) {
265 eesc.setSeed(seedptr);
269 int caloclusidx = pfClusterMapEE[*pfclus];
272 clusptrsEE[caloclusidx] = *pfclus;
274 eesc.setClusters(clusters);
278 int caloclusidx = pfClusterMapES[*pfclus];
281 clusptrsES[caloclusidx] = *pfclus;
283 eesc.setPreshowerClusters(psclusters);
288 fillerEBEE.
insert(caloClusHandleEB, clusptrsEB.begin(), clusptrsEB.end());
289 fillerEBEE.
insert(caloClusHandleEE, clusptrsEE.begin(), clusptrsEE.end());
293 fillerES.
insert(caloClusHandleES, clusptrsES.begin(), clusptrsES.end());
297 iEvent.
put(pfClusterAssociationEBEE,PFClusterAssociationEBEE_);
298 iEvent.
put(pfClusterAssociationES,PFClusterAssociationES_);
299 iEvent.
put(superClusterAlgo_.getEBOutputSCCollection(),
300 PFSuperClusterCollectionBarrel_);
301 iEvent.
put(superClusterAlgo_.getEEOutputSCCollection(),
302 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 &)