source: releases/Mars.2014.05.26/macros/tutorials/readpix.C@ 19594

Last change on this file since 19594 was 7159, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 2.5 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Thomas Bretz 12/2000 (tbretz@uni-sw.gwdg.de)
19!
20! Copyright: MAGIC Software Development, 2000-2001
21!
22!
23\* ======================================================================== */
24
25
26#include <iomanip>
27
28void readpix()
29{
30 //
31 // open the file
32 //
33 TFile input("delme.root", "READ");
34
35 //
36 // open the Run Header tree
37 //
38 TTree *runtree = (TTree*) input.Get("RunHeaders") ;
39
40 if (!runtree)
41 return;
42
43 cout << " Entries in Tree RunHeaders: " << runtree->GetEntries() << endl ;
44
45 //
46 // create an instance of MRawRunHeader, enable the branch and
47 // read the header, print it
48 //
49 MRawRunHeader *runheader = new MRawRunHeader();
50 runtree->GetBranch("MRawRunHeader")->SetAddress(&runheader);
51 runtree->GetEvent(0);
52 runheader->Print();
53
54 //
55 // open the Data Tree
56 //
57 TTree *evttree = (TTree*) input.Get("Data") ;
58
59 //
60 // create the instances of the data to read in
61 //
62 MRawEvtData *evtdata = new MRawEvtData();
63
64 //
65 // enable the corresponding branches
66 //
67 evttree->GetBranch("MRawEvtData")->SetAddress(&evtdata);
68
69 evttree->GetEvent(0);
70
71 MRawEvtPixelIter pixel(evtdata);
72
73 while (pixel.Next())
74 {
75
76 cout << "Pixel Nr: " << dec << pixel.GetPixelId() << " ";
77 cout << setfill('0') << endl;
78
79 cout << "Hi Gains: ";
80 for (int i=0; i<evtdata->GetNumHiGainSamples(); i++)
81 cout << setw(3) << (UInt_t)pixel.GetHiGainFadcSamples()[i];
82 cout << endl;
83
84 cout << "Lo Gains: ";
85 if (pixel.IsLoGain())
86 for (int i=0; i<evtdata->GetNumLoGainSamples(); i++)
87 cout << setw(3) << (UInt_t)pixel.GetLoGainFadcSamples()[i];
88 cout << endl << endl;
89
90 if (pixel.GetPixelId() == 11)
91 pixel.Draw();
92 };
93}
94
95
96
97
Note: See TracBrowser for help on using the repository browser.