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" |
7 |
– |
#include "FWCore/ServiceRegistry/interface/Service.h" |
6 |
|
#include "FWCore/MessageLogger/interface/JobReport.h" |
7 |
+ |
#include "FWCore/MessageLogger/interface/MessageLogger.h" |
8 |
|
#include "MitAna/DataUtil/interface/TreeWriter.h" |
9 |
|
#include "MitAna/DataTree/interface/Names.h" |
10 |
|
#include "MitCommon/OptIO/interface/OptInt.h" |
14 |
|
using namespace mithep; |
15 |
|
|
16 |
|
//-------------------------------------------------------------------------------------------------- |
17 |
< |
TreeService::TreeService(const ParameterSet &cfg, ActivityRegistry &ar) : |
17 |
> |
TreeService::TreeService(const ParameterSet &cfg) : |
18 |
|
tws_(0), |
19 |
+ |
zipMode_(1), |
20 |
+ |
bZipThres_(1), |
21 |
+ |
gZipThres_(1), |
22 |
+ |
lzoThres_(1), |
23 |
+ |
lzmaThres_(1), |
24 |
+ |
optIOVerbose_(1), |
25 |
|
fDoReset_(cfg.getUntrackedParameter<bool>("doReset",1)) |
26 |
|
{ |
27 |
|
// Constructor. |
59 |
|
if (cfg.exists("brSizes")) |
60 |
|
brSizes_=cfg.getUntrackedParameter<vector<unsigned> >("brSizes"); |
61 |
|
else |
62 |
< |
brSizes_.push_back(64*1024); |
58 |
< |
|
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; |
62 |
> |
brSizes_.push_back(16*1024); |
63 |
|
|
64 |
|
if (treeNames_.size()!=fileNames_.size()) { |
65 |
|
throw edm::Exception(edm::errors::Configuration, "TreeService::TreeService()\n") |
68 |
|
return; |
69 |
|
} |
70 |
|
|
71 |
+ |
if (OptInt::IsActivated()) { |
72 |
+ |
if (cfg.exists("zipMode")) |
73 |
+ |
zipMode_=cfg.getUntrackedParameter<unsigned>("zipMode"); |
74 |
+ |
else |
75 |
+ |
zipMode_ = 99; |
76 |
+ |
|
77 |
+ |
if (cfg.exists("bZipThres")) |
78 |
+ |
bZipThres_=cfg.getUntrackedParameter<double>("bZipThres"); |
79 |
+ |
else |
80 |
+ |
bZipThres_ = -1.0; |
81 |
+ |
|
82 |
+ |
if (cfg.exists("gZipThres")) |
83 |
+ |
gZipThres_=cfg.getUntrackedParameter<double>("gZipThres"); |
84 |
+ |
else |
85 |
+ |
gZipThres_ = 1.0; |
86 |
+ |
|
87 |
+ |
if (cfg.exists("lzoThres")) |
88 |
+ |
lzoThres_=cfg.getUntrackedParameter<double>("lzoThres"); |
89 |
+ |
else |
90 |
+ |
lzoThres_ = -1.0; |
91 |
+ |
|
92 |
+ |
if (cfg.exists("lzmaThres")) |
93 |
+ |
lzmaThres_=cfg.getUntrackedParameter<double>("lzmaThres"); |
94 |
+ |
else |
95 |
+ |
lzmaThres_ = 0.95; |
96 |
+ |
|
97 |
+ |
if (cfg.exists("optIOVerbose")) |
98 |
+ |
optIOVerbose_=cfg.getUntrackedParameter<unsigned>("optIOVerbose"); |
99 |
+ |
else |
100 |
+ |
optIOVerbose_ = 0; |
101 |
+ |
|
102 |
+ |
OptInt::SetZipMode(zipMode_); |
103 |
+ |
OptInt::SetGzipFraction(gZipThres_); |
104 |
+ |
OptInt::SetBzipFraction(bZipThres_); |
105 |
+ |
OptInt::SetLzoFraction(lzoThres_); |
106 |
+ |
OptInt::SetLzmaFraction(lzmaThres_); |
107 |
+ |
OptInt::SetVerbose(optIOVerbose_); |
108 |
+ |
|
109 |
+ |
} else { |
110 |
+ |
|
111 |
+ |
if (cfg.exists("zipMode") || cfg.exists("bZipThres") || |
112 |
+ |
cfg.exists("gZipThres") || cfg.exists("lzoThres") || |
113 |
+ |
cfg.exists("lzmaThres")) { |
114 |
+ |
edm::LogError("TreeService") << "OptIO interface not properly pre-loaded, " |
115 |
+ |
"ignoring given settings." << std::endl; |
116 |
+ |
} |
117 |
+ |
} |
118 |
+ |
|
119 |
|
// setup tw array |
120 |
|
tws_.SetOwner(kTRUE); |
121 |
|
tws_.Expand(treeNames_.size()); |
151 |
|
else if (brSizes_.size()>0) |
152 |
|
t->SetDefaultBrSize(brSizes_.at(0)); |
153 |
|
|
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 |
– |
|
154 |
|
//t->Print(); |
155 |
|
tws_.Add(t); |
156 |
|
} |
157 |
|
|
158 |
|
// set watchers |
159 |
< |
ar.watchPreProcessEvent (this,&TreeService::preEventProcessing); |
160 |
< |
ar.watchPostProcessEvent(this,&TreeService::postEventProcessing); |
161 |
< |
ar.watchPostBeginJob (this,&TreeService::postBeginJob); |
162 |
< |
ar.watchPostEndJob (this,&TreeService::postEndJob); |
159 |
> |
// ar.watchPreProcessEvent (this,&TreeService::preEventProcessing); |
160 |
> |
// ar.watchPostProcessEvent(this,&TreeService::postEventProcessing); |
161 |
> |
// ar.watchPostBeginJob (this,&TreeService::postBeginJob); |
162 |
> |
// ar.watchPostEndJob (this,&TreeService::postEndJob); |
163 |
|
} |
164 |
|
|
165 |
|
//-------------------------------------------------------------------------------------------------- |
199 |
|
} |
200 |
|
|
201 |
|
//-------------------------------------------------------------------------------------------------- |
202 |
< |
void TreeService::postEventProcessing(const Event&, const EventSetup&) |
202 |
> |
void TreeService::postEventProcessing() |
203 |
|
{ |
204 |
|
// Loop over all TreeWriter objects before processing of an event. |
205 |
|
|
215 |
|
} |
216 |
|
|
217 |
|
//-------------------------------------------------------------------------------------------------- |
218 |
< |
void TreeService::preEventProcessing(const EventID&, const Timestamp&) |
218 |
> |
void TreeService::preEventProcessing() |
219 |
|
{ |
220 |
|
// Loop over all TreeWriter objects after processing of a events. |
221 |
|
|