24 for (
const auto&
inputTag : conf.
getParameter<std::vector<edm::InputTag>>(
"RawDigiProducersList")) {
26 produces<edm::DetSetVector<SiStripDigi>>(
tagName);
28 produces<edm::DetSetVector<SiStripRawDigi>>(
tagName);
30 produces<edm::DetSetVector<SiStripProcessedRawDigi>>(
"APVCM" +
tagName);
32 produces<edm::DetSetVector<SiStripProcessedRawDigi>>(
"BADAPVBASELINE" +
tagName);
34 produces<edm::DetSetVector<SiStripDigi>>(
"BADAPVBASELINEPOINTS" +
tagName);
37 if (
tagName ==
"ProcessedRaw") {
40 throw cms::Exception(
"Processed Raw Cannot be converted in hybrid Format");
41 }
else if (
tagName ==
"VirginRaw") {
43 }
else if (
tagName ==
"ScopeMode") {
46 throw cms::Exception(
"Scope Mode cannot be converted in hybrid Format");
50 }
else if (
tagName ==
"ZeroSuppressed") {
55 <<
"SiStripZeroZuppression can only process types \"VirginRaw\", \"ProcessedRaw\" and \"ZeroSuppressed\"";
62 throw cms::Exception(
"Invalid option") <<
"When producing data in the hybrid format, the APV restorer must be " 63 "configured with APVInspectMode='HybridEmulation'";
66 edm::LogInfo(
"SiStripZeroSuppression") <<
"Raw digis will not be saved for hybrid inputs";
88 e.getByToken(std::get<rawtoken_t>(
input), inDigis);
89 if (!inDigis->empty())
96 e.getByToken(std::get<zstoken_t>(
input), inDigis);
97 if (!inDigis->empty()) {
124 for (
const auto& rawDigis :
input) {
127 int16_t nAPVflagged = 0;
129 nAPVflagged =
algorithms->suppressProcessedRawData(rawDigis, suppressedDigis);
131 nAPVflagged =
algorithms->suppressVirginRawData(rawDigis, suppressedDigis);
134 nAPVflagged =
algorithms->convertVirginRawToHybrid(rawDigis, suppressedDigis);
136 nAPVflagged =
algorithms->suppressVirginRawData(rawDigis, suppressedDigis);
151 for (
const auto& inDigis :
input) {
154 uint16_t nAPVflagged = 0;
155 nAPVflagged =
algorithms->suppressHybridData(inDigis, suppressedDigis);
158 if (!suppressedDigis.
empty())
166 const std::vector<bool>& apvf =
algorithms->getAPVFlags();
168 for (
const auto rawDigi : rawDigis) {
169 int16_t apvN =
strip / 128;
180 const std::vector<int16_t>& rawDigis) {
182 outRawDigis.
reserve(rawDigis.size());
183 const std::vector<bool>& apvf =
algorithms->getAPVFlags();
185 for (
const auto rawDigi : rawDigis) {
186 int16_t apvN =
strip / 128;
197 const auto& vmedians =
algorithms->getAPVsCM();
200 if (nAPVflagged > 0) {
209 const auto& baselinemap =
algorithms->getBaselineMap();
212 baselineDetSet.
reserve(vmedians.size() * 128);
213 for (
const auto& vmed : vmedians) {
214 const uint16_t apvN = vmed.first;
215 const float median = vmed.second;
216 auto itBaselineMap = baselinemap.find(apvN);
217 if (baselinemap.end() == itBaselineMap) {
226 if (!baselineDetSet.
empty())
232 for (
const auto& itBaselinePointVect :
algorithms->getSmoothedPoints()) {
233 const uint16_t apvN = itBaselinePointVect.first;
234 for (
const auto& itBaselinePointMap : itBaselinePointVect.second) {
235 const uint16_t bpstrip = itBaselinePointMap.first + apvN * 128;
236 const int16_t bp = itBaselinePointMap.second;
241 if (!baspointDetSet.
empty())
246 std::vector<bool> apvf(6,
false);
248 const auto& apvFlagged =
algorithms->getAPVFlags();
254 for (
const auto& vmed : vmedians) {
255 if (vmed.first > apvNb) {
256 for (
int i{0};
i < vmed.first - apvNb; ++
i) {
262 if (
fixCM && apvf[vmed.first]) {
270 if (!apvDetSet.
empty())
T getParameter(std::string const &) const
void storeBaselinePoints(uint32_t)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void push_back(const T &t)
std::vector< edm::DetSet< SiStripDigi > > output_base
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_baseline
def create(alignables, pedeDump, additionalData, outputFile, config)
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< std::tuple< std::string, zstoken_t > > hybridInputs
A signed Digi for the silicon strip detector, containing only adc information, and suitable for stori...
bool produceCalculatedBaseline
bool produceBaselinePoints
void processRaw(const edm::DetSetVector< SiStripRawDigi > &input, RawType inType)
std::vector< edm::DetSet< SiStripProcessedRawDigi > > output_apvcm
static std::string const input
void storeExtraOutput(uint32_t, int16_t)
std::unique_ptr< SiStripRawProcessingAlgorithms > algorithms
std::vector< edm::DetSet< SiStripDigi > > output_baseline_points
std::vector< std::tuple< std::string, RawType, rawtoken_t > > rawInputs
A Digi for the silicon strip detector, containing both strip and adc information, and suitable for st...
Log< level::Info, false > LogInfo
void storeBaseline(uint32_t, const medians_t &)
std::vector< edm::DetSet< SiStripRawDigi > > output_base_raw
void storeCMN(uint32_t, const medians_t &)
std::vector< std::pair< short, float > > medians_t
void processHybrid(const edm::DetSetVector< SiStripDigi > &input)
SiStripZeroSuppression(const edm::ParameterSet &)
edm::DetSet< SiStripRawDigi > formatRawDigis(const edm::DetSet< SiStripRawDigi > &rawDigis)
void putOutputs(edm::Event &evt, const std::string &tagName)
A Digi for the silicon strip detector, containing only adc information, and suitable for storing raw ...
produceCalculatedBaseline