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[ 10.5 ] [ 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 ]

  1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.
  3 
  4 #ifndef tools_wroot_mt_ntuple_row_wise
  5 #define tools_wroot_mt_ntuple_row_wise
  6 
  7 // pntuple = for parallel ntupling.
  8 
  9 #include "base_pntuple_row_wise"
 10 #include "mt_basket_add"
 11 #include "imt_ntuple"
 12 
 13 namespace tools {
 14 namespace wroot {
 15 
 16 class mt_ntuple_row_wise : public base_pntuple_row_wise, public virtual imt_ntuple {
 17   typedef base_pntuple_row_wise parent;
 18 public:
 19   virtual bool add_row(imutex& a_mutex,ifile& a_main_file) {
 20     if(m_cols.empty()) return false;
 21     tools_vforit(icol*,m_cols,it) (*it)->add();
 22     mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
 23     if(!m_row_wise_branch.pfill(_badd,0)) return false;
 24     tools_vforit(icol*,m_cols,it) (*it)->set_def();
 25     return true;
 26   }
 27   virtual bool end_fill(imutex& a_mutex,ifile& a_main_file) {
 28     mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
 29     if(!m_row_wise_branch.end_pfill(_badd)) return false;
 30     return end_leaves(a_mutex);
 31   }
 32 public:
 33   mt_ntuple_row_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
 34                      branch& a_main_branch,
 35                      const std::string& a_name,const std::string& a_title,
 36                      uint32 a_basket_size,
 37                      bool a_verbose)
 38   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_basket_size,a_verbose)
 39   ,m_main_branch(a_main_branch)
 40   {}
 41 
 42   mt_ntuple_row_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
 43                      branch& a_main_branch,
 44                      uint32 a_basket_size,
 45                      const ntuple_booking& a_bkg,bool a_verbose)
 46   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_basket_size,a_bkg,a_verbose)
 47   ,m_main_branch(a_main_branch)
 48   {}
 49 
 50   virtual ~mt_ntuple_row_wise() {}
 51 protected:
 52   mt_ntuple_row_wise(const mt_ntuple_row_wise& a_from)
 53   :imt_ntuple(a_from)
 54   ,parent(a_from)
 55   ,m_main_branch(a_from.m_main_branch)
 56   {}
 57   mt_ntuple_row_wise& operator=(const mt_ntuple_row_wise& a_from){parent::operator=(a_from);return *this;}
 58 protected:
 59   bool end_leaves(imutex& a_mutex) const {
 60     if(m_main_branch.leaves().size()!=m_row_wise_branch.leaves().size()) {
 61       m_out << "tools::wroot::mt_ntuple_row_wise::end_leaves :"
 62             << " m_main_branch.leaves().size() (" << m_main_branch.leaves().size() << ") != "
 63             << "m_row_wise_branch.leaves().size() (" << m_row_wise_branch.leaves().size() << ")."
 64             << std::endl;
 65       return false;
 66     }
 67 
 68 #include "MT_SET_MAX.icc"
 69 
 70     std::vector<base_leaf*>::iterator pit = const_cast< std::vector<base_leaf*>& >(m_row_wise_branch.leaves()).begin();
 71     tools_vforcit(base_leaf*,m_main_branch.leaves(),mit) {
 72       base_leaf* _mleaf = *mit;
 73       base_leaf* _pleaf = *pit; pit++; //WARNING.
 74 
 75       TOOLS_WROOT_MT_NTUPLE_SET_MAX(char)
 76       TOOLS_WROOT_MT_NTUPLE_SET_MAX(short)
 77       TOOLS_WROOT_MT_NTUPLE_SET_MAX(int)
 78       TOOLS_WROOT_MT_NTUPLE_SET_MAX(float)
 79       TOOLS_WROOT_MT_NTUPLE_SET_MAX(double)
 80 
 81       TOOLS_WROOT_MT_NTUPLE_STRING_SET_MAX
 82 
 83     }
 84 #undef TOOLS_WROOT_MT_NTUPLE_SET_MAX
 85 #undef TOOLS_WROOT_MT_NTUPLE_STRING_SET_MAX
 86 
 87     return true;
 88   }
 89 protected:
 90   branch& m_main_branch;
 91 };
 92 
 93 }}
 94 
 95 #endif