CMS 3D CMS Logo

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

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
template<typename T >
void getToken (edm::EDGetTokenT< T > &token, const edm::ParameterSet &pset, const std::string &label, const std::string &instance="")
 
 GsfElectronGSCrysFixer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~GsfElectronGSCrysFixer ()
 
- 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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 ()
 

Private Types

typedef edm::View
< reco::GsfElectron
GsfElectronView
 
typedef edm::ValueMap
< reco::SuperClusterRef
SCRefMap
 

Private Attributes

edm::EDGetTokenT
< EcalRecHitCollection
ebRecHitsToken_
 
std::unique_ptr
< ModifyObjectValueBase
gedRegression_
 
const CaloGeometrygeometry_
 
edm::EDGetTokenT
< reco::GsfElectronCoreCollection
newCoresToken_
 
edm::EDGetTokenT< SCRefMapnewCoresToOldSCMapToken_
 
edm::EDGetTokenT< GsfElectronViewoldGsfElesToken_
 
const CaloTopologytopology_
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 42 of file GsfElectronGSCrysFixer.cc.

Member Typedef Documentation

Definition at line 61 of file GsfElectronGSCrysFixer.cc.

Definition at line 62 of file GsfElectronGSCrysFixer.cc.

Constructor & Destructor Documentation

GsfElectronGSCrysFixer::GsfElectronGSCrysFixer ( const edm::ParameterSet pset)
explicit

Definition at line 87 of file GsfElectronGSCrysFixer.cc.

References edm::EDConsumerBase::consumesCollector(), ebRecHitsToken_, edm::ParameterSet::existsAs(), gedRegression_, reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterSet(), getToken(), newCoresToken_, newCoresToOldSCMapToken_, oldGsfElesToken_, fwrapper::plugin, and AlCaHLTBitMon_QueryRunRegistry::string.

