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