Diana Software
QBaseTree.cc
Go to the documentation of this file.
1 #include "QBaseTree.hh"
2 #include "QTreeInfo.hh"
3 #include <TList.h>
4 #include <iostream>
5 
7 
9 
10 }
11 
12 
13 QBaseTree::QBaseTree(QTreeType type, const char* title): TTree(QTREE_NAME, title, 99) {
14 
15  if(type == QTREE) GetTreeInfo().fType = 0;
16  else if(type == QATREE) GetTreeInfo().fType = 1;
17  else if(type == QITREE) GetTreeInfo().fType = 2;
18 }
19 
20 
22 {
23  TObject* obj = GetUserInfo()->FindObject("QTreeInfo");
24  if(!obj) {
25  obj = new QTreeInfo;
26  GetUserInfo()->AddLast(obj);
27  }
28  QTreeInfo* sobj = dynamic_cast<QTreeInfo*>(obj);
29  if(!sobj) std::cout<<"Error: object with name QTreeInfo is not of type QTreeInfo"<<std::endl;
30  return *sobj;
31 
32 }
33 
34 void QBaseTree::Streamer(TBuffer &R__b)
35 {
36 
37  if (R__b.IsReading()) {
38  UInt_t R__s, R__c;
39  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
40  if(R__v < 2) {
41  TTree::Streamer(R__b);
42  Int_t t;
43  R__b>>t;
44  if(t == 0) GetTreeInfo().fType = QTREE;
45  else if(t == 1) GetTreeInfo().fType = QATREE;
46  else if(t == 2) GetTreeInfo().fType = QITREE;
47  } else {
48  R__b.ReadClassBuffer(QBaseTree::Class(), this, R__v, R__s, R__c);
49 
50  }
51  } else {
52  QBaseTree::Class()->WriteBuffer(R__b, this);
53  }
54 }
ClassImp(QBaseTree)
#define QTREE_NAME
Definition: QBaseTree.hh:18
abstract class for diana trees
Definition: QBaseTree.hh:27
QBaseTree()
Definition: QBaseTree.cc:8
QTreeInfo & GetTreeInfo()
Definition: QBaseTree.cc:21
Int_t fType
Definition: QTreeInfo.hh:13