CMS 3D CMS Logo

TotemVFATRawToDigi.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Jan Kašpar (jan.kaspar@gmail.com)
6 *
7 ****************************************************************************/
8 
16 
20 
22 
26 
30 
34 
36 
37 #include <string>
38 
40 public:
41  explicit TotemVFATRawToDigi(const edm::ParameterSet &);
42  ~TotemVFATRawToDigi() override;
43 
44  void produce(edm::Event &, const edm::EventSetup &) override;
45  void endStream() override;
46 
47 private:
49 
51 
52  std::vector<unsigned int> fedIds;
53 
57 
60 
61  template <typename DigiType>
62  void run(edm::Event &, const edm::EventSetup &);
63 };
64 
65 using namespace edm;
66 using namespace std;
67 
69  : subSystemName(conf.getParameter<string>("subSystem")),
70  subSystem(ssUndefined),
71  fedIds(conf.getParameter<vector<unsigned int>>("fedIds")),
72  rawDataUnpacker(conf.getParameterSet("RawUnpacking")),
73  rawToDigiConverter(conf.getParameterSet("RawToDigi")) {
74  fedDataToken = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("rawDataTag"));
75 
76  // validate chosen subSystem
77  if (subSystemName == "TrackingStrip")
79  else if (subSystemName == "TimingDiamond")
81  else if (subSystemName == "TotemTiming")
83 
84  if (subSystem == ssUndefined)
85  throw cms::Exception("TotemVFATRawToDigi::TotemVFATRawToDigi")
86  << "Unknown sub-system string " << subSystemName << "." << endl;
87 
88  // FED (OptoRx) headers and footers
89  produces<vector<TotemFEDInfo>>(subSystemName);
90 
91  // declare products
93  produces<DetSetVector<TotemRPDigi>>(subSystemName);
94 
95  else if (subSystem == ssTimingDiamond)
96  produces<DetSetVector<CTPPSDiamondDigi>>(subSystemName);
97 
98  else if (subSystem == ssTotemTiming)
99  produces<DetSetVector<TotemTimingDigi>>(subSystemName);
100 
101  // set default IDs
102  if (fedIds.empty()) {
103  if (subSystem == ssTrackingStrip) {
105  fedIds.push_back(id);
106 
108  fedIds.push_back(id);
109  }
110 
111  else if (subSystem == ssTimingDiamond) {
113  fedIds.push_back(id);
114  }
115 
116  else if (subSystem == ssTotemTiming) {
118  ++id)
119  fedIds.push_back(id);
120  }
121  }
122 
123  // conversion status
124  produces<DetSetVector<TotemVFATStatus>>(subSystemName);
125 
126  totemMappingToken = esConsumes<TotemDAQMapping, TotemReadoutRcd>(ESInputTag("", subSystemName));
127  analysisMaskToken = esConsumes<TotemAnalysisMask, TotemReadoutRcd>(ESInputTag("", subSystemName));
128 }
129 
131 
133  if (subSystem == ssTrackingStrip)
134  run<DetSetVector<TotemRPDigi>>(event, es);
135 
136  else if (subSystem == ssTimingDiamond)
137  run<DetSetVector<CTPPSDiamondDigi>>(event, es);
138 
139  else if (subSystem == ssTotemTiming)
140  run<DetSetVector<TotemTimingDigi>>(event, es);
141 }
142 
143 template <typename DigiType>
145  // get DAQ mapping
147 
148  // get analysis mask to mask channels
150 
151  // raw data handle
153  event.getByToken(fedDataToken, rawData);
154 
155  // book output products
156  vector<TotemFEDInfo> fedInfo;
157  DigiType digi;
158  DetSetVector<TotemVFATStatus> conversionStatus;
159 
160  // raw-data unpacking
161  SimpleVFATFrameCollection vfatCollection;
162  for (const auto &fedId : fedIds) {
163  const FEDRawData &data = rawData->FEDData(fedId);
164  if (data.size() > 0)
165  rawDataUnpacker.run(fedId, data, fedInfo, vfatCollection);
166  }
167 
168  // raw-to-digi conversion
169  rawToDigiConverter.run(vfatCollection, *mapping, *analysisMask, digi, conversionStatus);
170 
171  // commit products to event
172  event.put(make_unique<vector<TotemFEDInfo>>(fedInfo), subSystemName);
173  event.put(make_unique<DigiType>(digi), subSystemName);
174  event.put(make_unique<DetSetVector<TotemVFATStatus>>(conversionStatus), subSystemName);
175 }
176 
178 
FEDNumbering.h
edm::DetSetVector
Definition: DetSetVector.h:61
TotemReadoutRcd.h
edm::ESInputTag
Definition: ESInputTag.h:87
FEDNumbering::MAXTotemRPVerticalFEDID
Definition: FEDNumbering.h:40
ESHandle.h
FEDNumbering::MINTotemRPVerticalFEDID
Definition: FEDNumbering.h:39
RawToDigiConverter.h
edm::EDGetTokenT< FEDRawDataCollection >
pps::RawDataUnpacker
Collection of code for unpacking of TOTEM raw-data.
Definition: RawDataUnpacker.h:29
edm
HLT enums.
Definition: AlignableModifier.h:19
TotemDAQMapping.h
TotemTimingDigi.h
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:162
EDProducer.h
FEDNumbering::MAXTotemRPTimingVerticalFEDID
Definition: FEDNumbering.h:42
SimpleVFATFrameCollection.h
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
TotemVFATRawToDigi::fedDataToken
edm::EDGetTokenT< FEDRawDataCollection > fedDataToken
Definition: TotemVFATRawToDigi.cc:59
ESGetToken.h
FEDRawData
Definition: FEDRawData.h:19
MakerMacros.h
FEDNumbering::MAXCTPPSDiamondFEDID
Definition: FEDNumbering.h:38
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TotemVFATRawToDigi::totemMappingToken
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd > totemMappingToken
Definition: TotemVFATRawToDigi.cc:60
edm::ESHandle
Definition: DTSurvey.h:22
TotemAnalysisMask.h
RawToDigiConverter::run
void run(const VFATFrameCollection &coll, const TotemDAQMapping &mapping, const TotemAnalysisMask &mask, edm::DetSetVector< TotemRPDigi > &digi, edm::DetSetVector< TotemVFATStatus > &status)
Creates RP digi.
Definition: RawToDigiConverter.cc:176
TotemVFATRawToDigi::run
void run(edm::Event &, const edm::EventSetup &)
Definition: TotemVFATRawToDigi.cc:144
TotemVFATRawToDigi::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TotemVFATRawToDigi.cc:132
TotemVFATRawToDigi::ssTotemTiming
Definition: TotemVFATRawToDigi.cc:55
TotemVFATStatus.h
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
TotemVFATRawToDigi::analysisMaskToken
edm::ESGetToken< TotemAnalysisMask, TotemReadoutRcd > analysisMaskToken
Definition: TotemVFATRawToDigi.cc:61
TotemVFATRawToDigi::endStream
void endStream() override
Definition: TotemVFATRawToDigi.cc:177
Event.h
producerFileCleanner.subSystem
subSystem
Definition: producerFileCleanner.py:109
FEDNumbering::MINTotemRPHorizontalFEDID
Definition: FEDNumbering.h:35
sistriplas_dqm_sourceclient-live_cfg.DigiType
DigiType
Definition: sistriplas_dqm_sourceclient-live_cfg.py:51
edmPickEvents.event
event
Definition: edmPickEvents.py:273
createfilelist.int
int
Definition: createfilelist.py:10
TotemVFATRawToDigi
Definition: TotemVFATRawToDigi.cc:39
SimpleVFATFrameCollection
Definition: SimpleVFATFrameCollection.h:19
FEDRawDataCollection.h
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
TotemVFATRawToDigi::subSystem
enum TotemVFATRawToDigi::@463 subSystem
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::stream::EDProducer
Definition: EDProducer.h:38
RawDataUnpacker.h
edm::EventSetup
Definition: EventSetup.h:57
DetSetVector.h
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
hlx_dqm_sourceclient_cfi.subSystemName
subSystemName
Definition: hlx_dqm_sourceclient_cfi.py:15
edm::ESGetToken< TotemDAQMapping, TotemReadoutRcd >
InputTag.h
edm::getParameterSet
ParameterSet const & getParameterSet(ParameterSetID const &id)
Definition: ParameterSet.cc:862
std
Definition: JetResolutionObject.h:76
TotemVFATRawToDigi::subSystemName
std::string subSystemName
Definition: TotemVFATRawToDigi.cc:53
FEDNumbering::MINCTPPSDiamondFEDID
Definition: FEDNumbering.h:37
FEDNumbering::MAXTotemRPHorizontalFEDID
Definition: FEDNumbering.h:36
FEDNumbering::MINTotemRPTimingVerticalFEDID
Definition: FEDNumbering.h:41
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
TotemVFATRawToDigi::ssTimingDiamond
Definition: TotemVFATRawToDigi.cc:55
TotemVFATRawToDigi::fedIds
std::vector< unsigned int > fedIds
Definition: TotemVFATRawToDigi.cc:57
Exception
Definition: hltDiff.cc:246
L1TStage2BMTF_cff.fedIds
fedIds
Definition: L1TStage2BMTF_cff.py:10
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
pps::RawDataUnpacker::run
int run(int fedId, const FEDRawData &data, std::vector< TotemFEDInfo > &fedInfoColl, SimpleVFATFrameCollection &coll) const
Unpack data from FED with fedId into ‘coll’ collection.
Definition: RawDataUnpacker.cc:20
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
TotemVFATRawToDigi::~TotemVFATRawToDigi
~TotemVFATRawToDigi() override
Definition: TotemVFATRawToDigi.cc:130
TotemVFATRawToDigi::ssTrackingStrip
Definition: TotemVFATRawToDigi.cc:55
TotemFEDInfo.h
TotemRPDigi.h
TotemVFATRawToDigi::ssUndefined
Definition: TotemVFATRawToDigi.cc:55
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
RawToDigiConverter
Collection of code to convert TOTEM raw data into digi.
Definition: RawToDigiConverter.h:25
TotemVFATRawToDigi::rawDataUnpacker
pps::RawDataUnpacker rawDataUnpacker
Definition: TotemVFATRawToDigi.cc:63
TotemVFATRawToDigi::TotemVFATRawToDigi
TotemVFATRawToDigi(const edm::ParameterSet &)
Definition: TotemVFATRawToDigi.cc:68
taus_updatedMVAIds_cff.mapping
mapping
Definition: taus_updatedMVAIds_cff.py:29
edm::InputTag
Definition: InputTag.h:15
RawToDigiConverter::printSummaries
void printSummaries() const
Print error summaries.
Definition: RawToDigiConverter.cc:382
TotemVFATRawToDigi::rawToDigiConverter
RawToDigiConverter rawToDigiConverter
Definition: TotemVFATRawToDigi.cc:64