1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: ParentBunch.cc 1807 2005-05-02 17:21:53Z moreggia $ |
---|
3 | // Author: Anne Stutz Aug, 23 2004 |
---|
4 | |
---|
5 | #include "ParentBunch.hh" |
---|
6 | #include "BunchOfPhotons.hh" |
---|
7 | #include <stdexcept> |
---|
8 | |
---|
9 | ClassImp(ParentBunch) |
---|
10 | |
---|
11 | //_____________________________________________________________________________ |
---|
12 | ParentBunch::ParentBunch(const ParentBunch& pb): |
---|
13 | fLateralDist(0), fAngularDist(0), fHistoLateral(0), fHistoAngular(0) { |
---|
14 | // |
---|
15 | // Copy Constructor |
---|
16 | // |
---|
17 | |
---|
18 | pb.Copy(*this); |
---|
19 | } |
---|
20 | |
---|
21 | //_____________________________________________________________________________ |
---|
22 | ParentBunch::ParentBunch(const Double_t weight,const Double_t yield, |
---|
23 | const EarthVector& showerposi,const EarthVector& showerposf, |
---|
24 | const Double_t datei,const Double_t datef, const EsafSpectrum& spectrum, |
---|
25 | const EarthVector& axis) : |
---|
26 | fLateralDist(0), fAngularDist(0), fHistoLateral(0), fHistoAngular(0) { |
---|
27 | // |
---|
28 | // Constructor useful when there is no longitudinal extension |
---|
29 | // |
---|
30 | fWeight = weight; // bunch weight |
---|
31 | fYield = yield; // bunch yield |
---|
32 | fShowerPosi = showerposi; // 3D coordinates of the first point of the bunch |
---|
33 | fShowerPosf = showerposf; // 3D coordinates of the last point of the bunch |
---|
34 | fAxis = axis; |
---|
35 | fDatei = datei; // time of passage at fShowerPosi |
---|
36 | fDatef = datef; // time of passage at fShowerPosf |
---|
37 | |
---|
38 | spectrum.Copy(fWlSpectrum); |
---|
39 | } |
---|
40 | |
---|
41 | //______________________________________________________________________________ |
---|
42 | void ParentBunch::Copy(ParentBunch& o) const { |
---|
43 | // |
---|
44 | // Copy this to |
---|
45 | // |
---|
46 | |
---|
47 | o.fWeight = fWeight; |
---|
48 | o.fYield = fYield; |
---|
49 | o.fShowerPosi = fShowerPosi; |
---|
50 | o.fShowerPosf = fShowerPosf; |
---|
51 | o.fAxis = fAxis; |
---|
52 | o.fDatei = fDatei; |
---|
53 | o.fDatef = fDatef; |
---|
54 | |
---|
55 | SafeDelete(o.fLateralDist); |
---|
56 | SafeDelete(o.fAngularDist); |
---|
57 | SafeDelete(o.fHistoLateral); |
---|
58 | SafeDelete(o.fHistoAngular); |
---|
59 | |
---|
60 | if ( fLateralDist ) o.fLateralDist = new TF12(*fLateralDist); |
---|
61 | |
---|
62 | if ( fAngularDist ) o.fAngularDist = new TF12(*fAngularDist); |
---|
63 | |
---|
64 | if ( fHistoLateral ) o.fHistoLateral = new TH1F(*fHistoLateral); |
---|
65 | |
---|
66 | if ( fHistoAngular ) o.fHistoAngular = new TH1F(*fHistoAngular); |
---|
67 | |
---|
68 | fWlSpectrum.Copy(o.fWlSpectrum); |
---|
69 | } |
---|
70 | |
---|
71 | //_____________________________________________________________________________ |
---|
72 | ParentBunch::~ParentBunch() { |
---|
73 | // |
---|
74 | // Destructor |
---|
75 | // |
---|
76 | |
---|
77 | SafeDelete(fLateralDist); |
---|
78 | SafeDelete(fAngularDist); |
---|
79 | SafeDelete(fHistoLateral); |
---|
80 | SafeDelete(fHistoAngular); |
---|
81 | } |
---|
82 | |
---|
83 | //_____________________________________________________________________________ |
---|
84 | void ParentBunch::SetHistoLateral( const TH1F& ld) { |
---|
85 | if ( fHistoLateral ) delete fHistoLateral; |
---|
86 | fHistoLateral = new TH1F(ld); |
---|
87 | } |
---|
88 | |
---|
89 | //_____________________________________________________________________________ |
---|
90 | void ParentBunch::SetHistoAngular( const TH1F& ad) { |
---|
91 | if ( fHistoAngular ) delete fHistoAngular; |
---|
92 | fHistoAngular = new TH1F(ad); |
---|
93 | } |
---|
94 | |
---|