23 for (
const auto&
inputTag : conf.
getParameter<std::vector<edm::InputTag>>(
"RawDigiProducersList")) {
25 produces<edm::DetSetVector<SiStripDigi>>(
tagName);
27 produces<edm::DetSetVector<SiStripRawDigi>>(
tagName);
29 produces<edm::DetSetVector<SiStripProcessedRawDigi>>(
"APVCM" +
tagName);
31 produces<edm::DetSetVector<SiStripProcessedRawDigi>>(
"BADAPVBASELINE" +
tagName);
33 produces<edm::DetSetVector<SiStripDigi>>(
"BADAPVBASELINEPOINTS" +
tagName);
36 if (
tagName ==
"ProcessedRaw") {
39 throw cms::Exception(
"Processed Raw Cannot be converted in hybrid Format");
40 }
else if (
tagName ==
"VirginRaw") {
42 }
else if (
tagName ==
"ScopeMode") {
45 throw cms::Exception(
"Scope Mode cannot be converted in hybrid Format");
49 }
else if (
tagName ==
"ZeroSuppressed") {
54 <<
"SiStripZeroZuppression can only process types \"VirginRaw\", \"ProcessedRaw\" and \"ZeroSuppressed\"";
61 throw cms::Exception(
"Invalid option") <<
"When producing data in the hybrid format, the APV restorer must be "
62 "configured with APVInspectMode='HybridEmulation'";
65 edm::LogInfo(
"SiStripZeroSuppression") <<
"Raw digis will not be saved for hybrid inputs";
87 e.getByToken(std::get<rawtoken_t>(
input), inDigis);
88 if (!inDigis->empty())
95 e.getByToken(std::get<zstoken_t>(
input), inDigis);
96 if (!inDigis->empty()) {
123 for (
const auto& rawDigis :
input) {
126 int16_t nAPVflagged = 0;
128 nAPVflagged =
algorithms->suppressProcessedRawData(rawDigis, suppressedDigis);
130 nAPVflagged =
algorithms->suppressVirginRawData(rawDigis, suppressedDigis);
133 nAPVflagged =
algorithms->convertVirginRawToHybrid(rawDigis, suppressedDigis);
135 nAPVflagged =
algorithms->suppressVirginRawData(rawDigis, suppressedDigis);
150 for (
const auto& inDigis :
input) {
153 uint16_t nAPVflagged = 0;
154 nAPVflagged =
algorithms->suppressHybridData(inDigis, suppressedDigis);
157 if (!suppressedDigis.
empty())
165 const std::vector<bool>& apvf =
algorithms->getAPVFlags();
167 for (
const auto rawDigi : rawDigis) {
168 int16_t apvN =
strip / 128;
179 const std::vector<int16_t>& rawDigis) {
181 outRawDigis.
reserve(rawDigis.size());
182 const std::vector<bool>& apvf =
algorithms->getAPVFlags();
184 for (
const auto rawDigi : rawDigis) {
185 int16_t apvN =
strip / 128;
196 const auto& vmedians =
algorithms->getAPVsCM();
199 if (nAPVflagged > 0) {
208 const auto& baselinemap =
algorithms->getBaselineMap();
211 baselineDetSet.
reserve(vmedians.size() * 128);
212 for (
const auto& vmed : vmedians) {
213 const uint16_t apvN = vmed.first;
214 const float median = vmed.second;
215 auto itBaselineMap = baselinemap.find(apvN);
216 if (baselinemap.end() == itBaselineMap) {
225 if (!baselineDetSet.
empty())
231 for (
const auto& itBaselinePointVect :
algorithms->getSmoothedPoints()) {
232 const uint16_t apvN = itBaselinePointVect.first;
233 for (
const auto& itBaselinePointMap : itBaselinePointVect.second) {
234 const uint16_t bpstrip = itBaselinePointMap.first + apvN * 128;
235 const int16_t bp = itBaselinePointMap.second;
240 if (!baspointDetSet.
empty())
245 std::vector<bool> apvf(6,
false);
247 const auto& apvFlagged =
algorithms->getAPVFlags();
253 for (
const auto& vmed : vmedians) {
254 if (vmed.first > apvNb) {
255 for (
int i{0};
i < vmed.first - apvNb; ++
i) {
261 if (
fixCM && apvf[vmed.first]) {
269 if (!apvDetSet.
empty())