8 #include "roughness.hh" 11 #include "icemodel.hh" 14 #include "secondaries.hh" 16 #include "counting.hh" 17 #include "Primaries.h" 24 #include "TObjString.h" 29 #define ANSI_COLOR_RED "\x1b[31m" 30 #define ANSI_COLOR_GREEN "\x1b[32m" 31 #define ANSI_COLOR_YELLOW "\x1b[33m" 32 #define ANSI_COLOR_BLUE "\x1b[34m" 33 #define ANSI_COLOR_MAGENTA "\x1b[35m" 34 #define ANSI_COLOR_CYAN "\x1b[36m" 35 #define ANSI_COLOR_RESET "\x1b[0m" 68 void Settings::parseSettingsFile(
const char* fileName, std::ofstream& outputFile){
70 std::ifstream settingsFile(fileName);
73 if(!settingsFile.is_open()){
74 std::cerr <<
"Error in " << ANSI_COLOR_BLUE << __FILE__ << ANSI_COLOR_RESET
75 <<
", could not open file " << ANSI_COLOR_RED << fileName << ANSI_COLOR_RESET << std::endl;
83 timeinfo = localtime (&rawtime);
84 outputFile <<
"Current date and time are: " << asctime(timeinfo) << std::endl;
90 while(!settingsFile.eof()){
93 std::getline(settingsFile, thisLine);
96 outputFile << thisLine << std::endl;
99 std::size_t found = thisLine.find(
"#");
103 TString thisLineCommentsRemoved(thisLine.substr(0, found));
106 TObjArray* tokens = thisLineCommentsRemoved.Tokenize(
":");
108 int nTokens = tokens->GetEntries();
113 TString key = ((TObjString*) tokens->At(0))->GetString();
114 TString value = ((TObjString*) tokens->At(1))->GetString();
116 Bool_t addVariable = newKvpPassesSanityChecks(key, value, fileName, lineNum);
119 keyValuePairStrings[key.Data()] = value.Data();
125 TRegexp reggie(
"[a-zA-Z0-9]");
126 Ssiz_t len = thisLineCommentsRemoved.Length();
128 Bool_t isAlphaNumeric = reggie.Index(thisLineCommentsRemoved, &len) != -1;
130 if(nTokens > 2 || isAlphaNumeric){
133 std::cerr <<
"Warning in " ANSI_COLOR_RED << __FILE__ << ANSI_COLOR_RESET
134 <<
". I couldn't parse line " << ANSI_COLOR_RED << lineNum << ANSI_COLOR_RESET
135 <<
" in " << fileName <<
". It said: " << std::endl;
136 std::cerr << ANSI_COLOR_BLUE << thisLine << ANSI_COLOR_RESET << std::endl;
146 outputFile << std::endl << std::endl;
147 outputFile << __FILE__ <<
" has finished parsing " << fileName << std::endl;
148 outputFile << std::endl << std::endl;
165 Bool_t Settings::newKvpPassesSanityChecks(
const TString& key,
const TString& value,
const char* fileName,
int lineNum){
167 Bool_t isGood =
true;
170 std::cerr <<
"Warning in " << ANSI_COLOR_BLUE << __FILE__ << ANSI_COLOR_RESET <<
", " 171 << ANSI_COLOR_BLUE << fileName << ANSI_COLOR_RESET
172 <<
" has a variable with no name at " << ANSI_COLOR_RED <<
"line " << lineNum
173 << ANSI_COLOR_RESET <<
"." << std::endl;
177 else if(value.Length()==0){
178 std::cerr <<
"Warning in " << ANSI_COLOR_BLUE << __FILE__ << ANSI_COLOR_RESET <<
", " 179 << ANSI_COLOR_BLUE << fileName << ANSI_COLOR_RESET
180 <<
" has a variable with no value at " << ANSI_COLOR_RED <<
"line " << lineNum
181 << ANSI_COLOR_RESET <<
"." << std::endl;
185 kvpMap::iterator it = keyValuePairStrings.find(key);
187 if(it!=keyValuePairStrings.end()){
188 std::cerr <<
"Warning in " << ANSI_COLOR_BLUE << __FILE__ << ANSI_COLOR_RESET <<
", " 189 << ANSI_COLOR_BLUE << fileName << ANSI_COLOR_RESET
190 <<
" already has a variable named " << ANSI_COLOR_RED << key.Data()
191 << ANSI_COLOR_RESET <<
"." << std::endl;
198 std::cerr <<
"Will ignore " << ANSI_COLOR_RED <<
"line " << lineNum << ANSI_COLOR_RESET << std::endl;
215 for(it = keyValuePairStrings.begin(); it!=keyValuePairStrings.end(); ++it){
216 std::cout << it->first <<
"\t" << it->second << std::endl;
230 FREQ_LOW_SEAVEYS=200.E6;
231 FREQ_HIGH_SEAVEYS=1200.E6;
232 BW_SEAVEYS=FREQ_HIGH_SEAVEYS-FREQ_LOW_SEAVEYS;
235 UNBIASED_SELECTION=1.;
236 UNBIASED_PS_MAX_DISTANCE_KM =1e3;
237 UNBIASED_CHORD_STEP_M =50;
245 CHANCEINHELL_FACTOR=1.0;
254 SCALEFACTOREPOLRX2=0.05;
263 USEDIRECTIONWEIGHTS=1;
267 SCREENEDGELENGTH=25.;
270 PAYLOAD_USE_SPECIFIC_TIME = 0;
271 PAYLOAD_USE_SPECIFIC_TIME_DELTA = 3600;
273 SPECIFIC_NU_POSITION = 0;
274 SPECIFIC_NU_POSITION_LATITUDE = -77.7;
275 SPECIFIC_NU_POSITION_LONGITUDE = 166.7;
276 SPECIFIC_NU_POSITION_ALTITUDE = 0;
277 SPECIFIC_NU_POSITION_DISTANCE = 100e3;
278 HORIZON_OFFSET = -999;
279 SAVE_TRUTH_NU_TREE = 0;
283 SOURCE_USE_EXPONENT = 0;
286 WHICH_SOURCES =
"All";
287 WHICH_SUBTYPE =
"All";
288 WHICH_START_TIME =
"0";
289 WHICH_END_TIME =
"MAX";
290 SOURCE_SKIP_WHEN_NONE = 0;
296 CUTONWEIGHTPROBS = 0.;
302 CUSTOM_NAME =
"customObject";
317 void Settings::ReadInputs(
const char* inputFileName, std::ofstream &foutput,
320 int& NNU,
double& RANDOMISEPOL) {
322 parseSettingsFile(inputFileName, foutput);
324 getSetting(
"Number of neutrinos", NNU);
325 getSetting(
"Energy exponent", EXPONENT);
326 getSetting(
"Energy CDF or dartboard", USEDARTBOARD);
328 getSetting(
"Neutrino position", UNBIASED_SELECTION);
329 getSetting(
"Neutrino Point Source Max Distance", UNBIASED_PS_MAX_DISTANCE_KM,
true);
330 getSetting(
"Neutrino Point Source Ice Chord Step", UNBIASED_CHORD_STEP_M,
true);
331 getSetting(
"Write hists and trees", HIST);
332 getSetting(
"Write ray", FILLRAYTREES);
334 getSetting(
"Only final tree", ONLYFINAL);
335 getSetting(
"Max histogram entries", HIST_MAX_ENTRIES);
336 getSetting(
"Random seed", SEED);
337 std::cout <<
"INITIAL SEED is " << SEED << std::endl;
338 gRandom->SetSeed(SEED);
340 getSetting(
"Write neutrino position", WRITEPOSFILE);
342 if (WRITEPOSFILE==1){
343 std::cout <<
"Non-default setting: WRITEPOSFILE= " << WRITEPOSFILE << std::endl;
345 getSetting(
"Events map", EVENTSMAP);
355 getSetting(
"Which payload", WHICH);
356 getSetting(
"Antenna layers", NLAYERS);
358 if (WHICH==9) ANITAVERSION=3;
359 else if (WHICH==10) ANITAVERSION=4;
362 if(((WHICH==1 || WHICH==6) && NLAYERS!=4) || (WHICH==0 && NLAYERS!=1) || (WHICH==7 && NLAYERS!=1)){
363 std::cout <<
"Non-default setting: WHICH = " << WHICH <<
" and NLAYERS= " << NLAYERS << std::endl;
367 getSetting(
"Inclination top three layers", INCLINE_TOPTHREE);
369 if(INCLINE_TOPTHREE!=10){
370 std::cout <<
"Non-default setting: INCLINE_TOPTHREE= " << INCLINE_TOPTHREE << std::endl;
373 getSetting(
"Inclination fourth layer", INCLINE_NADIR);
375 if(INCLINE_NADIR!=10){
376 std::cout <<
"Non-default setting: INCLINE_NADIR= " << INCLINE_NADIR << std::endl;
379 getSetting(
"Flight path", WHICHPATH);
381 if((WHICH==0 && WHICHPATH!=2) || (WHICH==2 && WHICHPATH!=6)){
382 std::cout <<
"Non-default setting: WHICHPATH = " << WHICHPATH <<
" and WHICH = " 383 << WHICH << std::endl;
386 getSetting(
"Balloon latitude", BN_LATITUDE);
387 getSetting(
"Balloon longitude", BN_LONGITUDE);
391 if(BN_LONGITUDE!=999 && BN_LATITUDE!=999)
393 std::cout <<
"Setting the payload position to a custom **fixed** position: BN_LATITUDE: "<< BN_LATITUDE <<
", BN_LONGITUDE: " << BN_LONGITUDE << std::endl;
397 std::cout <<
"Setting the payload position to the default **fixed** position: BN_LATITUDE: "<< BN_LATITUDE <<
", BN_LONGITUDE: " << BN_LONGITUDE << std::endl;
402 if (BN_LONGITUDE>180. && BN_LONGITUDE!=999){
403 std::cout <<
"Entered balloon longitude wrong! Should be between -180 and 180 degrees." << std::endl;
405 getSetting(
"Balloon orientation", RANDOMIZE_BN_ORIENTATION);
408 if (RANDOMIZE_BN_ORIENTATION==1 && (WHICHPATH==2 || WHICHPATH==6 ||
409 WHICHPATH==7 || WHICHPATH==8 || WHICHPATH==9)){
410 std::cout <<
"Warning:: Strangely you asked for a real flight path but a randomized balloon orientation. WILL BE OVERRIDDEN." << std::endl;
413 getSetting(
"Balloon altitude", BN_ALTITUDE);
418 getSetting(
"Gain setting", GAINS);
422 getSetting(
"Trigger scheme", TRIGGERSCHEME);
427 getSetting(
"Band thresholds", tempThresholds);
429 getSetting(
"Banding", BANDING);
432 if(BANDING !=0 && BANDING!= 1 && BANDING!=2 && BANDING!=4) {
433 std::cout <<
"Banding should be set to 0 (Anita 1), 1 (custum), 2 (Anita 2), 3 (Satellite) or 4 (Anita 3)." 438 if ((TRIGGERSCHEME==0 || TRIGGERSCHEME==1) && BANDING!=1) {
439 std::cout <<
"Frequency domain trigger schemes can only be used with user-set sub-bands." << std::endl;
443 if (TRIGGERSCHEME==2 && BANDING==1) {
444 std::cout <<
"Time domain trigger scheme only works with Anita 1, Anita 2 or Anita 3 banding data, you can't set your own bands." << std::endl;
449 getSetting(
"Lower band edges", bandLowEdgesMHz);
450 getSetting(
"Upper band edges", bandHighEdgesMHz);
451 getSetting(
"Required bands", requiredBands);
452 getSetting(
"Allowed bands", allowedBands);
453 getSetting(
"Number of bands", NBANDS);
454 getSetting(
"Percent bandwidth", PERCENTBW);
456 getSetting(
"Notch filter limits", notchFilterLimitsMHz);
458 getSetting(
"Num antenna channels for L1 trigger", trigRequirements[0]);
459 getSetting(
"Num L1 hits to pass L2", trigRequirements[1]);
460 getSetting(
"Num antenna for L2 trigger", antennaclump);
461 getSetting(
"Require centre antenna", REQUIRE_CENTRE);
462 getSetting(
"L3 trigger requirement", trigRequirements[2]);
463 getSetting(
"LCP/RCP or V/H", LCPRCP);
464 getSetting(
"Channels required polarization", channelRequirePol);
465 getSetting(
"Channels allowed polarization", channelAllowedPol);
467 getSetting(
"Exta antennas in trigger", DISCONES);
468 getSetting(
"Nadir only trigger", INCLUDE_NADIRONLY);
470 if (INCLUDE_NADIRONLY!=0){
471 std::cout <<
"Non-default setting: INCLUDE_NADIRONLY = " << INCLUDE_NADIRONLY << std::endl;
474 getSetting(
"ANITA-1 channel masking", CHMASKING);
476 if (WHICHPATH!=6 && CHMASKING==1) {
477 std::cout <<
"Cannot include masking for flights other than the ANITA-1 flight." << std::endl;
478 std::cout <<
"For the ANITA-3 channel masking, it is implemented together with the phi masking and it's turned on whenever the PHIMASKING is ON." << std::endl;
479 std::cout <<
"CHMASKING set to 0." << std::endl;
483 getSetting(
"ANITA-2 channel masking", PHIMASKING);
487 getSetting(
"Scale down LCP voltage 1st ant", SCALEDOWNLCPRX1);
488 getSetting(
"Scale down E pol 1st ant", SCALEDOWNEPOLRX1);
489 getSetting(
"Scale down H pol 1st ant", SCALEDOWNHPOLRX1);
490 getSetting(
"Scale down E pol 2nd ant", SCALEDOWNEPOLRX2);
491 getSetting(
"E pol scale down factor 2nd ant", SCALEFACTOREPOLRX2);
492 getSetting(
"H pol scale down factor 2nd ant", SCALEDOWNHPOLRX2);
493 getSetting(
"E pol 2nd ant dead", EPOLRX2ZERO);
494 getSetting(
"H pol 2nd ant dead", HPOLRX2ZERO);
495 getSetting(
"RCP 2nd ant dead", RCPRX2ZERO);
496 getSetting(
"LCP 2nd ant dead", LCPRX2ZERO);
498 if (WHICH==0 && !(SCALEDOWNEPOLRX1==1 && RCPRX2ZERO==1)){
499 std::cout <<
"Non-default setting: WHICH= " << WHICH <<
" and EPOLRX2ZERO= " << EPOLRX2ZERO << std::endl;
514 getSetting(
"Add noise to signal", SIGNAL_FLUCT);
516 if (SIGNAL_FLUCT!=1){
517 std::cout <<
"Non-default setting: SIGNAL_FLUCT= " << SIGNAL_FLUCT << std::endl;
520 getSetting(
"Zero signal", ZEROSIGNAL);
522 std::cout <<
"Non-default setting: ZEROSIGNAL= " << ZEROSIGNAL << std::endl;
525 getSetting(
"Random rotation polarization", RANDOMISEPOL);
527 getSetting(
"LPM effect", useLPM);
528 getSetting(
"E-field factor", jamieFactor);
529 getSetting(
"Thermal noise factor", THERMALNOISE_FACTOR);
531 if (THERMALNOISE_FACTOR!=1){
532 std::cout <<
"Non-default setting: THERMALNOISE_FACTOR= " << THERMALNOISE_FACTOR << std::endl;
535 getSetting(
"Disable polarization vectors", REMOVEPOLARIZATION);
537 if (REMOVEPOLARIZATION==1){
538 std::cout <<
"Non-default setting: Polarizations turned off!" << std::endl;
540 getSetting(
"Use pulser spectrum", PULSER);
542 std::cout <<
"Warning! Injecting a pulser spectrum- not simulating neutrinos! PULSER = " 543 << PULSER << std::endl;
546 getSetting(
"Centre one phi-sector",
CENTER);
549 std::cout <<
"WARNING!! Rotating payload to center one phi sector on the incoming signal for each event." 553 getSetting(
"Force vertical polarization", MAKEVERTICAL);
555 if (MAKEVERTICAL!=0){
556 std::cout <<
"WARNING!! Rotating polarization so it is always vertical approaching the payload" << std::endl;
567 getSetting(
"Slopeyness", SLOPEYSIZE);
568 if (SLOPEYSIZE!=0.012){
569 std::cout <<
"Non-default setting: SLOPEYSIZE= " << SLOPEYSIZE << std::endl;
571 getSetting(
"Enable slopeyness", SLOPEY);
573 std::cout <<
"Non-default setting: SLOPEY= " << SLOPEY << std::endl;
575 getSetting(
"Depth dependent refractive index", NOFZ);
577 std::cout <<
"Non-default setting: NOFZ= " << NOFZ << std::endl;
579 getSetting(
"Variable attenuation length", VARIABLE_ATTEN);
580 if (VARIABLE_ATTEN!=0){
581 std::cout <<
"Non-default setting: VARIABLE_ATTEN= " << VARIABLE_ATTEN << std::endl;
583 getSetting(
"Constant ice thickness", CONSTANTICETHICKNESS);
585 if (CONSTANTICETHICKNESS==1){
586 std::cout <<
"Non-default setting: CONSTANTICETHICKNESS= " << CONSTANTICETHICKNESS << std::endl;
589 getSetting(
"Fixed ice elevation", FIXEDELEVATION);
590 if (FIXEDELEVATION==1){
591 std::cout <<
"Non-default setting: FIXEDELEVATION= " << FIXEDELEVATION << std::endl;
594 getSetting(
"Antarctic ice model", ICE_MODEL);
595 if ((CONSTANTICETHICKNESS || FIXEDELEVATION) && ICE_MODEL != 0) {
597 std::cout <<
"Constant ice thickness and/or fixed elevation requested. Using Crust 2.0 ice model." << std::endl;
601 std::cout <<
"Using Crust 2.0 ice model." << std::endl;
603 else if (ICE_MODEL==1){
604 std::cout <<
"Using BEDMAP ice model." << std::endl;
607 getSetting(
"Flat surface", FLATSURFACE);
609 std::cout <<
"Non-default setting: all surface segments are flat." << std::endl;
612 getSetting(
"Medium", medium);
614 getSetting(
"Enable surface roughness", ROUGHNESS);
615 getSetting(
"Surface roughness", ROUGHSIZE);
616 getSetting(
"Screen edge length [meters]", SCREENEDGELENGTH);
618 getSetting(
"Screen step size [meters]", SCREENSTEPSIZE);
620 getSetting(
"FIRN", FIRN);
622 std::cout <<
"Warning! Non-standard parameter setting. FIRN = " << FIRN << std::endl;
624 getSetting(
"Which attenuation length", MOOREBAY);
626 getSetting(
"Source Option", SOURCE,
true);
627 getSetting(
"Source Use Exponent", SOURCE_USE_EXPONENT,
true);
628 getSetting(
"Source Max Energy", SOURCE_MAX_E,
true);
629 getSetting(
"Source Min Energy", SOURCE_MIN_E,
true);
630 getSetting(
"Which Sources", WHICH_SOURCES,
true);
631 getSetting(
"Which Subtype", WHICH_SUBTYPE,
true);
632 getSetting(
"Which Start Time", WHICH_START_TIME,
true);
633 getSetting(
"Which End Time", WHICH_END_TIME,
true);
634 getSetting(
"Source Skip When None", SOURCE_SKIP_WHEN_NONE,
true);
635 getSetting(
"Fixed Horizon Offset",HORIZON_OFFSET,
true);
636 if (SOURCE_SKIP_WHEN_NONE)
638 std::cout <<
"Non-default setting: settings->SOURCE_SKIP_WHEN_NONE= " << SOURCE_SKIP_WHEN_NONE << std::endl;
641 getSetting(
"Save Truth Nu Tree",SAVE_TRUTH_NU_TREE,
true);
643 getSetting(
"Cross-section factor", SIGMA_FACTOR);
644 if (SIGMA_FACTOR!=1){
645 std::cout <<
"Non-default setting: settings->SIGMA_FACTOR= " << SIGMA_FACTOR << std::endl;
647 getSetting(
"Theta_th factor", THETA_TH_FACTOR);
648 if (THETA_TH_FACTOR!=1){
649 std::cout <<
"Non-default setting: THETA_TH_FACTOR= " << THETA_TH_FACTOR << std::endl;
651 getSetting(
"Chance in hell factor", CHANCEINHELL_FACTOR);
652 if (CHANCEINHELL_FACTOR!=1){
653 std::cout <<
"Non-default setting: CHANCEINHELL_FACTOR= " << CHANCEINHELL_FACTOR << std::endl;
655 getSetting(
"Skip neutrinos", SKIPCUTS);
657 std::cout <<
"Non-default setting: Skipping all cuts!" << std::endl;
659 getSetting(
"Restrict neutrino directions", USEDIRECTIONWEIGHTS);
660 getSetting(
"Restrict neutrino positions", USEPOSITIONWEIGHTS);
661 if (USEPOSITIONWEIGHTS==0){
662 std::cout <<
"Non-default setting: Not selecting events within the horizon." << std::endl;
664 getSetting(
"Weight on absorption", WEIGHTABSORPTION);
665 getSetting(
"Phi points banana", horizontal_banana_points);
666 getSetting(
"Theta points banana", vertical_banana_points);
667 getSetting(
"Signal across frequencies", FORSECKEL);
668 getSetting(
"Shower type", SHOWERTYPE);
669 getSetting(
"Loop over boresights", BORESIGHTS);
671 std::cout <<
"Warning! Non-standard parameter setting. BORESIGHTS = " << BORESIGHTS << std::endl;
680 getSetting(
"Askaryan parameterization", askaryanParameterization);
682 getSetting(
"Cross-section parameterization", SIGMAPARAM);
683 getSetting(
"Inelasticity parameterization", YPARAM);
684 getSetting(
"Secondary interactions", SECONDARIES);
686 std::cout <<
"Non-default setting: SECONDARIES= " << SECONDARIES << std::endl;
688 getSetting(
"Tau decay as secondary interaction", TAUDECAY);
690 std::cout <<
"Non-default setting: TAUDECAY= " << TAUDECAY << std::endl;
692 getSetting(
"Include atmosphere", ATMOSPHERE);
694 std::cout <<
"Non-default setting: ATMOSPHERE= " << ATMOSPHERE << std::endl;
696 getSetting(
"Constant crust density", CONSTANTCRUST);
697 if (CONSTANTCRUST==1){
698 std::cout <<
"Non-default setting: CONSTANTCRUST= " << CONSTANTCRUST << std::endl;
700 getSetting(
"Constant y", CONSTANTY);
701 getSetting(
"Max interaction distance", MAXHORIZON);
702 getSetting(
"Set tau modes", taumodes);
704 getSetting(
"Which rays", WHICHRAYS);
706 std::cout <<
"Non-default setting: WHICHRAYS= " << WHICHRAYS << std::endl;
708 getSetting(
"CreateHorizons file", WRITE_FILE);
710 std::cout<<
"Writing CreateHorizons input file." << std::endl;
712 getSetting(
"Theta resolution", SIGMA_THETA);
714 std::cout <<
"Non-default setting: SIGMA_THETA = 1" << std::endl;
718 getSetting(
"Seavey Low Frequency",FREQ_LOW_SEAVEYS,
true);
719 BW_SEAVEYS=FREQ_HIGH_SEAVEYS-FREQ_LOW_SEAVEYS;
721 getSetting(
"Low frequency",
FREQ_LOW);
726 getSetting(
"High frequency", FREQ_HIGH);
734 getSetting(
"SLAC run", SLAC);
737 std::cout <<
"Warning! Non-standard parameter setting. SLAC = " << SLAC << std::endl;
740 foutput <<
"!!!!SLAC setting causes some settings to be superseded:" << std::endl;
742 foutput <<
"FIRN=0" << std::endl;
744 foutput <<
"SLOPEY=0" << std::endl;
746 foutput <<
"BORESIGHTS=1" << std::endl;
747 BN_ALTITUDE=4.22/0.3;
748 foutput <<
"BN_ALTITUDE=4.22/0.3" << std::endl;
749 RANDOMIZE_BN_ORIENTATION=0;
750 foutput <<
"RANDOMIZE_BN_ORIENTATION=0" << std::endl;
752 foutput <<
"SKIPCUTS=1" << std::endl;
754 foutput <<
"SLACSLOPE=5.8" << std::endl;
756 foutput <<
"SLACICELENGTH=5.02" << std::endl;
758 getSetting(
"SLAC horizontal distance", SLAC_HORIZDIST);
759 getSetting(
"SLAC ice slope", SLACSLOPE);
760 getSetting(
"SLAC block length", SLACICELENGTH);
761 getSetting(
"SLAC interaction depth", SLAC_HORIZ_DEPTH);
762 SLAC_DEPTH=tan(SLACSLOPE*RADDEG)*(SLACICELENGTH-SLAC_HORIZ_DEPTH)
772 getSetting(
"Coherent power threshold", COHERENT_THRESHOLD );
777 APPLYIMPULSERESPONSEDIGITIZER=0;
778 APPLYIMPULSERESPONSETRIGGER=0;
779 USETIMEDEPENDENTTHRESHOLDS=0;
781 getSetting(
"Digitizer path impulse response", APPLYIMPULSERESPONSEDIGITIZER);
782 std::cout <<
"Apply impulse response to digitizer path: " << APPLYIMPULSERESPONSEDIGITIZER << std::endl;
783 getSetting(
"Trigger path impulse response", APPLYIMPULSERESPONSETRIGGER);
784 std::cout <<
"Apply impulse response to trigger path: " << APPLYIMPULSERESPONSETRIGGER << std::endl;
786 #ifdef ANITA_UTIL_EXISTS 787 if ( (APPLYIMPULSERESPONSEDIGITIZER || APPLYIMPULSERESPONSETRIGGER) && WHICH!=8 && WHICH!=9 && WHICH!=10) {
788 std::cout <<
"Signal chain impulse response is only available for anita-2 and anita-3." << std::endl;
792 #ifndef ANITA_UTIL_EXISTS 793 if (APPLYIMPULSERESPONSEDIGITIZER || APPLYIMPULSERESPONSETRIGGER){
794 std::cout <<
"Signal chain impulse response can only be applied when the Anita tools are sourced." << std::endl;
798 getSetting(
"Time dependent thresholds", USETIMEDEPENDENTTHRESHOLDS);
799 std::cout <<
"Use time-dependent thresholds: " << USETIMEDEPENDENTTHRESHOLDS << std::endl;
800 getSetting(
"Dead time", USEDEADTIME);
801 std::cout <<
"Use dead time from flight: " << USEDEADTIME << std::endl;
803 if ( (USETIMEDEPENDENTTHRESHOLDS || USEDEADTIME) && WHICH!=9 && WHICH!=10) {
804 std::cout <<
"Time-dependent thresholds are only available for anita-3." << std::endl;
809 getSetting(
"Digitizer noise from flight", NOISEFROMFLIGHTDIGITIZER);
810 std::cout <<
"Use noise from flight for digitizer path: " << NOISEFROMFLIGHTDIGITIZER << std::endl;
812 getSetting(
"Trigger noise from flight", NOISEFROMFLIGHTTRIGGER);
813 std::cout <<
"Use noise from flight for trigger path: " << NOISEFROMFLIGHTTRIGGER << std::endl;
815 #ifdef ANITA3_EVENTREADER 816 if ( (NOISEFROMFLIGHTDIGITIZER || NOISEFROMFLIGHTTRIGGER) && (WHICH!=9 && WHICH!=10)) {
817 std::cout <<
"Noise from flight only available for anita-3." << std::endl;
820 if (!APPLYIMPULSERESPONSETRIGGER && NOISEFROMFLIGHTTRIGGER ){
821 std::cout <<
"Noise from flight can only be applied to trigger path if impulse reponse is also used " << std::endl;
826 #ifndef ANITA_UTIL_EXISTS 827 if (NOISEFROMFLIGHTDIGITIZER || NOISEFROMFLIGHTTRIGGER){
828 std::cout <<
"Noise from flight can only be applied when the Anita tools are sourced." << std::endl;
833 getSetting(
"Min bias", MINBIAS);
835 std::cout <<
"Generate Minimum Bias sample: " << MINBIAS << std::endl;
839 getSetting(
"Efficiency scan", TRIGGEREFFSCAN );
840 if (TRIGGEREFFSCAN==1){
841 getSetting(
"Central phi-sector", trigEffScanPhi );
842 getSetting(
"Apply pulse at surf", TRIGGEREFFSCAPULSE );
843 getSetting(
"Off-axis attenuation", efficiencyScanOffAxisAttenuations );
844 getSetting(
"Rings used", efficiencyScanRingsUsed );
845 getSetting(
"Phi-sectors delays", efficiencyScanPhiSectorDelay );
846 getSetting(
"Ring delays", efficiencyScanRingDelay );
847 getSetting(
"Ring delays to phi", efficiencyScanApplyRingDelay );
850 getSetting(
"Simulate TUFFs", TUFFSTATUS);
851 getSetting(
"Which TUFFs are on", whichTUFFsON);
852 if (TUFFSTATUS>0) cout <<
"TUFFs are simulated with status " << TUFFSTATUS << endl;
854 getSetting(
"Add CW", ADDCW);
855 if(ADDCW) cout <<
"Adding CW " << endl;
857 getSetting(
"Specific Payload Unix Time", PAYLOAD_USE_SPECIFIC_TIME);
858 getSetting(
"Specific Payload Delta Time", PAYLOAD_USE_SPECIFIC_TIME_DELTA);
860 getSetting(
"Use Specific Interaction Location", SPECIFIC_NU_POSITION);
861 std::vector<double> specific_place;
862 getSetting(
"Specific Interaction Location", specific_place);
863 if (specific_place.size() == 3)
865 SPECIFIC_NU_POSITION_LATITUDE = specific_place[0];
866 SPECIFIC_NU_POSITION_LONGITUDE = specific_place[1];
867 SPECIFIC_NU_POSITION_ALTITUDE = specific_place[2];
870 getSetting(
"Specific Interaction Location Maximum Distance", SPECIFIC_NU_POSITION_DISTANCE);
873 getSetting(
"Ignore Cross-Pol", IGNORE_CROSSPOL);
874 getSetting(
"Polarization Sign Hack", POL_SIGN_HACK);
875 getSetting(
"Minimum weight", CUTONWEIGHTS);
876 getSetting(
"Minimum probability weight", CUTONWEIGHTPROBS,1);
877 getSetting(
"Absolute declination cut", DEC_CUT);
878 getSetting(
"Draw all-sky map", ALL_SKY_MAP);
881 getSetting(
"Custom Name",CUSTOM_NAME);
882 getSetting(
"Custom RA",CUSTOM_RA);
883 getSetting(
"Custom Dec",CUSTOM_DEC);
884 getSetting(
"Custom Gamma",CUSTOM_GAMMA);
896 if (WHICH==2 || WHICH==6 || WHICH==8 || WHICH==9 || WHICH==10){
897 anita1->NTRIGGERLAYERS = NLAYERS - 1;
900 anita1->NTRIGGERLAYERS=NLAYERS;
904 anita1->INCLINE_TOPTHREE=INCLINE_TOPTHREE;
905 anita1->INCLINE_NADIR=INCLINE_NADIR;
911 anita1->LIVETIME=45.*24.*3600.*0.75;
914 anita1->LIVETIME=6.02*24.*3600.;
917 anita1->LIVETIME=17.*24.*3600.;
920 anita1->LIVETIME=28.5*24*3600;
923 anita1->LIVETIME=17.4*24*3600;
925 anita1->LIVETIME=14.*24.*3600.;
930 anita1->LIVETIME=100.*24.*3600.;
939 anita1->GAINS = GAINS;
940 anita1->BANDING = BANDING;
943 anita1->SIGMA_THETA = SIGMA_THETA;
947 for (
unsigned int i=0;i<tempThresholds.size();i++) {
948 anita1->bwslice_thresholds[i] = tempThresholds.at(i);
952 for (
unsigned int i=0; i < bandLowEdgesMHz.size(); i++) {
953 anita1->bwslice_min[i] = 1e6*bandLowEdgesMHz.at(i);
954 anita1->bwslice_max[i] = 1e6*bandHighEdgesMHz.at(i);
955 anita1->bwslice_center[i] = 0.5*(anita1->bwslice_min[i] + anita1->bwslice_max[i]);
956 anita1->bwslice_width[i] = anita1->bwslice_max[i] - anita1->bwslice_min[i];
959 for(
unsigned int i=0; i < requiredBands.size(); i++){
960 anita1->bwslice_required[i] = requiredBands.at(i);
963 for(
unsigned int i=0; i < allowedBands.size(); i++){
964 anita1->bwslice_allowed[i] = allowedBands.at(i);
967 anita1->maxthreshold=0.;
969 if (anita1->BANDING!=1){
970 anita1->bwmin=200.E6;
973 const int numBands = 5;
974 for (
int i=0; i<numBands; i++) {
975 if (anita1->bwslice_thresholds[i]>anita1->maxthreshold && anita1->bwslice_allowed[i]==1){
976 anita1->maxthreshold = anita1->bwslice_thresholds[i];
978 if (anita1->BANDING==1) {
979 if ((anita1->bwslice_max[i] - anita1->bwslice_min[i]) < anita1->bwmin && anita1->bwslice_allowed[i] == 1){
981 anita1->bwmin = anita1->bwslice_max[i] - anita1->bwslice_min[i];
987 anita1->
NOTCH_MIN = 1e6*notchFilterLimitsMHz.at(0);
988 anita1->NOTCH_MAX = 1e6*notchFilterLimitsMHz.at(1);
990 if (anita1->
NOTCH_MIN>anita1->NOTCH_MAX) {
991 std::cout <<
"Min of notch filter is greater than max. Try again." << std::endl;
993 if (anita1->
NOTCH_MIN!=0 || anita1->NOTCH_MAX!=0){
994 std::cout <<
"Applying a notch filter from " << anita1->
NOTCH_MIN <<
" Hz to " 995 << anita1->NOTCH_MAX <<
" Hz" << std::endl;
997 anita1->trigRequirements[0] = trigRequirements[0];
998 anita1->trigRequirements[1] = trigRequirements[1];
999 anita1->trigRequirements[2] = trigRequirements[2];
1000 anita1->REQUIRE_CENTRE = REQUIRE_CENTRE;
1001 for(
unsigned int i=0; i < channelRequirePol.size(); i++){
1002 anita1->pol_required[i] = channelRequirePol.at(i);
1004 for(
unsigned int i=0; i < channelAllowedPol.size(); i++){
1005 anita1->pol_allowed[i] = channelAllowedPol.at(i);
1010 sig1->SetLPM(useLPM);
1011 if (sig1->GetLPM()!=1){
1012 std::cout <<
"Non-default setting: LPM= " << sig1->GetLPM() << std::endl;
1014 sig1->SetParameterization(askaryanParameterization);
1015 sig1->SetJaime_Factor(jamieFactor);
1016 sig1->SetMedium(medium);
1019 sec1->SECONDARIES=SECONDARIES;
1020 sec1->TAUDECAY=TAUDECAY;
1022 anita1->trigEffScanPhi = trigEffScanPhi;
1023 for (
unsigned int i=0; i < efficiencyScanOffAxisAttenuations.size(); i++){
1024 anita1->trigEffScanAtt[i] = efficiencyScanOffAxisAttenuations.at(i);
1027 for (
unsigned int i=0; i < efficiencyScanPhiSectorDelay.size(); i++){
1029 anita1->trigEffScanPhiDelay[i] = efficiencyScanPhiSectorDelay.at(i)*1e-9;
1032 for (
unsigned int i=0; i < efficiencyScanRingDelay.size(); i++){
1034 anita1->trigEffScanRingDelay[i] = efficiencyScanRingDelay.at(i)*1e-9;
1037 for (
unsigned int i=0; i < efficiencyScanApplyRingDelay.size(); i++){
1038 anita1->trigEffScanApplyRingDelay[i] = efficiencyScanApplyRingDelay.at(i);
1041 for (
unsigned int i=0; i < efficiencyScanRingsUsed.size(); i++){
1042 anita1->trigEffScanRingsUsed[i] = efficiencyScanRingsUsed.at(i);
1047 if (TRIGGEREFFSCAN){
1048 std::cout <<
"Let's do a trigger efficiency scan!" << std::endl;
1049 std::cout <<
"Apply pulse at AMPA (0) or SURF (1) : " << TRIGGEREFFSCAPULSE << std::endl;
1050 std::cout <<
"Central phi sector is " << anita1->trigEffScanPhi << std::endl;
1051 std::cout <<
"Attenuations are ";
1052 for (
int i=0;i<5;i++) std::cout << anita1->trigEffScanAtt[i] <<
" ";
1053 std::cout << std::endl;
1054 std::cout <<
"Phi sector delays are ";
1055 for (
int i=0;i<5;i++) std::cout << anita1->trigEffScanPhiDelay[i] <<
" ";
1056 std::cout << std::endl;
1057 std::cout <<
"The rings used in this scan are ";
1058 for (
int i=0;i<3;i++) std::cout << anita1->trigEffScanRingsUsed[i] <<
" ";
1059 std::cout << std::endl;
1060 std::cout <<
"Ring delays are applie to : ";
1061 for (
int i=0;i<5;i++) std::cout << anita1->trigEffScanApplyRingDelay[i] <<
" ";
1062 std::cout << std::endl;
1063 std::cout <<
"Ring delays are for T-M, M-B, T-B : ";
1064 for (
int i=0;i<3;i++) std::cout << anita1->trigEffScanRingDelay[i] <<
" ";
1065 std::cout << std::endl;
1070 for (
unsigned int i=0; i< whichTUFFsON.size(); i++){
1071 anita1->TUFFstatus[i] = whichTUFFsON.at(i);
1075 std::cout <<
"The TUFFs are simulated for the whole flight with status " << TUFFSTATUS <<
" ! " << std::endl;
1077 std::cout <<
"Using Butterworth filters approximation " << std::endl;
1078 std::cout <<
"Notch 0 status " << anita1->TUFFstatus[0] << std::endl;
1079 std::cout <<
"Notch 1 status " << anita1->TUFFstatus[1] << std::endl;
1080 std::cout <<
"Notch 2 status " << anita1->TUFFstatus[2] << std::endl;
1096 void Settings::complainAboutNotFindingKey(
const TString& key){
1097 std::cerr <<
"Warning in " << ANSI_COLOR_BLUE << __FILE__ << ANSI_COLOR_RESET
1098 <<
", unable to find setting " << ANSI_COLOR_RED << key << ANSI_COLOR_RESET << std::endl;
1102 void Settings::getSetting(
const char* key,
int& value,
bool nonag){
1104 kvpMap::iterator it = keyValuePairStrings.find(key);
1105 if(it == keyValuePairStrings.end()){
1106 if(!nonag) complainAboutNotFindingKey(key);
1110 value = atoi(it->second.Data());
1114 void Settings::getSetting(
const char* key,
float& value,
bool nonag){
1116 kvpMap::iterator it = keyValuePairStrings.find(key);
1117 if(it == keyValuePairStrings.end()){
1118 complainAboutNotFindingKey(key);
1122 value = atof(it->second.Data());
1127 void Settings::getSetting(
const char * key, std::string & value,
bool nonag)
1129 kvpMap::iterator it = keyValuePairStrings.find(key);
1130 if(it == keyValuePairStrings.end()){
1131 if (!nonag) complainAboutNotFindingKey(key);
1135 value = it->second.Data();
1140 void Settings::getSetting(
const char* key,
double& value,
bool nonag){
1142 kvpMap::iterator it = keyValuePairStrings.find(key);
1143 if(it == keyValuePairStrings.end()){
1144 if (!nonag) complainAboutNotFindingKey(key);
1148 value = atof(it->second.Data());
1152 void Settings::getSetting(
const char* key, std::vector<int>& valueArray,
bool nonag){
1154 kvpMap::iterator it = keyValuePairStrings.find(key);
1155 if(it == keyValuePairStrings.end()){
1156 if (!nonag) complainAboutNotFindingKey(key);
1160 parseValueArray(it->second.Data(), valueArray);
1164 void Settings::getSetting(
const char* key, std::vector<float>& valueArray,
bool nonag){
1166 kvpMap::iterator it = keyValuePairStrings.find(key);
1167 if(it == keyValuePairStrings.end()){
1168 if (!nonag) complainAboutNotFindingKey(key);
1172 parseValueArray(it->second.Data(), valueArray);
1176 void Settings::getSetting(
const char* key, std::vector<double>& valueArray,
bool nonag){
1178 kvpMap::iterator it = keyValuePairStrings.find(key);
1179 if(it == keyValuePairStrings.end()){
1180 if (!nonag) complainAboutNotFindingKey(key);
1184 parseValueArray(it->second.Data(), valueArray);
1188 void Settings::parseValueArray(
const char* valueString, std::vector<int>& values){
1189 TString theValueString(valueString);
1191 TObjArray* theValues = theValueString.Tokenize(
",");
1192 for(
int i=0; i < theValues->GetEntries(); ++i){
1194 TObjString* token = (TObjString*) theValues->At(i);
1195 int value = atoi(token->GetString().Data());
1196 values.push_back(value);
1200 void Settings::parseValueArray(
const char* valueString, std::vector<float>& values){
1201 TString theValueString(valueString);
1203 TObjArray* theValues = theValueString.Tokenize(
",");
1204 for(
int i=0; i < theValues->GetEntries(); ++i){
1206 TObjString* token = (TObjString*) theValues->At(i);
1207 float value = atof(token->GetString().Data());
1208 values.push_back(value);
1212 void Settings::parseValueArray(
const char* valueString, std::vector<double>& values){
1213 TString theValueString(valueString);
1215 TObjArray* theValues = theValueString.Tokenize(
",");
1216 for(
int i=0; i < theValues->GetEntries(); ++i){
1218 TObjString* token = (TObjString*) theValues->At(i);
1219 double value = atof(token->GetString().Data());
1220 values.push_back(value);
int WHICHPATH
0=fixed balloon position,1=randomized,2=ANITA-lite GPS data,3=banana plot
double FREQ_LOW
lowest frequency
void printAllKeyValuePairStrings()
double MAXHORIZON
pick the interaction within this distance from the balloon so that it is within the horizon ...
Radiation from interaction.
double BN_LATITUDE
balloon latitude for fixed balloon location
int PERCENTBW
percent bandwidth
Reads in and stores input settings for the run.
double BN_ALTITUDE
pick balloon altitude
double BN_LONGITUDE
balloon longitude for fixed balloon location
int CENTER
whether or not to center one phi sector of the payload on the incoming signal (for making signal effi...
int NBANDS
number of frequency sub-bands (not counting full band)
int RANDOMIZE_BN_ORIENTATION
0=fixed balloon orientation,1=randomized
Contains everything about positions within payload and signals it sees for each event, in both the trigger and signal paths.
double FREQ_HIGH
highest frequency
double FREQ_LOW
lowest frequency
Handles everything related to balloon positions, payload orientation over the course of a flight...
double NOTCH_MIN
low edge of notch filter. This is set in the input file