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 
50 
51 namespace pat {
52 
54 
55  public:
56 
57  explicit PATPhotonProducer(const edm::ParameterSet & iConfig);
59 
60  virtual void produce(edm::Event & iEvent, const edm::EventSetup& iSetup) override;
61 
62  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
63 
64  private:
65 
66  // configurables
71 
77 
82 
87 
90  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > genMatchTokens_;
91 
92  // tools
94 
95  typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
96  typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
97  typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
98  typedef std::vector<IsolationLabel> IsolationLabels;
99 
101  pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
102  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit> > > isoDepositTokens_;
103  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > isolationValueTokens_;
104 
105  IsolationLabels isoDepositLabels_;
106  IsolationLabels isolationValueLabels_;
107 
110  template<typename T> void readIsolationLabels( const edm::ParameterSet & iConfig,
111  const char* psetName,
112  IsolationLabels& labels,
113  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens);
114 
117 
120 
122  typedef std::pair<std::string, edm::InputTag> NameTag;
123  std::vector<NameTag> photIDSrcs_;
124  std::vector<edm::EDGetTokenT<edm::ValueMap<Bool_t> > > photIDTokens_;
125 
127  //PUPPI isolation tokens
132 
136 
138 
139  };
140 
141 }
142 
143 
144 
145 template<typename T>
147  const char* psetName,
149  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens) {
150 
151  labels.clear();
152 
153  if (iConfig.exists( psetName )) {
154  edm::ParameterSet depconf
155  = iConfig.getParameter<edm::ParameterSet>(psetName);
156 
157  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
158  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
159  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
160  if (depconf.exists("pfAllParticles")) {
161  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
162  }
163  if (depconf.exists("pfChargedHadrons")) {
164  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
165  }
166  if (depconf.exists("pfChargedAll")) {
167  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
168  }
169  if (depconf.exists("pfPUChargedHadrons")) {
170  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
171  }
172  if (depconf.exists("pfNeutralHadrons")) {
173  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
174  }
175  if (depconf.exists("pfPhotons")) {
176  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
177  }
178  if (depconf.exists("user")) {
179  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
180  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
182  for ( ; it != ed; ++it, ++key) {
183  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
184  }
185  }
186 
187  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
188 
189  }
190  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
191 }
192 
193 
194 #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_
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::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:230
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)
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_