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