Using TMath::Abs instead of fabs
[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
cd234d8a 11 AliL3Transform::Init(path);
12
086f41d8 13 if(sp) {
14 singlepatch(in,first,last,path);
15 return;
16 }
fd337011 17
f2793c29 18 char name[256];
eb13caca 19 const Int_t npatch = 6;
cd234d8a 20
fd337011 21 AliL3FileHandler *fFileHandler = new AliL3FileHandler();
22 fFileHandler->SetAliInput(in);
fd337011 23
f2793c29 24 for(int slice=first; slice<=last; slice++){
eb13caca 25 for(int patch=0;patch<npatch;patch++){
d9ca376a 26 cerr<<"reading slice: "<<slice<<" patch: "<<patch<<" and storing to: "<<path<<"/digits_"<<slice<<"_"<<patch<<".raw"<<endl;
058d766f 27 fFileHandler->Init(slice,patch);
fd337011 28 sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
f2793c29 29 fFileHandler->SetBinaryOutput(name);
30 fFileHandler->AliDigits2CompBinary();
31 fFileHandler->CloseBinaryOutput();
cd234d8a 32 fFileHandler->Free();
f2793c29 33 cerr<<" done"<<endl;
34 }
35 }
36 fFileHandler->CloseAliInput();
37}
cd234d8a 38
39void write2rootfile(char *in,int first,int last,char *path)
40{
41 //Write new rootfile, using data from the binary files.
42
43 AliL3Transform::Init(path);
44 char filename[1024];
45 sprintf(filename,"%s/digitfile.root",path);
46 file = TFile::Open(filename,"READ");
47 if(file->IsOpen())
48 {
49 cout<<"Delete file "<<filename<<endl;
50 return;
51 }
52 for(int slice=first; slice<=last; slice++)
53 {
54 for(int patch=0; patch<=5; patch++)
55 {
56 c = new AliL3Compress(slice,patch,path);
57 c->WriteRootFile(filename,in);
58 delete c;
59 }
60 }
61
62}
8f25fe14 63
c864fdd1 64void singlepatch(char* in,int first=0, int last=0,char *path=".",int event=0)
8f25fe14 65{
66 AliL3Logger l;
fd337011 67 //l.UnSet(AliL3Logger::kDebug);
68 //l.UnSet(AliL3Logger::kAll);
69 //l.Set(AliL3Logger::kInformational);
e0dcd0b5 70 l.UseStderr();
086f41d8 71 //l.UseStream();
8f25fe14 72
8f25fe14 73 char name[256];
74 AliL3FileHandler *fFileHandler = new AliL3FileHandler();
75 fFileHandler->SetAliInput(in);
c864fdd1 76
8f25fe14 77 Int_t srow[2] = {0,175};
78 int patch=0;
79 for(int slice=first; slice<=last; slice++)
80 {
81 cerr<<"reading slice: "<<slice;
82 fFileHandler->Free();
83 fFileHandler->Init(slice,patch,srow);
c864fdd1 84 sprintf(name,"%s/digits_%d_%d.raw",path,slice,patch);
8f25fe14 85 fFileHandler->SetBinaryOutput(name);
86 fFileHandler->AliDigits2CompBinary(event);
87 fFileHandler->CloseBinaryOutput();
88 cerr<<" done"<<endl;
89 }
90 fFileHandler->CloseAliInput();
91
92}
c864fdd1 93
a740d2c6 94void make_init_file(Char_t *f,Char_t *path="./"){
a8e4cc39 95 AliL3Logger l;
96 //l.UnSet(AliL3Logger::kDebug);
97 //l.UnSet(AliL3Logger::kAll);
98 //l.Set(AliL3Logger::kInformational);
99 l.UseStderr();
100 //l.UseStream();
101
e0dcd0b5 102 AliL3Transform::MakeInitFile(f,path);
103}