3 |
|
#include "MitProd/TreeService/interface/TreeService.h" |
4 |
|
#include "DataFormats/Provenance/interface/ModuleDescription.h" |
5 |
|
#include "FWCore/ParameterSet/interface/ParameterSet.h" |
6 |
< |
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h" |
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" |
13 |
|
|
14 |
|
using namespace edm; |
15 |
|
using namespace std; |
18 |
|
//-------------------------------------------------------------------------------------------------- |
19 |
|
TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &ar) : |
20 |
|
tws_(0), |
21 |
< |
fDoReset_(cfg.getUntrackedParameter<bool>("doReset",1)) |
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 |
> |
fActivate_(cfg.getUntrackedParameter<bool>("doActivate",0)) |
29 |
|
{ |
30 |
|
// Constructor. |
31 |
|
|
62 |
|
if (cfg.exists("brSizes")) |
63 |
|
brSizes_=cfg.getUntrackedParameter<vector<unsigned> >("brSizes"); |
64 |
|
else |
65 |
< |
brSizes_.push_back(32*1024); |
65 |
> |
brSizes_.push_back(16*1024); |
66 |
|
|
67 |
|
if (treeNames_.size()!=fileNames_.size()) { |
68 |
|
throw edm::Exception(edm::errors::Configuration, "TreeService::TreeService()\n") |
71 |
|
return; |
72 |
|
} |
73 |
|
|
74 |
+ |
if (OptInt::IsActivated()) { |
75 |
+ |
if (cfg.exists("zipMode")) |
76 |
+ |
zipMode_=cfg.getUntrackedParameter<unsigned>("zipMode"); |
77 |
+ |
else |
78 |
+ |
zipMode_ = 99; |
79 |
+ |
|
80 |
+ |
if (cfg.exists("bZipThres")) |
81 |
+ |
bZipThres_=cfg.getUntrackedParameter<double>("bZipThres"); |
82 |
+ |
else |
83 |
+ |
bZipThres_ = -1.0; |
84 |
+ |
|
85 |
+ |
if (cfg.exists("gZipThres")) |
86 |
+ |
gZipThres_=cfg.getUntrackedParameter<double>("gZipThres"); |
87 |
+ |
else |
88 |
+ |
gZipThres_ = 1.0; |
89 |
+ |
|
90 |
+ |
if (cfg.exists("lzoThres")) |
91 |
+ |
lzoThres_=cfg.getUntrackedParameter<double>("lzoThres"); |
92 |
+ |
else |
93 |
+ |
lzoThres_ = -1.0; |
94 |
+ |
|
95 |
+ |
if (cfg.exists("lzmaThres")) |
96 |
+ |
lzmaThres_=cfg.getUntrackedParameter<double>("lzmaThres"); |
97 |
+ |
else |
98 |
+ |
lzmaThres_ = 0.95; |
99 |
+ |
|
100 |
+ |
if (cfg.exists("optIOVerbose")) |
101 |
+ |
optIOVerbose_=cfg.getUntrackedParameter<unsigned>("optIOVerbose"); |
102 |
+ |
else |
103 |
+ |
optIOVerbose_ = 0; |
104 |
+ |
|
105 |
+ |
OptInt::SetZipMode(zipMode_); |
106 |
+ |
OptInt::SetGzipFraction(gZipThres_); |
107 |
+ |
OptInt::SetBzipFraction(bZipThres_); |
108 |
+ |
OptInt::SetLzoFraction(lzoThres_); |
109 |
+ |
OptInt::SetLzmaFraction(lzmaThres_); |
110 |
+ |
OptInt::SetVerbose(optIOVerbose_); |
111 |
+ |
|
112 |
+ |
} else { |
113 |
+ |
|
114 |
+ |
if (cfg.exists("zipMode") || cfg.exists("bZipThres") || |
115 |
+ |
cfg.exists("gZipThres") || cfg.exists("lzoThres") || |
116 |
+ |
cfg.exists("lzmaThres")) { |
117 |
+ |
edm::LogError("TreeService") << "OptIO interface not properly pre-loaded, " |
118 |
+ |
"ignoring given settings." << std::endl; |
119 |
+ |
} |
120 |
+ |
} |
121 |
+ |
|
122 |
|
// setup tw array |
123 |
|
tws_.SetOwner(kTRUE); |
124 |
|
tws_.Expand(treeNames_.size()); |
159 |
|
} |
160 |
|
|
161 |
|
// set watchers |
162 |
< |
ar.watchPreProcessEvent (this,&TreeService::preEventProcessing); |
163 |
< |
ar.watchPostProcessEvent(this,&TreeService::postEventProcessing); |
164 |
< |
ar.watchPostBeginJob (this,&TreeService::postBeginJob); |
165 |
< |
ar.watchPostEndJob (this,&TreeService::postEndJob); |
162 |
> |
if (fActivate_) { |
163 |
> |
ar.watchPreProcessEvent (this,&TreeService::preEventProcessing); |
164 |
> |
ar.watchPostProcessEvent(this,&TreeService::postEventProcessing); |
165 |
> |
ar.watchPostBeginJob (this,&TreeService::postBeginJob); |
166 |
> |
ar.watchPostEndJob (this,&TreeService::postEndJob); |
167 |
> |
} |
168 |
|
} |
169 |
|
|
170 |
|
//-------------------------------------------------------------------------------------------------- |