1 |
loizides |
1.3 |
// $Id: OptInt.cc,v 1.2 2009/02/24 20:13:57 loizides Exp $
|
2 |
loizides |
1.1 |
|
3 |
|
|
#include "MitCommon/OptIO/interface/OptInt.h"
|
4 |
|
|
#include <TROOT.h>
|
5 |
|
|
#include <TSystem.h>
|
6 |
|
|
#include <TError.h>
|
7 |
|
|
#include <TEnv.h>
|
8 |
|
|
#include <Riostream.h>
|
9 |
|
|
|
10 |
|
|
ClassImp(mithep::OptInt)
|
11 |
|
|
|
12 |
|
|
using namespace mithep;
|
13 |
|
|
|
14 |
|
|
extern "C" void R__SetZipMode(int zipmode);
|
15 |
|
|
|
16 |
|
|
extern double lzipfrac;
|
17 |
|
|
extern double gzipfrac;
|
18 |
|
|
extern double bzipfrac;
|
19 |
loizides |
1.2 |
extern double lzmafrac;
|
20 |
loizides |
1.1 |
extern int myverbose;
|
21 |
|
|
extern int mystaticm;
|
22 |
|
|
|
23 |
|
|
//--------------------------------------------------------------------------------------------------
|
24 |
loizides |
1.2 |
void OptInt::SetAlgoFractions(Double_t lzo, Double_t gz, Double_t bz, Double_t lzma)
|
25 |
loizides |
1.1 |
{
|
26 |
|
|
// Fraction of compression that must be reached to accept result of the "heavy"
|
27 |
loizides |
1.3 |
// compression algorithms. Negative values turn off usage of the specific compression
|
28 |
loizides |
1.2 |
// algorithm in ZipMode=99.
|
29 |
loizides |
1.1 |
|
30 |
|
|
lzipfrac = lzo;
|
31 |
|
|
gzipfrac = gz;
|
32 |
|
|
bzipfrac = bz;
|
33 |
loizides |
1.2 |
lzmafrac = lzma;
|
34 |
|
|
}
|
35 |
|
|
|
36 |
|
|
//--------------------------------------------------------------------------------------------------
|
37 |
|
|
void OptInt::SetBzipFraction(Double_t f)
|
38 |
|
|
{
|
39 |
|
|
// Set fraction for compression algorithm, see description of SetAlgoFractions.
|
40 |
|
|
|
41 |
|
|
bzipfrac = f;
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
//--------------------------------------------------------------------------------------------------
|
45 |
|
|
void OptInt::SetGzipFraction(Double_t f)
|
46 |
|
|
{
|
47 |
|
|
// Set fraction for compression algorithm, see description of SetAlgoFractions.
|
48 |
|
|
|
49 |
|
|
gzipfrac = f;
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
//--------------------------------------------------------------------------------------------------
|
53 |
|
|
void OptInt::SetLzmaFraction(Double_t f)
|
54 |
|
|
{
|
55 |
|
|
// Set fraction for compression algorithm, see description of SetAlgoFractions.
|
56 |
|
|
|
57 |
|
|
lzmafrac = f;
|
58 |
|
|
}
|
59 |
|
|
|
60 |
|
|
//--------------------------------------------------------------------------------------------------
|
61 |
|
|
void OptInt::SetLzoFraction(Double_t f)
|
62 |
|
|
{
|
63 |
|
|
// Set fraction for compression algorithm, see description of SetAlgoFractions.
|
64 |
|
|
|
65 |
|
|
lzipfrac = f;
|
66 |
loizides |
1.1 |
}
|
67 |
|
|
|
68 |
|
|
//--------------------------------------------------------------------------------------------------
|
69 |
|
|
void OptInt::SetStaticMalloc(Bool_t b)
|
70 |
|
|
{
|
71 |
|
|
// Set flag to enable the usage of static rather than heap memory in the compression
|
72 |
|
|
// algorithm. No real increase in speed has been observed, therefore off by default.
|
73 |
|
|
|
74 |
|
|
mystaticm = b;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
//--------------------------------------------------------------------------------------------------
|
78 |
|
|
void OptInt::SetVerbose(Int_t vl)
|
79 |
|
|
{
|
80 |
|
|
// Set verbosity level in the R__zip and R__unzip functions. Use 1 to only enable for
|
81 |
|
|
// writing, 2 only for reading and 10 for both.
|
82 |
|
|
|
83 |
|
|
myverbose = vl;
|
84 |
|
|
}
|
85 |
|
|
|
86 |
|
|
//--------------------------------------------------------------------------------------------------
|
87 |
|
|
void OptInt::SetZipMode(Int_t zipmode)
|
88 |
|
|
{
|
89 |
|
|
// Set ZipMode to be used in R__zip. Supported values range from 1 to 5, where
|
90 |
|
|
// 1 == gzip (http://www.gzip.org/, standard in ROOT)
|
91 |
|
|
// 2 == bzip2 (http://www.bzip.org/)
|
92 |
|
|
// 3 == lzo (http://www.oberhumer.com/opensource/lzo/)
|
93 |
|
|
// 4 == rle (http://bcl.comli.eu/)
|
94 |
loizides |
1.3 |
// 5 == lzma (http://www.7-zip.org/sdk.html)
|
95 |
|
|
// 99 == combination of 1 to 5.
|
96 |
loizides |
1.1 |
|
97 |
|
|
R__SetZipMode(zipmode);
|
98 |
|
|
}
|