FEDRA emulsion software from the OPERA Collaboration
t2.C File Reference

Functions

void testread ()
 
void testwrite ()
 

Function Documentation

◆ testread()

void testread ( )
61 {
62  //----------------------------------------------------------CHECK
63  EdbRun *run2;
64  run2 =new EdbRun("prova.root","READ");
65  int nviews2 = run2->GetEntries();
66 
67  int nseg=0;
68  for(int v=0;v<nviews2;v++)
69  {
70  EdbView* View = run2->GetEntry(v);
71  nseg = View->Nsegments();
72  for(int j=0;j<nseg;j++)
73  {
74  EdbSegment* seg = View->GetSegment(j);
75  cout <<"v: "<<v<<" j: "<<j<<" ID: "<< seg->GetID()<<"\t";
76  cout<<"\t\tNel: "<<seg->GetNelements() <<endl;
77  }
78  }
79  //-------------------------------------------------- GetNelements return 0,> WHY???
80 }
Definition: EdbRun.h:74
int GetEntries() const
Definition: EdbRun.h:135
EdbView * GetEntry(int entry, int ih=1, int icl=0, int iseg=1, int itr=0, int ifr=0)
Definition: EdbRun.cxx:489
Definition: EdbSegment.h:61
Int_t GetNelements() const
Definition: EdbSegment.h:112
Int_t GetID() const
Definition: EdbSegment.h:90
Definition: EdbView.h:134
Definition: tlg2pattern.C:90

◆ testwrite()

void testwrite ( )
2 {
3  char* edbname = "prova.root";
4 
5  EdbRun *run =new EdbRun(edbname,"RECREATE");
6  EdbView *edbView;
7  edbView= run->GetView();
8 
9  int nviews=30;
10  int nsegments =200;
11  int npoints=14;
12 
13  int ntracks=0;
14  int nclusters=0;
15  int s=1;
16 
17  float x, y, z, tx, ty, dz;
18  int side, puls , id;
19 
20  for (int v = 0; v < nviews; v++)
21  {
22  edbView->Clear();
23  for (int t = 0; t < nsegments; t++)
24  {
25  EdbSegment* edbSegment = new EdbSegment();
26  int id = ntracks++;
27  x=y=t;
28  edbSegment->Set(x, y, z, tx, ty, dz, side, puls , id);
29  for (int n=0; n<npoints+v; n++)
30  {
31  EdbCluster* edbCluster = new EdbCluster(t,t,50*s+n,0, 0, 0, 0, id);
32  edbSegment->AddElement(edbCluster); // <----------------- ?
33  edbView->AddCluster(edbCluster);
34  nclusters++;
35  }
36  edbView->AddSegment(edbSegment);
37  }
38  run->AddView(edbView);
39  }
40 
41  //---------------------------------------------------------- CHECK
42  int nseg=0;
43  for(v=0;v<nviews;v++)
44  {
45  EdbView* View = run->GetEntry(v);
46  nseg = View->Nsegments();
47  for(int j=0;j<nseg;j++)
48  {
49  EdbSegment* seg = View->GetSegment(j);
50  cout <<"view: "<<v<<" seg: "<<j<<" ID: "<< seg->GetID()<<"\t";
51  cout<<"\t\tNel: "<<seg->GetNelements() <<endl;
52  }
53  }
54  //----------------------------------------------------------- OK GetNelements not 0
55 
56  run->Close();
57  delete run; //<---- close everything (or exit ...)
58 }
brick dz
Definition: RecDispMC.C:107
TTree * t
Definition: check_shower.C:4
Definition: EdbCluster.h:19
void Close()
Definition: EdbRun.cxx:466
void AddView()
Definition: EdbRun.cxx:332
EdbView * GetView() const
Definition: EdbRun.h:109
void AddElement(TObject *element)
Definition: EdbSegment.cxx:149
void Set(float x, float y, float z, float tx, float ty, float dz=0, int side=0, int puls=0, int id=0)
Definition: EdbSegment.cxx:92
EdbSegment * AddSegment(float x, float y, float z, float tx, float ty, float dz=0, int side=0, int puls=0, int id=-1)
Definition: EdbView.h:231
EdbCluster * AddCluster(EdbCluster *c)
Definition: EdbView.h:225
void Clear()
Definition: EdbView.cxx:79
EdbRun * run
Definition: check_raw.C:38
UInt_t id
Definition: tlg2pattern.C:118
EdbSegP * s
Definition: tlg2pattern.C:32