ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitCommon/OptIO/src/OptInt.cc
Revision: 1.4
Committed: Wed Mar 4 07:24:50 2009 UTC (16 years, 2 months ago) by loizides
Content type: text/plain
Branch: MAIN
CVS Tags: Mit_011, Mit_010a, Mit_010, Mit_009c, Mit_009b, Mit_009a, Mit_009, Mit_008pre2
Changes since 1.3: +10 -1 lines
Log Message:
Check if preload is activated

File Contents

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