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 
22 
27 
29 
34 
38 
41 
42 
45 
49 
50 namespace pat {
51 
53 
54  public:
55 
56  explicit PATPhotonProducer(const edm::ParameterSet & iConfig);
58 
59  virtual void produce(edm::Event & iEvent, const edm::EventSetup& iSetup) override;
60 
61  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
62 
63  private:
64 
65  // configurables
70 
76 
81 
86 
89  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > genMatchTokens_;
90 
91  // tools
93 
94  typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
95  typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
96  typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
97  typedef std::vector<IsolationLabel> IsolationLabels;
98 
100  pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
101  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit> > > isoDepositTokens_;
102  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > isolationValueTokens_;
103 
104  IsolationLabels isoDepositLabels_;
105  IsolationLabels isolationValueLabels_;
106 
109  template<typename T> void readIsolationLabels( const edm::ParameterSet & iConfig,
110  const char* psetName,
111  IsolationLabels& labels,
112  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens);
113 
116 
119 
121  typedef std::pair<std::string, edm::InputTag> NameTag;
122  std::vector<NameTag> photIDSrcs_;
123  std::vector<edm::EDGetTokenT<edm::ValueMap<Bool_t> > > photIDTokens_;
124 
126  //PUPPI isolation tokens
131 
134 
136 
137  };
138 
139 }
140 
141 
142 
143 template<typename T>
145  const char* psetName,
147  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens) {
148 
149  labels.clear();
150 
151  if (iConfig.exists( psetName )) {
152  edm::ParameterSet depconf
153  = iConfig.getParameter<edm::ParameterSet>(psetName);
154 
155  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
156  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
157  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
158  if (depconf.exists("pfAllParticles")) {
159  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
160  }
161  if (depconf.exists("pfChargedHadrons")) {
162  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
163  }
164  if (depconf.exists("pfChargedAll")) {
165  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
166  }
167  if (depconf.exists("pfPUChargedHadrons")) {
168  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
169  }
170  if (depconf.exists("pfNeutralHadrons")) {
171  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
172  }
173  if (depconf.exists("pfPhotons")) {
174  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
175  }
176  if (depconf.exists("user")) {
177  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
178  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
180  for ( ; it != ed; ++it, ++key) {
181  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
182  }
183  }
184 
185  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
186 
187  }
188  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
189 }
190 
191 
192 #endif
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
T getParameter(std::string const &) const
Assists in assimilating all pat::UserData into pat objects.
std::pair< pat::IsolationKeys, edm::InputTag > IsolationLabel
pat::PATUserDataHelper< pat::Photon > userDataHelper_
edm::EDGetTokenT< EcalRecHitCollection > reducedEndcapRecHitCollectionToken_
std::pair< std::string, edm::InputTag > NameTag
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
std::vector< edm::EDGetTokenT< edm::ValueMap< Bool_t > > > photIDTokens_
edm::EDGetTokenT< reco::BeamSpot > beamLineToken_
edm::EDGetTokenT< edm::View< reco::Photon > > photonToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::EDGetTokenT< edm::ValueMap< float > > ecalPFClusterIsoT_
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
pat::helper::KinResolutionsLoader resolutionLoader_
edm::EDGetTokenT< edm::ValueMap< float > > hcalPFClusterIsoT_
GreaterByEt< Photon > eTComparator_
IsolationKeys
Enum defining isolation keys.
Definition: Isolation.h:9
const CaloGeometry * ecalGeometry_
edm::InputTag reducedEndcapRecHitCollection_
std::vector< IsolationLabel > IsolationLabels
Definition: HeavyIon.h:7
IsolationLabels isoDepositLabels_
char const * label
pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_
int iEvent
Definition: GenABIO.cc:224
const CaloTopology * ecalTopology_
IsolationLabels isolationValueLabels_
std::vector< edm::EDGetTokenT< edm::ValueMap< IsoDeposit > > > isoDepositTokens_
pat::helper::EfficiencyLoader efficiencyLoader_
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_photons_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< NameTag > photIDSrcs_
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::helper::MultiIsolator isolator_
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
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
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_charged_hadrons_
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
edm::EDGetTokenT< edm::ValueMap< float > > PUPPIIsolation_neutral_hadrons_
PATPhotonProducer(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< EcalRecHitCollection > reducedBarrelRecHitCollectionToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > isolationValueTokens_
edm::InputTag reducedBarrelRecHitCollection_
edm::EDGetTokenT< reco::ConversionCollection > hConversionsToken_
Produces the pat::Photon.
edm::EDGetTokenT< reco::GsfElectronCollection > electronToken_