]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/exa/binary.C
Introduction of a fast version of the AliITSVertexerZ for HLT
[u/mrichter/AliRoot.git] / HLT / exa / binary.C
1 // $Id$
2
3 /**
4    Macro for converting AliRoot digits into HLT RawData. 
5    Binary creates for each patch its own file. 
6    Singlepatch uses one file per slice (sp=kTRUE). 
7    Use altro=kFALSE if you dont want to 
8    filter out single timebins
9
10    Run with ALIROOT (not ROOT)
11 */
12
13 binary(Char_t* inpath,Char_t *outpath,Int_t first,Int_t last,Int_t event,Bool_t sp=kFALSE,Bool_t altro=kTRUE){
14
15   AliL3Transform::Init(inpath,kTRUE);
16
17   if(sp) {
18     singlepatch(inpath,outpath,first,last,event,altro);
19     return;
20   }
21
22   Char_t name[256];
23   const Int_t npatch = 6;
24
25   sprintf(name,"%s/digitfile.root",inpath);
26   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
27   fFileHandler->SetAliInput(name);
28
29   for(Int_t slice=first; slice<=last; slice++){
30     for(Int_t patch=0;patch<npatch;patch++){
31       cerr<<"reading slice: "<<slice<<" patch: "<<patch<<" and storing to: "<<outpath<<"/digits_"<<slice<<"_"<<patch<<".raw"<<endl;
32       fFileHandler->Init(slice,patch);      
33       sprintf(name,"%s/digits_%d_%d_%d.raw",outpath,event,slice,patch);
34       fFileHandler->SetBinaryOutput(name);
35       fFileHandler->AliDigits2CompBinary(event,altro);
36       fFileHandler->CloseBinaryOutput();      
37       fFileHandler->Free();
38       cerr<<" done"<<endl;
39     }      
40   }
41   fFileHandler->CloseAliInput();
42 }
43
44 void singlepatch(Char_t* inpath,Char_t *outpath,Int_t first=0, Int_t last=0,Int_t event=0,Bool_t altro=kTRUE)
45 {
46    
47   Char_t name[256];
48   AliL3FileHandler *fFileHandler = new AliL3FileHandler(); 
49   sprintf(name,"%s/digitfile.root",inpath);
50   fFileHandler->SetAliInput(name);
51   
52   Int_t patch=-1;
53   for(Int_t slice=first; slice<=last; slice++)
54     {
55       cerr<<"reading slice: "<<slice;
56       fFileHandler->Free();
57       fFileHandler->Init(slice,patch);
58       sprintf(name,"%s/digits_%d_%d_%d.raw",outpath,event,slice,patch);
59       fFileHandler->SetBinaryOutput(name);
60       fFileHandler->AliDigits2CompBinary(event,altro);
61       fFileHandler->CloseBinaryOutput();      
62       cerr<<" done"<<endl;
63     }
64   fFileHandler->CloseAliInput();
65   
66 }
67
68 void write2rootfile(Char_t *in,Int_t first,Int_t last,Char_t *path)
69 {
70   //Write new rootfile, using data from the binary files. 
71
72   AliL3Transform::Init(path);
73   char filename[1024];
74   sprintf(filename,"%s/digitfile.root",path);
75   file = TFile::Open(filename,"READ");
76   if(file->IsOpen())
77     {
78       cout<<"Delete file "<<filename<<endl;
79       return;
80     }
81   for(Int_t slice=first; slice<=last; slice++)
82     {
83       for(Int_t patch=0; patch<=5; patch++)
84         {
85           c = new AliL3Compress(slice,patch,path);
86           c->WriteRootFile(filename,in);
87           delete c;
88         }
89     }
90   
91 }
92
93 void make_init_file(Char_t *f,Char_t *path="./"){
94   AliL3Transform::MakeInitFile(f,path);
95 }