Using TMath::Abs instead of fabs
[u/mrichter/AliRoot.git] / HLT / exa / convert.C
1 // $Id$
2
3 /**
4    Macro for converting 10 bit rawdata into 8 bit rawdata.
5 */
6
7 void convert(Int_t sl=0,Int_t sh=35,Char_t *path1="./", Char_t *path2="./")
8 {
9   char fname[250];
10   AliL3Logger l;
11   //l.UnSet(AliL3Logger::kDebug);
12   //l.UnSet(AliL3Logger::kAll);
13   //l.Set(AliL3Logger::kInformational);
14   l.UseStdout();
15   //l.UseStream();
16
17   for(int slice=sl; slice<=sh; slice++)
18     {
19       for(int patch=0; patch<6; patch++)
20         {
21           file = new AliL3DataHandler();
22           file->Init(slice,patch);
23           sprintf(fname,"%s/digits_%d_%d.raw",path1,slice,patch);
24           file->SetBinaryInput(fname);
25           sprintf(fname,"%s/digits_c8_%d_%d.raw",path2,slice,patch);
26           file->SetBinaryOutput(fname);
27           file->Convert10to8Bit();
28           file->CloseBinaryInput();
29           file->CloseBinaryOutput();
30           
31           delete file;
32         }
33     }
34 }
35
36 #if 0
37 void read()
38 {
39   AliL3MemHandler *file = new AliL3DataHandler();
40   file->SetBinaryInput("/prog/alice/data/new/fixed-slice0/rawdata_8bit/1part/digits_c8_0_5.raw");
41   //file->SetBinaryInput("test.raw");
42   UInt_t ndigits;
43   AliL3DigitRowData *data = (AliL3DigitRowData*)file->CompBinary2Memory(ndigits);
44   
45   cout<<"Number of rows: "<<ndigits<<endl;
46   
47   AliL3DigitData *digPt=0;
48   for(int i=0; i<32; i++)
49     {
50       //cout<<(int)data->fRow<<endl;
51       digPt = data->fDigitData;
52       //cout<<"Number of digits: "<<(int)data->fNDigit<<endl;
53       for(int j=0; j<data->fNDigit; j++)
54         {
55           cout<<"Row "<<(int)data->fRow<<" pad "<<(int)digPt[j].fPad<<" time "<<(int)digPt[j].fTime<<" charge "<<(int)digPt[j].fCharge<<endl;
56         }
57
58       file->UpdateRowPointer(data);
59       
60     }
61 }
62 endif