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 Attributes
GsfEleGSCrysSimpleFixer Class Reference
Inheritance diagram for GsfEleGSCrysSimpleFixer:
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)
 
 GsfEleGSCrysSimpleFixer (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
virtual ~GsfEleGSCrysSimpleFixer ()
 
- 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 Attributes

edm::EDGetTokenT
< EcalRecHitCollection
ebMultiAndWeightsRecHitsToken_
 
edm::EDGetTokenT
< EcalRecHitCollection
ebMultiRecHitsToken_
 
const CaloGeometrygeometry_
 
edm::EDGetTokenT
< reco::GsfElectronCollection
oldGsfElesToken_
 
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 40 of file GsfEleGSCrysSimpleFixer.cc.

Constructor & Destructor Documentation

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

Definition at line 74 of file GsfEleGSCrysSimpleFixer.cc.

References ebMultiAndWeightsRecHitsToken_, ebMultiRecHitsToken_, getToken(), and oldGsfElesToken_.

75 {
76 
77  getToken(oldGsfElesToken_,pset,"oldEles");
78  getToken(ebMultiAndWeightsRecHitsToken_,pset,"ebMultiAndWeightsRecHits");
79  getToken(ebMultiRecHitsToken_,pset,"ebMultiRecHits");
80 
81 
82  produces<reco::GsfElectronCollection >();
83 }
void getToken(edm::EDGetTokenT< T > &token, const edm::ParameterSet &pset, const std::string &label)
edm::EDGetTokenT< EcalRecHitCollection > ebMultiRecHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > ebMultiAndWeightsRecHitsToken_
edm::EDGetTokenT< reco::GsfElectronCollection > oldGsfElesToken_
virtual GsfEleGSCrysSimpleFixer::~GsfEleGSCrysSimpleFixer ( )
inlinevirtual

Definition at line 43 of file GsfEleGSCrysSimpleFixer.cc.

43 {}

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 137 of file GsfEleGSCrysSimpleFixer.cc.

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

138  {
139  edm::ESHandle<CaloGeometry> caloGeom ;
140  edm::ESHandle<CaloTopology> caloTopo ;
141  es.get<CaloGeometryRecord>().get(caloGeom);
142  es.get<CaloTopologyRecord>().get(caloTopo);
143  geometry_ = caloGeom.product();
144  topology_ = caloTopo.product();
145 }
const CaloGeometry * geometry_
const CaloTopology * topology_
T const * product() const
Definition: ESHandle.h:86
template<typename T >
void GsfEleGSCrysSimpleFixer::getToken ( edm::EDGetTokenT< T > &  token,
const edm::ParameterSet pset,
const std::string &  label 
)
inline

Definition at line 51 of file GsfEleGSCrysSimpleFixer.cc.

References edm::ParameterSet::getParameter(), and diffTwoXMLs::label.

Referenced by GsfEleGSCrysSimpleFixer().

51  {
52  token=consumes<T>(pset.getParameter<edm::InputTag>(label));
53  }
T getParameter(std::string const &) const
void GsfEleGSCrysSimpleFixer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 85 of file GsfEleGSCrysSimpleFixer.cc.

References reco::GsfElectron::correctedEcalEnergyError(), GainSwitchTools::correctHadem(), reco::GsfElectron::correctMomentum(), ebMultiAndWeightsRecHitsToken_, ebMultiRecHitsToken_, reco::GsfElectron::ecalEnergy(), reco::GsfElectron::ecalEnergyError(), GainSwitchTools::Fractions, GainSwitchTools::Full5x5, reco::GsfElectron::full5x5_setShowerShape(), reco::GsfElectron::full5x5_showerShape(), GainSwitchTools::gainSwitchedIdsIn5x5(), geometry_, GainSwitchTools::hasEBGainSwitchIn5x5(), eostools::move(), GainSwitchTools::newRawEnergyNoFracs(), oldGsfElesToken_, reco::GsfElectron::p4(), edm::Event::put(), reco::GsfElectron::setCorrectedEcalEnergy(), reco::GsfElectron::setCorrectedEcalEnergyError(), reco::GsfElectron::setShowerShape(), reco::GsfElectron::showerShape(), reco::GsfElectron::superCluster(), topology_, and reco::GsfElectron::trackMomentumError().

86 {
87  auto outEles = std::make_unique<reco::GsfElectronCollection>();
88 
89 
90  auto elesHandle = getHandle(iEvent,oldGsfElesToken_);
91  auto& ebMultiRecHits = *getHandle(iEvent,ebMultiRecHitsToken_);
92  auto& ebMultiAndWeightsRecHits = *getHandle(iEvent,ebMultiAndWeightsRecHitsToken_);
93 
94 
95  for(size_t eleNr=0;eleNr<elesHandle->size();eleNr++){
96  reco::GsfElectronRef eleRef(elesHandle,eleNr);
97  if(GainSwitchTools::hasEBGainSwitchIn5x5(*eleRef->superCluster(),&ebMultiRecHits,topology_)){
98 
99  reco::GsfElectron newEle(*eleRef);
100 
101  std::vector<DetId> gsIds = GainSwitchTools::gainSwitchedIdsIn5x5(eleRef->superCluster()->seed()->seed(),
102  &ebMultiRecHits,topology_);
103  float newRawEnergy = GainSwitchTools::newRawEnergyNoFracs(*eleRef->superCluster(),gsIds,
104  &ebMultiRecHits,&ebMultiAndWeightsRecHits);
105  float energyCorr = newRawEnergy / eleRef->superCluster()->rawEnergy();
106 
107  reco::GsfElectron::ShowerShape full5x5ShowerShape = GainSwitchTools::redoEcalShowerShape<true>(newEle.full5x5_showerShape(),newEle.superCluster(),&ebMultiAndWeightsRecHits,topology_,geometry_);
108  reco::GsfElectron::ShowerShape showerShape = GainSwitchTools::redoEcalShowerShape<false>(newEle.showerShape(),newEle.superCluster(),&ebMultiAndWeightsRecHits,topology_,geometry_);
109  //so the no fractions showershape had hcalDepth1/2 corrected by the regression energy, hence we need to know the type
112  newEle.full5x5_setShowerShape(full5x5ShowerShape);
113  newEle.setShowerShape(showerShape);
114 
115  newEle.setCorrectedEcalEnergy(newEle.ecalEnergy()*energyCorr);
116  newEle.setCorrectedEcalEnergyError(newEle.ecalEnergyError()*energyCorr);
117 
118  //meh, somebody else can sort this out
119  //the energy should for gain switch electrons be all from the ECAL so we will assume that
120  //to make my life easier
121  math::XYZTLorentzVector newMom(newEle.p4().x()/newEle.p4().t()*newEle.ecalEnergy(),
122  newEle.p4().y()/newEle.p4().t()*newEle.ecalEnergy(),
123  newEle.p4().z()/newEle.p4().t()*newEle.ecalEnergy(),
124  newEle.ecalEnergy());
125  newEle.correctMomentum(newMom,newEle.trackMomentumError(),newEle.correctedEcalEnergyError());
126 
127 
128  outEles->push_back(newEle);
129  }else{
130  outEles->push_back(*eleRef);
131  }
132  }
133 
134  iEvent.put(std::move(outEles));
135 }
const CaloGeometry * geometry_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
edm::EDGetTokenT< EcalRecHitCollection > ebMultiRecHitsToken_
edm::EDGetTokenT< EcalRecHitCollection > ebMultiAndWeightsRecHitsToken_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
def move
Definition: eostools.py:510
const CaloTopology * topology_
static void correctHadem(reco::GsfElectron::ShowerShape &showerShape, float eNewOverEOld, const GainSwitchTools::ShowerShapeType ssType)
static float newRawEnergyNoFracs(const reco::SuperCluster &superClus, const std::vector< DetId > gainSwitchedHitIds, const EcalRecHitCollection *oldRecHits, const EcalRecHitCollection *newRecHits)
static std::vector< DetId > gainSwitchedIdsIn5x5(const DetId &id, const EcalRecHitCollection *recHits, const CaloTopology *topology)
static bool hasEBGainSwitchIn5x5(const reco::SuperCluster &superClus, const EcalRecHitCollection *recHits, const CaloTopology *topology)
edm::EDGetTokenT< reco::GsfElectronCollection > oldGsfElesToken_

Member Data Documentation

edm::EDGetTokenT<EcalRecHitCollection> GsfEleGSCrysSimpleFixer::ebMultiAndWeightsRecHitsToken_
private

Definition at line 56 of file GsfEleGSCrysSimpleFixer.cc.

Referenced by GsfEleGSCrysSimpleFixer(), and produce().

edm::EDGetTokenT<EcalRecHitCollection> GsfEleGSCrysSimpleFixer::ebMultiRecHitsToken_
private

Definition at line 57 of file GsfEleGSCrysSimpleFixer.cc.

Referenced by GsfEleGSCrysSimpleFixer(), and produce().

const CaloGeometry* GsfEleGSCrysSimpleFixer::geometry_
private

Definition at line 60 of file GsfEleGSCrysSimpleFixer.cc.

Referenced by beginLuminosityBlock(), and produce().

edm::EDGetTokenT<reco::GsfElectronCollection> GsfEleGSCrysSimpleFixer::oldGsfElesToken_
private

Definition at line 55 of file GsfEleGSCrysSimpleFixer.cc.

Referenced by GsfEleGSCrysSimpleFixer(), and produce().

const CaloTopology* GsfEleGSCrysSimpleFixer::topology_
private

Definition at line 59 of file GsfEleGSCrysSimpleFixer.cc.

Referenced by beginLuminosityBlock(), and produce().