]>
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 | /////////////////////////////////////////////////////////////////////////////// | |
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 | /// | |
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), |
40 | fADCModule(-1), | |
41 | fADCValue(-1), | |
42 | fADCGain(0) | |
8309c1ab | 43 | { |
abf60186 | 44 | // Create an object to read ZDC raw digits |
8309c1ab | 45 | |
362c9d61 | 46 | fRawReader->Select("ZDC"); |
8309c1ab | 47 | } |
48 | ||
49 | //_____________________________________________________________________________ | |
50 | AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) : | |
51 | TObject(stream), | |
52 | fADCValue(-1) | |
53 | { | |
abf60186 | 54 | // Copy constructor |
8309c1ab | 55 | Fatal("AliZDCRawStream", "copy constructor not implemented"); |
56 | } | |
57 | ||
58 | //_____________________________________________________________________________ | |
59 | AliZDCRawStream& AliZDCRawStream::operator = (const AliZDCRawStream& | |
60 | /* stream */) | |
61 | { | |
abf60186 | 62 | // Assignment operator |
8309c1ab | 63 | Fatal("operator =", "assignment operator not implemented"); |
64 | return *this; | |
65 | } | |
66 | ||
67 | //_____________________________________________________________________________ | |
68 | AliZDCRawStream::~AliZDCRawStream() | |
69 | { | |
abf60186 | 70 | // Destructor |
8309c1ab | 71 | |
72 | } | |
73 | ||
74 | ||
75 | //_____________________________________________________________________________ | |
76 | Bool_t AliZDCRawStream::Next() | |
77 | { | |
abf60186 | 78 | // Read the next raw digit |
79 | // Returns kFALSE if there is no digit left | |
8309c1ab | 80 | |
abf60186 | 81 | if(!fRawReader->ReadNextInt((UInt_t&) fRawADC)) return kFALSE; |
8309c1ab | 82 | fIsADCDataWord = kFALSE; |
83 | ||
84 | //ADC Header | |
abf60186 | 85 | if(fRawADC & 0x2000000){ |
86 | if(((fRawADC & 0x3f00) >> 8) == 24) fADCModule=1; //fRawADC=2001800 -> 24 words -> 1st ADC module | |
87 | else if(((fRawADC & 0x3f00) >> 8) == 20) fADCModule=2; //fRawADC=2001400 -> 20 words -> 2nd ADC module | |
88 | // | |
89 | //printf(" **** This is the ADC Header - %d data words will follow \n",((fRawADC & 0x3f00) >> 8)); | |
90 | //printf(" fRawADC = %x, fADCModule = %d\n",fRawADC, fADCModule); | |
91 | } | |
92 | else if((fRawADC & 0x4000000) || (fRawADC & 0x3000000)){ | |
93 | fSector[0] = 0; | |
94 | //ADC EOB | |
95 | /*if(fRawADC & 0x4000000){ | |
96 | printf(" **** This is the ADC End Of Block - event number %d\n",(fRawADC & 0xffffff)); | |
97 | }*/ | |
48642b09 | 98 | } |
8309c1ab | 99 | //ADC Data Words |
abf60186 | 100 | else{ |
cc2abffd | 101 | /*printf("This is an ADC Data Word -> channel %d range %d\n",(fRawADC & 0x1e0000) >> 17, (fRawADC & 0x10000) >> 16); |
31af5828 | 102 | if(fRawADC & 0x1000) printf("ZDCRawStream -> ADC overflow\n"); |
cc2abffd | 103 | if(fRawADC & 0x2000) printf("ZDCRawStream -> ADC underflow\n");*/ |
abf60186 | 104 | // |
8309c1ab | 105 | fADCGain = (fRawADC & 0x10000) >> 16; |
106 | fADCValue = (fRawADC & 0xfff); | |
107 | fIsADCDataWord = kTRUE; | |
abf60186 | 108 | // |
8a2624cc | 109 | Int_t vADCChannel = (fRawADC & 0x1e0000) >> 17; |
abf60186 | 110 | if(fADCModule==1){ //1st ADC module |
111 | if(vADCChannel >= 0 && vADCChannel <= 4){ | |
112 | fSector[0] = 1; | |
113 | fSector[1] = vADCChannel; | |
114 | } | |
115 | else if(vADCChannel >= 8 && vADCChannel <= 12){ | |
116 | fSector[0] = 2; | |
117 | fSector[1] = vADCChannel-8; | |
118 | } | |
119 | else if(vADCChannel == 5 || vADCChannel == 13){ | |
120 | fSector[0] = 3; | |
97f8e77a | 121 | fSector[1] = ((vADCChannel-5)/8)+1; |
abf60186 | 122 | } |
123 | } | |
124 | else if(fADCModule==2){ //2nd ADC module | |
125 | if(vADCChannel >= 0 && vADCChannel <= 4){ | |
126 | fSector[0] = 4; | |
127 | fSector[1] = vADCChannel; | |
128 | } | |
129 | else if(vADCChannel >= 8 && vADCChannel <= 12){ | |
130 | fSector[0] = 5; | |
131 | fSector[1] = vADCChannel-8; | |
132 | } | |
8309c1ab | 133 | } |
cc2abffd | 134 | else Warning("AliZDCRawStream","\t No valid ADC module!\n"); |
abf60186 | 135 | |
8309c1ab | 136 | } |
137 | return kTRUE; | |
138 | } |