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 |
// ++++++++++ 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 |
//cout << "TRK" << endl; |
20 |
return TRK; |
21 |
} |
22 |
} |
23 |
} |
24 |
else { |
25 |
//cout << "TRK" << endl; |
26 |
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 |
//cout << "CALO good" << endl; |
35 |
return CALO; |
36 |
} |
37 |
} |
38 |
else { |
39 |
//cout << "CALO get" << endl; |
40 |
return CALO; |
41 |
} |
42 |
} |
43 |
|
44 |
// ++++++++++ CALO LEVEL 1++++++++++ |
45 |
if ((_cutMask & CALO_L1) == CALO_L1) { |
46 |
if (! (event->GetCaloLevel1() ) ) { |
47 |
//cout << "CALO_L1" << endl; |
48 |
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 |
//cout << "TOF" << endl; |
57 |
return TOF; |
58 |
} |
59 |
} |
60 |
else { |
61 |
//cout << "TOF" << endl; |
62 |
return TOF; |
63 |
} |
64 |
} |
65 |
|
66 |
// ++++++++++ ANT ++++++++++ |
67 |
if ((_cutMask & ANT) == ANT) { |
68 |
if (event->GetAcLevel2()) { |
69 |
if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1) |
70 |
|| ((event->GetAcLevel2()->status[1] >> 2) & 1)) { |
71 |
//cout << "ANT" << endl; |
72 |
return ANT; |
73 |
} |
74 |
} |
75 |
else { |
76 |
//cout << "ANT" << endl; |
77 |
return ANT; |
78 |
} |
79 |
} |
80 |
|
81 |
// ++++++++++ TRG ++++++++++ |
82 |
if ((_cutMask & TRG) == TRG) { |
83 |
if (event->GetTrigLevel2()) { |
84 |
if (event->GetTrigLevel2()->unpackError) { |
85 |
//cout << "TRG" << endl; |
86 |
return TRG; |
87 |
} |
88 |
} |
89 |
else { |
90 |
//cout << "TRG" << endl; |
91 |
return TRG; |
92 |
} |
93 |
} |
94 |
|
95 |
// ++++++++++ ND ++++++++++ |
96 |
if ((_cutMask & ND) == ND) { |
97 |
if (event->GetNDLevel2()) { |
98 |
if (event->GetNDLevel2()->unpackError) { |
99 |
//cout << "ND" << endl; |
100 |
return ND; |
101 |
} |
102 |
} |
103 |
else { |
104 |
//cout << "ND" << endl; |
105 |
return ND; |
106 |
} |
107 |
} |
108 |
|
109 |
// ++++++++++ ORB ++++++++++ |
110 |
if ((_cutMask & ORB) == ORB) { |
111 |
if (!event->GetOrbitalInfo()) { |
112 |
//cout << "ORB" << endl; |
113 |
return ORB; |
114 |
} |
115 |
} |
116 |
|
117 |
return CUTOK; |
118 |
} |