1 |
|
// $Id$ |
2 |
|
|
3 |
|
#include "MitCommon/OptIO/interface/OptInt.h" |
4 |
+ |
#include <Riostream.h> |
5 |
+ |
#include <TEnv.h> |
6 |
+ |
#include <TError.h> |
7 |
|
#include <TROOT.h> |
8 |
+ |
#include <TString.h> |
9 |
|
#include <TSystem.h> |
10 |
< |
#include <TError.h> |
7 |
< |
#include <TEnv.h> |
8 |
< |
#include <Riostream.h> |
10 |
> |
|
11 |
|
|
12 |
|
using namespace mithep; |
13 |
+ |
extern int activated; |
14 |
|
|
15 |
|
//-------------------------------------------------------------------------------------------------- |
16 |
|
namespace { |
17 |
|
class OptIntLoad { |
18 |
|
public: |
19 |
|
OptIntLoad() { |
20 |
< |
Int_t verbose = gEnv->GetValue("Root.OptIO.Verbose",0); |
21 |
< |
if(verbose) |
22 |
< |
::Info("OptIntLoad", "Loading libMitCommonOptIO.so for the optimized IO interface."); |
23 |
< |
Int_t zipmode = gEnv->GetValue("Root.ZipMode",-1); |
21 |
< |
if (zipmode>0) { |
22 |
< |
if(verbose) |
23 |
< |
::Warning("OptIntLoad", "Setting ZipMode to %d as specified in rootrc", zipmode); |
24 |
< |
OptInt::SetZipMode(zipmode); |
25 |
< |
} |
26 |
< |
Double_t lzf = gEnv->GetValue("Root.OptIO.LzoFraction",1.); |
27 |
< |
Double_t gzf = gEnv->GetValue("Root.OptIO.GzipFraction",1.); |
28 |
< |
Double_t bzf = gEnv->GetValue("Root.OptIO.BzipFraction",1.); |
29 |
< |
Double_t lzm = gEnv->GetValue("Root.OptIO.LzmaFraction",1.); |
30 |
< |
if (lzf!=1 || gzf!= 1 || bzf!=1 || lzm!=1) { |
20 |
> |
TString mylib(gSystem->Getenv("LD_PRELOAD")); |
21 |
> |
if (mylib.Contains("MitCommonOptIO")) { |
22 |
> |
activated = 123; |
23 |
> |
Int_t verbose = gEnv->GetValue("Root.OptIO.Verbose",0); |
24 |
|
if(verbose) |
25 |
< |
::Warning("OptIntLoad", "Setting algo fractions to %.2f, %.2f, %.2f, %.2f" |
26 |
< |
" as specified in rootrc", lzf, gzf, bzf, lzm); |
27 |
< |
OptInt::SetAlgoFractions(lzf, gzf, bzf, lzm); |
28 |
< |
} |
29 |
< |
Int_t smalloc = gEnv->GetValue("Root.OptIO.SMalloc",0); |
30 |
< |
if (smalloc) { |
31 |
< |
if(verbose) |
32 |
< |
::Warning("OptIntLoad", "Enabling static memory allocation as specified in rootrc"); |
33 |
< |
OptInt::SetStaticMalloc(smalloc==1); |
34 |
< |
} |
35 |
< |
if (verbose) { |
36 |
< |
::Warning("OptIntLoad", "Setting verbosity to %d as specified in rootrc", verbose); |
37 |
< |
OptInt::SetVerbose(verbose); |
25 |
> |
::Info("OptIntLoad", "Loading libMitCommonOptIO.so for the optimized IO interface."); |
26 |
> |
Int_t zipmode = gEnv->GetValue("Root.ZipMode",-1); |
27 |
> |
if (zipmode>0) { |
28 |
> |
if(verbose) |
29 |
> |
::Warning("OptIntLoad", "Setting ZipMode to %d as specified in rootrc", zipmode); |
30 |
> |
OptInt::SetZipMode(zipmode); |
31 |
> |
} |
32 |
> |
Double_t lzf = gEnv->GetValue("Root.OptIO.LzoFraction",1.); |
33 |
> |
Double_t gzf = gEnv->GetValue("Root.OptIO.GzipFraction",1.); |
34 |
> |
Double_t bzf = gEnv->GetValue("Root.OptIO.BzipFraction",1.); |
35 |
> |
Double_t lzm = gEnv->GetValue("Root.OptIO.LzmaFraction",1.); |
36 |
> |
if (lzf!=1 || gzf!= 1 || bzf!=1 || lzm!=1) { |
37 |
> |
if(verbose) |
38 |
> |
::Warning("OptIntLoad", "Setting algo fractions to %.2f, %.2f, %.2f, %.2f" |
39 |
> |
" as specified in rootrc", lzf, gzf, bzf, lzm); |
40 |
> |
OptInt::SetAlgoFractions(lzf, gzf, bzf, lzm); |
41 |
> |
} |
42 |
> |
Int_t smalloc = gEnv->GetValue("Root.OptIO.SMalloc",0); |
43 |
> |
if (smalloc) { |
44 |
> |
if(verbose) |
45 |
> |
::Warning("OptIntLoad", "Enabling static memory allocation as specified in rootrc"); |
46 |
> |
OptInt::SetStaticMalloc(smalloc==1); |
47 |
> |
} |
48 |
> |
if (verbose) { |
49 |
> |
::Warning("OptIntLoad", "Setting verbosity to %d as specified in rootrc", verbose); |
50 |
> |
OptInt::SetVerbose(verbose); |
51 |
> |
} |
52 |
|
} |
53 |
|
} |
54 |
|
}; |