g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tools::rroot::branch_element Class Reference
Inheritance diagram for tools::rroot::branch_element:
Inheritance graph
[legend]
Collaboration diagram for tools::rroot::branch_element:
Collaboration graph
[legend]

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
virtual void * cast (cid a_class) const
 
virtual bool stream (buffer &a_buffer)
 
virtual bool read_leaves (ifile &a_file, buffer &a_buffer)
 
virtual bool find_entry (ifile &a_file, uint64 a_entry, uint32 &a_nbytes)
 
virtual bool show (std::ostream &a_out, ifile &a_file, uint64 a_entry)
 
 branch_element (std::ostream &a_out, ifac &a_fac)
 
virtual ~branch_element ()
 
const std::string & class_name () const
 
int type () const
 
int streamer_type () const
 
int id () const
 
iroobject ()
 
int get_ndata () const
 
template<class T >
stl_vector< T > * object_to_stl_vector () const
 
obj_listobject_to_obj_list () const
 
template<class T >
stl_vector< T > * find_entry_vec (ifile &a_file, uint64 a_event)
 
- Public Member Functions inherited from tools::rroot::branch
virtual irocopy () const
 
 branch (std::ostream &a_out, ifac &a_fac)
 
virtual ~branch ()
 
uint32 entry_number () const
 
const std::string & name () const
 
const std::string & title () const
 
const std::vector< base_leaf * > & leaves () const
 
const std::vector< branch * > & branches () const
 
- Public Member Functions inherited from tools::rroot::iro
virtual ~iro ()
 

Static Public Member Functions

static const std::string & s_class ()
 
static cid id_class ()
 
- Static Public Member Functions inherited from tools::rroot::branch
static const std::string & s_class ()
 
static cid id_class ()
 

Protected Member Functions

 branch_element (const branch_element &a_from)
 
branch_elementoperator= (const branch_element &)
 
void _clear ()
 
- Protected Member Functions inherited from tools::rroot::branch
 branch (const branch &a_from)
 
branchoperator= (const branch &)
 
basketget_basket (ifile &a_file, seek a_pos, uint32 a_len)
 
void _clear ()
 
void _dump_first_last ()
 

Protected Attributes

irom_obj
 
std::string fClassName
 
int fClassVersion
 
int fID
 
int fType
 
int fStreamerType
 
branch_elementfBranchCount
 
bool fBranchCount_created
 
branch_elementfBranchCount2
 
bool fBranchCount2_created
 
int fNdata
 
- Protected Attributes inherited from tools::rroot::branch
std::ostream & m_out
 
ifacm_fac
 
std::vector< std::pair< uint64, uint64 > > m_first_last
 
std::map< uint32, std::pair< basket *, bool > > m_baskets
 
obj_array< basketm_streamed_baskets
 
basketm__read_basket
 
std::string m_name
 
std::string m_title
 
bool fAutoDelete
 
obj_array< branchm_branches
 
obj_array< base_leafm_leaves
 
uint32 fEntryOffsetLen
 
uint32 m_write_basket
 
uint32 m_entry_number
 
uint32 m_read_basket
 
int * fBasketBytes
 Current basket number when reading. More...
 
int * fBasketEntry
 
seekfBasketSeek
 

Detailed Description

Definition at line 18 of file branch_element.

Constructor & Destructor Documentation

◆ branch_element() [1/2]

tools::rroot::branch_element::branch_element ( std::ostream &  a_out,
ifac a_fac 
)
inline

Definition at line 621 of file branch_element.

622  :parent(a_out,a_fac)
623  ,m_obj(0)
624  ,fClassVersion(0)
625  ,fID(0)
626  ,fType(0)
627  ,fStreamerType(-1)
628  ,fBranchCount(0) //not owner
629  ,fBranchCount_created(false)
630  ,fBranchCount2(0) //not owner
631  ,fBranchCount2_created(false)
632  ,fNdata(1)
633  {}

◆ ~branch_element()

virtual tools::rroot::branch_element::~branch_element ( )
inlinevirtual

Definition at line 635 of file branch_element.

635  {
636  _clear();
637  if(m_obj) delete m_obj;
638  }

◆ branch_element() [2/2]

tools::rroot::branch_element::branch_element ( const branch_element a_from)
inlineprotected

Definition at line 640 of file branch_element.

640 :iro(a_from),parent(a_from){}

Member Function Documentation

