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

Remove exceptions from the strip unpacker #28756

Merged
merged 33 commits into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
453cd49
Remove unused handleException method
pieterdavid Jan 9, 2020
87fad09
Remove unused arguments from sistrip::FEDBufferBase::init
pieterdavid Jan 9, 2020
e7963da
Remove checks and exceptions from FEDBufferBase, add helper methods t…
pieterdavid Jan 9, 2020
99cde59
Update direct users of sistrip::FEDBufferBase to perform the checks
pieterdavid Jan 9, 2020
08bd30f
Update also SiStripSpyUnpacker and its users
pieterdavid Jan 9, 2020
d8dd974
Add readout mode check (and throw) from FEDSpyBuffer constructor (all…
pieterdavid Jan 9, 2020
4fc0635
Fix copy/paste errors
pieterdavid Jan 9, 2020
ded9685
Make standalone helper methods for pre-construct checks, and use these
pieterdavid Jan 10, 2020
ac0523f
remove 'fromnibble' helper methods, but keep implementation in header…
pieterdavid Jan 10, 2020
778bc23
compile fixes (namespace)
pieterdavid Jan 10, 2020
ea3e635
Do FEDBuffer-specific checks in findChannels (to be called after the …
pieterdavid Jan 10, 2020
726d90d
Code-format
pieterdavid Jan 10, 2020
19c4010
put debug messages with more information back, move checks methods wi…
pieterdavid Jan 10, 2020
38caaac
documentation; FED(Spy)Buffer(Base) constructors and checker methods …
pieterdavid Jan 10, 2020
0d32f82
Move checks (and exceptions) out of sistrip::FEDChannel::cmMedian
pieterdavid Jan 10, 2020
c92f232
compiling unpackChannel template methods (more readable than channelu…
pieterdavid Jan 14, 2020
82dbe0c
Propagate to on-demand unpacker
pieterdavid Jan 14, 2020
97eb8d4
Add conversion to SiStripRawDigi (and make constructor explicit + fix…
pieterdavid Jan 14, 2020
a2d0e8f
Fixes from testing ZS, more debugging in plugin
pieterdavid Jan 15, 2020
b8571af
VR: actually reorder; small fixes and debug printout
pieterdavid Jan 16, 2020
5936a13
Few fixes for ZS
pieterdavid Jan 16, 2020
b7bae79
Remove a few unnecessary const_cast from unpacker and FEDRawDataAnalyzer
pieterdavid Jan 16, 2020
bfe1428
ZS: read first cluster in loop; reorder a bit for consistency
pieterdavid Jan 17, 2020
a12c58c
One more implicit integer > SiStripRawDigi conversion
pieterdavid Jan 17, 2020
111dfff
code-format
pieterdavid Jan 17, 2020
9d0bf1f
Remove SiStripRawDigi->uint16_t conversion again
pieterdavid Jan 20, 2020
31d9c24
code-format
pieterdavid Jan 20, 2020
c4d7c83
review comments: naming, unnecessary code
pieterdavid Jan 22, 2020
02a70dc
review comment: simplify physical->readout order conversion
pieterdavid Jan 22, 2020
cefd216
cleanup some const casts
slava77devel Jan 21, 2020
f23f586
code format
pieterdavid Jan 22, 2020
8311920
Inline long expressions to retrieve ADCs
pieterdavid Jan 22, 2020
f0c4e61
Go back to reusing const from non-const accessors
pieterdavid Jan 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Alignment/LaserAlignment/plugins/LaserAlignmentEventFilter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ bool LaserAlignmentEventFilter::filter(edm::StreamID sid, edm::Event& iEvent, co
continue;

// construct FEDBuffer
sistrip::FEDBuffer buffer(input.data(), input.size());
const auto st_buffer = sistrip::preconstructCheckFEDBuffer(input);
if (sistrip::FEDBufferStatusCode::SUCCESS != st_buffer) {
throw cms::Exception("FEDBuffer") << st_buffer << " (check debug output for more details)";
}
sistrip::FEDBuffer buffer{input};
const auto st_chan = buffer.findChannels();
if (sistrip::FEDBufferStatusCode::SUCCESS != st_chan) {
throw cms::Exception("FEDBuffer") << st_chan << " (check debug output for more details)";
}
if (not buffer.doChecks(true)) {
edm::LogWarning("LaserAlignmentEventFilter") << "FED Buffer check fails for FED ID " << *ifed << ".";
continue;
Expand Down
4 changes: 2 additions & 2 deletions CalibTracker/SiStripAPVAnalysis/src/ApvAnalysisFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void ApvAnalysisFactory::updatePair(uint32_t detId, size_t pairNumber, const edm

for (size_t istrip = startStrip; istrip < stopStrip; istrip++) {
if (in.data.size() <= istrip)
tmpRawDigi.data.push_back(0);
tmpRawDigi.data.push_back(SiStripRawDigi(0));
else
tmpRawDigi.data.push_back(in.data[istrip]); //maybe dangerous
}
Expand Down Expand Up @@ -183,7 +183,7 @@ void ApvAnalysisFactory::update(uint32_t detId, const edm::DetSet<SiStripRawDigi

for (size_t istrip = startStrip; istrip < stopStrip; istrip++) {
if (in.data.size() <= istrip)
tmpRawDigi.data.push_back(0);
tmpRawDigi.data.push_back(SiStripRawDigi(0));
else
tmpRawDigi.data.push_back(in.data[istrip]); //maybe dangerous
}
Expand Down
6 changes: 3 additions & 3 deletions DQM/SiStripMonitorHardware/interface/FEDErrors.hh
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public:
bool fillFatalFEDErrors(const FEDRawData& aFedData, const unsigned int aPrintDebug);

//expensive check: fatal but kept separate
bool fillCorruptBuffer(const sistrip::FEDBuffer* aBuffer);
bool fillCorruptBuffer(const sistrip::FEDBuffer& aBuffer);

//FE/Channel check: rate of channels with error (only considering connected channels)
float fillNonFatalFEDErrors(const sistrip::FEDBuffer* aBuffer, const SiStripFedCabling* aCabling = nullptr);
Expand All @@ -165,11 +165,11 @@ public:
const bool aDoFEMaj,
std::vector<std::vector<std::pair<unsigned int, unsigned int> > >& aFeMajFrac);

bool fillFEErrors(const sistrip::FEDBuffer* aBuffer,
bool fillFEErrors(const sistrip::FEDBuffer& aBuffer,
const bool aDoFEMaj,
std::vector<std::vector<std::pair<unsigned int, unsigned int> > >& aFeMajFrac);

bool fillChannelErrors(const sistrip::FEDBuffer* aBuffer,
bool fillChannelErrors(const sistrip::FEDBuffer& aBuffer,
bool& aFullDebug,
const unsigned int aPrintDebug,
unsigned int& aCounterMonitoring,
Expand Down
32 changes: 31 additions & 1 deletion DQM/SiStripMonitorHardware/interface/SiStripFEDSpyBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ namespace sistrip {
//class representing spy channel buffers
class FEDSpyBuffer : public FEDBufferBase {
public:
/**
* constructor from a FEDRawData buffer
*
* The sistrip::preconstructCheckFEDSpyBuffer() method should be used
* to check the validity of fedBuffer before constructing a sistrip::FEDBuffer.
*
* @see sistrip::preconstructCheckFEDSpyBuffer()
*/
//construct from buffer
FEDSpyBuffer(const uint8_t* fedBuffer, const size_t fedBufferSize);
explicit FEDSpyBuffer(const FEDRawData& fedBuffer);
~FEDSpyBuffer() override;
void print(std::ostream& os) const override;

Expand Down Expand Up @@ -85,6 +93,28 @@ namespace sistrip {
// Inline function definitions
//

/**
* Check if a FEDRawData object satisfies the requirements for constructing a sistrip::FEDSpyBuffer
*
* These are:
* - those from sistrip::preconstructCheckFEDBufferBase() (with checkRecognizedFormat equal to true)
* - the readout mode should be equal to sistrip::READOUT_MODE_SPY
*
* In case any check fails, a value different from sistrip::FEDBufferStatusCode::SUCCESS
* is returned, and detailed information printed to LogDebug("FEDBuffer"), if relevant.
*
* @see sistrip::preconstructCheckFEDBufferBase()
*/
inline FEDBufferStatusCode preconstructCheckFEDSpyBuffer(const FEDRawData& fedBuffer) {
const auto st_base = preconstructCheckFEDBufferBase(fedBuffer, true);
if (FEDBufferStatusCode::SUCCESS != st_base)
return st_base;
const TrackerSpecialHeader hdr{fedBuffer.data() + 8};
if (READOUT_MODE_SPY != hdr.readoutMode())
return FEDBufferStatusCode::EXPECT_SPY;
return FEDBufferStatusCode::SUCCESS;
}

//FEDSpyChannelUnpacker

inline FEDSpyChannelUnpacker::FEDSpyChannelUnpacker(const FEDChannel& channel)
Expand Down
Loading