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