◆ _clear()

void tools::rroot::branch_element::_clear ( )
inlineprotected

Definition at line 703 of file branch_element.

703  {
706  }

◆ cast() [1/2]

virtual void* tools::rroot::branch_element::cast ( cid  a_class) const
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 33 of file branch_element.

33  {
34  if(void* p = cmp_cast<branch_element>(this,a_class)) {return p;}
35  return parent::cast(a_class);
36  }

◆ cast() [2/2]

virtual void* tools::rroot::branch_element::cast ( const std::string &  a_class) const
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 26 of file branch_element.

26  {
27  if(void* p = cmp_cast<branch_element>(this,a_class)) return p;
28  return parent::cast(a_class);
29  }

◆ class_name()

const std::string& tools::rroot::branch_element::class_name ( ) const
inline

Definition at line 643 of file branch_element.

643 {return fClassName;}

◆ find_entry()

virtual bool tools::rroot::branch_element::find_entry ( ifile a_file,
uint64  a_entry,
uint32 a_nbytes 
)
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 586 of file branch_element.

586  {
587  //The below line will call the upper read_leaves.
588  if(!parent::find_entry(a_file,a_entry,a_nbytes)) return false;
589 
590  if(m_branches.size()) {
591  //if(!m_obj) {
592  // m_obj = m_fac.create(fClassName);
593  // if(!m_obj) return false;
594  //}
595 
597  uint32 n;
598  if(!(*it)->find_entry(a_file,a_entry,n)) return false;
599  a_nbytes += n;
600  }
601  }
602 
603  return true;
604  }

◆ find_entry_vec()

template<class T >
stl_vector<T>* tools::rroot::branch_element::find_entry_vec ( ifile a_file,
uint64  a_event 
)
inline

Definition at line 682 of file branch_element.

682  {
683  unsigned int n;
684  if(!find_entry(a_file,a_event,n)) {
685  m_out << "tools::rroot::branch_element::find_entry_vec : find_entry() failed." << std::endl;
686  return 0;
687  }
688  if(!m_obj) {
689  m_out << "tools::rroot::branch_element::find_entry_vec : no object found." << std::endl;
690  return 0;
691  }
692  stl_vector<T>* od = id_cast<iro, stl_vector<T> >(*m_obj);
693  if(!od) {
694  m_out << "tools::rroot::branch_element::find_entry_vec :"
695  << " object not a tools::rroot::stl_vector<T>."
696  << std::endl;
697  return 0;
698  }
699  return od; //WARNING : we are not owner.
700  }

◆ get_ndata()

int tools::rroot::branch_element::get_ndata ( ) const
inline

Definition at line 648 of file branch_element.

648 {return fNdata;}

◆ id()

int tools::rroot::branch_element::id ( ) const
inline

Definition at line 646 of file branch_element.

646 {return fID;}

◆ id_class()

static cid tools::rroot::branch_element::id_class ( )
inlinestatic

Definition at line 32 of file branch_element.

32 {return branch_element_cid();}

◆ object()

iro* tools::rroot::branch_element::object ( )
inline

Definition at line 647 of file branch_element.

647 {return m_obj;}

◆ object_to_obj_list()

obj_list* tools::rroot::branch_element::object_to_obj_list ( ) const
inline

Definition at line 666 of file branch_element.

666  {
667  if(!m_obj) {
668  m_out << "tools::rroot::branch_element::object_to_obj_list : there is no object." << std::endl;
669  return 0;
670  }
671  obj_list* od = id_cast<iro,obj_list>(*m_obj);
672  if(!od) {
673  m_out << "tools::rroot::branch_element::object_to_obj_list :"
674  << " object of class " << sout(m_obj->s_cls()) << " not a tools::rroot::obj_list."
675  << std::endl;
676  return 0;
677  }
678  return od; //WARNING : we are not owner.
679  }

◆ object_to_stl_vector()

template<class T >
stl_vector<T>* tools::rroot::branch_element::object_to_stl_vector ( ) const
inline

Definition at line 651 of file branch_element.

651  {
652  if(!m_obj) {
653  m_out << "tools::rroot::branch_element::object_to_stl_vector : there is no object." << std::endl;
654  return 0;
655  }
656  stl_vector<T>* od = id_cast<iro, stl_vector<T> >(*m_obj);
657  if(!od) {
658  m_out << "tools::rroot::branch_element::object_to_stl_vector :"
659  << " object of class " << sout(m_obj->s_cls()) << " not a tools::rroot::stl_vector<T>."
660  << std::endl;
661  return 0;
662  }
663  return od; //WARNING : we are not owner.
664  }

