| 1 |
/* |
| 2 |
* DataQualCut.cpp |
| 3 |
* |
| 4 |
* Created on: 10-mar-2009 |
| 5 |
* Author: S. Ricciarini |
| 6 |
*/ |
| 7 |
|
| 8 |
/*! @file DataQualCut.cpp The DataQualCut class implementation file */ |
| 9 |
|
| 10 |
#include "DataQualCut.h" |
| 11 |
|
| 12 |
int DataQualCut::Check(PamLevel2 *event){ |
| 13 |
|
| 14 |
//cout << "DataQualCut::Check: "; |
| 15 |
// ++++++++++ TRK ++++++++++ |
| 16 |
|
| 17 |
if ((_cutMask & TRK) == TRK) { |
| 18 |
if (event->GetTrkLevel2()) { |
| 19 |
for (Int_t i=0; i<12; i++) { // check done for each DSP |
| 20 |
if (!event->GetTrkLevel2()->StatusCheck(i,0x12)) { // decode error OR CRC error |
| 21 |
return TRK; |
| 22 |
} |
| 23 |
} |
| 24 |
} |
| 25 |
else { |
| 26 |
return TRK; |
| 27 |
} |
| 28 |
} |
| 29 |
//cout << "TRK "; |
| 30 |
|
| 31 |
// ++++++++++ CALO LEVEL 2++++++++++ |
| 32 |
if ((_cutMask & CALO) == CALO) { |
| 33 |
if (event->GetCaloLevel2()) { |
| 34 |
if (!event->GetCaloLevel2()->IsGood(true)) { |
| 35 |
return CALO; |
| 36 |
} |
| 37 |
} |
| 38 |
else { |
| 39 |
return CALO; |
| 40 |
} |
| 41 |
} |
| 42 |
//cout << "CALO "; |
| 43 |
|
| 44 |
// ++++++++++ CALO LEVEL 1++++++++++ |
| 45 |
if ((_cutMask & CALO_L1) == CALO_L1) { |
| 46 |
if (! (event->GetCaloLevel1() ) ) { |
| 47 |
return CALO; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
// ++++++++++ TOF ++++++++++ |
| 52 |
if ((_cutMask & TOF) == TOF) { |
| 53 |
if (event->GetToFLevel2()) { |
| 54 |
if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0" |
| 55 |
return TOF; |
| 56 |
} |
| 57 |
} |
| 58 |
else { |
| 59 |
return TOF; |
| 60 |
} |
| 61 |
} |
| 62 |
//cout << "TOF "; |
| 63 |
|
| 64 |
// ++++++++++ ANT ++++++++++ |
| 65 |
if ((_cutMask & ANT) == ANT) { |
| 66 |
if (event->GetAcLevel2()) { |
| 67 |
if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1) |
| 68 |
|| ((event->GetAcLevel2()->status[1] >> 2) & 1)) { |
| 69 |
return ANT; |
| 70 |
} |
| 71 |
} |
| 72 |
else { |
| 73 |
return ANT; |
| 74 |
} |
| 75 |
} |
| 76 |
//cout << "ANT "; |
| 77 |
|
| 78 |
// ++++++++++ TRG ++++++++++ |
| 79 |
if ((_cutMask & TRG) == TRG) { |
| 80 |
if (event->GetTrigLevel2()) { |
| 81 |
if (event->GetTrigLevel2()->unpackError) { |
| 82 |
return TRG; |
| 83 |
} |
| 84 |
} |
| 85 |
else { |
| 86 |
return TRG; |
| 87 |
} |
| 88 |
} |
| 89 |
//cout << "TRG "; |
| 90 |
|
| 91 |
// ++++++++++ ND ++++++++++ |
| 92 |
if ((_cutMask & ND) == ND) { |
| 93 |
if (event->GetNDLevel2()) { |
| 94 |
if (event->GetNDLevel2()->unpackError) { |
| 95 |
return ND; |
| 96 |
} |
| 97 |
} |
| 98 |
else { |
| 99 |
return ND; |
| 100 |
} |
| 101 |
} |
| 102 |
//cout << "ND "; |
| 103 |
|
| 104 |
// ++++++++++ ORB ++++++++++ |
| 105 |
if ((_cutMask & ORB) == ORB) { |
| 106 |
if (!event->GetOrbitalInfo()) { |
| 107 |
return ORB; |
| 108 |
} |
| 109 |
} |
| 110 |
//cout << "ORB"; |
| 111 |
//cout << endl; |
| 112 |
|
| 113 |
return CUTOK; |
| 114 |
} |