Added new Transformer Object.
[u/mrichter/AliRoot.git] / HLT / exa / Binary.C
1 /* $Id$ */
2
3 /**
4 Macro for converting AliRoot digits into L3 RawData. Binary create for each patch its own file. singlepatch uses one file per slice. 
5  */
6
7 Binary(char* in,int first, int last,char *path=""){
8   char name[256];
9   const Int_t npatch = 6;
10   Int_t row[npatch][2] = {{0,31},{32,63},{64,91},{92,119},{120,143},{144,175}};
11   AliL3Logger l;
12   //l.UnSet(AliL3Logger::kDebug);
13   //l.UnSet(AliL3Logger::kAll);
14   //l.Set(AliL3Logger::kInformational);
15   l.UseStdout();
16   //l.UseStream();
17
18   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
19   fFileHandler->SetAliInput(in);
20   AliL3Transform *fTransformer = new AliL3Transform(path);
21   fFileHandler->SetTransformer(fTransformer);
22
23   for(int slice=first; slice<=last; slice++){
24     for(int patch=0;patch<npatch;patch++){
25       cerr<<"reading slice: "<<slice<<" patch: "<<patch<<" and storing to: "<<path<<"digits_"<<slice<<"_"<<patch<<".raw"<<endl;
26       fFileHandler->Free();
27       fFileHandler->Init(slice,patch,row[patch]);      
28       sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
29       fFileHandler->SetBinaryOutput(name);
30       fFileHandler->AliDigits2CompBinary();
31       fFileHandler->CloseBinaryOutput();      
32       cerr<<" done"<<endl;
33     }      
34   }
35   fFileHandler->CloseAliInput();
36 }
37  
38 void singlepatch(char* in,int first, int last,char *path="",int event=0)
39 {
40   AliL3Logger l;
41   //l.UnSet(AliL3Logger::kDebug);
42   //l.UnSet(AliL3Logger::kAll);
43   //l.Set(AliL3Logger::kInformational);
44   //l.UseStdout();
45   l.UseStream();
46   
47   char fname[100];
48   sprintf(fname,"%sevent_%d/",path,event);
49   char name[256];
50   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
51   fFileHandler->SetAliInput(in);
52   Int_t srow[2] = {0,175};
53   int patch=0;
54   for(int slice=first; slice<=last; slice++)
55     {
56       cerr<<"reading slice: "<<slice;
57       fFileHandler->Free();
58       fFileHandler->Init(slice,patch,srow);
59       sprintf(name,"%sdigits_%d_%d.raw",fname,slice,patch);
60       fFileHandler->SetBinaryOutput(name);
61       fFileHandler->AliDigits2CompBinary(event);
62       fFileHandler->CloseBinaryOutput();      
63       cerr<<" done"<<endl;
64     }
65   fFileHandler->CloseAliInput();
66   
67 }