56 const std::vector<std::string> flagnamesEB =
57 config.getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEB");
59 const std::vector<std::string> flagnamesEE =
60 config.getParameter<std::vector<std::string> >(
"RecHitFlagToBeExcludedEE");
62 flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
64 flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
66 const std::vector<std::string> severitynamesEB =
67 config.getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEB");
69 severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
71 const std::vector<std::string> severitynamesEE =
72 config.getParameter<std::vector<std::string> >(
"RecHitSeverityToBeExcludedEE");
74 severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
131 auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
134 bool validPhotonCoreHandle =
true;
137 if (!photonCoreHandle.
isValid()) {
138 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the photonCoreProducer";
139 validPhotonCoreHandle =
false;
143 bool validEcalRecHits =
true;
147 if (!barrelHitHandle.
isValid()) {
148 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the barrelEcalHits";
149 validEcalRecHits =
false;
151 if (validEcalRecHits)
157 if (!endcapHitHandle.
isValid()) {
158 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the endcapEcalHits";
159 validEcalRecHits =
false;
161 if (validEcalRecHits)
180 bool validVertex =
true;
184 edm::LogWarning(
"PhotonProducer") <<
"Error! Can't get the product primary Vertex Collection "
194 if (validPhotonCoreHandle)
208 edm::LogInfo(
"PhotonProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
232 std::vector<double> preselCutValues;
237 std::vector<int> flags_, severitiesexcl_;
239 for (
unsigned int lSC = 0; lSC < photonCoreHandle->size(); lSC++) {
244 int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
250 hits = ecalBarrelHits;
256 hits = ecalEndcapHits;
260 edm::LogWarning(
"") <<
"PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
266 if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0])
272 double HoE1 = towerIso1.
getTowerESum(&(*scRef)) / scRef->energy();
273 double HoE2 = towerIso2.
getTowerESum(&(*scRef)) / scRef->energy();
276 auto towersBehindCluster = egammaHadTower.
towersOf(*scRef);
288 float e2x5 = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*
hits), &(*topology));
289 float e3x3 = EcalClusterTools::e3x3(*(scRef->seed()), &(*
hits), &(*topology));
290 float e5x5 = EcalClusterTools::e5x5(*(scRef->seed()), &(*
hits), &(*topology));
291 std::vector<float> cov = EcalClusterTools::covariances(*(scRef->seed()), &(*
hits), &(*topology),
geometry);
292 std::vector<float> locCov = EcalClusterTools::localCovariances(*(scRef->seed()), &(*
hits), &(*topology));
295 float sigmaIetaIeta =
sqrt(locCov[0]);
296 float r9 = e3x3 / (scRef->rawEnergy());
305 std::vector<float> full5x5_cov =
307 std::vector<float> full5x5_locCov =
310 float full5x5_sigmaEtaEta =
sqrt(full5x5_cov[0]);
316 caloPosition = unconvPos;
318 caloPosition = scRef->position();
338 newCandidate.setFiducialVolumeFlags(fiducialFlags);
339 newCandidate.setIsolationVariables(isolVarR04, isolVarR03);
345 showerShape.
e3x3 = e3x3;
346 showerShape.
e5x5 = e5x5;
355 newCandidate.setShowerShapeVariables(showerShape);
359 full5x5_showerShape.
e1x5 = full5x5_e1x5;
360 full5x5_showerShape.
e2x5 = full5x5_e2x5;
361 full5x5_showerShape.
e3x3 = full5x5_e3x3;
362 full5x5_showerShape.
e5x5 = full5x5_e5x5;
364 full5x5_showerShape.
sigmaEtaEta = full5x5_sigmaEtaEta;
366 newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape);
384 newCandidate.setMIPVariables(mipVar);
388 bool isLooseEM =
true;
389 if (newCandidate.pt() <
highEt_) {
390 if (newCandidate.hadronicOverEm() >= preselCutValues[1])
392 if (newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2] + preselCutValues[3] * newCandidate.pt())
394 if (newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4] + preselCutValues[5] * newCandidate.pt())
396 if (newCandidate.nTrkSolidConeDR04() >
int(preselCutValues[6]))
398 if (newCandidate.nTrkHollowConeDR04() >
int(preselCutValues[7]))
400 if (newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8])
402 if (newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9])
404 if (newCandidate.sigmaIetaIeta() > preselCutValues[10])