source: tags/Mars-V0.4/macros/readpix.C

Last change on this file was 457, checked in by tbretz, 24 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#include <iomanip>
2
3void readpix() {
4 //
5 // open the file
6 //
7 TFile input("delme.root", "READ");
8
9 //
10 // open the Run Header tree
11 //
12 TTree *runtree = (TTree*) input.Get("RunHeaders") ;
13 cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
14
15 //
16 // create an instance of MRawRunHeader, enable the branch and
17 // read the header, print it
18 //
19 MRawRunHeader *runheader = new MRawRunHeader();
20 runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
21 runtree->GetEvent(0);
22 runheader->Print();
23
24 //
25 // open the Data Tree
26 //
27 TTree *evttree = (TTree*) input.Get("Data") ;
28
29 //
30 // create the instances of the data to read in
31 //
32 MRawEvtData *evtdata = new MRawEvtData();
33
34 //
35 // enable the corresponding branches
36 //
37 evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata);
38
39 evttree->GetEvent(0);
40
41 MRawEvtPixelIter pixel(evtdata);
42
43 while (pixel.Next())
44 {
45
46 cout << "Pixel Nr: " << dec << pixel.GetPixelId() << " ";
47 cout << setfill('0') << endl;
48
49 cout << "Hi Gains: ";
50 for (int i=0; i<evtdata->GetNumHiGainSamples(); i++)
51 cout << setw(3) << (UInt_t)pixel.GetHiGainFadcSamples()[i];
52 cout << endl;
53
54 cout << "Lo Gains: ";
55 if (pixel.IsLoGain())
56 for (int i=0; i<evtdata->GetNumLoGainSamples(); i++)
57 cout << setw(3) << (UInt_t)pixel.GetLoGainFadcSamples()[i];
58 cout << endl << endl;
59
60 if (pixel.GetPixelId() == 11)
61 pixel.Draw();
62 };
63}
64
65
66
67
Note: See TracBrowser for help on using the repository browser.