]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ZDC/AliZDCRawStream.cxx
Removed
[u/mrichter/AliRoot.git] / ZDC / AliZDCRawStream.cxx
CommitLineData
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
33ClassImp(AliZDCRawStream)
34
35
36//_____________________________________________________________________________
37AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
38 fRawReader(rawReader),
cc2abffd 39 fRawADC(0),
83347831 40 fADCModule(0),
cc2abffd 41 fADCValue(-1),
c0aec6f6 42 fADCGain(0),
43 fIsADCDataWord(kFALSE)
8309c1ab 44{
abf60186 45 // Create an object to read ZDC raw digits
8309c1ab 46
362c9d61 47 fRawReader->Select("ZDC");
8309c1ab 48}
49
50//_____________________________________________________________________________
51AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) :
c0aec6f6 52 TObject(stream)
8309c1ab 53{
abf60186 54 // Copy constructor
c0aec6f6 55 fRawADC = stream.GetADCRaw();
56 for(Int_t j=0; j<2; j++) fSector[j] = stream.GetSector(j);
57 fADCModule = stream.GetADCModule();
58 fADCValue = stream.GetADCValue();
59 fADCGain = stream.GetADCGain();
60 fIsADCDataWord = stream.IsADCDataWord();
61
62
8309c1ab 63}
64
65//_____________________________________________________________________________
66AliZDCRawStream& AliZDCRawStream::operator = (const AliZDCRawStream&
67 /* stream */)
68{
abf60186 69 // Assignment operator
8309c1ab 70 Fatal("operator =", "assignment operator not implemented");
71 return *this;
72}
73
74//_____________________________________________________________________________
75AliZDCRawStream::~AliZDCRawStream()
76{
abf60186 77// Destructor
8309c1ab 78
79}
80
81
82//_____________________________________________________________________________
83Bool_t AliZDCRawStream::Next()
84{
abf60186 85 // Read the next raw digit
86 // Returns kFALSE if there is no digit left
8309c1ab 87
abf60186 88 if(!fRawReader->ReadNextInt((UInt_t&) fRawADC)) return kFALSE;
8309c1ab 89 fIsADCDataWord = kFALSE;
90
83347831 91 if(fRawADC & 0x2000000){//ADC Header
92 fADCModule++;
93 //printf(" \t AliZDCRawStream -> Header ADC %d -> ADC datum contains %d data words \n",fADCModule,((fRawADC & 0x3f00) >> 8));
abf60186 94 }
83347831 95 else if((fRawADC & 0x4000000)){//ADC EOB
96 //printf(" \t AliZDCRawStream -> ADC %d End Of Block - event number %d\n\n",fADCModule, (fRawADC & 0xffffff));
97 fSector[0] = fSector[1] = 99;
48642b09 98 }
83347831 99 else if((fRawADC & 0x6000000)){//Not valid datum
100 printf(" \t AliZDCRawStream -> Not valid datum in ADC module %d\n",fADCModule);
101 }
102 else{//ADC data word
8309c1ab 103 fIsADCDataWord = kTRUE;
83347831 104 //printf(" \t \t ADC Data Word");
105 if(!(fRawADC & 0x1000) && !(fRawADC & 0x2000)){ // Valid ADC data
106 fADCGain = (fRawADC & 0x10000) >> 16;
107 fADCValue = (fRawADC & 0xfff);
108 //
109 Int_t vADCChannel = (fRawADC & 0x1e0000) >> 17;
110 if(fADCModule==1 || fADCModule==3){ //1st & 3rd ADC modules
111 if(vADCChannel >= 0 && vADCChannel <= 4){
112 fSector[0] = 1; // ZN1
113 fSector[1] = vADCChannel;
114 }
115 else if(vADCChannel >= 8 && vADCChannel <= 12){
116 fSector[0] = 2; // ZP1
117 fSector[1] = vADCChannel-8;
118 }
119 else if(vADCChannel == 5 || vADCChannel == 13){
120 fSector[0] = 3; // ZEM 1,2
121 fSector[1] = ((vADCChannel-5)/8)+1;
122 }
abf60186 123 }
83347831 124 else if(fADCModule==2 || fADCModule==4){ //2nd & 4rth ADC modules
125 if(vADCChannel >= 0 && vADCChannel <= 4){
126 fSector[0] = 4; // ZN2
127 fSector[1] = vADCChannel;
128 }
129 else if(vADCChannel >= 8 && vADCChannel <= 12){
130 fSector[0] = 5; // ZP2
131 fSector[1] = vADCChannel-8;
132 }
133 else if(vADCChannel == 5 || vADCChannel == 13){
07580130 134 fSector[0] = (vADCChannel-5)*3/8+1; // PM Ref 1,2
83347831 135 fSector[1] = 5;
136 }
137 }
138 else{
139 AliWarning(" \t AliZDCRawStream -> No valid ADC module!");
140 printf(" ADCmod = %d\n", fADCModule);
141 fRawReader->AddMajorErrorLog(kInvalidADCModule);
142 }
143 /*printf(" \t \tADC %d ch %d range %d -> det %d quad %d value %x\n",
144 fADCModule, vADCChannel, fADCGain, fSector[0], fSector[1], fADCValue);//Chiara debugging
145 */
abf60186 146 }
83347831 147 else if(fRawADC & 0x1000)
148 printf(" \t \tADC %d ch %d range %d overflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Overflow
149 else if(fRawADC & 0x2000)
150 printf(" \t \tADC %d ch %d range %d underflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Underflow
8309c1ab 151 }
83347831 152
8309c1ab 153 return kTRUE;
154}