7 #include "earthmodel.hh" 14 #include "ChanTrigger.h" 39 #include "EnvironmentVariable.h" 41 #ifdef ANITA_UTIL_EXISTS 43 #include "AnitaEventCalibrator.h" 44 #include "AnitaGeomTool.h" 45 #include "AnitaConventions.h" 48 #include "icemc_random.h" 50 const std::string ICEMC_DATA_DIR=ICEMC_SRC_DIR+
"/data/";
63 arrival_times[0][irx]=arrival_times[1][irx]=0.;
68 Tools::Zero(VNOISE_ANITALITE,16);
69 INCLINE_TOPTHREE = 10.;
71 SIGMA_THETA=0.5*RADDEG;
112 Tools::Zero(bwslice_thresholds,5);
113 for (
int i=0;i<5;i++) {
114 bwslice_allowed[i]=1;
116 bwslice_required[0]=0;
117 bwslice_required[1]=0;
118 bwslice_required[2]=0;
119 bwslice_required[3]=0;
120 bwslice_required[4]=1;
127 bwslice_center[0]=265.e6;
128 bwslice_center[1]=435.e6;
129 bwslice_center[2]=650.e6;
130 bwslice_center[3]=980.e6;
131 bwslice_center[4]=682.5E6;
133 bwslice_width[0]=130.e6;
134 bwslice_width[1]=160.e6;
135 bwslice_width[2]=250.e6;
136 bwslice_width[3]=370.e6;
137 bwslice_width[4]=965.E6;
141 for (
int i=0;i<4;i++) {
142 bwslice_min[i]=bwslice_center[i]-bwslice_width[i]/2.;
143 bwslice_max[i]=bwslice_center[i]+bwslice_width[i]/2.;
146 for (
int i = 0; i < 5; i++)
149 imaxbin[i] = NFOUR/2;
152 bwslice_min[4]= bwslice_center[0]-bwslice_width[0]/2.;
153 bwslice_max[4]=bwslice_center[3]+bwslice_width[3]/2.;
159 const char* outputdir;
160 outputdir =
"outputs";
163 if (stat(outputdir, &sb) == 0 && S_ISDIR(sb.st_mode))
169 mkdir(outputdir,S_IRWXU);
176 coherent_datafile->cd();
178 coherent_waveform_sum_tree->Write();
179 coherent_datafile->Write();
181 coherent_waveform_sum_tree->Delete();
182 coherent_datafile->Close();
183 coherent_datafile->Delete();
189 int Anita::Match(
int ilayer,
int ifold,
int rx_minarrivaltime) {
191 if (ilayer==GetLayer(rx_minarrivaltime) && ifold==GetIfold(rx_minarrivaltime))
200 for (
int i=0;i<ilayer;i++) {
218 return GetRx(ilayer,ifold);
225 if (settings1->WHICH==2 || settings1->WHICH==6) {
227 bwslice_vnoise[il][0]=5.5125E-6;
228 bwslice_vnoise[il][1]=6.1157E-6;
229 bwslice_vnoise[il][2]=7.64446E-6;
230 bwslice_vnoise[il][3]=9.29989E-6;
231 bwslice_vnoise[il][4]=0.;
232 for (
int i=0;i<4;i++) {
233 bwslice_vnoise[il][4]+=bwslice_vnoise[il][i]*bwslice_vnoise[il][i];
235 bwslice_vnoise[il][4]=sqrt(bwslice_vnoise[il][4]);
240 for (
int ibw=0;ibw<5;ibw++) {
241 bwslice_vnoise[il][ibw]=
ChanTrigger::GetNoise(settings1,bn1->altitude_bn,antarctica->SurfaceAboveGeoid(bn1->latitude,bn1->longitude),
THETA_ZENITH[il],bwslice_max[ibw]-bwslice_min[ibw],0.);
254 count_getnoisewaveforms=0;
263 TIMESTEP=(1./2.6)*1.E-9;
267 if (settings1->WHICH==10) ntuffs=7;
269 for (
int i=0;i<HALFNFOUR;i++) fTimes[i] = i * TIMESTEP * 1.0E9;
271 for (
int i=0;i<NFREQ;i++) {
274 avgfreq_rfcm_lab[i]=0.;
277 initializeFixedPowerThresholds(foutput);
280 if (settings1->WHICH==10){
282 powerthreshold[4] = -3.1;
285 if (settings1->TRIGGERSCHEME==5)
290 minsignalstrength=0.1;
295 INTEGRATIONTIME=3.5E-9;
302 TRIG_TIMESTEP=3.75E-9;
305 MIN_PHI_HYPOTHESIS=-22.5;
306 MAX_PHI_HYPOTHESIS=22.5;
307 MIN_THETA_HYPOTHESIS=-50.;
308 MAX_THETA_HYPOTHESIS=20.;
312 double freqstep=1./(double)(NFOUR/2)/TIMESTEP;
315 for (
int i=0;i<HALFNFOUR;i++) {
316 freq_forfft[2*i]=(double)i*freqstep;
317 freq_forfft[2*i+1]=(double)i*freqstep;
319 if (i<HALFNFOUR/2) freq_forplotting[i]=freq_forfft[2*i];
324 readVariableThresholds(settings1);
335 getLabAttn(NPOINTS_LAB,freqlab,labattn);
338 getDiodeDataAndAttenuation(settings1, outputdir);
340 if (settings1->PULSER==1) {
345 reference_angle[0]=0.;
346 reference_angle[1]=5.;
347 reference_angle[2]=10.;
348 reference_angle[3]=20.;
349 reference_angle[4]=30.;
350 reference_angle[5]=45.;
351 reference_angle[6]=90.;
355 for (
int j=0;j<settings1->NLAYERS;j++) {
358 VNOISE[j]=1.52889E-5;
362 #ifdef ANITA_UTIL_EXISTS 363 if (settings1->NOISEFROMFLIGHTDIGITIZER || settings1->NOISEFROMFLIGHTTRIGGER){
364 readNoiseFromFlight(settings1);
366 if (settings1->APPLYIMPULSERESPONSEDIGITIZER){
367 readImpulseResponseDigitizer(settings1);
368 if(settings1->TUFFSTATUS>0){
369 readTuffResponseDigitizer(settings1);
370 readTuffResponseTrigger(settings1);
373 if (settings1->APPLYIMPULSERESPONSETRIGGER){
374 readImpulseResponseTrigger(settings1);
379 if (settings1->WHICH==10){
381 double denom, trig, dig;
385 RayleighFits[0][3] = (TGraph*)RayleighFits[0][2]->Clone();
386 RayleighFits[1][4] = (TGraph*)RayleighFits[1][3]->Clone();
388 RayleighFits[1][27] = (TGraph*)RayleighFits[1][26]->Clone();
389 RayleighFits[1][46] = (TGraph*)RayleighFits[1][47]->Clone();
390 RayleighFits[0][27] = (TGraph*)RayleighFits[0][26]->Clone();
391 RayleighFits[0][28] = (TGraph*)RayleighFits[0][29]->Clone();
392 RayleighFits[0][32] = (TGraph*)RayleighFits[0][33]->Clone();
394 RayleighFits[1][9] = (TGraph*)RayleighFits[1][5]->Clone();
395 RayleighFits[1][42] = (TGraph*)RayleighFits[1][6]->Clone();
397 for (
int ifreq=0; ifreq<numFreqs; ifreq++){
398 fSignalChainResponseA3DigitizerFreqDomain[0][0][3][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[0][0][2][ifreq];
399 fSignalChainResponseA3DigitizerFreqDomain[1][0][4][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[1][0][3][ifreq];
401 fSignalChainResponseA3DigitizerFreqDomain[1][1][11][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[1][1][10][ifreq];
402 fSignalChainResponseA3DigitizerFreqDomain[1][2][14][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[1][2][15][ifreq];
403 fSignalChainResponseA3DigitizerFreqDomain[0][1][11][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[0][1][10][ifreq];
404 fSignalChainResponseA3DigitizerFreqDomain[0][1][12][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[0][1][13][ifreq];
405 fSignalChainResponseA3DigitizerFreqDomain[0][2][0][ifreq] =fSignalChainResponseA3DigitizerFreqDomain[0][2][1][ifreq];
407 fSignalChainResponseA3DigitizerFreqDomain[1][0][9][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[1][0][5][ifreq];
408 fSignalChainResponseA3DigitizerFreqDomain[1][2][10][ifreq]=fSignalChainResponseA3DigitizerFreqDomain[1][0][6][ifreq];
414 calculateImpulseResponsesRatios(settings1);
417 if (settings1->TRIGGEREFFSCAN){
418 readTriggerEfficiencyScanPulser(settings1);
426 setDiodeRMS(settings1, outputdir);
431 string stemp=string(outputdir.Data())+
"/signals.root";
432 fsignals=
new TFile(stemp.c_str(),
"RECREATE");
433 tsignals=
new TTree(
"tsignals",
"tsignals");
435 stemp=string(outputdir.Data())+
"/data.root";
436 fdata=
new TFile(stemp.c_str(),
"RECREATE");
437 tdata=
new TTree(
"tdata",
"tdata");
440 tsignals->Branch(
"signal_vpol_inanita",&
signal_vpol_inanita,
"signal_vpol_inanita[5][512]/D");
441 tsignals->Branch(
"timedomainnoise_rfcm_banding",&timedomainnoise_rfcm_banding,
"timedomainnoise_rfcm_banding[2][5][512]/D");
442 tsignals->Branch(
"total_vpol_inanita",&
total_vpol_inanita,
"total_vpol_inanita[5][512]/D");
449 tsignals->Branch(
"peak_rx_rfcm_lab",&
peak_rx_rfcm_lab,
"peak_rx_rfcm_lab[2]/D");
450 tsignals->Branch(
"inu",&
inu,
"inu/I");
451 tsignals->Branch(
"dangle",&dangle_inanita,
"dangle/D");
452 tsignals->Branch(
"emfrac",&emfrac_inanita,
"emfrac/D");
453 tsignals->Branch(
"hadfrac",&hadfrac_inanita,
"hadfrac/D");
454 tsignals->Branch(
"ston",&
ston,
"ston[5]/D");
458 tsignals->Branch(
"peak_rx_rfcm", &
peak_rx_rfcm,
"peak_rx_rfcm[2]/D" );
460 tsignals->Branch(
"peak_rx_rfcm_lab", &
peak_rx_rfcm_lab,
"peak_rx_rfcm_lab[2]/D" );
461 tsignals->Branch(
"bwslice_vrms",&bwslice_vrms,
"bwslice_vrms[5]/D");
462 tsignals->Branch(
"iminbin",&
iminbin,
"iminbin[5]/I");
463 tsignals->Branch(
"imaxbin",&imaxbin,
"imaxbin[5]/I");
464 tsignals->Branch(
"maxbin_fortotal",&
maxbin_fortotal,
"maxbin_fortotal[5]/I");
465 tsignals->Branch(
"channels_passing",&
channels_passing,
"channels_passing[2][5]/I");
466 tsignals->Branch(
"bwslice_rmsdiode",&bwslice_rmsdiode,
"bwslice_rmsdiode[2][5]/D");
467 tsignals->Branch(
"l1_passing",&l1_passing,
"l1_passing/I");
468 tsignals->Branch(
"integral_vmmhz",&integral_vmmhz_foranita,
"integral_vmmhz/D");
471 tsignals->Branch(
"flag_e_inanita",&flag_e_inanita,
"flag_e_inanita[5][512]/I");
472 tsignals->Branch(
"flag_h_inanita",&flag_h_inanita,
"flag_h_inanita[5][512]/I");
475 tdata=
new TTree(
"tdata",
"tdata");
479 tdata->Branch(
"arrival_times",&arrival_times,
"arrival_times[2][48]/D");
481 tdata->Branch(
"powerthreshold",&powerthreshold,
"powerthreshold[5]/D");
482 tdata->Branch(
"bwslice_rmsdiode",&bwslice_rmsdiode,
"bwslice_rmsdiode[2][5]/D");
486 tdata->Branch(
"arrayofhits_inanita",&arrayofhits_inanita,
"arrayofhits_inanita[3][16][2][512]/I");
488 tdata->Branch(
"l1trig_anita3and4_inanita",&l1trig_anita3and4_inanita,
"l1trig_anita3and4_inanita[2][16][512]/I");
490 tdata->Branch(
"l1trig_anita4lr_inanita",&l1trig_anita4lr_inanita,
"l1trig_anita4lr_inanita[3][16][512]/I");
493 tdata->Branch(
"l2trig_anita4lr_inanita",&l2trig_anita4lr_inanita,
"l2trig_anita4lr_inanita[16][3][512]/I");
495 tdata->Branch(
"l3type0trig_anita4lr_inanita",&l3type0trig_anita4lr_inanita,
"l3type0trig_anita4lr_inanita[16][512]/I");
496 tdata->Branch(
"l3trig_anita4lr_inanita",&l3trig_anita4lr_inanita,
"l3trig_anita4lr_inanita[16][512]/I");
500 tdata->Branch(
"passglobtrig",&passglobtrig,
"passglobtrig[2]/I");
504 tgaryanderic->Branch(
"arrayofhits",&arrayofhits_forgaryanderic,
"arrayofhits_forgaryanderic[3][16][2][512]/I");
505 tgaryanderic->Branch(
"l1trig",&l1trig_anita4lr_forgaryanderic,
"l1trig_anita4lr_forgaryanderic[3][16][512]/I");
508 tgaryanderic->Branch(
"l3type0trig",&l3type0trig_anita4lr_forgaryanderic,
"l3type0trig_anita4lr_forgaryanderic[16][512]/I");
509 tgaryanderic->Branch(
"l3type1trig",&l3type1trig_anita4lr_forgaryanderic,
"l3type1trig_anita4lr_forgaryanderic[16][512]/I");
510 tgaryanderic->Branch(
"passglobtrig",&passglobtrig,
"passglobtrig[2]/I");
511 tgaryanderic->Branch(
"weight",&weight_inanita,
"weight_inanita/D");
512 tgaryanderic->Branch(
"time",&time_trig,
"time_trig[512]/D");
515 tglob=
new TTree(
"tglob",
"tglob");
516 tglob->Branch(
"inu",&
inu,
"inu/I");
517 tglob->Branch(
"passglobtrig",&passglobtrig,
"passglobtrig[2]/I");
518 tglob->Branch(
"l1_passing_allantennas",&l1_passing_allantennas,
"l1_passing_allantennas[48]/I");
523 coherent_datafile =
new TFile(Form(
"%s/coherent_sum_data_file.root", outputdir.Data()),
"RECREATE");
524 coherent_waveform_sum_tree =
new TTree(
"coherent_waveform_sum_tree",
"Coherent Waveform Sum");
525 coherent_waveform_sum_tree->Branch(
"event_number", &cwst_event_number);
526 coherent_waveform_sum_tree->Branch(
"center_phi_sector", &cwst_center_phi_sector);
527 coherent_waveform_sum_tree->Branch(
"rms_noise", &cwst_rms_noise);
528 coherent_waveform_sum_tree->Branch(
"actual_rms", &cwst_actual_rms);
529 coherent_waveform_sum_tree->Branch(
"threshold", &cwst_threshold);
530 coherent_waveform_sum_tree->Branch(
"window_start", &cwst_window_start);
531 coherent_waveform_sum_tree->Branch(
"window_end", &cwst_window_end);
533 coherent_waveform_sum_tree->Branch(
"deg_theta", &cwst_deg_theta);
534 coherent_waveform_sum_tree->Branch(
"deg_phi", &cwst_deg_phi);
536 coherent_waveform_sum_tree->Branch(
"actual_deg_theta", &cwst_actual_deg_theta);
537 coherent_waveform_sum_tree->Branch(
"actual_deg_phi", &cwst_actual_deg_phi);
539 coherent_waveform_sum_tree->Branch(
"timesteps", cwst_timesteps);
541 for (
unsigned i = 0; i < 48; ++i) {
542 cwst_RXs[i].waveform =
new vector <double>(HALFNFOUR, 0.);
543 cwst_RXs[i].digitized =
new vector <double>(HALFNFOUR, 0.);
544 coherent_waveform_sum_tree->Branch(Form(
"rx%u", i), &(cwst_RXs[i]));
547 for (
unsigned int i = 0; i < 9; i++) {
548 cwst_aligned_wfms[i].digitized =
new vector <double>(HALFNFOUR, 0.);
549 coherent_waveform_sum_tree->Branch(Form(
"aligned_wfms%u", i), &(cwst_aligned_wfms[i]));
561 coherent_waveform_sum_tree->Branch(
"summed_wfm", &cwst_summed_wfm);
562 coherent_waveform_sum_tree->Branch(
"power_of_summed_wfm", &cwst_power_of_summed_wfm);
563 coherent_waveform_sum_tree->Branch(
"power", &cwst_power);
569 void Anita::initializeFixedPowerThresholds(ofstream &foutput){
577 powerthreshold[0]=-1.87;
578 powerthreshold[1]=-2.53;
579 powerthreshold[2]=-2.15;
580 powerthreshold[3]=-1.;
581 powerthreshold[4]=-4.41;
585 powerthreshold_nadir[0]=-6.7;
586 powerthreshold_nadir[1]=-6.5;
587 powerthreshold_nadir[2]=-5.1;
588 powerthreshold_nadir[3]=-1.;
589 powerthreshold_nadir[4]=-6.7;
592 foutput <<
"Thresholds are (in p/<p>): " <<
593 powerthreshold[0] <<
" (L)\t" <<
594 powerthreshold[1] <<
" (M)\t" <<
595 powerthreshold[2] <<
" (H)\t" <<
596 powerthreshold[4] <<
" (F)\n";
598 else if (BANDING==0 || BANDING==1) {
600 powerthreshold[0]=-3.27;
601 powerthreshold[1]=-3.24;
602 powerthreshold[2]=-2.48;
603 powerthreshold[3]=-2.56;
604 powerthreshold[4]=-3.;
606 foutput <<
"Thresholds are (in p/<p>): " <<
607 powerthreshold[0] <<
" (L)\t" <<
608 powerthreshold[1] <<
" (M1)\t" <<
609 powerthreshold[2] <<
" (M2)\t" <<
610 powerthreshold[3] <<
" (H)\t" <<
611 powerthreshold[4] <<
" \n";
613 }
else if (BANDING==4 || BANDING==5){
614 powerthreshold[0]=-1;
615 powerthreshold[1]=-1;
616 powerthreshold[2]=-1;
617 powerthreshold[3]=-1;
618 powerthreshold[4]=-5.40247;
621 foutput <<
"Thresholds are (in p/<p>): " <<
622 powerthreshold[0] <<
" (L)\t" <<
623 powerthreshold[1] <<
" (M1)\t" <<
624 powerthreshold[2] <<
" (M2)\t" <<
625 powerthreshold[3] <<
" (H)\t" <<
626 powerthreshold[4] <<
" \n";
631 void Anita::readVariableThresholds(
Settings *settings1){
633 if (settings1->WHICH==8) {
634 fturf=
new TFile((ICEMC_DATA_DIR+
"/turfrate_icemc.root").c_str());
635 turfratechain=(TTree*)fturf->Get(
"turfrate_icemc");
636 turfratechain->SetMakeClass(1);
637 turfratechain->SetBranchAddress(
"phiTrigMask",&phiTrigMask);
639 turfratechain->BuildIndex(
"realTime");
640 turfratechain->GetEvent(0);
642 turfratechain->GetEvent(turfratechain->GetEntries()-1);
646 }
else if (settings1->WHICH==9 || settings1->WHICH==10){
650 if (settings1->WHICH==9){
651 turfFile+=ICEMC_DATA_DIR+
"/SampleTurf_icemc_anita3.root";
652 surfFile+=ICEMC_DATA_DIR+
"/SampleSurf_icemc_anita3.root";
654 turfFile+=ICEMC_DATA_DIR+
"/SampleTurf_run42to367_anita4.root";
655 surfFile+=ICEMC_DATA_DIR+
"/SampleSurf_run42to367_anita4.root";
659 fturf=
new TFile(turfFile.c_str());
660 turfratechain=(TTree*)fturf->Get(
"turfrate_icemc");
661 turfratechain->SetMakeClass(1);
662 turfratechain->SetBranchAddress(
"phiTrigMask",&phiTrigMask);
663 turfratechain->SetBranchAddress(
"phiTrigMaskH",&phiTrigMaskH);
664 turfratechain->SetBranchAddress(
"l1TrigMask",&l1TrigMask);
665 turfratechain->SetBranchAddress(
"l1TrigMaskH",&l1TrigMaskH);
667 turfratechain->SetBranchAddress(
"deadTime",&
deadTime);
669 turfratechain->BuildIndex(
"realTime");
670 turfratechain->GetEvent(0);
672 turfratechain->GetEvent(turfratechain->GetEntries()-1);
676 fsurf=
new TFile(surfFile.c_str());
677 surfchain=(TTree*)fsurf->Get(
"surf_icemc");
678 surfchain->SetMakeClass(1);
679 surfchain->SetBranchAddress(
"thresholds", &
thresholds );
680 surfchain->SetBranchAddress(
"scalers", &
scalers );
683 surfchain->SetBranchAddress(
"fakeScaler", &
fakeScalers );
685 surfchain->BuildIndex(
"realTime");
686 surfchain->GetEvent(0);
688 surfchain->GetEvent(surfchain->GetEntries()-1);
694 void Anita::readAmplification(){
699 TFile *f2=
new TFile((ICEMC_DATA_DIR+
"/gains.root").c_str());
700 TTree *tgain=(TTree*)f2->Get(
"tree1");
702 float freq_ampl_eachantenna[NPOINTS_AMPL];
703 float ampl_eachantenna[NPOINTS_AMPL];
704 float noisetemp_eachantenna[NPOINTS_AMPL];
706 tgain->SetBranchAddress(
"freq",freq_ampl_eachantenna);
707 tgain->SetBranchAddress(
"ampl",ampl_eachantenna);
708 tgain->SetBranchAddress(
"noisetemp",noisetemp_eachantenna);
710 for (
int iant=0;iant<48;iant++) {
711 tgain->GetEvent(iant);
712 for (
int j=0;j<NPOINTS_AMPL;j++) {
714 freq_ampl[iant][j]=(double)freq_ampl_eachantenna[j];
716 ampl[iant][j]=(double)ampl_eachantenna[j];
719 ampl_notdb[iant][j]=pow(10.,ampl[iant][j]/10.);
721 noisetemp[iant][j]=(double)noisetemp_eachantenna[j];
730 void Anita::getDiodeDataAndAttenuation(
Settings *settings1, TString outputdir){
735 sdiode=ICEMC_DATA_DIR+
"/diode_anita1.root";
737 sdiode=ICEMC_DATA_DIR+
"diode_nobanding.root";
739 sdiode=ICEMC_DATA_DIR+
"/diode_anita2.root";
740 else if (BANDING==4 || BANDING==5)
741 sdiode=ICEMC_DATA_DIR+
"/diode_anita3.root";
743 fnoise=
new TFile(sdiode.c_str());
744 tdiode=(TTree*)fnoise->Get(
"diodeoutputtree");
750 sbands=ICEMC_DATA_DIR+
"/bands_anita1.root";
752 sbands=ICEMC_DATA_DIR+
"/bands_nobanding.root";
754 sbands=ICEMC_DATA_DIR+
"/bands_anita2.root";
755 else if (BANDING==4 || BANDING==5)
756 sbands=ICEMC_DATA_DIR+
"/bands_anita2.root";
758 TFile *fbands=
new TFile(sbands.c_str());
759 TTree *tbands=(TTree*)fbands->Get(
"bandstree");
762 for (
int i=0;i<HALFNFOUR;i++) {
763 time[i]=(double)i*TIMESTEP;
764 time_long[i]=time[i];
766 time_centered[i]=time[i]-(double)HALFNFOUR/2*TIMESTEP;
768 for (
int i=HALFNFOUR;i<NFOUR;i++) {
769 time_long[i]=(double)i*TIMESTEP;
776 int m=(int)(maxt_diode/TIMESTEP);
777 for (
int j=0;j<5;j++) {
778 for (
int i=0;i<m;i++) {
779 fdiode_real[j][i]=diode_real[j][i];
781 for (
int i=m;i<NFOUR;i++) {
782 fdiode_real[j][i]=0.;
785 Tools::realft(fdiode_real[j],1,NFOUR);
790 TCanvas *cdiode=
new TCanvas(
"cdiode",
"cdiode",880,800);
792 TGraph *gdiode=
new TGraph(NFOUR/2,time,diode_real[4]);
795 gdiode=
new TGraph(NFOUR/2,freq_forfft,fdiode_real[4]);
799 stemp=string(outputdir.Data())+
"/diode.eps";
800 cdiode->Print((TString)stemp);
802 tdiode->SetBranchAddress(
"avgfreqdomain_lab",&(avgfreqdomain_lab[0]));
803 tdiode->SetBranchAddress(
"freqdomain_amp_icemc",&(freqdomain_rfcm[0]));
804 tdiode->SetBranchAddress(
"freqdomain_rfcm_banding",&(freqdomain_rfcm_banding[0][0]));
808 tbands->SetBranchAddress(
"freq_bands",freq_bands);
809 tbands->SetBranchAddress(
"bandsattn",bandsattn);
811 tbands->SetBranchAddress(
"correl_banding",&(correl_banding[0][0]));
812 tbands->SetBranchAddress(
"correl_lab",&(correl_lab[0]));
820 for (
int j=0;j<5;j++) {
822 for (
int i=0;i<NPOINTS_BANDS;i++) {
825 if (bandsattn[j][i]>1.)
834 TGraph *gbandsattn[5];
836 TH2F *hbandsattn=
new TH2F(
"hbandsattn",
"hbandsattn",100,0.,2.E9,100,0.,1.);
837 TH2F *hcorr=
new TH2F(
"hcorr",
"hcorr",100,0.,2.E9,100,0.,2.);
838 for (
int i=0;i<5;i++) {
839 gbandsattn[i]=
new TGraph(NPOINTS_BANDS,freq_bands[i],bandsattn[i]);
840 gbandsattn[i]->SetLineColor(2+i);
841 gcorr[i]=
new TGraph(NPOINTS_BANDS,freq_bands[i],correl_banding[i]);
842 gcorr[i]->SetLineColor(2+i);
844 TCanvas *cbands=
new TCanvas(
"cbands",
"cbands",880,800);
848 for (
int i=0;i<5;i++) {
849 gbandsattn[i]->Draw(
"l");
853 for (
int i=0;i<5;i++) {
856 stemp=string(outputdir.Data())+
"/bands.eps";
857 cbands->Print((TString)stemp);
878 void Anita::setDiodeRMS(
Settings *settings1, TString outputdir){
880 double mindiodeconvl[5];
881 double onediodeconvl[5];
883 double power_noise_eachband[5][NFOUR];
884 double timedomain_output[5][NFOUR];
888 for (
int i=0;i<5;i++) {
889 bwslice_enoise[i]=0.;
890 bwslice_rmsdiode[0][i]=bwslice_rmsdiode[1][i]=0.;
903 for (
int j=0;j<3;j++) {
905 sprintf(histname,
"hnoise_%d",j);
907 hnoise[j]=
new TH1F(histname,histname,nhnoisebins,-40.,20.);
909 hnoise[j]=
new TH1F(histname,histname,nhnoisebins,-80.,40.);
912 sprintf(histname,
"hnoise_3");
913 hnoise[3]=
new TH1F(histname,histname,nhnoisebins,-60.0,40.0);
914 sprintf(histname,
"hnoise_4");
915 hnoise[4]=
new TH1F(histname,histname,nhnoisebins,-60.0,40.0);
918 sprintf(histname,
"hnoise_3");
919 hnoise[3]=
new TH1F(histname,histname,nhnoisebins,-120.0,80.0);
920 sprintf(histname,
"hnoise_4");
921 hnoise[4]=
new TH1F(histname,histname,nhnoisebins,-120.0,80.0);
928 cout <<
"after getting event, freqdomain_rfcm_banding is " << freqdomain_rfcm_banding[0][NFOUR/8-1] <<
"\n";
957 for (
int j=0;j<5;j++) {
959 for (
int k=0;k<NFOUR/4;k++) {
961 if (bwslice_min[j]>freq_forplotting[k] || bwslice_max[j]<freq_forplotting[k]) {
962 freqdomain_rfcm_banding[j][k]=0.;
971 for (
int j=0;j<5;j++) {
972 for (
int k=0;k<NFOUR/4;k++) {
973 power+=freqdomain_rfcm_banding[j][k]/((double)NFOUR/4);
978 int ngeneratedevents=1000;
979 int passes[5]={0,0,0,0,0};
980 double averageoutput[5]={0.,0.,0.,0.,0.};
982 if (!settings1->NOISEFROMFLIGHTTRIGGER){
983 for (
int i=0;i<ngeneratedevents;i++) {
984 cout << double(i)/double(ngeneratedevents) << endl;
988 for (
int j=0;j<5;j++) {
998 myconvlv(timedomainnoise_rfcm_banding[0][j],NFOUR,fdiode_real[j],mindiodeconvl[j],onediodeconvl[j],power_noise_eachband[j],timedomain_output[j]);
1000 hnoise[j]->Fill(onediodeconvl[j]*1.E15);
1002 bwslice_enoise[j]+=onediodeconvl[j];
1005 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1006 bwslice_meandiode[j]+=timedomain_output[j][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1007 bwslice_vrms[j]+=timedomainnoise_rfcm_banding[0][j][m]*timedomainnoise_rfcm_banding[0][j][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1008 averageoutput[j]+=timedomain_output[j][m]*timedomain_output[j][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1026 for (
int j=0;j<5;j++) {
1028 bwslice_vrms[j]=sqrt(bwslice_vrms[j]);
1032 for (
int j=0;j<5;j++) {
1033 bwslice_enoise[j]=hnoise[j]->GetMean()/1.E15;
1035 bwslice_fwhmnoise[j]=Tools::GetFWHM(hnoise[j]);
1040 for (
int i=0;i<ngeneratedevents;i++) {
1041 GetNoiseWaveforms();
1042 for (
int j=0;j<5;j++) {
1044 myconvlv(timedomainnoise_rfcm_banding[0][j],NFOUR,fdiode_real[j],mindiodeconvl[j],onediodeconvl[j],power_noise_eachband[j],timedomain_output[j]);
1046 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1047 bwslice_rmsdiode[0][j]+=(timedomain_output[j][m]-bwslice_meandiode[j])*(timedomain_output[j][m]-bwslice_meandiode[j])/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1053 for (
int j=0;j<5;j++) {
1054 bwslice_rmsdiode[0][j]=bwslice_rmsdiode[1][j]=sqrt(bwslice_rmsdiode[0][j]);
1055 cout <<
"mean, rms are " << bwslice_meandiode[j] <<
" " << bwslice_rmsdiode[0][j] <<
"\n";
1058 double thresh_begin=-1.;
1059 double thresh_end=-11.;
1060 double thresh_step=1.;
1062 double rate[5][100];
1063 for (
double testthresh=thresh_begin;testthresh>=thresh_end;testthresh-=thresh_step) {
1064 for (
int j=0;j<5;j++) {
1067 for (
int i=0;i<ngeneratedevents;i++) {
1069 GetNoiseWaveforms();
1070 for (
int j=0;j<5;j++) {
1072 myconvlv(timedomainnoise_rfcm_banding[0][j],NFOUR,fdiode_real[j],mindiodeconvl[j],onediodeconvl[j],power_noise_eachband[j],timedomain_output[j]);
1074 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1076 if (timedomain_output[j][m+1]<bwslice_rmsdiode[0][j]*testthresh) {
1078 m+=(int)(DEADTIME/TIMESTEP);
1085 for (
int j=0;j<5;j++) {
1086 int ibin=(int)fabs((testthresh-thresh_begin)/thresh_step);
1088 rate[j][ibin]=passes[j]/((double)ngeneratedevents*((
double)NFOUR/2*(TIMESTEP)-maxt_diode));
1089 if (rate[j][ibin]!=0)
1090 rate[j][ibin]=log10(rate[j][ibin]);
1097 #ifdef ANITA_UTIL_EXISTS 1098 double quickNoise[HALFNFOUR];
1100 memset(bwslice_diodemean_fullband_allchan, 0,
sizeof(bwslice_diodemean_fullband_allchan) );
1101 memset(bwslice_dioderms_fullband_allchan, 0,
sizeof(bwslice_dioderms_fullband_allchan) );
1103 static double tempdiodeoutput[1000][NFOUR];
1105 if (settings1->WHICH==9) {
1106 for (
int ipol=0; ipol<2; ipol++){
1107 for (
int iant=0; iant<48; iant++){
1109 std::cout <<
"Using noise from flight to get rms of channel " << (ipol == 0 ? iant : 48+iant) + 1 <<
" of 96\r" << std::flush;
1110 if((ipol == 0 ? iant : 48+iant) + 1 == 96){std::cout << std::endl;}
1112 for (
int ituff=0; ituff<ntuffs; ituff++){
1113 memset(tempdiodeoutput, 0,
sizeof(tempdiodeoutput) );
1115 for (
int i=0;i<ngeneratedevents;i++) {
1117 getQuickTrigNoiseFromFlight(settings1, quickNoise, ipol, iant, ituff);
1119 myconvlv(quickNoise,NFOUR,fdiode_real[4],mindiodeconvl[4],onediodeconvl[4],power_noise_eachband[4],tempdiodeoutput[i]);
1122 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1123 bwslice_diodemean_fullband_allchan[ipol][iant][ituff]+=tempdiodeoutput[i][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1130 for (
int i=0;i<ngeneratedevents;i++) {
1132 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1133 bwslice_dioderms_fullband_allchan[ipol][iant][ituff]+=(tempdiodeoutput[i][m]-bwslice_diodemean_fullband_allchan[ipol][iant][ituff])*(tempdiodeoutput[i][m]-bwslice_diodemean_fullband_allchan[ipol][iant][ituff])/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1138 bwslice_dioderms_fullband_allchan[ipol][iant][ituff]=sqrt(bwslice_dioderms_fullband_allchan[ipol][iant][ituff]);
1146 }
else if (settings1->WHICH==10){
1148 double quickNoise2[2][HALFNFOUR];
1149 double lcprcpNoise[2][HALFNFOUR];
1151 static double tempdiodeoutput2[1000][NFOUR];
1153 for (
int iant=0; iant<48; iant++){
1155 std::cout <<
"Using noise from flight to get rms of channel pair " << iant + 1 <<
" of 48\r" << std::flush;
1156 if( iant + 1 == 48 ){std::cout << std::endl;}
1158 for (
int ituff=0; ituff<ntuffs; ituff++){
1160 memset(tempdiodeoutput, 0,
sizeof(tempdiodeoutput) );
1161 memset(tempdiodeoutput2, 0,
sizeof(tempdiodeoutput2) );
1163 for (
int i=0;i<ngeneratedevents;i++) {
1165 for (
int ipol=0; ipol<2; ipol++){
1166 getQuickTrigNoiseFromFlight(settings1, quickNoise2[ipol], ipol, iant, ituff);
1170 myconvlv(lcprcpNoise[0],NFOUR,fdiode_real[4],mindiodeconvl[4],onediodeconvl[4],power_noise_eachband[4],tempdiodeoutput[i]);
1171 myconvlv(lcprcpNoise[1],NFOUR,fdiode_real[4],mindiodeconvl[4],onediodeconvl[4],power_noise_eachband[4],tempdiodeoutput2[i]);
1174 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1175 bwslice_diodemean_fullband_allchan[0][iant][ituff]+=tempdiodeoutput[i][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1176 bwslice_diodemean_fullband_allchan[1][iant][ituff]+=tempdiodeoutput2[i][m]/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1184 for (
int i=0;i<ngeneratedevents;i++) {
1186 for (
int m=(
int)(maxt_diode/TIMESTEP);m<NFOUR/2;m++) {
1187 bwslice_dioderms_fullband_allchan[0][iant][ituff]+=(tempdiodeoutput[i][m]-bwslice_diodemean_fullband_allchan[0][iant][ituff])*(tempdiodeoutput[i][m]-bwslice_diodemean_fullband_allchan[0][iant][ituff])/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1188 bwslice_dioderms_fullband_allchan[1][iant][ituff]+=(tempdiodeoutput2[i][m]-bwslice_diodemean_fullband_allchan[1][iant][ituff])*(tempdiodeoutput2[i][m]-bwslice_diodemean_fullband_allchan[1][iant][ituff])/((double)ngeneratedevents*((
double)NFOUR/2-maxt_diode/TIMESTEP));
1193 bwslice_dioderms_fullband_allchan[0][iant][ituff]=sqrt(bwslice_dioderms_fullband_allchan[0][iant][ituff]);
1194 bwslice_dioderms_fullband_allchan[1][iant][ituff]=sqrt(bwslice_dioderms_fullband_allchan[1][iant][ituff]);
1213 TCanvas *c4=
new TCanvas(
"c4",
"c4",880,800);
1215 for (
int j=0;j<5;j++) {
1219 frice[j]=
new TF1(
"frice",
"[2]*(-1.*x-[1])/[0]^2*exp(-1.*(-1.*x-[1])^2/2/[0]^2)",-50.,50.);
1220 frice[j]->SetParameter(0,4.);
1222 frice[j]->SetParameter(1,5.);
1223 frice[j]->SetParameter(2,400.);
1229 if ((BANDING==2 && j!=3) ||
1231 (BANDING!=2 && BANDING!=4) ||
1232 ((BANDING==4||BANDING==5) && j==4) ){
1235 if (j==0 && BANDING==2)
1236 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,1.);
1237 if (j==1 && BANDING==2)
1238 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,2.);
1239 if (j==2 && BANDING==2)
1240 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,10.);
1241 if (j==4 && (BANDING==2 || BANDING==4 || BANDING==5))
1242 hnoise[j]->Fit(frice[j],
"Q",
"",-15.,15.);
1244 if (j==0 && BANDING==0)
1245 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,5.);
1246 if (j==1 && BANDING==0)
1247 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,5.);
1248 if (j==2 && BANDING==0)
1249 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,15.);
1250 if (j==3 && BANDING==0)
1251 hnoise[j]->Fit(frice[j],
"Q",
"",-20.,20.);
1253 frice[j]->GetHistogram()->SetLineWidth(3);
1255 hnoise[j]->SetLineWidth(3);
1256 hnoise[j]->SetXTitle(
"Diode Output (10^{-15} Joules)");
1257 hnoise[j]->SetYTitle(
"Number of Noise Waveforms");
1258 hnoise[j]->SetTitleSize(0.05,
"X");
1259 hnoise[j]->SetTitleSize(0.05,
"Y");
1262 frice[j]->Draw(
"same");
1267 stemp=string(outputdir.Data())+
"/hnoise.eps";
1268 c4->Print((TString)stemp);
1276 #ifdef ANITA_UTIL_EXISTS 1277 void Anita::getQuickTrigNoiseFromFlight(
Settings *settings1,
double justNoise[HALFNFOUR],
int ipol,
int iant,
int ituff){
1280 phasorsTrig[0].setMagPhase(0,0);
1281 Double_t sigma, realPart, imPart, norm;
1283 if (iant<16) iring=0;
1284 else if (iant<32) iring=1;
1286 int iphi = iant - (iring*16);
1288 TRandom * fRand = getRNG(RNG_NOISE);
1289 for(
int i=1;i<numFreqs;i++) {
1291 if (freqs[i]*1e6>=settings1->FREQ_LOW_SEAVEYS && freqs[i]*1e6<=settings1->FREQ_HIGH_SEAVEYS){
1292 norm = fRatioTriggerToA3DigitizerFreqDomain[ipol][iring][iphi][ituff][i];
1293 sigma = RayleighFits[ipol][iant]->Eval(freqs[i])*4./TMath::Sqrt(numFreqs);
1295 realPart = fRand->Gaus(0,sigma);
1296 imPart = fRand->Gaus(0,sigma);
1305 Double_t *justNoiseTemp = rfNoiseTrig->GetY();
1307 for (
int i=0; i<HALFNFOUR; i++){
1311 delete[] phasorsTrig;
1316 void Anita::getPulserData(){
1318 TFile *fpulser=
new TFile((ICEMC_DATA_DIR+
"/pulser.root").c_str());
1320 TGraph *gpulser=(TGraph*)fpulser->Get(
"pulser");
1321 TGraph *gphases=(TGraph*)fpulser->Get(
"phases");
1322 TGraph *gnoise=(TGraph*)fpulser->Get(
"noise");
1326 double *temp1=gpulser->GetX();
1327 for (
int i=0;i<NFOUR/4;i++) {
1328 f_pulser[i]=temp1[i];
1330 double *temp2=gphases->GetX();
1331 for (
int i=0;i<NFOUR/4;i++) {
1332 f_phases[i]=temp2[i];
1334 double *temp3=gpulser->GetY();
1335 double *temp4=gnoise->GetY();
1338 for (
int i=0;i<NFOUR/4;i++) {
1339 v_pulser[i]=sqrt(temp3[i]);
1340 v_noise[i]=sqrt(temp4[i]);
1341 if (f_phases[i]<75.E6)
1346 TGraph *gpulser_eachband;
1347 TGraph *gnoise_eachband;
1348 TCanvas *cpulser=
new TCanvas(
"cpulser",
"cpulser",880,800);
1349 cpulser->Divide(1,5);
1351 for (
int i=0;i<5;i++) {
1355 cpulser->cd(iplot+1);
1357 gpulser_eachband=
new TGraph(NFOUR/4,f_pulser,v_pulser);
1359 gpulser_eachband->Draw(
"al");
1363 cpulser->Print(
"pulser.eps");
1365 TCanvas *cnoise=
new TCanvas(
"cnoise",
"cnoise",880,800);
1366 cnoise->Divide(1,5);
1367 for (
int i=0;i<5;i++) {
1371 cnoise->cd(iplot+1);
1372 gnoise_eachband=
new TGraph(NFOUR/4,f_pulser,v_noise);
1374 gnoise_eachband->Draw(
"al");
1378 cnoise->Print(
"noise.eps");
1386 double sumpulserpower=0.;
1387 double sumnoisepower=0.;
1389 for (
int i=0;i<NFOUR/4;i++) {
1390 sumpulserpower+=v_pulser[i]*v_pulser[i];
1391 sumnoisepower+=v_noise[i]*v_noise[i];
1394 double *temp5=gphases->GetY();
1395 for (
int i=0;i<NFOUR/4;i++) {
1396 v_phases[i]=temp5[i];
1413 void Anita::ReadGains(
void) {
1418 gainsfile.open((ICEMC_DATA_DIR+
"/hh_0").c_str());
1419 if(gainsfile.fail()) {
1420 cout <<
"can't open `$ICEMC_DATA_DIR`/hh_0\n";
1423 for(iii = 0; iii < NPOINTS_GAIN; iii++)
1424 gainsfile >> frequency_forgain_measured[iii] >> gainh_measured[iii];
1427 gainsfile.open((ICEMC_DATA_DIR+
"/vv_0").c_str());
1428 if(gainsfile.fail()) {
1429 cout <<
"can't open `$ICEMC_DATA_DIR`/vv_0\n";
1432 for(iii = 0; iii < NPOINTS_GAIN; iii++) {
1433 gainsfile >> sfrequency >> gainv_measured[iii];
1434 if(sfrequency != frequency_forgain_measured[iii])
1435 cout <<
"warning: sfrequency = " << sfrequency <<
", frequency_forgain_measured[iii] = " << frequency_forgain_measured[iii] << endl;
1439 gainsfile.open((ICEMC_DATA_DIR+
"/hv_0").c_str());
1440 if(gainsfile.fail()) {
1441 cout <<
"can't open `$ICEMC_DATA_DIR`/hv_0\n";
1444 for(iii = 0; iii < NPOINTS_GAIN; iii++) {
1445 gainsfile >> sfrequency >> gainhv_measured[iii];
1446 if(sfrequency != frequency_forgain_measured[iii])
1447 cout <<
"warning: sfrequency = " << sfrequency <<
", frequency_forgain_measured[iii] = " << frequency_forgain_measured[iii] << endl;
1451 gainsfile.open((ICEMC_DATA_DIR+
"/vh_0").c_str());
1452 if(gainsfile.fail()) {
1453 cout <<
"can't open `$ICEMC_DATA_DIR`/vh_0\n";
1456 for(iii = 0; iii < NPOINTS_GAIN; iii++) {
1457 gainsfile >> sfrequency >> gainvh_measured[iii];
1458 if(sfrequency != frequency_forgain_measured[iii])
1459 cout <<
"warning: sfrequency = " << sfrequency <<
", frequency_forgain_measured[iii] = " << frequency_forgain_measured[iii] << endl;
1467 void Anita::AntennaGain(
Settings *settings1,
double hitangle_e,
double hitangle_h,
double e_component,
double h_component,
int k,
double &vsignalarray_e,
double &vsignalarray_h) {
1469 if (freq[k]>=settings1->FREQ_LOW_SEAVEYS && freq[k]<=settings1->FREQ_HIGH_SEAVEYS) {
1471 double relativegains[4];
1473 for (
int pols=0;pols<2;pols++) {
1474 if (fabs(hitangle_e)<PI/2)
1475 relativegains[pols]=Get_gain_angle(pols,k,hitangle_e);
1477 relativegains[pols]=0.;
1486 vsignalarray_e = settings1->IGNORE_CROSSPOL ? 0.5*vsignalarray_e * vvGaintoHeight[k] * e_component * sqrt(relativegains[0])
1487 : vsignalarray_e * 0.5 * sqrt(vvGaintoHeight[k] * vvGaintoHeight[k] * e_component * e_component * relativegains[0] + hvGaintoHeight[k] * hvGaintoHeight[k] * h_component * h_component * relativegains[1]);
1495 for (
int pols=2;pols<4;pols++) {
1496 if (fabs(hitangle_h)<PI/2)
1497 relativegains[pols]=Get_gain_angle(pols,k,hitangle_h);
1499 relativegains[pols]=0.;
1507 vsignalarray_h= settings1->IGNORE_CROSSPOL ? vsignalarray_h * 0.5 * hhGaintoHeight[k] * h_component * sqrt(relativegains[2])
1508 : vsignalarray_h*0.5* sqrt(hhGaintoHeight[k]*hhGaintoHeight[k]*h_component*h_component*relativegains[2] + vhGaintoHeight[k]*vhGaintoHeight[k]*e_component*e_component*relativegains[3]);
1511 if (settings1->POL_SIGN_HACK && !settings1->IGNORE_CROSSPOL)
1513 if (e_component < 0) vsignalarray_e *=-1;
1514 if (h_component < 0) vsignalarray_h *=-1;
1527 void Anita::SetDiffraction() {
1528 const double cc = 299792458.0;
1529 const double height[2] = {3.21571, 2.25625};
1530 const double radius[2] = {1.40185, 1.5677};
1531 const int ntau = 200;
1532 double ww, xx, ss, theta, sintheta, squigglyC, squigglyS, tau, dtau;
1533 for(
int jj = 0; jj < 2; jj++)
1534 for(
int kk = 0; kk < 89; kk++) {
1535 sintheta = 0.37 + 0.005*double(kk);
1536 theta = asin(sintheta);
1537 ss = height[jj]/cos(theta);
1538 xx = height[jj]*tan(theta)-radius[jj];
1539 for(
int ll = 0; ll < NFREQ; ll++) {
1540 ww = sqrt(2./cc*freq[ll]/ss)*xx*sintheta;
1541 dtau = ww/double(ntau);
1544 for(
int ii = 0; ii < ntau; ii++) {
1545 tau = dtau*(double(ii)+0.5);
1546 squigglyC += cos(M_PI*0.5*tau*tau);
1547 squigglyS += sin(M_PI*0.5*tau*tau);
1551 diffraction[jj][kk][ll] = sqrt(0.5*((0.5+squigglyC)*(0.5+squigglyC)+(0.5+squigglyS)*(0.5+squigglyS)));
1552 if(jj == 0 && kk > 66) diffraction[jj][kk][ll] = 1.0;
1558 double Anita::GetDiffraction(
int ilayer,
double zenith_angle,
int ifreq) {
1559 double reference1 = (sin(zenith_angle)-0.37)*200.0;
1560 int whichbin = int(reference1);
1561 double factor = reference1 - double(whichbin);
1562 return factor*diffraction[ilayer][whichbin+1][ifreq] + (1.-factor)*diffraction[ilayer][whichbin][ifreq];
1565 int Anita::SurfChanneltoBand(
int ichan) {
1568 if (ichan<0 || ichan>31) {
1569 cout <<
"surf channel out of range!\n";
1573 int iband= (ichan%8-ichan%2)/2;
1589 int Anita::GetAntennaNumber(
int ilayer,
int ifold) {
1591 return 8*(ilayer)+ifold+1;
1594 int Anita::GetLayer(
int rx) {
1597 else if (rx>=8 && rx<16)
1599 else if (rx>=16 && rx<32)
1604 int Anita::GetIfold(
int rx) {
1612 int Anita::AntennaWaveformtoSurf(
int ilayer,
int ifold) {
1614 int antenna=GetAntennaNumber(ilayer,ifold);
1616 return antennatosurf[antenna-1];
1619 int Anita::AntennaNumbertoSurfNumber(
int ilayer,
int ifold) {
1620 int antenna=GetAntennaNumber(ilayer,ifold);
1622 return (antenna-1-(antenna-1)%4)/4+1;
1626 int Anita::GetSurfChannel(
int antenna,
int ibw,
int ipol) {
1628 return ((antenna-1)%4)*8+WhichBand(ibw,ipol);
1631 int Anita::WhichBand(
int ibw,
int ipol) {
1633 return 2*ibw+ipol+1;
1635 void Anita::Banding(
int j,
double *freq_noise,
double *vmmhz,
int NPOINTS_NOISE) {
1638 cout <<
"Band out of range.\n";
1643 for (
int i=0;i<NPOINTS_NOISE;i++) {
1645 iband=Tools::findIndex(freq_bands[j],freq_noise[i],NPOINTS_BANDS,freq_bands[j][0],freq_bands[j][NPOINTS_BANDS-1]);
1647 vmmhz[i]=vmmhz[i]*sqrt(bandsattn[j][iband]);
1652 else if (BANDING==1) {
1654 for (
int i=0;i<NPOINTS_NOISE;i++) {
1655 if (freq_noise[i]<bwslice_min[j] || freq_noise[i]>bwslice_max[j])
1661 void Anita::RFCMs(
int ilayer,
int ifold,
double *vmmhz) {
1663 int irx=Anita::GetAntennaNumber(ilayer,ifold)-1;
1666 for (
int i=0;i<NFREQ;i++) {
1668 iampl=Tools::findIndex(freq_ampl[irx],freq[i],NPOINTS_AMPL,freq_ampl[irx][0],freq_ampl[irx][NPOINTS_AMPL-1]);
1670 vmmhz[i]=vmmhz[i]*sqrt(ampl_notdb[irx][iampl]);
1679 void Anita::Set_gain_angle(
Settings *settings1,
double nmedium_receiver) {
1680 string gain_null1, gain_null2;
1684 for(jjj = 0; jjj < 4; jjj++)
1685 for(iii = 0; iii < 131; iii++)
1686 gain_angle[jjj][iii][0] = 1.;
1688 anglefile.open((ICEMC_DATA_DIR+
"/vv_az").c_str());
1689 if(anglefile.fail()) {
1690 cout <<
"can't open `$ICEMC_DATA_DIR`/vv_az\n";
1693 for(jjj = 1; jjj < 7; jjj++)
1694 for(iii = 0; iii < 131; iii++) {
1695 anglefile >> sfrequency >> gain_angle[0][iii][jjj];
1696 if(sfrequency != frequency_forgain_measured[iii]) cout <<
"check frequencies for vv_az\n";
1702 anglefile.open((ICEMC_DATA_DIR+
"/hh_az").c_str());
1703 if(anglefile.fail()) {
1704 cout <<
"can't open `$ICEMC_DATA_DIR`/hh_az\n";
1707 for(jjj = 1; jjj < 7; jjj++)
1708 for(iii = 0; iii < 131; iii++) {
1709 anglefile >> sfrequency >> gain_angle[1][iii][jjj];
1710 if(sfrequency != frequency_forgain_measured[iii]) cout <<
"check frequencies for hh_az\n";
1714 anglefile.open((ICEMC_DATA_DIR+
"/hh_el").c_str());
1715 if(anglefile.fail()) {
1716 cout <<
"can't open `$ICEMC_DATA_DIR`/hh_el\n";
1719 for(jjj = 1; jjj < 7; jjj++)
1720 for(iii = 0; iii < 131; iii++) {
1721 anglefile >> sfrequency >> gain_angle[2][iii][jjj];
1722 if(sfrequency != frequency_forgain_measured[iii]) cout <<
"check frequencies for hh_el\n";
1726 anglefile.open((ICEMC_DATA_DIR+
"/vv_el").c_str());
1727 if(anglefile.fail()) {
1728 cout <<
"can't open `$ICEMC_DATA_DIR`/vv_el\n";
1731 for(jjj = 1; jjj < 7; jjj++)
1732 for(iii = 0; iii < 131; iii++) {
1733 anglefile >> sfrequency >> gain_angle[3][iii][jjj];
1734 if(sfrequency != frequency_forgain_measured[iii]) cout <<
"check frequencies for vv_el\n";
1737 for(jjj = 0; jjj < 6; jjj++) inv_angle_bin_size[jjj] = 1. /
1738 (reference_angle[jjj+1] - reference_angle[jjj]);
1740 double gainhv, gainhh, gainvh, gainvv;
1741 double gain_step = frequency_forgain_measured[1]-frequency_forgain_measured[0];
1743 cout <<
"GAINS is " << GAINS <<
"\n";
1744 for (
int k = 0; k < NFREQ; ++k) {
1745 whichbin[k] = int((freq[k] - frequency_forgain_measured[0]) / gain_step);
1746 if((whichbin[k] >= NPOINTS_GAIN || whichbin[k] < 0) && !settings1->FORSECKEL) {
1747 cout <<
"Set_gain_angle out of range, freq = " << freq[k] << endl;
1752 scalef2[k] = (freq[k] - frequency_forgain_measured[whichbin[k]]) / gain_step;
1754 scalef1[k] = 1. - scalef2[k];
1757 if(whichbin[k] == NPOINTS_GAIN - 1) {
1758 gainhv = gainhv_measured[whichbin[k]];
1759 gainhh = gainh_measured[whichbin[k]];
1760 gainvh = gainvh_measured[whichbin[k]];
1761 gainvv = gainv_measured[whichbin[k]];
1764 gainhv = scalef1[k] * gainhv_measured[whichbin[k]] + scalef2[k] * gainhv_measured[whichbin[k] + 1];
1765 gainhh = scalef1[k] * gainh_measured[whichbin[k]] + scalef2[k] * gainh_measured[whichbin[k] + 1];
1766 gainvh = scalef1[k] * gainvh_measured[whichbin[k]] + scalef2[k] * gainvh_measured[whichbin[k] + 1];
1767 gainvv = scalef1[k] * gainv_measured[whichbin[k]] + scalef2[k] * gainv_measured[whichbin[k] + 1];
1779 hvGaintoHeight[k] = GaintoHeight(gainhv,freq[k],nmedium_receiver);
1780 hhGaintoHeight[k] = GaintoHeight(gainhh,freq[k],nmedium_receiver);
1781 vhGaintoHeight[k] = GaintoHeight(gainvh,freq[k],nmedium_receiver);
1782 vvGaintoHeight[k] = GaintoHeight(gainvv,freq[k],nmedium_receiver);
1799 int Anita::GetBeamWidths(
Settings *settings1) {
1809 double freq_specs[5];
1812 if (settings1->WHICH==7) {
1814 freq_specs[0]=265.E6;
1815 freq_specs[1]=435.E6;
1816 freq_specs[2]=650.E6;
1817 freq_specs[3]=992.5E6;
1821 else if (settings1->WHICH==11) {
1823 freq_specs[0]=265.E6;
1824 freq_specs[1]=435.E6;
1825 freq_specs[2]=650.E6;
1826 freq_specs[3]=992.5E6;
1832 freq_specs[0]=300.E6;
1833 freq_specs[1]=600.E6;
1834 freq_specs[2]=900.E6;
1835 freq_specs[3]=1200.E6;
1836 freq_specs[4]=1500.E6;
1844 if (settings1->WHICH==7) {
1907 double specs2[5][2];
1909 if (settings1->WHICH==7) {
1929 else if (settings1->WHICH==11) {
1986 for (
int i=0;i<4;i++) {
1987 for (
int j=0;j<2;j++) {
1988 specs2[i][j]=pow(10.,specs2[i][j]/10.);
1998 for (
int k=0;k<NFREQ;k++) {
2000 if (freq[k]<freq_specs[0]) {
2001 for (
int j=0;j<4;j++) {
2002 flare[j][k]=specs[0][j]*RADDEG;
2006 else if (freq[k]>=freq_specs[NFREQ_FORGAINS-1]) {
2007 for (
int j=0;j<4;j++) {
2008 flare[j][k]=specs[NFREQ_FORGAINS-1][j]*RADDEG;
2014 for (
int i=0;i<NFREQ_FORGAINS;i++) {
2015 if (freq[k]>=freq_specs[i] && freq[k]<freq_specs[i+1]) {
2016 scale = (freq[k]-freq_specs[i])/(freq_specs[i+1]-freq_specs[i]);
2018 for (
int j=0;j<4;j++) {
2019 flare[j][k]=(specs[i][j]+scale*(specs[i+1][j]-specs[i][j]))*RADDEG;
2029 for (
int k=0;k<NFREQ;k++) {
2031 if (freq[k]<freq_specs[0]) {
2032 for (
int j=0;j<2;j++) {
2033 gain[j][k]=specs2[0][j];
2037 else if (freq[k]>=freq_specs[NFREQ_FORGAINS-1]) {
2038 for (
int j=0;j<2;j++) {
2039 gain[j][k]=specs2[NFREQ_FORGAINS-1][j];
2044 for (
int i=0;i<NFREQ_FORGAINS;i++) {
2045 if (freq[k]>=freq_specs[i] && freq[k]<freq_specs[i+1]) {
2046 scale = (freq[k]-freq_specs[i])/(freq_specs[i+1]-freq_specs[i]);
2048 for (
int j=0;j<2;j++) {
2049 gain[j][k]=specs2[i][j]+scale*(specs2[i+1][j]-specs2[i][j]);
2060 double Anita::Get_gain_angle(
int gain_type,
int k,
double hitangle) {
2061 double scaleh1, scaleh2;
2062 if(gain_type < 0 || gain_type > 3) {
2063 cout <<
"gain_type out of range\n";
2067 hitangle = fabs(hitangle)*DEGRAD;
2068 flare[gain_type][k]=flare[gain_type][k]*DEGRAD;
2069 if(hitangle > 90.00001) {
2070 cout <<
"hitangle out of range\n";
2073 if(hitangle >= 90.) hitangle = 89.99999;
2083 return exp(-1.*(hitangle*hitangle)/(2*flare[gain_type][k]*flare[gain_type][k]));
2085 for(
int iii = 1; iii < 7; iii++) {
2086 if(hitangle <= reference_angle[iii]) {
2087 scaleh2 = (hitangle - reference_angle[iii-1]) *
2088 inv_angle_bin_size[iii-1];
2089 scaleh1 = 1. - scaleh2;
2091 if(whichbin[k] == NPOINTS_GAIN - 1)
2092 return scaleh1 * gain_angle[gain_type][whichbin[k]][iii-1] +
2093 scaleh2 * gain_angle[gain_type][whichbin[k]][iii];
2095 return scaleh1 * scalef1[k] * gain_angle[gain_type][whichbin[k]][iii-1] +
2096 scaleh1 * scalef2[k] * gain_angle[gain_type][whichbin[k]+1][iii-1] +
2097 scaleh2 * scalef1[k] * gain_angle[gain_type][whichbin[k]][iii] +
2098 scaleh2 * scalef2[k] * gain_angle[gain_type][whichbin[k]+1][iii];
2105 cout <<
"Get_gain_angle should have returned a value\n";
2110 void Anita::getDiodeModel( ) {
2114 TF1 *fdown1=
new TF1(
"fl_down1",
"[3]+[0]*exp(-1.*(x-[1])*(x-[1])/(2*[2]*[2]))",-300.E-9,300.E-9);
2115 fdown1->SetParameter(0,-0.8);
2117 fdown1->SetParameter(1,15.E-9);
2118 fdown1->SetParameter(2,2.3E-9);
2120 fdown1->SetParameter(3,0.);
2122 TF1 *fdown2=
new TF1(
"fl_down2",
"[3]+[0]*exp(-1.*(x-[1])*(x-[1])/(2*[2]*[2]))",-300.E-9,300.E-9);
2123 fdown2->SetParameter(0,-0.2);
2125 fdown2->SetParameter(1,15.E-9);
2126 fdown2->SetParameter(2,4.0E-9);
2128 fdown2->SetParameter(3,0.);
2132 idelaybeforepeak[0]=(int)(5.E-9/TIMESTEP);
2133 iwindow[0]=(int)(20.E-9/TIMESTEP);
2134 idelaybeforepeak[1]=(int)(5.E-9/TIMESTEP);
2135 iwindow[1]=(int)(20.E-9/TIMESTEP);
2136 idelaybeforepeak[2]=(int)(5.E-9/TIMESTEP);
2137 iwindow[2]=(int)(20.E-9/TIMESTEP);
2138 idelaybeforepeak[3]=(int)(5.E-9/TIMESTEP);
2139 iwindow[3]=(int)(20.E-9/TIMESTEP);
2140 idelaybeforepeak[4]=(int)(13.E-9/TIMESTEP);
2141 iwindow[4]=(int)(4.E-9/TIMESTEP);
2144 fdown1->Copy(fdiode);
2146 TF1 *f_up=
new TF1(
"f_up",
"[0]*([3]*(x-[1]))^2*exp(-(x-[1])/[2])",-200.E-9,100.E-9);
2148 f_up->SetParameter(2,7.0E-9);
2149 f_up->SetParameter(0,1.);
2150 f_up->SetParameter(1,18.E-9);
2151 f_up->SetParameter(3,1.E9);
2153 f_up->SetParameter(0,-1.*sqrt(2.*PI)*(fdiode.GetParameter(0)*fdiode.GetParameter(2)+fdown2->GetParameter(0)*fdown2->GetParameter(2))/(2.*pow(f_up->GetParameter(2),3.)*1.E18));
2156 for (
int j=0;j<5;j++) {
2159 f_up->SetParameter(0,0.00275);
2161 f_up->SetParameter(0,0.004544);
2163 f_up->SetParameter(0,-1.*sqrt(2.*PI)*(fdiode.GetParameter(0)*fdiode.GetParameter(2)+fdown2->GetParameter(0)*fdown2->GetParameter(2))/(2.*pow(f_up->GetParameter(2),3.)*1.E18));
2165 for (
int i=0;i<NFOUR/2;i++) {
2167 if (time[i]>0. && time[i]<maxt_diode) {
2169 diode_real[j][i]=fdiode.Eval(time[i])+fdown2->Eval(time[i]);
2170 if (time[i]>f_up->GetParameter(1))
2171 diode_real[j][i]+=f_up->Eval(time[i]);
2173 sum+=diode_real[j][i];
2176 diode_real[j][i]=0.;
2186 void Anita::myconvlv(
double *data,
const int NFOUR,
double *fdiode,
double &mindiodeconvl,
double &onediodeconvl,
double *power_noise,
double *diodeconv) {
2194 const int length=NFOUR;
2197 double power_noise_copy[length];
2200 for (
int i=0;i<NFOUR/2;i++) {
2201 power_noise_copy[i]=(data[i]*data[i])/impedence*TIMESTEP;
2203 for (
int i=NFOUR/2;i<NFOUR;i++) {
2204 power_noise_copy[i]=0.;
2216 Tools::realft(power_noise_copy,1,length);
2219 double ans_copy[length];
2227 for (
int j=1;j<length/2;j++) {
2228 ans_copy[2*j]=(power_noise_copy[2*j]*fdiode[2*j]-power_noise_copy[2*j+1]*fdiode[2*j+1])/((
double)length/2);
2229 ans_copy[2*j+1]=(power_noise_copy[2*j+1]*fdiode[2*j]+power_noise_copy[2*j]*fdiode[2*j+1])/((
double)length/2);
2231 ans_copy[0]=power_noise_copy[0]*fdiode[0]/((double)length/2);
2232 ans_copy[1]=power_noise_copy[1]*fdiode[1]/((double)length/2);
2236 Tools::realft(ans_copy,-1,length);
2240 for (
int i=0;i<NFOUR;i++) {
2241 power_noise[i]=power_noise_copy[i];
2242 diodeconv[i]=ans_copy[i];
2247 int iminsamp,imaxsamp;
2249 iminsamp=(int)(maxt_diode/TIMESTEP);
2257 if (imaxsamp<iminsamp) {
2258 cout <<
"Noise waveform is not long enough for this diode response.\n";
2262 int ibin=((iminsamp+imaxsamp)-(iminsamp+imaxsamp)%2)/2;
2266 onediodeconvl=diodeconv[ibin];
2271 for (
int i=iminsamp;i<imaxsamp;i++) {
2273 if (diodeconv[i]<mindiodeconvl)
2274 mindiodeconvl=diodeconv[i];
2295 void Anita::GetPhases() {
2299 double phase_corr,phase_uncorr;
2300 double phasor_x,phasor_y;
2301 TRandom * rng = getRNG(RNG_PHASES);
2303 for (
int k=0;k<NFOUR/4;k++) {
2304 iband=Tools::findIndex(freq_bands[0],freq_forfft[2*k],NPOINTS_BANDS,freq_bands[0][0],freq_bands[0][NPOINTS_BANDS-1]);
2307 phases_rfcm[0][k]=2*PI*rng->Rndm();
2308 phases_rfcm[1][k]=2*PI*rng->Rndm();
2313 if(iband < 0) corr = 0;
2314 else corr=correl_lab[iband];
2316 phase_corr=phases_rfcm[0][k];
2317 phase_uncorr=2*PI*rng->Rndm();
2318 phasor_x=corr*cos(phase_corr)+uncorr*cos(phase_uncorr);
2319 phasor_y=corr*sin(phase_corr)+uncorr*sin(phase_uncorr);
2320 phases_lab[0][k]=TMath::ATan2(phasor_y,phasor_x);
2324 phase_corr=phases_rfcm[1][k];
2325 phase_uncorr=2*PI*rng->Rndm();
2326 phasor_x=corr*cos(phase_corr)+uncorr*cos(phase_uncorr);
2327 phasor_y=corr*sin(phase_corr)+uncorr*sin(phase_uncorr);
2328 phases_lab[1][k]=TMath::ATan2(phasor_y,phasor_x);
2332 for (
int j=0;j<5;j++) {
2334 if(iband < 0) corr = 0;
2335 else corr=correl_banding[j][iband];
2337 phase_corr=phases_rfcm[0][k];
2338 phase_uncorr=2*PI*rng->Rndm();
2339 phasor_x=corr*cos(phase_corr)+uncorr*cos(phase_uncorr);
2340 phasor_y=corr*sin(phase_corr)+uncorr*sin(phase_uncorr);
2341 phases_rfcm_banding[0][j][k]=TMath::ATan2(phasor_y,phasor_x);
2342 phase_corr=phases_rfcm[1][k];
2343 phase_uncorr=2*PI*rng->Rndm();
2344 phasor_x=corr*cos(phase_corr)+uncorr*cos(phase_uncorr);
2345 phasor_y=corr*sin(phase_corr)+uncorr*sin(phase_uncorr);
2346 phases_rfcm_banding[1][j][k]=TMath::ATan2(phasor_y,phasor_x);
2356 void Anita::normalize_for_nsamples(
double *spectrum,
double nsamples,
double nsamp){
2357 for (
int k = 0; k < NFOUR / 4; k++){
2358 spectrum[2 * k] *= sqrt((
double) nsamples / (
double) nsamp);
2359 spectrum[2 * k + 1] *= sqrt((
double) nsamples / (
double) nsamp);
2364 void Anita::convert_power_spectrum_to_voltage_spectrum_for_fft(
int length,
double *spectrum,
double domain[],
double phase[]){
2365 double current_amplitude, current_phase;
2367 for (
int k = 0; k < length/2 ; k++){
2368 current_amplitude = domain[k];
2369 current_phase = phase[k];
2372 Tools::get_random_rician(0., 0., sqrt(2. / M_PI) * domain[k], current_amplitude, current_phase);
2375 spectrum[2 * k] = sqrt(current_amplitude) * cos(phase[k]) / (( (double) NFOUR / 2) / 2);
2376 spectrum[2 * k + 1] = sqrt(current_amplitude) * sin(phase[k]) / (( (double) NFOUR / 2) / 2);
2381 void Anita::GetNoiseWaveforms() {
2383 int nsamples = NFOUR / 2;
2385 double sumfreqdomain = 0.;
2386 double sumtimedomain = 0.;
2388 count_getnoisewaveforms++;
2397 for (
int ipol=0;ipol<2;ipol++)
2398 convert_power_spectrum_to_voltage_spectrum_for_fft(nsamples, timedomainnoise_rfcm[ipol], freqdomain_rfcm, phases_rfcm[ipol] );
2399 for (
int ipol=0;ipol<2;ipol++)
2400 convert_power_spectrum_to_voltage_spectrum_for_fft(nsamples, timedomainnoise_lab[ipol], avgfreqdomain_lab, phases_lab[ipol] );
2415 for (
int ipol=0;ipol<2;ipol++){
2416 normalize_for_nsamples(timedomainnoise_rfcm[ipol], (
double) nsamples, (
double) nsamp);
2417 normalize_for_nsamples(timedomainnoise_lab[ipol], (
double) nsamples, (
double) nsamp);
2422 for (
int k = 0; k < NFOUR / 4; k++){
2423 sumfreqdomain += avgfreqdomain_lab[k];
2426 Tools::realft(timedomainnoise_rfcm[ipol], -1, NFOUR / 2);
2427 Tools::realft(timedomainnoise_lab[ipol], -1, NFOUR / 2);
2432 for (
int k = 0; k < NFOUR / 2; k++) {
2437 sumtimedomain += timedomainnoise_lab[ipol][k] * timedomainnoise_lab[ipol][k];
2440 rms_rfcm[ipol] += timedomainnoise_rfcm[ipol][k] * timedomainnoise_rfcm[ipol][k] / ((double) NFOUR / 2);
2441 rms_lab[ipol] += timedomainnoise_lab[ipol][k] * timedomainnoise_lab[ipol][k] / ((double) NFOUR / 2);
2447 for (
int iband=0; iband<5; iband++) {
2448 for (
int ipol=0;ipol<2;ipol++)
2449 convert_power_spectrum_to_voltage_spectrum_for_fft(NFOUR/2,timedomainnoise_rfcm_banding[ipol][iband], freqdomain_rfcm_banding[iband], phases_rfcm_banding[ipol][iband]);
2450 for (
int ipol=0;ipol<2;ipol++)
2451 normalize_for_nsamples(timedomainnoise_rfcm_banding[ipol][iband], (
double) nsamples, (double) nsamp);
2452 for (
int ipol=0;ipol<2;ipol++)
2453 Tools::realft(timedomainnoise_rfcm_banding[ipol][iband], -1, NFOUR / 2);
2464 void Anita::GetArrayFromFFT(
double *tmp_fftvhz,
double *vhz_rx){
2466 int firstNonZero = Tools::Getifreq(freq[0],freq_forfft[0],freq_forfft[NFOUR/2-1],NFOUR/4);
2467 int lastNonZero = Tools::Getifreq(freq[NFREQ-1],freq_forfft[0],freq_forfft[NFOUR/2-1],NFOUR/4);
2468 double norm=TMath::Sqrt(
double(lastNonZero-firstNonZero)/
double(NFREQ));
2471 for (
int ifreq=0;ifreq<NFOUR/4;ifreq++){
2472 tmp_fftvhz[ifreq]=TMath::Sqrt(tmp_fftvhz[2*ifreq]*tmp_fftvhz[2*ifreq] + tmp_fftvhz[2*ifreq+1]*tmp_fftvhz[2*ifreq+1]);
2475 for (
int ifreq=0; ifreq<NFREQ; ifreq++){
2477 int ifour=Tools::Getifreq(freq[ifreq],freq_forfft[0],freq_forfft[NFOUR/2-1],NFOUR/4);
2478 vhz_rx[ifreq]=tmp_fftvhz[ifour]*norm;
2485 void Anita::GetPhasesFromFFT(
double *tmp_fftvhz,
double *phases){
2487 for (
int ifreq=0; ifreq<NFOUR/4; ifreq++){
2488 phases[ifreq]=TMath::ATan2(tmp_fftvhz[ifreq+1], tmp_fftvhz[ifreq])*180./PI;
2494 void Anita::FromTimeDomainToIcemcArray(
double *vsignalarray,
double vhz[NFREQ]){
2497 Tools::realft(vsignalarray,1,NFOUR/2);
2499 GetPhasesFromFFT(vsignalarray, v_phases);
2502 GetArrayFromFFT(vsignalarray, vhz);
2508 void Anita::MakeArrayforFFT(
double *vsignalarray_e,
double *vsignal_e_forfft,
double phasedelay,
bool useconstantdelay) {
2510 Tools::Zero(vsignal_e_forfft,NFOUR/2);
2512 double previous_value_e_even=0.;
2513 double previous_value_e_odd=0.;
2514 int count_nonzero=0;
2516 int ifirstnonzero=-1;
2517 int ilastnonzero=2000;
2518 for (
int i=0;i<NFREQ;i++) {
2522 int ifour=Tools::Getifreq(freq[i],freq_forfft[0],freq_forfft[NFOUR/2-1],NFOUR/4);
2524 if (ifour!=-1 && 2*ifour+1<NFOUR/2) {
2526 if (ifirstnonzero==-1){
2527 ifirstnonzero=ifour;
2530 vsignal_e_forfft[2*ifour]=vsignalarray_e[i]*2/((double)NFOUR/2);
2534 vsignal_e_forfft[2*ifour+1]=vsignalarray_e[i]*2/((double)NFOUR/2);
2540 for (
int j=iprevious+1;j<ifour;j++) {
2541 vsignal_e_forfft[2*j]=previous_value_e_even+(vsignal_e_forfft[2*ifour]-previous_value_e_even)*(
double)(j-iprevious)/(
double)(ifour-iprevious);
2544 vsignal_e_forfft[2*j+1]=previous_value_e_odd+(vsignal_e_forfft[2*ifour+1]-previous_value_e_odd)*(
double)(j-iprevious)/(
double)(ifour-iprevious);
2549 previous_value_e_even=vsignal_e_forfft[2*ifour];
2550 previous_value_e_odd=vsignal_e_forfft[2*ifour+1];
2558 for (
int j=0;j<NFOUR/4;j++) {
2559 vsignal_e_forfft[2*j]*=sqrt((
double)count_nonzero/(
double)(ilastnonzero-ifirstnonzero));
2560 vsignal_e_forfft[2*j+1]*=sqrt((
double)count_nonzero/(
double)(ilastnonzero-ifirstnonzero));
2565 if (useconstantdelay){
2566 double cosphase=cos(phasedelay*PI/180.);
2567 double sinphase=sin(phasedelay*PI/180.);
2568 for (
int ifour=0;ifour<NFOUR/4;ifour++) {
2570 cosphase = cos(v_phases[ifour]*PI/180.);
2571 sinphase = sin(v_phases[ifour]*PI/180.);
2573 vsignal_e_forfft[2*ifour]*=cosphase;
2574 vsignal_e_forfft[2*ifour+1]*=sinphase;
2580 void Anita::BoxAverageComplex(
double *array,
const int n,
int navg) {
2582 double array_temp[2*n];
2583 for (
int i=0;i<n;i++) {
2586 array_temp[2*i+1]=0.;
2589 for (
int k=i;k<i+navg;k++) {
2591 array_temp[2*i]+=array[2*k];
2592 array_temp[2*i+1]+=array[2*k+1];
2596 array[2*i]=array_temp[2*i]/(double)navg;
2597 array[2*i+1]=array_temp[2*i+1]/(double)navg;
2599 array_temp[2*i]=array[2*i];
2600 array_temp[2*i+1]=array[2*i+1];
2604 void Anita::BoxAverage(
double *array,
const int n,
int navg) {
2606 double array_temp[n];
2607 for (
int i=0;i<n;i++) {
2611 for (
int k=i;k<i+navg;k++) {
2613 array_temp[i]+=array[k];
2617 array[i]=array_temp[i]/(double)navg;
2620 array_temp[i]=array[i];
2626 void Anita::labAttn(
double *vhz) {
2627 for (
int i=0;i<NFREQ;i++) {
2629 int ilab=Tools::findIndex(freqlab,freq[i],NPOINTS_LAB,freqlab[0],freqlab[NPOINTS_LAB-1]);
2631 vhz[i]*=sqrt(labattn[ilab]);
2632 vhz[i]*=sqrt(labattn[ilab]);
2635 cout <<
"Lab attenuation outside of band.\n";
2639 int Anita::getLabAttn(
int NPOINTS_LAB,
double *freqlab,
double *labattn) {
2641 ifstream flab((ICEMC_DATA_DIR+
"/surfatten_run294_ch23v.dat").c_str());
2643 cout <<
"Cannot open lab data file.\n";
2652 float ffreqlab,flabattn;
2655 while (!flab.eof() && index<NPOINTS_LAB) {
2657 flab >> ffreqlab >> flabattn;
2658 labattn[index]=(double)pow(10.,flabattn/10.);
2662 freqlab[index]=(double)ffreqlab;
2676 double Anita::GaintoHeight(
double gain,
double freq,
double nmedium_receiver) {
2681 return 2*sqrt(gain/4/PI*CLIGHT*CLIGHT/(freq*freq)*Zr/(Z0*nmedium_receiver));
2685 void Anita::fill_coherent_waveform_sum_tree(
unsigned event_number,
unsigned center_phi_sector_index,
Settings* settings1,
double rms_noise,
double actual_rms,
unsigned window_start,
unsigned window_end,
double deg_theta,
double deg_phi,
double actual_deg_theta,
double actual_deg_phi, vector <double>& summed_wfm, vector <double>& power_of_summed_wfm,
double power){
2687 cwst_event_number = event_number;
2688 cwst_center_phi_sector = center_phi_sector_index;
2689 cwst_rms_noise = rms_noise;
2690 cwst_actual_rms = actual_rms;
2691 cwst_threshold = settings1->COHERENT_THRESHOLD;
2692 cwst_window_start = window_start;
2693 cwst_window_end = window_end;
2695 cwst_deg_theta = deg_theta;
2696 cwst_deg_phi = deg_phi;
2698 cwst_actual_deg_theta = actual_deg_theta;
2699 cwst_actual_deg_phi = actual_deg_phi;
2702 for (
int i = 0; i < HALFNFOUR; i++){
2703 cwst_timesteps[i] = i;
2706 cwst_summed_wfm = summed_wfm;
2707 cwst_power_of_summed_wfm = power_of_summed_wfm;
2710 coherent_waveform_sum_tree->Fill();
2720 const double gps_offset = atan2(-0.7042,0.71), MINCH = 0.0254, phase_center = 0.17;
2722 const double phase_center_anita2_analysis=.2;
2724 const double gps_offset_anita2=atan2(-0.7085,0.7056);
2725 const double gps_offset_anita3= 45*RADDEG;
2726 const double phase_center_anita3=0.20;
2729 if (settings1->WHICH==0) {
2733 settings1->CYLINDRICALSYMMETRY=0;
2743 for (
int i=0;i<5;i++) {
2747 for (
int i=0;i<
NRX_PHI[0];i++) {
2753 else if (settings1->WHICH==1) {
2755 settings1->CYLINDRICALSYMMETRY=1;
2797 for (
int i=0;i<5;i++) {
2803 else if (settings1->WHICH==2) {
2804 settings1->CYLINDRICALSYMMETRY=1;
2850 else if (settings1->WHICH==3) {
2852 cout <<
"Is this configuration cylindrically symmetric? Yes(1) or No(0)\n";
2853 cin >> settings1->CYLINDRICALSYMMETRY;
2855 cout <<
"How many layers?\n";
2856 cin >> settings1->NLAYERS;
2858 for (
int i=0;i<settings1->NLAYERS;i++) {
2860 cout <<
"How many antennas in the " << i <<
"th layer?\n";
2863 cout <<
"What is the offset in phi for the " << i <<
"th layer?\n";
2866 cout <<
"What is the theta ascent for the " << i <<
"th layer (0 if pointed straight upwards, PI if pointed straight downwards)?\n";
2869 cout <<
"What is the vertical position of this layer relative to the vertical center of the payload?";
2872 cout <<
"What is the distance between of the vertical axis of the payload and the center of this layer?";
2875 cout <<
"What is the phi of this layer relative to the vertical center of the payload in the horizontal plane?";
2880 if (settings1->CYLINDRICALSYMMETRY==0) {
2881 for (
int j=0;j<
NRX_PHI[i];j++) {
2882 cout <<
"What is the phi of the " << j <<
"th antenna is this layer?\n";
2888 cout <<
"How many polarizations must pass a voltage threshold?\n";
2889 cin >> settings1->NFOLD;
2891 cout <<
"How many times the expected noise level should the voltage threshold be?\n";
2892 cin >> maxthreshold;
2895 else if (settings1->WHICH==4) {
2900 if (settings1->NLAYERS!=2)
2901 cout <<
"Warning!!! Did not enter the right number of layers in the input file. For Anita Hill, it's 2.";
2903 settings1->CYLINDRICALSYMMETRY=1;
2936 else if(settings1->WHICH==6) {
2938 settings1->CYLINDRICALSYMMETRY=0;
3053 for(
int iii = 0; iii < 3; iii++)
3054 for(
int jjj = 0; jjj <
NRX_PHI[iii]; jjj++)
3057 else if (settings1->WHICH==7) {
3065 settings1->CYLINDRICALSYMMETRY=1;
3117 else if (settings1->WHICH==8) {
3118 cout<<
"initializing and using anitaII payload geometry"<<endl;
3127 settings1->CYLINDRICALSYMMETRY=0;
3352 for(
int iii = 0; iii < 4; iii++){
3353 for(
int jjj = 0; jjj <
NRX_PHI[iii]; jjj++){
3367 for(
int iii = 0; iii < 4; iii++){
3368 for(
int jjj = 0; jjj <
NRX_PHI[iii]; jjj++){
3373 r = sqrt(pow(x,2)+pow(y,2));
3387 else if (settings1->WHICH==9 || settings1->WHICH==10) {
3390 string whichANITAroman=
"";
3391 if (settings1->WHICH==9) whichANITAroman+=
"III";
3392 else whichANITAroman+=
"IV";
3393 cout<<
"Initializing and using ANITA-" << whichANITAroman <<
" payload geometry"<<endl;
3401 settings1->CYLINDRICALSYMMETRY=0;
3428 #ifdef ANITA_UTIL_EXISTS 3429 photoFile += ( (string)getenv(
"ANITA_UTIL_INSTALL_DIR") +
"/share/anitaCalib/anita"+whichANITAroman+
"Photogrammetry.csv");
3431 photoFile += (ICEMC_DATA_DIR+
"/anita"+whichANITAroman+
"Photogrammetry.csv");
3434 std::ifstream Anita3PhotoFile(photoFile.c_str());
3435 if (!Anita3PhotoFile){
3436 std::cerr <<
"Couldn't open photogrammetry!" << std::endl;
3442 for(
int i=0;i<2;i++) {
3443 line.ReadLine(Anita3PhotoFile);
3448 Double_t xAntPhoto[48];
3449 Double_t yAntPhoto[48];
3450 Double_t zAntPhoto[48];
3451 Double_t rAntPhoto[48];
3452 Double_t azCentrePhoto[48];
3453 Double_t apertureAzPhoto[48];
3454 Double_t apertureElPhoto[48];
3456 for(
int ant=0;ant<48;ant++) {
3457 line.ReadLine(Anita3PhotoFile);
3459 TObjArray *tokens = line.Tokenize(
",");
3460 for(
int j=0;j<8;j++) {
3461 const TString subString = ((TObjString*)tokens->At(j))->GetString();
3466 if (ant+1 != subString.Atoi()) {
3467 std::cerr <<
"Antenna number mismatch\n";
3471 xAntPhoto[ant]=subString.Atof();
3474 yAntPhoto[ant]=subString.Atof();
3477 zAntPhoto[ant]=subString.Atof();
3480 rAntPhoto[ant]=subString.Atof();
3483 azCentrePhoto[ant]=subString.Atof();
3486 apertureAzPhoto[ant]=subString.Atof();
3489 apertureElPhoto[ant]=subString.Atof()*(-1);
3499 Anita3PhotoFile.close();
3502 for (
int iant=0; iant<8;iant++){
3506 PHI_EACHLAYER[0][iant] = azCentrePhoto[iant*2] * RADDEG - gps_offset_anita3;
3507 PHI_EACHLAYER[1][iant] = azCentrePhoto[iant*2+1] * RADDEG - gps_offset_anita3;
3508 ANTENNA_DOWN[0][iant] = apertureElPhoto[iant*2] * RADDEG;
3509 ANTENNA_DOWN[1][iant] = apertureElPhoto[iant*2+1] * RADDEG;
3514 for (
int iant=0; iant<16;iant++){
3518 PHI_EACHLAYER[2][iant] = azCentrePhoto[iant+16] * RADDEG - gps_offset_anita3;
3519 ANTENNA_DOWN[2][iant] = apertureElPhoto[iant+16] * RADDEG;
3521 PHI_EACHLAYER[3][iant] = azCentrePhoto[iant+32] * RADDEG - gps_offset_anita3;
3522 ANTENNA_DOWN[3][iant] = apertureElPhoto[iant+32] * RADDEG;
3527 string whichANITAcard=
"";
3528 if (settings1->WHICH==9) whichANITAcard+=
"3";
3529 else whichANITAcard+=
"4";
3530 string phaseCenterName;
3531 #ifdef ANITA_UTIL_EXISTS 3532 phaseCenterName += ( (string)getenv(
"ANITA_UTIL_INSTALL_DIR") +
"/share/anitaCalib/phaseCenterPositionsRelativeToPhotogrammetryAnita"+whichANITAcard+
".dat");
3534 phaseCenterName += (ICEMC_DATA_DIR+
"/phaseCenterPositionsRelativeToPhotogrammetryAnita"+whichANITAcard+
".dat");
3537 std::ifstream PhaseCenterFile(phaseCenterName.c_str());
3538 Int_t antNum, tpol, pol;
3539 Double_t deltaR,deltaPhi,deltaZ;
3540 char firstLine[180];
3541 Double_t deltaRPhaseCentre[2][4][16];
3542 Double_t deltaZPhaseCentre[2][4][16];
3543 Double_t deltaPhiPhaseCentre[2][4][16];
3545 PhaseCenterFile.getline(firstLine,179);
3547 while(PhaseCenterFile >> antNum >> tpol >> deltaR >> deltaPhi >> deltaZ) {
3548 int ilayer = (antNum<16)*((antNum%2==0)*0 + (antNum%2==1)*1)+ (antNum>15)*(antNum<32)*2+(antNum>31)*3;
3549 int ifold = (ilayer<2)*((antNum-ilayer)/2)+(ilayer>1)*(antNum%16);
3552 else if (tpol==0) pol=1;
3554 deltaRPhaseCentre[pol][ilayer][ifold]=deltaR;
3555 deltaPhiPhaseCentre[pol][ilayer][ifold]=deltaPhi*TMath::DegToRad();
3556 deltaZPhaseCentre[pol][ilayer][ifold]=deltaZ;
3558 PhaseCenterFile.close();
3560 std::ifstream relativePhaseCenterToAmpaDelaysFile((ICEMC_DATA_DIR+
"/relativePhaseCenterToAmpaDelaysAnita"+whichANITAcard+
".dat").c_str());
3562 #ifdef ANITA_UTIL_EXISTS 3565 int tempAnt, intTempPol;
3567 for(Int_t surf=0; surf<NUM_SURF; surf++){
3568 for(Int_t chan=0; chan<NUM_CHAN; chan++){
3572 intTempPol = (tempPol==0) ? 1 : 0;
3580 for(
int ipol=0; ipol<2; ipol++){
3581 for (
int iant=0; iant<48; iant++){
3582 extraCableDelays[ipol][iant] = 0;
3589 double x, y, z, r, phi;
3590 for(
int ilayer = 0; ilayer < 4; ilayer++){
3591 for(
int ifold = 0; ifold <
NRX_PHI[ilayer]; ifold++){
3592 for (
int ipol = 1; ipol >= 0; ipol--){
3600 r = sqrt(pow(x,2)+pow(y,2)) + deltaRPhaseCentre[ipol][ilayer][ifold];
3601 phi = atan2(y,x) + deltaPhiPhaseCentre[ipol][ilayer][ifold];
3604 if(phi<0) phi+=TMath::TwoPi();
3605 if(phi>TMath::TwoPi()) phi-=TMath::TwoPi();
3622 else if (settings1->WHICH==11) {
3627 settings1->CYLINDRICALSYMMETRY=1;
3659 settings1->NANTENNAS=0;
3660 for (
int i=0;i<settings1->NLAYERS;i++)
3661 settings1->NANTENNAS+=
NRX_PHI[i];
3663 cout <<
"nantennas is " << settings1->NANTENNAS <<
"\n";
3668 if (settings1->WHICH==0) {
3669 temp_eachrx[0]=919.4;
3670 temp_eachrx[1]=1051.8;
3671 for (
int j=2;j<16;j++) {
3676 for (
int j=0;j<16;j++) {
3678 temp_eachrx[j]=(240.+200.);
3682 for (
int i=0;i<
NRX_PHI[0];i++) {
3687 void Anita::calculate_all_offsets(
void) {
3689 double angle_phi, angle_theta;
3691 double hypothesis_offset[3][3];
3693 vector<double> angles_tmp;
3694 vector< vector <double> > angles_diffthetas_tmp;
3696 double step_phi=(MAX_PHI_HYPOTHESIS-MIN_PHI_HYPOTHESIS)/(
double)N_STEPS_PHI;
3697 double step_theta=(MAX_THETA_HYPOTHESIS-MIN_THETA_HYPOTHESIS)/(
double)N_STEPS_THETA;
3699 cout <<
"step_theta is " << step_theta <<
"\n";
3701 for (
unsigned center_phi_sector_index = 0; center_phi_sector_index < 1; ++center_phi_sector_index) {
3703 for (
unsigned index_phi = 0; index_phi < N_STEPS_PHI; ++index_phi) {
3706 angle_phi = (double)center_phi_sector_index * 22.5 + MIN_PHI_HYPOTHESIS + (
double)index_phi * step_phi;
3709 angles_diffthetas_tmp.clear();
3710 for (
unsigned index_theta = 0; index_theta < N_STEPS_THETA; ++index_theta) {
3711 angle_theta = MIN_THETA_HYPOTHESIS + (double)index_theta*step_theta;
3717 angles_tmp.push_back(angle_phi);
3718 angles_tmp.push_back(angle_theta);
3720 angles_diffthetas_tmp.push_back(angles_tmp);
3722 calculate_single_offset(center_phi_sector_index, angle_phi, angle_theta, hypothesis_offset);
3724 for (
unsigned i_layer = 0; i_layer < N_SUMMED_LAYERS; ++i_layer) {
3725 for (
unsigned i_sector = 0; i_sector < N_SUMMED_PHI_SECTORS; ++i_sector) {
3726 hypothesis_offsets[center_phi_sector_index][index_phi][index_theta][i_sector][i_layer] = int(Tools::round(hypothesis_offset[i_sector][i_layer] / TRIG_TIMESTEP));
3732 hypothesis_angles.push_back(angles_diffthetas_tmp);
3737 getDifferentOffsets();
3738 printDifferentOffsets();
3741 void Anita::printDifferentOffsets() {
3742 ofstream ofile(
"outputs/offsets.txt");
3743 ofile <<
"number of offsets is " << vdifferent_offsets.size() <<
"\n";
3746 for (
unsigned int i=0;i<vdifferent_offsets.size();i++) {
3747 for (
int j=0;j<2;j++) {
3748 ofile << vdifferent_angles[i][j] <<
"\t";
3750 for (
unsigned int j=0;j<N_SUMMED_PHI_SECTORS;j++) {
3751 for (
unsigned int k=0;k<N_SUMMED_LAYERS;k++) {
3753 ofile << vdifferent_offsets[i][N_SUMMED_LAYERS*j+k] <<
" ";
3762 void Anita::getDifferentOffsets() {
3765 vector<double> vangles_tmp;
3767 for (
int center_phi_sector_index=0;center_phi_sector_index<1;center_phi_sector_index++) {
3768 for (
unsigned index_phi = 0; index_phi < N_STEPS_PHI; ++index_phi) {
3769 for (
unsigned index_theta = 0; index_theta < N_STEPS_THETA; ++index_theta) {
3771 vangles_tmp.clear();
3772 vangles_tmp.push_back(hypothesis_angles[index_phi][index_theta][0]);
3773 vangles_tmp.push_back(hypothesis_angles[index_phi][index_theta][1]);
3775 for (
unsigned i_sector = 0; i_sector < N_SUMMED_PHI_SECTORS; ++i_sector) {
3776 for (
unsigned i_layer = 0; i_layer < N_SUMMED_LAYERS; ++i_layer) {
3777 vtmp.push_back(hypothesis_offsets[center_phi_sector_index][index_phi][index_theta][i_sector][i_layer]);
3788 for (
unsigned int i=0;i<vdifferent_offsets.size();i++) {
3789 if (vtmp==vdifferent_offsets[i]) {
3799 vdifferent_offsets.push_back(vtmp);
3800 vdifferent_angles.push_back(vangles_tmp);
3808 void Anita::calculate_single_offset(
const unsigned center_phi_sector_index,
const double angle_phi,
const double angle_theta,
double hypothesis_offset[][3]) {
3809 double maximum_time = -2000E-9;
3811 double to_center_of_summed_phi_sectors=((double)N_SUMMED_PHI_SECTORS/2.)*22.5-11.25;
3813 Vector normal_vector =
Vector(cos(angle_theta * RADDEG) * cos((angle_phi+to_center_of_summed_phi_sectors) * RADDEG), cos(angle_theta * RADDEG) * sin((angle_phi+to_center_of_summed_phi_sectors) * RADDEG), sin(angle_theta * RADDEG));
3823 int phi_start=-1*(int)((
double)N_SUMMED_PHI_SECTORS/2.)+1;
3828 for (
signed int phi_sector_offset = phi_start; phi_sector_offset < (int)(phi_start+N_SUMMED_PHI_SECTORS); phi_sector_offset++) {
3829 unsigned i_sector = (phi_sector_offset + center_phi_sector_index + 16)%16;
3831 for (
unsigned i_layer = 0; i_layer < N_SUMMED_LAYERS; ++i_layer) {
3839 double offset = (-1. / CLIGHT) * normal_vector * (antenna_pos - one_antenna_pos);
3842 if (offset >= maximum_time) {
3843 maximum_time = offset;
3852 hypothesis_offset[phi_sector_offset-phi_start][i_layer] = offset;
3856 for (
unsigned i_layer = 0; i_layer < N_SUMMED_LAYERS; ++i_layer) {
3857 for (
unsigned i_sector = 0; i_sector < N_SUMMED_PHI_SECTORS; ++i_sector) {
3858 hypothesis_offset[i_sector][i_layer] -= maximum_time;
3859 hypothesis_offset[i_sector][i_layer]*=-1.;
3870 for (
int ipol=0; ipol<2; ipol++){
3873 arrival_times[ipol][antenna_index] = (
antenna_positions[ipol][antenna_index] * rf_direction) / CLIGHT;
3883 if( settings1->WHICH==8 ){
3887 double theta_deg =rf_tmp_dir.Theta() * DEGRAD;
3889 double phi_deg = rf_tmp_dir.Phi() *DEGRAD;
3890 double totalAngledeg;
3893 double phi_eachlayer;
3894 double theta_offset;
3899 theta_deg = theta_deg -90;
3902 theta_deg = theta_deg - theta_offset;
3903 for(
int iii = 0; iii < 4; iii++){
3904 for(
int jjj = 0; jjj <
NRX_PHI[iii]; jjj++){
3906 phi_deg = rf_tmp_dir.Phi();
3910 phi_deg =phi_deg- phi_eachlayer;
3912 if(fabs(phi_deg) > fabs(phi_deg+2*PI)) phi_deg+=2*PI;
3913 if(fabs(phi_deg) > fabs(phi_deg-2*PI)) phi_deg-=2*PI;
3914 phi_deg =phi_deg*DEGRAD;
3915 totalAngledeg = phi_deg*phi_deg + theta_deg*theta_deg;
3916 if(totalAngledeg > 2500) totalAngledeg=2500;
3918 extra_delay = (totalAngledeg*totalAngledeg)*1.45676e-8;
3919 extra_delay -= (totalAngledeg)*5.01452e-6;
3921 arrival_times[ipol][ant_ctr]+=extra_delay*1E-9;
3933 double first_trigger_time = Tools::dMin(minV, minH);
3934 for (
int ipol=0; ipol<2; ipol++){
3941 arrival_times[ipol][i] -= first_trigger_time;
3954 void Anita::GetArrivalTimesBoresights(
const Vector rf_direction[NLAYERS_MAX][NPHI_MAX],
Balloon *bn1,
Settings *settings1) {
3956 for (
int ipol=0; ipol<2; ipol++){
3958 int ilayer = (antenna_index<8)*0 + (antenna_index>7)*(antenna_index<16)*1+ (antenna_index>15)*(antenna_index<32)*2+(antenna_index>31)*3;
3959 int ifold = (ilayer<2)*(antenna_index%8)+(ilayer>1)*(antenna_index%16);
3960 arrival_times[ipol][antenna_index] = (
antenna_positions[ipol][antenna_index] * rf_direction[ilayer][ifold]) / CLIGHT;
3969 if(settings1->WHICH==8 ){
3973 double theta_deg =rf_tmp_dir.Theta() * DEGRAD;
3975 double phi_deg = rf_tmp_dir.Phi() *DEGRAD;
3976 double totalAngledeg;
3979 double phi_eachlayer;
3980 double theta_offset;
3985 theta_deg = theta_deg -90;
3988 theta_deg = theta_deg - theta_offset;
3990 phi_deg = rf_tmp_dir.Phi();
3994 phi_deg =phi_deg- phi_eachlayer;
3996 if(fabs(phi_deg) > fabs(phi_deg+2*PI)) phi_deg+=2*PI;
3997 if(fabs(phi_deg) > fabs(phi_deg-2*PI)) phi_deg-=2*PI;
3998 phi_deg =phi_deg*DEGRAD;
3999 totalAngledeg = phi_deg*phi_deg + theta_deg*theta_deg;
4000 if(totalAngledeg > 2500) totalAngledeg=2500;
4002 extra_delay = (totalAngledeg*totalAngledeg)*1.45676e-8;
4003 extra_delay -= (totalAngledeg)*5.01452e-6;
4005 arrival_times[ipol][ant_ctr]+=extra_delay*1E-9;
4014 double first_trigger_time = Tools::dMin(minV, minH);
4015 for (
int ipol=0; ipol<2; ipol++){
4018 arrival_times[ipol][i] -= first_trigger_time;
4025 void Anita::GetArrivalTimesBoresights(
const Vector rf_direction[NLAYERS_MAX][NPHI_MAX]) {
4027 for (
int ipol=0; ipol<2; ipol++){
4029 int ilayer = (antenna_index<8)*0 + (antenna_index>7)*(antenna_index<16)*1+ (antenna_index>15)*(antenna_index<32)*2+(antenna_index>31)*3;
4030 int ifold = (ilayer<2)*(antenna_index%8)+(ilayer>1)*(antenna_index%16);
4031 arrival_times[ipol][antenna_index] = (
antenna_positions[ipol][antenna_index] * rf_direction[ilayer][ifold]) / CLIGHT;
4044 double first_trigger_time = Tools::dMin(minV, minH);
4045 for (
int ipol=0; ipol<2; ipol++){
4048 arrival_times[ipol][i] = arrival_times[ipol][i] - first_trigger_time + additionalDt;
4057 void Anita::setphiTrigMask(UInt_t realTime_flightdata) {
4059 if (realTime_flightdata<realTime_tr_min || realTime_flightdata>
realTime_tr_max) {
4068 iturf=turfratechain->GetEntryNumberWithBestIndex(realTime_flightdata);
4076 turfratechain->GetEvent(iturf);
4084 void Anita::setTimeDependentThresholds(UInt_t realTime_flightdata){
4086 if (realTime_flightdata<realTime_surf_min || realTime_flightdata>
realTime_surf_max) {
4087 for(
int ipol=0;ipol<2;ipol++){
4088 for (
int iant=0;iant<48;iant++){
4095 isurf=surfchain->GetEntryNumberWithBestIndex(realTime_flightdata);
4097 for(
int ipol=0;ipol<2;ipol++){
4098 for (
int iant=0;iant<48;iant++){
4103 surfchain->GetEvent(isurf);
4111 #ifdef ANITA_UTIL_EXISTS 4112 void Anita::readImpulseResponseDigitizer(
Settings *settings1){
4115 deltaT = 1./(2.6*16.);
4116 string graphNames[2][3][16];
4123 if (settings1->WHICH==8){
4124 fileName = ICEMC_DATA_DIR+
"/sumPicoImpulse.root";
4126 for (
int iring=0;iring<3;iring++){
4127 for (
int iphi=1;iphi<17;iphi++){
4128 graphNames[0][iring][iphi]=
"grImpRespV";
4129 graphNames[1][iring][iphi]=
"grImpRespH";
4134 }
else if(settings1->WHICH==9 || settings1->WHICH==10){
4136 fileName = ICEMC_DATA_DIR+
"/Anita3_ImpulseResponseDigitizer.root";
4138 string spol[2] ={
"V",
"H"};
4139 string sring[3]={
"T",
"M",
"B"};
4141 for (
int ipol=0;ipol<2;ipol++){
4142 for (
int iring=0;iring<3;iring++){
4143 for (
int iphi=0;iphi<16;iphi++){
4144 graphNames[ipol][iring][iphi] = Form(
"g%02d%s%s", iphi+1, sring[iring].c_str(), spol[ipol].c_str() ) ;
4151 norm *= TMath::Power(10., -3./20.);
4153 norm *= TMath::Power(10., +1./20.);
4158 TFile fImpulse(fileName.c_str());
4160 if(!fImpulse.IsOpen()) {
4161 std::cerr <<
"Couldn't read siganl chain impulse response from " << fileName <<
"\n";
4165 for (
int ipol=0;ipol<2;ipol++){
4166 for (
int iring=0;iring<3;iring++){
4167 for (
int iphi=0;iphi<16;iphi++){
4169 TGraph *grTemp = (TGraph*) fImpulse.Get(graphNames[ipol][iring][iphi].c_str());
4171 std::cerr <<
"Couldn't read signal chain impulse response" << graphNames[ipol][iring][iphi] <<
" from file " << fileName <<
"\n";
4176 Int_t nPoints = grInt->GetN();
4177 Double_t *newx = grInt->GetX();
4178 Double_t *newy = grInt->GetY();
4180 for (
int i=0;i<nPoints;i++){
4181 newy[i]=newy[i]*norm;
4183 newx[i]=newx[i]*1E-9;
4187 grTemp =
new TGraph(nPoints, newx, newy);
4194 TGraph *gDig = fSignalChainResponseDigitizer[ipol][iring][iphi]->getFreqMagGraph();
4196 double temparray[512];
4197 for(
int i=0;i<numFreqs;i++) {
4198 temparray[i] = gDig->Eval(freqs[i]*1e6);
4202 for (
int i=0; i<numFreqs;i++){
4204 fSignalChainResponseA3DigitizerFreqDomain[ipol][iring][iphi][i] = temparray[i];
4206 fSignalChainResponseA3DigitizerFreqDomain[ipol][iring][iphi][i] = (temparray[i-2] + temparray[i-1] + temparray[i] + temparray[i+1] + temparray[i+2])/5.;
4208 fSignalChainResponseDigitizerFreqDomain[ipol][iring][iphi][0][i] = fSignalChainResponseA3DigitizerFreqDomain[ipol][iring][iphi][i];
4220 void Anita::readTuffResponseDigitizer(
Settings *settings1){
4227 string snotch_dir[6]={
"notches_260_0_0",
"notches_260_375_0",
"notches_260_0_460",
"notches_260_385_0",
"notches_260_365_0",
"notches_260_375_460"};
4228 string spol[2] = {
"V",
"H"};
4229 string sring[3] = {
"T",
"M",
"B"};
4231 deltaT = 1./(2.6*16.);
4234 double norm = TMath::Power(10., +6./20.);
4236 for(
int ipol=0; ipol<=1; ipol++) {
4237 for(
int iring = 0; iring<=2; iring++){
4238 for(
int iphi=0; iphi<=15; iphi++) {
4239 for(
int ituff=0; ituff <=6; ituff++) {
4242 filename = Form(
"%s/share/AnitaAnalysisFramework/responses/A4noNotches/%02d%s%s.imp",getenv(
"ANITA_UTIL_INSTALL_DIR"), iphi+1, sring[iring].c_str(), spol[ipol].c_str());
4245 filename = Form(
"%s/share/AnitaAnalysisFramework/responses/A4ImpulseTUFFs/%s/%02d%s%s.imp",getenv(
"ANITA_UTIL_INSTALL_DIR"), snotch_dir[ituff].c_str(), iphi+1, sring[iring].c_str(), spol[ipol].c_str());
4248 TGraph *gtemp =
new TGraph(filename);
4250 TGraph *gint = Tools::getInterpolatedGraph(gtemp,deltaT);
4252 Int_t nPoints = gint->GetN();
4253 Double_t *newx = gint->GetX();
4254 Double_t *newy = gint->GetY();
4257 for (
int i=0;i<nPoints;i++){
4259 newx[i]=newx[i]*1E-9;
4260 newy[i]=newy[i]*norm;
4262 *gint = TGraph(nPoints,newx,newy);
4269 TGraph *gDig = fSignalChainResponseDigitizerTuffs[ipol][iring][iphi][ituff]->getFreqMagGraph();
4271 double temparray[512];
4272 for(
int i=0;i<numFreqs;i++) {
4273 temparray[i] = gDig->Eval(freqs[i]*1e6);
4277 for (
int i=0; i<numFreqs;i++){
4279 fSignalChainResponseDigitizerFreqDomain[ipol][iring][iphi][ituff][i] = temparray[i];
4281 fSignalChainResponseDigitizerFreqDomain[ipol][iring][iphi][ituff][i] = (temparray[i-2] + temparray[i-1] + temparray[i] + temparray[i+1] + temparray[i+2])/5.;
4293 void Anita::readTuffResponseTrigger(
Settings *settings1){
4296 string snotch_dir[7]={
"trigconfigA.imp",
"trigconfigB.imp",
"trigconfigC.imp",
"trigconfigG.imp",
"trigconfigO.imp",
"trigconfigP.imp",
"trigconfigK.imp"};
4298 deltaT = 1./(2.6*16.);
4299 for(
int ipol=0; ipol<=1; ipol++) {
4300 for(
int iring = 0; iring<=2; iring++){
4301 for(
int iphi=0; iphi<=15; iphi++) {
4302 for(
int ituff=0; ituff <=6; ituff++) {
4303 filename = Form(
"%s/share/AnitaAnalysisFramework/responses/A4ImpulseTUFFs/%s",getenv(
"ANITA_UTIL_INSTALL_DIR"), snotch_dir[ituff].c_str());
4306 TGraph *gtemp =
new TGraph(filename);
4308 TGraph *gint = Tools::getInterpolatedGraph(gtemp,deltaT);
4310 Int_t nPoints = gint->GetN();
4311 Double_t *newx = gint->GetX();
4312 Double_t *newy = gint->GetY();
4314 for (
int i=0;i<nPoints;i++){
4316 newx[i]=newx[i]*1E-9;
4318 *gint = TGraph(nPoints,newx,newy);
4326 TGraph *gTrig = fSignalChainResponseTriggerTuffs[ipol][iring][iphi][ituff]->getFreqMagGraph();
4328 double temparray[512];
4329 for(
int i=0;i<numFreqs;i++) {
4330 temparray[i] = gTrig->Eval(freqs[i]*1e6);
4334 for (
int i=0; i<numFreqs;i++){
4336 fSignalChainResponseTriggerFreqDomain[ipol][iring][iphi][ituff][i] = temparray[i];
4338 fSignalChainResponseTriggerFreqDomain[ipol][iring][iphi][ituff][i] = (temparray[i-2] + temparray[i-1] + temparray[i] + temparray[i+1] + temparray[i+2])/5.;
4349 void Anita::readNoiseFromFlight(
Settings *settings1){
4351 TFile *fRayleighAnita3 =
new TFile((ICEMC_DATA_DIR+
"/RayleighAmplitudesAnita3_noSun_Interp.root").c_str(),
"read");
4353 for (
int iant=0;iant<48;iant++){
4354 RayleighFits[0][iant] = (TGraph*)fRayleighAnita3->Get(Form(
"grSigma%dV_interp", iant+1));
4355 RayleighFits[1][iant] = (TGraph*)fRayleighAnita3->Get(Form(
"grSigma%dH_interp", iant+1));
4358 Double_t *timeVals =
new Double_t [780];
4359 Double_t *voltVals =
new Double_t [780];
4360 for(
int i=0;i<780;i++){
4361 timeVals[i] = i*1./2.6;
4367 numFreqs=rfTemplate->getNumFreqs();
4368 freqs=rfTemplate->getFreqs();
4375 void Anita::readImpulseResponseTrigger(
Settings *settings1){
4380 deltaT = 1./(2.6*16.);
4381 string graphNames[2][3][16];
4385 if(settings1->WHICH==9 || settings1->WHICH==10){
4386 if(settings1->WHICH==9){
4387 fileName = ICEMC_DATA_DIR+
"/Anita3_ImpulseResponseTrigger.root";
4390 fileName = ICEMC_DATA_DIR+
"/Anita4_ImpulseResponseTrigger.root";
4392 string spol[2] ={
"V",
"H"};
4393 string sring[3]={
"T",
"M",
"B"};
4395 for (
int ipol=0;ipol<2;ipol++){
4396 for (
int iring=0;iring<3;iring++){
4397 for (
int iphi=0;iphi<16;iphi++){
4398 graphNames[ipol][iring][iphi]= Form(
"gTrigPath") ;
4408 if (!settings1->NOISEFROMFLIGHTTRIGGER) norm *= TMath::Power(10, -7/20.);
4412 TFile fImpulse(fileName.c_str());
4414 if(!fImpulse.IsOpen()) {
4415 std::cerr <<
"Couldn't read signal chain impulse response from " << fileName <<
"\n";
4419 for (
int ipol=0; ipol<2; ipol++){
4420 for (
int iring=0; iring<3; iring++){
4421 for (
int iphi=0; iphi<16; iphi++){
4423 TGraph *grTemp = (TGraph*) fImpulse.Get(graphNames[ipol][iring][iphi].c_str());
4425 std::cerr <<
"Couldn't read signal chain impulse response" << graphNames[ipol][iring][iphi] <<
" from file " << fileName <<
"\n";
4430 Int_t nPoints = grInt->GetN();
4431 Double_t *newx = grInt->GetX();
4432 Double_t *newy = grInt->GetY();
4434 for (
int i=0;i<nPoints;i++){
4435 newy[i]=newy[i]*norm;
4437 newx[i]=newx[i]*1E-9;
4441 grTemp =
new TGraph(nPoints, newx, newy);
4448 if (settings1->TUFFSTATUS==0){
4449 TGraph *gTrig = fSignalChainResponseTrigger[ipol][iring][iphi]->getFreqMagGraph();
4450 for(
int i=0;i<numFreqs;i++) {
4451 fSignalChainResponseTriggerFreqDomain[ipol][iring][iphi][0][i] = gTrig->Eval(freqs[i]*1e6);
4463 void Anita::calculateImpulseResponsesRatios(
Settings *settings1){
4465 double denom, dig, trig;
4470 if (settings1->WHICH==10) norm=0.85;
4472 for (
int ipol=0; ipol<2; ipol++){
4473 for (
int iring=0; iring<3; iring++){
4474 for (
int iphi=0; iphi<16; iphi++){
4475 for(
int ituff=0; ituff<ntuffs; ituff++){
4477 for(
int i=0;i<numFreqs;i++){
4478 denom = fSignalChainResponseA3DigitizerFreqDomain[ipol][iring][iphi][i];
4479 trig = fSignalChainResponseTriggerFreqDomain[ipol][iring][iphi][ituff][i];
4480 dig = fSignalChainResponseDigitizerFreqDomain[ipol][iring][iphi][ituff][i];
4482 if (freqs[i]<160.) {
4483 fRatioTriggerToA3DigitizerFreqDomain[ipol][iring][iphi][ituff][i] = 0.1;
4485 fRatioTriggerToA3DigitizerFreqDomain[ipol][iring][iphi][ituff][i] = (trig/denom)*norm;
4488 fRatioDigitizerToA3DigitizerFreqDomain[ipol][iring][iphi][ituff][i] = (dig/denom)*norm;
4506 void Anita::readTriggerEfficiencyScanPulser(
Settings *settings1){
4508 if(settings1->WHICH==10 || settings1->WHICH==9){
4510 if(settings1->WHICH==10){
4511 string fileName = ICEMC_DATA_DIR+
"/TriggerEfficiencyScanPulser_anita4_33dB_avg_trimmed.root";
4512 TFile *f =
new TFile(fileName.c_str(),
"read");
4513 gPulseAtAmpa = (TGraph*)f->Get(
"Phisector_3_33dBCh1_trimmed");
4516 Int_t nPoints = gPulseAtAmpa->GetN();
4517 Double_t *newx = gPulseAtAmpa->GetX();
4518 Double_t *newy = gPulseAtAmpa->GetY();
4519 Double_t meany = TMath::Mean(nPoints/10, newy);
4521 for (
int i=0;i<nPoints;i++){
4523 newx[i]=newx[i]*1E9;
4526 *gPulseAtAmpa = TGraph(nPoints,newx,newy);
4534 string fileName = ICEMC_DATA_DIR+
"/TriggerEfficiencyScanPulser_anita3.root";
4535 TFile *f =
new TFile(fileName.c_str(),
"read");
4537 gPulseAtAmpa = (TGraph*)f->Get(
"gAvgPulseAtAmpa");
4545 bool useDelayGenerator =
false;
4547 double maxDelays = (Tools::dMax(trigEffScanRingDelay, 3) + Tools::dMax(trigEffScanPhiDelay,5) );
4548 maxDelays -= (Tools::dMin(trigEffScanRingDelay, 3) + Tools::dMin(trigEffScanPhiDelay,5) );
4550 if (maxDelays!=0) useDelayGenerator=
true;
4552 for (
int i=0;i<gPulseAtAmpa->GetN();i++){
4553 if(settings1->WHICH==9){
4555 gPulseAtAmpa->GetY()[i]*=TMath::Power(10,-7./20.);
4556 }
else if(settings1->WHICH==10){
4564 gPulseAtAmpa->GetY()[i]*=TMath::Power(10,(-25.0+33.0)/20.);
4573 gPulseAtAmpa->GetY()[i]*=TMath::Power(10, trigEffScanAtt[2]*1./20.);
4575 if(settings1->WHICH==9){
4577 gPulseAtAmpa->GetY()[i]*=TMath::Power(10, -10.8/20.);
4578 }
else if(settings1->WHICH==10){
4580 gPulseAtAmpa->GetY()[i]*=TMath::Power(10, -12./20.);
4584 if (useDelayGenerator){
4585 gPulseAtAmpa->GetY()[i]*=TMath::Power(10, -12./20.);
4589 gPulseAtAmpa->GetY()[i]*=TMath::Power(10,-3./20.);
4600 double *x = gPulseAtAmpa->GetX();
4601 double *y = gPulseAtAmpa->GetY();
4602 double xnew[10000], ynew[10000];
4603 int N = gPulseAtAmpa->GetN();
4607 for (
int j=6; j<N; j++){
4612 TGraph *gtemp =
new TGraph (newn, xnew, ynew);
4616 for (
int i=0;i<HALFNFOUR;i++){
4617 trigEffScanPulseAtAmpa[i] = gPulseAtAmpaInt->Eval(fTimes[i]);
4619 if(settings1->WHICH==9){
4626 delete gPulseAtAmpaInt;
4629 if(settings1->WHICH==9){
4630 string fileName = ICEMC_DATA_DIR+
"/TriggerEfficiencyScanPulser_anita3.root";
4631 TFile *f =
new TFile(fileName.c_str(),
"read");
4633 for (
int isample=0;isample<250;isample++){
4635 TGraph *gPulseAtSurf = (TGraph*)f->Get(Form(
"gSamplePulseAtSurf_%i", isample));
4638 double *y2 = gPulseAtSurfInt->GetY();
4640 for (
int i=0;i<HALFNFOUR;i++){
4641 trigEffScanPulseAtSurf[isample][i]=y2[i]/10.;
4644 delete gPulseAtSurfInt;
4645 delete gPulseAtSurf;
4652 cout <<
"Impulse response on trigger path can only be used with ANITA-3 or ANITA-4" << endl;
4661 void Anita::calculateDelaysForEfficiencyScan(){
4665 for (
int iant=0; iant<48; iant++){
4667 phiIndex = trigEffScanPhi - (iant%16);
4668 if (phiIndex>8) phiIndex=phiIndex-16;
4670 if(TMath::Abs(phiIndex)<=2){
4674 if (iant%2==0) irx = iant/2;
4675 else irx = 8 + iant/2;
4679 arrival_times[0][irx] += trigEffScanPhiDelay[phiIndex+2];
4682 if (trigEffScanApplyRingDelay[phiIndex+2]>0){
4684 if (iant<16) arrival_times[0][irx] += trigEffScanRingDelay[0] + trigEffScanRingDelay[2];
4685 else if (iant<32) arrival_times[0][irx] += trigEffScanRingDelay[1];
double total_diodeinput_1_allantennas[48][HALFNFOUR]
this is across all antennas, just the full band
int noiseeventcounter
counts which event we're on so we go in order
unsigned int realTime_tr_min
min realtime from the turf rate file
double total_diodeinput_2_allantennas[48][HALFNFOUR]
needs comment
double peak_v_banding_rfcm[2][5]
peak V in e/h polarization after rfcm's and banding
int nnoiseevents
total number of noise events we're choosing from
double timedomain_output_corrected_forplotting[2][6][HALFNFOUR]
this is just for writing out to the following tree
double rms_rfcm_e_single_event
This is in Volts, not mV!
Double_t fakeThresholds[2][48]
Fake thresholds (coming from converting fake scalers to thresholds)
double LAYER_VPOSITION[Anita::NLAYERS_MAX]
position of layers in z relative to vertical center of the payload
static AnitaEventCalibrator * Instance(int version=0)
Instance generator.
unsigned int realTime_turfrate
realtime from the turf rate file
int GetRxTriggerNumbering(int ilayer, int ifold)
get antenna number based on which layer and position it is
double THETA_ZENITH[NLAYERS_MAX]
how the antenna is tilted in theta (in radians with 0=up)
double peak_rx_signalonly[2]
peak voltage in e/h polarization received by the antenna
double total_diodeinput_1_inanita[5][HALFNFOUR]
this is the waveform that is input to the tunnel diode in the first (LCP or vertical) polarization ...
TTree * tdata
writing data out for the analysers
This is a wrapper class for an RF Signal.
const char * ICEMC_SRC_DIR()
void Initialize(Settings *settings1, ofstream &foutput, int inu, TString outputdir)
initialize a bunch of stuff
double SIMON_DELTA_R[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
UShort_t scalers[2][48]
scalers as read from the surf file: first index is pol, second is antenna number (only working for An...
int number_all_antennas
this keeps count of the number of antennas for use with timing calculations, etc. ...
int PERCENTBW
percent bandwidth
AnitaEventCalibrator – The ANITA Event Calibrator.
Reads in and stores input settings for the run.
static double GetNoise(Settings *settings1, double altitude_bn, double geoid, double theta, double bw, double temp)
Get Noise.
double peak_rx_rfcm_lab[2]
peaks of the previous arrays
double BN_LONGITUDE
balloon longitude for fixed balloon location
double PHI_EACHLAYER[NLAYERS_MAX][NPHI_MAX]
phi of the center of each antenna on each layer
double PHI_OFFSET[NLAYERS_MAX]
antenna offset in phi for each layer (radians)
double total_diodeinput_2_inanita[5][HALFNFOUR]
this is the waveform that is input to the tunnel diode in the second (RCP or horizontal) polarization...
int NBANDS
number of frequency sub-bands (not counting full band)
int iminbin[5]
this is the minimum bin to start
UShort_t thresholds[2][48]
thresholds as read from the surf file: first index is pol, second is antenna number (only working for...
unsigned int realTime_tr_max
max realtime from the turf rate file
unsigned int realTime_surf_max
max realtime from the surf file
double timedomain_output_inanita[2][5][HALFNFOUR]
this is just for writing out to the following tree
TTree * tgaryanderic
writing data out for the analysers
double rms_lab[2]
rms noise at lab chip
Vector ANTENNA_POSITION_START[2][NLAYERS_MAX][NPHI_MAX]
antenna positions from Kurt's measurements
Double_t fakeScalers[2][48]
Fake scalers (coming from converting threhsolds during flight to scalers using threshold scan) ...
This is a wrapper class for a complex number.
double RRX[Anita::NLAYERS_MAX]
radius that the antenna sits from the axis of the payload (feedpoint)
double rms_rfcm[2]
rms noise just after rfcm's
Vector unRotatePayload(Vector ant_pos)
This function UN-rotates the payload.
double peak_rx_rfcm_signalonly[2]
peak voltage in e/h polarization received by the antenna
double surface_under_balloon
distance between center of the earth and the surface of earth under balloon
static const int NLAYERS_MAX
max number of layers (in smex design, it's 4)
double FREQ_HIGH
highest frequency
Vector antenna_positions[2][NLAYERS_MAX *NPHI_MAX]
these are the antenna positions in space in a coordinate system where x=north and y=west and the orig...
double ston[5]
signal to noise;
double FREQ_LOW
lowest frequency
Double_t relativePhaseCenterToAmpaDelays[12][9]
From phase center to AMPAs (hopefully)
int GetRx(int ilayer, int ifold)
get antenna number based on which layer and position it is
double THERMALNOISE_FACTOR
factor to multiply thermal noise for error analysis
int channels_passing[2][5]
channels passing. This is reset for every antenna for every event
double timedomain_output_allantennas[2][48][HALFNFOUR]
this is across all antennas, just the full band
double SIMON_DELTA_PHI[NLAYERS_MAX][NPHI_MAX]
measurements by Simon used in analysis ANITA-2
Double_t deadTime
fractional deadTime
double peak_rx_rfcm[2]
peak voltage in e/h polarization received by the antenna
Handles everything related to balloon positions, payload orientation over the course of a flight...
int l2trig_anita4lr_forgaryanderic[16][HALFNFOUR]
when it passes 2/3
Double_t fakeThresholds2[2][48]
Fake thresholds 2 (coming from converting flight scalers to thresholds)
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
double ANTENNA_DOWN[NLAYERS_MAX][NPHI_MAX]
down angles of antennas from Kurt's measurements
static const int NPHI_MAX
max number of antennas around in phi (in smex, 16)
unsigned int realTime_surf_min
min realtime from the surf file
double signal_vpol_inanita[5][HALFNFOUR]
this is the signal waveform in the vertical polarization, before converting to LCP, RCP where applicable
enum AnitaPol::EAnitaPol AnitaPol_t
Polarisation enumeration.
double LAYER_PHIPOSITION[Anita::NLAYERS_MAX]
phi corresponding to the position of each "layer" on the "payload"
int maxbin_fortotal[5]
when it sums the noise and signal together it shortens the waveform
double total_vpol_inanita[5][HALFNFOUR]
this is the sum of the signal and noise in the vertical polarization, before converting to LCP...
int NRX_PHI[NLAYERS_MAX]
number of antennas around in each layer. (radians)
Ice thicknesses and water depth.
unsigned int realTime_surf
realtime from the surf file
double LAYER_HPOSITION[Anita::NLAYERS_MAX]
distance in horizontal plane between center axis of the "payload" and each "layer".