143 const std::vector<std::string> flagnamesEB =
144 config.getParameter<std::vector<std::string>>(
"RecHitFlagToBeExcludedEB");
146 const std::vector<std::string> flagnamesEE =
147 config.getParameter<std::vector<std::string>>(
"RecHitFlagToBeExcludedEE");
149 flagsexclEB_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
151 flagsexclEE_ = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
153 const std::vector<std::string> severitynamesEB =
154 config.getParameter<std::vector<std::string>>(
"RecHitSeverityToBeExcludedEB");
156 severitiesexclEB_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEB);
158 const std::vector<std::string> severitynamesEE =
159 config.getParameter<std::vector<std::string>>(
"RecHitSeverityToBeExcludedEE");
161 severitiesexclEE_ = StringToEnumValue<EcalSeverityLevel::SeverityLevel>(severitynamesEE);
165 if (cfgCone.hOverEConeSize > 0) {
166 cfgCone.onlyBehindCluster =
false;
167 cfgCone.checkHcalStatus =
false;
172 cfgCone.maxSeverityHB =
config.getParameter<
int>(
"maxHcalRecHitSeverity");
174 cfgCone.maxSeverityHE = cfgCone.maxSeverityHB;
177 cfgBc.hOverEConeSize = 0.;
178 cfgBc.onlyBehindCluster =
true;
179 cfgBc.checkHcalStatus =
false;
184 cfgBc.maxSeverityHB =
config.getParameter<
int>(
"maxHcalRecHitSeverity");
186 cfgBc.maxSeverityHE = cfgBc.maxSeverityHB;
188 hcalHelperCone_ = std::make_unique<ElectronHcalHelper>(cfgCone, consumesCollector());
189 hcalHelperBc_ = std::make_unique<ElectronHcalHelper>(cfgBc, consumesCollector());
248 auto outputPhotonCollection_p = std::make_unique<reco::PhotonCollection>();
251 bool validPhotonCoreHandle =
true;
254 if (!photonCoreHandle.
isValid()) {
255 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the photonCoreProducer";
256 validPhotonCoreHandle =
false;
260 bool validEcalRecHits =
true;
264 if (!barrelHitHandle.
isValid()) {
265 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the barrelEcalHits";
266 validEcalRecHits =
false;
268 if (validEcalRecHits)
274 if (!endcapHitHandle.
isValid()) {
275 edm::LogError(
"PhotonProducer") <<
"Error! Can't get the endcapEcalHits";
276 validEcalRecHits =
false;
278 if (validEcalRecHits)
290 bool validVertex =
true;
294 edm::LogWarning(
"PhotonProducer") <<
"Error! Can't get the product primary Vertex Collection " 304 if (validPhotonCoreHandle)
318 edm::LogInfo(
"PhotonProducer") <<
" Put in the event " << iSC <<
" Photon Candidates \n";
323 for (
auto& pho : *outputPhotonCollection_p)
324 pho.hcalToRun2EffDepth();
346 std::vector<double> preselCutValues;
351 std::vector<int> flags_, severitiesexcl_;
353 for (
unsigned int lSC = 0; lSC < photonCoreHandle->size(); lSC++) {
358 int subdet = scRef->seed()->hitsAndFractions()[0].first.subdetId();
364 hits = ecalBarrelHits;
370 hits = ecalEndcapHits;
374 edm::LogWarning(
"") <<
"PhotonProducer: do not know if it is a barrel or endcap SuperCluster";
380 if (scRef->energy() / cosh(scRef->eta()) <= preselCutValues[0])
391 float e2x5 = EcalClusterTools::e2x5Max(*(scRef->seed()), &(*
hits), &(*topology));
392 float e3x3 = EcalClusterTools::e3x3(*(scRef->seed()), &(*
hits), &(*topology));
393 float e5x5 = EcalClusterTools::e5x5(*(scRef->seed()), &(*
hits), &(*topology));
394 const auto& cov = EcalClusterTools::covariances(*(scRef->seed()), &(*
hits), &(*topology),
geometry);
395 const auto& locCov = EcalClusterTools::localCovariances(*(scRef->seed()), &(*
hits), &(*topology));
398 float sigmaIetaIeta =
sqrt(locCov[0]);
399 float r9 = e3x3 / (scRef->rawEnergy());
411 float full5x5_sigmaEtaEta =
sqrt(full5x5_cov[0]);
417 caloPosition = unconvPos;
419 caloPosition = scRef->position();
439 newCandidate.setFiducialVolumeFlags(fiducialFlags);
440 newCandidate.setIsolationVariables(isolVarR04, isolVarR03);
446 showerShape.
e3x3 = e3x3;
447 showerShape.
e5x5 = e5x5;
457 newCandidate.setShowerShapeVariables(showerShape);
461 full5x5_showerShape.
e1x5 = full5x5_e1x5;
462 full5x5_showerShape.
e2x5 = full5x5_e2x5;
463 full5x5_showerShape.
e3x3 = full5x5_e3x3;
464 full5x5_showerShape.
e5x5 = full5x5_e5x5;
466 full5x5_showerShape.
sigmaEtaEta = full5x5_sigmaEtaEta;
474 newCandidate.full5x5_setShowerShapeVariables(full5x5_showerShape);
492 newCandidate.setMIPVariables(mipVar);
496 bool isLooseEM =
true;
497 if (newCandidate.pt() <
highEt_) {
498 if (newCandidate.hadronicOverEm() >= preselCutValues[1])
500 if (newCandidate.ecalRecHitSumEtConeDR04() > preselCutValues[2] + preselCutValues[3] * newCandidate.pt())
502 if (newCandidate.hcalTowerSumEtConeDR04() > preselCutValues[4] + preselCutValues[5] * newCandidate.pt())
504 if (newCandidate.nTrkSolidConeDR04() >
int(preselCutValues[6]))
506 if (newCandidate.nTrkHollowConeDR04() >
int(preselCutValues[7]))
508 if (newCandidate.trkSumPtSolidConeDR04() > preselCutValues[8])
510 if (newCandidate.trkSumPtHollowConeDR04() > preselCutValues[9])
512 if (newCandidate.sigmaIetaIeta() > preselCutValues[10])
edm::EDGetTokenT< reco::VertexCollection > vertexProducer_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< double > preselCutValuesEndcap_
std::vector< CaloTowerDetId > hcalTowersBehindClusters
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
isolationSumsCalculatorSet
void MIPcalculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::MIPVariables &mipId)
T const * product() const
std::unique_ptr< ElectronHcalHelper > hcalHelperCone_
edm::EDGetTokenT< HBHERecHitCollection > hbheRecHits_
std::vector< Vertex > VertexCollection
collection of Vertex objects
bool getByToken(EDGetToken token, Handle< PROD > &result) const
PositionCalc posCalculator_
const edm::ESGetToken< CaloTopology, CaloTopologyRecord > topologyToken_
std::array< float, 7 > hcalOverEcalBc
PhotonEnergyCorrector photonEnergyCorrector_
Log< level::Error, false > LogError
bool runMVABasedHaloTagger_
edm::EDGetTokenT< reco::PhotonCoreCollection > photonCoreProducer_
PhotonMIPHaloTagger photonMIPHaloTagger_
double hcalESum(const reco::SuperCluster &, int depth) const
edm::EDGetTokenT< EcalRecHitCollection > endcapEcalHits_
PhotonIsolationCalculator photonIsolationCalculator_
std::unique_ptr< ElectronHcalHelper > hcalHelperBc_
std::vector< int > flagsexclEB_
void setup(const edm::ParameterSet &conf, std::vector< int > const &flagsEB_, std::vector< int > const &flagsEE_, std::vector< int > const &severitiesEB_, std::vector< int > const &severitiesEE_, edm::ConsumesCollector &&iC)
std::vector< int > flagsexclEE_
std::string candidateP4type_
std::vector< int > severitiesexclEE_
math::XYZPoint Calculate_Location(const HitsAndFractions &iDetIds, const edm::SortedCollection< HitType > *iRecHits, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorGeometry *iESGeom=nullptr)
#define DEFINE_FWK_MODULE(type)
void init(const edm::EventSetup &theEventSetup)
void setup(const edm::ParameterSet &conf, edm::ConsumesCollector &&iC)
std::vector< int > severitiesexclEB_
void calculate(const reco::Photon *, const edm::Event &, const edm::EventSetup &es, reco::Photon::FiducialFlags &phofid, reco::Photon::IsolationVariables &phoisolR03, reco::Photon::IsolationVariables &phoisolR04) const
std::string PhotonCollection_
Log< level::Info, false > LogInfo
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
void calculate(edm::Event &evt, reco::Photon &, int subdet, const reco::VertexCollection &vtxcol, const edm::EventSetup &iSetup)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
std::array< float, 7 > hcalOverEcal
std::vector< Photon > PhotonCollection
collectin of Photon objects
std::vector< double > preselCutValuesBarrel_
auto hcalTowersBehindClusters(const reco::SuperCluster &sc) const
void fillPhotonCollection(edm::Event &evt, edm::EventSetup const &es, const edm::Handle< reco::PhotonCoreCollection > &photonCoreHandle, const CaloTopology *topology, const EcalRecHitCollection *ecalBarrelHits, const EcalRecHitCollection *ecalEndcapHits, ElectronHcalHelper const &hcalHelperCone, ElectronHcalHelper const &hcalHelperBc, reco::VertexCollection &pvVertices, reco::PhotonCollection &outputCollection, int &iSC)
PhotonProducer(const edm::ParameterSet &ps)
edm::EDGetTokenT< EcalRecHitCollection > barrelEcalHits_
std::unique_ptr< PhotonMVABasedHaloTagger > photonMVABasedHaloTagger_
Log< level::Warning, false > LogWarning
std::array< double, 4 > arrayHB
void produce(edm::Event &evt, const edm::EventSetup &es) override
std::array< double, 7 > arrayHE