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 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/wroot/base_pntuple (Version 11.3.0) and /externals/g4tools/include/tools/wroot/base_pntuple (Version 11.2.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_wroot_base_pntuple                    4 #ifndef tools_wroot_base_pntuple
  5 #define tools_wroot_base_pntuple                    5 #define tools_wroot_base_pntuple
  6                                                     6 
  7 // pntuple = for parallel ntupling.                 7 // pntuple = for parallel ntupling.
  8                                                     8 
  9 #include "branch_element"                           9 #include "branch_element"
 10 #include "icol"                                    10 #include "icol"
 11                                                    11 
 12 #include "../vfind"                                12 #include "../vfind"
 13                                                    13 
 14 #ifdef TOOLS_MEM                                   14 #ifdef TOOLS_MEM
 15 #include "../mem"                                  15 #include "../mem"
 16 #endif                                             16 #endif
 17                                                    17 
 18 namespace tools {                                  18 namespace tools {
 19 namespace wroot {                                  19 namespace wroot {
 20                                                    20 
 21 class base_pntuple {                               21 class base_pntuple {
 22 #ifdef TOOLS_MEM                                   22 #ifdef TOOLS_MEM
 23   static const std::string& s_class() {            23   static const std::string& s_class() {
 24     static const std::string s_v("tools::wroot     24     static const std::string s_v("tools::wroot::base_pntuple");
 25     return s_v;                                    25     return s_v;
 26   }                                                26   }
 27 #endif                                             27 #endif
 28 public:                                            28 public:
 29                                                    29 
 30 #include "columns.icc"                             30 #include "columns.icc"
 31                                                    31 
 32 public:                                            32 public:
 33   base_pntuple(std::ostream& a_out,seek a_seek     33   base_pntuple(std::ostream& a_out,seek a_seek_directory,const std::string& a_name,const std::string& a_title)
 34   :m_out(a_out)                                    34   :m_out(a_out)
 35   ,m_seek_directory(a_seek_directory)              35   ,m_seek_directory(a_seek_directory)
 36   ,m_name(a_name)                                  36   ,m_name(a_name)
 37   ,m_title(a_title)                                37   ,m_title(a_title)
 38   {                                                38   {
 39 #ifdef TOOLS_MEM                                   39 #ifdef TOOLS_MEM
 40     mem::increment(s_class().c_str());             40     mem::increment(s_class().c_str());
 41 #endif                                             41 #endif
 42   }                                                42   }
 43                                                    43 
 44   virtual ~base_pntuple() {                        44   virtual ~base_pntuple() {
 45     safe_clear<icol>(m_cols);                      45     safe_clear<icol>(m_cols);
 46 #ifdef TOOLS_MEM                                   46 #ifdef TOOLS_MEM
 47     mem::decrement(s_class().c_str());             47     mem::decrement(s_class().c_str());
 48 #endif                                             48 #endif
 49   }                                                49   }
 50 protected:                                         50 protected:
 51   base_pntuple(const base_pntuple& a_from):m_o     51   base_pntuple(const base_pntuple& a_from):m_out(a_from.m_out){
 52 #ifdef TOOLS_MEM                                   52 #ifdef TOOLS_MEM
 53     mem::increment(s_class().c_str());             53     mem::increment(s_class().c_str());
 54 #endif                                             54 #endif
 55   }                                                55   }
 56   base_pntuple& operator=(const base_pntuple&)     56   base_pntuple& operator=(const base_pntuple&){return *this;}
 57 public:                                            57 public:
 58   const std::vector<icol*>& columns() const {r     58   const std::vector<icol*>& columns() const {return m_cols;}
 59                                                    59 
 60   template <class T>                               60   template <class T>
 61   column_ref<T>* find_column_ref(const std::st     61   column_ref<T>* find_column_ref(const std::string& a_name) {
 62     icol* col = find_named<icol>(m_cols,a_name     62     icol* col = find_named<icol>(m_cols,a_name);
 63     if(!col) return 0;                             63     if(!col) return 0;
 64     return id_cast<icol, column_ref<T> >(*col)     64     return id_cast<icol, column_ref<T> >(*col);
 65   }                                                65   }
 66                                                    66 
 67   template <class T>                               67   template <class T>
 68   column<T>* find_column(const std::string& a_     68   column<T>* find_column(const std::string& a_name) {
 69     icol* col = find_named<icol>(m_cols,a_name     69     icol* col = find_named<icol>(m_cols,a_name);
 70     if(!col) return 0;                             70     if(!col) return 0;
 71     return id_cast<icol, column<T> >(*col);        71     return id_cast<icol, column<T> >(*col);
 72   }                                                72   }
 73                                                    73 
 74   column_string_ref* find_column_string_ref(co     74   column_string_ref* find_column_string_ref(const std::string& a_name) {
 75     icol* col = find_named<icol>(m_cols,a_name     75     icol* col = find_named<icol>(m_cols,a_name);
 76     if(!col) return 0;                             76     if(!col) return 0;
 77     return id_cast<icol, column_string_ref >(*     77     return id_cast<icol, column_string_ref >(*col);
 78   }                                                78   }
 79                                                    79 
 80   column_string* find_column_string(const std:     80   column_string* find_column_string(const std::string& a_name) {
 81     icol* col = find_named<icol>(m_cols,a_name     81     icol* col = find_named<icol>(m_cols,a_name);
 82     if(!col) return 0;                             82     if(!col) return 0;
 83     return id_cast<icol, column_string >(*col)     83     return id_cast<icol, column_string >(*col);
 84   }                                                84   }
 85                                                    85 
 86   template <class T>                               86   template <class T>
 87   std_vector_column_ref<T>* find_column_vector     87   std_vector_column_ref<T>* find_column_vector_ref(const std::string& a_name) {
 88     icol* col = find_named<icol>(m_cols,a_name     88     icol* col = find_named<icol>(m_cols,a_name);
 89     if(!col) return 0;                             89     if(!col) return 0;
 90     return id_cast<icol, std_vector_column_ref     90     return id_cast<icol, std_vector_column_ref<T> >(*col);
 91   }                                                91   }
 92                                                    92 
 93   template <class T>                               93   template <class T>
 94   std_vector_column<T>* find_column_vector(con     94   std_vector_column<T>* find_column_vector(const std::string& a_name) {
 95     icol* col = find_named<icol>(m_cols,a_name     95     icol* col = find_named<icol>(m_cols,a_name);
 96     if(!col) return 0;                             96     if(!col) return 0;
 97     return id_cast<icol, std_vector_column<T>      97     return id_cast<icol, std_vector_column<T> >(*col);
 98   }                                                98   }
 99                                                    99 
100   column_vector_string_ref* find_column_vector    100   column_vector_string_ref* find_column_vector_string_ref(const std::string& a_name) {
101     icol* col = find_named<icol>(m_cols,a_name    101     icol* col = find_named<icol>(m_cols,a_name);
102     if(!col) return 0;                            102     if(!col) return 0;
103     return id_cast<icol, column_vector_string_    103     return id_cast<icol, column_vector_string_ref >(*col);
104   }                                               104   }
105                                                   105 
106   column_vector_string* find_column_vector_str    106   column_vector_string* find_column_vector_string(const std::string& a_name) {
107     icol* col = find_named<icol>(m_cols,a_name    107     icol* col = find_named<icol>(m_cols,a_name);
108     if(!col) return 0;                            108     if(!col) return 0;
109     return id_cast<icol, column_vector_string     109     return id_cast<icol, column_vector_string >(*col);
110   }                                               110   }
111                                                   111 
112   void print_columns(std::ostream& a_out) {       112   void print_columns(std::ostream& a_out) {
113     a_out << "for ntuple named " << sout(m_nam    113     a_out << "for ntuple named " << sout(m_name) << ", number of columns " << m_cols.size() << " :" << std::endl;
114     tools_vforit(icol*,m_cols,it) {               114     tools_vforit(icol*,m_cols,it) {
115       a_out << " " << (*it)->name() << std::en    115       a_out << " " << (*it)->name() << std::endl;
116     }                                             116     }
117   }                                               117   }
118                                                   118 
119   //void set_basket_size(uint32 a_size) {tools    119   //void set_basket_size(uint32 a_size) {tools_vforit(icol*,m_cols,it) (*it)->set_basket_size(a_size);}
120                                                   120 
121 protected:                                        121 protected:
122   std::ostream& m_out;                            122   std::ostream& m_out;
123   seek m_seek_directory;                          123   seek m_seek_directory;
124   std::string m_name;                             124   std::string m_name;
125   std::string m_title;                            125   std::string m_title;
126   std::vector<icol*> m_cols;                      126   std::vector<icol*> m_cols;
127 };                                                127 };
128                                                   128 
129 }}                                                129 }}
130                                                   130 
131 #endif                                            131 #endif