◆ operator=()

branch_element& tools::rroot::branch_element::operator= ( const branch_element )
inlineprotected

Definition at line 641 of file branch_element.

641 {return *this;}

◆ read_leaves()

virtual bool tools::rroot::branch_element::read_leaves ( ifile a_file,
buffer a_buffer 
)
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 114 of file branch_element.

114  {
115 
116  // For k<type> value, see the below commented enum EReadWrite from ROOT-6.12.06 code.
117  static int kInt = 3;
118  static int kDouble = 8;
119  static int kDouble32 = 9;
120  static int kUInt = 13;
121  static int kBits = 15; // In v4-00-01 version 8, it is Long64_t.
122  static int kObject = 61;
123  static int kObjectP = 64;
124 
125  if(fType==3) { // TClonesArray master branch (has only the number of elements).
126  //from v4-00-01
127  int n;
128  if(!a_buffer.read(n)) return false;
129  /* ROOT-6.12.06 code :
130  if ((n < 0) || (n > fMaximum)) {
131  if (IsMissingCollection()) {
132  n = 0;
133  b.SetBufferOffset(b.Length() - sizeof(n));
134  } else {
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;
137  }
138  }*/
139  //::printf("debug : uuuu : ndata %d\n",n);
140  fNdata = n;
141 
142  //TClonesArray *clones = (TClonesArray*)fObject;
143  //if (!clones) return;
144  //if (clones->IsZombie()) return;
145  //clones->Clear();
146  //clones->ExpandCreateFast(fNdata);
147 
148  //m_out << "debug : tools::rroot::branch_element::read_leaves :"
149  // << " name " << m_name << " ref_cls " << fClassName
150  // << " : type " << fType << ", fNdata " << n
151  // << std::endl;
152  return true;
153 
154  } else if(fType==31) { // TClonesArray sub-branch (contains the elements).
155  if(fStreamerType==kObject) { //to read EsbRoot fgd_dig.root.
156  int ndata = fBranchCount->get_ndata();
157 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
158  ::printf("debug : %s : fClassName %s : fID %d : kObject : ndata %d\n",m_name.c_str(),fClassName.c_str(),fID,ndata);
159 #endif
160  streamer_info* _info = a_file.find_streamer_info(fClassName);
161  if(!_info) {
162  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
163  << " read(kObject) : streamer_infos for ref_cls " << fClassName << " not found."
164  << std::endl;
165  return false;
166  }
167  streamer_element* _element = _info->find_streamer_element(fID);
168  if(!_element) {
169  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
170  << " read(kObject) : for ref_cls " << fClassName << ", fID " << fID << " streamer element not found."
171  << std::endl;
172  return false;
173  }
174  //::printf("debug : element type name %s\n",_element->type_name().c_str());
175 
176  obj_list* _list = 0;
177  if(!m_obj) {
178  _list = new obj_list(m_fac);
179  m_obj = _list;
180  } else {
181  _list = id_cast<iro,obj_list>(*m_obj);
182  if(!_list) {
183  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
184  << " read(kObject) : m_obj is not an obj_list."
185  << std::endl;
186  return false;
187  }
188  }
189 
190  _list->safe_clear();
191 
192  for(int index=0;index<ndata;index++) {
193  ifac::args args;
194  iro* _obj = m_fac.create(_element->type_name(),args);
195  if(!_obj) {_list->safe_clear();return false;}
196  if(!_obj->stream(a_buffer)){
197  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
198  << " kObject : obj stream of class " << sout(_element->type_name())
199  << " failed at index " << index << " (" << ndata << ")." << std::endl;
200  _list->safe_clear();
201  return false;
202  }
203  _list->add_object(_obj); //give ownership.
204  }
205 
206  return true;
207  }
208  if(fStreamerType==kObjectP) return true;
209  //from v4-00-01
210  if(fStreamerType==kDouble32) {
211  int ndata = fBranchCount->get_ndata();
212 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
213  ::printf("debug : %s : fID %d : double32 : ndata %d\n",m_name.c_str(),fID,ndata);
214 #endif
215  stl_vector<double>* vec = 0;
216  if(!m_obj) {
217  vec = new stl_vector<double>;
218  m_obj = vec;
219  } else {
220  vec = id_cast<iro, stl_vector<double> >(*m_obj);
221  if(!vec) {
222  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
223  << " read(kDouble32) : m_obj is not a stl_vector<double>."
224  << std::endl;
225  return false;
226  }
227  }
228 
229  vec->resize(ndata);
230  float afloat;
231  for(int ii=0;ii<ndata;ii++) {
232  if(!a_buffer.read(afloat)) {
233  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
234  << " read(float) failed."
235  << std::endl;
236  vec->clear();
237  return false;
238  }
239  //::printf("debug : zzzz %g\n",afloat);
240  (*vec)[ii] = afloat;
241  }
242 
243  return true;
244 
245  } else if(fStreamerType==kDouble) {
246  int ndata = fBranchCount->get_ndata();
247 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
248  ::printf("debug : %s : fID %d : double : ndata %d\n",m_name.c_str(),fID,ndata);
249 #endif
250  stl_vector<double>* vec = 0;
251  if(!m_obj) {
252  vec = new stl_vector<double>;
253  m_obj = vec;
254  } else {
255  vec = id_cast<iro, stl_vector<double> >(*m_obj);
256  if(!vec) {
257  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
258  << " read(kDouble) : m_obj is not a stl_vector<double>."
259  << std::endl;
260  return false;
261  }
262  }
263 
264  vec->resize(ndata);
265  double* _value = vec_data(*vec);
266  if(!a_buffer.read_fast_array(_value,ndata)) {
267  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
268  << " read_fast_array(double) failed."
269  << std::endl;
270  vec->clear();
271  return false;
272  }
273 
274  return true;
275 
276  } else if(fStreamerType==kInt) {
277  int ndata = fBranchCount->get_ndata();
278 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
279  ::printf("debug : %s : fID %d : int : ndata %d\n",m_name.c_str(),fID,ndata);
280 #endif
281  stl_vector<int>* vec = 0;
282  if(!m_obj) {
283  vec = new stl_vector<int>;
284  m_obj = vec;
285  } else {
286  vec = id_cast<iro, stl_vector<int> >(*m_obj);
287  if(!vec) {
288  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
289  << " read(kInt) : m_obj is not a stl_vector<int>."
290  << std::endl;
291  return false;
292  }
293  }
294 
295  vec->resize(ndata);
296  int* _value = vec_data(*vec);
297  if(!a_buffer.read_fast_array(_value,ndata)) {
298  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
299  << " read_fast_array(int) failed."
300  << std::endl;
301  vec->clear();
302  return false;
303  }
304 
305  return true;
306 
307  } else if((fStreamerType==kUInt)||(fStreamerType==kBits)) {
308  int ndata = fBranchCount->get_ndata();
309 #ifdef TOOLS_RROOT_BRANCH_ELEMENT_DUMP
310  if(fStreamerType==kUInt) ::printf("debug : %s : fID %d : uint : ndata %d\n",m_name.c_str(),fID,ndata);
311  else ::printf("debug : %s : fID %d : bits : ndata %d\n",m_name.c_str(),fID,ndata);
312 #endif
313  stl_vector<uint32>* vec = 0;
314  if(!m_obj) {
315  vec = new stl_vector<uint32>;
316  m_obj = vec;
317  } else {
318  vec = id_cast<iro, stl_vector<uint32> >(*m_obj);
319  if(!vec) {
320  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
321  << " read(kUInt) : m_obj is not a stl_vector<uint32>."
322  << std::endl;
323  return false;
324  }
325  }
326 
327  vec->resize(ndata);
328  uint32* _value = vec_data(*vec);
329  if(!a_buffer.read_fast_array(_value,ndata)) {
330  m_out << "tools::rroot::branch_element::read_leaves : " << sout(m_name) << " :"
331  << " read_fast_array(uint) failed."
332  << std::endl;
333  vec->clear();
334  return false;
335  }
336 
337  return true;
338 
339  } else {
340  m_out << "tools::rroot::branch_element::read_leaves :"
341  << " name " << m_name << " ref_cls " << fClassName
342  << " : for type " << fType << ", stream_type " << fStreamerType << " not treated."
343  << std::endl;
344  return false;
345  }
346  /*
347  //m_obj = clones_array<float>(m_fac,true,false); //true = owner of objects.
348  uint32 ndata = 1;
349  float* _value = new float[ndata];
350  if(!a_buffer.read_fast_array(_value,ndata)) {
351  m_out << "tools::rroot::branch_element::read_leaves : \"" << name() << "\" :"
352  << " read_fast_array failed."
353  << std::endl;
354  return false;
355  }
356  */
357  //} else if(fType<=2) { //in v5-18-00d
358  } else if(fType==0) { // to read wroot.root of examples/cpp/wroot.cpp.
359 // if(fID>=0) {
360 // // branch in split mode
361 // m_out << "tools::rroot::branch_element::read_leaves :"
362 // << " name " << m_name << " ref_cls " << fClassName << " :"
363 // << " type 0 with ID " << fID << "."
364 // << std::endl;
365 // return true;
366 //
367 
368  if((fID==-1)||
369  (fID==1) // for pmx to read LHCb files :
370  ){
371  //from v4-00-01
372  //if (fBranchCount) fNdata = (Int_t)fBranchCount->GetValue(0,0);
373  //else fNdata = 1;
374  if(fBranchCount) {
376  //::printf("debug : branch_element::read_leaves : (fType==0,fID==-1) : fNdata %d\n",fNdata);
377  } else {
378  fNdata = 1;
379  }
380 
381  // read object :
382  bool created = false;
383  if(!m_obj) {
384  ifac::args args;
385  m_obj = m_fac.create(fClassName,args);
386  if(!m_obj) return false;
387  created = true;
388  }
389 
390  if(!m_obj->stream(a_buffer)){
391  m_out << "tools::rroot::branch_element::read_leaves :"
392  << " name " << sout(m_name) << ", ref_cls " << sout(fClassName) << " :"
393  << " obj stream failed."
394  << std::endl;
395  if(created) {delete m_obj;m_obj = 0;}
396  return false;
397  }
398 
399  return true;
400 
401  } else {
402  m_out << "tools::rroot::branch_element::read_leaves :"
403  << " name " << m_name << " ref_cls " << fClassName << " :"
404  << " type 0 with ID " << fID << " not treated."
405  << std::endl;
406  return false;
407  }
408 
409  }
410 
411  m_out << "tools::rroot::branch_element::read_leaves :"
412  << " name " << m_name << " ref_cls " << fClassName
413  << " : type " << fType << " not treated, stream_type is " << fStreamerType << "."
414  << std::endl;
415  return false;
416 
417 /*
421  if(fType==4) {
422  // STL container master branch (has only the number of elements).
423  //from v4-00-01
424  int n;
425  if(!a_buffer.read(n)) return false;
426  //fNdata = n;
427 
428  m_out << "tools::rroot::branch_element::read_leaves :"
429  << " name " << m_name << " ref_cls " << fClassName
430  << " : type " << fType << " not treated."
431  << std::endl;
432  return false;
433 
434  } else if(fType==41) {
435  // STL container sub-branch (contains the elements).
436  m_out << "tools::rroot::branch_element::read_leaves :"
437  << " name " << m_name << " ref_cls " << fClassName
438  << " : type " << fType << " not treated."
439  << std::endl;
440  return false;
441 
445  } else if(fType==3) {
446  // TClonesArray master branch (has only the number of elements).
447  //from v4-00-01
448  int n;
449  if(!a_buffer.read(n)) return false;
450 
451  //fNdata = n;
452  //TClonesArray *clones = (TClonesArray*)fObject;
453  //if (!clones) return;
454  //if (clones->IsZombie()) return;
455  //clones->Clear();
456  //clones->ExpandCreateFast(fNdata);
457 
458  m_out << "tools::rroot::branch_element::read_leaves :"
459  << " name " << m_name << " ref_cls " << fClassName
460  << " : type " << fType << " not treated."
461  << std::endl;
462  return false;
463 
464  } else if(fType==31) {
465  // TClonesArray sub-branch (contains the elements).
466  m_out << "tools::rroot::branch_element::read_leaves :"
467  << " name " << m_name << " ref_cls " << fClassName
468  << " : type " << fType << " not treated."
469  << std::endl;
470  return false;
471 
475  } else if(fType<=2) {
476  // branch in split mode
477 
478  //from v4-00-01
479  //if (fBranchCount) fNdata = (Int_t)fBranchCount->GetValue(0,0);
480  //else fNdata = 1;
481  //if (!fInfo) return;
482  //fInfo->ReadBuffer(b,fObject,fID);
483  //if (fStreamerType == 6) fNdata = (Int_t)GetValue(0,0);
484 
485  //from 3.0.06
486  //if (fID >= 0) {
487  // fInfo->ReadBuffer(b,fAddress,fID);
488  //} else if (fID == -1) { // top level branch in non split mode
489  // char **ppointer = (char**)fAddress;
490  // fInfo->ReadBuffer(b,*ppointer,fID);
491  //}
492 
493  //m_out << "tools::rroot::branch_element::read_leaves :"
494  // << " name " << m_name << " ref_cls " << fClassName << " :"
495  // << " type " << fType << " with ID " << fID << "."
496  // << " and then ?"
497  // << std::endl;
498 
499  // read object ?
500  bool created = false;
501  if(!m_obj) {
502  ifac::args args;
503  m_obj = m_fac.create(fClassName,args);
504  if(!m_obj) return false;
505  created = true;
506  }
507 
508  if(!m_obj->stream(a_buffer)){
509  m_out << "tools::rroot::branch_element::read_leaves :"
510  << " name " << m_name << " ref_cls " << fClassName << " :"
511  << " obj stream failed."
512  << std::endl;
513  if(created) {delete m_obj;m_obj = 0;}
514  return false;
515  }
516 
517  //m_out << "tools::rroot::branch_element::read_leaves :"
518  // << " name " << m_name << " ref_cls " << fClassName << " :"
519  // << " obj streamed."
520  // << std::endl;
521 
522  return true;
523 
524 // } else if(fType==0) {
525 // if(fID>=0) {
526 // // branch in split mode
527 // m_out << "tools::rroot::branch_element::read_leaves :"
528 // << " name " << m_name << " ref_cls " << fClassName << " :"
529 // << " type 0 with ID " << fID << "."
530 // << std::endl;
531 // return true;
532 //
533 // } else if(fID==-1) {
534 // // top level branch in non split mode
535 // m_out << "tools::rroot::branch_element::read_leaves :"
536 // << " name " << m_name << " ref_cls " << fClassName << " :"
537 // << " type 0 with ID " << fID
538 // << " : fill object."
539 // << std::endl;
540 
541 // if(!m_obj) {
542 // m_out << "tools::rroot::branch_element::read_leaves :"
543 // << " name " << m_name << " ref_cls " << fClassName << " :"
544 // << " m_obj is null."
545 // << std::endl;
546 // return false;
547 // }
548 // if(!m_obj->stream(a_buffer)){
549 // m_out << "tools::rroot::branch_element::read_leaves :"
550 // << " name " << m_name << " ref_cls " << fClassName << " :"
551 // << " obj stream failed."
552 // << std::endl;
553 // return false;
554 // }
555 // return true;
556 
557 // } else {
558 // m_out << "tools::rroot::branch_element::read_leaves :"
559 // << " name " << m_name << " ref_cls " << fClassName << " :"
560 // << " type 0 with ID " << fID << " not treated."
561 // << std::endl;
562 // return false;
563 // }
564 
565 // //LHCb files :
566 // } else if(fType==1) {
567 // // parent branch is a base class branch.
568 // // Ok, and then ?
569 // m_out << "tools::rroot::branch_element::read_leaves :"
570 // << " name " << m_name << " ref_cls " << fClassName << " :"
571 // << " type " << fType << " with ID " << fID << "."
572 // << std::endl;
573 // return true;
574 
575  } else {
576  m_out << "tools::rroot::branch_element::read_leaves :"
577  << " name " << m_name << " ref_cls " << fClassName << " :"
578  << " type " << fType << " with ID " << fID << "."
579  << " unknown case."
580  << std::endl;
581  return false;
582  }
583 */
584  }

