Settings.h
1 //class Tools:
4 
5 #ifndef SETTINGS_H_
6 #define SETTINGS_H_
7 
8 #include <fstream>
9 #include <vector>
10 
11 class Anita;
12 class Secondaries;
13 class Signal;
14 class Balloon;
15 class Ray;
16 
17 using std::string;
18 using std::ifstream;
19 using std::ofstream;
20 using std::vector;
21 
22 #include "TString.h"
23 #include <TObject.h>
24 #include <map>
25 
26 // from RVersion.h
27 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
28 #include "TClingRuntime.h"
29 #else
30 #include "TCint.h"
31 #endif
32 
34 
35 class Settings : public TObject {
36 
37  /* protected: */
38 
39  public:
40 
41  Settings();
42  ~Settings();
43  void Initialize();
45 
46  void getSetting(const char* key, int& value, bool nonag=false);
47  void getSetting(const char* key, float& value, bool nonag=false);
48  void getSetting(const char* key, double& value, bool nonag=false);
49 
50  void getSetting(const char * key, std::string & value, bool nonag=false);
51  void getSetting(const char* key, vector<int>& valueArray, bool nonag=false);
52  void getSetting(const char* key, vector<float>& valueArray, bool nonag=false);
53  void getSetting(const char* key, vector<double>& valueArray, bool nonag=false);
54 
55  void ReadInputs(const char* fileName , ofstream &foutput,
56  // Anita* anita1, Secondaries* sec1, Signal* sig1, Balloon* bn1, Ray* ray1,
57  int& NNU, double& RANDOMISEPOL);
58 
59  void ApplyInputs(Anita* anita1, Secondaries* sec1, Signal* sig1, Balloon* bn1, Ray* ray1);
60 
61 
62  int UNBIASED_SELECTION;
63  double UNBIASED_PS_MAX_DISTANCE_KM;
64  double UNBIASED_CHORD_STEP_M;
65  int WHICH; // which payload to use 0=Anita-lite,1=Ross,2=Smex,3=make your own
66  int ANITAVERSION;
67  int CYLINDRICALSYMMETRY; // is it cylindrically symmetric =1 if which=1,2, =0 if which=0
68  // if which=3 then 0 or 1
69  double SIGMA_FACTOR; // factor to multiply cross section by for error analysis
70  int SIGMAPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization
71  int YPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization
72  int SIGNAL_FLUCT; // 1=add noise fluctuation to signal or 0=do not
73  int TRIGGERSCHEME; // frequency domain voltage, frequency domain energy, time domain diode integration
74  int ZEROSIGNAL; // zero the signal to see how many of our hits are noise hits
75  int REMOVEPOLARIZATION; //Disable polarizations
76 
77  double INCLINE_TOPTHREE;
78  double INCLINE_NADIR;
79  int USEDARTBOARD;
80  int GAINS;
81  int BANDING;
82  int NBANDS;
83  int PERCENTBW;
84  int trigRequirements[4];// 0th element - L1 - how many channels per antenna should pass
85  // 1st element- L2 - how many antennas on a layer
86  // 2nd element - L3 - how many L2 triggers should be coincident
87  int REQUIRE_CENTRE; // require centre antenna in clump to be one of those hit
88  double INCLUDE_NADIRONLY; // cant angle of nadir (bottom) layer of antennas
89  int PULSER;
90  double SIGMA_THETA; // resolution on the polar angle of the signal
91  double FREQ_LOW;
92  double FREQ_HIGH;
93 
94  int SECONDARIES;
95  int TAUDECAY; // is tau decay counted as a secondary interaction
96 
97  int trigEffScanPhi; // central phi sector of trigger efficiency scan
98 
99 
100  int WHICHPATH;
101  int BN_LATITUDE;
102  int BN_LONGITUDE;
103  int BN_ALTITUDE;
104  int RANDOMIZE_BN_ORIENTATION;
105  int CENTER;
106  double MAXHORIZON;
107 
108  int EVENTSMAP;//whether draw the events distribution map
109 
110  int WHICHRAYS; // how many rays to look at (1) direct only (2) direct and down-going.
111  int MAKEVERTICAL; // option in the input file to force the signal to hit the payload with completely vertical polarisation. For making signal efficiency curves.
112 
113  // trigger
114  int LCPRCP; // 1 for circular polarization trigger, 0 for V and H
115  int JUSTVPOL; // 0 for both polarizations, 1 for just V polarization
116  // doesn't allow for both LCPRCP=1 and JUSTVPOL=1
117  //int FIFTHBAND; // 1 to include 0.2-1.2 GHz as a frequency band if JUSTVPOL==1
118  //int NFOLD=3; // how many channels must pass the trigger - in old mechanism - only used for anita-lite
119  int NFOLD; // how many channels must pass the trigger - in old mechanism - only used for anita-lite
120 
121 
122  //int CHMASKING=1; // whether or not to include channel masking
123  //int PHIMASKING=1; // whether or not to include phi masking
124  int CHMASKING; // whether or not to include channel masking
125  int PHIMASKING; // whether or not to include phi masking
126 
127  //int NLAYERS=0;
128  //int NANTENNAS=0;
129 
130  int NLAYERS;
131  int NANTENNAS;
132 
133  /* int ONLYFINAL=1; // only write to final histogram */
134  /* int HIST_MAX_ENTRIES=10000; //maximum number of events to put in histograms */
135  /* int HIST=1; //write to histograms */
136 
137  int ONLYFINAL; // only write to final histogram
138  int HIST_MAX_ENTRIES; //maximum number of events to put in histograms
139  int HIST; //write to histograms
140  double BW; // BANDWIDTH
141  //int DISCONES=1; // whether or not to use discones
142  int DISCONES; // whether or not to use discones
143 
144  //double NDISCONES_PASS=3; // number of discones needed to pass
145  double NDISCONES_PASS; // number of discones needed to pass
146 
147  int BORESIGHTS; // whether to loop over boresights
148  int SLAC; // whether or not we are simulating the slac run
149  double SLACSLOPE; // slope of the ice
150  double SLACICELENGTH; // length of the block of ice
151  double SLAC_HORIZDIST; // horizontal distance from interaction to center of payload at slac beam test
152  double SLAC_DEPTH; // vertical depth of interaction at slac beam test
153  double SLAC_HORIZ_DEPTH; // horizontal depth of interaction at slac
154 
155  std::string SOURCE; // the source option: FAVA (blazars), GRB (gamma ray bursts), SN (supernovae), see source.hh for more info
156  std::string WHICH_SOURCES; // which sources? All, or just a specific one
157  std::string WHICH_SUBTYPE; // which subtype? All, or just a specific one
158  std::string WHICH_START_TIME; // which start time? 0, or an anita flight option
159  std::string WHICH_END_TIME; // which end time? 0 or an anita flight option
160 
161  int SOURCE_USE_EXPONENT; //Use the exponent for a source (if exponent <= 21)
162  double SOURCE_MIN_E; // log10 of minimum energy for sources
163  double SOURCE_MAX_E; // log10 of maximinum energy for sources
164 
165  int SOURCE_SKIP_WHEN_NONE; //Whether or not to reroll position if no source is available!
166 
167  int ROUGHNESS; // include effects of surface roughness
168  int FIRN; // whether or not to include the firn
169 
170  //int SLOPEY=1; // 1=slopeyness on, 0=slopeyness off
171  //double SLOPEYSIZE=0.012; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean)
172 
173  int SLOPEY; // 1=slopeyness on, 0=slopeyness off
174  double SLOPEYSIZE; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean)
175 
176  bool DEBUG;
177 
178  //double THERMALNOISE_FACTOR=1.0; // factor to multiply thermal noise for error analysis
179  double THERMALNOISE_FACTOR; // factor to multiply thermal noise for error analysis
180 
181  //double FREQ_LOW_SEAVEYS=200.E6; // min frequency for seaveys
182  //const double FREQ_HIGH_SEAVEYS=1200.E6; // max frequency for seaveys
183 
184  double FREQ_LOW_SEAVEYS; // min frequency for seaveys
185  double FREQ_HIGH_SEAVEYS; // max frequency for seaveys
186  double BW_SEAVEYS;
187  //int FORSECKEL=1; // Make array of strength of signal across frequencies for different viewing angles.
188  int FORSECKEL; // Make array of strength of signal across frequencies for different viewing angles.
189 
190  double ROUGHSIZE; // roughness size
191  double SCREENEDGELENGTH; // edge length of screen used if there is roughness
192  double SCREENSTEPSIZE; // step size of screen grid if there is roughness
193 
194  int ICE_MODEL; //Select ice model to be used. 0 = Crust 2.0 , 1 = BEDMAP.
195  int NOFZ; // 1=depth dependent index of refraction,0=off
196  int CONSTANTCRUST; // set crust density and thickness to constant values.
197  int CONSTANTICETHICKNESS; // set ice thickness to constant value
198  int FIXEDELEVATION; // fix the elevation to the thickness of ice.
199  int MOOREBAY; //1=use Moore's Bay measured ice field attenuation length for the west land, otherwise use South Pole data
200  int USEPOSITIONWEIGHTS;// whether or not to restrict the neutrino position so it is within the horizon of the balloon
201  int WRITE_FILE; //Select whether or not to write a new input file for CreateHorizons
202 
203  int MINRAY;
204  int MAXRAY;
205 
206  int horizontal_banana_points;
207  int vertical_banana_points;
208  double EXPONENT; //Select neutrino flux exponent value or flux model. Detail : READ_EXPONENT
209 
210 
211  // Bunch of variables which were global in icemc.cc but are settings:
212  int FILLRAYTREES; // fill tree for each ray in roughness simulation
213  int SEED; // random number seed.
214  double THETA_TH_FACTOR; // factor to multiply theta_th to check code is working properly
215  double CHANCEINHELL_FACTOR; // loosen chance in hell cuts to check code is working properly
216  int WEIGHTABSORPTION; // whether or not to weight for earth absorption
217  int CONSTANTY; // whether or not to set y to a constant=0.2
218  int taumodes; //whether to choose a flat distribution for y (tau made in rock) or not
219  int VARIABLE_ATTEN; // 0=depth dependent attenuation length, 1=fixed
220  int TRIGTYPE; //1=Trigger scheme as in the SMEX proposal or 0= Just at least 8 channels pass with 2.3 sigma signal
221  int ATMOSPHERE;// include atmosphere
222  int SCALEDOWNLCPRX1; // scale down lcp voltage of antenna 1 by sqrt(2)
223  int SCALEDOWNEPOLRX1; // scale down power of e pol. of antenna 1 by factor of 2
224  int SCALEDOWNHPOLRX1; // scale down power of h pol. of antenna 1 by factor of 2
225  int SCALEDOWNEPOLRX2; // scale down power of e pol. of antenna 2 by factor of user's choice
226  double SCALEFACTOREPOLRX2; // scale power of e pol. of antenna 2 by this factor
227  int SCALEDOWNHPOLRX2; // scale down power of h pol. of antenna 2 by factor of 2
228  int EPOLRX2ZERO; // lcp channel on anita-lite is not considered for triggering.
229  int HPOLRX2ZERO; // h pol. of 2nd antenna set to zero.
230  int RCPRX2ZERO; // rcp of 2nd antenna set to zero.
231  int LCPRX2ZERO; // lcp of 2nd antenna set to zero.
232  int FLATSURFACE; // Normals of all positions on the surface are straight up.
233  int WRITEPOSFILE; //Write neutrino position information to file
234  int SKIPCUTS; //See every neutrino through to the end - don't make any of the various cuts designed to speed up the program. (For checking distributions.)
235  int USEDIRECTIONWEIGHTS;// whether or not to restrict the neutrino angle so that the viewing angle is near the cerenkov cone
236  int SHOWERTYPE; // Type of shower for previous option
237  int antennaclump; //number of antenna in clump (L2)
238  // End of the once-global varibles.
239  double COHERENT_THRESHOLD;
240  int APPLYIMPULSERESPONSEDIGITIZER; // apply impulse response in the digitizer path
241  int APPLYIMPULSERESPONSETRIGGER; // apply impulse response in the trigger path
242  int USETIMEDEPENDENTTHRESHOLDS; // use time-dependent thresholds
243  int USEDEADTIME; // use dead time from flight
244  int NOISEFROMFLIGHTTRIGGER; // use thermal noise from flight in trigger path
245  int NOISEFROMFLIGHTDIGITIZER; // use thermal noise from flight in digitizer path
246  int MINBIAS; // generate minimum bias sample
247  int TRIGGEREFFSCAN; // do a trigger efficiency scan
248  int TRIGGEREFFSCAPULSE; // Apply pulse at AMPA (0) or at SURF (1)
249 
250  int TUFFSTATUS; // Are the TUFFs on for the whole flight?
251 
252  int ADDCW; // Add CW
253 
254  int PAYLOAD_USE_SPECIFIC_TIME; //Instead of using the entire flight path, only generate neutrinos for a specific time for the paylaod (0 to disable).
255  int PAYLOAD_USE_SPECIFIC_TIME_DELTA; //How much before and after the specific time can we use payload locations?
256  int SPECIFIC_NU_POSITION; //Use a specific interaction position
257  double SPECIFIC_NU_POSITION_LATITUDE, SPECIFIC_NU_POSITION_LONGITUDE, SPECIFIC_NU_POSITION_ALTITUDE; //the specific interaction position
258  double SPECIFIC_NU_POSITION_DISTANCE; //Max distance from place
259  int IGNORE_CROSSPOL; //Ignore the crosspol polarization component
260  int POL_SIGN_HACK; // patch up the sign of e/h
261  double CUTONWEIGHTS;
262  double CUTONWEIGHTPROBS;
263  double DEC_CUT;
264  int ALL_SKY_MAP;
265 
266  // custom sources
267  std::string CUSTOM_NAME;
268  double CUSTOM_RA; // in decimal degrees
269  double CUSTOM_DEC; // in decimal degrees
270  double CUSTOM_GAMMA;
271 
272  double HORIZON_OFFSET;
273  int useLPM;
274 
275  // In-header intialization is to old gcc as Domino's pizza is to real Italians
276  double jamieFactor;// = 0;
277  int medium;// = 0;
278  int askaryanParameterization;// = 0;
279  int SAVE_TRUTH_NU_TREE;
280 
281  // TString outputdir; // directory where outputs go
282 
283  ClassDef(Settings,2);
284 
285  private:
286  typedef std::map<TString, TString> kvpMap;
287 
288  kvpMap keyValuePairStrings; //< The raw key value pairs as string, from parsing the config file
289  Bool_t newKvpPassesSanityChecks(const TString& key, const TString& value, const char* fileName, int lineNum);
290  void complainAboutNotFindingKey(const TString& key);
291  void parseValueArray(const char* valueString, vector<int>& values);
292  void parseValueArray(const char* valueString, vector<float>& values);
293  void parseValueArray(const char* valueString, vector<double>& values);
294  void parseSettingsFile(const char* fileName, ofstream& outputFile);
295 
296  vector<double> efficiencyScanOffAxisAttenuations;
297  vector<double> efficiencyScanPhiSectorDelay;
298  vector<double> efficiencyScanRingDelay;
299  vector<int> efficiencyScanRingsUsed;
300  vector<int> efficiencyScanApplyRingDelay;
301  vector<int> whichTUFFsON;
302  vector<double> tempThresholds;
303  vector<double> bandLowEdgesMHz;
304  vector<double> bandHighEdgesMHz;
305  vector<int> requiredBands;
306  vector<int> allowedBands;
307  vector<double> notchFilterLimitsMHz;
308  vector<int> channelRequirePol;
309  vector<int> channelAllowedPol;
310 
311 
312 };
313 #endif
double FREQ_LOW
lowest frequency
Definition: Settings.h:91
void printAllKeyValuePairStrings()
Definition: Settings.cc:212
Radiation from interaction.
Definition: signal.hh:13
Reads in and stores input settings for the run.
Definition: Settings.h:35
int CENTER
whether or not to center one phi sector of the payload on the incoming signal (for making signal effi...
Definition: Settings.h:105
Secondary interactions.
Definition: secondaries.hh:28
void Initialize()
Definition: Settings.cc:226
Contains everything about positions within payload and signals it sees for each event, in both the trigger and signal paths.
Definition: anita.hh:32
~Settings()
Definition: Settings.cc:53
Settings()
Definition: Settings.cc:43
Handles everything related to balloon positions, payload orientation over the course of a flight...
Definition: balloon.hh:30
Ray tracing.
Definition: ray.hh:20