12 #include "TTreeIndex.h" 18 #include "icemc_random.h" 23 #include "TPostScript.h" 28 #include "TGraphErrors.h" 29 #include "TGraphAsymmErrors.h" 34 #include "TRotation.h" 36 #include "Math/InterpolationTypes.h" 37 #include "Math/Interpolator.h" 41 #include "Constants.h" 43 #include "position.hh" 45 #include "earthmodel.hh" 48 #include "roughness.hh" 51 #include "icemodel.hh" 55 #include "secondaries.hh" 57 #include "counting.hh" 58 #include "Primaries.h" 59 #include "Taumodel.hh" 61 #include "GlobalTrigger.h" 62 #include "ChanTrigger.h" 63 #include "SimulatedSignal.h" 64 #include "EnvironmentVariable.h" 69 #if __cplusplus > 199711L 70 #include <type_traits> 75 #ifdef ANITA_UTIL_EXISTS 76 #include "UsefulAnitaEvent.h" 77 #include "AnitaGeomTool.h" 78 #include "AnitaConventions.h" 79 #include "RawAnitaHeader.h" 85 #ifdef ANITA3_EVENTREADER 86 #include "TruthAnitaEvent.h" 106 const int NVIEWANGLE=100;
111 double eventsfound_beforetrigger=0.;
112 double eventsfound_crust=0;
113 double eventsfound_weightgt01=0;
114 double eventsfound_belowhorizon=0;
115 double eventsfound=0;
116 double eventsfound_prob=0;
119 double poissonerror_minus[21] = {0.-0.00, 1.-0.37, 2.-0.74, 3.-1.10, 4.-2.34, 5.-2.75, 6.-3.82, 7.-4.25, 8.-5.30, 9.-6.33, 10.-6.78, 11.-7.81, 12.-8.83, 13.-9.28, 14.-10.30, 15.-11.32, 16.-12.33, 17.-12.79, 18.-13.81, 19.-14.82, 20.-15.83};
120 double poissonerror_plus[21] = {1.29-0., 2.75-1., 4.25-2., 5.30-3., 6.78-4., 7.81-5., 9.28-6., 10.30-7., 11.32-8., 12.79-9., 13.81-10., 14.82-11., 16.29-12., 17.30-13., 18.32-14., 19.32-15., 20.80-16., 21.81-17., 22.82-18., 23.82-19., 25.30-20.};
123 double MIN_LOGWEIGHT=-3;
124 double MAX_LOGWEIGHT=-1;
126 double eventsfound_binned[NBINS];
127 double eventsfound_binned_e[NBINS];
128 double eventsfound_binned_mu[NBINS];
129 double eventsfound_binned_tau[NBINS];
135 double error_e_plus=0;
136 double error_mu_plus=0;
137 double error_tau_plus=0;
138 double error_minus=0;
139 double error_e_minus=0;
140 double error_mu_minus=0;
141 double error_tau_minus=0;
143 double gain_dipole=2.15;
144 double changle_deg=0;
148 double RANDOMISEPOL=0.;
152 double volume_thishorizon;
154 double longitude_this;
155 double latitude_this;
156 double altitude_this;
157 double heading_this=0.;
162 double pnu=pow(10., 20);
167 double SIGNALRADIUS=2.;
170 double bwslice_vnoise_thislayer[4];
171 int passes_thisevent=0;
172 int unmasked_thisevent=0;
174 int discones_passing;
176 double heff_discone=0;
177 double polarfactor_discone=0.;
179 double volts_discone=0.;
180 double vnoise_discone=0.;
183 double BW_DISCONES=300.E6-120.E6;
192 double t_coeff_pokey, t_coeff_slappy;
195 double e_comp_max1=0;
196 double h_comp_max1=0;
197 double e_comp_max2=0;
198 double h_comp_max2=0;
199 double e_comp_max3=0;
200 double h_comp_max3=0;
203 double diff_3tries=0;
206 double costheta_inc=0;
207 double costheta_exit=0;
208 double theta_rf_atbn;
209 double theta_rf_atbn_measured;
211 double costhetanu=-1000;
216 double nearthlayers=0;
217 double weight_prob=0.;
222 double pieceofkm2sr=0;
224 double CUTONWEIGHTS=1.E-10;
227 int count_inthisloop1=0;
228 int count_inthisloop2=0;
229 int count_inthisloop3=0;
230 double averaging_thetas1=0;
231 double averaging_thetas2=0;
232 double averaging_thetas3=0;
237 int count_asktrigger=0;
238 int count_asktrigger_nfb=0;
241 double count_passestrigger_w=0;
244 int allcuts[2]={0, 0};
246 double allcuts_weighted[2]={0, 0};
247 double allcuts_weighted_polarization[3]={0, 0, 0};
251 int count_chanceofsurviving=0;
253 int count_chanceinhell0=0;
257 double count_chanceinhell2_w=0;
261 int count_chordgoodlength=0;
262 int count_d2goodlength=0;
266 double sum_frac_db[3];
268 const int NBINS_DISTANCE=28;
269 double eventsfound_binned_distance[NBINS_DISTANCE] = {0.};
270 int index_distance=0;
271 double km3sr_distance[NBINS_DISTANCE] = {0.};
272 double error_distance_plus[NBINS_DISTANCE] = {0.};
273 double error_distance_minus[NBINS_DISTANCE] = {0.};
274 int eventsfound_binned_distance_forerror[NBINS_DISTANCE][NBINS] = {{0}};
280 int count_passestrigger_nfb=0;
281 double percent_increase_db=0;
282 double percent_increase_nfb=0;
283 double percent_increase_total=0;
285 double error_km3sr_nfb=0;
286 double error_percent_increase_nfb=0;
291 int count_dbexitsice=0;
294 double eventsfound_nfb_binned[NBINS];
297 double heff_max=0.62639;
300 double scalefactor_distance=0;
301 double scalefactor_attenuation=0;
302 double MAX_ATTENLENGTH=1671;
305 double dviewangle_deg=0;
307 double forseckel[NVIEWANGLE][Anita::NFREQ];
308 double viewangles[NVIEWANGLE];
309 double GetAirDistance(
double altitude_bn,
double beta);
317 int max_antenna0 = -1;
318 int max_antenna1 = -1;
319 int max_antenna2 = -1;
320 double max_antenna_volts0 = 0;
321 double max_antenna_volts0_em = 0;
323 double max_antenna_volts1 = 0;
324 double max_antenna_volts2 = 0;
326 double rx0_signal_eachband[2][5];
327 double rx0_threshold_eachband[2][5];
328 double rx0_noise_eachband[2][5];
329 int rx0_passes_eachband[2][5];
336 double vmmhz1m_visible = 0;
337 int freq_bins = Anita::NFREQ;
338 double total_kgm2 = 0;
340 double r_in_array[3];
341 double nsurf_rfexit_array[3];
342 double nsurf_rfexit_db_array[3];
343 double r_bn_array[3];
344 double n_bn_array[3];
345 double posnu_array[3];
346 double nrf_iceside_array[5][3];
347 double nrf_iceside_db_array[5][3];
348 double ant_max_normal0_array[3];
349 double ant_max_normal1_array[3];
350 double ant_max_normal2_array[3];
351 double n_pol_array[3];
352 double n_exit2bn_array[5][3];
353 double r_enterice_array[3];
354 double n_exit2bn_db_array[5][3];
355 double rfexit_array[5][3];
356 double rfexit_db_array[5][3];
358 int times_crust_entered_det=0;
359 int times_mantle_entered_det=0;
360 int times_core_entered_det=0;
362 int mantle_entered=0;
364 int neutrinos_passing_all_cuts=0;
365 double sum_weights=0;
370 double justNoise_trig[2][48][512];
371 double justSignal_trig[2][48][512];
372 double justNoise_dig[2][48][512];
373 double justSignal_dig[2][48][512];
378 void SetupViewangles(
Signal *sig1);
380 void GetAir(
double *col1);
381 double GetThisAirColumn(
Settings*,
Position r_in,
Vector nnu,
Position posnu,
double *col1,
double& cosalpha,
double& mytheta,
double& cosbeta0,
double& mybeta);
383 double ScaleVmMHz(
double vmmhz1m_max,
const Position &posnu,
const Position &r_bn);
386 double IsItDoubleBang(
double exitlength,
double plepton);
389 void GetCurrent(
string& current);
392 double GetAverageVoltageFromAntennasHit(
Settings *settings1,
int *nchannels_perrx_triggered,
double *voltagearray,
double& volts_rx_sum);
397 void Attenuate(
IceModel *antartica1,
Settings *settings1,
double& vmmhz_max,
double rflength,
const Position &posnu);
401 void IsAbsorbed(
double chord_kgm2,
double len_int_kgm2,
double& weight);
404 int GetRayIceSide(
const Vector &n_exit2rx,
const Vector &nsurf_rfexit,
double nexit,
double nenter,
Vector &nrf2_iceside);
406 double GetViewAngle(
const Vector &nrf2_iceside,
const Vector &nnu);
407 int TIR(
const Vector &n_surf,
const Vector &nrf2_iceside,
double N_IN,
double N_OUT);
409 void IntegrateBands(Anita *anita1,
int k, Screen *panel1,
double *freq,
double scalefactor,
double *sumsignal);
411 void Integrate(Anita *anita1,
int j,
int k,
double *vmmhz,
double *freq,
double scalefactor,
double sumsignal);
413 void interrupt_signal_handler(
int);
415 bool ABORT_EARLY =
false;
419 void CloseTFile(TFile *hfile);
421 int Getmine(
double*,
double*,
double*,
double*);
423 void Getearth(
double*,
double*,
double*,
double*);
426 #ifdef ANITA_UTIL_EXISTS 427 int GetIceMCAntfromUsefulEventAnt(
Settings *settings1,
int UsefulEventAnt);
434 double thresholdsAnt[48][2][5];
435 double thresholdsAntPass[48][2][5];
439 double threshold_start=-1.;
440 double threshold_end=-6.;
441 const int NTHRESHOLDS=20;
442 double threshold_step=(threshold_end-threshold_start)/(
double)NTHRESHOLDS;
444 double npass_v_thresh[NTHRESHOLDS]={0.};
445 double denom_v_thresh[NTHRESHOLDS]={0.};
446 double npass_h_thresh[NTHRESHOLDS]={0.};
447 double denom_h_thresh[NTHRESHOLDS]={0.};
448 double thresholds[NTHRESHOLDS];
450 int main(
int argc,
char **argv) {
466 string input= ICEMC_SRC_DIR +
"/inputs.conf";
471 if( (argc%3!=1)&&(argc%2!=1)) {
472 cout <<
"Syntax for options: -i inputfile -o outputdir -r run_number\n";
477 double trig_thresh=0.;
480 while ((clswitch = getopt(argc, argv,
"t:i:o:r:n:e:")) != EOF) {
483 nnu_tmp=atoi(optarg);
484 cout <<
"Changed number of simulated neutrinos to " << nnu_tmp << endl;
487 trig_thresh=atof(optarg);
491 cout <<
"Changed input file to: " << input << endl;
495 cout <<
"Changed output directory to: " << string(outputdir.Data()) << endl;
496 stemp=
"mkdir -p " + string(outputdir.Data());
497 system(stemp.c_str());
501 stringstream convert(run_num);
509 settings1->SEED=settings1->SEED +run_no;
510 cout <<
"seed is " << settings1->SEED << endl;
511 setSeed(settings1->SEED);
514 stemp=string(outputdir.Data())+
"/nu_position"+run_num+
".txt";
515 ofstream nu_out(stemp.c_str(), ios::app);
517 stemp=string(outputdir.Data())+
"/veff"+run_num+
".txt";
518 ofstream veff_out(stemp.c_str(), ios::app);
520 stemp=string(outputdir.Data())+
"/distance"+run_num+
".txt";
521 ofstream distanceout(stemp.c_str());
523 stemp=string(outputdir.Data())+
"/debug"+run_num+
".txt";
524 fstream outfile(stemp.c_str(), ios::out);
526 stemp=string(outputdir.Data())+
"/forbrian"+run_num+
".txt";
527 fstream forbrian(stemp.c_str(), ios::out);
529 stemp=string(outputdir.Data())+
"/al_voltages_direct"+run_num+
".dat";
530 fstream al_voltages_direct(stemp.c_str(), ios::out);
532 stemp=string(outputdir.Data())+
"/events"+run_num+
".txt";
533 ofstream eventsthatpassfile(stemp.c_str());
535 stemp=string(outputdir.Data())+
"/numbers"+run_num+
".txt";
536 ofstream fnumbers(stemp.c_str());
538 stemp=string(outputdir.Data())+
"/output"+run_num+
".txt";
539 ofstream foutput(stemp.c_str(), ios::app);
541 stemp=string(outputdir.Data())+
"/slacviewangles"+run_num+
".dat";
542 ofstream fslac_viewangles(stemp.c_str());
544 stemp=string(outputdir.Data())+
"/slac_hitangles"+run_num+
".dat";
545 ofstream fslac_hitangles(stemp.c_str());
548 Anita *anita1=
new Anita();
555 settings1->ReadInputs(input.c_str(), foutput, NNU, RANDOMISEPOL);
556 settings1->ApplyInputs(anita1, sec1, sig1, bn1, ray1);
559 settings1->SEED=settings1->SEED + run_no;
560 setSeed(settings1->SEED);
562 bn1->InitializeBalloon();
563 anita1->Initialize(settings1, foutput, inu, outputdir);
568 settings1->EXPONENT=exp_tmp;
570 settings1->SIGNAL_FLUCT=1;
571 settings1->ZEROSIGNAL=1;
573 time_t raw_start_time = time(NULL);
574 struct tm * start_time = localtime(&raw_start_time);
576 cout <<
"Date and time at start of run are: " << asctime (start_time) <<
"\n";
579 Tools::Zero(sum_frac, 3);
580 Tools::Zero(sum_frac_db, 3);
585 Tools::Zero(anita1->PHI_OFFSET, Anita::NLAYERS_MAX);
586 Tools::Zero(anita1->THETA_ZENITH, Anita::NLAYERS_MAX);
587 Tools::Zero(anita1->LAYER_VPOSITION, Anita::NLAYERS_MAX);
588 Tools::Zero(anita1->RRX, Anita::NLAYERS_MAX);
592 double vmmhz[Anita::NFREQ];
595 double vmmhz_em[Anita::NFREQ];
596 double vmmhz_min_thatpasses=1000;
601 double volts_rx_rfcm_lab_e_all[48][512];
602 double volts_rx_rfcm_lab_h_all[48][512];
605 double e_component[Anita::NANTENNAS_MAX]={0};
606 double h_component[Anita::NANTENNAS_MAX]={0};
607 double n_component[Anita::NANTENNAS_MAX]={0};
609 double e_component_kvector[Anita::NANTENNAS_MAX]={0};
610 double h_component_kvector[Anita::NANTENNAS_MAX]={0};
611 double n_component_kvector[Anita::NANTENNAS_MAX]={0};
621 double hitangle_e_all[Anita::NANTENNAS_MAX];
622 double hitangle_h_all[Anita::NANTENNAS_MAX];
624 double eventsfound_db=0;
625 double eventsfound_nfb=0;
628 double sourceLon=-999;
629 double sourceAlt=-999;
630 double sourceLat=-999;
632 Vector n_nutraject_ontheground;
639 int l2trig[
Anita::NPOL][Anita::NTRIGGERLAYERS_MAX];
641 int l1trig[
Anita::NPOL][Anita::NTRIGGERLAYERS_MAX];
647 Tools::Zero(count1->npass, 2);
652 Tools::Zero(eventsfound_binned, NBINS);
653 Tools::Zero(eventsfound_binned_e, NBINS);
654 Tools::Zero(eventsfound_binned_mu, NBINS);
655 Tools::Zero(eventsfound_binned_tau, NBINS);
656 Tools::Zero(eventsfound_nfb_binned, NBINS);
659 Tools::Zero(anita1->arrival_times[0], Anita::NLAYERS_MAX*
Anita::NPHI_MAX);
660 Tools::Zero(anita1->arrival_times[1], Anita::NLAYERS_MAX*
Anita::NPHI_MAX);
667 #ifdef ANITA_UTIL_EXISTS 669 string outputAnitaFile =string(outputdir.Data())+
"/SimulatedAnitaEventFile"+run_num+
".root";
670 TFile *anitafileEvent =
new TFile(outputAnitaFile.c_str(),
"RECREATE");
672 TTree *eventTree =
new TTree(
"eventTree",
"eventTree");
673 eventTree->Branch(
"event", &realEvPtr );
674 eventTree->Branch(
"run", &run_no,
"run/I" );
675 eventTree->Branch(
"weight", &weight,
"weight/D");
677 outputAnitaFile =string(outputdir.Data())+
"/SimulatedAnitaHeadFile"+run_num+
".root";
678 TFile *anitafileHead =
new TFile(outputAnitaFile.c_str(),
"RECREATE");
680 TTree *headTree =
new TTree(
"headTree",
"headTree");
681 headTree->Branch(
"header", &rawHeaderPtr );
682 headTree->Branch(
"weight", &weight,
"weight/D");
684 outputAnitaFile =string(outputdir.Data())+
"/SimulatedAnitaGpsFile"+run_num+
".root";
685 TFile *anitafileGps =
new TFile(outputAnitaFile.c_str(),
"RECREATE");
687 TTree *adu5PatTree =
new TTree(
"adu5PatTree",
"adu5PatTree");
688 adu5PatTree->Branch(
"pat", &Adu5PatPtr );
689 adu5PatTree->Branch(
"eventNumber", &eventNumber,
"eventNumber/I");
690 adu5PatTree->Branch(
"weight", &weight,
"weight/D" );
692 #ifdef ANITA3_EVENTREADER 695 AnitaVersion::set(settings1->ANITAVERSION);
697 outputAnitaFile =string(outputdir.Data())+
"/SimulatedAnitaTruthFile"+run_num+
".root";
698 TFile *anitafileTruth =
new TFile(outputAnitaFile.c_str(),
"RECREATE");
700 TString icemcgitversion = TString::Format(
"%s", EnvironmentVariable::ICEMC_VERSION(outputdir));
701 printf(
"ICEMC GIT Repository Version: %s\n", icemcgitversion.Data());
702 unsigned int timenow = time(NULL);
704 TTree *configAnitaTree =
new TTree(
"configIcemcTree",
"Config file and settings information");
705 configAnitaTree->Branch(
"gitversion", &icemcgitversion );
706 configAnitaTree->Branch(
"startTime", &timenow );
708 configAnitaTree->Fill();
710 TTree *truthAnitaTree =
new TTree(
"truthAnitaTree",
"Truth Anita Tree");
711 truthAnitaTree->Branch(
"truth", &truthEvPtr );
719 IceModel *antarctica =
new IceModel(settings1->ICE_MODEL + settings1->NOFZ*10, settings1->CONSTANTICETHICKNESS * 1000 + settings1->CONSTANTCRUST * 100 + settings1->FIXEDELEVATION * 10 + 0, settings1->WEIGHTABSORPTION);
720 cout <<
"area of the earth's surface covered by antarctic ice is " << antarctica->ice_area <<
"\n";
727 bn1->SetDefaultBalloonPosition(antarctica);
731 anita1->GetPayload(settings1, bn1);
735 bn1->PickBalloonPosition(plusz, antarctica, settings1, anita1);
737 time_t raw_loop_start_time = time(NULL);
738 cout<<
"Starting loop over events. Time required for setup is "<<(int)((raw_loop_start_time - raw_start_time)/60)<<
":"<< ((raw_loop_start_time - raw_start_time)%60)<<endl;
743 double average_altitude=0.;
744 double average_rbn=0.;
747 signal(SIGINT, interrupt_signal_handler);
753 for (inu = 0; inu < NNU; inu++) {
756 if (inu % (NNU / 100) == 0)
757 cout << inu <<
" neutrinos. " << (double(inu)/double(NNU)) * 100 <<
"% complete.\n";
760 cout << inu <<
" neutrinos. " << (double(inu) / double(NNU)) * 100 <<
"% complete.\n";
762 eventNumber=(UInt_t)(run_no)*NNU+inu;
765 setSeed(eventNumber);
767 anita1->passglobtrig[0]=0;
768 anita1->passglobtrig[1]=0;
770 unmasked_thisevent=1;
771 vmmhz_min_thatpasses=1000;
780 bn1->dtryingposition=-999;
781 for (
int i=0; i<Anita::NFREQ;i++) {
788 bn1->PickBalloonPosition(antarctica, settings1, inu, anita1, getRNG(RNG_BALLOON_POSITION)->Rndm());
792 average_altitude+=bn1->altitude_bn/(double)NNU;
793 average_rbn+=bn1->r_bn.Mag()/(double)NNU;
795 realtime_this=bn1->realTime_flightdata;
796 longitude_this=bn1->longitude;
797 latitude_this=bn1->latitude;
798 altitude_this=bn1->altitude;
799 heading_this=bn1->heading;
802 for (
int ilayer=0; ilayer < settings1->NLAYERS; ilayer++) {
803 for (
int ifold=0;ifold<anita1->NRX_PHI[ilayer];ifold++) {
808 antNum = anita1->GetRxTriggerNumbering(ilayer, ifold);
812 #ifdef ANITA_UTIL_EXISTS 813 if (settings1->SIGNAL_FLUCT && (settings1->NOISEFROMFLIGHTDIGITIZER || settings1->NOISEFROMFLIGHTTRIGGER) )
823 chantrig1->
TriggerPath(settings1, anita1, antNum, bn1);
827 chantrig1->
TimeShiftAndSignalFluct(settings1, anita1, ilayer, ifold, volts_rx_rfcm_lab_e_all, volts_rx_rfcm_lab_h_all);
829 chantrig1->
saveTriggerWaveforms(anita1, justSignal_trig[0][antNum], justSignal_trig[1][antNum], justNoise_trig[0][antNum], justNoise_trig[1][antNum]);
830 chantrig1->
saveDigitizerWaveforms(anita1, justSignal_dig[0][antNum], justSignal_dig[1][antNum], justNoise_dig[0][antNum], justNoise_dig[1][antNum]);
844 #ifdef ANITA_UTIL_EXISTS 849 Adu5PatPtr->
latitude = bn1->latitude;
851 Adu5PatPtr->
altitude = bn1->altitude;
852 Adu5PatPtr->
realTime = bn1->realTime_flightdata;
853 Adu5PatPtr->
heading = bn1->heading;
854 Adu5PatPtr->
pitch = bn1->pitch;
855 Adu5PatPtr->roll = bn1->roll;
856 Adu5PatPtr->run = run_no;
860 memset(realEvPtr->
fVolts, 0,
sizeof(realEvPtr->
fVolts) );
861 memset(realEvPtr->
fTimes, 0,
sizeof(realEvPtr->
fTimes) );
863 int fNumPoints = 260;
865 for (
int iant = 0; iant < settings1->NANTENNAS; iant++){
867 int IceMCAnt = GetIceMCAntfromUsefulEventAnt(settings1, iant);
870 realEvPtr->
fNumPoints[UsefulChanIndexV] = fNumPoints;
871 realEvPtr->
fNumPoints[UsefulChanIndexH] = fNumPoints;
872 realEvPtr->
chanId[UsefulChanIndexV] = UsefulChanIndexV;
873 realEvPtr->
chanId[UsefulChanIndexH] = UsefulChanIndexH;
875 for (
int j = 0; j < fNumPoints; j++) {
877 realEvPtr->
fTimes[UsefulChanIndexV][j] = j * anita1->TIMESTEP * 1.0E9;
878 realEvPtr->
fTimes[UsefulChanIndexH][j] = j * anita1->TIMESTEP * 1.0E9;
880 realEvPtr->
fVolts[UsefulChanIndexH][j] = volts_rx_rfcm_lab_h_all[IceMCAnt][j+64]*1000;
881 realEvPtr->
fVolts[UsefulChanIndexV][j] = volts_rx_rfcm_lab_e_all[IceMCAnt][j+64]*1000;
895 rawHeaderPtr->
run = run_no;
905 if (settings1->WHICH<9){
906 rawHeaderPtr->
phiTrigMask = (short) anita1->phiTrigMask;
911 rawHeaderPtr->
realTime = bn1->realTime_flightdata;
912 rawHeaderPtr->
triggerTime = bn1->realTime_flightdata;
913 Adu5PatPtr->
latitude= bn1->latitude;
916 Adu5PatPtr->
realTime=bn1->realTime_flightdata;
917 Adu5PatPtr->
heading = bn1->heading;
918 Adu5PatPtr->
pitch = bn1->pitch;
919 Adu5PatPtr->roll = bn1->roll;
920 Adu5PatPtr->run = run_no;
922 #ifdef ANITA3_EVENTREADER 923 if (settings1->WHICH==9 || settings1->WHICH==10) {
926 rawHeaderPtr->setMask( (
short) anita1->l1TrigMask, (
short) anita1->phiTrigMask,
AnitaPol::kVertical);
927 rawHeaderPtr->setMask( (
short) anita1->l1TrigMaskH, (
short) anita1->phiTrigMaskH,
AnitaPol::kHorizontal);
932 truthEvPtr->
realTime = bn1->realTime_flightdata;
933 truthEvPtr->
run = run_no;
934 truthEvPtr->
nuMom = pnu;
935 truthEvPtr->
nu_pdg = pdgcode;
936 memcpy(truthEvPtr->
e_component, e_component,
sizeof(e_component));
937 memcpy(truthEvPtr->
h_component, h_component,
sizeof(h_component));
938 memcpy(truthEvPtr->
n_component, n_component,
sizeof(n_component));
939 memcpy(truthEvPtr->
e_component_k ,e_component_kvector,
sizeof(e_component_kvector));
940 memcpy(truthEvPtr->
h_component_k ,h_component_kvector,
sizeof(h_component_kvector));
941 memcpy(truthEvPtr->
n_component_k ,n_component_kvector,
sizeof(n_component_kvector));
945 truthEvPtr->
weight = weight;
946 for (
int i=0;i<3;i++){
949 truthEvPtr->
nuPos[i] = -999;
950 truthEvPtr->
nuDir[i] = -999;
958 for (
int i=0;i<48;i++){
959 truthEvPtr->
hitangle_e[i] = hitangle_e_all[i];
960 truthEvPtr->
hitangle_h[i] = hitangle_h_all[i];
962 if(settings1->ROUGHNESS){
963 for (
int i=0;i<Anita::NFREQ;i++)
964 truthEvPtr->
vmmhz[i] = -999;
966 truthAnitaTree->Fill();
980 neutrinos_passing_all_cuts++;
990 std::cout <<
"\n***********************************************************";
991 std::cout <<
"\n* SIGINT received, aborting loop over events early.";
992 std::cout <<
"\n* Stopped after event " << inu <<
" instead of " << NNU;
993 std::cout <<
"\n* Any output which relied on NNU should be corrected for.";
994 std::cout <<
"\n***********************************************************\n";
995 foutput <<
"\n***********************************************************";
996 foutput <<
"\n* SIGINT received, aborting loop over events early.";
997 foutput <<
"\n* Stopped after event " << inu <<
" instead of " << NNU;
998 foutput <<
"\n* Any output which relied on NNU should be corrected for.";
999 foutput <<
"\n***********************************************************\n";
1007 #ifdef ANITA_UTIL_EXISTS 1009 anitafileEvent->cd();
1010 eventTree->Write(
"eventTree");
1011 anitafileEvent->Close();
1012 delete anitafileEvent;
1014 anitafileHead->cd();
1015 headTree->Write(
"headTree");
1016 anitafileHead->Close();
1017 delete anitafileHead;
1020 adu5PatTree->Write(
"adu5PatTree");
1021 anitafileGps->Close();
1022 delete anitafileGps;
1024 #ifdef ANITA3_EVENTREADER 1025 anitafileTruth->cd();
1026 truthAnitaTree->Write(
"truthAnitaTree");
1027 anitafileTruth->Close();
1028 delete anitafileTruth;
1035 time_t raw_end_time = time(NULL);
1036 struct tm * end_time = localtime(&raw_end_time);
1037 cout <<
"Date and time at end of run are: " << asctime (end_time) <<
"\n";
1038 cout<<
"Total time elapsed is "<<(int)((raw_end_time - raw_start_time)/60)<<
":"<< ((raw_end_time - raw_start_time)%60)<<endl;
1040 foutput <<
"\nTotal time elapsed in run is " <<(int)((raw_end_time - raw_start_time)/60)<<
":"<< ((raw_end_time - raw_start_time)%60)<<endl;
1067 void interrupt_signal_handler(
int sig){
1068 signal(sig, SIG_IGN);
1075 #ifdef ANITA_UTIL_EXISTS 1077 int GetIceMCAntfromUsefulEventAnt(
Settings *settings1,
int UsefulEventAnt){
1081 int IceMCAnt = UsefulEventAnt;
1082 if ((settings1->WHICH==9 || settings1->WHICH==10) && UsefulEventAnt<16) {
1083 IceMCAnt = (UsefulEventAnt%2==0)*UsefulEventAnt/2 + (UsefulEventAnt%2==1)*(UsefulEventAnt/2+8);
UInt_t eventNumber
Event number from software.
Double_t h_component_k[48]
Component of the e-field along the rx h-plane.
Double_t weight
Weight assigned by icemc.
Int_t nu_pdg
Neutrino PDG code.
Double_t sourceLat
RF position when leaving the ice: Latitude (using icemc model)
double fVolts[12 *9][260]
Array of unwrapped (unless kNoCalib) voltages for each channel.
void InitializeEachBand(Anita *anita1)
Initialize trigger bands.
Adu5Pat – The ADU5 Position and Attitude Data.
void TriggerPath(Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
Apply trigger path.
static const int NPOL
number of polarizations
Double_t n_component_k[48]
Component of the e-field along the normal.
Float_t latitude
In degrees.
Radiation from interaction.
double fTimes[12 *9][260]
Array of unwrapped (unless kNoCalib) times for each channel.
Double_t sourceLon
RF position when leaving the ice: Longitude (using icemc model)
Double_t sourceAlt
RF position when leaving the ice: Altitude (using icemc model)
void TimeShiftAndSignalFluct(Settings *settings1, Anita *anita1, int ilayer, int ifold, double volts_rx_rfcm_lab_e_all[48][512], double volts_rx_rfcm_lab_h_all[48][512])
Time shift and fluctuate signal.
Float_t longitude
In degrees.
double volts_rx_forfft[2][5][Anita::HALFNFOUR]
Array of time domain after the antenna gain. Indeces stand for [ipol][iband][itime].
UInt_t realTime
Time from the GPS unit.
const char * ICEMC_SRC_DIR()
Double_t n_component[48]
Normal comp along polarization.
Double_t balloonPos[3]
Balloon position.
void saveTriggerWaveforms(Anita *anita1, double sig0[48], double sig1[48], double noise0[48], double noise1[48])
Save signal and noise waveforms at trigger.
Double_t vmmhz[128]
V/m/MHz at balloon (128 frequency bins)
Class that handles the channel trigger.
Reads in and stores input settings for the run.
This class is a 3-vector that represents a position on the Earth's surface.
void saveDigitizerWaveforms(Anita *anita1, double sig0[48], double sig1[48], double noise0[48], double noise1[48])
Save signal and noise waveforms at digitizer.
void getNoiseFromFlight(Settings *settings1, Anita *anita1, int ant, bool also_digi=true)
Add noise from ANITA-3 flight to the time domain waveforms.
Double_t h_component[48]
H comp along polarization.
UInt_t realTime
unixTime of readout
UsefulAnitaEvent – The Calibrated Useful Anita Event object.
Float_t altitude
In metres.
Double_t hitangle_h[48]
Hit angles rel. to h plane stored for each antenna.
void DigitizerPath(Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
Apply digitizer path.
TruthAnitaEvent – The Truth ANITA Event.
Double_t e_component[48]
E comp along polarization.
Shape of the earth, ice thicknesses, profiles of earth layers, densities, neutrino absorption...
static const int NLAYERS_MAX
max number of layers (in smex design, it's 4)
int fCapacitorNum[12 *9][260]
Array of capacitor numbers.
Double_t nuDir[3]
Neutrino direction.
Double_t e_component_k[48]
Component of e-field along the rx e-plane.
Double_t nuMom
Neutrino momentum.
int fNumPoints[12 *9]
Number of poins per channel.
Handles everything related to balloon positions, payload orientation over the course of a flight...
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
static const int NPHI_MAX
max number of antennas around in phi (in smex, 16)
Float_t heading
0 is facing north, 180 is facing south
Handles event counting as cuts are made.
UInt_t eventNumber
Software event number.
Double_t nuPos[3]
Neutrino position.
Double_t hitangle_e[48]
Hit angles rel. to e plane stored for each antenna.
Double_t balloonDir[3]
Balloon direction.
Ice thicknesses and water depth.