]>
Commit | Line | Data |
---|---|---|
1 | #if !defined(__CINT__) | |
2 | #include <Riostream.h> | |
3 | #include <TStopwatch.h> | |
4 | #include "AliTPCCompression.h" | |
5 | #endif | |
6 | ||
7 | /* | |
8 | This macro compress and decompress an Altro format file using Huffman technique with 5 tables | |
9 | */ | |
10 | ||
11 | void AliTPCH5OptimizedTables(const char* fSource="AltroFormat.dat",const char* fDest="CompressedData.dat"){ | |
12 | cout<<"Source file: "<<fSource<<" Output file: "<<fDest<<endl; | |
13 | static const Int_t NumTable=5; | |
14 | AliTPCCompression *util = new AliTPCCompression(); | |
15 | TStopwatch timer; | |
16 | //verbose level can be: 0=silent 1=few messages 2=pedantic output | |
17 | util->SetVerbose(1); | |
18 | ||
19 | Int_t choice; | |
20 | do{ | |
21 | cout<<"**** Chose the tables set **** "<<endl; | |
22 | cout<<"1==> Create tables from the input file "<<endl; | |
23 | cout<<"2==> Use external optimized tables (txt format)"<<endl; | |
24 | cout<<"3==> Time gap and Bunch length tables generated using formulas "<<endl; | |
25 | cout<<"Insert the corresponding number: "; | |
26 | cin>>choice; | |
27 | cout<<endl; | |
28 | }while((choice<1)||(choice>3)); | |
29 | switch(choice){ | |
30 | case 1:{ | |
31 | //Tables are created | |
32 | util->CreateTables(fSource,NumTable); | |
33 | cout<<"Tables have been created"<<endl; | |
34 | break; | |
35 | } | |
36 | case 2:{ | |
37 | util->CreateTablesFromTxtFiles(NumTable); | |
38 | break; | |
39 | } | |
40 | case 3:{ | |
41 | Double_t beta,gamma=0; | |
42 | ULong_t mul=0; | |
43 | cout<<"Multiplicity (suggested 20000) ==> "; | |
44 | cin>>mul; | |
45 | cout<<"Gamma (suggested 4.77) ==> "; | |
46 | cin>>gamma; | |
47 | cout<<"Beta (suggested 0.37) ==> "; | |
48 | cin>>beta; | |
49 | util->CreateTables(fSource,NumTable); | |
50 | util->CreateTableFormula(gamma,mul,300,0); | |
51 | util->CreateTableFormula(beta,mul,445,1); | |
52 | break; | |
53 | } | |
54 | }; | |
55 | ||
56 | //BE CAREFUL, the following method must be used only for debugging and | |
57 | //it is highly suggested to use it only for debugging files | |
58 | //reasonably small, because otherwise the size of the txt files can reach | |
59 | //quickly several MB wasting time and disk space. | |
60 | ||
61 | //util->ReadAltroFormat("File1.txt",fSource); | |
62 | ||
63 | //The source file is compressed | |
64 | timer.Start(); | |
65 | util->CompressDataOptTables(NumTable,fSource,fDest); | |
66 | timer.Stop(); | |
67 | timer.Print(); | |
68 | ||
69 | ||
70 | /* | |
71 | //The Compressed file is decompressed | |
72 | timer.Start(); | |
73 | util->DecompressDataOptTables(NumTable,fDest); | |
74 | timer.Stop(); | |
75 | timer.Print(); | |
76 | util->ReadAltroFormat("File2.txt","SourceDecompressed.dat"); | |
77 | */ | |
78 | delete util; | |
79 | } |