CMS 3D CMS Logo

OnlineMetaDataRawToDigi.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: EventFilter/OnlineMetaDataRawToDigi
4 // Class: OnlineMetaDataRawToDigi
5 //
11 //
12 // Original Author: Remigius K Mommsen (Fermilab)
13 // Created: Wed, 22 Nov 2017 18:19:56 GMT
14 //
15 //
16 
17 // system include files
18 #include <memory>
19 #include <iostream>
20 
21 // user include files
24 
27 
29 
31 
35 
40 
41 //
42 // class declaration
43 //
44 
46 public:
48  ~OnlineMetaDataRawToDigi() override;
49 
50  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
51 
52 private:
53  void produce(edm::Event&, const edm::EventSetup&) override;
55 
57 };
58 
60  edm::InputTag dataLabel = iConfig.getParameter<edm::InputTag>("onlineMetaDataInputLabel");
61  dataToken_ = consumes<FEDRawDataCollection>(dataLabel);
62 
63  produces<CTPPSRecord>();
64  produces<DCSRecord>();
65  produces<OnlineLuminosityRecord>();
66  produces<reco::BeamSpot>();
67 }
68 
70 
71 //
72 // member functions
73 //
74 
75 // ------------ method called to produce the data ------------
77  using namespace edm;
78 
80  iEvent.getByToken(dataToken_, rawdata);
81 
83  CTPPSRecord ctppsRecord;
84  OnlineLuminosityRecord onlineLuminosityRecord;
86 
87  if (rawdata.isValid()) {
88  const FEDRawData& onlineMetaDataRaw = rawdata->FEDData(FEDNumbering::MINMetaDataSoftFEDID);
89  const unsigned char* payload = onlineMetaDataRaw.data() + FEDHeader::length;
90 
91  if (onlineMetaDataRaw.size() >= FEDHeader::length + sizeof(uint8_t)) {
92  const uint8_t version = *(reinterpret_cast<uint8_t const*>(payload));
93  if (version == 1 && onlineMetaDataRaw.size() >= FEDHeader::length + sizeof(online::Data_v1)) {
94  online::Data_v1 const* onlineMetaData = reinterpret_cast<online::Data_v1 const*>(payload);
95  dcsRecord = DCSRecord(onlineMetaData->dcs);
96  onlineLuminosityRecord = OnlineLuminosityRecord(onlineMetaData->luminosity);
97  onlineBeamSpot = getBeamSpot(onlineMetaData->beamSpot);
98  } else if (version == 2 && onlineMetaDataRaw.size() >= FEDHeader::length + sizeof(online::Data_v2)) {
99  online::Data_v2 const* onlineMetaData = reinterpret_cast<online::Data_v2 const*>(payload);
100  ctppsRecord = CTPPSRecord(onlineMetaData->ctpps);
101  dcsRecord = DCSRecord(onlineMetaData->dcs);
102  onlineLuminosityRecord = OnlineLuminosityRecord(onlineMetaData->luminosity);
103  onlineBeamSpot = getBeamSpot(onlineMetaData->beamSpot);
104  }
105  }
106  }
107 
108  iEvent.put(std::make_unique<CTPPSRecord>(ctppsRecord));
109  iEvent.put(std::make_unique<DCSRecord>(dcsRecord));
110  iEvent.put(std::make_unique<OnlineLuminosityRecord>(onlineLuminosityRecord));
111  iEvent.put(std::make_unique<reco::BeamSpot>(onlineBeamSpot));
112 }
113 
116 
118  matrix(0, 0) = beamSpot.errX * beamSpot.errX;
119  matrix(1, 1) = beamSpot.errY * beamSpot.errY;
120  matrix(2, 2) = beamSpot.errZ * beamSpot.errZ;
121  matrix(3, 3) = beamSpot.errSigmaZ * beamSpot.errSigmaZ;
122  matrix(4, 4) = beamSpot.errDxdz * beamSpot.errDxdz;
123  matrix(5, 5) = beamSpot.errDydz * beamSpot.errDydz;
124  matrix(6, 6) = beamSpot.errWidthX * beamSpot.errWidthX;
125  // Note: errWidthY is not part of the CovarianceMatrix
126 
129 
130  bs.setBeamWidthY(beamSpot.widthY);
131 
132  return bs;
133 }
134 
135 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
138  desc.add<edm::InputTag>("onlineMetaDataInputLabel", edm::InputTag("rawDataCollector"));
139  descriptions.add("onlineMetaDataRawToDigi", desc);
140 }
141 
142 //define this as a plug-in
FEDNumbering.h
OnlineMetaDataRawToDigi::~OnlineMetaDataRawToDigi
~OnlineMetaDataRawToDigi() override
Definition: OnlineMetaDataRawToDigi.cc:69
pwdgSkimBPark_cfi.beamSpot
beamSpot
Definition: pwdgSkimBPark_cfi.py:5
FEDNumbering::MINMetaDataSoftFEDID
Definition: FEDNumbering.h:97
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
edm::EDGetTokenT< FEDRawDataCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HcalTopologyMode::LHC
Definition: HcalTopologyMode.h:26
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89287
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
online::Data_v2::dcs
const DCS_v1 dcs
Definition: OnlineMetaDataRaw.h:66
EDProducer.h
DCSRecord
Class to contain DCS information from soft FED 1022.
Definition: DCSRecord.h:20
OnlineMetaDataRaw.h
edm::Handle
Definition: AssociativeIterator.h:50
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
CTPPSRecord
Class to contain CTPPS information from soft FED 1022.
Definition: CTPPSRecord.h:20
FEDRawData
Definition: FEDRawData.h:19
online::Data_v2::beamSpot
const BeamSpot_v1 beamSpot
Definition: OnlineMetaDataRaw.h:64
online::BeamSpot_v1
Definition: OnlineMetaDataRaw.h:23
MakerMacros.h
cms::cuda::bs
bs
Definition: HistoContainer.h:127
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
BeamSpot.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
OnlineMetaDataRawToDigi::dataToken_
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
Definition: OnlineMetaDataRawToDigi.cc:56
reco::BeamSpot
Definition: BeamSpot.h:21
online::Data_v2::ctpps
const CTPPS_v1 ctpps
Definition: OnlineMetaDataRaw.h:65
jets_cff.payload
payload
Definition: jets_cff.py:32
BeamSpotOnline_cff.onlineBeamSpot
onlineBeamSpot
Definition: BeamSpotOnline_cff.py:7
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
OnlineMetaDataRawToDigi::OnlineMetaDataRawToDigi
OnlineMetaDataRawToDigi(const edm::ParameterSet &)
Definition: OnlineMetaDataRawToDigi.cc:59
CTPPSRecord.h
edm::ParameterSet
Definition: ParameterSet.h:47
online::Data_v2::luminosity
const Luminosity_v1 luminosity
Definition: OnlineMetaDataRaw.h:63
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
FEDRawDataCollection.h
DQMOffline_cff.dcsRecord
dcsRecord
Definition: DQMOffline_cff.py:27
edm::stream::EDProducer
Definition: EDProducer.h:38
online::Data_v1
Definition: OnlineMetaDataRaw.h:54
FEDHeader::length
static const uint32_t length
Definition: FEDHeader.h:54
edm::EventSetup
Definition: EventSetup.h:57
online::Data_v1::beamSpot
const BeamSpot_v1 beamSpot
Definition: OnlineMetaDataRaw.h:57
reco::BeamSpot::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
OnlineLuminosityRecord.h
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
OnlineMetaDataRawToDigi::getBeamSpot
reco::BeamSpot getBeamSpot(const online::BeamSpot_v1 &) const
Definition: OnlineMetaDataRawToDigi.cc:114
online::Data_v1::luminosity
const Luminosity_v1 luminosity
Definition: OnlineMetaDataRaw.h:56
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DCSRecord.h
online::Data_v2
Definition: OnlineMetaDataRaw.h:61
reco::BeamSpot::Point
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
ParameterSet.h
online::Data_v1::dcs
const DCS_v1 dcs
Definition: OnlineMetaDataRaw.h:58
OnlineMetaDataRawToDigi::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: OnlineMetaDataRawToDigi.cc:136
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
FEDHeader.h
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
OnlineMetaDataRawToDigi::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: OnlineMetaDataRawToDigi.cc:76
edm::InputTag
Definition: InputTag.h:15
OnlineLuminosityRecord
Class to contain the online luminosity from soft FED 1022.
Definition: OnlineLuminosityRecord.h:17
OnlineMetaDataRawToDigi
Definition: OnlineMetaDataRawToDigi.cc:45