CMS 3D CMS Logo

SiStripRawToDigiUnpacker.h
Go to the documentation of this file.
1 
2 #ifndef EventFilter_SiStripRawToDigi_SiStripRawToDigiUnpacker_H
3 #define EventFilter_SiStripRawToDigi_SiStripRawToDigiUnpacker_H
4 
11 #include "WarningSummary.h"
12 
14 namespace sistrip {
15  class RawToClustersLazyUnpacker;
16 }
17 namespace sistrip {
18  class RawToDigiUnpacker;
19 }
20 
23 class FEDRawData;
24 class SiStripDigi;
25 class SiStripRawDigi;
27 class SiStripFedCabling;
28 
29 namespace sistrip {
30 
32  friend class RawToClustersLazyUnpacker;
33 
34  public:
37 
39  RawToDigiUnpacker(int16_t appended_bytes,
40  int16_t fed_buffer_dump_freq,
41  int16_t fed_event_dump_freq,
42  int16_t trigger_fed_id,
43  bool using_fed_key,
44  bool unpack_bad_channels,
45  bool mark_missing_feds,
46  const uint32_t errorThreshold);
47 
50 
52  void createDigis(const SiStripFedCabling&,
53  const FEDRawDataCollection&,
55  RawDigis& scope_mode,
56  RawDigis& virgin_raw,
57  RawDigis& proc_raw,
58  Digis& zero_suppr,
60  RawDigis& common_mode);
61 
63  void triggerFed(const FEDRawDataCollection&, SiStripEventSummary&, const uint32_t& event);
64 
66  void locateStartOfFedBuffer(const uint16_t& fed_id, const FEDRawData& input, FEDRawData& output);
67 
69  inline void quiet(bool);
70 
72  inline void useDaqRegister(bool);
73 
74  inline void extractCm(bool);
75 
76  inline void doFullCorruptBufferChecks(bool);
77 
78  inline void doAPVEmulatorCheck(bool);
79 
80  inline void legacy(bool);
81 
82  void printWarningSummary() const { warnings_.printSummary(); }
83 
84  private:
86  void update(
87  RawDigis& scope_mode, RawDigis& virgin_raw, RawDigis& proc_raw, Digis& zero_suppr, RawDigis& common_mode);
88 
90  RawToDigiUnpacker() = delete;
91 
93  void updateEventSummary(const sistrip::FEDBuffer&, SiStripEventSummary&);
94 
96  inline void readoutOrder(uint16_t& physical_order, uint16_t& readout_order);
97 
99  inline void physicalOrder(uint16_t& readout_order, uint16_t& physical_order);
100 
102  inline sistrip::FedBufferFormat fedBufferFormat(const uint16_t& register_value);
103 
105  inline sistrip::FedReadoutMode fedReadoutMode(const uint16_t& register_value);
106 
108  static void dumpRawData(uint16_t fed_id, const FEDRawData&, std::stringstream&);
109 
111  void cleanupWorkVectors();
112 
114  class Registry {
115  public:
117  Registry(uint32_t aDetid, uint16_t firstStrip, size_t indexInVector, uint16_t numberOfDigis)
118  : detid(aDetid), first(firstStrip), index(indexInVector), length(numberOfDigis) {}
120  bool operator<(const Registry& other) const {
121  return (detid != other.detid ? detid < other.detid : first < other.first);
122  }
124  uint32_t detid;
125  uint16_t first;
126  size_t index;
127  uint16_t length;
128  };
129 
131  int16_t headerBytes_;
134  int16_t triggerFedId_;
138 
140  uint32_t event_;
141  bool once_;
142  bool first_;
144  bool quiet_;
148  bool legacy_;
149  uint32_t errorThreshold_;
150 
152  std::vector<Registry> zs_work_registry_;
153  std::vector<Registry> virgin_work_registry_;
154  std::vector<Registry> scope_work_registry_;
155  std::vector<Registry> proc_work_registry_;
156  std::vector<Registry> cm_work_registry_;
157 
159  std::vector<SiStripDigi> zs_work_digis_;
160  std::vector<SiStripRawDigi> virgin_work_digis_;
161  std::vector<SiStripRawDigi> scope_work_digis_;
162  std::vector<SiStripRawDigi> proc_work_digis_;
163  std::vector<SiStripRawDigi> cm_work_digis_;
164 
166  };
167 } // namespace sistrip
168 
169 void sistrip::RawToDigiUnpacker::readoutOrder(uint16_t& physical_order, uint16_t& readout_order) {
170  readout_order = (4 * ((static_cast<uint16_t>((static_cast<float>(physical_order) / 8.0))) % 4) +
171  static_cast<uint16_t>(static_cast<float>(physical_order) / 32.0) + 16 * (physical_order % 8));
172 }
173 
174 void sistrip::RawToDigiUnpacker::physicalOrder(uint16_t& readout_order, uint16_t& physical_order) {
175  physical_order = ((32 * (readout_order % 4)) + (8 * static_cast<uint16_t>(static_cast<float>(readout_order) / 4.0)) -
176  (31 * static_cast<uint16_t>(static_cast<float>(readout_order) / 16.0)));
177 }
178 
180  if ((register_value & 0xF) == 0x1) {
182  } else if ((register_value & 0xF) == 0x2) {
184  } else if ((register_value & 0xF) == 0x0) {
186  } else {
188  }
189 }
190 
192  return static_cast<sistrip::FedReadoutMode>(register_value & 0xF);
193 }
194 
195 void sistrip::RawToDigiUnpacker::quiet(bool quiet) { quiet_ = quiet; }
196 
197 void sistrip::RawToDigiUnpacker::useDaqRegister(bool use) { useDaqRegister_ = use; }
198 
199 void sistrip::RawToDigiUnpacker::extractCm(bool extract_cm) { extractCm_ = extract_cm; }
200 
201 void sistrip::RawToDigiUnpacker::doFullCorruptBufferChecks(bool do_full_corrupt_buffer_checks) {
202  doFullCorruptBufferChecks_ = do_full_corrupt_buffer_checks;
203 }
204 
205 void sistrip::RawToDigiUnpacker::doAPVEmulatorCheck(bool do_APVEmulator_check) {
206  doAPVEmulatorCheck_ = do_APVEmulator_check;
207 }
208 
209 void sistrip::RawToDigiUnpacker::legacy(bool legacy) { legacy_ = legacy; }
210 
211 #endif // EventFilter_SiStripRawToDigi_SiStripRawToDigiUnpacker_H
sistrip::RawToDigiUnpacker::scope_work_digis_
std::vector< SiStripRawDigi > scope_work_digis_
Definition: SiStripRawToDigiUnpacker.h:161
edm::DetSetVector< SiStripDigi >
sistrip::RawToDigiUnpacker::printWarningSummary
void printWarningSummary() const
Definition: SiStripRawToDigiUnpacker.h:82
Handle.h
Visibility.h
sistrip::RawToDigiUnpacker::proc_work_digis_
std::vector< SiStripRawDigi > proc_work_digis_
Definition: SiStripRawToDigiUnpacker.h:162
input
static const std::string input
Definition: EdmProvDump.cc:48
sistrip::RawToDigiUnpacker::errorThreshold_
uint32_t errorThreshold_
Definition: SiStripRawToDigiUnpacker.h:149
sistrip::UNDEFINED_FED_BUFFER_FORMAT
Definition: ConstantsForHardwareSystems.h:156
sistrip::RawToDigiUnpacker::doFullCorruptBufferChecks_
bool doFullCorruptBufferChecks_
Definition: SiStripRawToDigiUnpacker.h:146
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
sistrip::RawToDigiUnpacker::Registry::index
size_t index
Definition: SiStripRawToDigiUnpacker.h:126
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
sistrip::APV_ERROR_FORMAT
Definition: ConstantsForHardwareSystems.h:158
sistrip::RawToDigiUnpacker::doAPVEmulatorCheck_
bool doAPVEmulatorCheck_
Definition: SiStripRawToDigiUnpacker.h:147
sistrip::RawToDigiUnpacker::cm_work_digis_
std::vector< SiStripRawDigi > cm_work_digis_
Definition: SiStripRawToDigiUnpacker.h:163
sistrip::RawToDigiUnpacker::quiet_
bool quiet_
Definition: SiStripRawToDigiUnpacker.h:144
SiStripFedCabling
Contains cabling info at the device level, including DetId, APV pair numbers, hardware addresses,...
Definition: SiStripFedCabling.h:25
sistrip::RawToDigiUnpacker::markMissingFeds_
bool markMissingFeds_
Definition: SiStripRawToDigiUnpacker.h:137
dqmdumpme.first
first
Definition: dqmdumpme.py:55
FEDRawData
Definition: FEDRawData.h:19
sistrip::RawToDigiUnpacker::unpackBadChannels_
bool unpackBadChannels_
Definition: SiStripRawToDigiUnpacker.h:136
sistrip::RawToDigiUnpacker::cm_work_registry_
std::vector< Registry > cm_work_registry_
Definition: SiStripRawToDigiUnpacker.h:156
sistrip::RawToDigiUnpacker::warnings_
WarningSummary warnings_
Definition: SiStripRawToDigiUnpacker.h:165
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
SiStripRawDigi
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
Definition: SiStripRawDigi.h:15
sistrip::RawToDigiUnpacker::quiet
void quiet(bool)
verbosity
Definition: SiStripRawToDigiUnpacker.h:195
sistrip::RawToDigiUnpacker::Registry::first
uint16_t first
Definition: SiStripRawToDigiUnpacker.h:125
sistrip::RawToDigiUnpacker::doFullCorruptBufferChecks
void doFullCorruptBufferChecks(bool)
Definition: SiStripRawToDigiUnpacker.h:201
SiStripFEDBuffer.h
sistrip::RawToDigiUnpacker::Digis
edm::DetSetVector< SiStripDigi > Digis
Definition: SiStripRawToDigiUnpacker.h:35
sistrip::RawToDigiUnpacker::headerBytes_
int16_t headerBytes_
configurables
Definition: SiStripRawToDigiUnpacker.h:131
sistrip::FULL_DEBUG_FORMAT
Definition: ConstantsForHardwareSystems.h:157
trackingPlots.other
other
Definition: trackingPlots.py:1467
sistrip::RawToDigiUnpacker::useDaqRegister
void useDaqRegister(bool)
EventSummary update request -> not yet implemented for FEDBuffer class.
Definition: SiStripRawToDigiUnpacker.h:197
dso_hidden
#define dso_hidden
Definition: Visibility.h:12
sistrip::RawToDigiUnpacker::proc_work_registry_
std::vector< Registry > proc_work_registry_
Definition: SiStripRawToDigiUnpacker.h:155
sistrip::RawToDigiUnpacker::triggerFedId_
int16_t triggerFedId_
Definition: SiStripRawToDigiUnpacker.h:134
sistrip::RawToDigiUnpacker::zs_work_digis_
std::vector< SiStripDigi > zs_work_digis_
digi collections
Definition: SiStripRawToDigiUnpacker.h:159
sistrip::RawToDigiUnpacker::scope_work_registry_
std::vector< Registry > scope_work_registry_
Definition: SiStripRawToDigiUnpacker.h:154
sistrip::RawToDigiUnpacker::Registry::length
uint16_t length
Definition: SiStripRawToDigiUnpacker.h:127
sistrip::RawToDigiUnpacker::fedReadoutMode
sistrip::FedReadoutMode fedReadoutMode(const uint16_t &register_value)
returns buffer readout mode
Definition: SiStripRawToDigiUnpacker.h:191
WarningSummary.h
sistrip::RawToDigiUnpacker::virgin_work_registry_
std::vector< Registry > virgin_work_registry_
Definition: SiStripRawToDigiUnpacker.h:153
SiStripConstants.h
sistrip::UNKNOWN_FED_BUFFER_FORMAT
Definition: ConstantsForHardwareSystems.h:155
sistrip::RawToDigiUnpacker::Registry
private class to register start and end index of digis in a collection
Definition: SiStripRawToDigiUnpacker.h:114
sistrip::RawToDigiUnpacker::zs_work_registry_
std::vector< Registry > zs_work_registry_
registries
Definition: SiStripRawToDigiUnpacker.h:152
sistrip::fedchannelunpacker::detail::readoutOrder
uint16_t readoutOrder(uint16_t physical_order)
Definition: SiStripFEDBuffer.h:351
sistrip::RawToDigiUnpacker::legacy
void legacy(bool)
Definition: SiStripRawToDigiUnpacker.h:209
sistrip::RawToDigiUnpacker::physicalOrder
void physicalOrder(uint16_t &readout_order, uint16_t &physical_order)
order of strips
Definition: SiStripRawToDigiUnpacker.h:174
sistrip::RawToDigiUnpacker::doAPVEmulatorCheck
void doAPVEmulatorCheck(bool)
Definition: SiStripRawToDigiUnpacker.h:205
sistrip::RawToDigiUnpacker::Registry::detid
uint32_t detid
public data members
Definition: SiStripRawToDigiUnpacker.h:124
sistrip::RawToDigiUnpacker::extractCm
void extractCm(bool)
Definition: SiStripRawToDigiUnpacker.h:199
sistrip::RawToDigiUnpacker::extractCm_
bool extractCm_
Definition: SiStripRawToDigiUnpacker.h:145
DetSetVector.h
sistrip::FEDBuffer
Definition: SiStripFEDBuffer.h:24
edm::EDCollection< DetId >
sistrip::RawToDigiUnpacker::Registry::Registry
Registry(uint32_t aDetid, uint16_t firstStrip, size_t indexInVector, uint16_t numberOfDigis)
constructor
Definition: SiStripRawToDigiUnpacker.h:117
sistrip::RawToDigiUnpacker::first_
bool first_
Definition: SiStripRawToDigiUnpacker.h:142
sistrip::RawToDigiUnpacker::fedEventDumpFreq_
int16_t fedEventDumpFreq_
Definition: SiStripRawToDigiUnpacker.h:133
sistrip::RawToDigiUnpacker::once_
bool once_
Definition: SiStripRawToDigiUnpacker.h:141
sistrip::FedBufferFormat
FedBufferFormat
Definition: ConstantsForHardwareSystems.h:154
sistrip::RawToDigiUnpacker::useFedKey_
bool useFedKey_
Definition: SiStripRawToDigiUnpacker.h:135
sistrip::RawToDigiUnpacker
Definition: SiStripRawToDigiUnpacker.h:31
sistrip::RawToDigiUnpacker::fedBufferFormat
sistrip::FedBufferFormat fedBufferFormat(const uint16_t &register_value)
returns buffer format
Definition: SiStripRawToDigiUnpacker.h:179
sistrip::WarningSummary
Definition: WarningSummary.h:8
sistrip::RawToDigiUnpacker::legacy_
bool legacy_
Definition: SiStripRawToDigiUnpacker.h:148
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
sistrip::RawToDigiUnpacker::RawDigis
edm::DetSetVector< SiStripRawDigi > RawDigis
Definition: SiStripRawToDigiUnpacker.h:36
SiStripDigi
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Definition: SiStripDigi.h:12
sistrip::FedReadoutMode
FedReadoutMode
Definition: ConstantsForHardwareSystems.h:129
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
sistrip::RawToDigiUnpacker::fedBufferDumpFreq_
int16_t fedBufferDumpFreq_
Definition: SiStripRawToDigiUnpacker.h:132
SiStripEventSummary
Definition: SiStripEventSummary.h:22
event
Definition: event.py:1
sistrip::RawToDigiUnpacker::virgin_work_digis_
std::vector< SiStripRawDigi > virgin_work_digis_
Definition: SiStripRawToDigiUnpacker.h:160
sistrip::RawToDigiUnpacker::readoutOrder
void readoutOrder(uint16_t &physical_order, uint16_t &readout_order)
order of strips
Definition: SiStripRawToDigiUnpacker.h:169
sistrip::RawToDigiUnpacker::useDaqRegister_
bool useDaqRegister_
Definition: SiStripRawToDigiUnpacker.h:143
DetIdCollection.h
sistrip::RawToDigiUnpacker::event_
uint32_t event_
other values
Definition: SiStripRawToDigiUnpacker.h:140
sistrip::RawToDigiUnpacker::Registry::operator<
bool operator<(const Registry &other) const
< operator to sort registries
Definition: SiStripRawToDigiUnpacker.h:120
update
#define update(a, b)
Definition: TrackClassifier.cc:10