1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: OADBPhotons.cc 496 2004-03-23 16:43:10Z thea $ |
---|
3 | // A.Thea, J.Watts created Mar, 16 2004 |
---|
4 | |
---|
5 | #include "OADBPhotons.hh" |
---|
6 | #include "Photon.hh" |
---|
7 | |
---|
8 | ClassImp(OADBPhotons) |
---|
9 | |
---|
10 | // ctor |
---|
11 | OADBPhotons::OADBPhotons(): fLambda(0), fThetaFoV(0), fAngleId(-1), fWlId(-1), |
---|
12 | fNumPhotons(0), fThroughput(NULL), fXOut(NULL), fYOut(NULL), fThetaOut(NULL), |
---|
13 | fPhiOut(NULL) { |
---|
14 | } |
---|
15 | |
---|
16 | // dtor |
---|
17 | OADBPhotons::~OADBPhotons() { |
---|
18 | } |
---|
19 | |
---|
20 | |
---|
21 | Bool_t OADBPhotons::SetSize(Int_t s) { |
---|
22 | if ( s == fNumPhotons ) |
---|
23 | return kTRUE; |
---|
24 | fNumPhotons = s; |
---|
25 | |
---|
26 | if ( fThroughput ) delete [] fThroughput; |
---|
27 | if ( fXOut ) delete [] fXOut; |
---|
28 | if ( fYOut ) delete [] fYOut; |
---|
29 | if ( fThetaOut ) delete [] fThetaOut; |
---|
30 | if ( fPhiOut ) delete [] fPhiOut; |
---|
31 | |
---|
32 | fThroughput = new Float_t[fNumPhotons]; |
---|
33 | fXOut = new Float_t[fNumPhotons]; |
---|
34 | fYOut = new Float_t[fNumPhotons]; |
---|
35 | fThetaOut = new Float_t[fNumPhotons]; |
---|
36 | fPhiOut = new Float_t[fNumPhotons]; |
---|
37 | |
---|
38 | Clean(); |
---|
39 | |
---|
40 | return kTRUE; |
---|
41 | } |
---|
42 | |
---|
43 | // clean all the photons |
---|
44 | void OADBPhotons::Clean() { |
---|
45 | for(Int_t i(0); i<fNumPhotons; i++) { |
---|
46 | fThroughput[i] = -1; |
---|
47 | fXOut[i] = 0; |
---|
48 | fYOut[i] = 0; |
---|
49 | fThetaOut[i] = -1; |
---|
50 | fPhiOut[i] = -1; |
---|
51 | } |
---|
52 | } |
---|
53 | |
---|
54 | // save photon's data in the i-th position |
---|
55 | Bool_t OADBPhotons::SavePhoton(Int_t i,Photon *ph, Float_t tr) { |
---|
56 | if ( i< 0 || i >= fNumPhotons ) { |
---|
57 | cout << "OADBPhotons::SavePhoton: index out of range" << i << " vs " << fNumPhotons << endl; |
---|
58 | return kFALSE; |
---|
59 | } |
---|
60 | fThroughput[i] = tr; |
---|
61 | fXOut[i]=ph->pos.X(); |
---|
62 | fYOut[i]=ph->pos.Y(); |
---|
63 | fThetaOut[i] = ph->dir.Theta(); |
---|
64 | fPhiOut[i] = ph->dir.Phi(); |
---|
65 | return kTRUE; |
---|
66 | |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | // create a dead entry in the database |
---|
71 | Bool_t OADBPhotons::SaveGhost(Int_t i) { |
---|
72 | if ( i< 0 || i >= fNumPhotons ) { |
---|
73 | cout << "OADBPhotons::SaveGhost: index out of range " << i << " vs " << fNumPhotons<< endl; |
---|
74 | return kFALSE; |
---|
75 | } |
---|
76 | fThroughput[i] = -1; |
---|
77 | fXOut[i] = 0; |
---|
78 | fYOut[i] = 0; |
---|
79 | fThetaOut[i] = -1; |
---|
80 | fPhiOut[i] = -1; |
---|
81 | return kTRUE; |
---|
82 | |
---|
83 | } |
---|
84 | |
---|