◆ s_class()

static const std::string& tools::rroot::branch_element::s_class ( )
inlinestatic

Definition at line 21 of file branch_element.

21  {
22  static const std::string s_v("tools::rroot::branch_element");
23  return s_v;
24  }

◆ s_cls()

virtual const std::string& tools::rroot::branch_element::s_cls ( ) const
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 30 of file branch_element.

30 {return s_class();}

◆ show()

virtual bool tools::rroot::branch_element::show ( std::ostream &  a_out,
ifile a_file,
uint64  a_entry 
)
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 606 of file branch_element.

606  {
607  uint32 n;
608  if(!find_entry(a_file,a_entry,n)) return false;
609 
610  {std::string s;
611  uint32 len = uint32(name().size())+128;
612  sprintf(s,len," %-15s = ",name().c_str());
613  a_out << s;}
614 
615  a_out << m_obj << std::endl;
616 
617  return true;
618  //return parent::show(a_out,a_file,a_entry);
619  }

◆ stream()

virtual bool tools::rroot::branch_element::stream ( buffer a_buffer)
inlinevirtual

Reimplemented from tools::rroot::branch.

Definition at line 38 of file branch_element.

38  {
39  _clear();
40 
41  short v;
42  unsigned int s, c;
43  if(!a_buffer.read_version(v,s,c)) return false;
44 
45  //::printf("debug : inlib::branch_element::stream : version %d, count %d\n",v,c);
46 
47  if(!parent::stream(a_buffer)) {
48  m_out << "tools::rroot::branch_element::stream : parent::stream() failed." << std::endl;
49  return false;
50  }
51 
52  if(v<=7) {
53  if(!a_buffer.read(fClassName)) return false;
54  if(!a_buffer.read(fClassVersion)) return false;
55  if(!a_buffer.read(fID)) return false;
56  if(!a_buffer.read(fType)) return false;
57  if(!a_buffer.read(fStreamerType)) return false;
58  } else { //v>=8
59  if(!a_buffer.read(fClassName)) return false;
60  //::printf("debug : inlib::branch_element::stream : fClassName \"%s\"\n",fClassName.c_str());
61  std::string fParentName;
62  if(!a_buffer.read(fParentName)) return false;
63  //::printf("debug : inlib::branch_element::stream : fParentName \"%s\"\n",fParentName.c_str());
64  std::string fCloneName;
65  if(!a_buffer.read(fCloneName)) return false;
66  //::printf("debug : inlib::branch_element::stream : fCloneName \"%s\"\n",fCloneName.c_str());
67  int dummy_int;
68  if(!a_buffer.read(dummy_int)) return false; //fCheckSum
69  //::printf("debug : inlib::branch_element::stream : fCheckSum %d\n",dummy_int);
70 
71  if(v>=10) {
72  short dummy_short;
73  if(!a_buffer.read(dummy_short)) return false; //fClassVersion
74  //::printf("debug : inlib::branch_element::stream : fClassVersion %d\n",dummy_short);
75  } else {
76  if(!a_buffer.read(dummy_int)) return false; //fClassVersion
77  }
78 
79  if(!a_buffer.read(fID)) return false;
80  //::printf("debug : inlib::branch_element::stream : fID %d\n",fID);
81  if(!a_buffer.read(fType)) return false;
82  //::printf("debug : inlib::branch_element::stream : fType %d\n",fType);
83  if(!a_buffer.read(fStreamerType)) return false;
84  //::printf("debug : inlib::branch_element::stream : fStreamerType %d\n",fStreamerType);
85 
86  if(!a_buffer.read(dummy_int)) return false; //fMaximum
87  //::printf("debug : inlib::branch_element::stream : fMaximum %d\n",dummy_int);
88 
89  //TBranchElement* fBranchCount;
90  ifac::args args;
92  m_out << "tools::rroot::branch_element::stream : "
93  << "can't read fBranchCount."
94  << std::endl;
95  return false;
96  }
97 
98  //TBranchElement* fBranchCount2;
100  m_out << "tools::rroot::branch_element::stream : "
101  << "can't read fBranchCount2."
102  << std::endl;
103  _clear();
104  return false;
105  }
106 
107  }
108 
109  if(!a_buffer.check_byte_count(s,c,"TBranchElement")) {_clear();return false;}
110  return true;
111  }

