CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
CalibratedElectronProducerRun2T< T > Class Template Reference
Inheritance diagram for CalibratedElectronProducerRun2T< T >:
edm::stream::EDProducer<>

Public Member Functions

 CalibratedElectronProducerRun2T (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~CalibratedElectronProducerRun2T () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

edm::ESGetToken< GBRForest, GBRWrapperRcdgbrforestToken_
 
edm::EDGetTokenT< edm::View< T > > theElectronToken
 
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
 
EpCombinationTool theEpCombinationTool
 
std::string theGBRForestName
 
std::unique_ptr< TRandom > theSemiDeterministicRng
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T>
class CalibratedElectronProducerRun2T< T >

Definition at line 26 of file CalibratedElectronProducersRun2.cc.

Constructor & Destructor Documentation

◆ CalibratedElectronProducerRun2T()

template<typename T >
CalibratedElectronProducerRun2T< T >::CalibratedElectronProducerRun2T ( const edm::ParameterSet conf)
explicit

Definition at line 44 of file CalibratedElectronProducersRun2.cc.

References deDxTools::esConsumes(), edm::ParameterSet::existsAs(), CalibratedElectronProducerRun2T< T >::gbrforestToken_, edm::ParameterSet::getParameter(), ElectronEnergyCalibratorRun2::initPrivateRng(), CalibratedElectronProducerRun2T< T >::theEnCorrectorRun2, CalibratedElectronProducerRun2T< T >::theGBRForestName, and CalibratedElectronProducerRun2T< T >::theSemiDeterministicRng.

45  : theElectronToken(consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("electrons"))),
46  theGBRForestName(conf.getParameter<std::string>("gbrForestName")),
49  conf.getParameter<bool>("isMC"),
50  conf.getParameter<bool>("isSynchronization"),
51  conf.getParameter<std::string>("correctionFile")) {
52  if (conf.existsAs<bool>("semiDeterministic") && conf.getParameter<bool>("semiDeterministic")) {
53  theSemiDeterministicRng = std::make_unique<TRandom2>();
55  }
57  produces<std::vector<T> >();
58 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< edm::View< T > > theElectronToken
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:172
edm::ESGetToken< GBRForest, GBRWrapperRcd > gbrforestToken_
std::unique_ptr< TRandom > theSemiDeterministicRng
ElectronEnergyCalibratorRun2 theEnCorrectorRun2

◆ ~CalibratedElectronProducerRun2T()

template<typename T >
CalibratedElectronProducerRun2T< T >::~CalibratedElectronProducerRun2T ( )
override

Definition at line 61 of file CalibratedElectronProducersRun2.cc.

61 {}

Member Function Documentation

◆ produce()

template<typename T >
void CalibratedElectronProducerRun2T< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 64 of file CalibratedElectronProducersRun2.cc.

References dqmdumpme::first, edm::EventSetup::getData(), iEvent, recoMuon::in, createfilelist::int, M_PI, WZElectronSkims53X_cff::max, eostools::move(), MillePedeFileConverter_cfg::out, and fileCollector::seed.

64  {
65  const GBRForest *theGBRForest = &iSetup.getData(gbrforestToken_);
66  theEpCombinationTool.init(theGBRForest);
67 
69  iEvent.getByToken(theElectronToken, in);
70 
71  std::unique_ptr<std::vector<T> > out(new std::vector<T>());
72  out->reserve(in->size());
73 
74  if (theSemiDeterministicRng && !in->empty()) { // no need to set a seed if in is empty
75  const auto &first = in->front();
76  std::seed_seq seeder = {int(iEvent.id().event()),
77  int(iEvent.id().luminosityBlock()),
78  int(iEvent.id().run()),
79  int(in->size()),
80  int(std::numeric_limits<int>::max() * first.phi() / M_PI) & 0xFFF,
81  int(first.pdgId())};
82  uint32_t seed = 0, tries = 10;
83  do {
84  seeder.generate(&seed, &seed + 1);
85  tries++;
86  } while (seed == 0 && tries < 10);
87  theSemiDeterministicRng->SetSeed(seed ? seed : iEvent.id().event());
88  }
89 
90  for (const T &ele : *in) {
91  out->push_back(ele);
92  theEnCorrectorRun2.calibrate(out->back(), iEvent.id().run(), iEvent.streamID());
93  }
94 
95  iEvent.put(std::move(out));
96 }
edm::EDGetTokenT< edm::View< T > > theElectronToken
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool init(const GBRForest *forest)
edm::ESGetToken< GBRForest, GBRWrapperRcd > gbrforestToken_
int iEvent
Definition: GenABIO.cc:224
#define M_PI
std::unique_ptr< TRandom > theSemiDeterministicRng
void calibrate(SimpleElectron &electron, edm::StreamID const &id=edm::StreamID::invalidStreamID()) const
long double T
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ gbrforestToken_

template<typename T >
edm::ESGetToken<GBRForest, GBRWrapperRcd> CalibratedElectronProducerRun2T< T >::gbrforestToken_
private

◆ theElectronToken

template<typename T >
edm::EDGetTokenT<edm::View<T> > CalibratedElectronProducerRun2T< T >::theElectronToken
private

Definition at line 33 of file CalibratedElectronProducersRun2.cc.

◆ theEnCorrectorRun2

template<typename T >
ElectronEnergyCalibratorRun2 CalibratedElectronProducerRun2T< T >::theEnCorrectorRun2
private

◆ theEpCombinationTool

template<typename T >
EpCombinationTool CalibratedElectronProducerRun2T< T >::theEpCombinationTool
private

Definition at line 36 of file CalibratedElectronProducersRun2.cc.

◆ theGBRForestName

template<typename T >
std::string CalibratedElectronProducerRun2T< T >::theGBRForestName
private

◆ theSemiDeterministicRng

template<typename T >
std::unique_ptr<TRandom> CalibratedElectronProducerRun2T< T >::theSemiDeterministicRng
private