CMS 3D CMS Logo

PATPhotonProducer.h
Go to the documentation of this file.
1 //
2 //
3 
4 #ifndef PhysicsTools_PatAlgos_PATPhotonProducer_h
5 #define PhysicsTools_PatAlgos_PATPhotonProducer_h
6 
21 
26 
28 
33 
37 
40 
43 
47 
48 namespace pat {
49 
51  public:
52  explicit PATPhotonProducer(const edm::ParameterSet& iConfig);
53  ~PATPhotonProducer() override;
54 
55  void produce(edm::Event& iEvent, const edm::EventSetup& iSetup) override;
56 
57  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
58 
59  private:
60  // configurables
65 
71 
76 
81 
84  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > genMatchTokens_;
85 
86  // tools
88 
89  typedef std::vector<edm::Handle<edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
90  typedef std::vector<edm::Handle<edm::ValueMap<double> > > IsolationValueMaps;
91  typedef std::pair<pat::IsolationKeys, edm::InputTag> IsolationLabel;
92  typedef std::vector<IsolationLabel> IsolationLabels;
93 
95  pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
96  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit> > > isoDepositTokens_;
97  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > isolationValueTokens_;
98 
101 
104  template <typename T>
105  void readIsolationLabels(const edm::ParameterSet& iConfig,
106  const char* psetName,
108  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > >& tokens);
109 
112 
115 
117  typedef std::pair<std::string, edm::InputTag> NameTag;
118  std::vector<NameTag> photIDSrcs_;
119  std::vector<edm::EDGetTokenT<edm::ValueMap<Bool_t> > > photIDTokens_;
120 
122  //PUPPI isolation tokens
127 
130 
132  };
133 
134 } // namespace pat
135 
136 template <typename T>
138  const char* psetName,
140  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > >& tokens) {
141  labels.clear();
142 
143  if (iConfig.exists(psetName)) {
144  edm::ParameterSet depconf = iConfig.getParameter<edm::ParameterSet>(psetName);
145 
146  if (depconf.exists("tracker"))
147  labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
148  if (depconf.exists("ecal"))
149  labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
150  if (depconf.exists("hcal"))
151  labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
152  if (depconf.exists("pfAllParticles")) {
153  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
154  }
155  if (depconf.exists("pfChargedHadrons")) {
156  labels.push_back(
157  std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
158  }
159  if (depconf.exists("pfChargedAll")) {
160  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
161  }
162  if (depconf.exists("pfPUChargedHadrons")) {
163  labels.push_back(
164  std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
165  }
166  if (depconf.exists("pfNeutralHadrons")) {
167  labels.push_back(
168  std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
169  }
170  if (depconf.exists("pfPhotons")) {
171  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
172  }
173  if (depconf.exists("user")) {
174  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
175  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
177  for (; it != ed; ++it, ++key) {
178  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
179  }
180  }
181 
182  tokens = edm::vector_transform(
183  labels, [this](IsolationLabel const& label) { return consumes<edm::ValueMap<T> >(label.second); });
184  }
185  tokens = edm::vector_transform(
186  labels, [this](IsolationLabel const& label) { return consumes<edm::ValueMap<T> >(label.second); });
187 }
188 
189 #endif
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
pat::PATPhotonProducer::electronToken_
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_
Definition: PATPhotonProducer.h:62
pat::PATPhotonProducer::isolator_
pat::helper::MultiIsolator isolator_
Definition: PATPhotonProducer.h:94
pat::PATPhotonProducer::saveRegressionData_
bool saveRegressionData_
Definition: PATPhotonProducer.h:131
pat::PATUserDataHelper< pat::Photon >
pat::EcalIso
Definition: Isolation.h:11
pat::PATPhotonProducer::useUserData_
bool useUserData_
Definition: PATPhotonProducer.h:121
pat::PATPhotonProducer::embedBasicClusters_
bool embedBasicClusters_
Definition: PATPhotonProducer.h:68
ESHandle.h
pat::PATPhotonProducer::reducedEndcapRecHitCollectionToken_
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
Definition: PATPhotonProducer.h:75
pat::helper::EfficiencyLoader
Definition: EfficiencyLoader.h:16
edm::EDGetTokenT
Definition: EDGetToken.h:33
pat::PATPhotonProducer::IsolationLabels
std::vector< IsolationLabel > IsolationLabels
Definition: PATPhotonProducer.h:92
Photon.h
pat::PATPhotonProducer::photonToken_
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
Definition: PATPhotonProducer.h:61
EDProducer.h
pat::PfAllParticleIso
Definition: Isolation.h:13
pat::PATPhotonProducer::embedPreshowerClusters_
bool embedPreshowerClusters_
Definition: PATPhotonProducer.h:69
pat::PATPhotonProducer::ecalPFClusterIsoT_
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
Definition: PATPhotonProducer.h:79
pat::helper::MultiIsolator::IsolationValuePairs
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:17
CaloTopology
Definition: CaloTopology.h:19
MultiIsolator.h
EfficiencyLoader.h
pat::PATPhotonProducer::isolationValueLabels_
IsolationLabels isolationValueLabels_
Definition: PATPhotonProducer.h:100
EcalRecHitCollections.h
pat::PATPhotonProducer::IsoDepositMaps
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
Definition: PATPhotonProducer.h:89
pat::PATPhotonProducer::userDataHelper_
pat::PATUserDataHelper< pat::Photon > userDataHelper_
Definition: PATPhotonProducer.h:126
pat::PATPhotonProducer::embedSeedCluster_
bool embedSeedCluster_
Definition: PATPhotonProducer.h:67
GreaterByEt
Definition: EtComparator.h:23
pat::PATPhotonProducer::efficiencyLoader_
pat::helper::EfficiencyLoader efficiencyLoader_
Definition: PATPhotonProducer.h:111
CaloGeometry
Definition: CaloGeometry.h:21
pat::PfChargedHadronIso
Definition: Isolation.h:14
pat::PATPhotonProducer::resolutionLoader_
pat::helper::KinResolutionsLoader resolutionLoader_
Definition: PATPhotonProducer.h:114
pat::PATPhotonProducer::isoDepositLabels_
IsolationLabels isoDepositLabels_
Definition: PATPhotonProducer.h:99
pat::PATPhotonProducer::addPFClusterIso_
bool addPFClusterIso_
Definition: PATPhotonProducer.h:77
pat::PATPhotonProducer::embedRecHits_
bool embedRecHits_
Definition: PATPhotonProducer.h:70
pat::helper::KinResolutionsLoader
Definition: KinResolutionsLoader.h:18
pat::PATPhotonProducer::~PATPhotonProducer
~PATPhotonProducer() override
Definition: PATPhotonProducer.cc:142
pat::PATPhotonProducer::isoDepositTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
Definition: PATPhotonProducer.h:96
KinResolutionsLoader.h
pat::PATPhotonProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: PATPhotonProducer.cc:476
CaloGeometryRecord.h
pat::PATPhotonProducer::IsolationLabel
std::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
Definition: PATPhotonProducer.h:91
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::vector_transform
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
Definition: transform.h:11
pat::PATPhotonProducer::isolatorTmpStorage_
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
Definition: PATPhotonProducer.h:95
edm::ParameterSet::exists
bool exists(std::string const &parameterName) const
checks if a parameter exists
Definition: ParameterSet.cc:674
EtComparator.h
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
pat::PfGammaIso
Definition: Isolation.h:16
pat::PATPhotonProducer::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Definition: PATPhotonProducer.cc:144
UserData.h
pat::PATPhotonProducer::beamLineToken_
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
Definition: PATPhotonProducer.h:64
pat::UserBaseIso
Definition: Isolation.h:22
CaloTopologyRecord.h
pat::TrackIso
Definition: Isolation.h:10
iEvent
int iEvent
Definition: GenABIO.cc:224
pat::PATPhotonProducer::addGenMatch_
bool addGenMatch_
Definition: PATPhotonProducer.h:82
pat::PATPhotonProducer::isolationValueTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
Definition: PATPhotonProducer.h:97
pat::PATPhotonProducer::PATPhotonProducer
PATPhotonProducer(const edm::ParameterSet &iConfig)
Definition: PATPhotonProducer.cc:32
pat::HcalIso
Definition: Isolation.h:12
pat::PATPhotonProducer::ecalTopology_
const CaloTopology * ecalTopology_
Definition: PATPhotonProducer.h:128
pat::PfNeutralHadronIso
Definition: Isolation.h:15
edm::stream::EDProducer
Definition: EDProducer.h:38
pat::PATPhotonProducer::IsolationValueMaps
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
Definition: PATPhotonProducer.h:90
pat::PfChargedAllIso
Definition: Isolation.h:25
edm::EventSetup
Definition: EventSetup.h:57
pat::PATPhotonProducer::eTComparator_
GreaterByEt< Photon > eTComparator_
Definition: PATPhotonProducer.h:87
pat::PATPhotonProducer::addEfficiencies_
bool addEfficiencies_
Definition: PATPhotonProducer.h:110
pat
Definition: HeavyIon.h:7
pat::PfPUChargedHadronIso
Definition: Isolation.h:24
pat::PATPhotonProducer
Produces the pat::Photon.
Definition: PATPhotonProducer.h:50
EcalRecHit.h
InputTag.h
CaloTopology.h
pat::PATPhotonProducer::photIDTokens_
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
Definition: PATPhotonProducer.h:119
pat::PATPhotonProducer::photIDSrcs_
std::vector< NameTag > photIDSrcs_
Definition: PATPhotonProducer.h:118
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
pat::PATPhotonProducer::genMatchTokens_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
Definition: PATPhotonProducer.h:84
CaloSubdetectorTopology.h
pat::helper::MultiIsolator
Definition: MultiIsolator.h:15
pat::PATPhotonProducer::embedSuperCluster_
bool embedSuperCluster_
Definition: PATPhotonProducer.h:66
pat::IsolationKeys
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
pat::PATPhotonProducer::ecalGeometry_
const CaloGeometry * ecalGeometry_
Definition: PATPhotonProducer.h:129
pat::PATPhotonProducer::hcalPFClusterIsoT_
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
Definition: PATPhotonProducer.h:80
pat::PATPhotonProducer::hConversionsToken_
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
Definition: PATPhotonProducer.h:63
pat::PATPhotonProducer::readIsolationLabels
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
Definition: PATPhotonProducer.h:137
edm::ValueMap
Definition: ValueMap.h:107
CaloGeometry.h
pat::PATPhotonProducer::PUPPIIsolation_photons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
Definition: PATPhotonProducer.h:125
pat::PATPhotonProducer::addPhotonID_
bool addPhotonID_
Definition: PATPhotonProducer.h:116
pat::PATPhotonProducer::addPuppiIsolation_
bool addPuppiIsolation_
Definition: PATPhotonProducer.h:78
pat::PATPhotonProducer::reducedBarrelRecHitCollectionToken_
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
Definition: PATPhotonProducer.h:73
PATUserDataHelper.h
EventSetup.h
Electron.h
pat::PATPhotonProducer::PUPPIIsolation_neutral_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
Definition: PATPhotonProducer.h:124
ConsumesCollector.h
ParameterSet.h
pat::PATPhotonProducer::PUPPIIsolation_charged_hadrons_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
Definition: PATPhotonProducer.h:123
pat::PATPhotonProducer::reducedBarrelRecHitCollection_
edm::InputTag reducedBarrelRecHitCollection_
Definition: PATPhotonProducer.h:72
pat::PATPhotonProducer::addResolutions_
bool addResolutions_
Definition: PATPhotonProducer.h:113
edm::Event
Definition: Event.h:73
crabWrapper.key
key
Definition: crabWrapper.py:19
pat::PATPhotonProducer::embedGenMatch_
bool embedGenMatch_
Definition: PATPhotonProducer.h:83
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
pat::PATPhotonProducer::NameTag
std::pair< std::string, edm::InputTag > NameTag
Definition: PATPhotonProducer.h:117
pat::PATPhotonProducer::reducedEndcapRecHitCollection_
edm::InputTag reducedEndcapRecHitCollection_
Definition: PATPhotonProducer.h:74