CMS 3D CMS Logo

ConditionDumperInEdm.cc
Go to the documentation of this file.
2 #include <memory>
3 
5 
8 
9 //
10 // constructors and destructor
11 //
13  : gtEvmDigisLabel_{iConfig.getParameter<edm::InputTag>("gtEvmDigisLabel")},
14  gtEvmDigisLabelToken_{consumes<L1GlobalTriggerEvmReadoutRecord>(gtEvmDigisLabel_)},
15  runInfoToken_{esConsumes<edm::Transition::EndRun>()},
16  //per LUMI products
17  lumiToken_{produces<edm::ConditionsInLumiBlock, edm::Transition::EndLuminosityBlock>()},
18  //per RUN products
19  runToken_{produces<edm::ConditionsInRunBlock, edm::Transition::EndRun>()},
20  //per EVENT products
21  eventToken_{produces<edm::ConditionsInEventBlock>()} {}
22 
24 
25 //
26 // member functions
27 //
28 std::shared_ptr<edm::ConditionsInLumiBlock> ConditionDumperInEdm::globalBeginLuminosityBlock(
29  edm::LuminosityBlock const&, edm::EventSetup const&) const {
30  return std::make_shared<edm::ConditionsInLumiBlock>();
31 }
32 
34  lumi.emplace(lumiToken_, *luminosityBlockCache(lumi.index()));
35 }
36 
37 std::shared_ptr<edm::ConditionsInRunBlock> ConditionDumperInEdm::globalBeginRun(edm::Run const&,
38  const edm::EventSetup&) const {
39  return std::make_shared<edm::ConditionsInRunBlock>();
40 }
41 
43  //dump of RunInfo
44  auto& runBlock = *(runCache(run.index()));
45  {
46  auto const& sum = setup.getData(runInfoToken_);
47  runBlock.BStartCurrent = sum.m_start_current;
48  runBlock.BStopCurrent = sum.m_stop_current;
49  runBlock.BAvgCurrent = sum.m_avg_current;
50  }
51 
52  run.emplace(runToken_, runBlock);
53 }
54 
55 // ------------ method called to produce the data ------------
57  //get the L1 object
59  iEvent.getByToken(gtEvmDigisLabelToken_, gtReadoutRecordData);
60 
61  if (!gtReadoutRecordData.isValid()) {
62  LogDebug("ConditionDumperInEdm") << "\nWarning: L1GlobalTriggerEvmReadoutRecord with input tag " << gtEvmDigisLabel_
63  << "\nrequested in configuration, but not found in the event."
64  << "\nNo BST quantities retrieved." << std::endl;
65 
66  iEvent.emplace(eventToken_, eventBlock_);
67 
68  return;
69  }
70 
71  const L1GtfeExtWord& gtfeBlockData = gtReadoutRecordData->gtfeWord();
72 
73  //lumi info
74  auto& lumiBlock = *luminosityBlockCache(iEvent.getLuminosityBlock().index());
75  lumiBlock.totalIntensityBeam1 = gtfeBlockData.totalIntensityBeam1();
76  lumiBlock.totalIntensityBeam2 = gtfeBlockData.totalIntensityBeam2();
77 
78  //run info
79  auto& runBlock = *runCache(iEvent.getRun().index());
80  runBlock.beamMomentum = gtfeBlockData.beamMomentum();
81  runBlock.beamMode = gtfeBlockData.beamMode();
82  runBlock.lhcFillNumber = gtfeBlockData.lhcFillNumber();
83 
84  //event info
87 
88  iEvent.emplace(eventToken_, eventBlock_);
89 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const cms_uint16_t beamMode() const
std::shared_ptr< edm::ConditionsInLumiBlock > globalBeginLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) const final
const edm::EDGetTokenT< L1GlobalTriggerEvmReadoutRecord > gtEvmDigisLabelToken_
const edm::InputTag gtEvmDigisLabel_
const L1GtfeExtWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const edm::EDPutTokenT< edm::ConditionsInEventBlock > eventToken_
const cms_uint16_t bstMasterStatus() const
int iEvent
Definition: GenABIO.cc:224
const cms_uint32_t turnCountNumber() const
const cms_uint32_t lhcFillNumber() const
void endRunProduce(edm::Run &, const edm::EventSetup &) final
const edm::EDPutTokenT< edm::ConditionsInLumiBlock > lumiToken_
ConditionDumperInEdm(const edm::ParameterSet &)
edm::ConditionsInEventBlock eventBlock_
std::shared_ptr< edm::ConditionsInRunBlock > globalBeginRun(edm::Run const &, const edm::EventSetup &) const final
const cms_uint16_t beamMomentum() const
bool isValid() const
Definition: HandleBase.h:70
void produce(edm::Event &, const edm::EventSetup &) final
const cms_uint32_t totalIntensityBeam2() const
void endLuminosityBlockProduce(edm::LuminosityBlock &, edm::EventSetup const &) final
const edm::ESGetToken< RunInfo, RunInfoRcd > runInfoToken_
const cms_uint32_t totalIntensityBeam1() const
const edm::EDPutTokenT< edm::ConditionsInRunBlock > runToken_
Definition: Run.h:45
#define LogDebug(id)