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