34 Tile::MAX_ROS - 1, Tile::MAX_DRAWER,
38 Tile::MAX_ROS - 1, Tile::MAX_DRAWER,
42 Tile::MAX_ROS - 1, Tile::MAX_DRAWER,
46 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
49 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
60 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
65 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
70 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
75 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
80 Tile::MAX_ROS - 1, Tile::MAX_DRAWER);
83 return StatusCode::SUCCESS;
94 std::vector<float> meanSample[Tile::MAX_GAIN];
95 std::vector<float> meanSampleChannel[Tile::MAX_GAIN];
97 std::vector<float> meanSampleProd[Tile::MAX_GAIN];
98 std::vector<float> meanSampleProdChannel1[Tile::MAX_GAIN];
99 std::vector<float> meanSampleProdChannel2[Tile::MAX_GAIN];
110 if (digitsCollection->empty() )
continue;
112 HWIdentifier adc_id = digitsCollection->front()->adc_HWID();
118 const std::vector<uint32_t>& headerWordsLow = digitsCollection->getFragChipHeaderWords();
119 const std::vector<uint32_t>& headerWordsHigh = digitsCollection->getFragChipHeaderWordsHigh();
120 std::vector<std::reference_wrapper<const std::vector<uint32_t>>> headerWordsAll{headerWordsLow};
121 if (headerWordsHigh.empty()) {
123 headerWordsAll.push_back(headerWordsLow);
125 headerWordsAll.push_back(headerWordsHigh);
128 std::vector<std::vector<bool>> corruptedData(Tile::MAX_GAIN, std::vector<bool>(
MAX_DMU));
129 uint32_t fragStatus = digitsCollection->getFragStatus();
135 uint32_t rodBCID = digitsCollection->getRODBCID();
138 bool isCalibMode = (dqStatus->
calibMode() == 1);
141 int nDMU = headerWordsLow.size();
142 uint32_t crc32 = digitsCollection->getFragCRC();
143 uint32_t crcMask = digitsCollection->getFragDMUMask();
153 charge = cispar[6] * cispar[7] * (2. * 4.096 / 4095.);
155 charge = cispar[6] * cispar[7] * (2. * 4.096 / 1023.);
158 const TileDigits* moduleDigits[Tile::MAX_CHAN][Tile::MAX_GAIN] = {{
nullptr}};
160 for (
const TileDigits* tile_digits : *digitsCollection) {
174 const std::vector<float>& digits = tile_digits->samples();
175 unsigned int nSamples = digits.size();
180 double pedestal = digits[0];
192 double sampleMean = 0.0;
193 double sampleRMS = 0.0;
195 for (
double sample : digits) {
200 fill(
"TileDigitsOverflow", monCharge);
205 sampleRMS = sampleRMS /
nSamples - sampleMean * sampleMean;
206 sampleRMS = (sampleRMS > 0.0) ? sqrt(sampleRMS *
nSamples / (
nSamples - 1)) : 0.0;
209 meanSample[
adc].push_back(sampleMean);
218 || (cispar[6] > 0. && (
adc < 1 ||
charge < 12.))) {
228 std::vector<int> sampleNumbers(
nSamples);
229 std::iota(sampleNumbers.begin(), sampleNumbers.end(), 0);
236 int evtMod32 = (ctx.evt() + 1) % 32;
245 for (
unsigned int gain = 0;
gain < Tile::MAX_GAIN; ++
gain) {
251 for (
int channel1 : meanSampleChannel[
gain]) {
252 const std::vector<float>& digits1 = moduleDigits[channel1][
gain]->
samples();
253 for (
int channel2 : meanSampleChannel[
gain]) {
254 const std::vector<float>& digits2 = moduleDigits[channel2][
gain]->
samples();
255 double sampleProdMean = 0.;
256 unsigned int nSamples = digits1.size();
258 sampleProdMean += digits1[
i] * digits2[
i];
261 meanSampleProd[
gain].push_back(sampleProdMean);
262 meanSampleProdChannel1[
gain].push_back(channel1);
263 meanSampleProdChannel2[
gain].push_back(channel2);
271 meanSample[
gain].clear();
272 meanSampleChannel[
gain].clear();
274 meanSampleProd[
gain].clear();
275 meanSampleProdChannel1[
gain].clear();
276 meanSampleProdChannel2[
gain].clear();
291 return StatusCode::SUCCESS;
312 int dmuFE_EB[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 12, 13, 8, 9, 10, 11, 14, 15 };
313 int dmuFE_EB_special[16] = { 11, 0, 1, 2, 3, 4, 5, 6, 12, 13, 7, 8, 9, 10, 14, 15 };
319 int crcGlobal = (crc32 == 0) ? 0 : (crc0 == crc1) ? 1 : 2;
326 for (
int dmu = 0; dmu < nDMU; ++dmu) {
342 for (
int dmu = 0; dmu < nDMU; ++dmu) {
348 for (
int dmu = 0; dmu < nDMU; ++dmu) {
355 for (
int dmu = 0; dmu < nDMU; ++dmu) {
358 if ((fe_crc >> dmu & 0
x1) == 0x0) {
365 if ((fe_crc >> dmuFE_EB_special[dmu] & 0
x1) == 0x0) {
369 if ((fe_crc >> dmuFE_EB[dmu] & 0
x1) == 0x0) {
374 if ((rod_crc >> dmu & 0
x1) == 0x0) {
406 if (rawChannelCollection->empty())
continue;
408 HWIdentifier hwid = rawChannelCollection->front()->adc_HWID();
411 uint32_t crc32 = rawChannelCollection->getFragGlobalCRC() & 1;
419 uint32_t maskCRC = rawChannelCollection->getFragRODChipMask();
420 maskCRC = maskCRC << 16;
421 maskCRC += rawChannelCollection->getFragFEChipMask();
425 return StatusCode::SUCCESS;
430 uint32_t fragStatus,
int ros,
int drawer, std::vector<std::vector<bool>>& corruptedData)
const {
438 std::vector<int> dmus;
443 if (fragStatus & (TileFragStatus::ALL_FF | TileFragStatus::ALL_00)) {
445 }
else if (fragStatus & (TileFragStatus::NO_FRAG | TileFragStatus::NO_ROB)) {
448 for (
int dmu = 0; dmu <
MAX_DMU; ++dmu) {
453 for (
unsigned int gain = 0;
gain < Tile::MAX_GAIN; ++
gain) {
482 for (
auto headerWords : headerWordsAll) {
489 corruptedData[
gain][dmu] =
true;
493 corruptedData[
gain][dmu] =
true;
518 corruptedData[
gain][dmu] =
true;
537 for (
auto headerWords : headerWordsAll) {
544 if ((dmuBCID == rodBCID) || (dmuBCID == rodBCID - 1)
545 || ((rodBCID == 0) && ((dmuBCID == 3563) || (dmuBCID == 3564)))) {