source: trunk/MagicSoft/Mars/mraw/MRawEvtPixelIter.cc@ 458

Last change on this file since 458 was 456, checked in by tbretz, 24 years ago
2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog. 2000/12/23: Thomas Bretz, changes see Changelog.
File size: 2.8 KB
Line 
1///////////////////////////////////////////////////////////////////////////////
2//
3// MRawEvtPixelIter
4//
5// class to iterate over all pixels of one event.
6// The calling is similar to a root iterator:
7//
8// MRawEvtData *evtdata; // must be filled with data from somewhere
9// MRawEvtPixelIter pixel(evtdata); // evtdata: ptr to event you want to iterate
10//
11// while (pixel.Next())
12// {
13// // here you can access the actual time slices by using
14// // pixel.GetPixelId();
15// // pixel.GetHiGainFadcSamples()[i]; // i is the number of the slice
16// // pixel.IsLoGain(); // check if pixel has
17// // pixel.GetLoGainFadcSamples()[i]; // i is the number of the slice
18//
19// // WARNING: Don't acces more time slices than available.
20// // Get the numbers by calling: evtdata->GetNum[Lo,Hi]GainSamples()
21// // This number is constant for one event
22// }
23//
24///////////////////////////////////////////////////////////////////////////////
25#include "MRawEvtPixelIter.h"
26
27#include "MRawEvtData.h"
28
29#include "MArrayS.h"
30#include "MArrayB.h"
31
32ClassImp(MRawEvtPixelIter)
33
34MRawEvtData *MRawEvtPixelIter::Next()
35{
36 //
37 // if we are already at the last entry there is no 'next' entry anymore
38 //
39 if (fNumHiGainEntry==fData->fHiGainPixId->GetSize())
40 return NULL;
41
42 //
43 // if we are already at the last entry there is no 'next' entry anymore
44 //
45 if (fNumLoGainEntry != fData->fLoGainPixId->GetSize())
46 if (*fHiGainId == *fLoGainId)
47 {
48 //
49 // if higainpixid and logainpixid of the actual pixel are
50 // identical then we have to move the pointer to the next
51 // entry in the lo gains
52 //
53 fNumLoGainEntry++;
54 fLoGainId++;
55 fLoGainPos += fData->GetNumLoGainSamples();
56 }
57
58 //
59 // here we have to move the pointer to the next entry in the hi gains
60 //
61 fNumHiGainEntry++;
62 fHiGainId++;
63 fHiGainPos += fData->GetNumHiGainSamples();
64
65 //
66 // return a pointer to the 'source' class if we succeed
67 //
68 return fData;
69}
70
71void MRawEvtPixelIter::Reset()
72{
73 //
74 // set counter to zero
75 //
76 fNumLoGainEntry = 0;
77 fNumHiGainEntry = 0;
78
79 //
80 // set pointer to first entry of arrays
81 //
82 fHiGainId = fData->fHiGainPixId->GetArray()-1;
83 fLoGainId = fData->fLoGainPixId->GetArray()-1;
84 fHiGainPos = fData->fHiGainFadcSamples->GetArray()-fData->GetNumHiGainSamples();
85 fLoGainPos = fData->fLoGainFadcSamples->GetArray()-fData->GetNumLoGainSamples();
86}
87
88void MRawEvtPixelIter::Draw(Option_t *t)
89{
90 //
91 // Draw the actual pixel (for options see: MRawEvtData::Draw)
92 //
93 char *txt = new char[6+strlen(t)];
94 sprintf(txt, "%s%d", t, *fHiGainId);
95 fData->Draw(txt);
96 delete txt;
97}
98
99
100
101
102
103
Note: See TracBrowser for help on using the repository browser.