2 |
* DataQualCut.cpp |
* DataQualCut.cpp |
3 |
* |
* |
4 |
* Created on: 10-mar-2009 |
* Created on: 10-mar-2009 |
5 |
* Author: Sergio Ricciarini, Nicola Mori |
* Author: S. Ricciarini |
6 |
*/ |
*/ |
7 |
|
|
8 |
/*! @file DataQualCut.cpp The DataQualCut class implementation file */ |
/*! @file DataQualCut.cpp The DataQualCut class implementation file */ |
11 |
|
|
12 |
int DataQualCut::Check(PamLevel2 *event){ |
int DataQualCut::Check(PamLevel2 *event){ |
13 |
|
|
|
//cout << "DataQualCut::Check: "; |
|
14 |
// ++++++++++ TRK ++++++++++ |
// ++++++++++ TRK ++++++++++ |
|
|
|
15 |
if ((_cutMask & TRK) == TRK) { |
if ((_cutMask & TRK) == TRK) { |
16 |
if (event->GetTrkLevel2()) { |
if (event->GetTrkLevel2()) { |
17 |
for (Int_t i=0; i<12; i++) { // check done for each DSP |
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 |
if (!event->GetTrkLevel2()->StatusCheck(i,0x12)) { // decode error OR CRC error |
19 |
|
//cout << "TRK" << endl; |
20 |
return TRK; |
return TRK; |
21 |
} |
} |
22 |
} |
} |
23 |
} |
} |
24 |
else { |
else { |
25 |
|
//cout << "TRK" << endl; |
26 |
return TRK; |
return TRK; |
27 |
} |
} |
28 |
} |
} |
|
//cout << "TRK "; |
|
29 |
|
|
30 |
// ++++++++++ CALO LEVEL 2++++++++++ |
// ++++++++++ CALO LEVEL 2++++++++++ |
31 |
if ((_cutMask & CALO) == CALO) { |
if ((_cutMask & CALO) == CALO) { |
32 |
if (event->GetCaloLevel2()) { |
if (event->GetCaloLevel2()) { |
33 |
if (!event->GetCaloLevel2()->IsGood(true)) { |
if (!event->GetCaloLevel2()->IsGood(true)) { |
34 |
|
//cout << "CALO good" << endl; |
35 |
return CALO; |
return CALO; |
36 |
} |
} |
37 |
} |
} |
38 |
else { |
else { |
39 |
|
//cout << "CALO get" << endl; |
40 |
return CALO; |
return CALO; |
41 |
} |
} |
42 |
} |
} |
|
//cout << "CALO "; |
|
43 |
|
|
44 |
// ++++++++++ CALO LEVEL 1++++++++++ |
// ++++++++++ CALO LEVEL 1++++++++++ |
45 |
if ((_cutMask & CALO_L1) == CALO_L1) { |
if ((_cutMask & CALO_L1) == CALO_L1) { |
46 |
if (! (event->GetCaloLevel1() ) ) { |
if (! (event->GetCaloLevel1() ) ) { |
47 |
|
//cout << "CALO_L1" << endl; |
48 |
return CALO; |
return CALO; |
49 |
} |
} |
50 |
} |
} |
53 |
if ((_cutMask & TOF) == TOF) { |
if ((_cutMask & TOF) == TOF) { |
54 |
if (event->GetToFLevel2()) { |
if (event->GetToFLevel2()) { |
55 |
if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0" |
if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0" |
56 |
|
//cout << "TOF" << endl; |
57 |
return TOF; |
return TOF; |
58 |
} |
} |
59 |
} |
} |
60 |
else { |
else { |
61 |
|
//cout << "TOF" << endl; |
62 |
return TOF; |
return TOF; |
63 |
} |
} |
64 |
} |
} |
|
//cout << "TOF "; |
|
65 |
|
|
66 |
// ++++++++++ AC ++++++++++ |
// ++++++++++ ANT ++++++++++ |
67 |
if ((_cutMask & AC) == AC) { |
if ((_cutMask & ANT) == ANT) { |
68 |
if (event->GetAcLevel2()) { |
if (event->GetAcLevel2()) { |
69 |
if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1) |
if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1) |
70 |
|| ((event->GetAcLevel2()->status[1] >> 2) & 1)) { |
|| ((event->GetAcLevel2()->status[1] >> 2) & 1)) { |
71 |
return AC; |
//cout << "ANT" << endl; |
72 |
|
return ANT; |
73 |
} |
} |
74 |
} |
} |
75 |
else { |
else { |
76 |
return AC; |
//cout << "ANT" << endl; |
77 |
|
return ANT; |
78 |
} |
} |
79 |
} |
} |
|
//cout << "AC "; |
|
80 |
|
|
81 |
// ++++++++++ TRIG ++++++++++ |
// ++++++++++ TRG ++++++++++ |
82 |
if ((_cutMask & TRIG) == TRIG) { |
if ((_cutMask & TRG) == TRG) { |
83 |
if (event->GetTrigLevel2()) { |
if (event->GetTrigLevel2()) { |
84 |
if (event->GetTrigLevel2()->unpackError) { |
if (event->GetTrigLevel2()->unpackError) { |
85 |
return TRIG; |
//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 { |
else { |
104 |
return TRIG; |
//cout << "ND" << endl; |
105 |
|
return ND; |
106 |
} |
} |
107 |
} |
} |
|
//cout << "TRIG "; |
|
108 |
|
|
|
//TODO: vedere se si puo' controllare anche l'unpack error per ORB (sembra di no...) |
|
109 |
// ++++++++++ ORB ++++++++++ |
// ++++++++++ ORB ++++++++++ |
110 |
if ((_cutMask & ORB) == ORB) { |
if ((_cutMask & ORB) == ORB) { |
111 |
if (!event->GetOrbitalInfo()) { |
if (!event->GetOrbitalInfo()) { |
112 |
|
//cout << "ORB" << endl; |
113 |
return ORB; |
return ORB; |
114 |
} |
} |
115 |
} |
} |
|
//cout << "ORB"; |
|
|
//cout << endl; |
|
116 |
|
|
117 |
return CUTOK; |
return CUTOK; |
118 |
} |
} |