testEAS.cc
1 /* -*- C++ -*-.*********************************************************************************************
2  Author: Linda Cremonesi
3  Email: l.cremonesi@ucl.ac.uk
4 
5  Description:
6  Template to generate triggers coming from EAS
7 ***********************************************************************************************************/
8 #include <iostream>
9 #include <fstream>
10 #include <sstream>
11 #include <math.h>
12 #include <ctype.h>
13 #include <string>
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <vector>
17 #include <array>
18 #include <time.h>
19 #include "TTreeIndex.h"
20 #include "TChain.h"
21 #include "TH1.h"
22 #include "TF1.h"
23 #include "TF2.h"
24 #include "TFile.h"
25 #include "TTree.h"
26 #include "TLegend.h"
27 #include "icemc_random.h"
28 #include "TLine.h"
29 #include "TROOT.h"
30 #include "TPostScript.h"
31 #include "TCanvas.h"
32 #include "TH2F.h"
33 #include "TText.h"
34 #include "TProfile.h"
35 #include "TGraphErrors.h"
36 #include "TGraphAsymmErrors.h"
37 #include "TStyle.h"
38 #include "TMath.h"
39 #include <unistd.h>
40 #include "TVector3.h"
41 #include "TRotation.h"
42 #include "TSpline.h"
43 #include "Math/InterpolationTypes.h"
44 #include "Math/Interpolator.h"
45 #include "signal.h"
46 
47 #include "EnvironmentVariable.h"
48 
49 //#include "rx.hpp"
50 #include "Constants.h"
51 #include "Settings.h"
52 #include "position.hh"
53 
54 #include "earthmodel.hh"
55 #include "Tools.h"
56 #include "vector.hh"
57 #include "roughness.hh"
58 #include "anita.hh"
59 #include "balloon.hh"
60 #include "icemodel.hh"
61 // #include "trigger.hh"
62 #include "Spectra.h"
63 #include "signal.hh"
64 #include "secondaries.hh"
65 #include "ray.hh"
66 #include "counting.hh"
67 #include "Primaries.h"
68 #include "Taumodel.hh"
69 #include "screen.hh"
70 #include "GlobalTrigger.h"
71 #include "ChanTrigger.h"
72 
73 #include <string>
74 #include <sstream>
75 
76 #if __cplusplus > 199711L
77 #include <type_traits>
78 #endif
79 
80 #include <typeinfo>
81 
82 #ifdef ANITA_UTIL_EXISTS
83 #include "UsefulAnitaEvent.h"
84 #include "AnitaGeomTool.h"
85 #include "AnitaConventions.h"
86 #include "RawAnitaHeader.h"
87 #include "Adu5Pat.h"
88 #include "FFTtools.h"
89 UsefulAnitaEvent* realEvPtr = NULL;
90 RawAnitaHeader* rawHeaderPtr = NULL;
91 Adu5Pat* Adu5PatPtr = NULL;
92 #ifdef ANITA3_EVENTREADER
93 #include "TruthAnitaEvent.h"
94 TruthAnitaEvent* truthEvPtr = NULL;
95 #endif
96 #endif
97 
98 Taumodel* TauPtr = NULL;
99 
100 const string ICEMC_SRC_DIR = EnvironmentVariable::ICEMC_SRC_DIR();
101 
102 ClassImp(RX);
103 
104 using namespace std;
105 
106 class EarthModel;
107 class Position;
108 
109 
110 // functions
111 
112 
113 #ifdef ANITA_UTIL_EXISTS
114 int GetIceMCAntfromUsefulEventAnt(Settings *settings1, int UsefulEventAnt);
115 #ifdef R_EARTH
116 #undef R_EARTH
117 #endif
118 #endif
119 
120 bool ABORT_EARLY = false; // This flag is set to true when interrupt_signal_handler() is called
121 
122 
123 void interrupt_signal_handler(int sig);
124 
125 int main(int argc, char **argv) {
126 
127  string stemp;
128 
129  Settings* settings1 = new Settings();
130 
131  string input="inputs.txt";
132  string run_num;//current run number as string
133  int run_no = 0;//current run number as integer
134  TString outputdir;
135 
136  if( (argc%3!=1)&&(argc%2!=1)) {
137  cout << "Syntax for options: -i inputfile -o outputdir -r run_number\n";
138  return 0;
139  }
140  int nnu_tmp=0;
141  double exp_tmp=0;
142  double trig_thresh=0.;
143  char clswitch; // command line switch
144  if (argc>1) {
145  while ((clswitch = getopt(argc, argv, "t:i:o:r:n:e:")) != EOF) {
146  switch(clswitch) {
147  case 'n':
148  nnu_tmp=atoi(optarg);
149  cout << "Changed number of simulated neutrinos to " << nnu_tmp << endl;
150  break;
151  case 't':
152  trig_thresh=atof(optarg);
153  break;
154  case 'i':
155  input=optarg;
156  cout << "Changed input file to: " << input << endl;
157  break;
158  case 'o':
159  outputdir=optarg;
160  cout << "Changed output directory to: " << outputdir.Data() << endl;
161  stemp="mkdir " + string(outputdir.Data());
162  system(stemp.c_str());
163  break;
164  case 'e':
165  exp_tmp=atof(optarg);
166  cout << "Changed neutrino energy exponent to " << exp_tmp << endl;
167  break;
168  case 'r':
169  run_num=optarg;
170  stringstream convert(run_num);
171  convert>>run_no;
172  break;
173  } // end switch
174  } // end while
175  } // end if arg>1
176 
177 
178  settings1->SEED=settings1->SEED +run_no;
179  cout <<"seed is " << settings1->SEED << endl;
180 
181  setSeed(settings1->SEED);
182 
183 
184  Balloon *bn1=new Balloon(); // instance of the balloon
185  Anita *anita1=new Anita();// right now this constructor gets banding info
186  Secondaries *sec1=new Secondaries();
187  // Primaries *primary1=new Primaries();
188  Signal *sig1=new Signal();
189  Ray *ray1=new Ray(); // create new instance of the ray class
190  Counting *count1=new Counting();
191  GlobalTrigger *globaltrig1;
192  // Taumodel *taus1 = new Taumodel();
193  // input parameters
194 
195  double vmmhz[Anita::NFREQ]; // V/m/MHz at balloon (after all steps)
196  // given the angle you are off the Cerenkov cone, the fraction of the observed e field that comes from the em shower
197  double vmmhz_em[Anita::NFREQ];
198 
199  stemp=string(outputdir.Data())+"/output"+run_num+".txt";
200  ofstream foutput(stemp.c_str(), ios::app);
201 
202  int NNU;
203  double RANDOMISEPOL=0.;
204  int inu=0;
205  int neutrinos_passing_all_cuts=0;
206  double weight=0;
207  int discones_passing=0; // number of discones that pass
208 
209  settings1->ReadInputs(input.c_str(), foutput, NNU, RANDOMISEPOL);
210  settings1->ApplyInputs(anita1, sec1, sig1, bn1, ray1);
211  sig1->Initialize();
212 
213  settings1->SEED=settings1->SEED + run_no;
214  setSeed(settings1->SEED);
215 
216  bn1->InitializeBalloon();
217  anita1->Initialize(settings1, foutput, inu, outputdir);
218 
219  if (trig_thresh!=0)
220  anita1->powerthreshold[4]=trig_thresh;
221  if (nnu_tmp!=0)
222  NNU=nnu_tmp;
223  if (exp_tmp!=0)
224  settings1->EXPONENT=exp_tmp;
225 
226  // create new instance of the screen class
227  // only using the specular case as we are ignoring the ice
228  Screen *panel1 = new Screen(0);
229 
230  time_t raw_start_time = time(NULL);
231  struct tm * start_time = localtime(&raw_start_time);
232 
233  cout << "Date and time at start of run are: " << asctime (start_time) << "\n";
234 
235 
236  Tools::Zero(anita1->NRX_PHI, Anita::NLAYERS_MAX);
237  for (int i=0;i<Anita::NLAYERS_MAX;i++) {
238  Tools::Zero(anita1->PHI_EACHLAYER[i], Anita::NPHI_MAX);
239  }
240  Tools::Zero(anita1->PHI_OFFSET, Anita::NLAYERS_MAX);
241  Tools::Zero(anita1->THETA_ZENITH, Anita::NLAYERS_MAX);
242  Tools::Zero(anita1->LAYER_VPOSITION, Anita::NLAYERS_MAX);
243  Tools::Zero(anita1->RRX, Anita::NLAYERS_MAX);
244 
245  double volts_rx_rfcm_lab_e_all[48][512];
246  double volts_rx_rfcm_lab_h_all[48][512];
247 
248 
249  Vector n_eplane = const_z;
250  Vector n_hplane = -const_y;
251  Vector n_normal = const_x;
252 
253  Vector n_pol; // direction of polarization
254  Vector n_pol_eachboresight[Anita::NLAYERS_MAX][Anita::NPHI_MAX]; // direction of polarization of signal seen at each antenna
255  Vector direction2bn; // direction from EAS to balloon
256  Vector direction2bn_eachboresight[Anita::NLAYERS_MAX][Anita::NPHI_MAX]; // direction from EAS to balloon
257 
258  // variable declarations for functions GetEcompHcompEvector and GetEcompHcompkvector - oindree
259 
260  double e_component[Anita::NANTENNAS_MAX]={0}; // E comp along polarization
261  double h_component[Anita::NANTENNAS_MAX]={0}; // H comp along polarization
262  double n_component[Anita::NANTENNAS_MAX]={0}; // normal comp along polarization
263 
264  double e_component_kvector[Anita::NANTENNAS_MAX]={0}; // component of e-field along the rx e-plane
265  double h_component_kvector[Anita::NANTENNAS_MAX]={0}; // component of the e-field along the rx h-plane
266  double n_component_kvector[Anita::NANTENNAS_MAX]={0}; // component of the e-field along the normal
267 
268 
269  double hitangle_e, hitangle_h; // angle the ray hits the antenna wrt e-plane, h-plane
270  double hitangle_e_all[Anita::NANTENNAS_MAX]; // hit angles rel. to e plane stored for each antenna
271  double hitangle_h_all[Anita::NANTENNAS_MAX]; // hit angles rel. to h plane stored for each antenna
272 
273  double sourceLon;
274  double sourceAlt;
275  double sourceLat;
276 
277 
278  int l3trig[Anita::NPOL]; // 16 bit number which says which phi sectors pass L3 V-POL
279  // For each trigger layer, which "clumps" pass L2. 16 bit, 16 bit and 8 bit for layers 1 & 2 and nadirs
280  int l2trig[Anita::NPOL][Anita::NTRIGGERLAYERS_MAX];
281  //For each trigger layer, which antennas pass L1. 16 bit, 16 bit and 8 bit and layers 1, 2 and nadirs
282  int l1trig[Anita::NPOL][Anita::NTRIGGERLAYERS_MAX];
283 
284  // these are declared here so that they can be stuck into trees
285  int loctrig[Anita::NPOL][Anita::NLAYERS_MAX][Anita::NPHI_MAX]; //counting how many pass trigger requirement
286 
287  int loctrig_nadironly[Anita::NPOL][Anita::NPHI_MAX]; //counting how many pass trigger requirement
288 
289  int nchannels_triggered = 0; // total number of channels triggered
290  int nchannels_perrx_triggered[48]; // total number of channels triggered
291 
292 
293  Tools::Zero(count1->npass, 2); // sums events that pass, without weights
294 
295  UInt_t eventNumber;
296 
297 #ifdef ANITA_UTIL_EXISTS
298 
299  string outputAnitaFile =string(outputdir.Data())+"/SimulatedAnitaEventFile"+run_num+".root";
300  TFile *anitafileEvent = new TFile(outputAnitaFile.c_str(), "RECREATE");
301 
302  TTree *eventTree = new TTree("eventTree", "eventTree");
303  eventTree->Branch("event", &realEvPtr );
304  eventTree->Branch("run", &run_no, "run/I" );
305  eventTree->Branch("weight", &weight, "weight/D");
306 
307  outputAnitaFile =string(outputdir.Data())+"/SimulatedAnitaHeadFile"+run_num+".root";
308  TFile *anitafileHead = new TFile(outputAnitaFile.c_str(), "RECREATE");
309 
310  TTree *headTree = new TTree("headTree", "headTree");
311  headTree->Branch("header", &rawHeaderPtr );
312  headTree->Branch("weight", &weight, "weight/D");
313 
314  outputAnitaFile =string(outputdir.Data())+"/SimulatedAnitaGpsFile"+run_num+".root";
315  TFile *anitafileGps = new TFile(outputAnitaFile.c_str(), "RECREATE");
316 
317  TTree *adu5PatTree = new TTree("adu5PatTree", "adu5PatTree");
318  adu5PatTree->Branch("pat", &Adu5PatPtr );
319  adu5PatTree->Branch("eventNumber", &eventNumber, "eventNumber/I");
320  adu5PatTree->Branch("weight", &weight, "weight/D" );
321 
322  AnitaGeomTool *AnitaGeom1 = AnitaGeomTool::Instance();
323 
324 #ifdef ANITA3_EVENTREADER
325 
326  // Set AnitaVersion so that the right payload geometry is used
327  AnitaVersion::set(settings1->ANITAVERSION);
328 
329  outputAnitaFile =string(outputdir.Data())+"/SimulatedAnitaTruthFile"+run_num+".root";
330  TFile *anitafileTruth = new TFile(outputAnitaFile.c_str(), "RECREATE");
331 
332  TString icemcgitversion = TString::Format("%s", EnvironmentVariable::ICEMC_VERSION(outputdir));
333  printf("ICEMC GIT Repository Version: %s\n", icemcgitversion.Data());
334  unsigned int timenow = time(NULL);
335 
336  TTree *configAnitaTree = new TTree("configIcemcTree", "Config file and settings information");
337  configAnitaTree->Branch("gitversion", &icemcgitversion );
338  configAnitaTree->Branch("startTime", &timenow );
339  // configAnitaTree->Branch("settings", &settings1 );
340  configAnitaTree->Fill();
341 
342  TTree *triggerSettingsTree = new TTree("triggerSettingsTree", "Trigger settings");
343  triggerSettingsTree->Branch("dioderms", anita1->bwslice_dioderms_fullband_allchan, "dioderms[2][48][7]/D");
344  triggerSettingsTree->Branch("diodemean", anita1->bwslice_diodemean_fullband_allchan, "diodemean[2][48][7]/D");
345  triggerSettingsTree->Fill();
346 
347  TTree *truthAnitaTree = new TTree("truthAnitaTree", "Truth Anita Tree");
348  truthAnitaTree->Branch("truth", &truthEvPtr );
349 #endif
350 
351 #endif
352  //end ROOT variable definitions
354 
355 
356  IceModel *antarctica = new IceModel(settings1->ICE_MODEL + settings1->NOFZ*10, settings1->CONSTANTICETHICKNESS * 1000 + settings1->CONSTANTCRUST * 100 + settings1->FIXEDELEVATION * 10 + 0, settings1->WEIGHTABSORPTION);
357 
358  // fills arrays according to antenna specs
359  anita1->GetBeamWidths(settings1); // this is used if GAINS set to 0
360  // Antenna measured gain vs. frequency
361  anita1->ReadGains(); // this is used if GAINS set to 1
362  anita1->Set_gain_angle(settings1, sig1->NMEDIUM_RECEIVER);
363 
364 
365  // sets position of balloon and related quantities
366  // these are all passed as pointers
367  // theta, phi, altitude of balloon
368  // position of balloon, altitude and position of surface of earth (relative to the center of the earth) under balloon
369  bn1->SetDefaultBalloonPosition(antarctica);
370 
371  anita1->SetNoise(settings1, bn1, antarctica);
372  //pathtree->Fill(); //Added by Stephen for verification of path
373 
374  // find the maximum distance the interaction could be from the balloon and still be within the horizon.
375  antarctica->GetMAXHORIZON(bn1);
376 
377  // calculate the volume of ice seen by the balloon for all balloon positions
378  antarctica->CreateHorizons(settings1, bn1, bn1->theta_bn, bn1->phi_bn, bn1->altitude_bn, foutput);
379  cout << "Done with CreateHorizons.\n";
380 
381  // builds payload based on read inputs
382  anita1->GetPayload(settings1, bn1);
383 
384  if (settings1->TRIGGERSCHEME == 3 || settings1->TRIGGERSCHEME == 4 || settings1->TRIGGERSCHEME==5) {
385  Vector plusz(0., 0., 1.);
386  bn1->PickBalloonPosition(plusz, antarctica, settings1, anita1);
387  anita1->calculate_all_offsets();
388  double angle_theta=16.;
389  double angle_phi=0.;
390  Vector x = Vector(cos(angle_theta * RADDEG) * cos((angle_phi+11.25) * RADDEG),
391  cos(angle_theta * RADDEG) * sin((angle_phi+11.25) * RADDEG),
392  sin(angle_theta * RADDEG));
393  anita1->GetArrivalTimes(x,bn1,settings1);
394  cout << "end of getarrivaltimes\n";
395  }
396 
397  time_t raw_loop_start_time = time(NULL);
398  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;
399 
400 
401 
402  signal(SIGINT, interrupt_signal_handler); // This function call allows icemc to gracefully abort and write files as usual rather than stopping abruptly.
403 
404  double justNoise_trig[2][48][512];
405  double justSignal_trig[2][48][512];
406  double justNoise_dig[2][48][512];
407  double justSignal_dig[2][48][512];
408 
409  double thresholdsAnt[48][2][5];
410 
411  int passes_thisevent=0;
412  int passestrigger=0;
413  int count_total=0;
414  int count_rx=0;
415  int antNum=0;
416 
417  // begin looping over NNU neutrinos doing the things
418  for (inu = 0; inu < NNU; inu++) {
419 
420  if (NNU >= 100) {
421  if (inu % (NNU / 100) == 0)
422  cout << inu << " neutrinos. " << (double(inu)/double(NNU)) * 100 << "% complete.\n";
423  }
424  else
425  cout << inu << " neutrinos. " << (double(inu) / double(NNU)) * 100 << "% complete.\n";
426 
427 
428  eventNumber=(UInt_t)(run_no)*NNU+inu;
429 
430  // Set seed of all random number generators to be dependent on eventNumber
431  setSeed(eventNumber);
432 
433  anita1->passglobtrig[0]=0;
434  anita1->passglobtrig[1]=0;
435  passes_thisevent=0;
436  passestrigger=0;
437  count_total++;
438  // initializing the voltage seen by each polarization of each antenna
439  bn1->dtryingposition=0;
440  for (int i=0; i<Anita::NFREQ;i++) {
441  vmmhz[i] = 0.; // the full signal with all factors accounted for (1/r, atten. etc.)
442  vmmhz_em[i]=0.; // for keeping track of just the em component of the shower
443  } //Zero the vmmhz array - helpful for banana plots, shouldn't affect anything else - Stephen
444 
445  // Picks the balloon position and at the same time sets the masks and thresholds
446  bn1->PickBalloonPosition(antarctica, settings1, inu, anita1, getRNG(RNG_BALLOON_POSITION)->Rndm());
447 
448  // BR: Here calculate the direction to the balloon
449  // And the polarization
450  // direction2bn = something something something
451  // n_pol = something something something
452  // if you decide to evaluate a different direction per antenna, then you should define also
453  // direction2bn_eachboresight = something something something
454  // n_pol_eachboresight = something something something
455 
456 
457 
458  // make a global trigger object (but don't touch the electric fences)
459  globaltrig1 = new GlobalTrigger(settings1, anita1);
460 
461  Tools::Zero(anita1->arrival_times[0], Anita::NLAYERS_MAX*Anita::NPHI_MAX);
462  Tools::Zero(anita1->arrival_times[1], Anita::NLAYERS_MAX*Anita::NPHI_MAX);
463 
464  if(settings1->BORESIGHTS)
465  anita1->GetArrivalTimesBoresights(direction2bn_eachboresight);
466  else
467  anita1->GetArrivalTimes(direction2bn,bn1,settings1);
468 
469  anita1->rx_minarrivaltime=Tools::WhichIsMin(anita1->arrival_times[0], settings1->NANTENNAS);
470 
471 
472  globaltrig1->volts_rx_rfcm_trigger.assign(16, vector <vector <double> >(3, vector <double>(0)));
473  anita1->rms_rfcm_e_single_event = 0;
474 
475 
476  count_rx=0;
477  for (int ilayer=0; ilayer < settings1->NLAYERS; ilayer++) { // loop over layers on the payload
478  for (int ifold=0;ifold<anita1->NRX_PHI[ilayer];ifold++) { // ifold loops over phi
479 
480  ChanTrigger *chantrig1 = new ChanTrigger();
481  chantrig1->InitializeEachBand(anita1);
482 
483  //reset screen parameters (even for no roughness) for the new event
484  panel1->ResetParameters();
485 
486  panel1->SetNvalidPoints(1);
487 
488  // BR: Add here the electric field at the payload before it gets through the antennas
489  // For each antenna you need to define the electric field Vmmhz by doing
490  for (int k=0;k<Anita::NFREQ;k++) {
491  panel1->AddVmmhz_freq(vmmhz[k]);
492  }
493  panel1->AddDelay( 0. );
494  // Use this to add the direction
495  panel1->AddVec2bln(direction2bn);
496  // Use this to add direction of polarization
497  panel1->AddPol(n_pol);
498  panel1->AddWeight( 1. );
499  panel1->SetWeightNorm( 1. );
500 
501  // set the position of the source
502  sourceLon=sourceLat=sourceAlt=0;
503 
504  bn1->GetAntennaOrientation(settings1, anita1, ilayer, ifold, n_eplane, n_hplane, n_normal);
505 
506  // for this (hitangle_h_all[count_rx]=hitangle_h;) and histogram fill, use specular case
507  //although the GetEcomp..() functions are called in ConvertInputWFtoAntennaWF() to calculate the actual waveforms
508  if (!settings1->BORESIGHTS) {
509  bn1->GetEcompHcompkvector(n_eplane, n_hplane, n_normal, direction2bn, e_component_kvector[count_rx], h_component_kvector[count_rx], n_component_kvector[count_rx]);
510  bn1->GetEcompHcompEvector(settings1, n_eplane, n_hplane, n_pol, e_component[count_rx], h_component[count_rx], n_component[count_rx]);
511  }
512  else{ // i.e. if BORESIGHTS is true
513  bn1->GetEcompHcompkvector(n_eplane, n_hplane, n_normal, ray1->n_exit2bn_eachboresight[2][ilayer][ifold], e_component_kvector[count_rx], h_component_kvector[count_rx], n_component_kvector[count_rx]);
514  bn1->GetEcompHcompEvector(settings1, n_eplane, n_hplane, n_pol_eachboresight[ilayer][ifold], e_component[count_rx], h_component[count_rx], n_component[count_rx]);
515  }
516  bn1->GetHitAngles(e_component_kvector[count_rx], h_component_kvector[count_rx], n_component_kvector[count_rx], hitangle_e, hitangle_h);
517  // store hitangles for plotting
518  hitangle_h_all[count_rx]=hitangle_h;
519  hitangle_e_all[count_rx]=hitangle_e;
520  // for debugging
521 
522 
523  antNum = anita1->GetRxTriggerNumbering(ilayer, ifold);
524 
525  chantrig1->ApplyAntennaGain(settings1, anita1, bn1, panel1, antNum, n_eplane, n_hplane, n_normal);
526 
527  chantrig1->TriggerPath(settings1, anita1, antNum, bn1);
528 
529  chantrig1->DigitizerPath(settings1, anita1, antNum, bn1);
530 
531  chantrig1->TimeShiftAndSignalFluct(settings1, anita1, ilayer, ifold, volts_rx_rfcm_lab_e_all, volts_rx_rfcm_lab_h_all);
532 
533  chantrig1->saveTriggerWaveforms(anita1, justSignal_trig[0][antNum], justSignal_trig[1][antNum], justNoise_trig[0][antNum], justNoise_trig[1][antNum]);
534  chantrig1->saveDigitizerWaveforms(anita1, justSignal_dig[0][antNum], justSignal_dig[1][antNum], justNoise_dig[0][antNum], justNoise_dig[1][antNum]);
535 
536 
537  double thresholds[2][5];
538  //+++++//+++++//+++++//+++++//+++++//+++++//+++++
539  chantrig1->WhichBandsPass(settings1, anita1, globaltrig1, bn1, ilayer, ifold, 0, 0, 0, thresholdsAnt[antNum]);
540 
541 
542  delete chantrig1;
543 
544  count_rx++;
545  } //loop through the phi-fold antennas
546  } //loop through the layers of antennas
547 
548 
549  anita1->rms_rfcm_e_single_event = sqrt(anita1->rms_rfcm_e_single_event / (anita1->HALFNFOUR * settings1->NANTENNAS));
550 
551  for (int irx=0;irx<settings1->NANTENNAS;irx++) {
552  nchannels_perrx_triggered[irx]=globaltrig1->nchannels_perrx_triggered[irx];
553  }
554 
555  nchannels_triggered=Tools::iSum(globaltrig1->nchannels_perrx_triggered, settings1->NANTENNAS); // find total number of antennas that were triggered.
556 
558  // EVALUATE GLOBAL TRIGGER //
559  // FOR VPOL AND HPOL //
561 
562 
563  int thispasses[Anita::NPOL]={0,0};
564 
565  globaltrig1->PassesTrigger(settings1, anita1, discones_passing, 2, l3trig, l2trig, l1trig, settings1->antennaclump, loctrig, loctrig_nadironly, inu,
566  thispasses);
567 
568  for (int i=0;i<2;i++) {
569  for (int j=0;j<16;j++) {
570  for (int k=0;k<anita1->HALFNFOUR;k++) {
571  count1->nl1triggers[i][0]+=anita1->l1trig_anita3and4_inanita[i][j][k];
572  }
573  }
574  }
575 
577  // Require that it passes //
578  // global trigger //
580  // for Anita-lite, Anita Hill, just L1 requirement on 2 antennas. This option is currently disabled
581  // Save events that generate an RF trigger or that are part of the min bias sample
582  // Minimum bias sample: save all events that we could see at the payload
583  // Independentely from the fact that they generated an RF trigger
584 
585  if ( (thispasses[0]==1 && anita1->pol_allowed[0]==1)
586  || (thispasses[1]==1 && anita1->pol_allowed[1]==1)
587  || (settings1->MINBIAS==1)) {
588 
589  // cout << inu << endl;
590 
591  anita1->passglobtrig[0]=thispasses[0];
592  anita1->passglobtrig[1]=thispasses[1];
593 
594 
595  // keep track of events passing trigger
596  count1->npassestrigger[0]++;
597  // tags this event as passing
598  passestrigger=1;
599 
600 
601 #ifdef ANITA_UTIL_EXISTS
602  realEvPtr = new UsefulAnitaEvent();
603  rawHeaderPtr = new RawAnitaHeader();
604  Adu5PatPtr = new Adu5Pat();
605 
606  Adu5PatPtr->latitude= bn1->latitude;
607  Adu5PatPtr->longitude=bn1->longitude;
608  Adu5PatPtr->altitude=bn1->altitude;
609  Adu5PatPtr->realTime=bn1->realTime_flightdata;
610  Adu5PatPtr->heading = bn1->heading;
611  Adu5PatPtr->pitch = bn1->pitch;
612  Adu5PatPtr->roll = bn1->roll;
613  Adu5PatPtr->run = run_no;
614 
615  memset(realEvPtr->fNumPoints, 0, sizeof(realEvPtr->fNumPoints) );
616  memset(realEvPtr->fVolts, 0, sizeof(realEvPtr->fVolts) );
617  memset(realEvPtr->fTimes, 0, sizeof(realEvPtr->fTimes) );
618 
619  int fNumPoints = 260;
620 
621  for (int iant = 0; iant < settings1->NANTENNAS; iant++){
622  //int IceMCAnt = GetIceMCAntfromUsefulEventAnt(anita1, AnitaGeom1, iant);
623  int IceMCAnt = GetIceMCAntfromUsefulEventAnt(settings1, iant);
624  int UsefulChanIndexH = AnitaGeom1->getChanIndexFromAntPol(iant, AnitaPol::kHorizontal);
625  int UsefulChanIndexV = AnitaGeom1->getChanIndexFromAntPol(iant, AnitaPol::kVertical);
626  realEvPtr->fNumPoints[UsefulChanIndexV] = fNumPoints;
627  realEvPtr->fNumPoints[UsefulChanIndexH] = fNumPoints;
628  realEvPtr->chanId[UsefulChanIndexV] = UsefulChanIndexV;
629  realEvPtr->chanId[UsefulChanIndexH] = UsefulChanIndexH;
630 
631  for (int j = 0; j < fNumPoints; j++) {
632  // convert seconds to nanoseconds
633  realEvPtr->fTimes[UsefulChanIndexV][j] = j * anita1->TIMESTEP * 1.0E9;
634  realEvPtr->fTimes[UsefulChanIndexH][j] = j * anita1->TIMESTEP * 1.0E9;
635  // convert volts to millivolts
636  realEvPtr->fVolts[UsefulChanIndexH][j] = volts_rx_rfcm_lab_h_all[IceMCAnt][j+128]*1000;
637  realEvPtr->fCapacitorNum[UsefulChanIndexH][j] = 0;
638  realEvPtr->fVolts[UsefulChanIndexV][j] = volts_rx_rfcm_lab_e_all[IceMCAnt][j+128]*1000;
639  realEvPtr->fCapacitorNum[UsefulChanIndexV][j] = 0;
640  }//end int j
641  }// end int iant
642 
643  realEvPtr->eventNumber = eventNumber;
644 
645  rawHeaderPtr->eventNumber = eventNumber;
646  rawHeaderPtr->surfSlipFlag = 0;
647  rawHeaderPtr->errorFlag = 0;
648 
649  if (settings1->MINBIAS==1)
650  rawHeaderPtr->trigType = 8; // soft-trigger
651  else
652  rawHeaderPtr->trigType = 1; // RF trigger
653 
654  rawHeaderPtr->run = run_no;
655  // put the vpol only as a placeholder - these are only used in Anita-2 anyway
656  rawHeaderPtr->upperL1TrigPattern = l1trig[0][0];
657  rawHeaderPtr->lowerL1TrigPattern = l1trig[0][1];
658  rawHeaderPtr->nadirL1TrigPattern = l1trig[0][2];
659 
660  rawHeaderPtr->upperL2TrigPattern = l2trig[0][0];
661  rawHeaderPtr->lowerL2TrigPattern = l2trig[0][1];
662  rawHeaderPtr->nadirL2TrigPattern = l2trig[0][2];
663 
664  if (settings1->WHICH<9){
665  rawHeaderPtr->phiTrigMask = (short) anita1->phiTrigMask;
666  rawHeaderPtr->l3TrigPattern = (short) l3trig[0];
667  }
668 
669  rawHeaderPtr->calibStatus = 31;
670  rawHeaderPtr->realTime = bn1->realTime_flightdata;
671  Adu5PatPtr->latitude= bn1->latitude;
672  Adu5PatPtr->longitude=bn1->longitude;
673  Adu5PatPtr->altitude=bn1->altitude;
674  Adu5PatPtr->realTime=bn1->realTime_flightdata;
675  Adu5PatPtr->heading = bn1->heading;
676  Adu5PatPtr->pitch = bn1->pitch;
677  Adu5PatPtr->roll = bn1->roll;
678  Adu5PatPtr->run = run_no;
679 
680 #ifdef ANITA3_EVENTREADER
681  if (settings1->WHICH==9 || settings1->WHICH==10) {
682  rawHeaderPtr->setTrigPattern((short) l3trig[0], AnitaPol::kVertical);
683  rawHeaderPtr->setTrigPattern((short) l3trig[1], AnitaPol::kHorizontal);
684  rawHeaderPtr->setMask( (short) anita1->l1TrigMask, (short) anita1->phiTrigMask, AnitaPol::kVertical);
685  rawHeaderPtr->setMask( (short) anita1->l1TrigMaskH, (short) anita1->phiTrigMaskH, AnitaPol::kHorizontal);
686  }
687 
688  truthEvPtr = new TruthAnitaEvent();
689  truthEvPtr->eventNumber = eventNumber;
690  truthEvPtr->realTime = bn1->realTime_flightdata;
691  truthEvPtr->run = run_no;
692  truthEvPtr->nuMom = 0; //pnu;
693  truthEvPtr->nu_pdg = 0; //pdgcode;
694  memcpy(truthEvPtr->e_component, e_component, sizeof(e_component));
695  memcpy(truthEvPtr->h_component, h_component, sizeof(h_component));
696  memcpy(truthEvPtr->n_component, n_component, sizeof(n_component));
697  memcpy(truthEvPtr->e_component_k ,e_component_kvector, sizeof(e_component_kvector));
698  memcpy(truthEvPtr->h_component_k ,h_component_kvector, sizeof(h_component_kvector));
699  memcpy(truthEvPtr->n_component_k ,n_component_kvector, sizeof(n_component_kvector));
700  truthEvPtr->sourceLon = sourceLon;
701  truthEvPtr->sourceLat = sourceLat;
702  truthEvPtr->sourceAlt = sourceAlt;
703  truthEvPtr->weight = weight;
704  for (int i=0;i<3;i++){
705  truthEvPtr->balloonPos[i] = bn1->r_bn[i];
706  truthEvPtr->balloonDir[i] = bn1->n_bn[i];
707  truthEvPtr->nuPos[i] = 0; //interaction1->posnu[i];
708  truthEvPtr->nuDir[i] = 0; //interaction1->nnu[i];
709  }
710  for (int i=0;i<5;i++){
711  for (int j=0;j<3;j++){
712  truthEvPtr->rfExitNor[i][j] = 0;//ray1->n_exit2bn[i][j];
713  truthEvPtr->rfExitPos[i][j] = 0;//ray1->rfexit[i][j];
714  }
715  }
716  for (int i=0;i<48;i++){
717  truthEvPtr->hitangle_e[i] = hitangle_e_all[i];
718  truthEvPtr->hitangle_h[i] = hitangle_h_all[i];
719  }
720  if(settings1->ROUGHNESS){
721  for (int i=0;i<Anita::NFREQ;i++)
722  truthEvPtr->vmmhz[i] = panel1->GetVmmhz_freq(i);
723  }
724 
725  memset(truthEvPtr->SNRAtTrigger, 0, sizeof(truthEvPtr->SNRAtTrigger) );
726  memset(truthEvPtr->fSignalAtTrigger, 0, sizeof(truthEvPtr->fSignalAtTrigger) );
727  memset(truthEvPtr->fNoiseAtTrigger, 0, sizeof(truthEvPtr->fNoiseAtTrigger) );
728  memset(truthEvPtr->SNRAtDigitizer, 0, sizeof(truthEvPtr->SNRAtDigitizer) );
729  memset(truthEvPtr->thresholds, 0, sizeof(truthEvPtr->thresholds) );
730  memset(truthEvPtr->fDiodeOutput, 0, sizeof(truthEvPtr->fDiodeOutput) );
731 
732  truthEvPtr->maxSNRAtTriggerV=0;
733  truthEvPtr->maxSNRAtTriggerH=0;
734  truthEvPtr->maxSNRAtDigitizerV=0;
735  truthEvPtr->maxSNRAtDigitizerH=0;
736 
737  for (int iant = 0; iant < settings1->NANTENNAS; iant++){
738  int UsefulChanIndexH = AnitaGeom1->getChanIndexFromAntPol(iant, AnitaPol::kHorizontal);
739  int UsefulChanIndexV = AnitaGeom1->getChanIndexFromAntPol(iant, AnitaPol::kVertical);
740 
741  truthEvPtr->SNRAtTrigger[UsefulChanIndexV] = Tools::calculateSNR(justSignal_trig[0][iant], justNoise_trig[0][iant]);
742  truthEvPtr->SNRAtTrigger[UsefulChanIndexH] = Tools::calculateSNR(justSignal_trig[1][iant], justNoise_trig[1][iant]);
743 
744  if (truthEvPtr->SNRAtTrigger[UsefulChanIndexV]>truthEvPtr->maxSNRAtTriggerV) truthEvPtr->maxSNRAtTriggerV=truthEvPtr->SNRAtTrigger[UsefulChanIndexV];
745  if (truthEvPtr->SNRAtTrigger[UsefulChanIndexH]>truthEvPtr->maxSNRAtTriggerH) truthEvPtr->maxSNRAtTriggerH=truthEvPtr->SNRAtTrigger[UsefulChanIndexH];
746 
747  truthEvPtr->SNRAtDigitizer[UsefulChanIndexV] = Tools::calculateSNR(justSignal_dig[0][iant], justNoise_dig[0][iant]);
748  truthEvPtr->SNRAtDigitizer[UsefulChanIndexH] = Tools::calculateSNR(justSignal_dig[1][iant], justNoise_dig[1][iant]);
749 
750  if (truthEvPtr->SNRAtDigitizer[UsefulChanIndexV]>truthEvPtr->maxSNRAtDigitizerV) truthEvPtr->maxSNRAtDigitizerV=truthEvPtr->SNRAtDigitizer[UsefulChanIndexV];
751  if (truthEvPtr->SNRAtDigitizer[UsefulChanIndexH]>truthEvPtr->maxSNRAtDigitizerH) truthEvPtr->maxSNRAtDigitizerH=truthEvPtr->SNRAtDigitizer[UsefulChanIndexH];
752 
753 
754  truthEvPtr->thresholds[UsefulChanIndexV] = thresholdsAnt[iant][0][4];
755  truthEvPtr->thresholds[UsefulChanIndexH] = thresholdsAnt[iant][1][4];
756  int irx = iant;
757  if (iant<16){
758  if (iant%2) irx = iant/2;
759  else irx = iant/2 + 1;
760  }
761 
762  for (int j = 0; j < fNumPoints; j++) {
763  truthEvPtr->fTimes[UsefulChanIndexV][j] = j * anita1->TIMESTEP * 1.0E9;
764  truthEvPtr->fTimes[UsefulChanIndexH][j] = j * anita1->TIMESTEP * 1.0E9;
765 
766  truthEvPtr->fSignalAtTrigger[UsefulChanIndexV][j] = justSignal_trig[0][iant][j+128]*1000;
767  truthEvPtr->fSignalAtTrigger[UsefulChanIndexH][j] = justSignal_trig[1][iant][j+128]*1000;
768  truthEvPtr->fNoiseAtTrigger[UsefulChanIndexV][j] = justNoise_trig[0][iant][j+128]*1000;
769  truthEvPtr->fNoiseAtTrigger[UsefulChanIndexH][j] = justNoise_trig[1][iant][j+128]*1000;
770  truthEvPtr->fSignalAtDigitizer[UsefulChanIndexV][j] = justSignal_dig[0][iant][j+128]*1000;
771  truthEvPtr->fSignalAtDigitizer[UsefulChanIndexH][j] = justSignal_dig[1][iant][j+128]*1000;
772  truthEvPtr->fNoiseAtDigitizer[UsefulChanIndexV][j] = justNoise_dig[0][iant][j+128]*1000;
773  truthEvPtr->fNoiseAtDigitizer[UsefulChanIndexH][j] = justNoise_dig[1][iant][j+128]*1000;
774 
775  truthEvPtr->fDiodeOutput[UsefulChanIndexV][j] = anita1->timedomain_output_allantennas[0][irx][j];
776  truthEvPtr->fDiodeOutput[UsefulChanIndexH][j] = anita1->timedomain_output_allantennas[1][irx][j];
777  }//end int j
778 
779  }// end int iant
780 
781 
782  truthAnitaTree->Fill();
783  delete truthEvPtr;
784 #endif
785 
786  headTree->Fill();
787  eventTree->Fill();
788  adu5PatTree->Fill();
789 
790  delete realEvPtr;
791  delete rawHeaderPtr;
792  delete Adu5PatPtr;
793 #endif
794 
795  neutrinos_passing_all_cuts++;
796 
797 
798  passes_thisevent=1; // flag this event as passing
799  } // end if passing global trigger conditions
800  else {
801  passes_thisevent=0; // flag this event as not passing
802  }// end else event does not pass trigger
803 
805  //
806  // WE GET HERE REGARDLESS OF WHETHER THE TRIGGER PASSES
807  //
809 
810  delete globaltrig1;
811 
812  // keeping track of intermediate counters, incrementing by weight1.
813  // weight1 was not yet determined when integer counters were incremented.
814 
815 
816  //looping over two types of rays - upgoing and downgoing.
817  if (ABORT_EARLY){
818  std::cout << "\n***********************************************************";
819  std::cout << "\n* SIGINT received, aborting loop over events early.";
820  std::cout << "\n* Stopped after event " << inu << " instead of " << NNU;
821  std::cout << "\n* Any output which relied on NNU should be corrected for.";
822  std::cout << "\n***********************************************************\n";
823  foutput << "\n***********************************************************";
824  foutput << "\n* SIGINT received, aborting loop over events early.";
825  foutput << "\n* Stopped after event " << inu << " instead of " << NNU;
826  foutput << "\n* Any output which relied on NNU should be corrected for.";
827  foutput << "\n***********************************************************\n";
828  break;
829  }
830  }//end NNU neutrino loop
831 
832  // Finished with individual neutrinos now ...
833  //roughout.close();
834 
835 
836 
837 #ifdef ANITA_UTIL_EXISTS
838 
839  anitafileEvent->cd();
840  eventTree->Write("eventTree");
841  anitafileEvent->Close();
842  delete anitafileEvent;
843 
844  anitafileHead->cd();
845  headTree->Write("headTree");
846  anitafileHead->Close();
847  delete anitafileHead;
848 
849  anitafileGps->cd();
850  adu5PatTree->Write("adu5PatTree");
851  anitafileGps->Close();
852  delete anitafileGps;
853 
854 #ifdef ANITA3_EVENTREADER
855  anitafileTruth->cd();
856  configAnitaTree->Write("configAnitaTree");
857  truthAnitaTree->Write("truthAnitaTree");
858  triggerSettingsTree->Write("triggerSettingsTree");
859  anitafileTruth->Close();
860  delete anitafileTruth;
861 #endif
862 
863 #endif
864 
865 
866 
867  delete anita1;
868  return 0;
869 
870 } //END MAIN PROGRAM
871 
872 
873 
874 void interrupt_signal_handler(int sig){
875  signal(sig, SIG_IGN);
876  ABORT_EARLY = true;
877  return;
878 }
879 //end interrupt_signal_handler()
880 
881 #ifdef ANITA_UTIL_EXISTS
882 //int GetIceMCAntfromUsefulEventAnt(Anita *anita1, AnitaGeomTool *AnitaGeom1, int UsefulEventAnt){
883 int GetIceMCAntfromUsefulEventAnt(Settings *settings1, int UsefulEventAnt){
884  //int layer_temp = IceMCLayerPosition[UsefulEventIndex][0];
885  //int position_temp = IceMCLayerPosition[UsefulEventIndex][1];
886  //int IceMCIndex = anita1->GetRx(layer_temp, position_temp);
887  int IceMCAnt = UsefulEventAnt;
888  if ((settings1->WHICH==9 || settings1->WHICH==10) && UsefulEventAnt<16) {
889  IceMCAnt = (UsefulEventAnt%2==0)*UsefulEventAnt/2 + (UsefulEventAnt%2==1)*(UsefulEventAnt/2+8);
890  }
891 
892  return IceMCAnt;
893 }
894 //end GetIceMCAntfromUsefulEventAnt()
895 
896 
897 #endif
UInt_t eventNumber
Event number from software.
Definition: RawAnitaEvent.h:33
UShort_t lowerL2TrigPattern
Bit mask for lower ring l2 cluster triggers. eg. if the bit 1 (the lowest bit) is active it means the...
UChar_t surfSlipFlag
Sync Slip between SURF 2-9 and SURF 1.
Double_t h_component_k[48]
Component of the e-field along the rx h-plane.
Double_t rfExitPos[5][3]
Position where the RF exits the ice- 5 iterations, 3 dimensions each.
Double_t fNoiseAtDigitizer[12 *9][260]
Array of noise at digitizer.
UChar_t errorFlag
Error Flag.
void PassesTrigger(Settings *settings1, Anita *anita1, int discones_passing, int mode, int *l3trig, int l2trig[Anita::NPOL][Anita::NTRIGGERLAYERS_MAX], int l1trig[Anita::NPOL][Anita::NTRIGGERLAYERS_MAX], int antennaclump, int loctrig[Anita::NPOL][Anita::NLAYERS_MAX][Anita::NPHI_MAX], int loctrig_nadironly[Anita::NPOL][Anita::NPHI_MAX], int inu, int *thispasses, bool noiseOnly=false)
Evaluate the full trigger simulation for a given payload configuration.
Double_t weight
Weight assigned by icemc.
Int_t nu_pdg
Neutrino PDG code.
Position r_bn
position of balloon
Definition: balloon.hh:66
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.
Float_t pitch
in degrees
Definition: Adu5Pat.h:46
double phi_bn
theta,phi of balloon wrt south pole
Definition: balloon.hh:65
Global Trigger.
Definition: GlobalTrigger.h:12
void InitializeEachBand(Anita *anita1)
Initialize trigger bands.
Definition: ChanTrigger.cc:711
UShort_t upperL1TrigPattern
Bit mask for upper ring l1 antenna triggers. eg. if the bit 1 (the lowest bit) is active it means the...
UShort_t l3TrigPattern
Bit mask for l3 global triggers. eg. if the bit 1 (the lowest bit) is active it means that phi sector...
Adu5Pat – The ADU5 Position and Attitude Data.
Definition: Adu5Pat.h:26
void TriggerPath(Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
Apply trigger path.
Definition: ChanTrigger.cc:871
static const int NPOL
number of polarizations
Definition: anita.hh:51
Double_t n_component_k[48]
Component of the e-field along the normal.
Double_t fDiodeOutput[12 *9][260]
Array of tunnel diode output.
UShort_t calibStatus
Calib/Relay Status.
Float_t latitude
In degrees.
Definition: Adu5Pat.h:42
void ApplyAntennaGain(Settings *settings1, Anita *anita1, Balloon *bn1, Screen *panel1, int ant, Vector &n_eplane, Vector &n_hplane, Vector &n_normal)
Apply the antenna gain.
Definition: ChanTrigger.cc:743
STL namespace.
static Int_t getChanIndexFromAntPol(Int_t ant, AnitaPol::AnitaPol_t pol)
Convert ant-pol to logical index.
Radiation from interaction.
Definition: signal.hh:13
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)
void PickBalloonPosition(Vector straightup, IceModel *antarctica, Settings *settings1, Anita *anita1)
This function picks the balloon position.
Definition: balloon.cc:317
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.
Definition: Adu5Pat.h:43
Double_t thresholds[12 *9]
Channel thresholds used in icemc.
UInt_t realTime
Time from the GPS unit.
Definition: Adu5Pat.h:37
const char * ICEMC_SRC_DIR()
Double_t n_component[48]
Normal comp along polarization.
Double_t balloonPos[3]
Balloon position.
UChar_t nadirL2TrigPattern
8-bit trigger mask for L2 nadir triggers. Nadir L2 triggers are for the even phi sectors and are just...
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)
RawAnitaHeader – The Raw ANITA Event Header.
Double_t SNRAtDigitizer[12 *9]
Array of SNR at digitizer.
Class that handles the channel trigger.
Definition: ChanTrigger.h:18
Reads in and stores input settings for the run.
Definition: Settings.h:37
Double_t fSignalAtTrigger[12 *9][260]
Array of signal at trigger.
Vector n_bn
normalized r_bn
Definition: balloon.hh:73
Int_t run
Run number, assigned on ground.
Double_t maxSNRAtTriggerV
Max SNR at trigger V-POL.
void InitializeBalloon()
This function initializes the balloon or the specific flight.
Definition: balloon.cc:188
This class is a 3-vector that represents a position on the Earth&#39;s surface.
Definition: position.hh:26
Secondary interactions.
Definition: secondaries.hh:28
void saveDigitizerWaveforms(Anita *anita1, double sig0[48], double sig1[48], double noise0[48], double noise1[48])
Save signal and noise waveforms at digitizer.
Double_t h_component[48]
H comp along polarization.
UInt_t realTime
unixTime of readout
Double_t rfExitNor[5][3]
Normal vector in direction of exit point to balloon - 5 iterations.
UsefulAnitaEvent – The Calibrated Useful Anita Event object.
void GetAntennaOrientation(Settings *settings1, Anita *anita1, int ilayer, int ifold, Vector &n_eplane, Vector &n_hplane, Vector &n_normal)
This function gets the antenna orientation.
Definition: balloon.cc:649
Float_t altitude
In metres.
Definition: Adu5Pat.h:44
UShort_t phiTrigMask
16-bit phi mask (from TURF)
Double_t hitangle_h[48]
Hit angles rel. to h plane stored for each antenna.
void SetDefaultBalloonPosition(IceModel *antarctica1)
This function sets the default balloon position.
Definition: balloon.cc:75
Double_t fSignalAtDigitizer[12 *9][260]
Array of signal at digitizer.
void DigitizerPath(Settings *settings1, Anita *anita1, int ant, Balloon *bn1)
Apply digitizer path.
UChar_t chanId[12 *9]
Definition: RawAnitaEvent.h:39
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...
Definition: earthmodel.hh:40
static const int NLAYERS_MAX
max number of layers (in smex design, it&#39;s 4)
Definition: anita.hh:59
UShort_t lowerL1TrigPattern
Bit mask for lower ring l1 antenna triggers. eg. if the bit 1 (the lowest bit) is active it means the...
int fCapacitorNum[12 *9][260]
Array of capacitor numbers.
Double_t fNoiseAtTrigger[12 *9][260]
Array of noise at trigger.
Double_t nuDir[3]
Neutrino direction.
void WhichBandsPass(Settings *settings1, Anita *anita1, GlobalTrigger *globaltrig1, Balloon *bn1, int ilayer, int ifold, double dangle, double emfrac, double hadfrac, double thresholds[2][5])
Which bands passes the trigger.
Definition: ChanTrigger.cc:54
Vertical Polarisation.
void GetEcompHcompEvector(Settings *settings1, Vector n_eplane, Vector n_hplane, const Vector n_pol, double &e_component, double &h_component, double &n_component)
This function gets the e-component, h-component and e-vector.
Definition: balloon.cc:704
Double_t e_component_k[48]
Component of e-field along the rx e-plane.
Double_t maxSNRAtDigitizerV
Max SNR at digitizer V-POL.
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...
Definition: balloon.hh:30
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Definition: vector.hh:27
UShort_t upperL2TrigPattern
Bit mask for upper ring l2 cluster triggers. eg. if the bit 1 (the lowest bit) is active it means the...
static const int NPHI_MAX
max number of antennas around in phi (in smex, 16)
Definition: anita.hh:61
Horizontal Polarisation.
void GetHitAngles(double e_component_kvector, double h_component_kvector, double n_component_kvector, double &hitangle_e, double &hitangle_h)
This function gets the hit angles.
Definition: balloon.cc:726
Float_t heading
0 is facing north, 180 is facing south
Definition: Adu5Pat.h:45
Double_t maxSNRAtTriggerH
Max SNR at trigger H-POL.
Handles event counting as cuts are made.
Definition: counting.hh:10
UInt_t realTime
unixTime of readout
Definition: rx.hpp:23
UChar_t nadirL1TrigPattern
8-bit trigger mask for L1 nadir triggers. Here bit 1 is antenna 33 (phi 1), bit 2 is antenna 34 (phi ...
static AnitaGeomTool * Instance(int anita_version=0)
Instance generator. If version_number == 0, uses AnitaVersion::get();.
AnitaGeomTool – The ANITA Geometry Tool.
Definition: AnitaGeomTool.h:48
double dtryingposition
weighting factor: how many equivalent tries each neutrino counts for after having reduced possible in...
Definition: balloon.hh:43
UInt_t eventNumber
Software event number.
Double_t nuPos[3]
Neutrino position.
Ray tracing.
Definition: ray.hh:20
Double_t fTimes[12 *9][260]
Array of unwrapped (unless kNoCalib) times for each channel.
Double_t hitangle_e[48]
Hit angles rel. to e plane stored for each antenna.
Int_t run
Run number.
Double_t SNRAtTrigger[12 *9]
Array of SNR at trigger.
void GetEcompHcompkvector(Vector n_eplane, Vector n_hplane, Vector n_normal, const Vector n_exit2bn, double &e_component_kvector, double &h_component_kvector, double &n_component_kvector)
This function gets the e-component, h-component and k-vector.
Definition: balloon.cc:690
Double_t maxSNRAtDigitizerH
Max SNR at digitizer H-POL.
UChar_t trigType
Bit 0 is RF, 1 is ADU5, 2 is G12, 3 is software/external.
Double_t balloonDir[3]
Balloon direction.
Ice thicknesses and water depth.
Definition: icemodel.hh:103
unsigned int realTime_flightdata
realtime from the flight data file
Definition: balloon.hh:51