6 |
|
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" |
7 |
|
#include "FWCore/ServiceRegistry/interface/Service.h" |
8 |
|
#include "FWCore/MessageLogger/interface/JobReport.h" |
9 |
+ |
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
10 |
|
#include "MitAna/DataUtil/interface/TreeWriter.h" |
11 |
|
#include "MitAna/DataTree/interface/Names.h" |
12 |
|
#include "MitCommon/OptIO/interface/OptInt.h" |
18 |
|
//-------------------------------------------------------------------------------------------------- |
19 |
|
TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &ar) : |
20 |
|
tws_(0), |
21 |
+ |
zipMode_(1), |
22 |
+ |
bZipThres_(1), |
23 |
+ |
gZipThres_(1), |
24 |
+ |
lzoThres_(1), |
25 |
+ |
lzmaThres_(1), |
26 |
+ |
optIOVerbose_(1), |
27 |
|
fDoReset_(cfg.getUntrackedParameter<bool>("doReset",1)) |
28 |
|
{ |
29 |
|
// Constructor. |
63 |
|
else |
64 |
|
brSizes_.push_back(64*1024); |
65 |
|
|
59 |
– |
if (cfg.exists("zipMode")) |
60 |
– |
zipMode_=cfg.getUntrackedParameter<unsigned>("zipMode"); |
61 |
– |
else |
62 |
– |
zipMode_ = 99; |
63 |
– |
|
64 |
– |
if (cfg.exists("bZipThres")) |
65 |
– |
bZipThres_=cfg.getUntrackedParameter<double>("bZipThres"); |
66 |
– |
else |
67 |
– |
bZipThres_ = -1.0; |
68 |
– |
|
69 |
– |
if (cfg.exists("gZipThres")) |
70 |
– |
gZipThres_=cfg.getUntrackedParameter<double>("gZipThres"); |
71 |
– |
else |
72 |
– |
gZipThres_ = 1.0; |
73 |
– |
|
74 |
– |
if (cfg.exists("lzoThres")) |
75 |
– |
lzoThres_=cfg.getUntrackedParameter<double>("lzoThres"); |
76 |
– |
else |
77 |
– |
lzoThres_ = -1.0; |
78 |
– |
|
79 |
– |
if (cfg.exists("lzmaThres")) |
80 |
– |
lzmaThres_=cfg.getUntrackedParameter<double>("lzmaThres"); |
81 |
– |
else |
82 |
– |
lzmaThres_ = 0.95; |
83 |
– |
|
84 |
– |
if (cfg.exists("optIOVerbose")) |
85 |
– |
optIOVerbose_=cfg.getUntrackedParameter<unsigned>("optIOVerbose"); |
86 |
– |
else |
87 |
– |
optIOVerbose_ = 0; |
88 |
– |
|
66 |
|
if (treeNames_.size()!=fileNames_.size()) { |
67 |
|
throw edm::Exception(edm::errors::Configuration, "TreeService::TreeService()\n") |
68 |
|
<< "Number of main trees should match number of files " << treeNames_.size() |
70 |
|
return; |
71 |
|
} |
72 |
|
|
73 |
+ |
if (OptInt::IsActivated()) { |
74 |
+ |
if (cfg.exists("zipMode")) |
75 |
+ |
zipMode_=cfg.getUntrackedParameter<unsigned>("zipMode"); |
76 |
+ |
else |
77 |
+ |
zipMode_ = 99; |
78 |
+ |
|
79 |
+ |
if (cfg.exists("bZipThres")) |
80 |
+ |
bZipThres_=cfg.getUntrackedParameter<double>("bZipThres"); |
81 |
+ |
else |
82 |
+ |
bZipThres_ = -1.0; |
83 |
+ |
|
84 |
+ |
if (cfg.exists("gZipThres")) |
85 |
+ |
gZipThres_=cfg.getUntrackedParameter<double>("gZipThres"); |
86 |
+ |
else |
87 |
+ |
gZipThres_ = 1.0; |
88 |
+ |
|
89 |
+ |
if (cfg.exists("lzoThres")) |
90 |
+ |
lzoThres_=cfg.getUntrackedParameter<double>("lzoThres"); |
91 |
+ |
else |
92 |
+ |
lzoThres_ = -1.0; |
93 |
+ |
|
94 |
+ |
if (cfg.exists("lzmaThres")) |
95 |
+ |
lzmaThres_=cfg.getUntrackedParameter<double>("lzmaThres"); |
96 |
+ |
else |
97 |
+ |
lzmaThres_ = 0.95; |
98 |
+ |
|
99 |
+ |
if (cfg.exists("optIOVerbose")) |
100 |
+ |
optIOVerbose_=cfg.getUntrackedParameter<unsigned>("optIOVerbose"); |
101 |
+ |
else |
102 |
+ |
optIOVerbose_ = 0; |
103 |
+ |
|
104 |
+ |
OptInt::SetZipMode(zipMode_); |
105 |
+ |
OptInt::SetGzipFraction(gZipThres_); |
106 |
+ |
OptInt::SetBzipFraction(bZipThres_); |
107 |
+ |
OptInt::SetLzoFraction(lzoThres_); |
108 |
+ |
OptInt::SetLzmaFraction(lzmaThres_); |
109 |
+ |
OptInt::SetVerbose(optIOVerbose_); |
110 |
+ |
|
111 |
+ |
} else { |
112 |
+ |
|
113 |
+ |
if (cfg.exists("zipMode") || cfg.exists("bZipThres") || |
114 |
+ |
cfg.exists("gZipThres") || cfg.exists("lzoThres") || |
115 |
+ |
cfg.exists("lzmaThres")) { |
116 |
+ |
edm::LogError("TreeService") << "OptIO interface not properly pre-loaded, " |
117 |
+ |
"ignoring given settings." << std::endl; |
118 |
+ |
} |
119 |
+ |
} |
120 |
+ |
|
121 |
|
// setup tw array |
122 |
|
tws_.SetOwner(kTRUE); |
123 |
|
tws_.Expand(treeNames_.size()); |
153 |
|
else if (brSizes_.size()>0) |
154 |
|
t->SetDefaultBrSize(brSizes_.at(0)); |
155 |
|
|
131 |
– |
OptInt::SetZipMode(zipMode_); |
132 |
– |
|
133 |
– |
OptInt::SetGzipFraction(gZipThres_); |
134 |
– |
|
135 |
– |
OptInt::SetBzipFraction(bZipThres_); |
136 |
– |
|
137 |
– |
OptInt::SetLzoFraction(lzoThres_); |
138 |
– |
|
139 |
– |
OptInt::SetLzmaFraction(lzmaThres_); |
140 |
– |
|
141 |
– |
OptInt::SetVerbose(optIOVerbose_); |
142 |
– |
|
156 |
|
//t->Print(); |
157 |
|
tws_.Add(t); |
158 |
|
} |