Import Geant4 10.6.0 source tree
This commit is contained in:
@@ -19,6 +19,12 @@ namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
class base_pntuple {
|
||||
#ifdef TOOLS_MEM
|
||||
static const std::string& s_class() {
|
||||
static const std::string s_v("tools::wroot::base_pntuple");
|
||||
return s_v;
|
||||
}
|
||||
#endif
|
||||
public:
|
||||
|
||||
#include "columns.icc"
|
||||
@@ -29,13 +35,24 @@ public:
|
||||
,m_seek_directory(a_seek_directory)
|
||||
,m_name(a_name)
|
||||
,m_title(a_title)
|
||||
{}
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~base_pntuple() {
|
||||
safe_clear<icol>(m_cols);
|
||||
#ifdef TOOLS_MEM
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
base_pntuple(const base_pntuple& a_from):m_out(a_from.m_out){}
|
||||
base_pntuple(const base_pntuple& a_from):m_out(a_from.m_out){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
base_pntuple& operator=(const base_pntuple&){return *this;}
|
||||
public:
|
||||
const std::vector<icol*>& columns() const {return m_cols;}
|
||||
|
||||
@@ -55,7 +55,6 @@ public:
|
||||
:parent(a_out,a_seek_directory,a_name,a_title)
|
||||
,m_file(a_out,a_byte_swap,a_compression,a_verbose)
|
||||
{}
|
||||
|
||||
base_pntuple_column_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
const std::vector<uint32>& a_basket_sizes,
|
||||
const ntuple_booking& a_bkg,bool a_verbose)
|
||||
|
||||
@@ -169,10 +169,15 @@ protected:
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
const buffer& datbuf() const {return m_data;}
|
||||
buffer& datbuf() {return m_data;}
|
||||
|
||||
const int* entry_offset() const {return m_entry_offset;}
|
||||
int* entry_offset() {return m_entry_offset;}
|
||||
|
||||
const int* displacement() const {return m_displacement;}
|
||||
int* displacement() {return m_displacement;}
|
||||
|
||||
uint32 nev_buf_size() const {return m_nev_buf_size;}
|
||||
uint32 nev() const {return m_nev;}
|
||||
uint32 last() const {return m_last;}
|
||||
|
||||
@@ -410,10 +410,10 @@ public:
|
||||
public:
|
||||
virtual ~iadd_basket() {}
|
||||
public:
|
||||
virtual bool add_basket(basket&) = 0;
|
||||
virtual bool add_basket(basket*) = 0;
|
||||
};
|
||||
|
||||
bool pfill(iadd_basket& a_badd) {
|
||||
bool pfill(iadd_basket& a_badd,uint32 a_nev) {
|
||||
//done on a pntuple/branch.
|
||||
|
||||
//a_nbytes = 0;
|
||||
@@ -445,33 +445,33 @@ public:
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
uint32 lnew = buf.length();
|
||||
uint32 nbytes = lnew - lold;
|
||||
|
||||
//uint32 add_bytes = 0;
|
||||
//uint32 nout = 0;
|
||||
|
||||
|
||||
// Should we create a new basket?
|
||||
// Compare expected next size with m_basket_size.
|
||||
if((lnew+nbytes)>=m_basket_size) {
|
||||
if(!a_badd.add_basket(*bk)) {
|
||||
bool store_basket = false;
|
||||
if(a_nev) {
|
||||
store_basket = (bk->nev()>=a_nev); // trigger add_basket per number of entries reached.
|
||||
} else {
|
||||
store_basket = ((lnew+nbytes)>=m_basket_size); // trigger add_basket when reaching m_basket_size.
|
||||
}
|
||||
|
||||
if(store_basket) {
|
||||
if(!a_badd.add_basket(bk)) { //we give ownership of bk.
|
||||
m_out << "tools::wroot::branch::parallel_fill :"
|
||||
<< " main_branch.add_basket() failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
delete bk;
|
||||
//delete bk; //no, it is deleted by the a_badd.add_basket().
|
||||
bool main_branch_byte_swap = m_byte_swap; //NOTE : it assumes that pntuple/branch and main/branch have same byte_swap.
|
||||
bool main_branch_verbose = m_verbose;
|
||||
m_baskets[m_write_basket] = new basket(m_out,main_branch_byte_swap,
|
||||
m_seek_directory,m_name,m_title,"TBasket",m_basket_size,
|
||||
main_branch_verbose);
|
||||
//a_mutex.unlock();
|
||||
}
|
||||
//a_nbytes = nbytes;
|
||||
//a_add_bytes = add_bytes;
|
||||
//a_nout = nout;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -490,15 +490,16 @@ public:
|
||||
uint32 lold = buf.length();
|
||||
|
||||
if(lold) {
|
||||
if(!a_badd.add_basket(*bk)) {
|
||||
if(!a_badd.add_basket(bk)) { //we give ownership of bk.
|
||||
m_out << "tools::wroot::branch::parallel_fill :"
|
||||
<< " main_branch.add_basket() failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
delete bk;
|
||||
}
|
||||
|
||||
delete bk;
|
||||
m_baskets[m_write_basket] = 0; // no need to recreate a basket since it is end of fill.
|
||||
|
||||
return true;
|
||||
@@ -562,6 +563,9 @@ protected:
|
||||
bool m_verbose;
|
||||
seek m_seek_directory;
|
||||
obj_array<basket> m_baskets;
|
||||
/// for parallelization :
|
||||
public:
|
||||
std::vector<basket*> m_parallel_baskets;
|
||||
protected:
|
||||
//Object
|
||||
//uint32 m_bits;
|
||||
|
||||
@@ -214,8 +214,7 @@ public:
|
||||
<< std::endl;
|
||||
return 0;
|
||||
}
|
||||
directory* dir =
|
||||
new directory(m_file,this,a_name,a_title.empty()?a_name:a_title);
|
||||
directory* dir = new directory(m_file,this,a_name,a_title.empty()?a_name:a_title);
|
||||
if(!dir->is_valid()) {
|
||||
m_file.out() << "tools::wroot::directory::mkdir :"
|
||||
<< " directory badly created."
|
||||
@@ -327,6 +326,9 @@ public:
|
||||
void clear_dirs() {safe_clear<directory>(m_dirs);}
|
||||
void clear_objs() {safe_clear<iobject>(m_objs);}
|
||||
|
||||
const std::list<key*>& keys() const {return m_keys;}
|
||||
//std::list<key*>& keys() {return m_keys;}
|
||||
|
||||
protected:
|
||||
void clear_keys() {
|
||||
std::list<key*>::iterator it;
|
||||
@@ -361,9 +363,6 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
//const std::list<key*>& keys() const {return m_keys;}
|
||||
//std::list<key*>& keys() {return m_keys;}
|
||||
|
||||
key* find_key(const std::string& a_name) {
|
||||
if(m_file.verbose()) {
|
||||
m_file.out() << "tools::wroot::directory::find_key :"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
namespace streamer_info {
|
||||
namespace streamer__info {
|
||||
|
||||
enum Type { // sizeof :
|
||||
BASE = 0, // x
|
||||
@@ -128,7 +128,7 @@ protected:
|
||||
public:
|
||||
virtual void setArrayDimension(int aDimension){
|
||||
fArrayDim = aDimension;
|
||||
if(aDimension) fType += streamer_info::ARRAY;
|
||||
if(aDimension) fType += streamer__info::ARRAY;
|
||||
//fNewType = fType;
|
||||
}
|
||||
virtual void setMaxIndex(int aDimension,int aMaximum){
|
||||
@@ -179,11 +179,11 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_base(*this);}
|
||||
public:
|
||||
streamer_base(const std::string& aName,const std::string& aTitle,int aOffset,int aBaseVersion)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer_info::BASE,"BASE")
|
||||
:streamer_element(aName,aTitle,aOffset,streamer__info::BASE,"BASE")
|
||||
,fBaseVersion(aBaseVersion)
|
||||
{
|
||||
if (aName=="TObject") fType = streamer_info::TOBJECT;
|
||||
if (aName=="TNamed") fType = streamer_info::TNAMED;
|
||||
if (aName=="TObject") fType = streamer__info::TOBJECT;
|
||||
if (aName=="TNamed") fType = streamer__info::TNAMED;
|
||||
}
|
||||
virtual ~streamer_base(){}
|
||||
public:
|
||||
@@ -237,12 +237,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_short(*this);}
|
||||
public:
|
||||
streamer_short(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::SHORT,"Short_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::SHORT,"Short_t")
|
||||
{}
|
||||
streamer_short(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::SHORT,"Short_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::SHORT,"Short_t")
|
||||
{
|
||||
aOffset += streamer_info::size_SHORT;
|
||||
aOffset += streamer__info::size_SHORT;
|
||||
}
|
||||
virtual ~streamer_short(){}
|
||||
public:
|
||||
@@ -255,12 +255,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_int(*this);}
|
||||
public:
|
||||
streamer_int(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::INT,"Int_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::INT,"Int_t")
|
||||
{}
|
||||
streamer_int(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::INT,"Int_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::INT,"Int_t")
|
||||
{
|
||||
aOffset += streamer_info::size_INT;
|
||||
aOffset += streamer__info::size_INT;
|
||||
}
|
||||
virtual ~streamer_int(){}
|
||||
public:
|
||||
@@ -273,12 +273,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_uint(*this);}
|
||||
public:
|
||||
streamer_uint(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::UNSIGNED_INT,"UInt_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_INT,"UInt_t")
|
||||
{}
|
||||
streamer_uint(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::UNSIGNED_INT,"UInt_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_INT,"UInt_t")
|
||||
{
|
||||
aOffset += streamer_info::size_UINT;
|
||||
aOffset += streamer__info::size_UINT;
|
||||
}
|
||||
virtual ~streamer_uint(){}
|
||||
public:
|
||||
@@ -291,12 +291,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_float(*this);}
|
||||
public:
|
||||
streamer_float(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::FLOAT,"Float_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::FLOAT,"Float_t")
|
||||
{}
|
||||
streamer_float(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::FLOAT,"Float_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::FLOAT,"Float_t")
|
||||
{
|
||||
aOffset += streamer_info::size_FLOAT;
|
||||
aOffset += streamer__info::size_FLOAT;
|
||||
}
|
||||
virtual ~streamer_float(){}
|
||||
public:
|
||||
@@ -309,12 +309,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_double(*this);}
|
||||
public:
|
||||
streamer_double(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::DOUBLE,"Double_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Double_t")
|
||||
{}
|
||||
streamer_double(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::DOUBLE,"Double_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Double_t")
|
||||
{
|
||||
aOffset += streamer_info::size_DOUBLE;
|
||||
aOffset += streamer__info::size_DOUBLE;
|
||||
}
|
||||
virtual ~streamer_double(){}
|
||||
public:
|
||||
@@ -327,12 +327,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_stat_t(*this);}
|
||||
public:
|
||||
streamer_stat_t(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::DOUBLE,"Stat_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Stat_t")
|
||||
{}
|
||||
streamer_stat_t(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::DOUBLE,"Stat_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::DOUBLE,"Stat_t")
|
||||
{
|
||||
aOffset += streamer_info::size_DOUBLE;
|
||||
aOffset += streamer__info::size_DOUBLE;
|
||||
}
|
||||
virtual ~streamer_stat_t(){}
|
||||
public:
|
||||
@@ -345,12 +345,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_bool(*this);}
|
||||
public:
|
||||
streamer_bool(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::UNSIGNED_CHAR,"Bool_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_CHAR,"Bool_t")
|
||||
{}
|
||||
streamer_bool(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer_info::UNSIGNED_CHAR,"Bool_t")
|
||||
:streamer_basic_type(aName,aTitle,aOffset,streamer__info::UNSIGNED_CHAR,"Bool_t")
|
||||
{
|
||||
aOffset += streamer_info::size_BOOL;
|
||||
aOffset += streamer__info::size_BOOL;
|
||||
}
|
||||
virtual ~streamer_bool(){}
|
||||
public:
|
||||
@@ -383,7 +383,7 @@ public:
|
||||
const std::string& aCountClass,
|
||||
int aCountVersion,
|
||||
const std::string& aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,aType+streamer_info::POINTER,aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,aType+streamer__info::POINTER,aTypeName)
|
||||
,fCountVersion(aCountVersion)
|
||||
,fCountName(aCountName)
|
||||
,fCountClass(aCountClass)
|
||||
@@ -426,12 +426,12 @@ public: //streamer_element
|
||||
virtual streamer_element* copy() const {return new streamer_string(*this);}
|
||||
public:
|
||||
streamer_string(const std::string& aName,const std::string& aTitle,int aOffset)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer_info::_TSTRING,"TString")
|
||||
:streamer_element(aName,aTitle,aOffset,streamer__info::_TSTRING,"TString")
|
||||
{}
|
||||
streamer_string(int& aOffset,const std::string& aName,const std::string& aTitle)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer_info::_TSTRING,"TString")
|
||||
:streamer_element(aName,aTitle,aOffset,streamer__info::_TSTRING,"TString")
|
||||
{
|
||||
aOffset += streamer_info::size_TString;
|
||||
aOffset += streamer__info::size_TString;
|
||||
}
|
||||
virtual ~streamer_string(){}
|
||||
public:
|
||||
@@ -458,9 +458,9 @@ public: //streamer_element
|
||||
public:
|
||||
streamer_object(const std::string& aName,const std::string& aTitle,int aOffset,const std::string& aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,0,aTypeName){
|
||||
fType = streamer_info::OBJECT;
|
||||
if (aName=="TObject") fType = streamer_info::TOBJECT;
|
||||
if (aName=="TNamed") fType = streamer_info::TNAMED;
|
||||
fType = streamer__info::OBJECT;
|
||||
if (aName=="TObject") fType = streamer__info::TOBJECT;
|
||||
if (aName=="TNamed") fType = streamer__info::TNAMED;
|
||||
}
|
||||
virtual ~streamer_object(){}
|
||||
public:
|
||||
@@ -489,8 +489,8 @@ public: //streamer_element
|
||||
public:
|
||||
streamer_object_pointer(const std::string& aName,const std::string& aTitle,
|
||||
int aOffset,const std::string& aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer_info::OBJECT_POINTER,aTypeName){
|
||||
if(aTitle.substr(0,2)=="->") fType = streamer_info::OBJECT_ARROW;
|
||||
:streamer_element(aName,aTitle,aOffset,streamer__info::OBJECT_POINTER,aTypeName){
|
||||
if(aTitle.substr(0,2)=="->") fType = streamer__info::OBJECT_ARROW;
|
||||
}
|
||||
virtual ~streamer_object_pointer(){}
|
||||
public:
|
||||
@@ -519,7 +519,7 @@ public: //streamer_element
|
||||
public:
|
||||
streamer_object_any(const std::string& aName,const std::string& aTitle,
|
||||
int aOffset,const std::string& aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer_info::OBJECT_ANY,aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,streamer__info::OBJECT_ANY,aTypeName)
|
||||
{}
|
||||
virtual ~streamer_object_any(){}
|
||||
public:
|
||||
@@ -553,7 +553,7 @@ protected:
|
||||
kSTLlist = 2, kSTLdeque = 3, kSTLmap = 4,
|
||||
kSTLset = 5, kSTLmultimap=6, kSTLmultiset=7};
|
||||
|
||||
// Instead of EDataType, we use the Streamer_Info::Type.
|
||||
// Instead of EDataType, we use the streamer__info::Type.
|
||||
//enum EDataType {
|
||||
// kChar_t = 1, kUChar_t = 11, kShort_t = 2, kUShort_t = 12,
|
||||
// kInt_t = 3, kUInt_t = 13, kLong_t = 4, kULong_t = 14,
|
||||
@@ -562,7 +562,7 @@ protected:
|
||||
public:
|
||||
streamer_STL(const std::string& aName,const std::string& aTitle,
|
||||
int aOffset,
|
||||
streamer_info::Type aType, //Must match TDataType/EDataType
|
||||
streamer__info::Type aType, //Must match TDataType/EDataType
|
||||
const std::string& aTypeName)
|
||||
:streamer_element(aName,aTitle,aOffset,kSTL,aTypeName){
|
||||
fSTLtype = kSTLvector;
|
||||
|
||||
@@ -541,7 +541,7 @@ protected:
|
||||
}
|
||||
|
||||
bool write_streamer_infos() {
|
||||
obj_list<StreamerInfo> sinfos;
|
||||
obj_list<streamer_info> sinfos;
|
||||
fill_infos(sinfos,m_out);
|
||||
|
||||
if(sinfos.empty()) return false;
|
||||
@@ -550,7 +550,7 @@ protected:
|
||||
|
||||
if(!sinfos.stream(bref)) {
|
||||
m_out << "tools::wroot::file::write_streamer_infos :"
|
||||
<< " cannot stream obj_list<StreamerInfo>."
|
||||
<< " cannot stream obj_list<streamer_info>."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace wroot {
|
||||
// sizeof(TNamed) = 28 = TObject + 2 * TString.
|
||||
// sizeof(TObjArray) = 40
|
||||
|
||||
class StreamerInfo : public virtual ibo {
|
||||
class streamer_info : public virtual ibo {
|
||||
static const std::string& s_class() {
|
||||
static const std::string s_v("tools::wroot::StreamerInfo");
|
||||
static const std::string s_v("tools::wroot::streamer_info");
|
||||
return s_v;
|
||||
}
|
||||
public: //ibo
|
||||
@@ -45,13 +45,13 @@ public: //ibo
|
||||
}
|
||||
public:
|
||||
virtual void out(std::ostream& a_out) const {
|
||||
a_out << "StreamerInfo for class :"
|
||||
a_out << "streamer_info for class :"
|
||||
<< " " << fName << ", version=" << fStreamedClassVersion
|
||||
<< std::endl;
|
||||
tools_vforcit(streamer_element*,fElements,it) (*it)->out(a_out);
|
||||
}
|
||||
public:
|
||||
StreamerInfo(const std::string& a_cls_store_name,int a_cls_vers,unsigned int a_cls_check_sum)
|
||||
streamer_info(const std::string& a_cls_store_name,int a_cls_vers,unsigned int a_cls_check_sum)
|
||||
:fName(a_cls_store_name)
|
||||
,fTitle("")
|
||||
,fCheckSum(a_cls_check_sum)
|
||||
@@ -61,13 +61,13 @@ public:
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
virtual ~StreamerInfo(){
|
||||
virtual ~streamer_info(){
|
||||
#ifdef TOOLS_MEM
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
StreamerInfo(const StreamerInfo& a_from)
|
||||
streamer_info(const streamer_info& a_from)
|
||||
:ibo(a_from)
|
||||
,fName(a_from.fName)
|
||||
,fTitle(a_from.fName)
|
||||
@@ -79,7 +79,7 @@ protected:
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
StreamerInfo& operator=(const StreamerInfo& a_from){
|
||||
streamer_info& operator=(const streamer_info& a_from){
|
||||
fName = a_from.fName;
|
||||
fTitle = a_from.fName;
|
||||
fCheckSum = a_from.fCheckSum;
|
||||
|
||||
@@ -18,9 +18,9 @@ inline void acs(unsigned int& a_cs,int a_n,int* a_dims) {
|
||||
for(int i=0;i<a_n;i++) a_cs = a_cs*3+(unsigned int)a_dims[i];
|
||||
}
|
||||
|
||||
inline void fill_vec(obj_list<StreamerInfo>& a_infos,const std::string& a_type,streamer_info::Type a_si_type) {
|
||||
inline void fill_vec(obj_list<streamer_info>& a_infos,const std::string& a_type,streamer__info::Type a_si_type) {
|
||||
unsigned int check = 196608;
|
||||
StreamerInfo* info = new StreamerInfo(std::string("vector<")+a_type+">",4,check);
|
||||
streamer_info* info = new streamer_info(std::string("vector<")+a_type+">",4,check);
|
||||
a_infos.push_back(info);
|
||||
info->add(new streamer_STL("This","Used to call the proper TStreamerInfo case",0,a_si_type,std::string("vector<")+a_type+">"));
|
||||
}
|
||||
@@ -30,7 +30,7 @@ inline int size_VIRTUAL() {return 4;}
|
||||
inline int size_TObject() {return 12;}
|
||||
inline int size_TNamed() {return 28;}
|
||||
|
||||
inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out) {
|
||||
inline void fill_infos_core(obj_list<streamer_info>& a_infos,std::ostream& a_out) {
|
||||
|
||||
// sizeof(TString) = 8 (4 (virtual ~) + 1 + 3 (align))
|
||||
// sizeof(TObject) = 12
|
||||
@@ -60,7 +60,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fBits");
|
||||
scs(check,"UInt_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TObject",1,check);
|
||||
streamer_info* info = new streamer_info("TObject",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = size_VIRTUAL();
|
||||
@@ -85,7 +85,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fTitle");
|
||||
scs(check,"TString");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TNamed",1,check);
|
||||
streamer_info* info = new streamer_info("TNamed",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -113,7 +113,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fElements");
|
||||
scs(check,"TObjArray*");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerInfo",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerInfo",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TNamed","The basis for a named object (name, title)",0,TNamed_version));//28
|
||||
@@ -153,7 +153,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TString");
|
||||
//Should be : 2369818458U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerElement",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerElement",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TNamed","The basis for a named object (name, title)",0,TNamed_version));
|
||||
@@ -179,7 +179,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"Int_t");
|
||||
//Should be : 2671078514U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerBase",3,check);
|
||||
streamer_info* info = new streamer_info("TStreamerBase",3,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));
|
||||
@@ -192,7 +192,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TStreamerElement");
|
||||
//Should be : 2525579865U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerString",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerString",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));}
|
||||
@@ -204,7 +204,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TStreamerElement");
|
||||
//Should be : 3001875966U;
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerBasicType",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerBasicType",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));}
|
||||
@@ -225,7 +225,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TString");
|
||||
//Should be : 1587298059U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerBasicPointer",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerBasicPointer",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));
|
||||
@@ -240,7 +240,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TStreamerElement");
|
||||
//Should be : 2177456715U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerObject",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerObject",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));}
|
||||
@@ -252,7 +252,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TStreamerElement");
|
||||
//Should be : 720556968U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerObjectPointer",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerObjectPointer",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));}
|
||||
@@ -264,7 +264,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"TStreamerElement");
|
||||
//Should be : 3108880127U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TStreamerObjectAny",2,check);
|
||||
streamer_info* info = new streamer_info("TStreamerObjectAny",2,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
info->add(new streamer_base("TStreamerElement","base class for one element (data member) to be Streamed",0,TStreamerElement_version));}
|
||||
@@ -276,7 +276,7 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fN");
|
||||
scs(check,"Int_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TArray",1,check);
|
||||
streamer_info* info = new streamer_info("TArray",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -295,13 +295,13 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fArray");
|
||||
scs(check,"Int_t*");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TArrayI",1,check);
|
||||
streamer_info* info = new streamer_info("TArrayI",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
int offset = 0;
|
||||
info->add(new streamer_base("TArray","Abstract array base class",offset,TArray_version));offset += size_TArray;
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer_info::INT,"fN","TArray",1,"Int_t*"));offset += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer__info::INT,"fN","TArray",1,"Int_t*"));offset += size_POINTER;
|
||||
|
||||
//12
|
||||
}
|
||||
@@ -315,13 +315,13 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fArray");
|
||||
scs(check,"Double_t*");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TArrayD",1,check);
|
||||
streamer_info* info = new streamer_info("TArrayD",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
int offset = 0;
|
||||
info->add(new streamer_base("TArray","Abstract array base class",offset,TArray_version));offset += size_TArray; //8
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer_info::DOUBLE,"fN","TArray",1,"Double_t*"));offset += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer__info::DOUBLE,"fN","TArray",1,"Double_t*"));offset += size_POINTER;
|
||||
|
||||
//12
|
||||
}
|
||||
@@ -335,30 +335,30 @@ inline void fill_infos_core(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fArray");
|
||||
scs(check,"Float_t*");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TArrayF",1,check);
|
||||
streamer_info* info = new streamer_info("TArrayF",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
int offset = 0;
|
||||
info->add(new streamer_base("TArray","Abstract array base class",offset,TArray_version));offset += size_TArray;
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer_info::FLOAT,"fN","TArray",1,"Float_t*"));offset += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fArray","[fN] Array of fN integers",offset,streamer__info::FLOAT,"fN","TArray",1,"Float_t*"));offset += size_POINTER;
|
||||
|
||||
//12
|
||||
}
|
||||
|
||||
fill_vec(a_infos,"char",streamer_info::CHAR);
|
||||
fill_vec(a_infos,"short",streamer_info::SHORT);
|
||||
fill_vec(a_infos,"int",streamer_info::INT);
|
||||
fill_vec(a_infos,"unsigned char",streamer_info::UNSIGNED_CHAR);
|
||||
fill_vec(a_infos,"unsigned short",streamer_info::UNSIGNED_SHORT);
|
||||
fill_vec(a_infos,"unsigned int",streamer_info::UNSIGNED_INT);
|
||||
fill_vec(a_infos,"float",streamer_info::FLOAT);
|
||||
fill_vec(a_infos,"double",streamer_info::DOUBLE);
|
||||
fill_vec(a_infos,"bool",streamer_info::BOOL);
|
||||
fill_vec(a_infos,"char",streamer__info::CHAR);
|
||||
fill_vec(a_infos,"short",streamer__info::SHORT);
|
||||
fill_vec(a_infos,"int",streamer__info::INT);
|
||||
fill_vec(a_infos,"unsigned char",streamer__info::UNSIGNED_CHAR);
|
||||
fill_vec(a_infos,"unsigned short",streamer__info::UNSIGNED_SHORT);
|
||||
fill_vec(a_infos,"unsigned int",streamer__info::UNSIGNED_INT);
|
||||
fill_vec(a_infos,"float",streamer__info::FLOAT);
|
||||
fill_vec(a_infos,"double",streamer__info::DOUBLE);
|
||||
fill_vec(a_infos,"bool",streamer__info::BOOL);
|
||||
|
||||
}
|
||||
|
||||
inline void fill_infos_cont(obj_list<StreamerInfo>& a_infos,std::ostream&) {
|
||||
inline void fill_infos_cont(obj_list<streamer_info>& a_infos,std::ostream&) {
|
||||
|
||||
// sizeof(TString) = 8 (4 (virtual ~) + 1 + 3 (align))
|
||||
// sizeof(TObject) = 12
|
||||
@@ -382,7 +382,7 @@ inline void fill_infos_cont(obj_list<StreamerInfo>& a_infos,std::ostream&) {
|
||||
scs(check,"fSize");
|
||||
scs(check,"Int_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TCollection",TCollection_version,check);
|
||||
streamer_info* info = new streamer_info("TCollection",TCollection_version,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -403,7 +403,7 @@ inline void fill_infos_cont(obj_list<StreamerInfo>& a_infos,std::ostream&) {
|
||||
scs(check,"fSorted");
|
||||
scs(check,"Bool_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TSeqCollection",TSeqCollection_version,check);
|
||||
streamer_info* info = new streamer_info("TSeqCollection",TSeqCollection_version,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -421,7 +421,7 @@ inline void fill_infos_cont(obj_list<StreamerInfo>& a_infos,std::ostream&) {
|
||||
scs(check,"TSeqCollection");
|
||||
//members :
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TList",TList_version,check);
|
||||
streamer_info* info = new streamer_info("TList",TList_version,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -438,7 +438,7 @@ inline int size_TAttLine() {return 10;} //12?
|
||||
inline int size_TAttFill() {return 8;}
|
||||
inline int size_TAttMarker() {return 12;}
|
||||
|
||||
inline void fill_infos_graf(obj_list<StreamerInfo>& a_infos,std::ostream& a_out) {
|
||||
inline void fill_infos_graf(obj_list<streamer_info>& a_infos,std::ostream& a_out) {
|
||||
|
||||
//sizeof(Font_t) = 2
|
||||
//sizeof(Style_t) = 2
|
||||
@@ -465,13 +465,13 @@ inline void fill_infos_graf(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
//Should be : 1369587346U
|
||||
|
||||
// Beurk ; but the ROOT TTree compells indirectly the below.
|
||||
StreamerInfo* info = new StreamerInfo("TAttLine",1,check);
|
||||
streamer_info* info = new streamer_info("TAttLine",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = size_VIRTUAL();
|
||||
info->add(new streamer_basic_type("fLineColor","line color",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fLineStyle","line style",ofs,streamer_info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fLineWidth","line width",ofs,streamer_info::SHORT,"Width_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fLineColor","line color",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fLineStyle","line style",ofs,streamer__info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fLineWidth","line width",ofs,streamer__info::SHORT,"Width_t"));ofs += size_SHORT;
|
||||
//2 (alignement ???)
|
||||
if(ofs!=size_TAttLine()) {
|
||||
a_out << "tools::wroot::fill_infos :"
|
||||
@@ -490,12 +490,12 @@ inline void fill_infos_graf(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"Style_t");
|
||||
|
||||
//Should be : 1204118360U
|
||||
StreamerInfo* info = new StreamerInfo("TAttFill",1,check);
|
||||
streamer_info* info = new streamer_info("TAttFill",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = size_VIRTUAL();
|
||||
info->add(new streamer_basic_type("fFillColor","fill area color",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fFillStyle","fill area style",ofs,streamer_info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fFillColor","fill area color",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fFillStyle","fill area style",ofs,streamer__info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
if(ofs!=size_TAttFill()) {
|
||||
a_out << "tools::wroot::fill_infos :"
|
||||
<< " TAttFill " << ofs << " (" << size_TAttFill() << " expected.)"
|
||||
@@ -517,13 +517,13 @@ inline void fill_infos_graf(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be 4207747460U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TAttMarker",1,check);
|
||||
streamer_info* info = new streamer_info("TAttMarker",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = size_VIRTUAL();
|
||||
info->add(new streamer_basic_type("fMarkerColor","Marker color index",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fMarkerStyle","Marker style",ofs,streamer_info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fMarkerSize","Marker size",ofs,streamer_info::FLOAT,"Size_t"));ofs += size_FLOAT;
|
||||
info->add(new streamer_basic_type("fMarkerColor","Marker color index",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fMarkerStyle","Marker style",ofs,streamer__info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_basic_type("fMarkerSize","Marker size",ofs,streamer__info::FLOAT,"Size_t"));ofs += size_FLOAT;
|
||||
if(ofs!=size_TAttMarker()) {
|
||||
a_out << "tools::wroot::fill_infos :"
|
||||
<< " TAttMarker " << ofs << " (" << size_TAttMarker() << " expected.)"
|
||||
@@ -536,7 +536,7 @@ inline int size_TBranch() {return 264;} //256?
|
||||
inline int size_TLeaf() {return 60;} //52?
|
||||
inline int size_TTree() {return 254;} //240?
|
||||
|
||||
inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out) {
|
||||
inline void fill_infos_tree(obj_list<streamer_info>& a_infos,std::ostream& a_out) {
|
||||
|
||||
const int size_CHAR = 1;
|
||||
const int size_INT = 4;
|
||||
@@ -617,7 +617,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
//Should be : 3245044844U //3.00.06
|
||||
//Should be : FIXME //3.10.02
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TTree",5,check);
|
||||
streamer_info* info = new streamer_info("TTree",5,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -726,7 +726,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
//Should be : 2056727376U (6 3.00.06)
|
||||
//Should be : FIXME (7 3.03.01)
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TBranch",8,check);
|
||||
streamer_info* info = new streamer_info("TBranch",8,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -738,7 +738,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
info->add(new streamer_int(ofs,"fWriteBasket","Last basket number written"));
|
||||
info->add(new streamer_int(ofs,"fEntryNumber","Current entry number (last one filled in this branch)"));
|
||||
info->add(new streamer_int(ofs,"fOffset","Offset of this branch"));
|
||||
info->add(new streamer_basic_type("fMaxBaskets","Maximum number of Baskets so far",ofs,streamer_info::COUNTER,"Int_t"));ofs += size_COUNTER;
|
||||
info->add(new streamer_basic_type("fMaxBaskets","Maximum number of Baskets so far",ofs,streamer__info::COUNTER,"Int_t"));ofs += size_COUNTER;
|
||||
info->add(new streamer_int(ofs,"fSplitLevel","Branch split level")); //3.03.01
|
||||
ofs += size_INT; //!fNLeaves
|
||||
ofs += size_INT; //!fReadBasket
|
||||
@@ -751,9 +751,9 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
info->add(new streamer_object("fBaskets","-> List of baskets of this branch",ofs,"TObjArray"));ofs += size_TObjArray;
|
||||
ofs += size_INT; //!fNBasketRAM
|
||||
ofs += size_POINTER; //!*fBasketRAM
|
||||
info->add(new streamer_basic_pointer("fBasketBytes","[fMaxBaskets] Lenght of baskets on file",ofs,streamer_info::INT,"fMaxBaskets","TBranch",6,"Int_t*"));ofs += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fBasketEntry","[fMaxBaskets] Table of first entry in eack basket",ofs,streamer_info::INT,"fMaxBaskets","TBranch",6,"Int_t*"));ofs += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fBasketSeek","[fMaxBaskets] Addresses of baskets on file",ofs,streamer_info::INT,"fMaxBaskets","TBranch",6,"Seek_t*"));ofs += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fBasketBytes","[fMaxBaskets] Lenght of baskets on file",ofs,streamer__info::INT,"fMaxBaskets","TBranch",6,"Int_t*"));ofs += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fBasketEntry","[fMaxBaskets] Table of first entry in eack basket",ofs,streamer__info::INT,"fMaxBaskets","TBranch",6,"Int_t*"));ofs += size_POINTER;
|
||||
info->add(new streamer_basic_pointer("fBasketSeek","[fMaxBaskets] Addresses of baskets on file",ofs,streamer__info::INT,"fMaxBaskets","TBranch",6,"Seek_t*"));ofs += size_POINTER;
|
||||
ofs += size_POINTER; //!*fTree
|
||||
ofs += size_POINTER; //!*fAddress
|
||||
ofs += size_POINTER; //!*fDirectory
|
||||
@@ -775,7 +775,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : 2857878535U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TBranchObject",1,check);
|
||||
streamer_info* info = new streamer_info("TBranchObject",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -805,7 +805,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fStreamerType");
|
||||
scs(check,"Int_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TBranchElement",1,check);
|
||||
streamer_info* info = new streamer_info("TBranchElement",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int offset = 0;
|
||||
@@ -844,7 +844,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : 727988519U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeaf",2,check);
|
||||
streamer_info* info = new streamer_info("TLeaf",2,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -878,7 +878,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : FIXME
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafS",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafS",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
@@ -902,7 +902,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : 3495201397U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafI",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafI",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -927,7 +927,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be 1366318032U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafF",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafF",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -952,7 +952,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafD",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafD",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -977,13 +977,13 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : FIXME
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafB",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafB",1,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = 0;
|
||||
info->add(new streamer_base("TLeaf","Leaf: description of a Branch data type",ofs,TLeaf_version));ofs += size_TLeaf();
|
||||
info->add(new streamer_basic_type("fMinimum","Minimum value if leaf range is specified",ofs,streamer_info::CHAR,"Char_t"));ofs += size_CHAR;
|
||||
info->add(new streamer_basic_type("fMaximum","Maximum value if leaf range is specified",ofs,streamer_info::CHAR,"Char_t"));ofs += size_CHAR;
|
||||
info->add(new streamer_basic_type("fMinimum","Minimum value if leaf range is specified",ofs,streamer__info::CHAR,"Char_t"));ofs += size_CHAR;
|
||||
info->add(new streamer_basic_type("fMaximum","Maximum value if leaf range is specified",ofs,streamer__info::CHAR,"Char_t"));ofs += size_CHAR;
|
||||
|
||||
}
|
||||
|
||||
@@ -1001,7 +1001,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be : FIXME
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafC",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafC",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -1021,7 +1021,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
|
||||
//Should be 2312661809U
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafObject",4,check);
|
||||
streamer_info* info = new streamer_info("TLeafObject",4,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -1041,7 +1041,7 @@ inline void fill_infos_tree(obj_list<StreamerInfo>& a_infos,std::ostream& a_out)
|
||||
scs(check,"fType");
|
||||
scs(check,"Int_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TLeafElement",1,check);
|
||||
streamer_info* info = new streamer_info("TLeafElement",1,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -1061,7 +1061,7 @@ inline int size_TH1() {return 560;} //568?
|
||||
inline int size_TH2() {return 592;} //600?
|
||||
inline int size_TH2D() {return 604;} //612?
|
||||
|
||||
inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out) {
|
||||
inline void fill_infos_histo(obj_list<streamer_info>& a_infos,std::ostream& a_out) {
|
||||
|
||||
typedef streamer_basic_type sbt;
|
||||
|
||||
@@ -1123,21 +1123,21 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTitleFont");
|
||||
scs(check,"Style_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TAttAxis",4,check);
|
||||
streamer_info* info = new streamer_info("TAttAxis",4,check);
|
||||
a_infos.push_back(info);
|
||||
// Elements :
|
||||
int ofs = size_VIRTUAL();
|
||||
info->add(new streamer_int(ofs,"fNdivisions","Number of divisions(10000*n3 + 100*n2 + n1)"));
|
||||
info->add(new sbt("fAxisColor","color of the line axis",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fLabelColor","color of labels",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fLabelFont","font for labels",ofs,streamer_info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fAxisColor","color of the line axis",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fLabelColor","color of labels",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fLabelFont","font for labels",ofs,streamer__info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new streamer_float(ofs,"fLabelOffset","offset of labels"));
|
||||
info->add(new streamer_float(ofs,"fLabelSize","size of labels"));
|
||||
info->add(new streamer_float(ofs,"fTickLength","length of tick marks"));
|
||||
info->add(new streamer_float(ofs,"fTitleOffset","offset of axis title"));
|
||||
info->add(new streamer_float(ofs,"fTitleSize","size of axis title"));
|
||||
info->add(new sbt("fTitleColor","color of axis title",ofs,streamer_info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fTitleFont","font for axis title",ofs,streamer_info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fTitleColor","color of axis title",ofs,streamer__info::SHORT,"Color_t"));ofs += size_SHORT;
|
||||
info->add(new sbt("fTitleFont","font for axis title",ofs,streamer__info::SHORT,"Style_t"));ofs += size_SHORT;
|
||||
//uuuu ofs += 2; //alignement ???
|
||||
if(ofs!=size_TAttAxis()) {
|
||||
a_out << "tools::wroot::fill_infos :"
|
||||
@@ -1176,7 +1176,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTimeFormat");
|
||||
scs(check,"TString");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TAxis",6,check);
|
||||
streamer_info* info = new streamer_info("TAxis",6,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
// Elements :
|
||||
@@ -1184,8 +1184,8 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
info->add(new streamer_base("TNamed","The basis for a named object (name, title)",ofs,TNamed_version));ofs += size_TNamed();
|
||||
info->add(new streamer_base("TAttAxis","Axis attributes",ofs,TAttAxis_version));ofs += size_TAttAxis();
|
||||
info->add(new streamer_int(ofs,"fNbins","Number of bins"));
|
||||
info->add(new sbt("fXmin","low edge of first bin",ofs,streamer_info::DOUBLE,"Axis_t"));ofs += size_DOUBLE;
|
||||
info->add(new sbt("fXmax","upper edge of last bin",ofs,streamer_info::DOUBLE,"Axis_t"));ofs += size_DOUBLE;
|
||||
info->add(new sbt("fXmin","low edge of first bin",ofs,streamer__info::DOUBLE,"Axis_t"));ofs += size_DOUBLE;
|
||||
info->add(new sbt("fXmax","upper edge of last bin",ofs,streamer__info::DOUBLE,"Axis_t"));ofs += size_DOUBLE;
|
||||
info->add(new streamer_object_any("fXbins","Bin edges array in X",ofs,"TArrayD"));ofs += size_TArrayD;
|
||||
ofs += size_POINTER; //!*fXlabels
|
||||
info->add(new streamer_int(ofs,"fFirst","first bin to display"));
|
||||
@@ -1258,7 +1258,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fFunctions");
|
||||
scs(check,"TList*");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH1",TH1_version,check);
|
||||
streamer_info* info = new streamer_info("TH1",TH1_version,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1302,7 +1302,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH1");
|
||||
scs(check,"TArrayF");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH1F",1,check);
|
||||
streamer_info* info = new streamer_info("TH1F",1,check);
|
||||
a_infos.push_back(info);
|
||||
int ofs = 0;
|
||||
info->add(new streamer_base("TH1","1-Dim histogram base class",ofs,TH1_version));ofs += size_TH1();
|
||||
@@ -1318,7 +1318,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH1");
|
||||
scs(check,"TArrayD");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH1D",TH1D_version,check);
|
||||
streamer_info* info = new streamer_info("TH1D",TH1D_version,check);
|
||||
a_infos.push_back(info);
|
||||
int ofs = 0;
|
||||
info->add(new streamer_base("TH1","1-Dim histogram base class",ofs,TH1_version));ofs += size_TH1();
|
||||
@@ -1352,13 +1352,13 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTsumwy2");
|
||||
scs(check,"Double_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TProfile",4,check);
|
||||
streamer_info* info = new streamer_info("TProfile",4,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
info->add(new streamer_base("TH1D","1-Dim histograms (one double per channel)",ofs,TH1D_version));ofs += size_TH1D;
|
||||
info->add(new streamer_object_any("fBinEntries","number of entries per bin",ofs,"TArrayD"));ofs += size_TArrayD;
|
||||
info->add(new streamer_basic_type("fErrorMode","Option to compute errors",ofs,streamer_info::INT,"EErrorType"));ofs += size_INT;
|
||||
info->add(new streamer_basic_type("fErrorMode","Option to compute errors",ofs,streamer__info::INT,"EErrorType"));ofs += size_INT;
|
||||
info->add(new streamer_double(ofs,"fYmin","Lower limit in Y (if set)"));
|
||||
info->add(new streamer_double(ofs,"fYmax","Upper limit in Y (if set)"));
|
||||
info->add(new streamer_double(ofs,"fTsumwy","Total Sum of weight*Y"));
|
||||
@@ -1387,7 +1387,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTsumwxy");
|
||||
scs(check,"Stat_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH2",TH2_version,check);
|
||||
streamer_info* info = new streamer_info("TH2",TH2_version,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1410,7 +1410,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH2");
|
||||
scs(check,"TArrayF");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH2F",3,check);
|
||||
streamer_info* info = new streamer_info("TH2F",3,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1428,7 +1428,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH2");
|
||||
scs(check,"TArrayD");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH2D",TH2D_version,check);
|
||||
streamer_info* info = new streamer_info("TH2D",TH2D_version,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1464,13 +1464,13 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTsumwz2");
|
||||
scs(check,"Double_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TProfile2D",5,check);
|
||||
streamer_info* info = new streamer_info("TProfile2D",5,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
info->add(new streamer_base("TH2D","2-Dim histograms (one double per channel)",ofs,TH2D_version));ofs += size_TH2D();
|
||||
info->add(new streamer_object_any("fBinEntries","number of entries per bin",ofs,"TArrayD"));ofs += size_TArrayD;
|
||||
info->add(new sbt("fErrorMode","Option to compute errors",ofs,streamer_info::INT,"EErrorType"));ofs += size_INT;
|
||||
info->add(new sbt("fErrorMode","Option to compute errors",ofs,streamer__info::INT,"EErrorType"));ofs += size_INT;
|
||||
info->add(new streamer_double(ofs,"fZmin","Lower limit in Z (if set)"));
|
||||
info->add(new streamer_double(ofs,"fZmax","Upper limit in Z (if set)"));
|
||||
info->add(new streamer_double(ofs,"fTsumwz","Total Sum of weight*Z"));
|
||||
@@ -1505,7 +1505,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"fTsumwyz");
|
||||
scs(check,"Double_t");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH3",TH3_version,check);
|
||||
streamer_info* info = new streamer_info("TH3",TH3_version,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1531,7 +1531,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH3");
|
||||
scs(check,"TArrayF");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH3F",3,check);
|
||||
streamer_info* info = new streamer_info("TH3F",3,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1548,7 +1548,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
scs(check,"TH3");
|
||||
scs(check,"TArrayD");
|
||||
|
||||
StreamerInfo* info = new StreamerInfo("TH3D",3,check);
|
||||
streamer_info* info = new streamer_info("TH3D",3,check);
|
||||
a_infos.push_back(info);
|
||||
|
||||
int ofs = 0;
|
||||
@@ -1561,7 +1561,7 @@ inline void fill_infos_histo(obj_list<StreamerInfo>& a_infos,std::ostream& a_out
|
||||
|
||||
}
|
||||
|
||||
inline void fill_infos(obj_list<StreamerInfo>& a_infos,std::ostream& a_out) {
|
||||
inline void fill_infos(obj_list<streamer_info>& a_infos,std::ostream& a_out) {
|
||||
|
||||
fill_infos_core(a_infos,a_out);
|
||||
fill_infos_cont(a_infos,a_out);
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
#ifndef tools_wroot_mpi_basket_add
|
||||
#define tools_wroot_mpi_basket_add
|
||||
|
||||
#include "mpi_send_basket"
|
||||
#include "branch"
|
||||
#include "mpi_protocol"
|
||||
#include "../impi"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
@@ -14,38 +13,10 @@ namespace wroot {
|
||||
class mpi_basket_add : public virtual branch::iadd_basket {
|
||||
typedef branch::iadd_basket parent;
|
||||
public:
|
||||
virtual bool add_basket(basket& a_basket) {
|
||||
m_mpi.pack_reset();
|
||||
if(!m_mpi.pack(mpi_protocol_basket())) return false;
|
||||
if(!m_mpi.pack(m_id)) return false;
|
||||
if(!m_mpi.pack(m_icol)) return false;
|
||||
|
||||
if(!m_mpi.spack(a_basket.object_name())) return false;
|
||||
if(!m_mpi.spack(a_basket.object_title())) return false;
|
||||
|
||||
if(!m_mpi.pack(a_basket.last())) return false;
|
||||
if(!m_mpi.pack(a_basket.nev_buf_size())) return false;
|
||||
if(!m_mpi.pack(a_basket.nev())) return false;
|
||||
|
||||
if(a_basket.entry_offset()) {
|
||||
if(!m_mpi.bpack(true)) return false;
|
||||
if(!m_mpi.pack(a_basket.nev_buf_size(),a_basket.entry_offset())) return false;
|
||||
} else {
|
||||
if(!m_mpi.bpack(false)) return false;
|
||||
}
|
||||
|
||||
if(a_basket.displacement()) {
|
||||
if(!m_mpi.bpack(true)) return false;
|
||||
if(!m_mpi.pack(a_basket.nev_buf_size(),a_basket.displacement())) return false;
|
||||
} else {
|
||||
if(!m_mpi.bpack(false)) return false;
|
||||
}
|
||||
|
||||
if(!m_mpi.pack(a_basket.datbuf().length(),a_basket.datbuf().buf())) return false;
|
||||
|
||||
if(!m_mpi.send_buffer(m_dest,m_tag)) return false;
|
||||
|
||||
return true;
|
||||
virtual bool add_basket(basket* a_basket) {
|
||||
bool status = mpi_send_basket(m_mpi,m_dest,m_tag,m_id,m_icol,*a_basket);
|
||||
delete a_basket;
|
||||
return status;
|
||||
}
|
||||
public:
|
||||
mpi_basket_add(impi& a_mpi,int a_dest,int a_tag,uint32 a_id,uint32 a_icol)
|
||||
|
||||
@@ -31,15 +31,20 @@ inline basket* mpi_create_basket(std::ostream& a_out,impi& a_mpi,bool a_byte_swa
|
||||
|
||||
int* displacement = 0;
|
||||
{bool not_null;
|
||||
if(!a_mpi.bunpack(not_null)) return 0;
|
||||
if(!a_mpi.bunpack(not_null)) {delete [] entry_offset;return 0;}
|
||||
if(not_null) {
|
||||
uint32 n;
|
||||
if(!a_mpi.unpack(n,displacement)) return 0;
|
||||
if(!a_mpi.unpack(n,displacement)) {delete [] entry_offset;return 0;}
|
||||
}}
|
||||
|
||||
uint32 _size;
|
||||
char* _buffer;
|
||||
if(!a_mpi.unpack(_size,_buffer)) {a_out << "unpack(buffer) failed."<< std::endl;return 0;}
|
||||
if(!a_mpi.unpack(_size,_buffer)) {
|
||||
a_out << "unpack(buffer) failed."<< std::endl;
|
||||
delete [] entry_offset;
|
||||
delete [] displacement;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// wbasket fields set at file writing :
|
||||
//m_buf_size,m_buffer,m_nbytes,m_object_size,m_date,m_cycle,m_seek_key
|
||||
@@ -53,6 +58,9 @@ inline basket* mpi_create_basket(std::ostream& a_out,impi& a_mpi,bool a_byte_swa
|
||||
_basket->datbuf().write_fast_array(_buffer,_size);
|
||||
_basket->set_nev(last,nev_buf_size,nev,entry_offset,displacement);
|
||||
|
||||
delete [] entry_offset;
|
||||
delete [] displacement;
|
||||
|
||||
delete [] _buffer;
|
||||
|
||||
return _basket;
|
||||
|
||||
@@ -18,6 +18,49 @@ namespace wroot {
|
||||
|
||||
class mpi_ntuple_column_wise : public base_pntuple_column_wise, public virtual impi_ntuple {
|
||||
typedef base_pntuple_column_wise parent;
|
||||
protected:
|
||||
class basket_add : public mpi_basket_add {
|
||||
typedef mpi_basket_add parent;
|
||||
public:
|
||||
virtual bool add_basket(basket* a_basket) { // we get ownership of a_basket.
|
||||
if(m_row_mode) {
|
||||
m_parallel_branch.m_parallel_baskets.push_back(a_basket);
|
||||
if(ready_to_flush_baskets(m_cols)) {return flush_baskets(m_mpi,m_dest,m_tag,m_id,m_cols);}
|
||||
return true;
|
||||
}
|
||||
bool status = mpi_send_basket(m_mpi,m_dest,m_tag,m_id,m_icol,*a_basket);
|
||||
delete a_basket;
|
||||
return status;
|
||||
}
|
||||
public:
|
||||
basket_add(impi& a_mpi,int a_dest,int a_tag,uint32 a_id,uint32 a_icol,
|
||||
branch& a_parallel_branch,
|
||||
std::vector<icol*>& a_cols,
|
||||
bool a_row_mode)
|
||||
:parent(a_mpi,a_dest,a_tag,a_id,a_icol)
|
||||
,m_parallel_branch(a_parallel_branch)
|
||||
,m_cols(a_cols)
|
||||
,m_row_mode(a_row_mode)
|
||||
{}
|
||||
protected:
|
||||
basket_add(const basket_add& a_from)
|
||||
:branch::iadd_basket(a_from)
|
||||
,parent(a_from)
|
||||
,m_parallel_branch(a_from.m_parallel_branch)
|
||||
,m_cols(a_from.m_cols)
|
||||
,m_row_mode(a_from.m_row_mode)
|
||||
{}
|
||||
basket_add& operator=(const basket_add& a_from){
|
||||
parent::operator=(a_from);
|
||||
m_row_mode = a_from.m_row_mode;
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
branch& m_parallel_branch;
|
||||
std::vector<icol*>& m_cols;
|
||||
bool m_row_mode;
|
||||
};
|
||||
|
||||
public:
|
||||
virtual bool add_row(impi& a_mpi,int a_dest,int a_tag) {
|
||||
if(m_cols.empty()) return false;
|
||||
@@ -26,8 +69,8 @@ public:
|
||||
|
||||
uint32 _icol = 0;
|
||||
tools_vforit(icol*,m_cols,it) {
|
||||
mpi_basket_add _badd(a_mpi,a_dest,a_tag,m_id,_icol);_icol++;
|
||||
if(!(*it)->get_branch().pfill(_badd)) return false;
|
||||
basket_add _badd(a_mpi,a_dest,a_tag,m_id,_icol,(*it)->get_branch(),m_cols,m_row_mode);_icol++;
|
||||
if(!(*it)->get_branch().pfill(_badd,m_nev)) return false;
|
||||
}
|
||||
|
||||
tools_vforit(icol*,m_cols,it) (*it)->set_def();
|
||||
@@ -37,10 +80,20 @@ public:
|
||||
virtual bool end_fill(impi& a_mpi,int a_dest,int a_tag) {
|
||||
uint32 _icol = 0;
|
||||
tools_vforit(icol*,m_cols,it) {
|
||||
mpi_basket_add _badd(a_mpi,a_dest,a_tag,m_id,_icol);_icol++;
|
||||
basket_add _badd(a_mpi,a_dest,a_tag,m_id,_icol,(*it)->get_branch(),m_cols,m_row_mode);_icol++;
|
||||
if(!(*it)->get_branch().end_pfill(_badd)) return false;
|
||||
}
|
||||
|
||||
if(m_row_mode) {
|
||||
size_t number;
|
||||
bool status = flush_remaining_baskets(number,a_mpi,a_dest,a_tag,m_id,m_cols);
|
||||
if(number) {
|
||||
m_out << "tools::wroot::mpi_ntuple_column_wise::end_fill : it remained " << number << " baskets not written on file." << std::endl;
|
||||
status = false;
|
||||
}
|
||||
if(!status) return false;
|
||||
}
|
||||
|
||||
a_mpi.pack_reset();
|
||||
if(!a_mpi.pack(mpi_protocol_end_fill())) return false;
|
||||
if(!a_mpi.pack(m_id)) return false;
|
||||
@@ -54,21 +107,94 @@ public:
|
||||
mpi_ntuple_column_wise(uint32 a_id,std::ostream& a_out,
|
||||
bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
const std::string& a_name,const std::string& a_title,
|
||||
bool a_row_mode,uint32 a_nev,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
|
||||
,m_id(a_id)
|
||||
{}
|
||||
,m_row_mode(a_row_mode)
|
||||
,m_nev(a_nev)
|
||||
{
|
||||
if(m_row_mode) {
|
||||
if(!m_nev) m_nev = 4000; //4000*sizeof(double) = 32000 = default basket size.
|
||||
} else {
|
||||
m_nev = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mpi_ntuple_column_wise(uint32 a_id,std::ostream& a_out,
|
||||
bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
const std::vector<uint32>& a_basket_sizes,const ntuple_booking& a_bkg,bool a_verbose)
|
||||
const std::vector<uint32>& a_basket_sizes,const ntuple_booking& a_bkg,
|
||||
bool a_row_mode,uint32 a_nev,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_basket_sizes,a_bkg,a_verbose)
|
||||
,m_id(a_id)
|
||||
{}
|
||||
,m_row_mode(a_row_mode)
|
||||
,m_nev(a_nev)
|
||||
{
|
||||
if(m_row_mode) {
|
||||
if(!m_nev) m_nev = 4000; //4000*sizeof(double) = 32000 = default basket size.
|
||||
} else {
|
||||
m_nev = 0;
|
||||
}
|
||||
}
|
||||
virtual ~mpi_ntuple_column_wise() {}
|
||||
protected:
|
||||
mpi_ntuple_column_wise(const mpi_ntuple_column_wise& a_from):impi_ntuple(a_from),parent(a_from){}
|
||||
mpi_ntuple_column_wise(const mpi_ntuple_column_wise& a_from)
|
||||
:impi_ntuple(a_from)
|
||||
,parent(a_from)
|
||||
,m_row_mode(a_from.m_row_mode)
|
||||
,m_nev(a_from.m_nev)
|
||||
{}
|
||||
mpi_ntuple_column_wise& operator=(const mpi_ntuple_column_wise& a_from){parent::operator=(a_from);return *this;}
|
||||
protected:
|
||||
static bool ready_to_flush_baskets(std::vector<icol*>& a_cols) {
|
||||
//return true if all parallel branches have at least one basket in their m_parallel_baskets.
|
||||
if(a_cols.empty()) return false;
|
||||
tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
if(_branch.m_parallel_baskets.empty()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool flush_baskets(impi& a_mpi,int a_dest,int a_tag,uint32 a_id,std::vector<icol*>& a_cols) {
|
||||
a_mpi.pack_reset();
|
||||
if(!a_mpi.pack(mpi_protocol_baskets())) return false;
|
||||
if(!a_mpi.pack(a_id)) return false;
|
||||
|
||||
bool status = true;
|
||||
uint32 _icol = 0;
|
||||
tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
basket* _front_basket = _branch.m_parallel_baskets.front();
|
||||
if(status) {
|
||||
if(!mpi_pack_basket(a_mpi,_icol,*_front_basket)) status = false;
|
||||
}
|
||||
_branch.m_parallel_baskets.erase(_branch.m_parallel_baskets.begin());
|
||||
delete _front_basket;
|
||||
_icol++;
|
||||
}
|
||||
if(!status) return false;
|
||||
|
||||
return a_mpi.send_buffer(a_dest,a_tag);
|
||||
}
|
||||
|
||||
static bool flush_remaining_baskets(size_t& a_number,impi& a_mpi,int a_dest,int a_tag,uint32 a_id,std::vector<icol*>& a_cols) {
|
||||
a_number = 0;
|
||||
while(ready_to_flush_baskets(a_cols)) {
|
||||
if(!flush_baskets(a_mpi,a_dest,a_tag,a_id,a_cols)) return false;
|
||||
}
|
||||
// look for pending baskets.
|
||||
{tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
a_number += _branch.m_parallel_baskets.size();
|
||||
}}
|
||||
{tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
safe_clear(_branch.m_parallel_baskets);
|
||||
}}
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
bool end_leaves(impi& a_mpi) const {
|
||||
#include "MPI_SET_MAX.icc"
|
||||
tools_vforcit(icol*,m_cols,pit) {
|
||||
@@ -89,6 +215,8 @@ protected:
|
||||
}
|
||||
protected:
|
||||
uint32 m_id;
|
||||
bool m_row_mode;
|
||||
uint32 m_nev;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -23,7 +23,7 @@ public:
|
||||
if(m_cols.empty()) return false;
|
||||
tools_vforit(icol*,m_cols,it) (*it)->add();
|
||||
mpi_basket_add _badd(a_mpi,a_dest,a_tag,m_id,0);
|
||||
if(!m_row_wise_branch.pfill(_badd)) return false;
|
||||
if(!m_row_wise_branch.pfill(_badd,0)) return false;
|
||||
tools_vforit(icol*,m_cols,it) (*it)->set_def();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
inline uint32 mpi_protocol_basket() {return 1;}
|
||||
inline uint32 mpi_protocol_end_fill() {return 2;}
|
||||
inline uint32 mpi_protocol_baskets() {return 2;}
|
||||
inline uint32 mpi_protocol_end_fill() {return 3;}
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_wroot_mpi_send_basket
|
||||
#define tools_wroot_mpi_send_basket
|
||||
|
||||
#include "mpi_protocol"
|
||||
#include "../impi"
|
||||
#include "basket"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
inline bool mpi_pack_basket(impi& a_mpi,uint32 a_icol,const basket& a_basket) {
|
||||
if(!a_mpi.pack(a_icol)) return false;
|
||||
|
||||
if(!a_mpi.spack(a_basket.object_name())) return false;
|
||||
if(!a_mpi.spack(a_basket.object_title())) return false;
|
||||
|
||||
if(!a_mpi.pack(a_basket.last())) return false;
|
||||
if(!a_mpi.pack(a_basket.nev_buf_size())) return false;
|
||||
if(!a_mpi.pack(a_basket.nev())) return false;
|
||||
|
||||
if(a_basket.entry_offset()) {
|
||||
if(!a_mpi.bpack(true)) return false;
|
||||
if(!a_mpi.pack(a_basket.nev_buf_size(),a_basket.entry_offset())) return false;
|
||||
} else {
|
||||
if(!a_mpi.bpack(false)) return false;
|
||||
}
|
||||
|
||||
if(a_basket.displacement()) {
|
||||
if(!a_mpi.bpack(true)) return false;
|
||||
if(!a_mpi.pack(a_basket.nev_buf_size(),a_basket.displacement())) return false;
|
||||
} else {
|
||||
if(!a_mpi.bpack(false)) return false;
|
||||
}
|
||||
|
||||
if(!a_mpi.pack(a_basket.datbuf().length(),a_basket.datbuf().buf())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool mpi_send_basket(impi& a_mpi,int a_dest,int a_tag,uint32 a_id,uint32 a_icol,const basket& a_basket) {
|
||||
a_mpi.pack_reset();
|
||||
if(!a_mpi.pack(mpi_protocol_basket())) return false;
|
||||
if(!a_mpi.pack(a_id)) return false;
|
||||
if(!mpi_pack_basket(a_mpi,a_icol,a_basket)) return false;
|
||||
return a_mpi.send_buffer(a_dest,a_tag);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_wroot_mt_basket_add
|
||||
#define tools_wroot_mt_basket_add
|
||||
|
||||
// used in pntuple.
|
||||
|
||||
#include "branch"
|
||||
|
||||
namespace tools {
|
||||
namespace wroot {
|
||||
|
||||
class mt_basket_add : public virtual branch::iadd_basket {
|
||||
typedef branch::iadd_basket parent;
|
||||
public:
|
||||
virtual bool add_basket(basket* a_basket) { //we take ownership of a_basket.
|
||||
m_mutex.lock();
|
||||
uint32 add_bytes,nout;
|
||||
if(!m_main_branch.add_basket(m_main_file,*a_basket,add_bytes,nout)) {
|
||||
m_mutex.unlock();
|
||||
delete a_basket;
|
||||
return false;
|
||||
}
|
||||
m_main_branch.set_tot_bytes(m_main_branch.tot_bytes()+add_bytes);
|
||||
m_main_branch.set_zip_bytes(m_main_branch.zip_bytes()+nout);
|
||||
m_mutex.unlock();
|
||||
delete a_basket;
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
mt_basket_add(imutex& a_mutex,ifile& a_main_file,branch& a_main_branch)
|
||||
:m_mutex(a_mutex),m_main_file(a_main_file),m_main_branch(a_main_branch)
|
||||
{}
|
||||
protected:
|
||||
mt_basket_add(const mt_basket_add& a_from):parent()
|
||||
,m_mutex(a_from.m_mutex),m_main_file(a_from.m_main_file),m_main_branch(a_from.m_main_branch)
|
||||
{}
|
||||
mt_basket_add& operator=(const mt_basket_add&){return *this;}
|
||||
protected:
|
||||
imutex& m_mutex;
|
||||
ifile& m_main_file;
|
||||
branch& m_main_branch;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -7,7 +7,7 @@
|
||||
// mt = multi-threads.
|
||||
|
||||
#include "base_pntuple_column_wise"
|
||||
#include "basket_add"
|
||||
#include "mt_basket_add"
|
||||
#include "imt_ntuple"
|
||||
|
||||
namespace tools {
|
||||
@@ -15,70 +15,220 @@ namespace wroot {
|
||||
|
||||
class mt_ntuple_column_wise : public base_pntuple_column_wise, public virtual imt_ntuple {
|
||||
typedef base_pntuple_column_wise parent;
|
||||
protected:
|
||||
class basket_add : public mt_basket_add {
|
||||
typedef mt_basket_add parent;
|
||||
public:
|
||||
virtual bool add_basket(basket* a_basket) { // we get ownership of a_basket.
|
||||
if(m_row_mode) {
|
||||
//m_ntuple.m_out << "debug : add_basket in parallel branch name " << m_parallel_branch.name()
|
||||
// << ", num existing baskets " << m_parallel_branch.m_parallel_baskets.size() << "." << std::endl;
|
||||
m_parallel_branch.m_parallel_baskets.push_back(a_basket);
|
||||
if(ready_to_flush_baskets(m_cols)) {return flush_baskets(m_mutex,m_main_file,m_cols,m_main_branches);}
|
||||
return true;
|
||||
} else {
|
||||
m_mutex.lock();
|
||||
uint32 add_bytes,nout;
|
||||
bool status = false;
|
||||
if(m_main_branch.add_basket(m_main_file,*a_basket,add_bytes,nout)) {
|
||||
m_main_branch.set_tot_bytes(m_main_branch.tot_bytes()+add_bytes);
|
||||
m_main_branch.set_zip_bytes(m_main_branch.zip_bytes()+nout);
|
||||
status = true;
|
||||
}
|
||||
m_mutex.unlock();
|
||||
delete a_basket;
|
||||
return status;
|
||||
}
|
||||
}
|
||||
public:
|
||||
basket_add(imutex& a_mutex,ifile& a_main_file,
|
||||
branch& a_main_branch,branch& a_parallel_branch,
|
||||
std::vector<icol*>& a_cols,
|
||||
std::vector<branch*>& a_main_branches,
|
||||
bool a_row_mode)
|
||||
:parent(a_mutex,a_main_file,a_main_branch)
|
||||
,m_parallel_branch(a_parallel_branch)
|
||||
,m_cols(a_cols)
|
||||
,m_main_branches(a_main_branches)
|
||||
,m_row_mode(a_row_mode)
|
||||
{}
|
||||
protected:
|
||||
basket_add(const basket_add& a_from)
|
||||
:branch::iadd_basket(a_from)
|
||||
,parent(a_from)
|
||||
,m_parallel_branch(a_from.m_parallel_branch)
|
||||
,m_cols(a_from.m_cols)
|
||||
,m_main_branches(a_from.m_main_branches)
|
||||
,m_row_mode(a_from.m_row_mode)
|
||||
{}
|
||||
basket_add& operator=(const basket_add&){return *this;}
|
||||
protected:
|
||||
branch& m_parallel_branch;
|
||||
std::vector<icol*>& m_cols;
|
||||
std::vector<branch*>& m_main_branches;
|
||||
bool m_row_mode;
|
||||
};
|
||||
public:
|
||||
virtual bool add_row(imutex& a_mutex,ifile& a_main_file) {
|
||||
if(m_cols.empty()) return false;
|
||||
{tools_vforit(icol*,m_cols,it) (*it)->add();}
|
||||
if(m_main_branches.size()!=m_cols.size()) {
|
||||
m_file.out() << "tools::wroot::mt_ntuple_column_wise::add_row :"
|
||||
<< " m_main_branches.size() (" << m_main_branches.size() << ") != "
|
||||
<< "m_cols.size() (" << m_cols.size() << ")."
|
||||
<< std::endl;
|
||||
m_out << "tools::wroot::mt_ntuple_column_wise::add_row :"
|
||||
<< " m_main_branches.size() (" << m_main_branches.size() << ") != "
|
||||
<< "m_cols.size() (" << m_cols.size() << ")."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
{basket_add _badd(a_mutex,a_main_file);
|
||||
std::vector<branch*>::const_iterator itb = m_main_branches.begin();
|
||||
{std::vector<branch*>::const_iterator itb = m_main_branches.begin();
|
||||
tools_vforit(icol*,m_cols,it) {
|
||||
branch* main_branch = (*itb);itb++;
|
||||
_badd.set_main_branch(main_branch);
|
||||
if(!(*it)->get_branch().pfill(_badd)) return false;
|
||||
basket_add _badd(a_mutex,a_main_file,*main_branch,(*it)->get_branch(),m_cols,m_main_branches,m_row_mode);
|
||||
if(!(*it)->get_branch().pfill(_badd,m_nev)) return false;
|
||||
}}
|
||||
{tools_vforit(icol*,m_cols,it) (*it)->set_def();}
|
||||
return true;
|
||||
}
|
||||
virtual bool end_fill(imutex& a_mutex,ifile& a_main_file) {
|
||||
if(m_main_branches.size()!=m_cols.size()) {
|
||||
m_file.out() << "tools::wroot::mt_ntuple_column_wise::end_fill :"
|
||||
<< " m_main_branches.size() (" << m_main_branches.size() << ") != "
|
||||
<< "m_cols.size() (" << m_cols.size() << ")."
|
||||
<< std::endl;
|
||||
m_out << "tools::wroot::mt_ntuple_column_wise::end_fill :"
|
||||
<< " m_main_branches.size() (" << m_main_branches.size() << ") != "
|
||||
<< "m_cols.size() (" << m_cols.size() << ")."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
basket_add _badd(a_mutex,a_main_file);
|
||||
std::vector<branch*>::const_iterator itb = m_main_branches.begin();
|
||||
tools_vforit(icol*,m_cols,it) {
|
||||
branch* main_branch = (*itb);itb++;
|
||||
_badd.set_main_branch(main_branch);
|
||||
basket_add _badd(a_mutex,a_main_file,*main_branch,(*it)->get_branch(),m_cols,m_main_branches,m_row_mode);
|
||||
if(!(*it)->get_branch().end_pfill(_badd)) return false;
|
||||
}
|
||||
if(m_row_mode) {
|
||||
size_t number;
|
||||
bool status = flush_remaining_baskets(number,a_mutex,a_main_file,m_cols,m_main_branches);
|
||||
if(number) {
|
||||
m_out << "tools::wroot::mt_ntuple_column_wise::end_fill : it remained " << number << " baskets not written on file." << std::endl;
|
||||
status = false;
|
||||
}
|
||||
if(!status) return false;
|
||||
}
|
||||
return end_leaves(a_mutex);
|
||||
}
|
||||
public:
|
||||
mt_ntuple_column_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
std::vector<branch*>& a_main_branches,
|
||||
const std::string& a_name,const std::string& a_title,
|
||||
bool a_row_mode,uint32 a_nev,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_name,a_title,a_verbose)
|
||||
,m_main_branches(a_main_branches)
|
||||
{}
|
||||
,m_row_mode(a_row_mode)
|
||||
,m_nev(a_nev)
|
||||
{
|
||||
if(m_row_mode) {
|
||||
if(!m_nev) m_nev = 4000; //4000*sizeof(double) = 32000 = default basket size.
|
||||
} else {
|
||||
m_nev = 0;
|
||||
}
|
||||
}
|
||||
|
||||
mt_ntuple_column_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
std::vector<branch*>& a_main_branches,
|
||||
const std::vector<uint32>& a_basket_sizes,
|
||||
const ntuple_booking& a_bkg,bool a_verbose)
|
||||
std::vector<branch*>& a_main_branches,
|
||||
const std::vector<uint32>& a_basket_sizes,
|
||||
const ntuple_booking& a_bkg,
|
||||
bool a_row_mode,uint32 a_nev,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_basket_sizes,a_bkg,a_verbose)
|
||||
,m_main_branches(a_main_branches)
|
||||
{}
|
||||
,m_row_mode(a_row_mode)
|
||||
,m_nev(a_nev)
|
||||
{
|
||||
if(m_row_mode) {
|
||||
if(!m_nev) m_nev = 4000;
|
||||
} else {
|
||||
m_nev = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef tools_wroot_mt_ntuple_column_wise //g4tools backcomp :
|
||||
mt_ntuple_column_wise(std::ostream& a_out,bool a_byte_swap,uint32 a_compression,seek a_seek_directory,
|
||||
std::vector<branch*>& a_main_branches,
|
||||
const std::vector<uint32>& a_basket_sizes,
|
||||
const ntuple_booking& a_bkg,
|
||||
bool a_verbose)
|
||||
:parent(a_out,a_byte_swap,a_compression,a_seek_directory,a_basket_sizes,a_bkg,a_verbose)
|
||||
,m_main_branches(a_main_branches)
|
||||
,m_row_mode(false)
|
||||
,m_nev(0)
|
||||
{
|
||||
if(m_row_mode) {
|
||||
if(!m_nev) m_nev = 4000;
|
||||
} else {
|
||||
m_nev = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual ~mt_ntuple_column_wise() {}
|
||||
protected:
|
||||
mt_ntuple_column_wise(const mt_ntuple_column_wise& a_from)
|
||||
:imt_ntuple(a_from)
|
||||
,parent(a_from)
|
||||
,m_main_branches(a_from.m_main_branches)
|
||||
,m_row_mode(a_from.m_row_mode)
|
||||
,m_nev(a_from.m_nev)
|
||||
{}
|
||||
mt_ntuple_column_wise& operator=(const mt_ntuple_column_wise& a_from){parent::operator=(a_from);return *this;}
|
||||
protected:
|
||||
static bool ready_to_flush_baskets(std::vector<icol*>& a_cols) {
|
||||
//return true if all parallel branches have at least one basket in their m_parallel_baskets.
|
||||
if(a_cols.empty()) return false;
|
||||
tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
if(_branch.m_parallel_baskets.empty()) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
static bool flush_baskets(imutex& a_mutex,ifile& a_main_file,std::vector<icol*>& a_cols,std::vector<branch*>& a_main_branches) {
|
||||
a_mutex.lock();
|
||||
bool status = true;
|
||||
std::vector<branch*>::const_iterator itb = a_main_branches.begin();
|
||||
tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
basket* _front_basket = _branch.m_parallel_baskets.front();
|
||||
branch* main_branch = (*itb);itb++;
|
||||
if(status) {
|
||||
uint32 add_bytes,nout;
|
||||
if(main_branch->add_basket(a_main_file,*_front_basket,add_bytes,nout)) {
|
||||
main_branch->set_tot_bytes(main_branch->tot_bytes()+add_bytes);
|
||||
main_branch->set_zip_bytes(main_branch->zip_bytes()+nout);
|
||||
} else {
|
||||
status = false;
|
||||
}
|
||||
}
|
||||
_branch.m_parallel_baskets.erase(_branch.m_parallel_baskets.begin());
|
||||
delete _front_basket;
|
||||
}
|
||||
a_mutex.unlock();
|
||||
return status;
|
||||
}
|
||||
|
||||
static bool flush_remaining_baskets(size_t& a_number,imutex& a_mutex,ifile& a_main_file,std::vector<icol*>& a_cols,std::vector<branch*>& a_main_branches) {
|
||||
a_number = 0;
|
||||
while(ready_to_flush_baskets(a_cols)) {
|
||||
if(!flush_baskets(a_mutex,a_main_file,a_cols,a_main_branches)) return false;
|
||||
}
|
||||
// look for pending baskets.
|
||||
{tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
a_number += _branch.m_parallel_baskets.size();
|
||||
}}
|
||||
{tools_vforit(icol*,a_cols,it) {
|
||||
branch& _branch = (*it)->get_branch();
|
||||
safe_clear(_branch.m_parallel_baskets);
|
||||
}}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool end_leaves(imutex& a_mutex) const {
|
||||
|
||||
#include "MT_SET_MAX.icc"
|
||||
@@ -86,8 +236,8 @@ protected:
|
||||
std::vector<icol*>::const_iterator pit = m_cols.begin();
|
||||
tools_vforcit(branch*,m_main_branches,mit) {
|
||||
if((*mit)->leaves().empty()) {
|
||||
m_file.out() << "tools::wroot::mt_ntuple_column_wise::end_leaves :"
|
||||
<< " branch " << (*mit)->name() << " without leaf." << std::endl;
|
||||
m_out << "tools::wroot::mt_ntuple_column_wise::end_leaves :"
|
||||
<< " branch " << (*mit)->name() << " without leaf." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -103,6 +253,8 @@ protected:
|
||||
}
|
||||
protected:
|
||||
std::vector<branch*>& m_main_branches;
|
||||
bool m_row_mode;
|
||||
uint32 m_nev;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
// pntuple = for parallel ntupling.
|
||||
|
||||
#include "base_pntuple_row_wise"
|
||||
#include "basket_add"
|
||||
#include "mt_basket_add"
|
||||
#include "imt_ntuple"
|
||||
|
||||
namespace tools {
|
||||
@@ -19,15 +19,13 @@ public:
|
||||
virtual bool add_row(imutex& a_mutex,ifile& a_main_file) {
|
||||
if(m_cols.empty()) return false;
|
||||
tools_vforit(icol*,m_cols,it) (*it)->add();
|
||||
basket_add _badd(a_mutex,a_main_file);
|
||||
_badd.set_main_branch(&m_main_branch);
|
||||
if(!m_row_wise_branch.pfill(_badd)) return false;
|
||||
mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
|
||||
if(!m_row_wise_branch.pfill(_badd,0)) return false;
|
||||
tools_vforit(icol*,m_cols,it) (*it)->set_def();
|
||||
return true;
|
||||
}
|
||||
virtual bool end_fill(imutex& a_mutex,ifile& a_main_file) {
|
||||
basket_add _badd(a_mutex,a_main_file);
|
||||
_badd.set_main_branch(&m_main_branch);
|
||||
mt_basket_add _badd(a_mutex,a_main_file,m_main_branch);
|
||||
if(!m_row_wise_branch.end_pfill(_badd)) return false;
|
||||
return end_leaves(a_mutex);
|
||||
}
|
||||
|
||||
@@ -374,7 +374,7 @@ public:
|
||||
bool mpi_add_basket(impi& a_impi) {
|
||||
uint32 icol; //not used if row_wise.
|
||||
if(!a_impi.unpack(icol)) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : unpack(icol) failed."<< std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : unpack(icol) failed."<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -385,13 +385,14 @@ public:
|
||||
m_dir.file().byte_swap(),m_dir.seek_directory(),
|
||||
m_row_wise_branch->basket_size());
|
||||
if(!basket) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : mpi_create_basket() failed."<< std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : mpi_create_basket() failed."<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 add_bytes,nout;
|
||||
if(!m_row_wise_branch->add_basket(m_dir.file(),*basket,add_bytes,nout)) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : row wise : branch.add_basket() failed."<< std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : row wise : branch.add_basket() failed."<< std::endl;
|
||||
delete basket;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -401,7 +402,7 @@ public:
|
||||
|
||||
} else {
|
||||
if(icol>=m_cols.size()) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : column index " << icol << " >= " << m_cols.size() << std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : column index " << icol << " >= " << m_cols.size() << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -411,13 +412,14 @@ public:
|
||||
m_dir.file().byte_swap(),m_dir.seek_directory(),
|
||||
_branch.basket_size());
|
||||
if(!basket) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : mpi_create_basket() failed."<< std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : mpi_create_basket() failed."<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 add_bytes,nout;
|
||||
if(!_branch.add_basket(m_dir.file(),*basket,add_bytes,nout)) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baset : column wise : branch.add_basket() failed."<< std::endl;
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : column wise : branch.add_basket() failed."<< std::endl;
|
||||
delete basket;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -428,6 +430,43 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mpi_add_baskets(impi& a_impi) { //column_wise && row_mode only.
|
||||
uint32 _icol = 0;
|
||||
tools_vforcit(icol*,m_cols,it) {
|
||||
uint32 icol;
|
||||
if(!a_impi.unpack(icol)) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_baskets : unpack(icol) failed."<< std::endl;
|
||||
return false;
|
||||
}
|
||||
if(icol!=_icol) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : received column index " << icol << ", whilst " << _icol << " expected." << std::endl;
|
||||
return false;
|
||||
}
|
||||
branch& _branch = m_cols[icol]->get_branch();
|
||||
basket* basket = mpi_create_basket(m_out,a_impi,
|
||||
m_dir.file().byte_swap(),m_dir.seek_directory(),
|
||||
_branch.basket_size());
|
||||
if(!basket) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : mpi_create_basket() failed."<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 add_bytes,nout;
|
||||
if(!_branch.add_basket(m_dir.file(),*basket,add_bytes,nout)) {
|
||||
m_out << "tools::wroot::ntuple::mpi_add_basket : column wise : branch.add_basket() failed."<< std::endl;
|
||||
delete basket;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete basket;
|
||||
_branch.set_tot_bytes(_branch.tot_bytes()+add_bytes);
|
||||
_branch.set_zip_bytes(_branch.zip_bytes()+nout);
|
||||
|
||||
_icol++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mpi_end_fill(impi& a_impi) {
|
||||
|
||||
#define TOOLS_WROOT_NTUPLE_SET_LEAF_LENGTH_MAX(a__type) \
|
||||
|
||||
Reference in New Issue
Block a user