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 
137 
138  };
139 
140 }
141 
142 
143 
144 template<typename T>
146  const char* psetName,
148  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens) {
149 
150  labels.clear();
151 
152  if (iConfig.exists( psetName )) {
153  edm::ParameterSet depconf
154  = iConfig.getParameter<edm::ParameterSet>(psetName);
155 
156  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
157  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
158  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
159  if (depconf.exists("pfAllParticles")) {
160  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
161  }
162  if (depconf.exists("pfChargedHadrons")) {
163  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
164  }
165  if (depconf.exists("pfChargedAll")) {
166  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
167  }
168  if (depconf.exists("pfPUChargedHadrons")) {
169  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
170  }
171  if (depconf.exists("pfNeutralHadrons")) {
172  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
173  }
174  if (depconf.exists("pfPhotons")) {
175  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
176  }
177  if (depconf.exists("user")) {
178  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
179  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
181  for ( ; it != ed; ++it, ++key) {
182  labels.push_back(std::make_pair(pat::IsolationKeys(key), *it));
183  }
184  }
185 
186  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
187 
188  }
189  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
190 }
191 
192 
193 #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_
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_