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 
86 
89  std::vector<edm::EDGetTokenT<edm::Association<reco::GenParticleCollection> > > genMatchTokens_;
90 
91  // tools
92  GreaterByEt<Photon> eTComparator_;
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 
106 
109  template<typename T> void readIsolationLabels( const edm::ParameterSet & iConfig,
110  const char* psetName,
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 
127 
131 
132 
133  };
134 
135 }
136 
137 
138 using namespace pat;
139 
140 template<typename T>
142  const char* psetName,
144  std::vector<edm::EDGetTokenT<edm::ValueMap<T> > > & tokens) {
145 
146  labels.clear();
147 
148  if (iConfig.exists( psetName )) {
149  edm::ParameterSet depconf
150  = iConfig.getParameter<edm::ParameterSet>(psetName);
151 
152  if (depconf.exists("tracker")) labels.push_back(std::make_pair(pat::TrackIso, depconf.getParameter<edm::InputTag>("tracker")));
153  if (depconf.exists("ecal")) labels.push_back(std::make_pair(pat::EcalIso, depconf.getParameter<edm::InputTag>("ecal")));
154  if (depconf.exists("hcal")) labels.push_back(std::make_pair(pat::HcalIso, depconf.getParameter<edm::InputTag>("hcal")));
155  if (depconf.exists("pfAllParticles")) {
156  labels.push_back(std::make_pair(pat::PfAllParticleIso, depconf.getParameter<edm::InputTag>("pfAllParticles")));
157  }
158  if (depconf.exists("pfChargedHadrons")) {
159  labels.push_back(std::make_pair(pat::PfChargedHadronIso, depconf.getParameter<edm::InputTag>("pfChargedHadrons")));
160  }
161  if (depconf.exists("pfChargedAll")) {
162  labels.push_back(std::make_pair(pat::PfChargedAllIso, depconf.getParameter<edm::InputTag>("pfChargedAll")));
163  }
164  if (depconf.exists("pfPUChargedHadrons")) {
165  labels.push_back(std::make_pair(pat::PfPUChargedHadronIso, depconf.getParameter<edm::InputTag>("pfPUChargedHadrons")));
166  }
167  if (depconf.exists("pfNeutralHadrons")) {
168  labels.push_back(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();
176  int key = UserBaseIso;
177  for ( ; it != ed; ++it, ++key) {
178  labels.push_back(std::make_pair(IsolationKeys(key), *it));
179  }
180  }
181  }
182 
183  tokens = edm::vector_transform(labels, [this](IsolationLabel const & label){return consumes<edm::ValueMap<T> >(label.second);});
184 
185 }
186 
187 
188 #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
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
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_