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