1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////////
20 // This class provides access to ZDC digits in raw data. //
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. //
27 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliZDCRawStream.h"
30 #include "AliRawReader.h"
33 ClassImp(AliZDCRawStream)
36 //_____________________________________________________________________________
37 AliZDCRawStream::AliZDCRawStream(AliRawReader* rawReader) :
38 fRawReader(rawReader),
43 fIsADCDataWord(kFALSE)
45 // Create an object to read ZDC raw digits
47 fRawReader->Select("ZDC");
50 //_____________________________________________________________________________
51 AliZDCRawStream::AliZDCRawStream(const AliZDCRawStream& stream) :
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();
64 //_____________________________________________________________________________
65 AliZDCRawStream& AliZDCRawStream::operator = (const AliZDCRawStream&
68 // Assignment operator
69 Fatal("operator =", "assignment operator not implemented");
73 //_____________________________________________________________________________
74 AliZDCRawStream::~AliZDCRawStream()
81 //_____________________________________________________________________________
82 Bool_t AliZDCRawStream::Next()
84 // Read the next raw digit
85 // Returns kFALSE if there is no digit left
87 if(!fRawReader->ReadNextInt((UInt_t&) fRawADC)) return kFALSE;
88 fIsADCDataWord = kFALSE;
90 if(fRawADC & 0x2000000){//ADC Header
92 //printf(" \t AliZDCRawStream -> Header ADC %d -> ADC datum contains %d data words \n",fADCModule,((fRawADC & 0x3f00) >> 8));
94 else if(fRawADC & 0x4000000){//ADC EOB
95 //printf(" \t AliZDCRawStream -> ADC %d End Of Block - event number %d\n\n",fADCModule, (fRawADC & 0xffffff));
96 fSector[0] = fSector[1] = 99;
98 else if(fRawADC & 0x6000000){//Not valid datum
99 printf(" \t AliZDCRawStream -> Not valid datum in ADC module %d\n",fADCModule);
102 fIsADCDataWord = kTRUE;
103 //printf(" \t \t ADC Data Word");
104 if(!(fRawADC & 0x1000) && !(fRawADC & 0x2000)){ // Valid ADC data
105 fADCGain = (fRawADC & 0x10000) >> 16;
106 fADCValue = (fRawADC & 0xfff);
108 Int_t vADCChannel = (fRawADC & 0x1e0000) >> 17;
109 if(fADCModule==1 || fADCModule==3){ //1st & 3rd ADC modules
110 if(vADCChannel >= 0 && vADCChannel <= 4){
111 fSector[0] = 1; // ZN1
112 fSector[1] = vADCChannel;
114 else if(vADCChannel >= 8 && vADCChannel <= 12){
115 fSector[0] = 2; // ZP1
116 fSector[1] = vADCChannel-8;
118 else if(vADCChannel == 5 || vADCChannel == 13){
119 fSector[0] = 3; // ZEM 1,2
120 fSector[1] = ((vADCChannel-5)/8)+1;
123 else if(fADCModule==2 || fADCModule==4){ //2nd & 4rth ADC modules
124 if(vADCChannel >= 0 && vADCChannel <= 4){
125 fSector[0] = 4; // ZN2
126 fSector[1] = vADCChannel;
128 else if(vADCChannel >= 8 && vADCChannel <= 12){
129 fSector[0] = 5; // ZP2
130 fSector[1] = vADCChannel-8;
132 else if(vADCChannel == 5 || vADCChannel == 13){
133 fSector[0] = (vADCChannel-5)*3/8+1; // PM Ref 1,2
138 AliWarning(" \t AliZDCRawStream -> No valid ADC module!");
139 printf(" ADCmod = %d\n", fADCModule);
140 fRawReader->AddMajorErrorLog(kInvalidADCModule);
142 /*printf(" \t \tADC %d ch %d range %d -> det %d quad %d value %x\n",
143 fADCModule, vADCChannel, fADCGain, fSector[0], fSector[1], fADCValue);//Chiara debugging
146 else if(fRawADC & 0x1000)
147 printf(" \t \tADC %d ch %d range %d overflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Overflow
148 else if(fRawADC & 0x2000)
149 printf(" \t \tADC %d ch %d range %d underflow\n",fADCModule, (fRawADC & 0x1e0000) >> 17, fADCGain); // Underflow