CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PhotonRegressionValueMapProducer Class Reference
Inheritance diagram for PhotonRegressionValueMapProducer:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 PhotonRegressionValueMapProducer (const edm::ParameterSet &)
 
 ~PhotonRegressionValueMapProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
void writeValueMap (edm::Event &iEvent, const edm::Handle< edm::View< reco::Photon > > &handle, const std::vector< float > &values, const std::string &label) const
 

Private Attributes

edm::EDGetTokenT
< EcalRecHitCollection
ebReducedRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
ebReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT
< EcalRecHitCollection
eeReducedRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
eeReducedRecHitCollectionMiniAOD_
 
edm::EDGetTokenT
< EcalRecHitCollection
esReducedRecHitCollection_
 
edm::EDGetTokenT
< EcalRecHitCollection
esReducedRecHitCollectionMiniAOD_
 
std::unique_ptr
< EcalClusterLazyToolsBase
lazyTools
 
edm::EDGetToken src_
 
edm::EDGetToken srcMiniAOD_
 
const bool use_full5x5_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 33 of file PhotonRegressionValueMapProducer.cc.

Constructor & Destructor Documentation

PhotonRegressionValueMapProducer::PhotonRegressionValueMapProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 69 of file PhotonRegressionValueMapProducer.cc.

References ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::ParameterSet::getParameter(), src_, and srcMiniAOD_.

69  :
70  use_full5x5_(iConfig.getParameter<bool>("useFull5x5")) {
71 
72  //
73  // Declare consummables, handle both AOD and miniAOD case
74  //
75  ebReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
76  ("ebReducedRecHitCollection"));
77  ebReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
78  ("ebReducedRecHitCollectionMiniAOD"));
79 
80  eeReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
81  ("eeReducedRecHitCollection"));
82  eeReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
83  ("eeReducedRecHitCollectionMiniAOD"));
84 
85  esReducedRecHitCollection_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
86  ("esReducedRecHitCollection"));
87  esReducedRecHitCollectionMiniAOD_ = mayConsume<EcalRecHitCollection>(iConfig.getParameter<edm::InputTag>
88  ("esReducedRecHitCollectionMiniAOD"));
89 
90  // reco photons are castable into pat photons, so no need to handle reco/pat seprately
91  src_ = mayConsume<edm::View<reco::Photon> >(iConfig.getParameter<edm::InputTag>("src"));
92  srcMiniAOD_ = mayConsume<edm::View<reco::Photon> >(iConfig.getParameter<edm::InputTag>("srcMiniAOD"));
93 
94  //
95  // Declare producibles
96  //
97  // Cluster shapes
98  produces<edm::ValueMap<float> >(sigmaIPhiIPhi_);
99  produces<edm::ValueMap<float> >(sigmaIEtaIPhi_);
100  produces<edm::ValueMap<float> >(e2x5Max_);
101  produces<edm::ValueMap<float> >(e2x5Left_);
102  produces<edm::ValueMap<float> >(e2x5Right_);
103  produces<edm::ValueMap<float> >(e2x5Top_);
104  produces<edm::ValueMap<float> >(e2x5Bottom_);
105 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
PhotonRegressionValueMapProducer::~PhotonRegressionValueMapProducer ( )

Definition at line 107 of file PhotonRegressionValueMapProducer.cc.

108 {}

Member Function Documentation

void PhotonRegressionValueMapProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 249 of file PhotonRegressionValueMapProducer.cc.

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

249  {
250  //The following says we do not know what parameters are allowed so do no validation
251  // Please change this to state exactly what you do use, even if it is no parameters
253  desc.setUnknown();
254  descriptions.addDefault(desc);
255 }
void addDefault(ParameterSetDescription const &psetDescription)
void PhotonRegressionValueMapProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 135 of file PhotonRegressionValueMapProducer.cc.

References ebReducedRecHitCollection_, ebReducedRecHitCollectionMiniAOD_, eeReducedRecHitCollection_, eeReducedRecHitCollectionMiniAOD_, esReducedRecHitCollection_, esReducedRecHitCollectionMiniAOD_, edm::hlt::Exception, edm::Event::getByToken(), lazyTools, alcazmumu_cfi::src, src_, srcMiniAOD_, run_regression::test, use_full5x5_, and writeValueMap().

