]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
73dd85b2 | 2 | // Category: global |
2817d3e2 | 3 | // |
e5967ab3 | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4G3Defaults | |
7 | // ------------------- | |
2817d3e2 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4G3Defaults.h" | |
11 | #include "TG4Globals.h" | |
12 | ||
13 | #include <math.h> | |
14 | ||
e5967ab3 | 15 | // static data members |
16 | ||
17 | TG4G3Defaults* TG4G3Defaults::fgInstance = 0; | |
2817d3e2 | 18 | |
73dd85b2 | 19 | //_____________________________________________________________________________ |
2817d3e2 | 20 | TG4G3Defaults::TG4G3Defaults() { |
21 | // | |
e5967ab3 | 22 | if (fgInstance) { |
23 | TG4Globals::Exception( | |
24 | "TG4G3Defaults: attempt to create two instances of singleton."); | |
25 | } | |
26 | ||
27 | fgInstance = this; | |
28 | ||
29 | // fill cut vector with default values | |
30 | ||
31 | fCutVector.SetCut(kCUTGAM, 0.001 * GeV); | |
32 | fCutVector.SetCut(kCUTELE, 0.001 * GeV); | |
33 | fCutVector.SetCut(kCUTNEU, 0.01 * GeV); | |
34 | fCutVector.SetCut(kCUTHAD, 0.01 * GeV); | |
35 | fCutVector.SetCut(kCUTMUO, 0.01 * GeV); | |
36 | fCutVector.SetCut(kBCUTE, fCutVector[kCUTGAM]); | |
37 | fCutVector.SetCut(kBCUTM, fCutVector[kCUTGAM]); | |
38 | fCutVector.SetCut(kDCUTE, 10. * TeV); | |
39 | fCutVector.SetCut(kDCUTM, 10. * TeV); | |
40 | fCutVector.SetCut(kPPCUTM, 0.01 * GeV); | |
41 | ||
42 | // fill control vector with default values | |
43 | fControlVector.SetControl(kPAIR, kActivate, fCutVector); // 1 | |
44 | fControlVector.SetControl(kCOMP, kActivate, fCutVector); // 1 | |
45 | fControlVector.SetControl(kPHOT, kActivate, fCutVector); // 1 | |
46 | fControlVector.SetControl(kPFIS, kInActivate, fCutVector); // 0 | |
47 | fControlVector.SetControl(kDRAY, kInActivate, fCutVector); // 0 | |
48 | fControlVector.SetControl(kANNI, kActivate, fCutVector); // 1 | |
49 | fControlVector.SetControl(kBREM, kActivate, fCutVector); // 1 | |
50 | fControlVector.SetControl(kHADR, kActivate, fCutVector); // 1 | |
51 | fControlVector.SetControl(kMUNU, kInActivate, fCutVector); // 0 | |
52 | fControlVector.SetControl(kDCAY, kActivate, fCutVector); // 1 | |
53 | fControlVector.SetControl(kLOSS, kActivate2, fCutVector); // 2 | |
54 | fControlVector.SetControl(kMULS, kActivate, fCutVector); // 1 | |
55 | fControlVector.SetControl(kCKOV, kInActivate, fCutVector); // 0 | |
56 | fControlVector.SetControl(kRAYL, kInActivate, fCutVector); // 0 | |
57 | fControlVector.SetControl(kLABS, kInActivate, fCutVector); // 0 | |
58 | fControlVector.SetControl(kSYNC, kInActivate, fCutVector); // 0 | |
2817d3e2 | 59 | } |
60 | ||
e5967ab3 | 61 | //_____________________________________________________________________________ |
62 | TG4G3Defaults::TG4G3Defaults(const TG4G3Defaults& right) { | |
63 | // | |
64 | TG4Globals::Exception( | |
65 | "Attempt to copy TG4G3Defaults singleton."); | |
66 | } | |
67 | ||
73dd85b2 | 68 | //_____________________________________________________________________________ |
2817d3e2 | 69 | TG4G3Defaults::~TG4G3Defaults() { |
70 | // | |
71 | } | |
72 | ||
e5967ab3 | 73 | // operators |
74 | ||
73dd85b2 | 75 | //_____________________________________________________________________________ |
e5967ab3 | 76 | TG4G3Defaults& |
77 | TG4G3Defaults::operator=(const TG4G3Defaults& right) | |
78 | { | |
79 | // check assignement to self | |
80 | if (this == &right) return *this; | |
81 | ||
82 | TG4Globals::Exception( | |
83 | "Attempt to assign TG4G3Defaults singleton."); | |
84 | ||
85 | return *this; | |
86 | } | |
87 | ||
88 | //_____________________________________________________________________________ | |
89 | G4double TG4G3Defaults::CutValue(G4int g3Cut) const | |
2817d3e2 | 90 | { |
91 | // Returns the G3 default value for the specified cut. | |
92 | // --- | |
93 | ||
e5967ab3 | 94 | return fCutVector[g3Cut]; |
2817d3e2 | 95 | } |
96 | ||
73dd85b2 | 97 | //_____________________________________________________________________________ |
e5967ab3 | 98 | TG4G3ControlValue TG4G3Defaults::ControlValue(G4int control) const |
2817d3e2 | 99 | { |
9187be37 | 100 | // Returns the G3 default value for the specified control. |
2817d3e2 | 101 | // --- |
102 | ||
e5967ab3 | 103 | return fControlVector[control]; |
2817d3e2 | 104 | } |
105 | ||
73dd85b2 | 106 | //_____________________________________________________________________________ |
e5967ab3 | 107 | G4bool TG4G3Defaults::IsDefaultCut(TG4G3Cut cut, G4double value) const |
2817d3e2 | 108 | { |
109 | // Tests if the parameter value is equal to the G3 default value. | |
110 | // --- | |
111 | ||
e5967ab3 | 112 | if (abs(value*GeV - CutValue(cut)) > TG4G3CutVector::Tolerance()) |
2817d3e2 | 113 | return false; |
114 | else | |
115 | return true; | |
116 | } | |
117 | ||
73dd85b2 | 118 | //_____________________________________________________________________________ |
9187be37 | 119 | G4bool TG4G3Defaults::IsDefaultControl(TG4G3Control control, |
e5967ab3 | 120 | TG4G3ControlValue value) const |
2817d3e2 | 121 | { |
122 | // Tests if the parameter value is equal to the G3 default value. | |
123 | // --- | |
124 | ||
9187be37 | 125 | if (value == ControlValue(control)) |
2817d3e2 | 126 | return true; |
127 | else | |
128 | return false; | |
129 | } |