]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/Binary.C
Changed for new Aliroot version.
[u/mrichter/AliRoot.git] / HLT / exa / Binary.C
1 // $Id$
2
3 /**
4    Macro for converting AliRoot digits into L3 RawData. 
5    Binary creates for each patch its own file. 
6    Singlepatch uses one file per slice (sp=kTRUE). 
7 */
8
9 Binary(char* in,int first, int last,char *path=".",Bool_t sp=kFALSE){
10
11   if(sp) {
12     singlepatch(in,first,last,path);
13     return;
14   }
15
16   char name[256];
17   const Int_t npatch = 6;
18   AliL3Logger l;
19   //l.UnSet(AliL3Logger::kDebug);
20   //l.UnSet(AliL3Logger::kAll);
21   //l.Set(AliL3Logger::kInformational);
22   l.UseStdout();
23   //l.UseStream();
24
25   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
26   fFileHandler->SetAliInput(in);
27   AliL3Transform::Init(path,kTRUE);
28
29   for(int slice=first; slice<=last; slice++){
30     for(int patch=0;patch<npatch;patch++){
31       cerr<<"reading slice: "<<slice<<" patch: "<<patch<<" and storing to: "<<path<<"/digits_"<<slice<<"_"<<patch<<".raw"<<endl;
32       fFileHandler->Free();
33       fFileHandler->Init(slice,patch);      
34       sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
35       fFileHandler->SetBinaryOutput(name);
36       fFileHandler->AliDigits2CompBinary();
37       fFileHandler->CloseBinaryOutput();      
38       cerr<<" done"<<endl;
39     }      
40   }
41   fFileHandler->CloseAliInput();
42 }
43  
44 void singlepatch(char* in,int first=0, int last=0,char *path=".",int event=0)
45 {
46   AliL3Logger l;
47   //l.UnSet(AliL3Logger::kDebug);
48   //l.UnSet(AliL3Logger::kAll);
49   //l.Set(AliL3Logger::kInformational);
50   l.UseStdout();
51   //l.UseStream();
52   
53   char name[256];
54   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
55   fFileHandler->SetAliInput(in);
56   AliL3Transform::Init(path);
57
58   Int_t srow[2] = {0,175};
59   int patch=0;
60   for(int slice=first; slice<=last; slice++)
61     {
62       cerr<<"reading slice: "<<slice;
63       fFileHandler->Free();
64       fFileHandler->Init(slice,patch,srow);
65       sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
66       fFileHandler->SetBinaryOutput(name);
67       fFileHandler->AliDigits2CompBinary(event);
68       fFileHandler->CloseBinaryOutput();      
69       cerr<<" done"<<endl;
70     }
71   fFileHandler->CloseAliInput();
72   
73 }
74
75
76