Skip to content

Commit

Permalink
Merge pull request cms-sw#26679 from veszpv/RestoreFEDErrorTreatmentF…
Browse files Browse the repository at this point in the history
…orPhase0v2

Restore fed error treatment for phase0 pixel detector
  • Loading branch information
cmsbuild authored May 13, 2019
2 parents 5d7c99f + afe87d4 commit b45186e
Show file tree
Hide file tree
Showing 8 changed files with 423 additions and 29 deletions.
27 changes: 9 additions & 18 deletions EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@
*
*/

#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h"
#include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerBase.h"
#include "FWCore/Utilities/interface/typedefs.h"

#include <vector>
#include <map>

class FEDRawData;

class SiPixelFrameConverter;
class SiPixelFedCabling;

class ErrorChecker {
class ErrorChecker : public ErrorCheckerBase {

public:
// typedef unsigned int Word32;
// typedef long long Word64;
typedef cms_uint32_t Word32;
typedef cms_uint64_t Word64;

Expand All @@ -29,29 +20,29 @@ class ErrorChecker {

ErrorChecker();

void setErrorStatus(bool ErrorStatus);
void setErrorStatus(bool ErrorStatus) override;

bool checkCRC(bool& errorsInEvent, int fedId, const Word64* trailer, Errors& errors);
bool checkCRC(bool& errorsInEvent, int fedId, const Word64* trailer, Errors& errors) override;

bool checkHeader(bool& errorsInEvent, int fedId, const Word64* header, Errors& errors);
bool checkHeader(bool& errorsInEvent, int fedId, const Word64* header, Errors& errors) override;

bool checkTrailer(bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, Errors& errors);
bool checkTrailer(bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, Errors& errors) override;

bool checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameConverter* converter,
const SiPixelFedCabling* theCablingTree,
Word32& errorWord, Errors& errors);
Word32& errorWord, Errors& errors) override;



void conversionError(int fedId, const SiPixelFrameConverter* converter,
int status, Word32& errorWord, Errors& errors);
int status, Word32& errorWord, Errors& errors) override;

private:

bool includeErrors;

cms_uint32_t errorDetId(const SiPixelFrameConverter* converter,
int errorType, const Word32 & word) const;
int errorType, const Word32 & word) const override;

};

Expand Down
52 changes: 52 additions & 0 deletions EventFilter/SiPixelRawToDigi/interface/ErrorCheckerBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#ifndef ErrorCheckerBase_H
#define ErrorCheckerBase_H
/** \class ErrorCheckerBase
*
*
*/

#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h"

#include <vector>
#include <map>


class SiPixelFrameConverter;
class SiPixelFedCabling;

class ErrorCheckerBase {

public:
typedef cms_uint32_t Word32;
typedef cms_uint64_t Word64;

typedef std::vector<SiPixelRawDataError> DetErrors;
typedef std::map<cms_uint32_t, DetErrors> Errors;

virtual ~ErrorCheckerBase() {};

virtual void setErrorStatus(bool ErrorStatus)=0;

virtual bool checkCRC(bool& errorsInEvent, int fedId, const Word64* trailer, Errors& errors)=0;

virtual bool checkHeader(bool& errorsInEvent, int fedId, const Word64* header, Errors& errors)=0;

virtual bool checkTrailer(bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, Errors& errors)=0;

virtual bool checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameConverter* converter,
const SiPixelFedCabling* theCablingTree,
Word32& errorWord, Errors& errors)=0;



virtual void conversionError(int fedId, const SiPixelFrameConverter* converter,
int status, Word32& errorWord, Errors& errors)=0;

private:

virtual cms_uint32_t errorDetId(const SiPixelFrameConverter* converter,
int errorType, const Word32 & word) const =0;

};

#endif
49 changes: 49 additions & 0 deletions EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifndef ErrorCheckerPhase0_H
#define ErrorCheckerPhase0_H
/** \class ErrorCheckerPhase0
*
*
*/

#include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerBase.h"
#include "FWCore/Utilities/interface/typedefs.h"


class ErrorCheckerPhase0 : public ErrorCheckerBase {

public:
typedef cms_uint32_t Word32;
typedef cms_uint64_t Word64;

typedef std::vector<SiPixelRawDataError> DetErrors;
typedef std::map<cms_uint32_t, DetErrors> Errors;

ErrorCheckerPhase0();

void setErrorStatus(bool ErrorStatus) override;

bool checkCRC(bool& errorsInEvent, int fedId, const Word64* trailer, Errors& errors) override;

bool checkHeader(bool& errorsInEvent, int fedId, const Word64* header, Errors& errors) override;

bool checkTrailer(bool& errorsInEvent, int fedId, unsigned int nWords, const Word64* trailer, Errors& errors) override;

bool checkROC(bool& errorsInEvent, int fedId, const SiPixelFrameConverter* converter,
const SiPixelFedCabling* theCablingTree,
Word32& errorWord, Errors& errors) override;



void conversionError(int fedId, const SiPixelFrameConverter* converter,
int status, Word32& errorWord, Errors& errors) override;

private:

bool includeErrors;

cms_uint32_t errorDetId(const SiPixelFrameConverter* converter,
int errorType, const Word32 & word) const override;

};

#endif
3 changes: 2 additions & 1 deletion EventFilter/SiPixelRawToDigi/interface/PixelDataFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "DataFormats/SiPixelRawData/interface/SiPixelRawDataError.h"
#include "DataFormats/Common/interface/DetSetVector.h"
#include "EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h"
#include "EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h"
#include "FWCore/Utilities/interface/typedefs.h"
#include "DataFormats/SiPixelDetId/interface/PixelFEDChannel.h"

Expand Down Expand Up @@ -101,7 +102,7 @@ class PixelDataFormatter {
bool debug;
int allDetDigis;
int hasDetDigis;
ErrorChecker errorcheck;
std::unique_ptr<ErrorCheckerBase> errorcheck;

// For the 32bit data format (moved from *.cc namespace, keep uppercase for compatibility)
// Add special layer 1 roc for phase1
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/SiPixelRawToDigi/plugins/SiPixelDigiToRaw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ void SiPixelDigiToRaw::produce( edm::StreamID, edm::Event& ev,

PixelDataFormatter::BadChannels badChannels;
edm::Handle<PixelFEDChannelCollection> pixelFEDChannelCollectionHandle;
if (ev.getByToken(theBadPixelFEDChannelsToken, pixelFEDChannelCollectionHandle)){
if (usePhase1 && ev.getByToken(theBadPixelFEDChannelsToken, pixelFEDChannelCollectionHandle)){
for (auto const& fedChannels: *pixelFEDChannelCollectionHandle) {
PixelDataFormatter::DetBadChannels detBadChannels;
for(const auto& fedChannel: fedChannels) {
Expand Down
2 changes: 1 addition & 1 deletion EventFilter/SiPixelRawToDigi/plugins/SiPixelRawToDigi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void SiPixelRawToDigi::produce( edm::Event& ev,
for (auto const& aPixelError : errorDetSet) {
// For the time being, we extend the error handling functionality with ErrorType 25
// In the future, we should sort out how the usage of tkerrorlist can be generalized
if (aPixelError.getType()==25) {
if (usePhase1 && aPixelError.getType()==25) {
assert(aPixelError.getFedId()==fedId);
const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId);
if (fed) {
Expand Down
Loading

0 comments on commit b45186e

Please sign in to comment.