Little bugfix for new aliroot version 3.08.
[u/mrichter/AliRoot.git] / HLT / exa / binary.C
CommitLineData
086f41d8 1// $Id$
fd337011 2
3/**
086f41d8 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
a740d2c6 9binary(char* in,int first, int last,char *path=".",Bool_t sp=kFALSE){
086f41d8 10
11 if(sp) {
12 singlepatch(in,first,last,path);
13 return;
14 }
fd337011 15
f2793c29 16 char name[256];
eb13caca 17 const Int_t npatch = 6;
fd337011 18 AliL3Logger l;
19 //l.UnSet(AliL3Logger::kDebug);
20 //l.UnSet(AliL3Logger::kAll);
21 //l.Set(AliL3Logger::kInformational);
e0dcd0b5 22 l.UseStderr();
fd337011 23 //l.UseStream();
24
e0dcd0b5 25 //read init file
26 AliL3Transform::Init(path);
27
fd337011 28 AliL3FileHandler *fFileHandler = new AliL3FileHandler();
29 fFileHandler->SetAliInput(in);
fd337011 30
f2793c29 31 for(int slice=first; slice<=last; slice++){
eb13caca 32 for(int patch=0;patch<npatch;patch++){
d9ca376a 33 cerr<<"reading slice: "<<slice<<" patch: "<<patch<<" and storing to: "<<path<<"/digits_"<<slice<<"_"<<patch<<".raw"<<endl;
8f25fe14 34 fFileHandler->Free();
058d766f 35 fFileHandler->Init(slice,patch);
fd337011 36 sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
f2793c29 37 fFileHandler->SetBinaryOutput(name);
38 fFileHandler->AliDigits2CompBinary();
39 fFileHandler->CloseBinaryOutput();
40 cerr<<" done"<<endl;
41 }
42 }
43 fFileHandler->CloseAliInput();
44}
8f25fe14 45
c864fdd1 46void singlepatch(char* in,int first=0, int last=0,char *path=".",int event=0)
8f25fe14 47{
48 AliL3Logger l;
fd337011 49 //l.UnSet(AliL3Logger::kDebug);
50 //l.UnSet(AliL3Logger::kAll);
51 //l.Set(AliL3Logger::kInformational);
e0dcd0b5 52 l.UseStderr();
086f41d8 53 //l.UseStream();
8f25fe14 54
e0dcd0b5 55 //read init file
56 AliL3Transform::Init(path);
57
8f25fe14 58 char name[256];
59 AliL3FileHandler *fFileHandler = new AliL3FileHandler();
60 fFileHandler->SetAliInput(in);
c864fdd1 61
8f25fe14 62 Int_t srow[2] = {0,175};
63 int patch=0;
64 for(int slice=first; slice<=last; slice++)
65 {
66 cerr<<"reading slice: "<<slice;
67 fFileHandler->Free();
68 fFileHandler->Init(slice,patch,srow);
c864fdd1 69 sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
8f25fe14 70 fFileHandler->SetBinaryOutput(name);
71 fFileHandler->AliDigits2CompBinary(event);
72 fFileHandler->CloseBinaryOutput();
73 cerr<<" done"<<endl;
74 }
75 fFileHandler->CloseAliInput();
76
77}
c864fdd1 78
a740d2c6 79void make_init_file(Char_t *f,Char_t *path="./"){
e0dcd0b5 80 AliL3Transform::MakeInitFile(f,path);
81}