◆ streamer_type()

int tools::rroot::branch_element::streamer_type ( ) const
inline

Definition at line 645 of file branch_element.

645 {return fStreamerType;}

◆ type()

int tools::rroot::branch_element::type ( ) const
inline

Definition at line 644 of file branch_element.

644 {return fType;}

Member Data Documentation

◆ fBranchCount

branch_element* tools::rroot::branch_element::fBranchCount
protected

Definition at line 715 of file branch_element.

◆ fBranchCount2

branch_element* tools::rroot::branch_element::fBranchCount2
protected

Definition at line 717 of file branch_element.

◆ fBranchCount2_created

bool tools::rroot::branch_element::fBranchCount2_created
protected

Definition at line 718 of file branch_element.

◆ fBranchCount_created

bool tools::rroot::branch_element::fBranchCount_created
protected

Definition at line 716 of file branch_element.

◆ fClassName

std::string tools::rroot::branch_element::fClassName
protected

Definition at line 710 of file branch_element.

◆ fClassVersion

int tools::rroot::branch_element::fClassVersion
protected

Definition at line 711 of file branch_element.

◆ fID

int tools::rroot::branch_element::fID
protected

Definition at line 712 of file branch_element.

◆ fNdata

int tools::rroot::branch_element::fNdata
protected

