CMS 3D CMS Logo

SiStripRawToDigiModule.cc
Go to the documentation of this file.
1 
4 
14 #include <cstdlib>
15 
16 namespace sistrip {
17 
19  : rawToDigi_(nullptr),
20  cabling_(nullptr),
21  extractCm_(false),
22  doFullCorruptBufferChecks_(false),
23  doAPVEmulatorCheck_(true),
24  tTopoToken_(esConsumes()),
25  fedCablingToken_(esConsumes()) {
26  if (edm::isDebugEnabled()) {
27  LogTrace("SiStripRawToDigi") << "[sistrip::RawToDigiModule::" << __func__ << "]"
28  << " Constructing object...";
29  }
30 
31  token_ = consumes<FEDRawDataCollection>(pset.getParameter<edm::InputTag>("ProductLabel"));
32  int16_t appended_bytes = pset.getParameter<int>("AppendedBytes");
33  int16_t trigger_fed_id = pset.getParameter<int>("TriggerFedId");
34  bool legacy_unpacker = pset.getParameter<bool>("LegacyUnpacker");
35  bool use_daq_register = pset.getParameter<bool>("UseDaqRegister");
36  bool using_fed_key = pset.getParameter<bool>("UseFedKey");
37  bool unpack_bad_channels = pset.getParameter<bool>("UnpackBadChannels");
38  bool mark_missing_feds = pset.getParameter<bool>("MarkModulesOnMissingFeds");
39 
40  int16_t fed_buffer_dump_freq = pset.getUntrackedParameter<int>("FedBufferDumpFreq", 0);
41  int16_t fed_event_dump_freq = pset.getUntrackedParameter<int>("FedEventDumpFreq", 0);
42  bool quiet = pset.getUntrackedParameter<bool>("Quiet", true);
43  extractCm_ = pset.getParameter<bool>("UnpackCommonModeValues");
44  doFullCorruptBufferChecks_ = pset.getParameter<bool>("DoAllCorruptBufferChecks");
45  doAPVEmulatorCheck_ = pset.getParameter<bool>("DoAPVEmulatorCheck");
46 
47  uint32_t errorThreshold = pset.getParameter<unsigned int>("ErrorThreshold");
48 
49  rawToDigi_ = new sistrip::RawToDigiUnpacker(appended_bytes,
50  fed_buffer_dump_freq,
51  fed_event_dump_freq,
52  trigger_fed_id,
53  using_fed_key,
54  unpack_bad_channels,
55  mark_missing_feds,
56  errorThreshold);
57  rawToDigi_->legacy(legacy_unpacker);
58  rawToDigi_->quiet(quiet);
59  rawToDigi_->useDaqRegister(use_daq_register);
63 
64  produces<SiStripEventSummary>();
65  produces<edm::DetSetVector<SiStripRawDigi> >("ScopeMode");
66  produces<edm::DetSetVector<SiStripRawDigi> >("VirginRaw");
67  produces<edm::DetSetVector<SiStripRawDigi> >("ProcessedRaw");
68  produces<edm::DetSetVector<SiStripDigi> >("ZeroSuppressed");
69  produces<DetIdCollection>();
70  if (extractCm_)
71  produces<edm::DetSetVector<SiStripRawDigi> >("CommonMode");
72  }
73 
75  if (rawToDigi_) {
76  delete rawToDigi_;
77  }
78  if (cabling_) {
79  cabling_ = nullptr;
80  }
81  if (edm::isDebugEnabled()) {
82  LogTrace("SiStripRawToDigi") << "[sistrip::RawToDigiModule::" << __func__ << "]"
83  << " Destructing object...";
84  }
85  }
86 
95 
96  // Retrieve FED raw data (by label, which is "source" by default)
98  event.getByToken(token_, buffers);
99 
100  // Populate SiStripEventSummary object with "trigger FED" info
101  auto summary = std::make_unique<SiStripEventSummary>();
102  rawToDigi_->triggerFed(*buffers, *summary, event.id().event());
103 
104  // Create containers for digis
109  DetIdCollection* ids = new DetIdCollection();
111 
112  // Create digis
113  if (rawToDigi_) {
114  rawToDigi_->createDigis(*cabling_, *buffers, *summary, *sm, *vr, *pr, *zs, *ids, *cm);
115  }
116 
117  // Create unique_ptr's of digi products
118  std::unique_ptr<edm::DetSetVector<SiStripRawDigi> > sm_dsv(sm);
119  std::unique_ptr<edm::DetSetVector<SiStripRawDigi> > vr_dsv(vr);
120  std::unique_ptr<edm::DetSetVector<SiStripRawDigi> > pr_dsv(pr);
121  std::unique_ptr<edm::DetSetVector<SiStripDigi> > zs_dsv(zs);
122  std::unique_ptr<DetIdCollection> det_ids(ids);
123  std::unique_ptr<edm::DetSetVector<SiStripRawDigi> > cm_dsv(cm);
124 
125  // Add to event
126  event.put(std::move(summary));
127  event.put(std::move(sm_dsv), "ScopeMode");
128  event.put(std::move(vr_dsv), "VirginRaw");
129  event.put(std::move(pr_dsv), "ProcessedRaw");
130  event.put(std::move(zs_dsv), "ZeroSuppressed");
131  event.put(std::move(det_ids));
132  if (extractCm_)
133  event.put(std::move(cm_dsv), "CommonMode");
134  }
135 
138  const bool isFirst = cabling_ != nullptr;
139  cabling_ = &setup.getData(fedCablingToken_);
140 
141  if (edm::isDebugEnabled()) {
142  if (isFirst) {
143  std::stringstream ss;
144  ss << "[sistrip::RawToDigiModule::" << __func__ << "]"
145  << " Updating cabling for first time..." << std::endl
146  << " Terse print out of FED cabling:" << std::endl;
147  cabling_->terse(ss);
148  LogTrace("SiStripRawToDigi") << ss.str();
149  }
150  }
151 
152  if (edm::isDebugEnabled()) {
153  std::stringstream sss;
154  sss << "[sistrip::RawToDigiModule::" << __func__ << "]"
155  << " Summary of FED cabling:" << std::endl;
156  cabling_->summary(sss, &setup.getData(tTopoToken_));
157  LogTrace("SiStripRawToDigi") << sss.str();
158  }
159  }
160  }
161 
163 } // namespace sistrip
edm::ESWatcher::check
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
edm::DetSetVector< SiStripRawDigi >
sistrip::RawToDigiUnpacker::printWarningSummary
void printWarningSummary() const
Definition: SiStripRawToDigiUnpacker.h:82
Handle.h
MessageLogger.h
funct::false
false
Definition: Factorize.h:29
sistrip::RawToDigiModule::extractCm_
bool extractCm_
Definition: SiStripRawToDigiModule.h:48
sistrip::RawToDigiModule::~RawToDigiModule
~RawToDigiModule() override
Definition: SiStripRawToDigiModule.cc:74
SiStripRawDigi.h
sistrip::RawToDigiModule::rawToDigi_
RawToDigiUnpacker * rawToDigi_
Definition: SiStripRawToDigiModule.h:45
SiStripRawToDigiUnpacker.h
SiStripFedCabling.h
sistrip::RawToDigiModule::token_
edm::EDGetTokenT< FEDRawDataCollection > token_
Definition: SiStripRawToDigiModule.h:46
cuy.isFirst
isFirst
Definition: cuy.py:418
edm::Handle< FEDRawDataCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
sistrip::RawToDigiModule::fedCablingWatcher_
edm::ESWatcher< SiStripFedCablingRcd > fedCablingWatcher_
Definition: SiStripRawToDigiModule.h:56
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
sistrip::RawToDigiUnpacker::quiet
void quiet(bool)
verbosity
Definition: SiStripRawToDigiUnpacker.h:195
sistrip::RawToDigiUnpacker::createDigis
void createDigis(const SiStripFedCabling &, const FEDRawDataCollection &, SiStripEventSummary &, RawDigis &scope_mode, RawDigis &virgin_raw, RawDigis &proc_raw, Digis &zero_suppr, DetIdCollection &, RawDigis &common_mode)
creates digis
Definition: SiStripRawToDigiUnpacker.cc:84
sistrip::RawToDigiUnpacker::doFullCorruptBufferChecks
void doFullCorruptBufferChecks(bool)
Definition: SiStripRawToDigiUnpacker.h:201
SiStripDigi.h
sistrip::RawToDigiModule::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: SiStripRawToDigiModule.cc:93
sistrip::RawToDigiUnpacker::useDaqRegister
void useDaqRegister(bool)
EventSummary update request -> not yet implemented for FEDBuffer class.
Definition: SiStripRawToDigiUnpacker.h:197
SiStripEventSummary.h
funct::true
true
Definition: Factorize.h:173
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:47
sipixeldigitoraw
Definition: SiPixelDigiToRaw.cc:32
sistrip::RawToDigiUnpacker::triggerFed
void triggerFed(const FEDRawDataCollection &, SiStripEventSummary &, const uint32_t &event)
trigger info
Definition: SiStripRawToDigiUnpacker.cc:727
sistrip::RawToDigiModule::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripRawToDigiModule.h:54
sistrip::RawToDigiUnpacker::legacy
void legacy(bool)
Definition: SiStripRawToDigiUnpacker.h:209
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
sistrip::RawToDigiModule::RawToDigiModule
RawToDigiModule(const edm::ParameterSet &)
Definition: SiStripRawToDigiModule.cc:18
sistrip::RawToDigiUnpacker::doAPVEmulatorCheck
void doAPVEmulatorCheck(bool)
Definition: SiStripRawToDigiUnpacker.h:205
sistrip::RawToDigiUnpacker::extractCm
void extractCm(bool)
Definition: SiStripRawToDigiUnpacker.h:199
edm::EventSetup
Definition: EventSetup.h:58
sistrip::RawToDigiModule::cabling_
const SiStripFedCabling * cabling_
Definition: SiStripRawToDigiModule.h:47
DetSetVector.h
edm::EDCollection< DetId >
eostools.move
def move(src, dest)
Definition: eostools.py:511
sistrip::RawToDigiModule::endStream
void endStream() override
Definition: SiStripRawToDigiModule.cc:162
DetIdCollection
edm::EDCollection< DetId > DetIdCollection
Definition: DetIdCollection.h:7
sistrip::RawToDigiModule::doFullCorruptBufferChecks_
bool doFullCorruptBufferChecks_
Definition: SiStripRawToDigiModule.h:49
sistrip::RawToDigiModule::updateCabling
void updateCabling(const edm::EventSetup &)
Definition: SiStripRawToDigiModule.cc:136
sistrip::RawToDigiUnpacker
Definition: SiStripRawToDigiUnpacker.h:31
SiStripRawToDigiModule.h
SiStripFedCabling::summary
void summary(std::stringstream &ss, const TrackerTopology *trackerTopo) const
LEFT FOR COMPATIBILITY. SHOULD BE REPLACED BY PRINTSUMMARY.
Definition: SiStripFedCabling.h:101
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
SiStripFedCabling::terse
void terse(std::stringstream &) const
Definition: SiStripFedCabling.cc:249
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
sistrip
sistrip classes
Definition: EnsembleCalibrationLA.cc:10
event
Definition: event.py:1
DeDxTools::esConsumes
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
DetIdCollection.h
sistrip::RawToDigiModule::fedCablingToken_
edm::ESGetToken< SiStripFedCabling, SiStripFedCablingRcd > fedCablingToken_
Definition: SiStripRawToDigiModule.h:55
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
sistrip::RawToDigiModule::doAPVEmulatorCheck_
bool doAPVEmulatorCheck_
Definition: SiStripRawToDigiModule.h:52