Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:48

0001 
0002 #define TOOLS_WROOT_MT_NTUPLE_SET_MAX(a__type) \
0003      {leaf_ref<a__type>* _mleaf_ = _mleaf?id_cast<base_leaf, leaf_ref<a__type> >(*_mleaf):0;\
0004       leaf_ref<a__type>* _pleaf_ = _pleaf?id_cast<base_leaf, leaf_ref<a__type> >(*_pleaf):0;\
0005       if(_mleaf_&&!_pleaf_) {\
0006         m_out << "tools::wroot::mt_ntuple::end_leaves : merge leaves problem (1)." << std::endl;\
0007         if(_mleaf) m_out << "main leaf name " << _mleaf->name() << ", cid " << _mleaf->id_cls() << std::endl;\
0008         return false;\
0009       }\
0010       if(!_mleaf_&&_pleaf_) {\
0011         m_out << "tools::wroot::mt_ntuple::end_leaves : merge leaves problem (2)." << std::endl;\
0012         if(_pleaf) m_out << "to compare with parallel leaf name " << _pleaf->name() << ", cid " << _pleaf->id_cls() << std::endl;\
0013         return false;\
0014       }\
0015       if(_mleaf_ && _pleaf_) {\
0016         /*uint32 _length = _pleaf_->length();*/\
0017         a__type _mx = _pleaf_->get_max();\
0018         a_mutex.lock(); /*do it here (and not outside loop) because of upper m_out.*/\
0019         /*_mleaf_->set_length(max_of(_length,_mleaf_->length()));*/\
0020         _mleaf_->set_max(max_of<a__type>(_mx,_mleaf_->get_max()));\
0021         a_mutex.unlock();\
0022       }}
0023 
0024 #define TOOLS_WROOT_MT_NTUPLE_STRING_SET_MAX \
0025      {leaf_string_ref* _mleaf_ = _mleaf?id_cast<base_leaf,leaf_string_ref>(*_mleaf):0;\
0026       leaf_string_ref* _pleaf_ = _pleaf?id_cast<base_leaf,leaf_string_ref>(*_pleaf):0;\
0027       if(_mleaf_&&!_pleaf_) {\
0028         m_out << "tools::wroot::mt_ntuple::end_leaves : merge string leaves problem (1)." << std::endl;\
0029         if(_mleaf) m_out << "main leaf name " << _mleaf->name() << ", cid " << _mleaf->id_cls() << std::endl;\
0030         return false;\
0031       }\
0032       if(!_mleaf_&&_pleaf_) {\
0033         m_out << "tools::wroot::mt_ntuple::end_leaves : merge string leaves problem (2)." << std::endl;\
0034         if(_pleaf) m_out << "to compare with parallel leaf name " << _pleaf->name() << ", cid " << _pleaf->id_cls() << std::endl;\
0035         return false;\
0036       }\
0037       if(_mleaf_ && _pleaf_) {\
0038         /*m_out << "tools::wroot::mt_ntuple::end_leaves : merge string leaves ok." << std::endl;*/\
0039         uint32 _length = _pleaf_->length();\
0040         int _mx = _pleaf_->get_max();\
0041         a_mutex.lock(); /*do it here (and not outside loop) because of upper m_out.*/\
0042         _mleaf_->set_length(max_of(_length,_mleaf_->length()));\
0043         _mleaf_->set_max(max_of(_mx,_mleaf_->get_max()));\
0044         a_mutex.unlock();\
0045       }}
0046