Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore FED error treatment for phase0 (required for UL Rereco of 2016) #26606

Closed
25 changes: 9 additions & 16 deletions EventFilter/SiPixelRawToDigi/interface/ErrorChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,11 @@
*
*/

#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;
Expand All @@ -29,29 +22,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
54 changes: 54 additions & 0 deletions EventFilter/SiPixelRawToDigi/interface/ErrorCheckerBase.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#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 unsigned int Word32;
// typedef long long Word64;
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
51 changes: 51 additions & 0 deletions EventFilter/SiPixelRawToDigi/interface/ErrorCheckerPhase0.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#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 unsigned int Word32;
// typedef long long Word64;
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==true && 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 @@ -252,7 +252,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==true && aPixelError.getType()==25) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this even needed on the raw2digi side?
Do we have cases for valid pixel error =25 in phase 0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In phase 0, error type 25 is exotic but can happen when AFAIK the analog levels in the FED input are not interpreted correctly and the communication protocol is compromised. Such an event was actually caught by reconstruction. So this is indeed needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this fix is mandatory for full reprocessing of 2016. Without it you will have a small but finite chunk of unprocessable data

assert(aPixelError.getFedId()==fedId);
const sipixelobjects::PixelFEDCabling* fed = cabling_->fed(fedId);
if (fed) {
Expand Down
Loading