Logo Coherent WaveBurst  
Reference Guide
Logo
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TestSetGetTreeDetector2.C
Go to the documentation of this file.
1 //
2 // Test set/get detector info to/from tree
3 // Author : Gabriele Vedovato
4 
5 {
6 
7  #define N_IFO 3
8  #define IFILE_NAME "test_streamer.root"
9 
10  char ifo[N_IFO][4]={"L1","H1","V1"};
11 
13  TFile ofile(IFILE_NAME,"RECREATE");
14  TTree *otree = new TTree("tree", "tree");
15 
17 
18  for(int n=0;n<N_IFO;n++) {
19  pD[n] = new detector(ifo[n]);
20  otree->GetUserInfo()->Add(pD[n]);
21  }
22  otree->Write();
23  ofile.Close();
24 
25  TFile ifile("test_streamer.root");
26  TTree* itree = (TTree *) gROOT->FindObject("tree");
27  TList* list = itree->GetUserInfo();
28  for (int n=0;n<list->GetSize();n++) {
29  detector* pDetector = (detector*)list->At(n);
30  detectorParams dParams = pDetector->getDetectorParams();
31  if(n==0) pDetector->print();
32  cout << dParams.name << endl;
33  //cout << pDetector->Name << endl;
34 cout << "----> DEB1" << endl;
35  detector* D = new detector(*pDetector);
36 cout << "----> DEB2" << endl;
37  D->print();
38 cout << "----> DEB3" << endl;
39 exit(0);
40  }
41  ifile.Close();
42 
43  detector* D = new detector(*pDetector);
44 
45  //detector V1("V1");
46  //V1.print();
47 
48  exit(0);
49 }
50 
detectorParams getDetectorParams()
Definition: detector.cc:201
detector * pD[N_IFO]
char name[32]
Definition: detector.hh:32
int n
Definition: cwb_net.C:10
#define IFILE_NAME
TFile ifile("test_streamer.root")
static bool checkFile(TString fName, bool question=false, TString message="")
Definition: Toolbox.cc:3956
char ifo[NIFO_MAX][8]
TTree * otree
#define N_IFO
detector * D
TFile ofile(IFILE_NAME,"RECREATE")
TTree * itree
void print()
Definition: detector.cc:1768
TList * list
exit(0)