1 #include "DataQualityMonitor.h" 3 DataQualityMonitor::DataQualityMonitor(){
5 Double_t defaultThresholds[NUM_POL][NUM_SEAVEYS] = {
6 {109, 104, 139, 102, 173, 104, 116, 107, 85, 186, 224, 157, 245, 118, 137, 108,
7 95, 117, 108, 111, 109, 111, 103, 103, 97, 199, 208, 200, 184, 205, 175, 109,
8 106, 147, 117, 115, 117, 116, 114, 106, 95, 179, 208, 189, 184, 198, 110, 99},
9 {186, 205, 235, 269, 180, 239, 247, 175, 197, 310, 288, 327, 291, 270, 374, 232,
10 247, 257, 264, 249, 218, 283, 216, 250, 220, 360, 293, 347, 375, 423, 373, 247,
11 114, 177, 201, 266, 207, 239, 206, 184, 190, 327, 326, 271, 397, 415, 247, 255}};
13 fillThresholds(defaultThresholds);
17 DataQualityMonitor::~DataQualityMonitor(){
22 Int_t DataQualityMonitor::ProcessEvent(RawAnitaEvent* rawEvent){
24 UsefulAnitaEvent* pedEvent =
new UsefulAnitaEvent(rawEvent, WaveCalType::kAddPeds);
25 pedEvent->setAlfaFilterFlag(
false);
27 fillMaxAbsSecondDerivArray(pedEvent);
29 Int_t numBadChannels = 0;
31 for(Int_t pol=0; pol<NUM_POL; pol++){
32 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
34 if(lastMaxAbsSecondDeriv[pol][ant] > threshMaxAbsSecondDeriv[pol][ant]){
42 return numBadChannels;
46 void DataQualityMonitor::fillMaxAbsSecondDerivArray(UsefulAnitaEvent* pedEvent){
48 for(Int_t pol=0; pol<NUM_POL; pol++){
49 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
50 lastMaxAbsSecondDeriv[pol][ant] = -9999;
52 TGraph* gr = pedEvent->getGraph(ant, (AnitaPol::AnitaPol_t) pol);
54 for(
int samp = 0; samp < gr->GetN(); samp++){
56 Double_t V = gr->GetY()[samp];
58 if(samp < gr->GetN() - 2){
59 Double_t V2 = gr->GetY()[samp+1];
60 Double_t V3 = gr->GetY()[samp+2];
61 double thisAbsSecondDeriv = TMath::Abs(2*V2 - V3 - V);
62 if(thisAbsSecondDeriv > lastMaxAbsSecondDeriv[pol][ant]){
63 lastMaxAbsSecondDeriv[pol][ant] = thisAbsSecondDeriv;
76 void DataQualityMonitor::fillThresholds(Double_t vals[NUM_POL][NUM_SEAVEYS]){
78 for(Int_t pol=0; pol<NUM_POL; pol++){
79 for(Int_t ant=0; ant<NUM_SEAVEYS; ant++){
80 threshMaxAbsSecondDeriv[pol][ant] = vals[pol][ant];