Last change
on this file since 753 was 454, checked in by harald, 24 years ago |
Import the first sources of the MAGIC Analysis and Reconstruction Software.
T. Bretz and H. Kornmayer 20.December 2000
|
File size:
1.6 KB
|
Line | |
---|
1 | {
|
---|
2 |
|
---|
3 | //
|
---|
4 | // open the file
|
---|
5 | //
|
---|
6 | TFile input("test.root", "READ");
|
---|
7 |
|
---|
8 | //
|
---|
9 | // open the Run Header tree
|
---|
10 | //
|
---|
11 | TTree *runtree = (TTree*) input.Get("RunHeaders") ;
|
---|
12 | cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
|
---|
13 |
|
---|
14 | //
|
---|
15 | // create an instance of MRawRunHeader, enable the branch and
|
---|
16 | // read the header, print it
|
---|
17 | //
|
---|
18 | MRawRunHeader *runheader = new MRawRunHeader();
|
---|
19 | runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
|
---|
20 | runtree->GetEvent(0);
|
---|
21 | runheader->Print();
|
---|
22 |
|
---|
23 | //
|
---|
24 | // open the Data Tree
|
---|
25 | //
|
---|
26 | TTree *evttree = (TTree*) input.Get("Data") ;
|
---|
27 |
|
---|
28 | //
|
---|
29 | // create the instances of the data to read in
|
---|
30 | //
|
---|
31 | MRawEvtHeader *evtheader = new MRawEvtHeader();
|
---|
32 | MTime *evttime = new MTime();
|
---|
33 | MRawEvtData *evtdata = new MRawEvtData();
|
---|
34 | MRawCrateArray *evtcrate = new MRawCrateArray();
|
---|
35 |
|
---|
36 | //
|
---|
37 | // enable the corresponding branches
|
---|
38 | //
|
---|
39 | evttree->GetBranch("MRawEvtHeader")->SetAddress(&evtheader);
|
---|
40 | evttree->GetBranch("MTime")->SetAddress(&evttime);
|
---|
41 | evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata);
|
---|
42 | evttree->GetBranch("MRawCrateArray")->SetAddress(&evtcrate);
|
---|
43 |
|
---|
44 | //
|
---|
45 | // loop over all events and print the information
|
---|
46 | //
|
---|
47 | Int_t iEnt = evttree->GetEntries();
|
---|
48 | cout << " Entries in Tree Data: " << iEnt << endl;
|
---|
49 |
|
---|
50 | for (Int_t i = 0; i<iEnt; i++)
|
---|
51 | {
|
---|
52 | // readin event with the selected branches
|
---|
53 | evttree->GetEvent(i);
|
---|
54 |
|
---|
55 | evtheader->Print();
|
---|
56 | evttime->Print();
|
---|
57 | evtcrate->Print();
|
---|
58 | evtdata->Print();
|
---|
59 | }
|
---|
60 | }
|
---|
61 |
|
---|
62 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.