| 2 |
* DataQualCut.cpp |
* DataQualCut.cpp |
| 3 |
* |
* |
| 4 |
* Created on: 10-mar-2009 |
* Created on: 10-mar-2009 |
| 5 |
* Author: S. Ricciarini |
* Author: S. Ricciarini, N. Mori, E. Mocchiutti |
| 6 |
*/ |
*/ |
| 7 |
|
|
| 8 |
/*! @file DataQualCut.cpp The DataQualCut class implementation file */ |
/*! @file DataQualCut.cpp The DataQualCut class implementation file */ |
| 9 |
|
|
| 10 |
#include "DataQualCut.h" |
#include "DataQualCut.h" |
| 11 |
|
|
| 12 |
|
Bool_t DataQualCut::CL1IsGood(CaloLevel1 *cl1, CaloLevel2 *cl2){ |
| 13 |
|
// |
| 14 |
|
// variables |
| 15 |
|
// |
| 16 |
|
Int_t view = 0; |
| 17 |
|
Int_t plane = 0; |
| 18 |
|
Int_t strip = 0; |
| 19 |
|
Int_t sview = 0; |
| 20 |
|
Int_t splane = 0; |
| 21 |
|
Int_t sstrip = 0; |
| 22 |
|
Float_t mip = 0.; |
| 23 |
|
Int_t nstrip = 0; |
| 24 |
|
// |
| 25 |
|
// values in calolevel1 are stored following this order: view X first, view Y second / for each view from plane 0 to plane 21 / for each plane from strip 0 to strip 95 |
| 26 |
|
// any incongruence in this order means that the CaloLevel1 event is corrupted |
| 27 |
|
// the nstrip calculated with CaloLevel1 (excluding plane 18X) must be equal to nstrip in CaloLevel2 (which is not affected by the bug) |
| 28 |
|
// if they don't match the CaloLevel1 event is corrupted |
| 29 |
|
// if the vector in CaloLevel1 is ordered and nstrip from CaloLevel1 and CaloLevel2 matches then the CaloLevel1 event can only be corrupted on the values of plane 18X |
| 30 |
|
// hence it is good if you are not using plane 18X |
| 31 |
|
// |
| 32 |
|
for (Int_t i=0; i<cl1->istrip; i++){ |
| 33 |
|
mip=cl1->DecodeEstrip(i,view,plane,strip); |
| 34 |
|
if ( view < 0 || view > 1 ) return(false); |
| 35 |
|
if ( plane < 0 || plane > 21 ) return(false); |
| 36 |
|
if ( strip < 0 || strip > 95 ) return(false); |
| 37 |
|
if ( i > 0 ){ |
| 38 |
|
if ( view < sview ) return(false); |
| 39 |
|
if ( view == sview ){ |
| 40 |
|
if ( plane < splane ) return(false); |
| 41 |
|
if ( plane == splane ){ |
| 42 |
|
if ( strip <= sstrip ) return(false); |
| 43 |
|
}; |
| 44 |
|
}; |
| 45 |
|
}; |
| 46 |
|
if ( !(view==0 && plane==18) ) nstrip++; |
| 47 |
|
sview = view; |
| 48 |
|
splane = plane; |
| 49 |
|
sstrip = strip; |
| 50 |
|
}; |
| 51 |
|
if ( nstrip != cl2->nstrip ) return(false); |
| 52 |
|
return(true); |
| 53 |
|
} |
| 54 |
|
|
| 55 |
int DataQualCut::Check(PamLevel2 *event){ |
int DataQualCut::Check(PamLevel2 *event){ |
| 56 |
|
|
| 57 |
// ++++++++++ TRK ++++++++++ |
// ++++++++++ TRK ++++++++++ |
| 59 |
if (event->GetTrkLevel2()) { |
if (event->GetTrkLevel2()) { |
| 60 |
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 |
| 61 |
if (!event->GetTrkLevel2()->StatusCheck(i,0x12)) { // decode error OR CRC error |
if (!event->GetTrkLevel2()->StatusCheck(i,0x12)) { // decode error OR CRC error |
|
//cout << "TRK" << endl; |
|
| 62 |
return TRK; |
return TRK; |
| 63 |
} |
} |
| 64 |
} |
} |
| 65 |
} |
} |
| 66 |
else { |
else { |
|
//cout << "TRK" << endl; |
|
| 67 |
return TRK; |
return TRK; |
| 68 |
} |
} |
| 69 |
} |
} |
| 70 |
|
|
| 71 |
// ++++++++++ CALO LEVEL 2++++++++++ |
// ++++++++++ CALO LEVEL 2 ++++++++++ |
| 72 |
if ((_cutMask & CALO) == CALO) { |
if ((_cutMask & CALO) == CALO) { |
| 73 |
if (event->GetCaloLevel2()) { |
if (event->GetCaloLevel2()) { |
| 74 |
if (!event->GetCaloLevel2()->IsGood(true)) { |
if (!event->GetCaloLevel2()->IsGood(true)) { |
|
//cout << "CALO good" << endl; |
|
| 75 |
return CALO; |
return CALO; |
| 76 |
} |
} |
| 77 |
} |
} |
| 78 |
else { |
else { |
|
//cout << "CALO get" << endl; |
|
| 79 |
return CALO; |
return CALO; |
| 80 |
} |
} |
| 81 |
} |
} |
| 82 |
|
|
| 83 |
// ++++++++++ CALO LEVEL 1++++++++++ |
// ++++++++++ CALO LEVEL 1 ++++++++++ |
| 84 |
if ((_cutMask & CALO_L1) == CALO_L1) { |
if ((_cutMask & CALO_L1) == CALO_L1) { |
| 85 |
if (! (event->GetCaloLevel1() ) ) { |
if (! (event->GetCaloLevel1() ) ) { |
| 86 |
//cout << "CALO_L1" << endl; |
return CALO; |
| 87 |
|
} |
| 88 |
|
if (! CL1IsGood(event->GetCaloLevel1(),event->GetCaloLevel2()) ){ |
| 89 |
return CALO; |
return CALO; |
| 90 |
} |
} |
| 91 |
} |
} |
| 94 |
if ((_cutMask & TOF) == TOF) { |
if ((_cutMask & TOF) == TOF) { |
| 95 |
if (event->GetToFLevel2()) { |
if (event->GetToFLevel2()) { |
| 96 |
if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0" |
if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0" |
|
//cout << "TOF" << endl; |
|
| 97 |
return TOF; |
return TOF; |
| 98 |
} |
} |
| 99 |
} |
} |
| 100 |
else { |
else { |
|
//cout << "TOF" << endl; |
|
| 101 |
return TOF; |
return TOF; |
| 102 |
} |
} |
| 103 |
} |
} |
| 112 |
} |
} |
| 113 |
} |
} |
| 114 |
else { |
else { |
|
//cout << "ANT" << endl; |
|
| 115 |
return ANT; |
return ANT; |
| 116 |
} |
} |
| 117 |
} |
} |
| 120 |
if ((_cutMask & TRG) == TRG) { |
if ((_cutMask & TRG) == TRG) { |
| 121 |
if (event->GetTrigLevel2()) { |
if (event->GetTrigLevel2()) { |
| 122 |
if (event->GetTrigLevel2()->unpackError) { |
if (event->GetTrigLevel2()->unpackError) { |
|
//cout << "TRG" << endl; |
|
| 123 |
return TRG; |
return TRG; |
| 124 |
} |
} |
| 125 |
} |
} |
| 126 |
else { |
else { |
|
//cout << "TRG" << endl; |
|
| 127 |
return TRG; |
return TRG; |
| 128 |
} |
} |
| 129 |
} |
} |
| 145 |
// ++++++++++ ORB ++++++++++ |
// ++++++++++ ORB ++++++++++ |
| 146 |
if ((_cutMask & ORB) == ORB) { |
if ((_cutMask & ORB) == ORB) { |
| 147 |
if (!event->GetOrbitalInfo()) { |
if (!event->GetOrbitalInfo()) { |
|
//cout << "ORB" << endl; |
|
| 148 |
return ORB; |
return ORB; |
| 149 |
} |
} |
| 150 |
} |
} |