/[PAMELA software]/PamVMC_update/include/PamVMCOptMgr.h
ViewVC logotype

Annotation of /PamVMC_update/include/PamVMCOptMgr.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Oct 15 15:52:30 2013 UTC (11 years, 1 month ago) by formato
Branch: MAIN, rel
CVS Tags: reltag, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
PamVMC update

1 formato 1.1 #ifndef PAMVMCOPTMGR_H
2     #define PAMVMCOPTMGR_H
3     #include <iostream>
4     #include <stdio.h>
5     #include <stdlib.h>
6    
7     #include <TSystem.h>
8     #include <TMap.h>
9     #include <TObjString.h>
10     #include <TDOMParser.h>
11     #include <TXMLAttr.h>
12     #include <TXMLNode.h>
13    
14    
15     #include "PamVMCOptions.h"
16     using namespace std;
17    
18     class PamVMCOptMgr: public TObject {
19    
20     private:
21    
22     static PamVMCOptMgr * fopt;
23     TMap foptmap;
24    
25     void SetOpt(const char *name, TObject *value){
26     foptmap.Add(new TObjString(name),value);
27     }
28    
29     void ParseOptions(TXMLNode *node);
30     pInitModeOpt * ParseInitOpt(TXMLNode *node);
31     pRandomModeOpt * ParseRandomOpt(TXMLNode *node);
32     pRuntimeModeOpt * ParseRuntimeOpt(TXMLNode *node);
33     pPrimaryModeOpt * ParsePrimaryOpt(TXMLNode *node);
34     protected:
35     PamVMCOptMgr(){
36     ParseOptions(0);
37     }
38    
39     public:
40    
41     ~PamVMCOptMgr(){ foptmap.DeleteAll(); }
42    
43     static PamVMCOptMgr * Instance();
44    
45     TObject * GetOpt(const char *name){
46     return foptmap(name);
47     }
48    
49     virtual void Print(const Option_t* = "") const { foptmap.Print(); }
50    
51     Int_t ParseFile(TString filename) {
52     TDOMParser *domParser = new TDOMParser();
53     Int_t parsecode = domParser->ParseFile(filename);
54    
55     if (parsecode < 0) {
56     cerr << domParser->GetParseCodeMessage(parsecode) << endl;
57     return -1;
58     }
59    
60     TXMLNode * node = domParser->GetXMLDocument()->GetRootNode();
61    
62     ParseOptions(node);
63    
64     return 0;
65     }
66    
67    
68     //Different getters
69    
70     //INIT Options
71     TString GetOutPath(){
72     return ((pInitModeOpt*)GetOpt("Init_mode_set"))->fout_path;
73     }
74     TString GetOutPattern(){
75     return ((pInitModeOpt*)GetOpt("Init_mode_set"))->fout_file_pattern;
76     }
77     TString GetOutPatternFull(){
78     TString tmp = ((pInitModeOpt*)GetOpt("Init_mode_set"))->fout_path;
79     tmp += "/";
80     tmp += ((pInitModeOpt*)GetOpt("Init_mode_set"))->fout_file_pattern;
81     return tmp;
82     }
83     TString GetTmpPath(){
84     return ((pInitModeOpt*)GetOpt("Init_mode_set"))->fout_tmp_dir;
85     }
86    
87     Bool_t IsUseCookie(){
88     return ((pInitModeOpt*)GetOpt("Init_mode_set"))->fuse_pbs_jobcookie;
89     }
90    
91     Bool_t IsNoCalo(){
92     return ((pInitModeOpt*)GetOpt("Init_mode_set"))->fuse_nocalo;
93     }
94    
95     TString GetG4ConfigC(){
96     TString tmp = ((pInitModeOpt*)GetOpt("Init_mode_set"))->fg4Config_path;
97     tmp += "/";
98     tmp += ((pInitModeOpt*)GetOpt("Init_mode_set"))->fg4Config_C_name;
99     return tmp;
100     }
101    
102     TString GetG4ConfigIn(){
103     TString tmp = ((pInitModeOpt*)GetOpt("Init_mode_set"))->fg4Config_path;
104     tmp += "/";
105     tmp += ((pInitModeOpt*)GetOpt("Init_mode_set"))->fg4Config_in_name;
106     return tmp;
107     }
108    
109     //RANDOM OPTIONS
110    
111     Bool_t IsReadRandomMode(){
112     /* 0 - generate, 1 - read from file */
113     return ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fread_from_file_mode;
114     }
115    
116     Bool_t IsUserRandomMode(){
117     /* 1 - generate random use user-defined seeds, 0 - autogenerate them */
118     return ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fgenerate_g4_seed_user;
119     }
120    
121     void GetUserRandomSeed(Int_t & seed1, Int_t & seed2){
122     seed1 = ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fseed1;
123     seed2 = ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fseed2;
124     }
125     Bool_t DoWriteRandom(){
126     /* 0 - don't save g4 random snapshots into root-file, 1 - do it */
127     return ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fwrite_to_file_mode;
128     }
129     TString GetRandomOutFile(){
130     TString tmp = ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fwrite_g4_rnd_path;
131     tmp += "/";
132     tmp += ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fwrite_g4_rnd_filename;
133     return tmp;
134     }
135     TString GetRandomOutFilename(){
136     return ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fwrite_g4_rnd_filename;
137     }
138     TString GetRandomInFilename(){
139     return ((pRandomModeOpt*)GetOpt("Random_mode_set"))->fread_g4_seed_path;
140     }
141    
142     //RUNTIME OPTIONS
143    
144     Int_t GetVerboseLevel(){
145     return ((pRuntimeModeOpt*)GetOpt("Runtime_mode_set"))->fverbose_lev;
146     }
147     Int_t GetMaxSteps(){
148     return ((pRuntimeModeOpt*)GetOpt("Runtime_mode_set"))->fmaxstep;
149     }
150     Save_cond GetSaveCond(){
151     return ((pRuntimeModeOpt*)GetOpt("Runtime_mode_set"))->fsv_c;
152     }
153     Save_mode GetSaveMode(){
154     return ((pRuntimeModeOpt*)GetOpt("Runtime_mode_set"))->fsv_m;
155     }
156    
157     //PRIMARY OPTIONS
158     Bool_t GetReadPrimMode(){
159     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fread_mode;
160     }
161     TString GetReadPrimPath(){
162     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fread_path;
163     }
164     Int_t GetPrimPDG(){
165     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fpdg;
166     }
167    
168     Momentum_mode GetPrimMomMode(){
169     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fmom_mode;
170     }
171    
172     Momentum_units GetPrimMomUnits(){
173     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->funits;
174     }
175    
176     Double_t GetMomFixed(){
177     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fmom_fix;
178     }
179    
180     void GetMomLimits( Double_t & min, Double_t & max){
181     min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fmom_min;
182     max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fmom_max;
183     }
184    
185     Double_t GetMomGamma(){
186     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fgamma;
187     }
188    
189     Bool_t IsCustomKinematics(){
190     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fspt_mode;
191     }
192     Bool_t IsBoxVertex(){
193     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fvert_mode;
194     }
195    
196     void GetFixedPointVertex( Double_t &x0, Double_t &y0, Double_t &z0 ){
197     x0 = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fx0;
198     y0 = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fy0;
199     z0 = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fz0;
200     }
201    
202     void GetBoxVertex( Double_t &x0_min, Double_t &x0_max,
203     Double_t &y0_min, Double_t &y0_max,
204     Double_t &z0_min, Double_t &z0_max ){
205     x0_min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fx0_min;
206     x0_max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fx0_max;
207     y0_min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fy0_min;
208     y0_max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fy0_max;
209     z0_min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fz0_min;
210     z0_max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fz0_max;
211     }
212    
213     Bool_t IsIsotropicPlane(){
214     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fang_mode;
215     }
216    
217     void GetFixedAngles( Double_t &theta, Double_t &phi){
218     theta = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->ftheta;
219     phi = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fphi;
220     }
221     void GetIsotropicAngles( Double_t &theta_min, Double_t &theta_max,
222     Double_t &phi_min, Double_t &phi_max ){
223     theta_min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->ftheta_min;
224     theta_max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->ftheta_max;
225     phi_min = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fphi_min;
226     phi_max = ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fphi_max;
227     }
228    
229     Nevents_mode GetStopMode(){
230     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fnv_m;
231     }
232    
233     Int_t GetEvMax(){
234     return ((pPrimaryModeOpt*)GetOpt("Primary_mode_set"))->fnevents;
235     }
236    
237     ClassDef(PamVMCOptMgr,1);
238    
239    
240     };
241    
242     #endif

  ViewVC Help
Powered by ViewVC 1.1.23