135  {
136 
137  using namespace edm;
138 
140 
141  bool isAOD = true;
142  iEvent.getByToken(src_, src);
143  if(!src.isValid() ){
144  isAOD = false;
145  iEvent.getByToken(srcMiniAOD_, src);
146  }
147 
148  if( !src.isValid() ) {
149  throw cms::Exception("IllDefinedDataTier")
150  << "DataFormat does not contain a photon source!";
151  }
152 
153  // configure lazy tools
155 
156  if( isAOD ) {
160  } else {
164  }
165 
166  if( use_full5x5_ ) {
167  lazyTools.reset( new noZS::EcalClusterLazyTools(iEvent, iSetup,
168  ebrh, eerh, esrh ) );
169  } else {
170  lazyTools.reset( new EcalClusterLazyTools(iEvent, iSetup,
171  ebrh, eerh, esrh ) );
172  }
173 
174  if( !isAOD && src->size() ) {
175  edm::Ptr<pat::Photon> test(src->ptrAt(0));
176  if( test.isNull() || !test.isAvailable() ) {
177  throw cms::Exception("InvalidConfiguration")
178  <<"DataFormat is detected as miniAOD but cannot cast to pat::Photon!";
179  }
180  }
181 
182  // Cluster shapes
183  std::vector<float> sigmaIPhiIPhi;
184  std::vector<float> sigmaIEtaIPhi;
185  std::vector<float> e2x5Max;
186  std::vector<float> e2x5Left;
187  std::vector<float> e2x5Right;
188  std::vector<float> e2x5Top;
189  std::vector<float> e2x5Bottom;
190 
191  // reco::Photon::superCluster() is virtual so we can exploit polymorphism
192  for (unsigned idxpho = 0; idxpho < src->size(); ++idxpho) {
193  const auto& iPho = src->ptrAt(idxpho);
194 
195  //
196  // Compute full 5x5 quantities
197  //
198  const auto& theseed = *(iPho->superCluster()->seed());
199 
200  if( use_full5x5_ ) {
201  calculateValues<noZS::EcalClusterLazyTools>(lazyTools.get(),
202  theseed,
203  sigmaIPhiIPhi,
204  sigmaIEtaIPhi,
205  e2x5Max,
206  e2x5Left,
207  e2x5Right,
208  e2x5Top,
209  e2x5Bottom);
210  } else {
211  calculateValues<EcalClusterLazyTools>(lazyTools.get(),
212  theseed,
213  sigmaIPhiIPhi,
214  sigmaIEtaIPhi,
215  e2x5Max,
216  e2x5Left,
217  e2x5Right,
218  e2x5Top,
219  e2x5Bottom);
220  }
221  }
222 
223  // Cluster shapes
224  writeValueMap(iEvent, src, sigmaIPhiIPhi, sigmaIPhiIPhi_);
225  writeValueMap(iEvent, src, sigmaIEtaIPhi, sigmaIEtaIPhi_);
226  writeValueMap(iEvent, src, e2x5Max, e2x5Max_);
227  writeValueMap(iEvent, src, e2x5Left, e2x5Left_);
228  writeValueMap(iEvent, src, e2x5Right, e2x5Right_);
229  writeValueMap(iEvent, src, e2x5Top, e2x5Top_);
230  writeValueMap(iEvent, src, e2x5Bottom, e2x5Bottom_);
231 
232  lazyTools.reset(nullptr);
233 }
EcalClusterLazyToolsT<::EcalClusterTools > EcalClusterLazyTools
std::unique_ptr< EcalClusterLazyToolsBase > lazyTools
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollectionMiniAOD_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollectionMiniAOD_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > ebReducedRecHitCollection_
void writeValueMap(edm::Event &iEvent, const edm::Handle< edm::View< reco::Photon > > &handle, const std::vector< float > &values, const std::string &label) const
edm::EDGetTokenT< EcalRecHitCollection > esReducedRecHitCollection_
edm::EDGetTokenT< EcalRecHitCollection > eeReducedRecHitCollectionMiniAOD_
void PhotonRegressionValueMapProducer::writeValueMap ( edm::Event iEvent,
const edm::Handle< edm::View< reco::Photon > > &  handle,
const std::vector< float > &  values,
const std::string &  label 
) const
private

Definition at line 235 of file PhotonRegressionValueMapProducer.cc.

References edm::helper::Filler< Map >::fill(), patZpeak::handle, edm::helper::Filler< Map >::insert(), and edm::Event::put().

Referenced by produce().

239 {
240  using namespace edm;
241  using namespace std;
242  auto_ptr<ValueMap<float> > valMap(new ValueMap<float>());
243  edm::ValueMap<float>::Filler filler(*valMap);
244  filler.insert(handle, values.begin(), values.end());
245  filler.fill();
246  iEvent.put(valMap, label);
247 }
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::ebReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::ebReducedRecHitCollectionMiniAOD_
private
edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::eeReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::eeReducedRecHitCollectionMiniAOD_
private
edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::esReducedRecHitCollection_
private
edm::EDGetTokenT<EcalRecHitCollection> PhotonRegressionValueMapProducer::esReducedRecHitCollectionMiniAOD_
private
std::unique_ptr<EcalClusterLazyToolsBase> PhotonRegressionValueMapProducer::lazyTools
private

Definition at line 52 of file PhotonRegressionValueMapProducer.cc.

Referenced by produce().

edm::EDGetToken PhotonRegressionValueMapProducer::src_
private
edm::EDGetToken PhotonRegressionValueMapProducer::srcMiniAOD_
private
const bool PhotonRegressionValueMapProducer::use_full5x5_
private

Definition at line 66 of file PhotonRegressionValueMapProducer.cc.

Referenced by produce().