]>
Commit | Line | Data |
---|---|---|
8309c1ab | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
83347831 | 19 | // // |
20 | // This class provides access to ZDC digits in raw data. // | |
21 | // // | |
22 | // It loops over all ZDC digits in the raw data given by the AliRawReader. // | |
23 | // The Next method goes to the next digit. If there are no digits left // | |
24 | // it returns kFALSE. // | |
25 | // Getters provide information about the current digit. // | |
26 | // // | |
8309c1ab | 27 | /////////////////////////////////////////////////////////////////////////////// |
28 | ||
29 | #include "AliZDCRawStream.h" | |
30 | #include "AliRawReader.h" | |
cc2abffd | 31 | #include "AliLog.h" |
8309c1ab | 32 | |
33 | ClassImp(AliZDCRawStream) | |
34 | ||
35 | ||
36 | //_____________________________________________________________________________ | |
37 | AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) : | |
38 | fRawReader(rawReader), | |
cc2abffd | 39 | fRawADC(0), |
786b72f5 | 40 | fADCModule(0), |
41 | fADCChannel(-1), | |
cc2abffd | 42 | fADCValue(-1), |
c0aec6f6 | 43 | fADCGain(0), |
44 | fIsADCDataWord(kFALSE) | |
8309c1ab | 45 | { |
abf60186 | 46 | // Create an object to read ZDC raw digits |
8309c1ab | 47 | |
362c9d61 | 48 | fRawReader->Select("ZDC"); |
8309c1ab | 49 | } |
50 | ||
51 | //_____________________________________________________________________________ | |
52 | AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) : | |
a718c993 | 53 | TObject(stream), |
c61a7285 | 54 | fRawReader(stream.fRawReader), |
a718c993 | 55 | fRawADC(stream.GetADCRaw()), |
56 | fADCModule(stream.GetADCModule()), | |
57 | fADCChannel(stream.GetADCChannel()), | |
58 | fADCValue(stream.GetADCValue()), | |
59 | fADCGain(stream.GetADCGain()), | |
60 | fIsADCDataWord(stream.IsADCDataWord()) | |
8309c1ab | 61 | { |
abf60186 | 62 | // Copy constructor |
c0aec6f6 | 63 | for(Int_t j=0; j<2; j++) fSector[j] = stream.GetSector(j); |
c0aec6f6 | 64 | |
8309c1ab | 65 | } |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | AliZDCRawStream& AliZDCRawStream::operator = (const AliZDCRawStream& | |
69 | /* stream */) | |
70 | { | |
abf60186 | 71 | // Assignment operator |
8309c1ab | 72 | Fatal("operator =", "assignment operator not implemented"); |
73 | return *this; | |
74 | } | |
75 | ||
76 | //_____________________________________________________________________________ | |
77 | AliZDCRawStream::~AliZDCRawStream() | |
78 | { | |
abf60186 | 79 | // Destructor |
8309c1ab | 80 | |
81 | } | |
82 | ||
83 | ||
84 | //_____________________________________________________________________________ | |
85 | Bool_t AliZDCRawStream::Next() | |
86 | { | |
abf60186 | 87 | // Read the next raw digit |
88 | // Returns kFALSE if there is no digit left | |
8309c1ab | 89 | |
abf60186 | 90 | if(!fRawReader->ReadNextInt((UInt_t&) fRawADC)) return kFALSE; |
8309c1ab | 91 | fIsADCDataWord = kFALSE; |
6006df88 | 92 | // |
1069e28d | 93 | // --- DARC header |
94 | if((fRawADC == 0xe52b6300) || (fRawADC == 0xe52c0300) || (fRawADC == 0xffffffff) || | |
95 | (fRawADC == 0xdeadface) || (fRawADC == 0xdeadbeef)){ | |
96 | //printf(" This is a DARC header!!!\n"); | |
abf60186 | 97 | } |
1069e28d | 98 | // --- End of data |
99 | else if(fRawADC == 0xcafefade){ | |
100 | //printf(" End of data!\n"); | |
101 | } | |
102 | // --- ADC buffer | |
6006df88 | 103 | else{ |
786b72f5 | 104 | Bool_t firstADCHeader = kTRUE; |
105 | // | |
106 | if((fRawADC & 0x6000000) == 0x6000000){ // Not valid datum BEFORE valid data! | |
107 | firstADCHeader = kFALSE; | |
1069e28d | 108 | //printf(" AliZDCRawStream -> Not valid datum in ADC module!!! %d\n",fADCModule); |
6006df88 | 109 | } |
1069e28d | 110 | else if((fRawADC & 0x4000000) == 0x4000000){ // ADC EOB |
111 | //printf(" AliZDCRawStream -> ADC %d End Of Block - Event no. %d\n\n",fADCModule, (fRawADC & 0xffffff)); | |
6006df88 | 112 | fSector[0] = fSector[1] = 99; |
113 | } | |
1069e28d | 114 | else if((fRawADC & 0x2000000) == 0x2000000){ // ADC Header |
41f31182 | 115 | //printf(" fRawADC %x\n",fRawADC); |
1069e28d | 116 | // Reading the GEO address to determine ADC module |
117 | fADCModule = (fRawADC & 0xf8000000) >> 27; | |
118 | fADCModule ++; | |
786b72f5 | 119 | // If the not valid datum isn't followed by the 1st ADC header |
120 | // the event is corrupted (i.e., 2 gates arrived before trigger) | |
121 | if(fADCModule == 1) firstADCHeader = kTRUE; | |
122 | //if(fADCModule == 1) printf(" fADCModule %d, firstADCHeader %d\n",fADCModule,firstADCHeader); | |
123 | //printf(" AliZDCRawStream -> HEADER: ADC mod. %d contains %d data words \n",fADCModule,((fRawADC & 0x3f00) >> 8)); | |
6006df88 | 124 | } |
1069e28d | 125 | else{ // ADC data word |
6006df88 | 126 | fIsADCDataWord = kTRUE; |
786b72f5 | 127 | //printf(" fRawADC = %x firstADCHeader %d\n",fRawADC,firstADCHeader); |
1069e28d | 128 | // |
786b72f5 | 129 | if(!(fRawADC & 0x1000) && !(fRawADC & 0x2000) && firstADCHeader){ // Valid ADC data |
6006df88 | 130 | fADCGain = (fRawADC & 0x10000) >> 16; |
131 | fADCValue = (fRawADC & 0xfff); | |
132 | // | |
786b72f5 | 133 | fADCChannel = (fRawADC & 0x1e0000) >> 17; |
134 | // | |
135 | // If raw data corresponds to an ADC ch. without physical signal | |
136 | // fsector[0] = fSector[1] = -1 | |
137 | for(Int_t i=0; i<2; i++)fSector[i] = -1; | |
138 | //if(fSector[0]!=-1) printf(" \t \t ADC Data Word: ADC ch. %d",fADCChannel); | |
139 | // | |
6006df88 | 140 | if(fADCModule==1 || fADCModule==3){ //1st & 3rd ADC modules |
786b72f5 | 141 | if(fADCChannel >= 0 && fADCChannel <= 4){ |
6006df88 | 142 | fSector[0] = 1; // ZN1 |
786b72f5 | 143 | fSector[1] = fADCChannel; |
6006df88 | 144 | } |
786b72f5 | 145 | else if(fADCChannel >= 8 && fADCChannel <= 12){ |
6006df88 | 146 | fSector[0] = 2; // ZP1 |
786b72f5 | 147 | fSector[1] = fADCChannel-8; |
6006df88 | 148 | } |
786b72f5 | 149 | else if(fADCChannel == 5 || fADCChannel == 13){ |
6006df88 | 150 | fSector[0] = 3; // ZEM 1,2 |
786b72f5 | 151 | fSector[1] = ((fADCChannel-5)/8)+1; |
6006df88 | 152 | } |
83347831 | 153 | } |
6006df88 | 154 | else if(fADCModule==2 || fADCModule==4){ //2nd & 4rth ADC modules |
786b72f5 | 155 | if(fADCChannel >= 0 && fADCChannel <= 4){ |
6006df88 | 156 | fSector[0] = 4; // ZN2 |
786b72f5 | 157 | fSector[1] = fADCChannel; |
6006df88 | 158 | } |
786b72f5 | 159 | else if(fADCChannel >= 8 && fADCChannel <= 12){ |
6006df88 | 160 | fSector[0] = 5; // ZP2 |
786b72f5 | 161 | fSector[1] = fADCChannel-8; |
6006df88 | 162 | } |
786b72f5 | 163 | else if(fADCChannel == 5 || fADCChannel == 13){ |
164 | fSector[0] = (fADCChannel-5)*3/8+1; // PM Ref 1,2 | |
6006df88 | 165 | fSector[1] = 5; |
166 | } | |
83347831 | 167 | } |
6006df88 | 168 | else{ |
1069e28d | 169 | AliWarning(" AliZDCRawStream -> No valid ADC module\n"); |
6006df88 | 170 | fRawReader->AddMajorErrorLog(kInvalidADCModule); |
171 | } | |
1069e28d | 172 | //printf(" ADC %d ch %d range %d -> det %d quad %d value %x\n", |
786b72f5 | 173 | // fADCModule, fADCChannel, fADCGain, fSector[0], fSector[1], fADCValue);//Chiara debugging |
6006df88 | 174 | |
1069e28d | 175 | }// Valid ADC data |
176 | else if(fRawADC & 0x1000){ | |
177 | //printf(" ADC %d ch %d range %d overflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Overflow | |
6006df88 | 178 | } |
1069e28d | 179 | else if(fRawADC & 0x2000){ |
180 | //printf(" ADC %d ch %d range %d underflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Underflow | |
181 | } | |
182 | }// ADC word | |
6006df88 | 183 | }//Not DARC Header |
83347831 | 184 | |
8309c1ab | 185 | return kTRUE; |
186 | } |