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

Last change on this file since 2410 was 2410, 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 void AddPixel(Int_t idx, Float_t nph, Float_t er)
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 fLut.Set(idx+1);
42
43 fLut[idx] = fNumPixels;
44 new ((*fPixels)[fNumPixels++]) MCerPhotPix(idx, nph, er);
45 }
46
47 void FixSize();
48
49 Bool_t IsPixelExisting(Int_t id) const;
50 Bool_t IsPixelUsed (Int_t id) const;
51 Bool_t IsPixelCore (Int_t id) const;
52
53 Float_t GetNumPhotonsMin(const MGeomCam *geom=NULL) const;
54 Float_t GetNumPhotonsMax(const MGeomCam *geom=NULL) const;
55
56 Float_t GetRatioMin(const MGeomCam *geom=NULL) const;
57 Float_t GetRatioMax(const MGeomCam *geom=NULL) const;
58
59 Float_t GetErrorPhotMin(const MGeomCam *geom=NULL) const;
60 Float_t GetErrorPhotMax(const MGeomCam *geom=NULL) const;
61
62 MCerPhotPix &operator[](int i) { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
63 MCerPhotPix &operator[](int i) const { return *(MCerPhotPix*)(fPixels->UncheckedAt(i)); }
64
65 void Scale(Double_t f) { fPixels->ForEach(MCerPhotPix, Scale)(f); }
66 void RemoveUnusedPixels();
67
68 MCerPhotPix *GetPixById(int idx) const;// { return idx>=0 && idx<fLut.GetSize() ? (MCerPhotPix*)(fPixels->UncheckedAt(fLut[idx])) : 0; } // Return a pointer to the pixel with the requested id. NULL if it doesn't exist.
69
70 void Reset();
71
72 void Print(Option_t *opt=NULL) const;
73 void Clear(Option_t *opt=NULL) { Reset(); }
74
75 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const;
76 void DrawPixelContent(Int_t num, TVirtualPad *pad=NULL) const;
77
78 ClassDef(MCerPhotEvt, 2) // class for an event containing cerenkov photons
79};
80
81#endif
Note: See TracBrowser for help on using the repository browser.