Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/rroot/branch_element

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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 ]

Diff markup

Differences between /externals/g4tools/include/tools/rroot/branch_element (Version 11.3.0) and /externals/g4tools/include/tools/rroot/branch_element (Version 11.0.p2)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_rroot_branch_element                  4 #ifndef tools_rroot_branch_element
  5 #define tools_rroot_branch_element                  5 #define tools_rroot_branch_element
  6                                                     6 
  7 #include "branch"                                   7 #include "branch"
  8 #include "stl_vector"                               8 #include "stl_vector"
  9                                                     9 
 10 #include "info"                                    10 #include "info"
 11 #include "obj_list"                                11 #include "obj_list"
 12                                                    12 
 13 //#define TOOLS_RROOT_BRANCH_ELEMENT_DUMP          13 //#define TOOLS_RROOT_BRANCH_ELEMENT_DUMP
 14                                                    14 
 15 namespace tools {                                  15 namespace tools {
 16 namespace rroot {                                  16 namespace rroot {
 17                                                    17 
 18 class branch_element : public branch {             18 class branch_element : public branch {
 19   typedef branch parent;                           19   typedef branch parent;
 20 public:                                            20 public:
 21   static const std::string& s_class() {            21   static const std::string& s_class() {
 22     static const std::string s_v("tools::rroot     22     static const std::string s_v("tools::rroot::branch_element");
 23     return s_v;                                    23     return s_v;
 24   }                                                24   }
 25 public: //iro                                      25 public: //iro
 26   virtual void* cast(const std::string& a_clas     26   virtual void* cast(const std::string& a_class) const {
 27     if(void* p = cmp_cast<branch_element>(this     27     if(void* p = cmp_cast<branch_element>(this,a_class)) return p;
 28     return parent::cast(a_class);                  28     return parent::cast(a_class);
 29   }                                                29   }
 30   virtual const std::string& s_cls() const {re     30   virtual const std::string& s_cls() const {return s_class();}
 31 public:                                            31 public:
 32   static cid id_class() {return branch_element     32   static cid id_class() {return branch_element_cid();}
 33   virtual void* cast(cid a_class) const {          33   virtual void* cast(cid a_class) const {
 34     if(void* p = cmp_cast<branch_element>(this     34     if(void* p = cmp_cast<branch_element>(this,a_class)) {return p;}
 35     return parent::cast(a_class);                  35     return parent::cast(a_class);
 36   }                                                36   }
 37 public:                                            37 public:
 38   virtual bool stream(buffer& a_buffer) {          38   virtual bool stream(buffer& a_buffer) {
 39     _clear();                                      39     _clear();
 40                                                    40 
 41     short v;                                       41     short v;
 42     unsigned int _s,_c;                        <<  42     unsigned int s, c;
 43     if(!a_buffer.read_version(v,_s,_c)) return <<  43     if(!a_buffer.read_version(v,s,c)) return false;
 44                                                    44 
 45     //::printf("debug : tools::branch_element: <<  45     //::printf("debug : inlib::branch_element::stream : version %d, count %d\n",v,c);
 46                                                    46 
 47     if(!parent::stream(a_buffer)) {                47     if(!parent::stream(a_buffer)) {
 48       m_out << "tools::rroot::branch_element::     48       m_out << "tools::rroot::branch_element::stream : parent::stream() failed." << std::endl;
 49       return false;                                49       return false;
 50     }                                              50     }
 51                                                    51 
 52     if(v<=7) {                                     52     if(v<=7) {
 53       if(!a_buffer.read(fClassName)) return fa     53       if(!a_buffer.read(fClassName)) return false;
 54       if(!a_buffer.read(fClassVersion)) return     54       if(!a_buffer.read(fClassVersion)) return false;
 55       if(!a_buffer.read(fID)) return false;        55       if(!a_buffer.read(fID)) return false;
 56       if(!a_buffer.read(fType)) return false;      56       if(!a_buffer.read(fType)) return false;
 57       if(!a_buffer.read(fStreamerType)) return     57       if(!a_buffer.read(fStreamerType)) return false;
 58     } else { //v>=8                                58     } else { //v>=8
 59       if(!a_buffer.read(fClassName)) return fa     59       if(!a_buffer.read(fClassName)) return false;
 60       //::printf("debug : tools::branch_elemen <<  60       //::printf("debug : inlib::branch_element::stream : fClassName \"%s\"\n",fClassName.c_str());
 61       std::string fParentName;                     61       std::string fParentName;
 62       if(!a_buffer.read(fParentName)) return f     62       if(!a_buffer.read(fParentName)) return false;
 63       //::printf("debug : tools::branch_elemen <<  63       //::printf("debug : inlib::branch_element::stream : fParentName \"%s\"\n",fParentName.c_str());
 64       std::string fCloneName;                      64       std::string fCloneName;
 65       if(!a_buffer.read(fCloneName)) return fa     65       if(!a_buffer.read(fCloneName)) return false;
 66       //::printf("debug : tools::branch_elemen <<  66       //::printf("debug : inlib::branch_element::stream : fCloneName \"%s\"\n",fCloneName.c_str());
 67       int dummy_int;                               67       int dummy_int;
 68       if(!a_buffer.read(dummy_int)) return fal     68       if(!a_buffer.read(dummy_int)) return false; //fCheckSum
 69       //::printf("debug : tools::branch_elemen <<  69       //::printf("debug : inlib::branch_element::stream : fCheckSum %d\n",dummy_int);
 70                                                    70 
 71       if(v>=10) {                                  71       if(v>=10) {
 72         short dummy_short;                         72         short dummy_short;
 73         if(!a_buffer.read(dummy_short)) return     73         if(!a_buffer.read(dummy_short)) return false; //fClassVersion
 74         //::printf("debug : tools::branch_elem <<  74         //::printf("debug : inlib::branch_element::stream : fClassVersion %d\n",dummy_short);
 75       } else {                                     75       } else {
 76         if(!a_buffer.read(dummy_int)) return f     76         if(!a_buffer.read(dummy_int)) return false; //fClassVersion
 77       }                                            77       }
 78                                                    78 
 79       if(!a_buffer.read(fID)) return false;        79       if(!a_buffer.read(fID)) return false;
 80       //::printf("debug : tools::branch_elemen <<  80       //::printf("debug : inlib::branch_element::stream : fID %d\n",fID);
 81       if(!a_buffer.read(fType)) return false;      81       if(!a_buffer.read(fType)) return false;
 82       //::printf("debug : tools::branch_elemen <<  82       //::printf("debug : inlib::branch_element::stream : fType %d\n",fType);
 83       if(!a_buffer.read(fStreamerType)) return     83       if(!a_buffer.read(fStreamerType)) return false;
 84       //::printf("debug : tools::branch_elemen <<  84       //::printf("debug : inlib::branch_element::stream : fStreamerType %d\n",fStreamerType);
 85                                                    85 
 86       if(!a_buffer.read(dummy_int)) return fal     86       if(!a_buffer.read(dummy_int)) return false; //fMaximum
 87       //::printf("debug : tools::branch_elemen <<  87       //::printf("debug : inlib::branch_element::stream : fMaximum %d\n",dummy_int);
 88                                                    88 
 89       //TBranchElement* fBranchCount;              89       //TBranchElement* fBranchCount;
 90       ifac::args args;                             90       ifac::args args;
 91       if(!pointer_stream(a_buffer,m_fac,args,f     91       if(!pointer_stream(a_buffer,m_fac,args,fBranchCount,fBranchCount_created)) {
 92         m_out << "tools::rroot::branch_element     92         m_out << "tools::rroot::branch_element::stream : "
 93               << "can't read fBranchCount."        93               << "can't read fBranchCount."
 94               << std::endl;                        94               << std::endl;
 95         return false;                              95         return false;
 96       }                                            96       }
 97                                                    97 
 98       //TBranchElement* fBranchCount2;             98       //TBranchElement* fBranchCount2;
 99       if(!pointer_stream(a_buffer,m_fac,args,f     99       if(!pointer_stream(a_buffer,m_fac,args,fBranchCount2,fBranchCount2_created)) {
100         m_out << "tools::rroot::branch_element    100         m_out << "tools::rroot::branch_element::stream : "
101               << "can't read fBranchCount2."      101               << "can't read fBranchCount2."
102               << std::endl;                       102               << std::endl;
103         _clear();                                 103         _clear();
104         return false;                             104         return false;
105       }                                           105       }
106                                                   106 
107     }                                             107     }
108                                                   108 
109     if(!a_buffer.check_byte_count(_s,_c,"TBran << 109     if(!a_buffer.check_byte_count(s,c,"TBranchElement")) {_clear();return false;}
110     return true;                                  110     return true;
111   }                                               111   }
112 public: //branch                                  112 public: //branch
113                                                   113 
114   virtual bool read_leaves(ifile& a_file,buffe    114   virtual bool read_leaves(ifile& a_file,buffer& a_buffer){
115                                                   115 
116     // For k<type> value, see the below commen    116     // For k<type> value, see the below commented enum EReadWrite from ROOT-6.12.06 code.
117     static int kInt      = 3;                     117     static int kInt      = 3;
118     static int kDouble   = 8;                     118     static int kDouble   = 8;
119     static int kDouble32 = 9;                     119     static int kDouble32 = 9;
120     static int kUInt     = 13;                    120     static int kUInt     = 13;
121     static int kBits     = 15;  // In v4-00-01    121     static int kBits     = 15;  // In v4-00-01 version 8, it is Long64_t.
122     static int kObject   = 61;                    122     static int kObject   = 61;
123     static int kObjectP  = 64;                    123     static int kObjectP  = 64;
124                                                   124 
125     if(fType==3) { // TClonesArray master bran    125     if(fType==3) { // TClonesArray master branch (has only the number of elements).
126       //from v4-00-01                             126       //from v4-00-01
127       int n;                                      127       int n;
128       if(!a_buffer.read(n)) return false;         128       if(!a_buffer.read(n)) return false;
129       /* ROOT-6.12.06 code :                      129       /* ROOT-6.12.06 code :
130       if ((n < 0) || (n > fMaximum)) {            130       if ((n < 0) || (n > fMaximum)) {
131          if (IsMissingCollection()) {             131          if (IsMissingCollection()) {
132             n = 0;                                132             n = 0;
133             b.SetBufferOffset(b.Length() - siz    133             b.SetBufferOffset(b.Length() - sizeof(n));
134          } else {                                 134          } else {
135             Error("ReadLeaves", "Incorrect siz    135             Error("ReadLeaves", "Incorrect size read for the container in %s\nThe size read is %d when the maximum is %d\nThe size is reset to 0 for this entry (%lld)", GetName(), n, fMaximum, GetReadEntry());
136             n = 0;                                136             n = 0;
137          }                                        137          }
138       }*/                                         138       }*/
139       //::printf("debug : uuuu : ndata %d\n",n    139       //::printf("debug : uuuu : ndata %d\n",n);
140       fNdata = n;                                 140       fNdata = n;
141                                                   141 
142       //TClonesArray *clones = (TClonesArray*)    142       //TClonesArray *clones = (TClonesArray*)fObject;
143       //if (!clones) return;                      143       //if (!clones) return;
144       //if (clones->IsZombie()) return;           144       //if (clones->IsZombie()) return;
145       //clones->Clear();                          145       //clones->Clear();
146       //clones->ExpandCreateFast(fNdata);         146       //clones->ExpandCreateFast(fNdata);
147                                                   147 
148       //m_out << "debug : tools::rroot::branch    148       //m_out << "debug : tools::rroot::branch_element::read_leaves :"
149       //      << " name " << m_name << " ref_c    149       //      << " name " << m_name << " ref_cls " << fClassName
150       //      << " : type " << fType << ", fNd    150       //      << " : type " << fType << ", fNdata " << n
151       //      << std::endl;                       151       //      << std::endl;
152       return true;                                152       return true;
153                                                   153 
154     } else if(fType==31) { // TClonesArray sub    154     } else if(fType==31) { // TClonesArray sub-branch (contains the elements).
155       if(fStreamerType==kObject) { //to read E    155       if(fStreamerType==kObject) { //to read EsbRoot fgd_dig.root.
156         int ndata = fBranchCount->get_ndata();    156         int ndata = fBranchCount->get_ndata();
157 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            157 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
158         ::printf("debug : %s : fClassName %s :    158         ::printf("debug : %s : fClassName %s : fID %d : kObject : ndata %d\n",m_name.c_str(),fClassName.c_str(),fID,ndata);
159 #endif                                            159 #endif
160         streamer_info* _info = a_file.find_str    160         streamer_info* _info = a_file.find_streamer_info(fClassName);
161         if(!_info) {                              161         if(!_info) {
162           m_out << "tools::rroot::branch_eleme    162           m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
163                 << " read(kObject) : streamer_    163                 << " read(kObject) : streamer_infos for ref_cls " << fClassName << " not found."
164                 << std::endl;                     164                 << std::endl;
165           return false;                           165           return false;
166         }                                         166         }
167         streamer_element* _element = _info->fi    167         streamer_element* _element = _info->find_streamer_element(fID);
168         if(!_element) {                           168         if(!_element) {
169           m_out << "tools::rroot::branch_eleme    169           m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
170                 << " read(kObject) : for ref_c    170                 << " read(kObject) : for ref_cls " << fClassName << ", fID " << fID << " streamer element not found."
171                 << std::endl;                     171                 << std::endl;
172           return false;                           172           return false;
173         }                                         173         }
174         //::printf("debug : element type name     174         //::printf("debug : element type name %s\n",_element->type_name().c_str());
175                                                   175 
176         obj_list* _list = 0;                      176         obj_list* _list = 0;
177         if(!m_obj) {                              177         if(!m_obj) {
178           _list = new obj_list(m_fac);            178           _list = new obj_list(m_fac);
179           m_obj = _list;                          179           m_obj = _list;
180         } else {                                  180         } else {
181           _list = id_cast<iro,obj_list>(*m_obj    181           _list = id_cast<iro,obj_list>(*m_obj);
182           if(!_list) {                            182           if(!_list) {
183             m_out << "tools::rroot::branch_ele    183             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
184                   << " read(kObject) : m_obj i    184                   << " read(kObject) : m_obj is not an obj_list."
185                   << std::endl;                   185                   << std::endl;
186             return false;                         186             return false;
187           }                                       187           }
188         }                                         188         }
189                                                   189 
190         _list->safe_clear();                      190         _list->safe_clear();
191                                                   191 
192         for(int index=0;index<ndata;index++) {    192         for(int index=0;index<ndata;index++) {
193           ifac::args args;                        193           ifac::args args;
194           iro* _obj = m_fac.create(_element->t    194           iro* _obj = m_fac.create(_element->type_name(),args);
195           if(!_obj) {_list->safe_clear();retur    195           if(!_obj) {_list->safe_clear();return false;}
196           if(!_obj->stream(a_buffer)){            196           if(!_obj->stream(a_buffer)){
197             m_out << "tools::rroot::branch_ele    197             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
198                   << " kObject : obj stream of    198                   << " kObject : obj stream of class " << sout(_element->type_name())
199                   << " failed at index " << in    199                   << " failed at index " << index << " (" << ndata << ")." << std::endl;
200             _list->safe_clear();                  200             _list->safe_clear();
201             return false;                         201             return false;
202           }                                       202           }
203           _list->add_object(_obj); //give owne    203           _list->add_object(_obj); //give ownership.
204         }                                         204         }
205                                                   205 
206         return true;                              206         return true;
207       }                                           207       }
208       if(fStreamerType==kObjectP) return true;    208       if(fStreamerType==kObjectP) return true;
209       //from v4-00-01                             209       //from v4-00-01
210       if(fStreamerType==kDouble32) {              210       if(fStreamerType==kDouble32) {
211         int ndata = fBranchCount->get_ndata();    211         int ndata = fBranchCount->get_ndata();
212 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            212 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
213         ::printf("debug : %s : fID %d : double    213         ::printf("debug : %s : fID %d : double32 : ndata %d\n",m_name.c_str(),fID,ndata);
214 #endif                                            214 #endif
215         stl_vector<double>* vec = 0;              215         stl_vector<double>* vec = 0;
216         if(!m_obj) {                              216         if(!m_obj) {
217           vec = new stl_vector<double>;           217           vec = new stl_vector<double>;
218           m_obj = vec;                            218           m_obj = vec;
219         } else {                                  219         } else {
220           vec = id_cast<iro, stl_vector<double    220           vec = id_cast<iro, stl_vector<double> >(*m_obj);
221           if(!vec) {                              221           if(!vec) {
222             m_out << "tools::rroot::branch_ele    222             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
223                   << " read(kDouble32) : m_obj    223                   << " read(kDouble32) : m_obj is not a stl_vector<double>."
224                   << std::endl;                   224                   << std::endl;
225             return false;                         225             return false;
226           }                                       226           }
227         }                                         227         }
228                                                   228 
229         vec->resize(ndata);                       229         vec->resize(ndata);
230         float afloat;                             230         float afloat;
231         for(int ii=0;ii<ndata;ii++) {             231         for(int ii=0;ii<ndata;ii++) {
232           if(!a_buffer.read(afloat)) {            232           if(!a_buffer.read(afloat)) {
233             m_out << "tools::rroot::branch_ele    233             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
234                   << " read(float) failed."       234                   << " read(float) failed."
235                   << std::endl;                   235                   << std::endl;
236             vec->clear();                         236             vec->clear();
237             return false;                         237             return false;
238           }                                       238           }
239           //::printf("debug : zzzz %g\n",afloa    239           //::printf("debug : zzzz %g\n",afloat);
240           (*vec)[ii] = afloat;                    240           (*vec)[ii] = afloat;
241         }                                         241         }
242                                                   242 
243         return true;                              243         return true;
244                                                   244 
245       } else if(fStreamerType==kDouble) {         245       } else if(fStreamerType==kDouble) {
246         int ndata = fBranchCount->get_ndata();    246         int ndata = fBranchCount->get_ndata();
247 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            247 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
248         ::printf("debug : %s : fID %d : double    248         ::printf("debug : %s : fID %d : double : ndata %d\n",m_name.c_str(),fID,ndata);
249 #endif                                            249 #endif
250         stl_vector<double>* vec = 0;              250         stl_vector<double>* vec = 0;
251         if(!m_obj) {                              251         if(!m_obj) {
252           vec = new stl_vector<double>;           252           vec = new stl_vector<double>;
253           m_obj = vec;                            253           m_obj = vec;
254         } else {                                  254         } else {
255           vec = id_cast<iro, stl_vector<double    255           vec = id_cast<iro, stl_vector<double> >(*m_obj);
256           if(!vec) {                              256           if(!vec) {
257             m_out << "tools::rroot::branch_ele    257             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
258                   << " read(kDouble) : m_obj i    258                   << " read(kDouble) : m_obj is not a stl_vector<double>."
259                   << std::endl;                   259                   << std::endl;
260             return false;                         260             return false;
261           }                                       261           }
262         }                                         262         }
263                                                   263 
264         vec->resize(ndata);                       264         vec->resize(ndata);
265         double* _value = vec_data(*vec);          265         double* _value = vec_data(*vec);
266         if(!a_buffer.read_fast_array(_value,nd    266         if(!a_buffer.read_fast_array(_value,ndata)) {
267           m_out << "tools::rroot::branch_eleme    267           m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
268                 << " read_fast_array(double) f    268                 << " read_fast_array(double) failed."
269                 << std::endl;                     269                 << std::endl;
270           vec->clear();                           270           vec->clear();
271           return false;                           271           return false;
272         }                                         272         }
273                                                   273 
274         return true;                              274         return true;
275                                                   275 
276       } else if(fStreamerType==kInt) {            276       } else if(fStreamerType==kInt) {
277         int ndata = fBranchCount->get_ndata();    277         int ndata = fBranchCount->get_ndata();
278 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            278 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
279         ::printf("debug : %s : fID %d : int :     279         ::printf("debug : %s : fID %d : int : ndata %d\n",m_name.c_str(),fID,ndata);
280 #endif                                            280 #endif
281         stl_vector<int>* vec = 0;                 281         stl_vector<int>* vec = 0;
282         if(!m_obj) {                              282         if(!m_obj) {
283           vec = new stl_vector<int>;              283           vec = new stl_vector<int>;
284     m_obj = vec;                                  284     m_obj = vec;
285         } else {                                  285         } else {
286           vec = id_cast<iro, stl_vector<int> >    286           vec = id_cast<iro, stl_vector<int> >(*m_obj);
287           if(!vec) {                              287           if(!vec) {
288             m_out << "tools::rroot::branch_ele    288             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
289                   << " read(kInt) : m_obj is n    289                   << " read(kInt) : m_obj is not a stl_vector<int>."
290                   << std::endl;                   290                   << std::endl;
291             return false;                         291             return false;
292           }                                       292           }
293         }                                         293         }
294                                                   294 
295         vec->resize(ndata);                       295         vec->resize(ndata);
296         int* _value = vec_data(*vec);             296         int* _value = vec_data(*vec);
297         if(!a_buffer.read_fast_array(_value,nd    297         if(!a_buffer.read_fast_array(_value,ndata)) {
298           m_out << "tools::rroot::branch_eleme    298           m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
299                 << " read_fast_array(int) fail    299                 << " read_fast_array(int) failed."
300                 << std::endl;                     300                 << std::endl;
301           vec->clear();                           301           vec->clear();
302           return false;                           302           return false;
303         }                                         303         }
304                                                   304 
305         return true;                              305         return true;
306                                                   306 
307       } else if((fStreamerType==kUInt)||(fStre    307       } else if((fStreamerType==kUInt)||(fStreamerType==kBits)) {
308         int ndata = fBranchCount->get_ndata();    308         int ndata = fBranchCount->get_ndata();
309 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            309 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
310         if(fStreamerType==kUInt) ::printf("deb    310         if(fStreamerType==kUInt) ::printf("debug : %s : fID %d : uint : ndata %d\n",m_name.c_str(),fID,ndata);
311         else                     ::printf("deb    311         else                     ::printf("debug : %s : fID %d : bits : ndata %d\n",m_name.c_str(),fID,ndata);
312 #endif                                            312 #endif
313         stl_vector<uint32>* vec = 0;              313         stl_vector<uint32>* vec = 0;
314         if(!m_obj) {                              314         if(!m_obj) {
315           vec = new stl_vector<uint32>;           315           vec = new stl_vector<uint32>;
316     m_obj = vec;                                  316     m_obj = vec;
317         } else {                                  317         } else {
318           vec = id_cast<iro, stl_vector<uint32    318           vec = id_cast<iro, stl_vector<uint32> >(*m_obj);
319           if(!vec) {                              319           if(!vec) {
320             m_out << "tools::rroot::branch_ele    320             m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
321                   << " read(kUInt) : m_obj is     321                   << " read(kUInt) : m_obj is not a stl_vector<uint32>."
322                   << std::endl;                   322                   << std::endl;
323             return false;                         323             return false;
324           }                                       324           }
325         }                                         325         }
326                                                   326 
327         vec->resize(ndata);                       327         vec->resize(ndata);
328         uint32* _value = vec_data(*vec);          328         uint32* _value = vec_data(*vec);
329         if(!a_buffer.read_fast_array(_value,nd    329         if(!a_buffer.read_fast_array(_value,ndata)) {
330           m_out << "tools::rroot::branch_eleme    330           m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
331                 << " read_fast_array(uint) fai    331                 << " read_fast_array(uint) failed."
332                 << std::endl;                     332                 << std::endl;
333           vec->clear();                           333           vec->clear();
334           return false;                           334           return false;
335         }                                         335         }
336                                                   336 
337         return true;                              337         return true;
338                                                   338 
339       } else {                                    339       } else {
340         m_out << "tools::rroot::branch_element    340         m_out << "tools::rroot::branch_element::read_leaves :"
341               << " name " << m_name << " ref_c    341               << " name " << m_name << " ref_cls " << fClassName
342               << " : for type " << fType << ",    342               << " : for type " << fType << ", stream_type " << fStreamerType << " not treated."
343               << std::endl;                       343               << std::endl;
344         return false;                             344         return false;
345       }                                           345       }
346   /*                                              346   /*
347         //m_obj = clones_array<float>(m_fac,tr    347         //m_obj = clones_array<float>(m_fac,true,false);  //true = owner of objects.
348         uint32 ndata = 1;                         348         uint32 ndata = 1;
349         float* _value = new float[ndata];         349         float* _value = new float[ndata];
350         if(!a_buffer.read_fast_array(_value,nd    350         if(!a_buffer.read_fast_array(_value,ndata)) {
351           m_out << "tools::rroot::branch_eleme    351           m_out << "tools::rroot::branch_element::read_leaves : \"" << name() << "\" :"
352                 << " read_fast_array failed."     352                 << " read_fast_array failed."
353                 << std::endl;                     353                 << std::endl;
354           return false;                           354           return false;
355         }                                         355         }
356   */                                              356   */
357   //} else if(fType<=2) { //in v5-18-00d          357   //} else if(fType<=2) { //in v5-18-00d
358     } else if(fType==0) { // to read wroot.roo    358     } else if(fType==0) { // to read wroot.root of examples/cpp/wroot.cpp.
359 //     if(fID>=0) {                               359 //     if(fID>=0) {
360 //       // branch in split mode                  360 //       // branch in split mode
361 //       m_out << "tools::rroot::branch_elemen    361 //       m_out << "tools::rroot::branch_element::read_leaves :"
362 //             << " name " << m_name << " ref_    362 //             << " name " << m_name << " ref_cls " << fClassName << " :"
363 //             << " type 0 with ID " << fID <<    363 //             << " type 0 with ID " << fID << "."
364 //             << std::endl;                      364 //             << std::endl;
365 //       return true;                             365 //       return true;
366 //                                                366 //
367                                                   367 
368        if((fID==-1)||                             368        if((fID==-1)||
369           (fID==1)     // for pmx to read LHCb    369           (fID==1)     // for pmx to read LHCb files :
370          ){                                       370          ){
371          //from v4-00-01                          371          //from v4-00-01
372          //if (fBranchCount) fNdata = (Int_t)f    372          //if (fBranchCount) fNdata = (Int_t)fBranchCount->GetValue(0,0);
373          //else fNdata = 1;                       373          //else fNdata = 1;
374    if(fBranchCount) {                             374    if(fBranchCount) {
375            fNdata = fBranchCount->get_ndata();    375            fNdata = fBranchCount->get_ndata();
376            //::printf("debug : branch_element:    376            //::printf("debug : branch_element::read_leaves : (fType==0,fID==-1) : fNdata %d\n",fNdata);
377    } else {                                       377    } else {
378      fNdata = 1;                                  378      fNdata = 1;
379    }                                              379    }
380                                                   380 
381          // read object :                         381          // read object :
382    bool created = false;                          382    bool created = false;
383          if(!m_obj) {                             383          if(!m_obj) {
384            ifac::args args;                       384            ifac::args args;
385            m_obj = m_fac.create(fClassName,arg    385            m_obj = m_fac.create(fClassName,args);
386            if(!m_obj) return false;               386            if(!m_obj) return false;
387      created = true;                              387      created = true;
388          }                                        388          }
389                                                   389 
390          if(!m_obj->stream(a_buffer)){            390          if(!m_obj->stream(a_buffer)){
391            m_out << "tools::rroot::branch_elem    391            m_out << "tools::rroot::branch_element::read_leaves :"
392                  << " name " << sout(m_name) <    392                  << " name " << sout(m_name) << ", ref_cls " << sout(fClassName) << " :"
393                  << " obj stream failed."         393                  << " obj stream failed."
394                  << std::endl;                    394                  << std::endl;
395      if(created) {delete m_obj;m_obj = 0;}        395      if(created) {delete m_obj;m_obj = 0;}
396            return false;                          396            return false;
397          }                                        397          }
398                                                   398 
399          return true;                             399          return true;
400                                                   400 
401        } else {                                   401        } else {
402          m_out << "tools::rroot::branch_elemen    402          m_out << "tools::rroot::branch_element::read_leaves :"
403                << " name " << m_name << " ref_    403                << " name " << m_name << " ref_cls " << fClassName << " :"
404                << " type 0 with ID " << fID <<    404                << " type 0 with ID " << fID << " not treated."
405                << std::endl;                      405                << std::endl;
406          return false;                            406          return false;
407        }                                          407        }
408                                                   408 
409     }                                             409     }
410                                                   410 
411     m_out << "tools::rroot::branch_element::re    411     m_out << "tools::rroot::branch_element::read_leaves :"
412           << " name " << m_name << " ref_cls "    412           << " name " << m_name << " ref_cls " << fClassName
413           << " : type " << fType << " not trea    413           << " : type " << fType << " not treated, stream_type is " << fStreamerType << "."
414           << std::endl;                           414           << std::endl;
415     return false;                                 415     return false;
416                                                   416 
417 /*                                                417 /*
418     //////////////////////////////////////////    418     ///////////////////////////////////////////////////////
419     /// STL container ////////////////////////    419     /// STL container /////////////////////////////////////
420     //////////////////////////////////////////    420     ///////////////////////////////////////////////////////
421     if(fType==4) {                                421     if(fType==4) {
422       // STL container master branch (has only    422       // STL container master branch (has only the number of elements).
423       //from v4-00-01                             423       //from v4-00-01
424       int n;                                      424       int n;
425       if(!a_buffer.read(n)) return false;         425       if(!a_buffer.read(n)) return false;
426       //fNdata = n;                               426       //fNdata = n;
427                                                   427 
428       m_out << "tools::rroot::branch_element::    428       m_out << "tools::rroot::branch_element::read_leaves :"
429             << " name " << m_name << " ref_cls    429             << " name " << m_name << " ref_cls " << fClassName
430             << " : type " << fType << " not tr    430             << " : type " << fType << " not treated."
431             << std::endl;                         431             << std::endl;
432       return false;                               432       return false;
433                                                   433 
434     } else if(fType==41) {                        434     } else if(fType==41) {
435       // STL container sub-branch (contains th    435       // STL container sub-branch (contains the elements).
436       m_out << "tools::rroot::branch_element::    436       m_out << "tools::rroot::branch_element::read_leaves :"
437             << " name " << m_name << " ref_cls    437             << " name " << m_name << " ref_cls " << fClassName
438             << " : type " << fType << " not tr    438             << " : type " << fType << " not treated."
439             << std::endl;                         439             << std::endl;
440       return false;                               440       return false;
441                                                   441 
442     //////////////////////////////////////////    442     ///////////////////////////////////////////////////////
443     /// TClonesArray container ///////////////    443     /// TClonesArray container ////////////////////////////
444     //////////////////////////////////////////    444     ///////////////////////////////////////////////////////
445     } else if(fType==3) {                         445     } else if(fType==3) {
446       // TClonesArray master branch (has only     446       // TClonesArray master branch (has only the number of elements).
447       //from v4-00-01                             447       //from v4-00-01
448       int n;                                      448       int n;
449       if(!a_buffer.read(n)) return false;         449       if(!a_buffer.read(n)) return false;
450                                                   450 
451       //fNdata = n;                               451       //fNdata = n;
452       //TClonesArray *clones = (TClonesArray*)    452       //TClonesArray *clones = (TClonesArray*)fObject;
453       //if (!clones) return;                      453       //if (!clones) return;
454       //if (clones->IsZombie()) return;           454       //if (clones->IsZombie()) return;
455       //clones->Clear();                          455       //clones->Clear();
456       //clones->ExpandCreateFast(fNdata);         456       //clones->ExpandCreateFast(fNdata);
457                                                   457 
458       m_out << "tools::rroot::branch_element::    458       m_out << "tools::rroot::branch_element::read_leaves :"
459             << " name " << m_name << " ref_cls    459             << " name " << m_name << " ref_cls " << fClassName
460             << " : type " << fType << " not tr    460             << " : type " << fType << " not treated."
461             << std::endl;                         461             << std::endl;
462       return false;                               462       return false;
463                                                   463 
464     } else if(fType==31) {                        464     } else if(fType==31) {
465       // TClonesArray sub-branch (contains the    465       // TClonesArray sub-branch (contains the elements).
466       m_out << "tools::rroot::branch_element::    466       m_out << "tools::rroot::branch_element::read_leaves :"
467             << " name " << m_name << " ref_cls    467             << " name " << m_name << " ref_cls " << fClassName
468             << " : type " << fType << " not tr    468             << " : type " << fType << " not treated."
469             << std::endl;                         469             << std::endl;
470       return false;                               470       return false;
471                                                   471 
472     //////////////////////////////////////////    472     ///////////////////////////////////////////////////////
473     //////////////////////////////////////////    473     ///////////////////////////////////////////////////////
474     //////////////////////////////////////////    474     ///////////////////////////////////////////////////////
475     } else if(fType<=2) {                         475     } else if(fType<=2) {
476       // branch in split mode                     476       // branch in split mode
477                                                   477 
478       //from v4-00-01                             478       //from v4-00-01
479       //if (fBranchCount) fNdata = (Int_t)fBra    479       //if (fBranchCount) fNdata = (Int_t)fBranchCount->GetValue(0,0);
480       //else fNdata = 1;                          480       //else fNdata = 1;
481       //if (!fInfo) return;                       481       //if (!fInfo) return;
482       //fInfo->ReadBuffer(b,fObject,fID);         482       //fInfo->ReadBuffer(b,fObject,fID);
483       //if (fStreamerType == 6) fNdata = (Int_    483       //if (fStreamerType == 6) fNdata = (Int_t)GetValue(0,0);
484                                                   484 
485       //from 3.0.06                               485       //from 3.0.06
486       //if (fID >= 0) {                           486       //if (fID >= 0) {
487       //  fInfo->ReadBuffer(b,fAddress,fID);      487       //  fInfo->ReadBuffer(b,fAddress,fID);
488       //} else if (fID == -1) {   // top level    488       //} else if (fID == -1) {   // top level branch in non split mode
489       //  char **ppointer = (char**)fAddress;     489       //  char **ppointer = (char**)fAddress;
490       //  fInfo->ReadBuffer(b,*ppointer,fID);     490       //  fInfo->ReadBuffer(b,*ppointer,fID);
491       //}                                         491       //}
492                                                   492 
493       //m_out << "tools::rroot::branch_element    493       //m_out << "tools::rroot::branch_element::read_leaves :"
494       //      << " name " << m_name << " ref_c    494       //      << " name " << m_name << " ref_cls " << fClassName << " :"
495       //      << " type " << fType << " with I    495       //      << " type " << fType << " with ID " << fID << "."
496       //      << " and then ?"                    496       //      << " and then ?"
497       //      << std::endl;                       497       //      << std::endl;
498                                                   498 
499       // read object ?                            499       // read object ?
500       bool created = false;                       500       bool created = false;
501       if(!m_obj) {                                501       if(!m_obj) {
502         ifac::args args;                          502         ifac::args args;
503         m_obj = m_fac.create(fClassName,args);    503         m_obj = m_fac.create(fClassName,args);
504         if(!m_obj) return false;                  504         if(!m_obj) return false;
505         created = true;                           505         created = true;
506       }                                           506       }
507                                                   507 
508       if(!m_obj->stream(a_buffer)){               508       if(!m_obj->stream(a_buffer)){
509         m_out << "tools::rroot::branch_element    509         m_out << "tools::rroot::branch_element::read_leaves :"
510               << " name " << m_name << " ref_c    510               << " name " << m_name << " ref_cls " << fClassName << " :"
511               << " obj stream failed."            511               << " obj stream failed."
512               << std::endl;                       512               << std::endl;
513         if(created) {delete m_obj;m_obj = 0;}     513         if(created) {delete m_obj;m_obj = 0;}
514         return false;                             514         return false;
515       }                                           515       }
516                                                   516 
517       //m_out << "tools::rroot::branch_element    517       //m_out << "tools::rroot::branch_element::read_leaves :"
518       //      << " name " << m_name << " ref_c    518       //      << " name " << m_name << " ref_cls " << fClassName << " :"
519       //      << " obj streamed."                 519       //      << " obj streamed."
520       //      << std::endl;                       520       //      << std::endl;
521                                                   521 
522       return true;                                522       return true;
523                                                   523 
524 //  } else if(fType==0) {                         524 //  } else if(fType==0) {
525 //     if(fID>=0) {                               525 //     if(fID>=0) {
526 //       // branch in split mode                  526 //       // branch in split mode
527 //       m_out << "tools::rroot::branch_elemen    527 //       m_out << "tools::rroot::branch_element::read_leaves :"
528 //             << " name " << m_name << " ref_    528 //             << " name " << m_name << " ref_cls " << fClassName << " :"
529 //             << " type 0 with ID " << fID <<    529 //             << " type 0 with ID " << fID << "."
530 //             << std::endl;                      530 //             << std::endl;
531 //       return true;                             531 //       return true;
532 //                                                532 //
533 //     } else if(fID==-1) {                       533 //     } else if(fID==-1) {
534 //       // top level branch in non split mode    534 //       // top level branch in non split mode
535 //       m_out << "tools::rroot::branch_elemen    535 //       m_out << "tools::rroot::branch_element::read_leaves :"
536 //             << " name " << m_name << " ref_    536 //             << " name " << m_name << " ref_cls " << fClassName << " :"
537 //             << " type 0 with ID " << fID       537 //             << " type 0 with ID " << fID
538 //             << " : fill object."               538 //             << " : fill object."
539 //             << std::endl;                      539 //             << std::endl;
540                                                   540 
541 //       if(!m_obj) {                             541 //       if(!m_obj) {
542 //         m_out << "tools::rroot::branch_elem    542 //         m_out << "tools::rroot::branch_element::read_leaves :"
543 //               << " name " << m_name << " re    543 //               << " name " << m_name << " ref_cls " << fClassName << " :"
544 //               << " m_obj is null."             544 //               << " m_obj is null."
545 //               << std::endl;                    545 //               << std::endl;
546 //         return false;                          546 //         return false;
547 //       }                                        547 //       }
548 //       if(!m_obj->stream(a_buffer)){            548 //       if(!m_obj->stream(a_buffer)){
549 //         m_out << "tools::rroot::branch_elem    549 //         m_out << "tools::rroot::branch_element::read_leaves :"
550 //               << " name " << m_name << " re    550 //               << " name " << m_name << " ref_cls " << fClassName << " :"
551 //               << " obj stream failed."         551 //               << " obj stream failed."
552 //               << std::endl;                    552 //               << std::endl;
553 //         return false;                          553 //         return false;
554 //       }                                        554 //       }
555 //       return true;                             555 //       return true;
556                                                   556 
557 //     } else {                                   557 //     } else {
558 //       m_out << "tools::rroot::branch_elemen    558 //       m_out << "tools::rroot::branch_element::read_leaves :"
559 //             << " name " << m_name << " ref_    559 //             << " name " << m_name << " ref_cls " << fClassName << " :"
560 //             << " type 0 with ID " << fID <<    560 //             << " type 0 with ID " << fID << " not treated."
561 //             << std::endl;                      561 //             << std::endl;
562 //       return false;                            562 //       return false;
563 //     }                                          563 //     }
564                                                   564 
565 //  //LHCb files :                                565 //  //LHCb files :
566 //  } else if(fType==1) {                         566 //  } else if(fType==1) {
567 //    // parent branch is a base class branch.    567 //    // parent branch is a base class branch.
568 //    // Ok, and then ?                           568 //    // Ok, and then ?
569 //    m_out << "tools::rroot::branch_element::    569 //    m_out << "tools::rroot::branch_element::read_leaves :"
570 //          << " name " << m_name << " ref_cls    570 //          << " name " << m_name << " ref_cls " << fClassName << " :"
571 //          << " type " << fType << " with ID     571 //          << " type " << fType << " with ID " << fID << "."
572 //          << std::endl;                         572 //          << std::endl;
573 //    return true;                                573 //    return true;
574                                                   574 
575     } else {                                      575     } else {
576       m_out << "tools::rroot::branch_element::    576       m_out << "tools::rroot::branch_element::read_leaves :"
577             << " name " << m_name << " ref_cls    577             << " name " << m_name << " ref_cls " << fClassName << " :"
578             << " type " << fType << " with ID     578             << " type " << fType << " with ID " << fID << "."
579             << " unknown case."                   579             << " unknown case."
580             << std::endl;                         580             << std::endl;
581       return false;                               581       return false;
582     }                                             582     }
583 */                                                583 */
584   }                                               584   }
585                                                   585 
586   virtual bool find_entry(ifile& a_file,uint64    586   virtual bool find_entry(ifile& a_file,uint64 a_entry,uint32& a_nbytes){
587     //The below line will call the upper read_    587     //The below line will call the upper read_leaves.
588     if(!parent::find_entry(a_file,a_entry,a_nb    588     if(!parent::find_entry(a_file,a_entry,a_nbytes)) return false;
589                                                   589 
590     if(m_branches.size()) {                       590     if(m_branches.size()) {
591       //if(!m_obj) {                              591       //if(!m_obj) {
592       //  m_obj = m_fac.create(fClassName);       592       //  m_obj = m_fac.create(fClassName);
593       //  if(!m_obj) return false;                593       //  if(!m_obj) return false;
594       //}                                         594       //}
595                                                   595 
596       tools_vforcit(branch*,m_branches,it) {      596       tools_vforcit(branch*,m_branches,it) {
597         uint32 n;                                 597         uint32 n;
598         if(!(*it)->find_entry(a_file,a_entry,n    598         if(!(*it)->find_entry(a_file,a_entry,n)) return false;
599         a_nbytes += n;                            599         a_nbytes += n;
600       }                                           600       }
601     }                                             601     }
602                                                   602 
603     return true;                                  603     return true;
604   }                                               604   }
605                                                   605 
606   virtual bool show(std::ostream& a_out,ifile&    606   virtual bool show(std::ostream& a_out,ifile& a_file,uint64 a_entry){
607     uint32 n;                                     607     uint32 n;
608     if(!find_entry(a_file,a_entry,n)) return f    608     if(!find_entry(a_file,a_entry,n)) return false;
609                                                   609 
610    {std::string _s;                            << 610    {std::string s;
611     uint32 len = uint32(name().size())+128;       611     uint32 len = uint32(name().size())+128;
612     sprintf(_s,len," %-15s = ",name().c_str()) << 612     sprintf(s,len," %-15s = ",name().c_str());
613     a_out << _s;}                              << 613     a_out << s;}
614                                                   614 
615     a_out << m_obj << std::endl;                  615     a_out << m_obj << std::endl;
616                                                   616 
617     return true;                                  617     return true;
618     //return parent::show(a_out,a_file,a_entry    618     //return parent::show(a_out,a_file,a_entry);
619   }                                               619   }
620 public:                                           620 public:
621   branch_element(std::ostream& a_out,ifac& a_f    621   branch_element(std::ostream& a_out,ifac& a_fac)
622   :parent(a_out,a_fac)                            622   :parent(a_out,a_fac)
623   ,m_obj(0)                                       623   ,m_obj(0)
624   ,fClassVersion(0)                               624   ,fClassVersion(0)
625   ,fID(0)                                         625   ,fID(0)
626   ,fType(0)                                       626   ,fType(0)
627   ,fStreamerType(-1)                              627   ,fStreamerType(-1)
628   ,fBranchCount(0)   //not owner                  628   ,fBranchCount(0)   //not owner
629   ,fBranchCount_created(false)                    629   ,fBranchCount_created(false)
630   ,fBranchCount2(0)  //not owner                  630   ,fBranchCount2(0)  //not owner
631   ,fBranchCount2_created(false)                   631   ,fBranchCount2_created(false)
632   ,fNdata(1)                                      632   ,fNdata(1)
633   {}                                              633   {}
634                                                   634 
635   virtual ~branch_element() {                     635   virtual ~branch_element() {
636     _clear();                                     636     _clear();
637     if(m_obj) delete m_obj;                       637     if(m_obj) delete m_obj;
638   }                                               638   }
639 protected:                                        639 protected:
640   branch_element(const branch_element& a_from)    640   branch_element(const branch_element& a_from):iro(a_from),parent(a_from){}
641   branch_element& operator=(const branch_eleme    641   branch_element& operator=(const branch_element&){return *this;}
642 public:                                           642 public:
643   const std::string& class_name() const {retur    643   const std::string& class_name() const {return fClassName;}
644   int type() const {return fType;}                644   int type() const {return fType;}
645   int streamer_type() const {return fStreamerT    645   int streamer_type() const {return fStreamerType;}
646   int id() const {return fID;}                    646   int id() const {return fID;}
647   iro* object() {return m_obj;}                   647   iro* object() {return m_obj;}
648   int get_ndata() const {return fNdata;}          648   int get_ndata() const {return fNdata;}
649                                                   649 
650   template <class T>                              650   template <class T>
651   stl_vector<T>* object_to_stl_vector() const     651   stl_vector<T>* object_to_stl_vector() const {
652     if(!m_obj) {                                  652     if(!m_obj) {
653       m_out << "tools::rroot::branch_element::    653       m_out << "tools::rroot::branch_element::object_to_stl_vector : there is no object." << std::endl;
654       return 0;                                   654       return 0;
655     }                                             655     }
656     stl_vector<T>* od = id_cast<iro, stl_vecto    656     stl_vector<T>* od = id_cast<iro, stl_vector<T> >(*m_obj);
657     if(!od) {                                     657     if(!od) {
658       m_out << "tools::rroot::branch_element::    658       m_out << "tools::rroot::branch_element::object_to_stl_vector :"
659             << " object of class " << sout(m_o    659             << " object of class " << sout(m_obj->s_cls()) << " not a tools::rroot::stl_vector<T>."
660       << std::endl;                               660       << std::endl;
661       return 0;                                   661       return 0;
662     }                                             662     }
663     return od; //WARNING : we are not owner.      663     return od; //WARNING : we are not owner.
664   }                                               664   }
665                                                   665 
666   obj_list* object_to_obj_list() const {          666   obj_list* object_to_obj_list() const {
667     if(!m_obj) {                                  667     if(!m_obj) {
668       m_out << "tools::rroot::branch_element::    668       m_out << "tools::rroot::branch_element::object_to_obj_list : there is no object." << std::endl;
669       return 0;                                   669       return 0;
670     }                                             670     }
671     obj_list* od = id_cast<iro,obj_list>(*m_ob    671     obj_list* od = id_cast<iro,obj_list>(*m_obj);
672     if(!od) {                                     672     if(!od) {
673       m_out << "tools::rroot::branch_element::    673       m_out << "tools::rroot::branch_element::object_to_obj_list :"
674             << " object of class " << sout(m_o    674             << " object of class " << sout(m_obj->s_cls()) << " not a tools::rroot::obj_list."
675       << std::endl;                               675       << std::endl;
676       return 0;                                   676       return 0;
677     }                                             677     }
678     return od; //WARNING : we are not owner.      678     return od; //WARNING : we are not owner.
679   }                                               679   }
680                                                   680 
681   template <class T>                              681   template <class T>
682   stl_vector<T>* find_entry_vec(ifile& a_file,    682   stl_vector<T>* find_entry_vec(ifile& a_file,uint64 a_event) {
683     unsigned int n;                               683     unsigned int n;
684     if(!find_entry(a_file,a_event,n)) {           684     if(!find_entry(a_file,a_event,n)) {
685       m_out << "tools::rroot::branch_element::    685       m_out << "tools::rroot::branch_element::find_entry_vec : find_entry() failed." << std::endl;
686       return 0;                                   686       return 0;
687     }                                             687     }
688     if(!m_obj) {                                  688     if(!m_obj) {
689       m_out << "tools::rroot::branch_element::    689       m_out << "tools::rroot::branch_element::find_entry_vec : no object found." << std::endl;
690       return 0;                                   690       return 0;
691     }                                             691     }
692     stl_vector<T>* od = id_cast<iro, stl_vecto    692     stl_vector<T>* od = id_cast<iro, stl_vector<T> >(*m_obj);
693     if(!od) {                                     693     if(!od) {
694       m_out << "tools::rroot::branch_element::    694       m_out << "tools::rroot::branch_element::find_entry_vec :"
695             << " object not a tools::rroot::st    695             << " object not a tools::rroot::stl_vector<T>."
696       << std::endl;                               696       << std::endl;
697       return 0;                                   697       return 0;
698     }                                             698     }
699     return od; //WARNING : we are not owner.      699     return od; //WARNING : we are not owner.
700   }                                               700   }
701                                                   701 
702 protected:                                        702 protected:
703   void _clear() {                                 703   void _clear() {
704     if(fBranchCount_created) {delete fBranchCo    704     if(fBranchCount_created) {delete fBranchCount;fBranchCount = 0;fBranchCount_created = false;}
705     if(fBranchCount2_created) {delete fBranchC    705     if(fBranchCount2_created) {delete fBranchCount2;fBranchCount2 = 0;fBranchCount2_created = false;}
706   }                                               706   }
707 protected:                                        707 protected:
708   iro* m_obj;                                     708   iro* m_obj;
709 protected:                                        709 protected:
710   std::string fClassName; //Class name of refe    710   std::string fClassName; //Class name of referenced object
711   int fClassVersion;  //Version number of clas    711   int fClassVersion;  //Version number of class
712   int fID;            //element serial number     712   int fID;            //element serial number in fInfo
713   int fType;          //branch type               713   int fType;          //branch type
714   int fStreamerType;  //branch streamer type      714   int fStreamerType;  //branch streamer type
715   branch_element* fBranchCount;  // pointer to    715   branch_element* fBranchCount;  // pointer to primary branchcount branch
716   bool fBranchCount_created;                      716   bool fBranchCount_created;
717   branch_element* fBranchCount2; // pointer to    717   branch_element* fBranchCount2; // pointer to secondary branchcount branch
718   bool fBranchCount2_created;                     718   bool fBranchCount2_created;
719   int fNdata;         // Number of data in thi    719   int fNdata;         // Number of data in this branch
720 };                                                720 };
721                                                   721 
722 }}                                                722 }}
723                                                   723 
724 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            724 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
725 #undef TOOLS_RROOT_BRANCH_ELEMENT_DUMP            725 #undef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
726 #endif                                            726 #endif
727                                                   727 
728 #endif                                            728 #endif
729                                                   729 
730 //////////////////////////////////////////////    730 ////////////////////////////////////////////////////////////
731 //////////////////////////////////////////////    731 ////////////////////////////////////////////////////////////
732 //////////////////////////////////////////////    732 ////////////////////////////////////////////////////////////
733 /* In v4-00-01 version 8 :                        733 /* In v4-00-01 version 8 :
734           case  1:  {b.ReadFastArray((Char_t*)    734           case  1:  {b.ReadFastArray((Char_t*)  fAddress, n); break;}
735           case  2:  {b.ReadFastArray((Short_t*    735           case  2:  {b.ReadFastArray((Short_t*) fAddress, n); break;}
736           case  3:  {b.ReadFastArray((Int_t*)     736           case  3:  {b.ReadFastArray((Int_t*)   fAddress, n); break;}
737           case  4:  {b.ReadFastArray((Long_t*)    737           case  4:  {b.ReadFastArray((Long_t*)  fAddress, n); break;}
738           case  5:  {b.ReadFastArray((Float_t*    738           case  5:  {b.ReadFastArray((Float_t*) fAddress, n); break;}
739           case  6:  {b.ReadFastArray((Int_t*)     739           case  6:  {b.ReadFastArray((Int_t*)   fAddress, n); break;}
740           case  8:  {b.ReadFastArray((Double_t    740           case  8:  {b.ReadFastArray((Double_t*)fAddress, n); break;}
741           case 11:  {b.ReadFastArray((UChar_t*    741           case 11:  {b.ReadFastArray((UChar_t*) fAddress, n); break;}
742           case 12:  {b.ReadFastArray((UShort_t    742           case 12:  {b.ReadFastArray((UShort_t*)fAddress, n); break;}
743           case 13:  {b.ReadFastArray((UInt_t*)    743           case 13:  {b.ReadFastArray((UInt_t*)  fAddress, n); break;}
744           case 14:  {b.ReadFastArray((ULong_t*    744           case 14:  {b.ReadFastArray((ULong_t*) fAddress, n); break;}
745           case 15:  {b.ReadFastArray((Long64_t    745           case 15:  {b.ReadFastArray((Long64_t*)fAddress, n); break;}
746           case 16:  {b.ReadFastArray((ULong64_    746           case 16:  {b.ReadFastArray((ULong64_t*)fAddress, n); break;}
747       case  9:  {Double_t *xx = (Double_t*)fAd    747       case  9:  {Double_t *xx = (Double_t*)fAddress;
748                   Float_t afloat;                 748                   Float_t afloat;
749             for (Int_t ii=0;ii<n;ii++) {          749             for (Int_t ii=0;ii<n;ii++) {
750                     b>> afloat; xx[ii] = Doubl    750                     b>> afloat; xx[ii] = Double_t(afloat);
751             } break;}                             751             } break;}
752 */                                                752 */
753 /* 6.12.06 version 10 : fStreamerType : from m    753 /* 6.12.06 version 10 : fStreamerType : from meta/inc/TVirtualStreamerInfo.h :
754                                                   754 
755    enum EReadWrite {                              755    enum EReadWrite {
756       kBase        =  0,  kOffsetL = 20,  kOff    756       kBase        =  0,  kOffsetL = 20,  kOffsetP = 40,  kCounter =  6,  kCharStar = 7,
757       kChar        =  1,  kShort   =  2,  kInt    757       kChar        =  1,  kShort   =  2,  kInt     =  3,  kLong    =  4,  kFloat    = 5,
758       kDouble      =  8,  kDouble32=  9,          758       kDouble      =  8,  kDouble32=  9,
759       kUChar       = 11,  kUShort  = 12,  kUIn    759       kUChar       = 11,  kUShort  = 12,  kUInt    = 13,  kULong   = 14,  kBits     = 15,
760       kLong64      = 16,  kULong64 = 17,  kBoo    760       kLong64      = 16,  kULong64 = 17,  kBool    = 18,  kFloat16 = 19,
761       kObject      = 61,  kAny     = 62,  kObj    761       kObject      = 61,  kAny     = 62,  kObjectp = 63,  kObjectP = 64,  kTString  = 65,
762       kTObject     = 66,  kTNamed  = 67,  kAny    762       kTObject     = 66,  kTNamed  = 67,  kAnyp    = 68,  kAnyP    = 69,  kAnyPnoVT = 70,
763       kSTLp        = 71,                          763       kSTLp        = 71,
764       kSkip        = 100, kSkipL = 120, kSkipP    764       kSkip        = 100, kSkipL = 120, kSkipP   = 140,
765       kConv        = 200, kConvL = 220, kConvP    765       kConv        = 200, kConvL = 220, kConvP   = 240,
766       kSTL         = ROOT::kSTLany, // 300        766       kSTL         = ROOT::kSTLany, // 300
767       kSTLstring   = ROOT::kSTLstring, // 365     767       kSTLstring   = ROOT::kSTLstring, // 365
768       kStreamer    = 500, kStreamLoop = 501,      768       kStreamer    = 500, kStreamLoop = 501,
769       kCache       = 600,  // Cache the value     769       kCache       = 600,  // Cache the value in memory than is not part of the object but is accessible via a SchemaRule
770       kArtificial  = 1000,                        770       kArtificial  = 1000,
771       kCacheNew    = 1001,                        771       kCacheNew    = 1001,
772       kCacheDelete = 1002,                        772       kCacheDelete = 1002,
773       kNeedObjectForVirtualBaseClass = 99997,     773       kNeedObjectForVirtualBaseClass = 99997,
774       kMissing     = 99999                        774       kMissing     = 99999
775    };                                             775    };
776                                                   776 
777 // Some comments about EReadWrite                 777 // Some comments about EReadWrite
778 // kBase    : base class element                  778 // kBase    : base class element
779 // kOffsetL : fixed size array                    779 // kOffsetL : fixed size array
780 // kOffsetP : pointer to object                   780 // kOffsetP : pointer to object
781 // kCounter : counter for array size              781 // kCounter : counter for array size
782 // kCharStar: pointer to array of char            782 // kCharStar: pointer to array of char
783 // kBits    : TObject::fBits in case of a refe    783 // kBits    : TObject::fBits in case of a referenced object
784 // kObject  : Class  derived from TObject         784 // kObject  : Class  derived from TObject
785 // kObjectp : Class* derived from TObject and     785 // kObjectp : Class* derived from TObject and with    comment field //->Class
786 // kObjectP : Class* derived from TObject and     786 // kObjectP : Class* derived from TObject and with NO comment field //->Class
787 // kAny     : Class  not derived from TObject     787 // kAny     : Class  not derived from TObject
788 // kAnyp    : Class* not derived from TObject     788 // kAnyp    : Class* not derived from TObject with    comment field //->Class
789 // kAnyP    : Class* not derived from TObject     789 // kAnyP    : Class* not derived from TObject with NO comment field //->Class
790 // kAnyPnoVT: Class* not derived from TObject     790 // kAnyPnoVT: Class* not derived from TObject with NO comment field //->Class and Class has NO virtual table
791 // kSTLp    : Pointer to STL container.           791 // kSTLp    : Pointer to STL container.
792 // kTString : TString, special case               792 // kTString : TString, special case
793 // kTObject : TObject, special case               793 // kTObject : TObject, special case
794 // kTNamed  : TNamed , special case               794 // kTNamed  : TNamed , special case
795                                                   795 
796 */                                                796 */