Class Reference for E1039 Core & Analysis Software
recoConsts.cc
Go to the documentation of this file.
1 #include "recoConsts.h"
2 
3 #include <iostream>
4 #include <wordexp.h>
5 
8 {
9  if(__instance == nullptr)
10  {
11  __instance = new recoConsts();
13  }
14 
15  return __instance;
16 }
17 
19 {}
20 
21 void recoConsts::set_CharFlag(const std::string& name, const std::string& flag)
22 {
23  std::string flag_expanded = ExpandEnvironmentals(flag);
24  charflag[name] = flag_expanded;
25 }
26 
27 std::string recoConsts::ExpandEnvironmentals(const std::string& input)
28 {
29  if (input.length() == 00) return ""; // Treat specially since exp_result.we_wordc = 0 when input is "".
30  wordexp_t exp_result;
31  if(wordexp(input.c_str(), &exp_result, 0) != 0)
32  {
33  std::cout << "ExpandEnvironmentals - ERROR - Your string '" << input << "' cannot be understood!" << std::endl;
34  return "";
35  }
36  const std::string output(exp_result.we_wordv[0]);
37  return output;
38 }
39 
41 {
42  //Following constants are shared between simulation and reconstruction
43  set_DoubleFlag("KMAGSTR", 1.0);
44  set_DoubleFlag("FMAGSTR", 1.0);
45  set_DoubleFlag("TMAGSTR", 5.0); // Target magnetic field strength, in Tesla
46 
47  //Following flags control the running mode and must be
48  //set to appropriate values in the configuration set
49  set_IntFlag("RUNNUMBER", 1);
50 
51  set_BoolFlag("KMAG_ON", true);
52  set_BoolFlag("COARSE_MODE", false);
53  set_BoolFlag("MC_MODE", false);
54  set_BoolFlag("COSMIC_MODE", false);
55  set_BoolFlag("REQUIRE_MUID", true);
56  set_CharFlag("HIT_MASK_MODE", "AUTO");
57 
58  set_BoolFlag("TARGETONLY", false);
59  set_BoolFlag("DUMPONLY", false);
60 
61  //Following values are fed to GeomSvc
62  set_BoolFlag("OnlineAlignment", false);
63  set_BoolFlag("IdealGeom", false);
64 
65  set_CharFlag("AlignmentMille", "$E1039_RESOURCE/alignment/run6/align_mille.txt");
66  set_CharFlag("AlignmentHodo", "$E1039_RESOURCE/alignment/run6/alignment_hodo.txt");
67  set_CharFlag("AlignmentProp", "$E1039_RESOURCE/alignment/run6/alignment_prop.txt");
68  set_CharFlag("Calibration", "$E1039_RESOURCE/alignment/run6/calibration.txt");
69 
70  set_CharFlag("DB_SERVER", "DB1");
71  set_CharFlag("DB_USER" , "seaguest");
72 
73  set_CharFlag("TRIGGER_Repo", "$TRIGGER_ROOT");
74  set_CharFlag("TRIGGER_L1", "67");
75 
76  set_CharFlag("fMagFile", "$GEOMETRY_ROOT/magnetic_fields/Fmag.root");
77  set_CharFlag("kMagFile", "$GEOMETRY_ROOT/magnetic_fields/Kmag.root");
78 
79  //Following flags adjust the performance/efficiency of the reconstruction,
80  //thus should be included in the configuration set
81  set_DoubleFlag("TX_MAX", 0.15);
82  set_DoubleFlag("TY_MAX", 0.1);
83  set_DoubleFlag("X0_MAX", 150.);
84  set_DoubleFlag("Y0_MAX", 50.);
85  set_DoubleFlag("INVP_MIN", 0.01);
86  set_DoubleFlag("INVP_MAX", 0.2);
87  set_DoubleFlag("PROB_LOOSE", 0.);
88  set_DoubleFlag("PROB_TIGHT", 1.E-12);
89  set_DoubleFlag("BAD_HIT_REJECTION", 3.);
90  set_DoubleFlag("MERGE_THRESH", 0.015);
91  set_DoubleFlag("RESOLUTION_FACTOR", 1.6);
92 
93  set_DoubleFlag("X_BEAM", 0.);
94  set_DoubleFlag("Y_BEAM", 0.);
95  set_DoubleFlag("SIGX_BEAM", 0.3);
96  set_DoubleFlag("SIGY_BEAM", 0.3);
97 
98  set_DoubleFlag("X0_TARGET", 0.);
99  set_DoubleFlag("Y0_TARGET", 0.);
100  set_DoubleFlag("RX_TARGET", 0.95);
101  set_DoubleFlag("RY_TARGET", 0.95);
102 
103  set_CharFlag("EventReduceOpts", "aoc");
104 
105  set_BoolFlag("USE_V1495_HIT", true);
106  set_BoolFlag("USE_TWTDC_HIT", false);
107 
108  set_IntFlag("NSTEPS_FMAG", 100);
109  set_IntFlag("NSTEPS_SHIELDING", 50);
110  set_IntFlag("NSTEPS_TARGET", 100);
111 
112  set_DoubleFlag("TDCTimeOffset", 0.);
113 
114  set_DoubleFlag("RejectWinDC0", 0.12);
115  set_DoubleFlag("RejectWinDC1", 0.12);
116  set_DoubleFlag("RejectWinDC2", 0.15);
117  set_DoubleFlag("RejectWinDC3p", 0.16);
118  set_DoubleFlag("RejectWinDC3m", 0.14);
119 
120  set_IntFlag("MaxHitsDC0", 100);
121  set_IntFlag("MaxHitsDC1", 100);
122  set_IntFlag("MaxHitsDC2", 100);
123  set_IntFlag("MaxHitsDC3p", 100);
124  set_IntFlag("MaxHitsDC3m", 100);
125 
126  //Following numbers are related to the geometric set up thus should not
127  //change under most circumstances, unless one is studying the effects of these cuts
128  //could be excluded from the configuration set
129  set_DoubleFlag("SAGITTA_TARGET_CENTER", 1.85);
130  set_DoubleFlag("SAGITTA_TARGET_WIDTH", 0.25);
131  set_DoubleFlag("SAGITTA_DUMP_CENTER", 1.5);
132  set_DoubleFlag("SAGITTA_DUMP_WIDTH", 0.3);
133 
134  set_IntFlag("MUID_MINHITS", 1);
135  set_DoubleFlag("MUID_REJECTION", 4.);
136  set_DoubleFlag("MUID_THE_P0", 0.11825);
137  set_DoubleFlag("MUID_EMP_P0", 0.00643);
138  set_DoubleFlag("MUID_EMP_P1", -0.00009);
139  set_DoubleFlag("MUID_EMP_P2", 0.00000046);
140  set_DoubleFlag("MUID_Z_REF", 2028.19);
141  set_DoubleFlag("MUID_R_CUT", 3.0);
142 
143  set_DoubleFlag("DEDX_FE_P0", 7.18274);
144  set_DoubleFlag("DEDX_FE_P1", 0.0361447);
145  set_DoubleFlag("DEDX_FE_P2", -0.000718127);
146  set_DoubleFlag("DEDX_FE_P3", 7.97312e-06);
147  set_DoubleFlag("DEDX_FE_P4", -3.05481e-08);
148 
149  set_DoubleFlag("PT_KICK_KMAG", 0.4016);
150  set_DoubleFlag("PT_KICK_FMAG", 2.909);
151 
152  set_DoubleFlag("Z_KMAG_BEND", 1042.01722);
153  set_DoubleFlag("Z_FMAG_BEND", 251.4);
154  set_DoubleFlag("Z_KFMAG_BEND", 375.);
155  set_DoubleFlag("ELOSS_KFMAG", 8.12);
156  set_DoubleFlag("ELOSS_ABSORBER", 1.81);
157  set_DoubleFlag("Z_ST2", 1347.36);
158  set_DoubleFlag("Z_ABSORBER", 2028.19);
159  set_DoubleFlag("Z_REF", 0.);
160  set_DoubleFlag("Z_TARGET", -300.00);
161  set_DoubleFlag("Z_DUMP", 42.);
162  set_DoubleFlag("Z_ST1", 600.);
163  set_DoubleFlag("Z_ST3", 1910.);
164  set_DoubleFlag("FMAG_HOLE_LENGTH", 27.94);
165  set_DoubleFlag("FMAG_HOLE_RADIUS", 1.27);
166  set_DoubleFlag("FMAG_LENGTH", 502.92);
167  set_DoubleFlag("Z_UPSTREAM", -700.);
168  set_DoubleFlag("Z_DOWNSTREAM", 500.);
169 }
170 
171 void recoConsts::init(int runNo, bool verbose)
172 {
173  set_IntFlag("RUNNUMBER", runNo);
174  if (runNo < 10) { // E906 data. We will need dataset-dependent settings.
175  set_DoubleFlag("FMAGSTR", -1.044);
176  set_DoubleFlag("KMAGSTR", -1.025);
177  set_CharFlag ("TRIGGER_L1", "78");
178  set_DoubleFlag("RejectWinDC0" , 0.12);
179  set_DoubleFlag("RejectWinDC1" , 0.25);
180  set_DoubleFlag("RejectWinDC2" , 0.15);
181  set_DoubleFlag("RejectWinDC3p", 0.16);
182  set_DoubleFlag("RejectWinDC3m", 0.14);
183  set_IntFlag("MaxHitsDC0" , 350);
184  set_IntFlag("MaxHitsDC1" , 350);
185  set_IntFlag("MaxHitsDC2" , 170);
186  set_IntFlag("MaxHitsDC3p", 140);
187  set_IntFlag("MaxHitsDC3m", 140);
188  }
189  return;
190 }
191 
192 void recoConsts::init(const std::string& setname, bool verbose)
193 {
194  if(setname == "cosmic")
195  {
196  set_BoolFlag("KMAG_ON", false);
197  set_BoolFlag("COSMIC_MODE", true);
198 
199  set_DoubleFlag("TX_MAX", 1.);
200  set_DoubleFlag("TY_MAX", 1.);
201  set_DoubleFlag("X0_MAX", 1000.);
202  set_DoubleFlag("Y0_MAX", 1000.);
203  }
204 
205  if(verbose) Print();
206 }
207 
208 void recoConsts::initfile(const std::string& filename, bool verbose)
209 {
210  ReadFromFile(filename, verbose);
211  return;
212 }
213 
214 void recoConsts::Print() const
215 {
216  // methods from PHFlag
217  PrintCharFlags();
218  PrintFloatFlags();
220  PrintIntFlags();
221  PrintBoolFlags();
222 }
virtual void PrintIntFlags() const
Definition: PHFlag.cc:195
virtual void set_IntFlag(const std::string &name, const int flag)
Definition: PHFlag.cc:145
virtual void set_BoolFlag(const std::string &name, const bool flag)
Definition: PHFlag.cc:179
virtual void PrintBoolFlags() const
Definition: PHFlag.cc:243
virtual void set_DoubleFlag(const std::string &name, const double flag)
Definition: PHFlag.cc:77
virtual void PrintCharFlags() const
Definition: PHFlag.cc:231
virtual void ReadFromFile(const std::string &name, bool verbose=false)
Definition: PHFlag.cc:285
std::map< std::string, std::string > charflag
Definition: PHFlag.h:68
virtual void PrintDoubleFlags() const
Definition: PHFlag.cc:207
virtual void PrintFloatFlags() const
Definition: PHFlag.cc:219
void Print() const
print all the parameters
Definition: recoConsts.cc:214
static recoConsts * __instance
Definition: recoConsts.h:44
void initfile(const std::string &filename, bool verbose=false)
initialize by reading a file
Definition: recoConsts.cc:208
void init(int runNo=0, bool verbose=false)
initialize the constants by the runNo - not implemented yet
Definition: recoConsts.cc:171
void set_defaults()
set the default value for all the constants needed - user is supposed to add a default value here to ...
Definition: recoConsts.cc:40
std::string ExpandEnvironmentals(const std::string &input)
Definition: recoConsts.cc:27
static recoConsts * instance()
Definition: recoConsts.cc:7
virtual void set_CharFlag(const std::string &name, const std::string &flag)
overide the virtual function to expand the environmental variables
Definition: recoConsts.cc:21