CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
85  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > genMatchTokens_;
86 
87  // tools
88  GreaterByEt<Photon> eTComparator_;
89 
90  typedef std::vector< edm::Handle< edm::ValueMap<IsoDeposit> > > IsoDepositMaps;
91  typedef std::vector< edm::Handle< edm::ValueMap<double> > > IsolationValueMaps;
92  typedef std::pair<pat::IsolationKeys,edm::InputTag> IsolationLabel;
93  typedef std::vector<IsolationLabel> IsolationLabels;
94 
96  pat::helper::MultiIsolator::IsolationValuePairs isolatorTmpStorage_; // better here than recreate at each event
97  std::vector<edm::EDGetTokenT<edm::ValueMap<IsoDeposit> > > isoDepositTokens_;
98  std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > isolationValueTokens_;
99 
102 
105  template<typename T> 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 
123 
127 
128 
129  };
130 
131 }
132 
133 
134 using namespace pat;
135 
136 template<typename T>
138  const char* psetName,
140  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens) {
141 
142  labels.clear();
143 
144  if (iConfig.exists( psetName )) {
145  edm::ParameterSet depconf
146  = iConfig.getParameter<edm::ParameterSet>(psetName);
147 
148  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
149  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
150  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
151  if (depconf.exists("pfAllParticles")) {
152  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
153  }
154  if (depconf.exists("pfChargedHadrons")) {
155  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
156  }
157  if (depconf.exists("pfChargedAll")) {
158  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
159  }
160  if (depconf.exists("pfPUChargedHadrons")) {
161  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
162  }
163  if (depconf.exists("pfNeutralHadrons")) {
164  labels.push_back(std::make_pair(pat::PfNeutralHadronIso, depconf.getParameter<edm::InputTag>("pfNeutralHadrons")));
165  }
166  if (depconf.exists("pfPhotons")) {
167  labels.push_back(std::make_pair(pat::PfGammaIso, depconf.getParameter<edm::InputTag>("pfPhotons")));
168  }
169  if (depconf.exists("user")) {
170  std::vector<edm::InputTag> userdeps = depconf.getParameter<std::vector<edm::InputTag> >("user");
171  std::vector<edm::InputTag>::const_iterator it = userdeps.begin(), ed = userdeps.end();
172  int key = UserBaseIso;
173  for ( ; it != ed; ++it, ++key) {
174  labels.push_back(std::make_pair(IsolationKeys(key), *it));
175  }
176  }
177  }
178 
179  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
180 
181 }
182 
183 
184 #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
std::vector< edm::EDGetTokenT< edm::Association< reco::GenParticleCollection > > > genMatchTokens_
pat::helper::KinResolutionsLoader resolutionLoader_
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
void readIsolationLabels(const edm::ParameterSet &iConfig, const char *psetName, IsolationLabels &labels, std::vector< edm::EDGetTokenT< edm::ValueMap< T > > > &tokens)
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_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< NameTag > photIDSrcs_
std::vector< edm::Handle< edm::ValueMap< IsoDeposit > > > IsoDepositMaps
pat::helper::MultiIsolator isolator_
std::vector< std::pair< pat::IsolationKeys, float > > IsolationValuePairs
Definition: MultiIsolator.h:16
list key
Definition: combine.py:13
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_