88 {
89  getToken(oldGsfElesToken_,pset,"oldEles");
90  getToken(newCoresToken_,pset,"newCores");
91  getToken(newCoresToOldSCMapToken_, pset, "newCores");
92  getToken(ebRecHitsToken_,pset,"ebRecHits");
93 
94  //ripped wholesale from GEDGsfElectronFinalizer
95  if( pset.existsAs<edm::ParameterSet>("regressionConfig") ) {
96  const edm::ParameterSet& iconf = pset.getParameterSet("regressionConfig");
97  const std::string& mname = iconf.getParameter<std::string>("modifierName");
99  ModifyObjectValueFactory::get()->create(mname,iconf);
100  gedRegression_.reset(plugin);
102  gedRegression_->setConsumes(sumes);
103  } else {
104  gedRegression_.reset(nullptr);
105  }
106 
107  produces<reco::GsfElectronCollection >();
108  // new -> old
109  produces<ElectronRefMap>();
110 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:186
auto_ptr< JetDefinition::Plugin > plugin
edm::EDGetTokenT< SCRefMap > newCoresToOldSCMapToken_
void getToken(edm::EDGetTokenT< T > &token, const edm::ParameterSet &pset, const std::string &label, const std::string &instance="")
std::unique_ptr< ModifyObjectValueBase > gedRegression_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< GsfElectronView > oldGsfElesToken_
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
ParameterSet const & getParameterSet(std::string const &) const
edm::EDGetTokenT< reco::GsfElectronCoreCollection > newCoresToken_
T get(const Candidate &c)
Definition: component.h:55
virtual GsfElectronGSCrysFixer::~GsfElectronGSCrysFixer ( )
inlinevirtual

Definition at line 45 of file GsfElectronGSCrysFixer.cc.

45 {}

Member Function Documentation

void GsfElectronGSCrysFixer::beginLuminosityBlock ( edm::LuminosityBlock const &  lb,
edm::EventSetup const &  es 
)
overridevirtual

Reimplemented from edm::stream::EDProducerBase.

Definition at line 182 of file GsfElectronGSCrysFixer.cc.

References geometry_, edm::EventSetup::get(), edm::ESHandle< class >::product(), and topology_.

183  {
184  edm::ESHandle<CaloGeometry> caloGeom ;
185  edm::ESHandle<CaloTopology> caloTopo ;
186  es.get<CaloGeometryRecord>().get(caloGeom);
187  es.get<CaloTopologyRecord>().get(caloTopo);
188  geometry_ = caloGeom.product();
189  topology_ = caloTopo.product();
190 }
const CaloTopology * topology_
const CaloGeometry * geometry_
T const * product() const
Definition: ESHandle.h:86
template<typename T >
void GsfElectronGSCrysFixer::getToken ( edm::EDGetTokenT< T > &  token,
const edm::ParameterSet pset,
const std::string &  label,
const std::string &  instance = "" 
)
inline

Definition at line 53 of file GsfElectronGSCrysFixer.cc.

References edm::ParameterSet::getParameter(), instance, and GlobalPosition_Frontier_DevDB_cff::tag.

Referenced by GsfElectronGSCrysFixer().

53  {
54  auto tag(pset.getParameter<edm::InputTag>(label));
55  if (!instance.empty())
56  tag = edm::InputTag(tag.label(), instance, tag.process());
57 
58  token = consumes<T>(tag);
59  }
T getParameter(std::string const &) const
static PFTauRenderPlugin instance
void GsfElectronGSCrysFixer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 129 of file GsfElectronGSCrysFixer.cc.

References GainSwitchTools::correctHadem(), ebRecHitsToken_, edm::helper::Filler< Map >::fill(), GainSwitchTools::Fractions, GainSwitchTools::Full5x5, gedRegression_, geometry_, GainSwitchTools::hasEBGainSwitchIn5x5(), edm::helper::Filler< Map >::insert(), eostools::move(), newCoresToken_, newCoresToOldSCMapToken_, oldGsfElesToken_, edm::Event::put(), reco::GsfElectron::superCluster(), and topology_.

130 {
131  auto outEles = std::make_unique<reco::GsfElectronCollection>();
132 
133  if( gedRegression_ ) {
134  gedRegression_->setEvent(iEvent);
135  gedRegression_->setEventContent(iSetup);
136  }
137 
138  auto elesHandle = getHandle(iEvent,oldGsfElesToken_);
139  auto& ebRecHits = *getHandle(iEvent,ebRecHitsToken_);
140  auto newCoresHandle = getHandle(iEvent,newCoresToken_);
141  auto newCoresToOldSCMap = *getHandle(iEvent, newCoresToOldSCMapToken_);
142 
143  std::vector<reco::GsfElectronRef> oldElectrons;
144 
145  unsigned iE(0);
146  for (auto& oldEle : *elesHandle) {
147  auto&& refToBase(elesHandle->refAt(iE++));
148  oldElectrons.emplace_back(refToBase.id(), &oldEle, refToBase.key());
149 
150  reco::GsfElectronCoreRef newCoreRef = getNewCore(oldEle,newCoresHandle,newCoresToOldSCMap);
151 
152  outEles->emplace_back(oldEle,newCoreRef);
153  auto& newEle(outEles->back());
154 
155  if (GainSwitchTools::hasEBGainSwitchIn5x5(*oldEle.superCluster(), &ebRecHits, topology_)) {
156 
157  reco::GsfElectron::ShowerShape full5x5ShowerShape = GainSwitchTools::redoEcalShowerShape<true>(newEle.full5x5_showerShape(),newEle.superCluster(),&ebRecHits,topology_,geometry_);
158  reco::GsfElectron::ShowerShape showerShape = GainSwitchTools::redoEcalShowerShape<false>(newEle.showerShape(),newEle.superCluster(),&ebRecHits,topology_,geometry_);
159 
160  float eNewSCOverEOldSC = newEle.superCluster()->energy()/oldEle.superCluster()->energy();
163 
164  newEle.full5x5_setShowerShape(full5x5ShowerShape);
165  newEle.setShowerShape(showerShape);
166 
167 
168  if( gedRegression_ )
169  gedRegression_->modifyObject(newEle);
170  }
171  }
172 
173  auto&& newElectronsHandle(iEvent.put(std::move(outEles)));
174 
175  std::auto_ptr<ElectronRefMap> pRefMap(new ElectronRefMap);
176  ElectronRefMap::Filler refMapFiller(*pRefMap);
177  refMapFiller.insert(newElectronsHandle, oldElectrons.begin(), oldElectrons.end());
178  refMapFiller.fill();
179  iEvent.put(pRefMap);
180 }
edm::EDGetTokenT< SCRefMap > newCoresToOldSCMapToken_
const CaloTopology * topology_
std::unique_ptr< ModifyObjectValueBase > gedRegression_
const CaloGeometry * geometry_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
edm::EDGetTokenT< GsfElectronView > oldGsfElesToken_
static void correctHadem(reco::GsfElectron::ShowerShape &showerShape, float eNewOverEOld, const GainSwitchTools::ShowerShapeType ssType)
edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsToken_
edm::EDGetTokenT< reco::GsfElectronCoreCollection > newCoresToken_
static bool hasEBGainSwitchIn5x5(const reco::SuperCluster &superClus, const EcalRecHitCollection *recHits, const CaloTopology *topology)

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> GsfElectronGSCrysFixer::ebRecHitsToken_
private

Definition at line 67 of file GsfElectronGSCrysFixer.cc.

Referenced by GsfElectronGSCrysFixer(), and produce().

std::unique_ptr<ModifyObjectValueBase> GsfElectronGSCrysFixer::gedRegression_
private

Definition at line 71 of file GsfElectronGSCrysFixer.cc.

Referenced by GsfElectronGSCrysFixer(), and produce().

const CaloGeometry* GsfElectronGSCrysFixer::geometry_
private

Definition at line 70 of file GsfElectronGSCrysFixer.cc.

Referenced by beginLuminosityBlock(), and produce().

edm::EDGetTokenT<reco::GsfElectronCoreCollection> GsfElectronGSCrysFixer::newCoresToken_
private

Definition at line 65 of file GsfElectronGSCrysFixer.cc.

Referenced by GsfElectronGSCrysFixer(), and produce().

edm::EDGetTokenT<SCRefMap> GsfElectronGSCrysFixer::newCoresToOldSCMapToken_
private

Definition at line 66 of file GsfElectronGSCrysFixer.cc.

Referenced by GsfElectronGSCrysFixer(), and produce().

edm::EDGetTokenT<GsfElectronView> GsfElectronGSCrysFixer::oldGsfElesToken_
private

Definition at line 64 of file GsfElectronGSCrysFixer.cc.

Referenced by GsfElectronGSCrysFixer(), and produce().

const CaloTopology* GsfElectronGSCrysFixer::topology_
private

Definition at line 69 of file GsfElectronGSCrysFixer.cc.

Referenced by beginLuminosityBlock(), and produce().