/[PAMELA software]/PamCut/MiscCuts/DataQualCut/DataQualCut.cpp
ViewVC logotype

Annotation of /PamCut/MiscCuts/DataQualCut/DataQualCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Thu Apr 29 13:09:13 2010 UTC (14 years, 7 months ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1
Branch point for: V8
Changes since 1.3: +49 -14 lines
Check for bug in Calo level 1 in 9th reduction added. (Code from E. Mocchiutti)

1 pam-fi 1.1 /*
2     * DataQualCut.cpp
3     *
4     * Created on: 10-mar-2009
5 pam-fi 1.4 * Author: S. Ricciarini, N. Mori, E. Mocchiutti
6 pam-fi 1.1 */
7    
8     /*! @file DataQualCut.cpp The DataQualCut class implementation file */
9    
10     #include "DataQualCut.h"
11    
12 pam-fi 1.4 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 pam-fi 1.1 int DataQualCut::Check(PamLevel2 *event){
56    
57     // ++++++++++ TRK ++++++++++
58     if ((_cutMask & TRK) == TRK) {
59     if (event->GetTrkLevel2()) {
60     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
62     return TRK;
63     }
64     }
65     }
66     else {
67     return TRK;
68     }
69     }
70    
71 pam-fi 1.4 // ++++++++++ CALO LEVEL 2 ++++++++++
72 pam-fi 1.1 if ((_cutMask & CALO) == CALO) {
73     if (event->GetCaloLevel2()) {
74     if (!event->GetCaloLevel2()->IsGood(true)) {
75     return CALO;
76     }
77     }
78     else {
79     return CALO;
80     }
81     }
82    
83 pam-fi 1.4 // ++++++++++ CALO LEVEL 1 ++++++++++
84 pam-fi 1.1 if ((_cutMask & CALO_L1) == CALO_L1) {
85     if (! (event->GetCaloLevel1() ) ) {
86 pam-fi 1.4 return CALO;
87     }
88     if (! CL1IsGood(event->GetCaloLevel1(),event->GetCaloLevel2()) ){
89 pam-fi 1.1 return CALO;
90     }
91     }
92    
93     // ++++++++++ TOF ++++++++++
94     if ((_cutMask & TOF) == TOF) {
95     if (event->GetToFLevel2()) {
96     if (event->GetToFLevel2()->unpackError) { // "unpackerror" here means "unpackerror !=0"
97     return TOF;
98     }
99     }
100     else {
101     return TOF;
102     }
103     }
104    
105 pam-fi 1.2 // ++++++++++ ANT ++++++++++
106     if ((_cutMask & ANT) == ANT) {
107 pam-fi 1.1 if (event->GetAcLevel2()) {
108     if (event->GetAcLevel2()->unpackError || ((event->GetAcLevel2()->status[0] >> 2) & 1)
109     || ((event->GetAcLevel2()->status[1] >> 2) & 1)) {
110 pam-fi 1.3 //cout << "ANT" << endl;
111 pam-fi 1.2 return ANT;
112 pam-fi 1.1 }
113     }
114     else {
115 pam-fi 1.2 return ANT;
116 pam-fi 1.1 }
117     }
118    
119 pam-fi 1.2 // ++++++++++ TRG ++++++++++
120     if ((_cutMask & TRG) == TRG) {
121 pam-fi 1.1 if (event->GetTrigLevel2()) {
122     if (event->GetTrigLevel2()->unpackError) {
123 pam-fi 1.2 return TRG;
124 pam-fi 1.1 }
125     }
126     else {
127 pam-fi 1.2 return TRG;
128 pam-fi 1.1 }
129     }
130 pam-fi 1.2
131     // ++++++++++ ND ++++++++++
132     if ((_cutMask & ND) == ND) {
133     if (event->GetNDLevel2()) {
134     if (event->GetNDLevel2()->unpackError) {
135 pam-fi 1.3 //cout << "ND" << endl;
136 pam-fi 1.2 return ND;
137     }
138     }
139     else {
140 pam-fi 1.3 //cout << "ND" << endl;
141 pam-fi 1.2 return ND;
142     }
143     }
144 pam-fi 1.1
145     // ++++++++++ ORB ++++++++++
146     if ((_cutMask & ORB) == ORB) {
147     if (!event->GetOrbitalInfo()) {
148     return ORB;
149     }
150     }
151    
152     return CUTOK;
153     }

  ViewVC Help
Powered by ViewVC 1.1.23