32 badPixelInfo_(nullptr),
33 modulesToUnpack_(nullptr),
37 int s8 =
sizeof(char);
38 if (s8 != 1 || s32 != 4 * s8 || s64 != 2 * s32) {
39 LogError(
"UnexpectedSizes") <<
" unexpected sizes: " 40 <<
" size of char is: " << s8 <<
", size of Word32 is: " << s32
41 <<
", size of Word64 is: " << s64 <<
", send exception";
89 bool moreHeaders =
true;
94 moreHeaders = headerStatus;
98 bool moreTrailers =
true;
100 while (moreTrailers) {
104 moreTrailers = trailerStatus;
114 unsigned int rawId = 0;
115 unsigned int nrawId = 0;
117 bool skipROC =
false;
122 if (*(ew - 1) == 0) {
137 if ((nlink !=
link) | (nroc !=
roc)) {
147 errorsInEvent =
true;
152 rawId = rocp->
rawId();
155 layer = PixelROC::bpixLayerPhase1(rawId);
175 std::unique_ptr<LocalPixel>
local;
184 LogDebug(
"PixelDataFormatter::interpretRawData") <<
"status #3";
185 errorsInEvent =
true;
189 local = std::make_unique<LocalPixel>(localCR);
197 LogDebug(
"PixelDataFormatter::interpretRawData") <<
"status #3";
198 errorsInEvent =
true;
202 local = std::make_unique<LocalPixel>(localDP);
205 if (nrawId != rawId) {
208 if ((*detDigis).empty()) {
209 (*detDigis).
data.reserve(32);
215 (*detDigis).data.emplace_back(global.
row, global.
col,
adc);
216 LogTrace(
"") << (*detDigis).data.back();
218 LogError(
"NullPointerException") <<
"@SUB=PixelDataFormatter::interpretRawData" 219 <<
"DetSet pointer not set. This is not supposed to happen.";
228 std::map<int, vector<Word32> > words;
231 for (Digis::const_iterator im = digis.begin(); im != digis.end(); im++) {
237 layer = PixelROC::bpixLayerPhase1(rawId);
239 BadChannels::const_iterator detBadChannels = badChannels.find(rawId);
242 const DetDigis& detDigis = im->second;
243 for (DetDigis::const_iterator it = detDigis.begin(); it != detDigis.end(); it++) {
256 <<
" detector: " << rawId << endl
257 <<
print(digi) << endl;
258 }
else if (detBadChannels != badChannels.end()) {
260 std::find_if(detBadChannels->second.begin(), detBadChannels->second.end(), [&](
const PixelFEDChannel& ch) {
263 if (badChannel != detBadChannels->second.end()) {
264 LogError(
"FormatDataException") <<
" while marked bad, found digi for FED " <<
fedId <<
" Link " 265 <<
getLink(words[
fedId].back()) <<
" on module " << rawId << endl
266 <<
print(digi) << endl;
274 for (
const auto& detBadChannels : badChannels) {
275 for (
const auto& badChannel : detBadChannels.second) {
276 unsigned int FEDError25 = 25;
278 words[badChannel.fed].push_back(
word);
283 typedef std::map<int, vector<Word32> >::const_iterator RI;
284 for (RI feddata = words.begin(); feddata != words.end(); feddata++) {
285 int fedId = feddata->first;
288 if (words.find(
fedId)->second.size() % 2 != 0)
292 int dataSize = words.find(
fedId)->second.size() *
sizeof(
Word32);
295 dataSize += (nHeaders + nTrailers) *
sizeof(
Word64);
306 unsigned int nWord32InFed = words.find(
fedId)->second.size();
307 for (
unsigned int i = 0;
i < nWord32InFed;
i += 2) {
318 if (
word != reinterpret_cast<Word64*>(
rawData->data() + dataSize)) {
319 string s =
"** PROBLEM in PixelDataFormatter !!!";
329 std::map<
int, vector<Word32> >& words)
const {
347 std::map<
int, vector<Word32> >& words)
const {
356 int col = ((cabling.
dcol) * 2) + ((cabling.
pxid) % 2);
369 str <<
" DIGI: row: " << digi.
row() <<
", col: " << digi.
column() <<
", adc: " << digi.
adc();
375 str <<
"word64: " <<
reinterpret_cast<const bitset<64>&
>(
word);
380 std::vector<int>
const& tkerrorlist,
381 std::vector<int>
const& usererrorlist,
390 nodeterrors.insert(nodeterrors.end(), rawErrorsVec.begin(), rawErrorsVec.end());
393 errorDetSet.
data.insert(errorDetSet.
data.end(), rawErrorsVec.begin(), rawErrorsVec.end());
399 std::vector<PixelFEDChannel> disabledChannelsDetSet;
401 for (
auto const& aPixelError : errorDetSet) {
404 if (
phase1_ && aPixelError.getType() == 25) {
405 int fedId = aPixelError.getFedId();
414 for (
unsigned int iRoc = 1; iRoc <=
link->numberOfROCs(); iRoc++) {
421 disabledChannelsDetSet.push_back(ch);
426 if (!tkerrorlist.empty()) {
427 auto it_find =
std::find(tkerrorlist.begin(), tkerrorlist.end(), aPixelError.getType());
428 if (it_find != tkerrorlist.end()) {
435 if (!usererrorlist.empty()) {
436 auto it_find =
std::find(usererrorlist.begin(), usererrorlist.end(), aPixelError.getType());
437 if (it_find != usererrorlist.end()) {
444 if (!disabledChannelsDetSet.empty()) {
445 disabled_channelcollection.
insert(
errorDetId, disabledChannelsDetSet.data(), disabledChannelsDetSet.size());
constexpr uint32_t getRow(uint32_t ww)
constexpr cms_uint32_t dummyDetId
const PixelFEDLink * link(unsigned int id) const
return link identified by id. Link id's are ranged [1, numberOfLinks]
int toCabling(sipixelobjects::ElectronicIndex &cabling, const sipixelobjects::DetectorIndex &detector) const
constexpr uint32_t DCOL_shift
constexpr uint32_t PXID_shift
bool IsRocBad(const uint32_t &detid, const short &rocNb) const
constexpr uint32_t COL_shift
constexpr uint32_t getCol(uint32_t ww)
constexpr uint16_t numRowsInRoc
constexpr uint32_t ROC_shift
void push_back(T const &t)
constexpr uint32_t ADC_shift
constexpr uint32_t ROW_shift
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned short adc() const
constexpr std::array< uint8_t, layerIndexSize > layer
reference find_or_insert(det_id_type id)
global coordinates (row and column in DetUnit, as in PixelDigi)
constexpr uint32_t getPxId(uint32_t ww)
static void set(unsigned char *trailer, uint32_t lenght, uint16_t crc, uint8_t evt_stat, uint8_t tts, bool moreTrailers=false)
Set all fields in the trailer.
GlobalPixel toGlobal(const LocalPixel &loc) const
constexpr uint32_t getDCol(uint32_t ww)
constexpr uint32_t getADC(uint32_t ww)
constexpr uint32_t getLink(uint32_t ww)
unsigned int cms_uint32_t
DetSet insert(id_type iid, data_type const *idata, size_type isize)
double collumn and pixel ID in double collumn representation
constexpr uint32_t getROC(uint32_t ww)
const PixelFEDCabling * fed(unsigned int idFed) const
get fed identified by its id
constexpr uint32_t LINK_shift
virtual bool isBarrel() const
true for barrel modules
row and collumn in ROC representation
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
uint32_t rawId() const
return the DetUnit to which this ROC belongs to.
unsigned int idInDetUnit() const
id of this ROC in DetUnit etermined by token path
uint16_t *__restrict__ uint16_t const *__restrict__ adc