CMS 3D CMS Logo

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

Public Member Functions

void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 TkInstLumiTableProducer (const edm::ParameterSet &params)
 
- 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
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const std::string m_doc
 
bool m_extension
 
const edm::EDGetTokenT< OnlineLuminosityRecordm_metaDataToken
 
const std::string m_name
 
const edm::EDGetTokenT< LumiScalersCollectionm_scalerToken
 

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

Definition at line 11 of file TkInstLumiTableProducer.cc.

Constructor & Destructor Documentation

◆ TkInstLumiTableProducer()

TkInstLumiTableProducer::TkInstLumiTableProducer ( const edm::ParameterSet params)
inlineexplicit

Definition at line 13 of file TkInstLumiTableProducer.cc.

14  : m_name(params.getParameter<std::string>("name")),
15  m_doc(params.existsAs<std::string>("doc") ? params.getParameter<std::string>("doc") : ""),
16  m_extension(params.existsAs<bool>("extension") ? params.getParameter<bool>("extension") : false),
17  m_scalerToken(consumes<LumiScalersCollection>(params.getParameter<edm::InputTag>("lumiScalers"))),
18  m_metaDataToken(consumes<OnlineLuminosityRecord>(params.getParameter<edm::InputTag>("metadata"))) {
19  produces<nanoaod::FlatTable>();
20  }
const edm::EDGetTokenT< LumiScalersCollection > m_scalerToken
const edm::EDGetTokenT< OnlineLuminosityRecord > m_metaDataToken

Member Function Documentation

◆ fillDescriptions()

static void TkInstLumiTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 22 of file TkInstLumiTableProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

22  {
24  desc.add<std::string>("name", "");
25  desc.add<std::string>("doc", "");
26  desc.add<bool>("extension", false);
27  desc.add<edm::InputTag>("lumiScalers", edm::InputTag("scalersRawToDigi"));
28  desc.add<edm::InputTag>("metadata", edm::InputTag("onlineMetaDataDigis"));
29  descriptions.add("tkInstLumiTable", desc);
30  }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

void TkInstLumiTableProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 43 of file TkInstLumiTableProducer.cc.

References OnlineLuminosityRecord::avgPileUp(), iEvent, nano_mu_global_cff::instLumi, OnlineLuminosityRecord::instLumi(), edm::HandleBase::isValid(), V0Monitor_cfi::lumiScalers, m_extension, m_metaDataToken, m_name, m_scalerToken, eostools::move(), MillePedeFileConverter_cfg::out, and displacedMuons_cfi::pu.

43  {
44  auto out = std::make_unique<nanoaod::FlatTable>(1, m_name, true, m_extension);
45 
46  out->addColumnValue<int>("bx", iEvent.bunchCrossing(), "Bunch-crossing ID");
47 
48  float instLumi{0.}, pu{0.};
51 
52  if (lumiScalers.isValid() && !lumiScalers->empty()) {
53  if (lumiScalers->begin() != lumiScalers->end()) {
54  instLumi = lumiScalers->begin()->instantLumi();
55  pu = lumiScalers->begin()->pileup();
56  }
57  } else if (metaData.isValid()) {
58  instLumi = metaData->instLumi();
59  pu = metaData->avgPileUp();
60  } else {
61  edm::LogInfo("TkInstLumiTableProducer")
62  << "Luminosity related collections not found in the event; will write dummy values";
63  }
64 
65  out->addColumnValue<float>("instLumi", instLumi, "Instantaneous luminosity");
66  out->addColumnValue<float>("PU", pu, "Pileup");
67 
68  iEvent.put(std::move(out));
69 }
const edm::EDGetTokenT< LumiScalersCollection > m_scalerToken
float instLumi() const
Return the luminosity for the current nibble.
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
bool isValid() const
Definition: HandleBase.h:70
const edm::EDGetTokenT< OnlineLuminosityRecord > m_metaDataToken
float avgPileUp() const
Return the average pileup for th current nibble.
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ m_doc

const std::string TkInstLumiTableProducer::m_doc
private

Definition at line 36 of file TkInstLumiTableProducer.cc.

◆ m_extension

bool TkInstLumiTableProducer::m_extension
private

Definition at line 37 of file TkInstLumiTableProducer.cc.

Referenced by produce().

◆ m_metaDataToken

const edm::EDGetTokenT<OnlineLuminosityRecord> TkInstLumiTableProducer::m_metaDataToken
private

Definition at line 40 of file TkInstLumiTableProducer.cc.

Referenced by produce().

◆ m_name

const std::string TkInstLumiTableProducer::m_name
private

Definition at line 35 of file TkInstLumiTableProducer.cc.

Referenced by produce().

◆ m_scalerToken

const edm::EDGetTokenT<LumiScalersCollection> TkInstLumiTableProducer::m_scalerToken
private

Definition at line 39 of file TkInstLumiTableProducer.cc.

Referenced by produce().