4 #ifndef tools_wroot_streamers
5 #define tools_wroot_streamers
12 #include "../histo/h1d"
13 #include "../histo/h2d"
14 #include "../histo/h3d"
15 #include "../histo/p1d"
16 #include "../histo/p2d"
18 #include "../histo/h1df"
19 #include "../histo/h2df"
20 #include "../histo/h3df"
30 int fNdivisions = 510;
32 short fLabelColor = 1;
33 short fLabelFont = 62;
34 float fLabelOffset = 0.005F;
35 float fLabelSize = 0.04F;
36 float fTickLength = 0.03F;
37 float fTitleOffset = 1;
38 float fTitleSize = 0.04F;
39 short fTitleColor = 1;
40 short fTitleFont = 62;
46 if(!a_buffer.
write(fNdivisions))
return false;
47 if(!a_buffer.
write(fAxisColor))
return false;
48 if(!a_buffer.
write(fLabelColor))
return false;
49 if(!a_buffer.
write(fLabelFont))
return false;
50 if(!a_buffer.
write(fLabelOffset))
return false;
51 if(!a_buffer.
write(fLabelSize))
return false;
52 if(!a_buffer.
write(fTickLength))
return false;
53 if(!a_buffer.
write(fTitleOffset))
return false;
54 if(!a_buffer.
write(fTitleSize))
return false;
55 if(!a_buffer.
write(fTitleColor))
return false;
56 if(!a_buffer.
write(fTitleFont))
return false;
64 const std::string& a_name,
65 const std::string& a_title) {
75 if(!a_buffer.
write(a_axis.
bins()))
return false;
88 if(!a_buffer.
write((
int)0))
return false;
89 if(!a_buffer.
write((
int)0))
return false;
92 if(!a_buffer.
write((
unsigned char)0))
return false;
95 if(!a_buffer.
write(std::string()))
return false;
107 if(!a_buffer.
write(name))
return false;
109 if(!a_buffer.
write(nobjects))
return false;
114 template <
class HIST>
115 inline std::string
axis_title(
const HIST& a_h,
const std::string& a_key) {
117 annotations_t::const_iterator it = a_h.annotations().find(a_key);
118 if(it==a_h.annotations().end())
return std::string();
122 template <
class HIST>
125 const std::string& a_name,
126 const std::vector<double>& a_bin_Sw2) {
130 if(!
Named_stream(a_buffer,a_name,a_h.title()))
return false;
136 if(!a_buffer.
write((
int)a_h.get_bins()))
return false;
139 if(a_h.dimension()==3) {
150 }
else if(a_h.dimension()==2) {
162 }
else if(a_h.dimension()==1) {
179 if(!a_buffer.
write((
short)(1000 * 0.25)))
return false;
180 if(!a_buffer.
write((
short)(1000 * 0.5)))
return false;
182 if(!a_buffer.
write((
double)a_h.all_entries()))
return false;
183 if(!a_buffer.
write((
double)a_h.get_in_range_Sw()))
return false;
184 if(!a_buffer.
write((
double)a_h.get_in_range_Sw2()))
return false;
187 a_h.get_ith_axis_Sxw(0,
value);
191 a_h.get_ith_axis_Sx2w(0,
value);
194 if(!a_buffer.
write((
double)-1111))
return false;
195 if(!a_buffer.
write((
double)-1111))
return false;
196 if(!a_buffer.
write((
double)0))
return false;
198 if(!a_buffer.
write_array(std::vector<double>()))
return false;
209 if(!a_buffer.
write(opt))
return false;}
216 template <
class HIST>
219 const std::string& a_name,
220 const std::vector<double>& a_bin_Sw2) {
222 if(!
TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw2))
return false;
223 if(!a_buffer.
write((
double)1))
return false;
226 a_h.get_ith_axis_Sxw(1,
value);
230 a_h.get_ith_axis_Sx2w(1,
value);
233 if(!a_buffer.
write((
double)a_h.Sxyw()))
return false;
238 template <
class HIST>
241 const std::string& a_name,
242 const std::vector<double>& a_bin_Sw2) {
244 if(!
TH_write_1D(a_buffer,a_h,a_name,a_bin_Sw2))
return false;
248 a_h.get_ith_axis_Sxw(1,
value);
251 a_h.get_ith_axis_Sx2w(1,
value);
253 if(!a_buffer.
write((
double)a_h.Sxyw()))
return false;
256 a_h.get_ith_axis_Sxw(2,
value);
259 a_h.get_ith_axis_Sx2w(2,
value);
261 if(!a_buffer.
write((
double)a_h.Szxw()))
return false;
262 if(!a_buffer.
write((
double)a_h.Syzw()))
return false;
269 std::vector<double> bins_sum_w2d;
270 convert<float,double>(a_h.
bins_sum_w2(),bins_sum_w2d);
271 if(!
TH_write_1D(a_buffer,a_h,a_name,bins_sum_w2d))
return false;
279 std::vector<float> bins_sum_wf;
280 convert<double,float>(a_h.
bins_sum_w(),bins_sum_wf);
281 if(!a_buffer.
write_array(bins_sum_wf))
return false;
295 std::vector<float> bins_sum_wf;
296 convert<double,float>(a_h.
bins_sum_w(),bins_sum_wf);
297 if(!a_buffer.
write_array(bins_sum_wf))
return false;
303 std::vector<double> bins_sum_w2d;
304 convert<float,double>(a_h.
bins_sum_w2(),bins_sum_w2d);
305 if(!
TH_write_2D(a_buffer,a_h,a_name,bins_sum_w2d))
return false;
320 std::vector<float> bins_sum_wf;
321 convert<double,float>(a_h.
bins_sum_w(),bins_sum_wf);
322 if(!a_buffer.
write_array(bins_sum_wf))
return false;
328 std::vector<double> bins_sum_w2d;
329 convert<float,double>(a_h.
bins_sum_w2(),bins_sum_w2d);
330 if(!
TH_write_3D(a_buffer,a_h,a_name,bins_sum_w2d))
return false;
363 if(!a_buffer.
write(errorMode))
return false;
364 if(!a_buffer.
write(a_p.
min_v()))
return false;
365 if(!a_buffer.
write(a_p.
max_v()))
return false;
395 if(!a_buffer.
write(errorMode))
return false;
396 if(!a_buffer.
write(a_p.
min_v()))
return false;
397 if(!a_buffer.
write(a_p.
max_v()))
return false;