| 1 |
pam-fi |
1.1 |
/* |
| 2 |
|
|
* DataQualCut.cpp |
| 3 |
|
|
* |
| 4 |
|
|
* Created on: 10-mar-2009 |
| 5 |
|
|
* Author: Sergio Ricciarini, Nicola Mori |
| 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 |
|
|
// ++++++++++ AC ++++++++++ |
| 65 |
|
|
if ((_cutMask & AC) == AC) { |
| 66 |
|
|
if (event->GetAcLevel2()) { |
| 67 |
|
|
if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1) |
| 68 |
|
|
|| ((event->GetAcLevel2()->status[1] >> 2) & 1)) { |
| 69 |
|
|
return AC; |
| 70 |
|
|
} |
| 71 |
|
|
} |
| 72 |
|
|
else { |
| 73 |
|
|
return AC; |
| 74 |
|
|
} |
| 75 |
|
|
} |
| 76 |
|
|
//cout << "AC "; |
| 77 |
|
|
|
| 78 |
|
|
// ++++++++++ TRIG ++++++++++ |
| 79 |
|
|
if ((_cutMask & TRIG) == TRIG) { |
| 80 |
|
|
if (event->GetTrigLevel2()) { |
| 81 |
|
|
if (event->GetTrigLevel2()->unpackError) { |
| 82 |
|
|
return TRIG; |
| 83 |
|
|
} |
| 84 |
|
|
} |
| 85 |
|
|
else { |
| 86 |
|
|
return TRIG; |
| 87 |
|
|
} |
| 88 |
|
|
} |
| 89 |
|
|
//cout << "TRIG "; |
| 90 |
|
|
|
| 91 |
|
|
//TODO: vedere se si puo' controllare anche l'unpack error per ORB (sembra di no...) |
| 92 |
|
|
// ++++++++++ ORB ++++++++++ |
| 93 |
|
|
if ((_cutMask & ORB) == ORB) { |
| 94 |
|
|
if (!event->GetOrbitalInfo()) { |
| 95 |
|
|
return ORB; |
| 96 |
|
|
} |
| 97 |
|
|
} |
| 98 |
|
|
//cout << "ORB"; |
| 99 |
|
|
//cout << endl; |
| 100 |
|
|
|
| 101 |
|
|
return CUTOK; |
| 102 |
|
|
} |