// Copyright (C) 2010, Guy Barrand. All rights reserved. // See the file tools.license for terms. #ifndef tools_histo_histo_data #define tools_histo_histo_data #include #include //for annotations #include "axes" #include "../eqT" namespace tools { namespace histo { inline unsigned int dim_planes(unsigned int a_dim) { // m_dim = 1 -> 0 // m_dim = 2 -> 0+1=1 // m_dim = 3 -> 0+1+2=3 // m_dim = 4 -> 0+1+2+3=6 typedef unsigned int dim_t; dim_t n = 0; for(dim_t i=0;i class histo_data { public: typedef axis axis_t; typedef unsigned int dim_t; typedef std::map annotations_t; public: histo_data() :m_dimension(0) ,m_bin_number(0) ,m_all_entries(0) ,m_in_range_entries(0) ,m_in_range_Sw(0) ,m_in_range_Sw2(0) {} public: histo_data(const histo_data& a_from) :m_title(a_from.m_title) ,m_dimension(a_from.m_dimension) ,m_bin_number(a_from.m_bin_number) ,m_bin_entries(a_from.m_bin_entries) ,m_bin_Sw(a_from.m_bin_Sw) ,m_bin_Sw2(a_from.m_bin_Sw2) ,m_bin_Sxw(a_from.m_bin_Sxw) ,m_bin_Sx2w(a_from.m_bin_Sx2w) ,m_axes(a_from.m_axes) ,m_in_range_plane_Sxyw(a_from.m_in_range_plane_Sxyw) ,m_annotations(a_from.m_annotations) ,m_all_entries(a_from.m_all_entries) ,m_in_range_entries(a_from.m_in_range_entries) ,m_in_range_Sw(a_from.m_in_range_Sw) ,m_in_range_Sw2(a_from.m_in_range_Sw2) ,m_in_range_Sxw(a_from.m_in_range_Sxw) ,m_in_range_Sx2w(a_from.m_in_range_Sx2w) {} histo_data& operator=(const histo_data& a_from) { if(&a_from==this) return *this; m_title = a_from.m_title; m_dimension = a_from.m_dimension; m_bin_number = a_from.m_bin_number; m_bin_entries = a_from.m_bin_entries; m_bin_Sw = a_from.m_bin_Sw; m_bin_Sw2 = a_from.m_bin_Sw2; m_bin_Sxw = a_from.m_bin_Sxw; m_bin_Sx2w = a_from.m_bin_Sx2w; m_axes = a_from.m_axes; m_in_range_plane_Sxyw = a_from.m_in_range_plane_Sxyw; m_annotations = a_from.m_annotations; m_all_entries = a_from.m_all_entries; m_in_range_entries = a_from.m_in_range_entries; m_in_range_Sw = a_from.m_in_range_Sw; m_in_range_Sw2 = a_from.m_in_range_Sw2; m_in_range_Sxw = a_from.m_in_range_Sxw; m_in_range_Sx2w = a_from.m_in_range_Sx2w; return *this; } virtual ~histo_data(){} protected: void reset_fast_getters(){ //m_in_range_plane_Sxyw is not a fast getter. m_all_entries = 0; m_in_range_entries = 0; m_in_range_Sw = 0; m_in_range_Sw2 = 0; m_in_range_Sxw.assign(m_dimension,0); m_in_range_Sx2w.assign(m_dimension,0); } public: void update_fast_getters() { reset_fast_getters(); {for(TO ibin=0;ibin m_bin_entries; std::vector m_bin_Sw; std::vector m_bin_Sw2; std::vector< std::vector > m_bin_Sxw; std::vector< std::vector > m_bin_Sx2w; // Axes : std::vector m_axes; // etc : std::vector m_in_range_plane_Sxyw; // ill-defined relative to slicing, sub, div, mult operations. Handled because of CERN-ROOT. std::map m_annotations; // fast getters : TN m_all_entries; //used if reading from a ROOT file. TN m_in_range_entries; TW m_in_range_Sw; TW m_in_range_Sw2; std::vector m_in_range_Sxw; std::vector m_in_range_Sx2w; }; }} #endif