Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/Geant4/tools/wroot/mt_ntuple_row_wise is written in an unsupported language. File is not indexed.

0001 // Copyright (C) 2010, Guy Barrand. All rights reserved.
0002 // See the file tools.license for terms.
0003 
0004 #ifndef tools_wroot_mt_ntuple_row_wise
0005 #define tools_wroot_mt_ntuple_row_wise
0006 
0007 // pntuple = for parallel ntupling.
0008 
0009 #include "base_pntuple_row_wise"
0010 #include "mt_basket_add"
0011 #include "imt_ntuple"
0012 
0013 namespace tools {
0014 namespace wroot {
0015 
0016 class mt_ntuple_row_wise : public base_pntuple_row_wise, public virtual imt_ntuple {
0017   typedef base_pntuple_row_wise parent;
0018 public:
0019   virtual bool add_row(imutex& a_mutex,ifile& a_main_file) {
0020     if(m_cols.empty()) return false;
0021     tools_vforit(icol*,m_cols,it) (*it)->add();
0022     mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
0023     if(!m_row_wise_branch.pfill(_badd,0)) return false;
0024     tools_vforit(icol*,m_cols,it) (*it)->set_def();
0025     return true;
0026   }
0027   virtual bool end_fill(imutex& a_mutex,ifile& a_main_file) {
0028     mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
0029     if(!m_row_wise_branch.end_pfill(_badd)) return false;
0030     return end_leaves(a_mutex);
0031   }
0032 public:
0033   mt_ntuple_row_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
0034                      branch& a_main_branch,
0035                      const std::string& a_name,const std::string& a_title,
0036                      uint32 a_basket_size,
0037                      bool a_verbose)
0038   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_basket_size,a_verbose)
0039   ,m_main_branch(a_main_branch)
0040   {}
0041 
0042   mt_ntuple_row_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
0043                      branch& a_main_branch,
0044                      uint32 a_basket_size,
0045                      const ntuple_booking& a_bkg,bool a_verbose)
0046   :parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_basket_size,a_bkg,a_verbose)
0047   ,m_main_branch(a_main_branch)
0048   {}
0049 
0050   virtual ~mt_ntuple_row_wise() {}
0051 protected:
0052   mt_ntuple_row_wise(const mt_ntuple_row_wise& a_from)
0053   :imt_ntuple(a_from)
0054   ,parent(a_from)
0055   ,m_main_branch(a_from.m_main_branch)
0056   {}
0057   mt_ntuple_row_wise& operator=(const mt_ntuple_row_wise& a_from){parent::operator=(a_from);return *this;}
0058 protected:
0059   bool end_leaves(imutex& a_mutex) const {
0060     if(m_main_branch.leaves().size()!=m_row_wise_branch.leaves().size()) {
0061       m_out << "tools::wroot::mt_ntuple_row_wise::end_leaves :"
0062             << " m_main_branch.leaves().size() (" << m_main_branch.leaves().size() << ") != "
0063             << "m_row_wise_branch.leaves().size() (" << m_row_wise_branch.leaves().size() << ")."
0064             << std::endl;
0065       return false;
0066     }
0067 
0068 #include "MT_SET_MAX.icc"
0069 
0070     std::vector<base_leaf*>::iterator pit = const_cast< std::vector<base_leaf*>& >(m_row_wise_branch.leaves()).begin();
0071     tools_vforcit(base_leaf*,m_main_branch.leaves(),mit) {
0072       base_leaf* _mleaf = *mit;
0073       base_leaf* _pleaf = *pit; pit++; //WARNING.
0074 
0075       TOOLS_WROOT_MT_NTUPLE_SET_MAX(char)
0076       TOOLS_WROOT_MT_NTUPLE_SET_MAX(short)
0077       TOOLS_WROOT_MT_NTUPLE_SET_MAX(int)
0078       TOOLS_WROOT_MT_NTUPLE_SET_MAX(float)
0079       TOOLS_WROOT_MT_NTUPLE_SET_MAX(double)
0080 
0081       TOOLS_WROOT_MT_NTUPLE_STRING_SET_MAX
0082 
0083     }
0084 #undef TOOLS_WROOT_MT_NTUPLE_SET_MAX
0085 #undef TOOLS_WROOT_MT_NTUPLE_STRING_SET_MAX
0086 
0087     return true;
0088   }
0089 protected:
0090   branch& m_main_branch;
0091 };
0092 
0093 }}
0094 
0095 #endif