]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TGeant4/TG4G3Defaults.cxx
Changes by Massimo Masera to allow Recpoints and Clusters to be written
[u/mrichter/AliRoot.git] / TGeant4 / TG4G3Defaults.cxx
1 // $Id$
2 // Category: global
3 //
4 // Author: I. Hrivnacova
5 //
6 // Class TG4G3Defaults
7 // -------------------
8 // See the class description in the header file.
9
10 #include "TG4G3Defaults.h"
11 #include "TG4Globals.h"
12
13 #include <math.h>
14
15 // static data members
16
17 TG4G3Defaults* TG4G3Defaults::fgInstance = 0;
18
19 //_____________________________________________________________________________
20 TG4G3Defaults::TG4G3Defaults() {
21 //
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
59 }
60   
61 //_____________________________________________________________________________
62 TG4G3Defaults::TG4G3Defaults(const TG4G3Defaults& right) {
63 // 
64   TG4Globals::Exception(
65     "Attempt to copy TG4G3Defaults singleton.");
66 }
67
68 //_____________________________________________________________________________
69 TG4G3Defaults::~TG4G3Defaults() {
70 //
71 }
72
73 // operators
74
75 //_____________________________________________________________________________
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
90 {
91 // Returns the G3 default value for the specified cut.
92 // ---
93
94   return fCutVector[g3Cut];
95 }          
96
97 //_____________________________________________________________________________
98 TG4G3ControlValue TG4G3Defaults::ControlValue(G4int control) const
99 {
100 // Returns the G3 default value for the specified control.
101 // ---
102
103   return fControlVector[control];
104 }          
105
106 //_____________________________________________________________________________
107 G4bool TG4G3Defaults::IsDefaultCut(TG4G3Cut cut, G4double value) const
108 {
109 // Tests if the parameter value is equal to the G3 default value.
110 // ---
111
112   if (abs(value*GeV - CutValue(cut)) > TG4G3CutVector::Tolerance()) 
113     return false;
114   else  
115     return true;
116 }
117
118 //_____________________________________________________________________________
119 G4bool TG4G3Defaults::IsDefaultControl(TG4G3Control control,
120                                        TG4G3ControlValue value) const
121 {
122 // Tests if the parameter value is equal to the G3 default value.
123 // ---
124
125   if (value == ControlValue(control)) 
126     return true;
127   else  
128     return false;
129 }