CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pat::PATPhotonSlimmer Class Reference

slimmer of PAT Taus More...

Inheritance diagram for pat::PATPhotonSlimmer:
edm::stream::EDProducer<>

Public Member Functions

 PATPhotonSlimmer (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

const StringCutObjectSelector< pat::PhotondropBasicClusters_
 
const StringCutObjectSelector< pat::PhotondropPreshowerClusters_
 
const StringCutObjectSelector< pat::PhotondropRecHits_
 
const StringCutObjectSelector< pat::PhotondropRegressionData_
 
const StringCutObjectSelector< pat::PhotondropSaturation_
 
const StringCutObjectSelector< pat::PhotondropSeedCluster_
 
const StringCutObjectSelector< pat::PhotondropSuperClusters_
 
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
 
const bool linkToPackedPF_
 
const bool modifyPhoton_
 
const edm::EDGetTokenT< pat::PackedCandidateCollectionpc_
 
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
 
std::unique_ptr< pat::ObjectModifier< pat::Photon > > photonModifier_
 
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedBarrelRecHitCollectionToken_
 
const edm::EDGetTokenT< EcalRecHitCollectionreducedEndcapRecHitCollectionToken_
 
const StringCutObjectSelector< pat::PhotonsaveNonZSClusterShapes_
 
const edm::EDGetTokenT< edm::View< pat::Photon > > src_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

slimmer of PAT Taus

Definition at line 28 of file PATPhotonSlimmer.cc.

Constructor & Destructor Documentation

◆ PATPhotonSlimmer()

pat::PATPhotonSlimmer::PATPhotonSlimmer ( const edm::ParameterSet iConfig)
explicit

Definition at line 54 of file PATPhotonSlimmer.cc.

55  : src_(consumes<edm::View<pat::Photon>>(iConfig.getParameter<edm::InputTag>("src"))),
56  dropSuperClusters_(iConfig.getParameter<std::string>("dropSuperCluster")),
57  dropBasicClusters_(iConfig.getParameter<std::string>("dropBasicClusters")),
58  dropPreshowerClusters_(iConfig.getParameter<std::string>("dropPreshowerClusters")),
59  dropSeedCluster_(iConfig.getParameter<std::string>("dropSeedCluster")),
60  dropRecHits_(iConfig.getParameter<std::string>("dropRecHits")),
61  dropSaturation_(iConfig.getParameter<std::string>("dropSaturation")),
62  dropRegressionData_(iConfig.getParameter<std::string>("dropRegressionData")),
63  reco2pf_(mayConsume<edm::ValueMap<std::vector<reco::PFCandidateRef>>>(
64  iConfig.getParameter<edm::InputTag>("recoToPFMap"))),
66  iConfig.getParameter<edm::InputTag>("packedPFCandidates"))),
67  pc_(mayConsume<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedPFCandidates"))),
68  linkToPackedPF_(iConfig.getParameter<bool>("linkToPackedPFCandidates")),
69  saveNonZSClusterShapes_(iConfig.getParameter<std::string>("saveNonZSClusterShapes")),
71  consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("reducedBarrelRecHitCollection"))),
73  consumes<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>("reducedEndcapRecHitCollection"))),
74  modifyPhoton_(iConfig.getParameter<bool>("modifyPhotons")),
75  ecalClusterToolsESGetTokens_{consumesCollector()} {
76  if (modifyPhoton_) {
77  const edm::ParameterSet& mod_config = iConfig.getParameter<edm::ParameterSet>("modifierConfig");
78  photonModifier_ = std::make_unique<pat::ObjectModifier<pat::Photon>>(mod_config, consumesCollector());
79  }
80 
81  mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEB"));
82  mayConsume<EcalRecHitCollection>(edm::InputTag("reducedEcalRecHitsEE"));
83 
84  produces<std::vector<pat::Photon>>();
85 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
const StringCutObjectSelector< pat::Photon > dropSuperClusters_
const StringCutObjectSelector< pat::Photon > saveNonZSClusterShapes_
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
const edm::EDGetTokenT< edm::View< pat::Photon > > src_
const StringCutObjectSelector< pat::Photon > dropRegressionData_
const StringCutObjectSelector< pat::Photon > dropSeedCluster_
const StringCutObjectSelector< pat::Photon > dropRecHits_
std::unique_ptr< pat::ObjectModifier< pat::Photon > > photonModifier_
const StringCutObjectSelector< pat::Photon > dropSaturation_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
const StringCutObjectSelector< pat::Photon > dropBasicClusters_
const StringCutObjectSelector< pat::Photon > dropPreshowerClusters_
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_

Member Function Documentation

◆ produce()

void pat::PATPhotonSlimmer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 87 of file PATPhotonSlimmer.cc.

References edm::HandleBase::id(), iEvent, edm::isNotFinite(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, submitPVResolutionJobs::key, relativeConstraints::keys, eostools::move(), MillePedeFileConverter_cfg::out, packedPFCandidateRefMixer_cfi::pf, displacedMuons_cfi::photon, electrons_cff::r9, run3scouting_cff::sigmaIetaIeta, mathSSE::sqrt(), and TrackRefitter_38T_cff::src.

87  {
88  using namespace edm;
89  using namespace std;
90 
92  iEvent.getByToken(src_, src);
93 
97  if (linkToPackedPF_) {
98  iEvent.getByToken(reco2pf_, reco2pf);
99  iEvent.getByToken(pf2pc_, pf2pc);
100  iEvent.getByToken(pc_, pc);
101  }
102  noZS::EcalClusterLazyTools lazyToolsNoZS(iEvent,
106 
107  auto out = std::make_unique<std::vector<pat::Photon>>();
108  out->reserve(src->size());
109 
110  if (modifyPhoton_) {
111  photonModifier_->setEvent(iEvent);
112  }
113  if (modifyPhoton_)
114  photonModifier_->setEventContent(iSetup);
115 
116  std::vector<unsigned int> keys;
117  for (View<pat::Photon>::const_iterator it = src->begin(), ed = src->end(); it != ed; ++it) {
118  out->push_back(*it);
119  pat::Photon& photon = out->back();
120 
121  if (modifyPhoton_) {
122  photonModifier_->modify(photon);
123  }
124 
125  if (dropSuperClusters_(photon)) {
126  photon.superCluster_.clear();
127  photon.embeddedSuperCluster_ = false;
128  }
129  if (dropBasicClusters_(photon)) {
130  photon.basicClusters_.clear();
131  }
133  photon.preshowerClusters_.clear();
134  }
135  if (dropSeedCluster_(photon)) {
136  photon.seedCluster_.clear();
137  photon.embeddedSeedCluster_ = false;
138  }
139  if (dropRecHits_(photon)) {
140  photon.recHits_ = EcalRecHitCollection();
141  photon.embeddedRecHits_ = false;
142  }
143  if (dropSaturation_(photon)) {
144  photon.setSaturationInfo(reco::Photon::SaturationInfo());
145  }
147  photon.setEMax(0);
148  photon.setE2nd(0);
149  photon.setE3x3(0);
150  photon.setETop(0);
151  photon.setEBottom(0);
152  photon.setELeft(0);
153  photon.setERight(0);
154  photon.setSee(0);
155  photon.setSep(0);
156  photon.setSpp(0);
157  photon.setMaxDR(0);
158  photon.setMaxDRDPhi(0);
159  photon.setMaxDRDEta(0);
160  photon.setMaxDRRawEnergy(0);
161  photon.setSubClusRawE1(0);
162  photon.setSubClusRawE2(0);
163  photon.setSubClusRawE3(0);
164  photon.setSubClusDPhi1(0);
165  photon.setSubClusDPhi2(0);
166  photon.setSubClusDPhi3(0);
167  photon.setSubClusDEta1(0);
168  photon.setSubClusDEta2(0);
169  photon.setSubClusDEta3(0);
170  photon.setCryPhi(0);
171  photon.setCryEta(0);
172  photon.setIEta(0);
173  photon.setIPhi(0);
174  }
175 
176  if (linkToPackedPF_) {
177  //std::cout << " PAT photon in " << src.id() << " comes from " << photon.refToOrig_.id() << ", " << photon.refToOrig_.key() << std::endl;
178  keys.clear();
179  for (auto const& pf : (*reco2pf)[photon.refToOrig_]) {
180  if (pf2pc->contains(pf.id())) {
181  keys.push_back((*pf2pc)[pf].key());
182  }
183  }
184  photon.setAssociatedPackedPFCandidates(
186  //std::cout << "Photon with pt " << photon.pt() << " associated to " << photon.associatedPackedFCandidateIndices_.size() << " PF Candidates\n";
187  //if there's just one PF Cand then it's me, otherwise I have no univoque parent so my ref will be null
188  if (keys.size() == 1) {
189  photon.refToOrig_ = photon.sourceCandidatePtr(0);
190  } else {
191  photon.refToOrig_ = reco::CandidatePtr(pc.id());
192  }
193  }
195  const auto& vCov = lazyToolsNoZS.localCovariances(*(photon.superCluster()->seed()));
196  float r9 = lazyToolsNoZS.e3x3(*(photon.superCluster()->seed())) / photon.superCluster()->rawEnergy();
197  float sigmaIetaIeta = (!edm::isNotFinite(vCov[0])) ? sqrt(vCov[0]) : 0;
198  float sigmaIetaIphi = vCov[1];
199  float sigmaIphiIphi = (!edm::isNotFinite(vCov[2])) ? sqrt(vCov[2]) : 0;
200  float e15o55 =
201  lazyToolsNoZS.e1x5(*(photon.superCluster()->seed())) / lazyToolsNoZS.e5x5(*(photon.superCluster()->seed()));
202  photon.addUserFloat("sigmaIetaIeta_NoZS", sigmaIetaIeta);
203  photon.addUserFloat("sigmaIetaIphi_NoZS", sigmaIetaIphi);
204  photon.addUserFloat("sigmaIphiIphi_NoZS", sigmaIphiIphi);
205  photon.addUserFloat("r9_NoZS", r9);
206  photon.addUserFloat("e1x5_over_e5x5_NoZS", e15o55);
207  }
208  }
209 
210  iEvent.put(std::move(out));
211 }
Analysis-level Photon class.
Definition: Photon.h:46
ProductID id() const
Definition: HandleBase.cc:29
const edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
const StringCutObjectSelector< pat::Photon > dropSuperClusters_
const StringCutObjectSelector< pat::Photon > saveNonZSClusterShapes_
ESData get(edm::EventSetup const &eventSetup) const
int iEvent
Definition: GenABIO.cc:224
const EcalClusterLazyTools::ESGetTokens ecalClusterToolsESGetTokens_
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > pf2pc_
const edm::EDGetTokenT< edm::ValueMap< std::vector< reco::PFCandidateRef > > > reco2pf_
T sqrt(T t)
Definition: SSEVec.h:19
key
prepare the HTCondor submission files and eventually submit them
const edm::EDGetTokenT< edm::View< pat::Photon > > src_
const StringCutObjectSelector< pat::Photon > dropRegressionData_
edm::Ptr< Candidate > CandidatePtr
persistent reference to an object in a collection of Candidate objects
Definition: CandidateFwd.h:25
HLT enums.
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:88
const StringCutObjectSelector< pat::Photon > dropSeedCluster_
const StringCutObjectSelector< pat::Photon > dropRecHits_
std::unique_ptr< pat::ObjectModifier< pat::Photon > > photonModifier_
const StringCutObjectSelector< pat::Photon > dropSaturation_
const edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
def move(src, dest)
Definition: eostools.py:511
const StringCutObjectSelector< pat::Photon > dropBasicClusters_
const StringCutObjectSelector< pat::Photon > dropPreshowerClusters_
edm::SortedCollection< EcalRecHit > EcalRecHitCollection
const edm::EDGetTokenT< pat::PackedCandidateCollection > pc_

Member Data Documentation

◆ dropBasicClusters_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropBasicClusters_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropPreshowerClusters_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropPreshowerClusters_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropRecHits_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropRecHits_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropRegressionData_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropRegressionData_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropSaturation_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropSaturation_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropSeedCluster_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropSeedCluster_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ dropSuperClusters_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::dropSuperClusters_
private

Definition at line 37 of file PATPhotonSlimmer.cc.

◆ ecalClusterToolsESGetTokens_

const EcalClusterLazyTools::ESGetTokens pat::PATPhotonSlimmer::ecalClusterToolsESGetTokens_
private

Definition at line 49 of file PATPhotonSlimmer.cc.

◆ linkToPackedPF_

const bool pat::PATPhotonSlimmer::linkToPackedPF_
private

Definition at line 43 of file PATPhotonSlimmer.cc.

◆ modifyPhoton_

const bool pat::PATPhotonSlimmer::modifyPhoton_
private

Definition at line 47 of file PATPhotonSlimmer.cc.

◆ pc_

const edm::EDGetTokenT<pat::PackedCandidateCollection> pat::PATPhotonSlimmer::pc_
private

Definition at line 42 of file PATPhotonSlimmer.cc.

◆ pf2pc_

const edm::EDGetTokenT<edm::Association<pat::PackedCandidateCollection> > pat::PATPhotonSlimmer::pf2pc_
private

Definition at line 41 of file PATPhotonSlimmer.cc.

◆ photonModifier_

std::unique_ptr<pat::ObjectModifier<pat::Photon> > pat::PATPhotonSlimmer::photonModifier_
private

Definition at line 48 of file PATPhotonSlimmer.cc.

◆ reco2pf_

const edm::EDGetTokenT<edm::ValueMap<std::vector<reco::PFCandidateRef> > > pat::PATPhotonSlimmer::reco2pf_
private

Definition at line 40 of file PATPhotonSlimmer.cc.

◆ reducedBarrelRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATPhotonSlimmer::reducedBarrelRecHitCollectionToken_
private

Definition at line 45 of file PATPhotonSlimmer.cc.

◆ reducedEndcapRecHitCollectionToken_

const edm::EDGetTokenT<EcalRecHitCollection> pat::PATPhotonSlimmer::reducedEndcapRecHitCollectionToken_
private

Definition at line 45 of file PATPhotonSlimmer.cc.

◆ saveNonZSClusterShapes_

const StringCutObjectSelector<pat::Photon> pat::PATPhotonSlimmer::saveNonZSClusterShapes_
private

Definition at line 44 of file PATPhotonSlimmer.cc.

◆ src_

const edm::EDGetTokenT<edm::View<pat::Photon> > pat::PATPhotonSlimmer::src_
private

Definition at line 35 of file PATPhotonSlimmer.cc.