From 6da6cbd7b92ffffc75d5290c05ea147238d57a65 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Thu, 22 Jan 2015 16:32:12 +0100 Subject: [PATCH] check validity of s-curve header information --- s-curves/cpp_based-on-dabc-lib/unpacker.cxx | 23 +++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/s-curves/cpp_based-on-dabc-lib/unpacker.cxx b/s-curves/cpp_based-on-dabc-lib/unpacker.cxx index a285a52..ccbf82a 100644 --- a/s-curves/cpp_based-on-dabc-lib/unpacker.cxx +++ b/s-curves/cpp_based-on-dabc-lib/unpacker.cxx @@ -147,9 +147,21 @@ signed analyze_C0(hadaq::RawSubevent* sub, unsigned ix, unsigned framelen, unsig cout << "Run Number: " << sf.run_number << endl; #endif - if (sf.frame_length != 0x25) { - printf("The framelength should match 37 = 0x25\n"); - return -1; + // validity checks for M-26: + bool valid = true; + if (sf.row >= 576) valid = false; + if (sf.sensor_id >= 2) valid = false; + if (sf.bank >= 4) valid = false; + if (sf.frame_length != 0x25) valid = false; + if (! valid) { + cout << "Something is wrong with this frame:" << endl; + cout << "Frame length: " << sf.frame_length << endl; + cout << "Sensor ID: " << sf.sensor_id << endl; + cout << "Threshold: " << sf.threshold << endl; + cout << "Bank: " << sf.bank << endl; + cout << "Row: " << sf.row << endl; + cout << "Run Number: " << sf.run_number << endl; + return ix + sf.frame_length; } if (prev_threshold == 0xFFFF) prev_threshold = 0xFFFE; // prevent first save_tree() call @@ -178,8 +190,7 @@ signed analyze_C0(hadaq::RawSubevent* sub, unsigned ix, unsigned framelen, unsig } } } - ix += j; - return ix; + return ix + j; } @@ -239,7 +250,7 @@ void save_tree() { } else { - pixelprob[i] = 0; + pixelprob[i] = 0.0; } } scurveTree->Fill(); -- 2.43.0