58 dropSuperClusters_(iConfig.getParameter<
std::
string>(
"dropSuperCluster")),
59 dropBasicClusters_(iConfig.getParameter<
std::
string>(
"dropBasicClusters")),
60 dropPreshowerClusters_(iConfig.getParameter<
std::
string>(
"dropPreshowerClusters")),
61 dropSeedCluster_(iConfig.getParameter<
std::
string>(
"dropSeedCluster")),
62 dropRecHits_(iConfig.getParameter<
std::
string>(
"dropRecHits")),
63 dropSaturation_(iConfig.getParameter<
std::
string>(
"dropSaturation")),
64 dropRegressionData_(iConfig.getParameter<
std::
string>(
"dropRegressionData")),
66 iConfig.getParameter<
edm::
InputTag>(
"recoToPFMap"))),
68 iConfig.getParameter<
edm::
InputTag>(
"packedPFCandidates"))),
70 linkToPackedPF_(iConfig.getParameter<
bool>(
"linkToPackedPFCandidates")),
71 saveNonZSClusterShapes_(iConfig.getParameter<
std::
string>(
"saveNonZSClusterShapes")),
72 reducedBarrelRecHitCollectionToken_(
74 reducedEndcapRecHitCollectionToken_(
76 modifyPhoton_(iConfig.getParameter<
bool>(
"modifyPhotons")),
77 ecalClusterToolsESGetTokens_{consumesCollector()} {
80 photonModifier_ = std::make_unique<pat::ObjectModifier<pat::Photon>>(mod_config, consumesCollector());
83 mayConsume<EcalRecHitCollection>(
edm::InputTag(
"reducedEcalRecHitsEB"));
84 mayConsume<EcalRecHitCollection>(
edm::InputTag(
"reducedEcalRecHitsEE"));
86 produces<std::vector<pat::Photon>>();
101 if (linkToPackedPF_) {
102 iEvent.getByToken(reco2pf_, reco2pf);
103 iEvent.getByToken(pf2pc_, pf2pc);
104 iEvent.getByToken(pc_, pc);
107 ecalClusterToolsESGetTokens_.get(iSetup),
108 reducedBarrelRecHitCollectionToken_,
109 reducedEndcapRecHitCollectionToken_);
111 auto out = std::make_unique<std::vector<pat::Photon>>();
112 out->reserve(
src->size());
115 photonModifier_->setEvent(
iEvent);
118 photonModifier_->setEventContent(iSetup);
120 std::vector<unsigned int>
keys;
126 photonModifier_->modify(
photon);
129 if (dropSuperClusters_(
photon)) {
130 photon.superCluster_.clear();
131 photon.embeddedSuperCluster_ =
false;
133 if (dropBasicClusters_(
photon)) {
134 photon.basicClusters_.clear();
136 if (dropPreshowerClusters_(
photon)) {
137 photon.preshowerClusters_.clear();
139 if (dropSeedCluster_(
photon)) {
140 photon.seedCluster_.clear();
141 photon.embeddedSeedCluster_ =
false;
143 if (dropRecHits_(
photon)) {
145 photon.embeddedRecHits_ =
false;
147 if (dropSaturation_(
photon)) {
150 if (dropRegressionData_(
photon)) {
164 photon.setMaxDRRawEnergy(0);
165 photon.setSubClusRawE1(0);
166 photon.setSubClusRawE2(0);
167 photon.setSubClusRawE3(0);
168 photon.setSubClusDPhi1(0);
169 photon.setSubClusDPhi2(0);
170 photon.setSubClusDPhi3(0);
171 photon.setSubClusDEta1(0);
172 photon.setSubClusDEta2(0);
173 photon.setSubClusDEta3(0);
180 if (linkToPackedPF_) {
183 for (
auto const&
pf : (*reco2pf)[
photon.refToOrig_]) {
184 if (pf2pc->contains(
pf.id())) {
188 photon.setAssociatedPackedPFCandidates(
192 if (
keys.size() == 1) {
198 if (saveNonZSClusterShapes_(
photon)) {
199 const auto& vCov = lazyToolsNoZS.localCovariances(*(
photon.superCluster()->seed()));
200 float r9 = lazyToolsNoZS.e3x3(*(
photon.superCluster()->seed())) /
photon.superCluster()->rawEnergy();
202 float sigmaIetaIphi = vCov[1];
205 lazyToolsNoZS.e1x5(*(
photon.superCluster()->seed())) / lazyToolsNoZS.e5x5(*(
photon.superCluster()->seed()));
206 photon.addUserFloat(
"sigmaIetaIeta_NoZS", sigmaIetaIeta);
207 photon.addUserFloat(
"sigmaIetaIphi_NoZS", sigmaIetaIphi);
208 photon.addUserFloat(
"sigmaIphiIphi_NoZS", sigmaIphiIphi);
210 photon.addUserFloat(
"e1x5_over_e5x5_NoZS", e15o55);