]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCH5OptimizedTables.C
TPC module
[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);
c9bd9d3d 18
9f992f70 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 };
c9bd9d3d 55
9f992f70 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
c9bd9d3d 61 //util->ReadAltroFormat("File1.txt",fSource);
2e9f335b 62
9f992f70 63 //The source file is compressed
2e9f335b 64 timer.Start();
65 util->CompressDataOptTables(NumTable,fSource,fDest);
66 timer.Stop();
67 timer.Print();
68
9f992f70 69
70 /*
2e9f335b 71 //The Compressed file is decompressed
72 timer.Start();
73 util->DecompressDataOptTables(NumTable,fDest);
74 timer.Stop();
75 timer.Print();
9f992f70 76 util->ReadAltroFormat("File2.txt","SourceDecompressed.dat");
2e9f335b 77 */
78 delete util;
79}