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 hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () 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 26 of file CalibratedElectronProducersRun2.cc.

Constructor & Destructor Documentation

◆ CalibratedElectronProducerRun2T()

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

Definition at line 43 of file CalibratedElectronProducersRun2.cc.

44  : theElectronToken(consumes<edm::View<T> >(conf.getParameter<edm::InputTag>("electrons"))),
45  theGBRForestName(conf.getParameter<std::string>("gbrForestName")),
48  conf.getParameter<bool>("isMC"),
49  conf.getParameter<bool>("isSynchronization"),
50  conf.getParameter<std::string>("correctionFile")) {
51  if (conf.existsAs<bool>("semiDeterministic") && conf.getParameter<bool>("semiDeterministic")) {
52  theSemiDeterministicRng = std::make_unique<TRandom2>();
54  }
55  produces<std::vector<T> >();
56 }

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 59 of file CalibratedElectronProducersRun2.cc.

59 {}

Member Function Documentation

◆ produce()

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

Definition at line 62 of file CalibratedElectronProducersRun2.cc.

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

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

Member Data Documentation

◆ 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 37 of file CalibratedElectronProducersRun2.cc.

◆ theGBRForestHandle

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

Definition at line 35 of file CalibratedElectronProducersRun2.cc.

◆ theGBRForestName

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

Definition at line 34 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:34
CalibratedElectronProducerRun2T::theGBRForestHandle
edm::ESHandle< GBRForest > theGBRForestHandle
Definition: CalibratedElectronProducersRun2.cc:35
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:171
edm::Handle
Definition: AssociativeIterator.h:50
dqmdumpme.first
first
Definition: dqmdumpme.py:55
fileCollector.seed
seed
Definition: fileCollector.py:127
edm::EventSetup::get
T get() const
Definition: EventSetup.h:80
CalibratedElectronProducerRun2T::theSemiDeterministicRng
std::unique_ptr< TRandom > theSemiDeterministicRng
Definition: CalibratedElectronProducersRun2.cc:39
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::View
Definition: CaloClusterFwd.h:14
CalibratedElectronProducerRun2T::theEpCombinationTool
EpCombinationTool theEpCombinationTool
Definition: CalibratedElectronProducersRun2.cc:37
CalibratedElectronProducerRun2T::theElectronToken
edm::EDGetTokenT< edm::View< T > > theElectronToken
Definition: CalibratedElectronProducersRun2.cc:33
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:49
get
#define get
eostools.move
def move(src, dest)
Definition: eostools.py:511
T
long double T
Definition: Basic3DVectorLD.h:48
GBRWrapperRcd
Definition: GBRWrapperRcd.h:24
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
edm::InputTag
Definition: InputTag.h:15
CalibratedElectronProducerRun2T::theEnCorrectorRun2
ElectronEnergyCalibratorRun2 theEnCorrectorRun2
Definition: CalibratedElectronProducersRun2.cc:38