Definition at line 719 of file branch_element.

◆ fStreamerType

int tools::rroot::branch_element::fStreamerType
protected

Definition at line 714 of file branch_element.

◆ fType

int tools::rroot::branch_element::fType
protected

Definition at line 713 of file branch_element.

◆ m_obj

iro* tools::rroot::branch_element::m_obj
protected

Definition at line 708 of file branch_element.


The documentation for this class was generated from the following file:
tools::rroot::branch_element::fBranchCount2
branch_element * fBranchCount2
Definition: branch_element:717
tools::rroot::branch::m_out
std::ostream & m_out
Definition: branch:925
tools::rroot::branch_element::_clear
void _clear()
Definition: branch_element:703
tools::rroot::branch::m_name
std::string m_name
Definition: branch:935
tools::rroot::branch_element::fBranchCount
branch_element * fBranchCount
Definition: branch_element:715
tools::rroot::branch::cast
virtual void * cast(const std::string &a_class) const
Definition: branch:31
tools::rroot::iro::stream
virtual bool stream(buffer &)=0
tools::rroot::branch_element::fNdata
int fNdata
Definition: branch_element:719
tools::vec_data
const T * vec_data(const std::vector< T > &a_vec)
Definition: vdata:18
tools::rroot::branch_element_cid
cid branch_element_cid()
Definition: cids:25
tools::rroot::branch_element::find_entry
virtual bool find_entry(ifile &a_file, uint64 a_entry, uint32 &a_nbytes)
Definition: branch_element:586
tools::rroot::branch_element::fStreamerType
int fStreamerType
Definition: branch_element:714
tools::file::size
bool size(const std::string &a_file, long &a_size)
Definition: fsize:13
tools::rroot::pointer_stream
bool pointer_stream(buffer &a_buffer, ifac &a_fac, ifac::args &a_args, const std::string &a_T_class, T *&a_obj, bool &a_created)
Definition: buffer:646
tools::rroot::ifac::create
virtual iro * create(const std::string &a_class, const args &)=0
tools::rroot::branch::find_entry
virtual bool find_entry(ifile &a_file, uint64 a_entry, uint32 &a_nbytes)
Definition: branch:537
tools::rroot::branch_element::fClassName
std::string fClassName
Definition: branch_element:710
tools::rroot::branch::m_fac
ifac & m_fac
Definition: branch:926
tools::rroot::branch_element::fType
int fType
Definition: branch_element:713
tools::rroot::branch::stream
virtual bool stream(buffer &a_buffer)
Definition: branch:44
tools::rroot::branch::branch
branch(std::ostream &a_out, ifac &a_fac)
Definition: branch:768
tools::sprintf
bool sprintf(std::string &a_string, int a_length, const char *a_format,...)
Definition: sprintf:34
tools::rroot::branch_element::fID
int fID
Definition: branch_element:712
tools::rroot::branch::name
const std::string & name() const
Definition: branch:821
tools::rroot::branch::m_branches
obj_array< branch > m_branches
Definition: branch:939
tools::rroot::branch_element::fBranchCount2_created
bool fBranchCount2_created
Definition: branch_element:718
tools::rroot::branch_element::m_obj
iro * m_obj
Definition: branch_element:708
tools::rroot::ifac::args
std::map< char, void * > args
Definition: ifac:21
tools::rroot::branch_element::get_ndata
int get_ndata() const
Definition: branch_element:648
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::rroot::branch_element::s_class
static const std::string & s_class()
Definition: branch_element:21
tools::rroot::branch_element::fClassVersion
int fClassVersion
Definition: branch_element:711
tools::rroot::iro::s_cls
virtual const std::string & s_cls() const =0
tools::rroot::branch_element::fBranchCount_created
bool fBranchCount_created
Definition: branch_element:716
tools::uint32
unsigned int uint32
Definition: typedefs:71