source: trunk/MagicSoft/Mars/manalysis/MCerPhotEvt.h@ 2893

Last change on this file since 2893 was 2502, checked in by tbretz, 21 years ago
*** empty log message ***
File size: 2.5 KB
Line 
1#ifndef MARS_MCerPhotEvt
2#define MARS_MCerPhotEvt
3
4#ifndef ROOT_TClonesArray
5#include <TClonesArray.h>
6#endif
7#ifndef ROOT_TArrayI
8#include <TArrayI.h>
9#endif
10#ifndef MARS_MCamEvent
11#include "MCamEvent.h"
12#endif
13#ifndef MARS_MCerPhotPix
14#include "MCerPhotPix.h"
15#endif
16
17class MGeomCam;
18class MCerPhotPix;
19
20class MCerPhotEvt : public MCamEvent
21{
22private:
23 UInt_t fNumPixels;
24 TArrayI fLut; // Lookup tabel to lookup pixel by index
25 TClonesArray *fPixels; //-> FIXME: Change TClonesArray away from a pointer?
26
27public:
28 MCerPhotEvt(const char *name=NULL, const char *title=NULL);
29 ~MCerPhotEvt() { delete fPixels; }
30
31 UInt_t GetNumPixels() const { return fNumPixels; }
32 //void InitSize(UInt_t num) { fPixels->Expand(num); }
33
34 MCerPhotPix *AddPixel(Int_t idx, Float_t nph=0, Float_t er=0)
35 {
36 //
37 // If this is too slow or takes to much space we might use
38 // MGeomApply and an InitSize member function instead.
39 //
40 if (idx>=fLut.GetSize())
41 {
42 const Int_t n = fLut.GetSize();
43 fLut.Set(idx+1);
44 for (int i=n; i<idx; i++)
45 fLut[i] = -1;
46 }
47
48 fLut[idx] = fNumPixels;
49 return new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er);
50 }
51
52 void FixSize();
53
54 Bool_t IsPixelExisting(Int_t id) const;
55 Bool_t IsPixelUsed (Int_t id) const;
56 Bool_t IsPixelCore (Int_t id) const;
57
58 Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
59 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
60
61 Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
62 Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
63
64 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
65 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
66
67 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
68 MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
69
70 void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
71 void RemoveUnusedPixels();
72
73 MCerPhotPix *GetPixById(Int_t idx) const;
74
75 void Reset();
76
77 void Print(Option_t *opt=NULL) const;
78 void Clear(Option_t *opt=NULL) { Reset(); }
79
80 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
81 void DrawPixelContent(Int_t num) const;
82
83 ClassDef(MCerPhotEvt, 2) // class for an event containing cerenkov photons
84};
85
86#endif
Note: See TracBrowser for help on using the repository browser.