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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Private Attributes

edm::EDGetTokenT< edm::View< T > > theElectronToken
 
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
 
EpCombinationTool theEpCombinationTool
 
edm::ESHandle< GBRForesttheGBRForestHandle
 
std::string theGBRForestName
 
std::unique_ptr< TRandom > theSemiDeterministicRng
 

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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

template<typename T>
class CalibratedElectronProducerRun2T< T >

Definition at line 24 of file CalibratedElectronProducersRun2.cc.

Constructor & Destructor Documentation

◆ CalibratedElectronProducerRun2T()

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

Definition at line 41 of file CalibratedElectronProducersRun2.cc.

42  : theElectronToken(consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("electrons"))),
43  theGBRForestName(conf.getParameter<std::string>("gbrForestName")),
46  conf.getParameter<bool>("isMC"),
47  conf.getParameter<bool>("isSynchronization"),
48  conf.getParameter<std::string>("correctionFile")) {
49  if (conf.existsAs<bool>("semiDeterministic") && conf.getParameter<bool>("semiDeterministic")) {
50  theSemiDeterministicRng.reset(new TRandom2());
52  }
53  produces<std::vector<T> >();
54 }

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

◆ ~CalibratedElectronProducerRun2T()

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

Definition at line 57 of file CalibratedElectronProducersRun2.cc.

57 {}

Member Function Documentation

◆ produce()

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

Definition at line 60 of file CalibratedElectronProducersRun2.cc.

60  {
63 
65  iEvent.getByToken(theElectronToken, in);
66 
67  std::unique_ptr<std::vector<T> > out(new std::vector<T>());
68  out->reserve(in->size());
69 
70  if (theSemiDeterministicRng && !in->empty()) { // no need to set a seed if in is empty
71  const auto &first = in->front();
72  std::seed_seq seeder = {int(iEvent.id().event()),
73  int(iEvent.id().luminosityBlock()),
74  int(iEvent.id().run()),
75  int(in->size()),
76  int(std::numeric_limits<int>::max() * first.phi() / M_PI) & 0xFFF,
77  int(first.pdgId())};
78  uint32_t seed = 0, tries = 10;
79  do {
80  seeder.generate(&seed, &seed + 1);
81  tries++;
82  } while (seed == 0 && tries < 10);
83  theSemiDeterministicRng->SetSeed(seed ? seed : iEvent.id().event());
84  }
85 
86  for (const T &ele : *in) {
87  out->push_back(ele);
88  theEnCorrectorRun2.calibrate(out->back(), iEvent.id().run(), iEvent.streamID());
89  }
90 
91  iEvent.put(std::move(out));
92 }

References dqmdumpme::first, edm::EventSetup::get(), get, iEvent, recoMuon::in, createfilelist::int, M_PI, SiStripPI::max, eostools::move(), MillePedeFileConverter_cfg::out, and SurveyInfoScenario_cff::seed.

Member Data Documentation

◆ theElectronToken

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

Definition at line 31 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 35 of file CalibratedElectronProducersRun2.cc.

◆ theGBRForestHandle

template<typename T >
edm::ESHandle<GBRForest> CalibratedElectronProducerRun2T< T >::theGBRForestHandle
private

Definition at line 33 of file CalibratedElectronProducersRun2.cc.

◆ theGBRForestName

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

Definition at line 32 of file CalibratedElectronProducersRun2.cc.

◆ theSemiDeterministicRng

template<typename T >
std::unique_ptr<TRandom> CalibratedElectronProducerRun2T< T >::theSemiDeterministicRng
private
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
CalibratedElectronProducerRun2T::theGBRForestName
std::string theGBRForestName
Definition: CalibratedElectronProducersRun2.cc:32
CalibratedElectronProducerRun2T::theGBRForestHandle
edm::ESHandle< GBRForest > theGBRForestHandle
Definition: CalibratedElectronProducersRun2.cc:33
EpCombinationTool::init
bool init(const GBRForest *forest)
Definition: EpCombinationTool.cc:49
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
CalibratedElectronProducerRun2T::theSemiDeterministicRng
std::unique_ptr< TRandom > theSemiDeterministicRng
Definition: CalibratedElectronProducersRun2.cc:37
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
CalibratedElectronProducerRun2T::theEpCombinationTool
EpCombinationTool theEpCombinationTool
Definition: CalibratedElectronProducersRun2.cc:35
CalibratedElectronProducerRun2T::theElectronToken
edm::EDGetTokenT< edm::View< T > > theElectronToken
Definition: CalibratedElectronProducersRun2.cc:31
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
ElectronEnergyCalibratorRun2::calibrate
void calibrate(SimpleElectron &electron, edm::StreamID const &id=edm::StreamID::invalidStreamID()) const
Definition: ElectronEnergyCalibratorRun2.cc:37
recoMuon::in
Definition: RecoMuonEnumerators.h:6
ElectronEnergyCalibratorRun2::initPrivateRng
void initPrivateRng(TRandom *rnd)
Definition: ElectronEnergyCalibratorRun2.cc:28
createfilelist.int
int
Definition: createfilelist.py:10
iEvent
int iEvent
Definition: GenABIO.cc:224
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
GBRWrapperRcd
Definition: GBRWrapperRcd.h:24
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::InputTag
Definition: InputTag.h:15
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
CalibratedElectronProducerRun2T::theEnCorrectorRun2
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
Definition: CalibratedElectronProducersRun2.cc:36