diff --git a/#AraSim.cc# b/#AraSim.cc# new file mode 100644 index 00000000..17e9f62a --- /dev/null +++ b/#AraSim.cc# @@ -0,0 +1,829 @@ +// ROOT includes +#include "TFile.h" +#include "TRandom3.h" +#include "TTree.h" + +// AraSim includes +//vector and position must be first +#include "Vector.h" +#include "Position.h" + +#include "Constants.h" +#include "counting.hh" +#include "Detector.h" +#include "EarthModel.h" +#include "Efficiencies.h" +#include "Event.h" +#include "IceModel.h" +#include "Primaries.h" +#include "Ray.h" +#include "Report.h" +#include "RaySolver.h" +#include "secondaries.hh" +#include "Settingsude "signal.hh" +#include "Spectra.h" +#include "Tools.h" +#include "Trigger.h" + +using namespace std; + +#ifdef ARA_UTIL_EXISTS + #include "UsefulIcrrStationEvent.h" + ClassImp(UsefulIcrrStationEvent); + #include "UsefulAtriStationEvent.h" + ClassImp(UsefulAtriStationEvent); +#endif + +class EarthModel; //class + +void test(); + +string outputdir="outputs"; + +int main(int argc, char **argv) { // read setup.txt file + + Settings *settings1 = new Settings(); + + cout<<"\n\tDefault values!"<NNU<ICE_MODEL<NOFZ<CONSTANTICETHICKNESS<FIXEDELEVATION<MOOREBAY<EXPONENT<DETECTOR< 1) { // read file!! + setupfile = string( argv[1] ); + cout<<"setupfile : "< 2) { // read file!! + run_no = string( argv[2] ); + cout<<"run number : "< 3) { // read file!! + outputdir = string( argv[3] ); + if(outputdir[outputdir.size()-1]=='/') outputdir=outputdir.substr(0,outputdir.size()-1); // make sure outputdir doesn't have a / at the end + cout<<"outputdir : "< 2! + // cout<<"too many info! just use default setup.txt file!"<ReadFile(setupfile); + cout<<"Read "<NNU<ICE_MODEL<NOFZ<CONSTANTICETHICKNESS<FIXEDELEVATION<MOOREBAY<EXPONENT<DETECTOR<POSNU_RADIUS<EVENT_GENERATION_MODE << endl; + // cout << "EVENT_NUM: " << settings1->EVENT_NUM << endl; + + if (settings1->EVENT_GENERATION_MODE == 1){ + // string evtfile = "eventReadIn.txt"; + string evtfile = string(argv[argc - 1]); + settings1->ReadEvtFile(evtfile); + cout<<"Read "<< evtfile <<" file!"<NNU; i++){ + cout << settings1->EVID[i] << " " << settings1->NUFLAVORINT[i] << " " << settings1->NUBAR[i] << " " << settings1->PNU[i] << " " << settings1->CURRENTINT[i] << " " << settings1->IND_POSNU_R[i] << " " << settings1->IND_POSNU_THETA[i] << " " << settings1->IND_POSNU_PHI[i] << " " << settings1->IND_NNU_THETA[i] << " " << settings1->IND_NNU_PHI[i] << " " << settings1->ELAST[i] << endl; + } + } + // set gRandom as TRandom3 when settings1->RANDOM_MODE = 1 + if (settings1->RANDOM_MODE == 1) { + // test TRandom3 + TRandom3 *test_randm3 = new TRandom3 (0); + gRandom = test_randm3; + } else { + gRandom->SetSeed(settings1->SEED + atoi(run_no.c_str() ) ); + + } + //cout<<"first random from TRandom3 : "<Rndm()<<"\n"; + cout<<"first random : "<Rndm()<<"\n"; + + // IceModel *icemodel=new IceModel(ICE_MODEL + NOFZ*10,CONSTANTICETHICKNESS * 1000 + CONSTANTCRUST * 100 + FIXEDELEVATION * 10 + 0,MOOREBAY);// creates Antarctica ice model + IceModel *icemodel=new IceModel(settings1->ICE_MODEL + settings1->NOFZ*10,settings1->CONSTANTICETHICKNESS * 1000 + settings1->CONSTANTCRUST * 100 + settings1->FIXEDELEVATION * 10 + 0,settings1->MOOREBAY);// creates Antarctica ice model + // IceModel inherits from EarthModel + + cout<Surface(0., 0.)<SurfaceAboveGeoid(0., 0.)<DETECTOR); // builds antenna array, 0 for testbed + + Trigger *trigger=new Trigger(detector, settings1); // builds the trigger + // Efficiencies *efficiencies=new Efficiencies(detector->getnRx(),outputdir); // keeps track of efficiencies at each stage of the simulation + Efficiencies *efficiencies=new Efficiencies(100,outputdir); // keeps track of efficiencies at each stage of the simulation + cout<<"called Efficiencies"<EXPONENT); // gets library (or whatever) of neutrino spectra + cout<<"called Spectra"< 2) { + AraFile=new TFile((outputdir+"/AraOut."+setupfile.substr(setupfile.find_last_of("/")+1)+".run"+run_no+".root").c_str(),"RECREATE","ara"); + } + else { + AraFile=new TFile((outputdir+"/AraOut.root").c_str(),"RECREATE","ara"); + } + + TTree *AraTree=new TTree("AraTree","AraTree"); // for single entry + TTree *AraTree2=new TTree("AraTree2","AraTree2"); //for many entries + cout<<"assign AraFile, AraTrees"<Branch("detector",&detector); + cout<<"branch detector"<Branch("icemodel",&icemodel); + cout<<"branch icemodel"<Branch("trigger",&trigger); + cout<<"branch trigger"<Branch("settings",&settings1); + cout<<"branch settings"<Branch("spectra",&spectra); + cout<<"branch spectra"<Branch("event",&event); + cout<<"branch Evt"<Branch("report",&report); + cout<<"branch report"<Branch("UsefulIcrrStationEvent", &theIcrrEvent); + eventTree->Branch("UsefulAtriStationEvent",&theAtriEvent); + eventTree->Branch("weight", &weight); + + /* + UsefulIcrrStationEvent *theIcrrEventArray[3]; + for (int i = 0; i < 3; i++){ + theIcrrEvent[i] = 0; + } + UsefulAtriStationEvent *theAtriEventArray[38]; + for (int i = 0; i < 38; i++){ + theAtriEvent[i] = 0; + } + */ + + + /* + TTree *eventTree0; + eventTree0 = new TTree("eventTree0","Tree of Station 0 ARA Events"); + eventTree0->Branch("UsefulIcrrStationEvent",&theIcrrEventArray[0]); + TTree *eventTree1; + eventTree1 = new TTree("eventTree1","Tree of Station 1 ARA Events"); + eventTree1->Branch("UsefulAtriStationEvent",&theAtriEventArray[1]); + TTree *eventTree2; + eventTree2 = new TTree("eventTree2","Tree of Station 2 ARA Events"); + eventTree2->Branch("UsefulAtriStationEvent",&theAtriEventArray[2]); + TTree *eventTree3; + eventTree3 = new TTree("eventTree3","Tree of Station 3 ARA Events"); + eventTree3->Branch("UsefulAtriStationEvent",&theAtriEventArray[3]); + */ + #endif + + + cout<<"will call secondaries"<SetMedium(0); // set medium as ice + cout<<"finish calling secondaries and signal"<SetMeanRmsDiode(settings1, detector, report); + + if (settings1->NOISE_WAVEFORM_GENERATE_MODE == 0) {// noise waveforms will be generated for each evts + trigger->ClearNoiseWaveforms(); + } + + // now in Trigger class, there will be meandiode, rmsdiode values for noise (we need this for trigger later) + + double max_dt = 0.; // max arrival time difference + + int Total_Global_Pass = 0; // total global trigger passed number + double Total_Weight = 0.; + double Total_Probability = 0.; + + + /* + + TCanvas *cFull_window = new TCanvas("cFull_window","A Simple Graph Example",200,10,10000,11200); + cFull_window->Divide(1,16); + + TGraph *g_Full_window; + + TGraph *G_V_threshold_diode; + G_V_threshold_diode = new TGraph(2, threshold_x, threshold_y); + + TCanvas *cFull_window_V = new TCanvas("cFull_window_V","A Simple Graph Example",200,10,3200,2400); + cFull_window_V->Divide(4,4); + + TGraph *g_Full_window_V; + + */ + + double x_V[settings1->NFOUR/2]; + double y_V[settings1->NFOUR/2]; + + + + double xbin[settings1->DATA_BIN_SIZE]; + for (int i=0; iDATA_BIN_SIZE; i++) { + xbin[i] = i; + } + + double threshold_y[2]; + double threshold_x[2]; + + threshold_x[0] = 0.; + threshold_x[1] = (double)settings1->DATA_BIN_SIZE-1.; + threshold_y[0] = (trigger->rmsdiode) * (trigger->powerthreshold); + threshold_y[1] = (trigger->rmsdiode) * (trigger->powerthreshold); + + cout<<"powerthreshold : "<powerthreshold<TRIG_WINDOW = TRIG_WINDOW_Size; + + Total_Global_Pass = 0; + cout<<"begin looping events!!"<CALPULSER_ON << endl; + + // test Detector set correctly + cout<<"number of stations : "<params.number_of_stations << endl; + cout<<"total number of antennas : "<params.number_of_antennas << endl; + int ch_count = 0; + for (int i=0; iparams.number_of_stations; i++) { + for (int j=0; jstations[i].strings.size(); j++) { + for (int k=0; kstations[i].strings[j].antennas.size(); k++) { + ch_count++; + cout<<"station["<CheckCompatibilities(detector); + if (settings_compatibility_error > 0) { + cerr<<"There are "<< settings_compatibility_error<<" errors from settings. Check error messages."<DETECTOR == 3 && settings1->READGEOM == 1){ + cerr << "ERROR::InstalledStation geometry not available without AraRoot installation!" << endl; + return -1; + } + #endif + + + // test autoflush + // AraTree2->SetAutoFlush(0); + + // reset accumulative trig search bin info + settings1->ACCUM_TRIG_SEARCH_BINS_STATION0 = 0.; + + int nuLimit =0; + if (settings1->EVENT_GENERATION_MODE == 1){ //event mode read in different single events + nuLimit = settings1->NNU; + } + else if (settings1->ONLY_PASSED_EVENTS == 1){ + nuLimit = settings1->NNU_PASSED; + } + else { + nuLimit = settings1->NNU; + } + // cout << "nuLimit: " << nuLimit << endl; + int inu = 0; + int Events_Thrown = 0; + int Events_Passed = 0; + // for (int inu=0;inuNNU;inu++) { // loop over neutrinos + while (inu < nuLimit){ + // cout << "inu: " << inu << endl; + check_station_DC = 0; + check_station_DC = 0; + if ( settings1->DEBUG_MODE_ON==0 ) { + std::cerr<<"*"; + if ( Events_Thrown%100 == 0 ) + cout<<"Thrown "<inu_passed = -1; + + report = new Report(detector, settings1); + + #ifdef ARA_UTIL_EXISTS + theIcrrEvent = new UsefulIcrrStationEvent(); + theAtriEvent = new UsefulAtriStationEvent(); + #endif + + + // go further only if we picked up usable posnu + if (event->Nu_Interaction[0].pickposnu>0) { + + /* + if (settings1->NOISE_WAVEFORM_GENERATE_MODE == 0) {// noise waveforms will be generated for each evts + trigger->GetNewNoiseWaveforms(settings1, detector, report); + } + */ + + + //-------------------------------------------------- + // cout<<"inu : "<pnu : "<pnu<Nu_Interaction[0].posnu.Print(); + // cout<<"nnu : "; + // event->Nu_Interaction[0].nnu.Print(); + // cout<<"event->n_interactions : "<n_interactions<nuflavor<Nu_Interaction[0].vmmhz1m[0] : "<Nu_Interaction[0].vmmhz1m[0]<Nu_Interaction[0].pickposnu<Connect_Interaction_Detector (event, detector, raysolver, signal, icemodel, settings1, trigger); + + //report->Connect_Interaction_Detector (event, detector, raysolver, signal, icemodel, settings1, trigger, theEvent); + report->Connect_Interaction_Detector (event, detector, raysolver, signal, icemodel, settings1, trigger, Events_Thrown); + //report->Connect_Interaction_Detector (event, detector, raysolver, signal, icemodel, settings1, trigger, theEvent, Events_Thrown); + + #ifdef ARA_UTIL_EXISTS + if (settings1->DATA_LIKE_OUTPUT !=0){ + int stationID; + int stationIndex; + if (settings1->DETECTOR == 4){ + stationID = settings1->DETECTOR_STATION; + stationIndex = 0; + } else { + stationID = 0; + stationIndex = 0; + } + + if (report->stations[stationIndex].Global_Pass) { + // report->MakeUsefulEvent(detector, settings1, trigger, stationID, stationIndex, theIcrrEvent); + cout << endl << "Making useful event" << endl; + report->MakeUsefulEvent(detector, settings1, trigger, stationID, stationIndex, theAtriEvent); + /* + for (int i_chan = 0; i_chan< 16; i_chan++){ + int elecChan = AraGeomTool::Instance()->getElecChanFromRFChan(i_chan, stationID); + int string_i = detector->getStringfromArbAntID( stationIndex, i_chan); + int antenna_i = detector->getAntennafromArbAntID( stationIndex, i_chan); + cout << "Output: " << elecChan << " : " << theAtriEvent->fTimes[elecChan][1] << " : " << report->stations[stationIndex].strings[string_i].antennas[antenna_i].time_mimic[1] << endl; + } + */ + } + weight = event->Nu_Interaction[0].weight; + } + // cout << "weight: " << weight <ClearUselessfromConnect(detector, settings1, trigger); + for(int i=0;iNu_Interaction.size(); i++) + event->Nu_Interaction[i].clear_useless(settings1); + + // test if posnu is exactly same in calpulser mode + if (settings1->CALPULSER_ON == 1) { + cur_posnu_x = event->Nu_Interaction[0].posnu.GetX(); + cur_posnu_y = event->Nu_Interaction[0].posnu.GetY(); + cur_posnu_z = event->Nu_Interaction[0].posnu.GetZ(); + // cout<<"posnu x:"<0) { + if (pre_posnu_x==cur_posnu_x && pre_posnu_y==cur_posnu_y && pre_posnu_z==cur_posnu_z) { + } + else cout<<"posnu location changed!"<Nu_Interaction[0].posnu.GetX(); + pre_posnu_y = event->Nu_Interaction[0].posnu.GetY(); + pre_posnu_z = event->Nu_Interaction[0].posnu.GetZ(); + } + + for (int i=0; iparams.number_of_stations; i++) { + #ifdef ARA_UTIL_EXISTS + if (settings1->DATA_LIKE_OUTPUT != 0){ + if (settings1->DETECTOR == 3 && i == 0) + { theIcrrEvent->numRFChans = 14; } + else if (settings1->DETECTOR == 4 && settings1->DETECTOR_STATION == 0) + { theIcrrEvent->numRFChans = 14; } + else { + theAtriEvent->fNumChannels = 20; + theIcrrEvent->numRFChans = 16; + } + } + #endif + + if (max_dt < report->stations[i].max_arrival_time - report->stations[i].min_arrival_time) + max_dt = report->stations[i].max_arrival_time - report->stations[i].min_arrival_time; + // check the total global trigger passed + if (report->stations[i].Global_Pass) { + cout<<"\nGlobal_Pass : "<stations[i].Global_Pass<<" evt : "<Nu_Interaction[0].weight<Nu_Interaction[0].weight; + Total_Probability += event->Nu_Interaction[0].probability; + + // test increment weight + if (settings1->INTERACTION_MODE==1) { + count1->incrementEventsFound( event->Nu_Interaction[0].weight, event ); + } + else if (settings1->INTERACTION_MODE==0) { + count1->incrementEventsFound( event->Nu_Interaction[0].probability, event ); + } + else if (settings1->INTERACTION_MODE==3) { + count1->incrementEventsFound( event->Nu_Interaction[0].probability, event ); + } + else if (settings1->INTERACTION_MODE==4) { + count1->incrementEventsFound( event->Nu_Interaction[0].weight, event ); + } + } + check_station_DC++; + event->inu_passed = Events_Passed; + } + } + + /* + AraTree2->Fill(); //fill interaction every events + // for 1, save all events whether passed trigger or not + if (settings1->DATA_LIKE_OUTPUT==2) { + //theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + // for 0, save events which passed trigger + else if (settings1->DATA_LIKE_OUTPUT==1) { + //if ( Global_Pass_Flag == 1 ) { + if ( check_station_DC > 0 ) { + //theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + } + theEvent = NULL; + + delete theEvent; + */ + + settings1->ACCUM_TRIG_SEARCH_BINS_STATION0 += report->stations[0].total_trig_search_bin; + } // if pickposnu > 0 + else { + //cout<<"pickposnu : "<Nu_Interaction[0].pickposnu<delete_all(); + event->delete_all(); + } + + + // test FILL_TREE_MODE + if (settings1->FILL_TREE_MODE==0) { // fill event event + AraTree2->Fill(); //fill interaction every events + #ifdef ARA_UTIL_EXISTS + // for 1, save all events whether passed trigger or not + if (settings1->DATA_LIKE_OUTPUT==2) { + // theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + // for 0, save events which passed trigger + else if (settings1->DATA_LIKE_OUTPUT==1) { + if ( check_station_DC > 0 ) { + // theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + } + #endif + } + else if (settings1->FILL_TREE_MODE==1) { // fill only usable posnu event + if (event->Nu_Interaction[0].pickposnu>0) { + AraTree2->Fill(); //fill interaction every events + #ifdef ARA_UTIL_EXISTS + // for 1, save all events whether passed trigger or not + if (settings1->DATA_LIKE_OUTPUT==2) { + // theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + // for 0, save events which passed trigger + else if (settings1->DATA_LIKE_OUTPUT==1) { + if ( check_station_DC > 0 ) { + //theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + } + #endif + } + } + else if (settings1->FILL_TREE_MODE==2) { // fill only triggered event + if (check_station_DC>0) { + AraTree2->Fill(); //fill interaction every events + #ifdef ARA_UTIL_EXISTS + // for 1, save all events whether passed trigger or not + if (settings1->DATA_LIKE_OUTPUT==2) { + //theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + // for 0, save events which passed trigger + else if (settings1->DATA_LIKE_OUTPUT==1) { + if ( check_station_DC > 0 ) { + //theEvent = &report->theUsefulEvent; + eventTree->Fill(); + } + } + #endif + } + } + if (settings1->EVENT_GENERATION_MODE == 1){ + inu++; + } + else if (settings1->ONLY_PASSED_EVENTS == 1){ + if (check_station_DC > 0){ + inu++; + } + } + else { + inu++; + } + if (check_station_DC > 0){ + Events_Passed++; + } + Events_Thrown++; + + + //theEvent = NULL; + + /* + if (settings1->NOISE_WAVEFORM_GENERATE_MODE == 0) {// noise waveforms will be generated for each evts + // remove noise waveforms for next evt + rigger->ClearNoiseWaveforms(); + } + */ + + // if(inu==nuLimit){ + // cout<Print("test_V_mimic.pdf"); + //-------------------------------------------------- + + ofstream weight_file; + //weight_file.open(("./weight_output/weight_"+setupfile).c_str()); + if (argc == 3) { + weight_file.open(("./weight_output/weight_"+setupfile+".run"+run_no).c_str()); + } + else if (argc >3 ){ // add the subdirectory for outputs + weight_file.open((outputdir+"/weight_output/weight_"+setupfile+".run"+run_no).c_str()); + } + else { + weight_file.open(("./weight_output/weight_"+setupfile).c_str()); + } + + + cout<<" end loop"<NNU << endl; + cout << "Total Events Thrown: " << Events_Thrown << endl; + cout<<"Total_Global_Pass : "<INTERACTION_MODE==1) { + weight_file << "Total_Weight="<INTERACTION_MODE==0) { + weight_file << "Total_Probability="<NBINS-1; i++) { + cout<eventsfound_binned[i]<<", "; + weight_file << count1->eventsfound_binned[i]<<" "; + } + cout<eventsfound_binned[count1->NBINS-1]; + weight_file << count1->eventsfound_binned[count1->NBINS-1]<<"\n"; + weight_file.close(); + cout<<"\n\n"; + + + // if using picknear_cylinder method + if (settings1->INTERACTION_MODE==1) { + double IceVolume; + IceVolume = PI * (settings1->POSNU_RADIUS) * (settings1->POSNU_RADIUS) * icemodel->IceThickness( detector->stations[0] ); + cout << "Radius: " << settings1->POSNU_RADIUS << " [m]" << endl; + cout<<"IceVolume : "<eventsfound_binned, error_plus, error_minus ); + + /* + Veff_test = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * Total_Weight / (double)(settings1->NNU); + + // account all factors to error + error_plus = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * error_plus / (double)(settings1->NNU); + error_minus = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * error_minus / (double)(settings1->NNU); + */ + + Veff_test_we = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * Total_Weight / (double)(settings1->NNU); + Veff_test = IceVolume * 4. * PI * Total_Weight / (double)(settings1->NNU); + error_plus = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * error_plus / (double)(settings1->NNU); + error_minus = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * error_minus / (double)(settings1->NNU); + + cout<<"test Veff(ice) : "<INTERACTION_MODE==0) { + + double IceArea; + IceArea = PI * (settings1->POSNU_RADIUS) * (settings1->POSNU_RADIUS); + cout << endl; + cout<<"IceArea : "<< IceArea <NNU); + cout << "Aeff : " << Aeff << " [m^2]" << endl; + + + // error bar for weight + double error_plus = 0; + double error_minus = 0; + Counting::findErrorOnSumWeights( count1->eventsfound_binned, error_plus, error_minus ); + + // account all factors to error + error_plus = IceArea * error_plus / (double)(settings1->NNU); + error_minus = IceArea * error_minus / (double)(settings1->NNU); + + cout<<"And Aeff error plus : "<NNU<<", PickUnbiased passed NNU : "<DATA_SAVE_MODE != 0) { + trigger->v_noise_timedomain.clear(); + trigger->v_noise_timedomain_diode.clear(); + } + if (settings1->DATA_SAVE_MODE == 2) {// in DATA_SAVE_MODE==2, remove noise spectrum before Rayleigh dist. + trigger->Vfft_noise_before.clear(); + } + + AraTree->Fill(); // fill tree for one entry + AraFile->Write(); + // AraFile->Close(); + + efficiencies->summarize(); // summarize the results in an output file + + double freq[detector->GetFreqBin()], Filter[detector->GetFreqBin()]; + double Filter_E[detector->GetFreqBin()]; + + for (int i=0; iGetFreqBin(); i++) { + freq[i] = detector->GetFreq(i); // in Hz + Filter[i] = detector->GetFilterGain(i); // in dB + Filter_E[i] = pow(10., (detector->GetFilterGain(i))/20.); + } + + cout<<"max_dt : "<NNU<ICE_MODEL<SetSeed(settings1->SEED + atoi(run_no.c_str() ) ); - + } //cout<<"first random from TRandom3 : "<Rndm()<<"\n"; cout<<"first random : "<Rndm()<<"\n"; // IceModel *icemodel=new IceModel(ICE_MODEL + NOFZ*10,CONSTANTICETHICKNESS * 1000 + CONSTANTCRUST * 100 + FIXEDELEVATION * 10 + 0,MOOREBAY);// creates Antarctica ice model - IceModel *icemodel=new IceModel(settings1->ICE_MODEL + settings1->NOFZ*10,settings1->CONSTANTICETHICKNESS * 1000 + settings1->CONSTANTCRUST * 100 + settings1->FIXEDELEVATION * 10 + 0,settings1->MOOREBAY);// creates Antarctica ice model - // IceModel inherits from EarthModel + IceModel *icemodel=new IceModel(settings1->ICE_MODEL + settings1->NOFZ*10,settings1->CONSTANTICETHICKNESS * 1000 + settings1->CONSTANTCRUST * 100 + settings1->FIXEDELEVATION * 10 + 0,settings1->MOOREBAY, settings1->SYSTEMATICS_IceAtten);// creates Antarctica ice model + // IceModel inherits from EarthModel cout<Surface(0., 0.)<SurfaceAboveGeoid(0., 0.)<DETECTOR); // builds antenna array, 0 for testbed - Trigger *trigger=new Trigger(detector, settings1); // builds the trigger + Trigger *trigger=new Trigger(detector, settings1); // builds the trigger // Efficiencies *efficiencies=new Efficiencies(detector->getnRx(),outputdir); // keeps track of efficiencies at each stage of the simulation Efficiencies *efficiencies=new Efficiencies(100,outputdir); // keeps track of efficiencies at each stage of the simulation cout<<"called Efficiencies"<EXPONENT); // gets library (or whatever) of neutrino spectra cout<<"called Spectra"<TRIG_WINDOW = TRIG_WINDOW_Size; - + Total_Global_Pass = 0; cout<<"begin looping events!!"<CheckCompatibilitiesDetector(detector); @@ -356,7 +356,7 @@ int main(int argc, char **argv) { // read setup.txt file cerr<<"There are "<< settings_compatibility_error<<" errors from settings after Detector class instance is initialized. Check error messages."<DETECTOR == 3 && settings1->READGEOM == 1){ cerr << "ERROR::InstalledStation geometry not available without AraRoot installation!" << endl; @@ -368,7 +368,7 @@ int main(int argc, char **argv) { // read setup.txt file // test autoflush // AraTree2->SetAutoFlush(0); - // reset accumulative trig search bin info + // reset accumulative trig search bin info settings1->ACCUM_TRIG_SEARCH_BINS_STATION0 = 0.; int nuLimit =0; @@ -381,13 +381,13 @@ int main(int argc, char **argv) { // read setup.txt file else { nuLimit = settings1->NNU; } - // cout << "nuLimit: " << nuLimit << endl; + // cout << "nuLimit: " << nuLimit << endl; int inu = 0; int Events_Thrown = 0; int Events_Passed = 0; // for (int inu=0;inuNNU;inu++) { // loop over neutrinos while (inu < nuLimit){ - // cout << "inu: " << inu << endl; + // cout << "inu: " << inu << endl; check_station_DC = 0; check_station_DC = 0; if ( settings1->DEBUG_MODE_ON==0 ) { @@ -399,9 +399,9 @@ int main(int argc, char **argv) { // read setup.txt file // event = new Event ( settings1, spectra, primary1, icemodel, detector, signal, sec1 ); event = new Event ( settings1, spectra, primary1, icemodel, detector, signal, sec1, Events_Thrown ); event->inu_passed = -1; - + report = new Report(detector, settings1); - + #ifdef ARA_UTIL_EXISTS theIcrrEvent = new UsefulIcrrStationEvent(); theAtriEvent = new UsefulAtriStationEvent(); @@ -429,7 +429,7 @@ int main(int argc, char **argv) { // read setup.txt file // cout<<"nu_flavor : "<nuflavor<Nu_Interaction[0].vmmhz1m[0] : "<Nu_Interaction[0].vmmhz1m[0]<Nu_Interaction[0].pickposnu<Nu_Interaction[0].weight; } - // cout << "weight: " << weight <ClearUselessfromConnect(detector, settings1, trigger); for(int i=0;iNu_Interaction.size(); i++) event->Nu_Interaction[i].clear_useless(settings1); @@ -496,24 +496,24 @@ int main(int argc, char **argv) { // read setup.txt file { theIcrrEvent->numRFChans = 14; } else if (settings1->DETECTOR == 4 && settings1->DETECTOR_STATION == 0) { theIcrrEvent->numRFChans = 14; } - else { - theAtriEvent->fNumChannels = 20; - theIcrrEvent->numRFChans = 16; + else { + theAtriEvent->fNumChannels = 20; + theIcrrEvent->numRFChans = 16; } } #endif - + if (max_dt < report->stations[i].max_arrival_time - report->stations[i].min_arrival_time) max_dt = report->stations[i].max_arrival_time - report->stations[i].min_arrival_time; // check the total global trigger passed if (report->stations[i].Global_Pass) { cout<<"\nGlobal_Pass : "<stations[i].Global_Pass<<" evt : "<Nu_Interaction[0].weight<Nu_Interaction[0].weight; Total_Probability += event->Nu_Interaction[0].probability; - + // test increment weight if (settings1->INTERACTION_MODE==1) { count1->incrementEventsFound( event->Nu_Interaction[0].weight, event ); @@ -526,10 +526,10 @@ int main(int argc, char **argv) { // read setup.txt file } else if (settings1->INTERACTION_MODE==4) { count1->incrementEventsFound( event->Nu_Interaction[0].weight, event ); - } + } } check_station_DC++; - event->inu_passed = Events_Passed; + event->inu_passed = Events_Passed; } } @@ -563,7 +563,7 @@ int main(int argc, char **argv) { // read setup.txt file // test FILL_TREE_MODE - if (settings1->FILL_TREE_MODE==0) { // fill event event + if (settings1->FILL_TREE_MODE==0) { // fill event event AraTree2->Fill(); //fill interaction every events #ifdef ARA_UTIL_EXISTS // for 1, save all events whether passed trigger or not @@ -580,7 +580,7 @@ int main(int argc, char **argv) { // read setup.txt file } #endif } - else if (settings1->FILL_TREE_MODE==1) { // fill only usable posnu event + else if (settings1->FILL_TREE_MODE==1) { // fill only usable posnu event if (event->Nu_Interaction[0].pickposnu>0) { AraTree2->Fill(); //fill interaction every events #ifdef ARA_UTIL_EXISTS @@ -599,7 +599,7 @@ int main(int argc, char **argv) { // read setup.txt file #endif } } - else if (settings1->FILL_TREE_MODE==2) { // fill only triggered event + else if (settings1->FILL_TREE_MODE==2) { // fill only triggered event if (check_station_DC>0) { AraTree2->Fill(); //fill interaction every events #ifdef ARA_UTIL_EXISTS @@ -633,7 +633,7 @@ int main(int argc, char **argv) { // read setup.txt file Events_Passed++; } Events_Thrown++; - + //theEvent = NULL; @@ -666,10 +666,10 @@ int main(int argc, char **argv) { // read setup.txt file // }// end trigger window loop TrigWind.close(); - + //-------------------------------------------------- // cFull_window_V->Print("test_V_mimic.pdf"); - //-------------------------------------------------- + //-------------------------------------------------- ofstream weight_file; //weight_file.open(("./weight_output/weight_"+setupfile).c_str()); @@ -690,7 +690,7 @@ int main(int argc, char **argv) { // read setup.txt file cout<<"Total_Global_Pass : "<INTERACTION_MODE==1) { weight_file << "Total_Weight="<eventsfound_binned, error_plus, error_minus ); - /* + /* Veff_test = IceVolume * 4. * PI * signal->RHOICE / signal->RHOH20 * Total_Weight / (double)(settings1->NNU); // account all factors to error @@ -776,7 +776,7 @@ int main(int argc, char **argv) { // read setup.txt file //-------------------------------------------------- // cout<<"Total NNU : "<NNU<<", PickUnbiased passed NNU : "<Write(); // AraFile->Close(); - efficiencies->summarize(); // summarize the results in an output file + efficiencies->summarize(); // summarize the results in an output file double freq[detector->GetFreqBin()], Filter[detector->GetFreqBin()]; double Filter_E[detector->GetFreqBin()]; @@ -822,12 +822,12 @@ int main(int argc, char **argv) { // read setup.txt file cout<<"outputdir= "<> tempFilterFreq >> tempFilter; + filterValue[i] = tempFilter; + filterFreq[i] = tempFilterFreq; + } + } + in.close(); + ifstream NecOut( filename.c_str() ); const int N = freq_step; double Transm[N]; @@ -2309,7 +2326,11 @@ inline void Detector::ReadVgain(string filename, Settings *settings1) { for (int j=0; jUSE_SIGNAL_CHAIN_LOWER_BOUND == 0){ //default + Vgain[i][j] = Transm[i] * atof( line.substr( 20, 33 ).c_str() ); // read gain (not dB) + } else { //systematic error estimate: 600MHz low-pass filter + SC effi. lower bound + Vgain[i][j] = Transm[i] * atof( line.substr( 20, 33 ).c_str() ) * filterValue[i] * settings1->SC_EFFICIENCY_ERROR_V; // read gain (not dB) + } Vphase[i][j] = atof( line.substr( 34 ).c_str() ); // read gain (not dB) //cout<<"VGain : "<> tempFilterFreq >> tempFilter; + filterValue[i] = tempFilter; + filterFreq[i] = tempFilterFreq; + } + } + in.close(); + + ifstream NecOut( filename.c_str() ); const int N = freq_step; @@ -2364,13 +2403,18 @@ inline void Detector::ReadVgainTop(string filename, Settings *settings1) { // cout<<"freq["<USE_SIGNAL_CHAIN_LOWER_BOUND == 0){ VgainTop[i][j] = Transm[i]*atof( line.substr( 20, 33 ).c_str() ); + } else { //systematic error estimate: 600MHz low-pass filter + SC effi. lower bound + VgainTop[i][j] = Transm[i] * atof( line.substr( 20, 33 ).c_str() ) * filterValue[i] * settings1->SC_EFFICIENCY_ERROR_V; // read gain (not dB) + } + VphaseTop[i][j] = atof( line.substr( 34 ).c_str() ); // + 180.0/TMath::Pi()*TMath::ATan(-Freq[i]/500.0); // read gain (not dB) //cout<<"VGain : "<> tempFilterFreq >> tempFilter; + filterValue[i] = tempFilter; + //cout<<"filterValue: "<USE_SIGNAL_CHAIN_LOWER_BOUND == 0){ Hgain[i][j] = Transm[i]*atof( line.substr( 20, 33 ).c_str() ); // read gain (not dB) + } else { //systematic error estimate: 600MHz low-pass filter + SC effi. lower bound + Hgain[i][j] = Transm[i] * atof( line.substr( 20, 33 ).c_str() ) * filterValue[i] * settings1->SC_EFFICIENCY_ERROR_H; // read gain (not dB) + //cout<<"SC effi low H: "<SC_EFFICIENCY_ERROR_H<> sub; yNF_tmp.push_back( atof(sub.c_str()) ); } - cout << "freq: " << yNF_tmp[0]; + // cout << "freq: " << yNF_tmp[0]; all_chNF.push_back( yNF_tmp ); yNF_tmp.clear(); - cout << " ch1: " << all_chNF[N][1] << endl; + // cout << " ch1: " << all_chNF[N][1] << endl; N++; @@ -4422,17 +4491,17 @@ inline void Detector::ReadElectChain(string filename, Settings *settings1) { N++; xfreq_tmp.push_back( atof( line.substr(0, line.find_first_of(",")).c_str() ) ); - cout<<"freq : "<>d_sheetup[i]>>l_sheetup[i]) { i++; } sheetup.close(); - + ifstream shelfup("data/iceshelf_attenlength_up.txt"); if(shelfup.fail()) { cerr << "Failed to open iceshelf_attenlength_up.txt" << endl; exit(1); } - + i=0; while(shelfup>>d_shelfup[i]>>l_shelfup[i]) { @@ -129,7 +128,7 @@ void IceModel::setUpIceModel(int model) { i++; } westlandup.close(); - + //read in attenuation length for downgoing signals ifstream sheetdown("data/icesheet_attenlength_down.txt"); if(sheetdown.fail()) @@ -137,7 +136,7 @@ void IceModel::setUpIceModel(int model) { cerr << "Failed to open icesheet_attenlength_down.txt" << endl; exit(1); } - + i=0; while(sheetdown>>d_sheetdown[i]>>l_sheetdown[i]) { @@ -152,14 +151,14 @@ void IceModel::setUpIceModel(int model) { cerr << "Failed to open iceshelf_attenlength_down.txt" << endl; exit(1); } - + i=0; while(shelfdown>>d_shelfdown[i]>>l_shelfdown[i]) { i++; } shelfdown.close(); - + ifstream westlanddown("data/westland_attenlength_down.txt"); if(westlanddown.fail()) {cerr << "Failed to open westland_attenlength_down.txt"; @@ -189,14 +188,14 @@ void IceModel::setUpIceModel(int model) { if ( file.is_open() ) { while (file.good() ) { - + if ( first_time == 1 ) { for (int sl=0; slSYSTEMATICS_IceAtten; + // int SYSTEMAT_IceAtten = 0; + // NB: the difference in the three models are the *depths* not the *length*s + // NB: that's a somewhat non-traditional way of doing it, but should work + ARA_IceAtten_bin = 53; + if(SYSTEMATICS_IceAttenuation == 0){ + double ARA_IceAtten_Depth_central[53] = + { 72.7412, 76.5697, 80.3982, 91.8836, 95.7121, 107.198, + 118.683, 133.997, 153.139, 179.939, 206.738, 245.023, + 298.622, 356.049, 405.819, 470.904, 516.845, 566.616, + 616.386, 669.985, 727.412, 784.839, 838.438, 899.694, + 949.464, 1003.06, 1060.49, 1121.75, 1179.17, 1236.6, + 1297.86, 1347.63, 1405.05, 1466.31, 1516.08, 1565.85, + 1611.79, 1657.73, 1699.85, 1745.79, 1791.73, 1833.84, + 1883.61, 1929.56, 1990.81, 2052.07, 2109.49, 2170.75, + 2232.01, 2304.75, 2362.17, 2431.09, 2496.17 }; + double ARA_IceAtten_Length_central[53] = + { 1994.67, 1952, 1896, 1842.67, 1797.33, 1733.33, + 1680, 1632, 1586.67, 1552, 1522.67, 1501.33, + 1474.67, 1458.67, 1437.33, 1416, 1392, 1365.33, + 1344, 1312, 1274.67, 1242.67, 1205.33, 1168, + 1128, 1090.67, 1048, 1008, 965.333, 920, + 874.667, 834.667, 797.333, 752, 714.667, 677.333, + 648, 616, 589.333, 557.333, 530.667, 506.667, + 477.333, 453.333, 418.667, 389.333, 362.667, + 333.333, 309.333, 285.333, 264, 242.667, 221.333 }; + + std::copy(ARA_IceAtten_Depth_central,ARA_IceAtten_Depth_central+ARA_IceAtten_bin,ARA_IceAtten_Depth); + std::copy(ARA_IceAtten_Length_central,ARA_IceAtten_Length_central+ARA_IceAtten_bin,ARA_IceAtten_Length); - // - double ARA_IceAtten_Depth_tmp[53] = { 72.7412, 76.5697, 80.3982, 91.8836, 95.7121, 107.198, 118.683, 133.997, 153.139, 179.939, 206.738, 245.023, 298.622, 356.049, 405.819, 470.904, 516.845, 566.616, 616.386, 669.985, 727.412, 784.839, 838.438, 899.694, 949.464, 1003.06, 1060.49, 1121.75, 1179.17, 1236.6, 1297.86, 1347.63, 1405.05, 1466.31, 1516.08, 1565.85, 1611.79, 1657.73, 1699.85, 1745.79, 1791.73, 1833.84, 1883.61, 1929.56, 1990.81, 2052.07, 2109.49, 2170.75, 2232.01, 2304.75, 2362.17, 2431.09, 2496.17 }; - - double ARA_IceAtten_Length_tmp[53] = { 1994.67, 1952, 1896, 1842.67, 1797.33, 1733.33, 1680, 1632, 1586.67, 1552, 1522.67, 1501.33, 1474.67, 1458.67, 1437.33, 1416, 1392, 1365.33, 1344, 1312, 1274.67, 1242.67, 1205.33, 1168, 1128, 1090.67, 1048, 1008, 965.333, 920, 874.667, 834.667, 797.333, 752, 714.667, 677.333, 648, 616, 589.333, 557.333, 530.667, 506.667, 477.333, 453.333, 418.667, 389.333, 362.667, 333.333, 309.333, 285.333, 264, 242.667, 221.333 }; +} - ARA_IceAtten_bin = 53; - for (int bin=0; binPickAnyDirection(); // first pick the neutrino direction -// +// // double mincos=cos(COASTLINE*RADDEG); // double maxcos=cos(0.); // double minphi=0.; @@ -289,14 +367,14 @@ Position IceModel::PickBalloonPosition() const { // double thisphi,thiscos,thissin; // double theta=0.; // double phi=0.; -// -// int ilon,ilat; +// +// int ilon,ilat; // int e_coord,n_coord; // double vol_thisbin=0.; // double lon=0.; // double lat=0.; -// -// +// +// // thisphi=gRandom->Rndm()*(maxphi-minphi)+minphi; // thiscos=gRandom->Rndm()*(maxcos-mincos)+mincos; // thissin=sqrt(1.-thiscos*thiscos); @@ -312,7 +390,7 @@ Position IceModel::PickBalloonPosition() const { // interaction1->wheredoesitenterice_err=0; // interaction1->toohigh=0; // interaction1->toolow=0; -// +// // thisr_in.SetXYZ(R_EARTH*thissin*cos(thisphi),R_EARTH*thissin*sin(thisphi),R_EARTH*thiscos); // if (thisr_in.Dot(interaction1->nnu)>0) // interaction1->nnu=-1.*interaction1->nnu; @@ -320,123 +398,123 @@ Position IceModel::PickBalloonPosition() const { // //cout << "lat, coastline, cos are " << thisr_in.Lat() << " " << COASTLINE << " " << cos(interaction1->nnu.Theta()) << "\n"; // if (thisr_in.Lat()>COASTLINE && cos(interaction1->nnu.Theta())<0) { // interaction1->noway=1; -// +// // interaction1->pickunbiased=0; // return 0; // there is no way it's going through the ice // } -// +// // int count1=0; // int count2=0; -// -// +// +// // if (Ray::WhereDoesItLeave(0,thisr_in,interaction1->nnu,antarctica,thisnuexitearth)) { // where does it leave Earth // // really want to find where it leaves ice // int err; // // Does it leave in an ice bin // if (IceThickness(thisnuexitearth) && thisnuexitearth.Lat()Surface(thisnuexitice)) { // if the exit point is above the surface -// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>5.E3) { -// WhereDoesItExitIce(inu,thisnuexitearth,interaction1->nnu,5.E3, // then back up and find it more precisely -// thisr_exitice); -// thisnuexitice=(5000.)*interaction1->nnu; -// thisnuexitice+=thisr_exitice; -// count1++; -// } -// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>5.E2) { -// -// WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E2, // then back up and find it more precisely -// thisr_exitice); -// thisnuexitice=5.E2*interaction1->nnu; -// thisnuexitice+=thisr_exitice; -// count1++; -// } -// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>50.) { -// -// WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,50., // then back up and find it more precisely -// thisr_exitice); -// count1++; -// } // end third wheredoesitexit -// thisnuexitice=thisr_exitice; -// } // if the exit point overshoots -// else -// thisnuexitice=thisnuexitearth; -// -// // should also correct for undershooting +// //cout << "inu is " << inu << " it's in ice.\n"; +// //cout << "this is an ice bin.\n"; +// thisnuexitice=thisnuexitearth; +// thisr_exitice=thisnuexitearth; +// if (thisnuexitice.Mag()>Surface(thisnuexitice)) { // if the exit point is above the surface +// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>5.E3) { +// WhereDoesItExitIce(inu,thisnuexitearth,interaction1->nnu,5.E3, // then back up and find it more precisely +// thisr_exitice); +// thisnuexitice=(5000.)*interaction1->nnu; +// thisnuexitice+=thisr_exitice; +// count1++; +// } +// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>5.E2) { +// +// WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E2, // then back up and find it more precisely +// thisr_exitice); +// thisnuexitice=5.E2*interaction1->nnu; +// thisnuexitice+=thisr_exitice; +// count1++; +// } +// if ((thisnuexitice.Mag()-Surface(thisnuexitice))/cos(interaction1->nnu.Theta())>50.) { +// +// WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,50., // then back up and find it more precisely +// thisr_exitice); +// count1++; +// } // end third wheredoesitexit +// thisnuexitice=thisr_exitice; +// } // if the exit point overshoots +// else +// thisnuexitice=thisnuexitearth; +// +// // should also correct for undershooting // if (count1>10) -// cout << "count1 is " << count1 << "\n"; +// cout << "count1 is " << count1 << "\n"; // } // if it's an Antarctic ice bin // else { // it leaves a rock bin so back up and find where it leaves ice -// //cout << "inu is " << inu << " it's in rock.\n"; -// if (thisr_in.Distance(thisnuexitearth)>5.E4) { -// count2++; -// if (WhereDoesItExitIce(inu,thisnuexitearth,interaction1->nnu,5.E4, // then back up and find it more precisely -// thisr_exitice)) { -// -// thisnuexitice=(5.E4)*interaction1->nnu; -// thisnuexitice+=thisr_exitice; -// //cout << "inu is " << inu << " I'm here 1.\n"; -// -// } -// else { -// interaction1->neverseesice=1; +// //cout << "inu is " << inu << " it's in rock.\n"; +// if (thisr_in.Distance(thisnuexitearth)>5.E4) { +// count2++; +// if (WhereDoesItExitIce(inu,thisnuexitearth,interaction1->nnu,5.E4, // then back up and find it more precisely +// thisr_exitice)) { +// +// thisnuexitice=(5.E4)*interaction1->nnu; +// thisnuexitice+=thisr_exitice; +// //cout << "inu is " << inu << " I'm here 1.\n"; +// +// } +// else { +// interaction1->neverseesice=1; // interaction1->pickunbiased = 0; -// return 0; -// } -// } -// else -// thisnuexitice=thisnuexitearth; -// // WhereDoesItExitIce(inu,thisnuexit,interaction1->nnu,5.E4, // then back up and find it more precisely -// // thisr_exitice); -// // thisnuexit=5.E4*interaction1->nnu; -// // thisnuexit+=thisr_exitice; -// if (thisr_in.Distance(thisnuexitice)>5.E3) { -// -// -// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E3, // then back up and find it more precisely -// thisr_exitice)) { -// count2++; -// //interaction1->neverseesice=1; -// thisnuexitice=5.E3*interaction1->nnu; -// thisnuexitice+=thisr_exitice; -// //cout << "inu is " << inu << " I'm here 2\n"; -// //return 0; -// -// } -// } -// if (thisr_in.Distance(thisnuexitice)>5.E2) { -// -// -// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E2, // then back up and find it more precisely -// thisr_exitice)) { -// count2++; -// //interaction1->neverseesice=1; -// -// thisnuexitice=5.E2*interaction1->nnu; -// thisnuexitice+=thisr_exitice; -// //cout << "inu is " << inu << " I'm here 3\n"; -// //return 0; -// } -// -// } -// if (thisr_in.Distance(thisnuexitice)>50.) { -// -// -// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,50., // then back up and find it more precisely -// thisr_exitice)) { -// //interaction1->neverseesice=1; -// count2++; -// //cout << "inu is " << inu << " I'm here 4\n"; -// //return 0; -// } -// } -// thisnuexitice=thisr_exitice; -// if (count2>10) -// cout << "count1 is " << count2 << "\n"; -// // else return 0; // never reaches any ice or is it because our step is too big +// return 0; +// } +// } +// else +// thisnuexitice=thisnuexitearth; +// // WhereDoesItExitIce(inu,thisnuexit,interaction1->nnu,5.E4, // then back up and find it more precisely +// // thisr_exitice); +// // thisnuexit=5.E4*interaction1->nnu; +// // thisnuexit+=thisr_exitice; +// if (thisr_in.Distance(thisnuexitice)>5.E3) { +// +// +// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E3, // then back up and find it more precisely +// thisr_exitice)) { +// count2++; +// //interaction1->neverseesice=1; +// thisnuexitice=5.E3*interaction1->nnu; +// thisnuexitice+=thisr_exitice; +// //cout << "inu is " << inu << " I'm here 2\n"; +// //return 0; +// +// } +// } +// if (thisr_in.Distance(thisnuexitice)>5.E2) { +// +// +// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,5.E2, // then back up and find it more precisely +// thisr_exitice)) { +// count2++; +// //interaction1->neverseesice=1; +// +// thisnuexitice=5.E2*interaction1->nnu; +// thisnuexitice+=thisr_exitice; +// //cout << "inu is " << inu << " I'm here 3\n"; +// //return 0; +// } +// +// } +// if (thisr_in.Distance(thisnuexitice)>50.) { +// +// +// if (WhereDoesItExitIce(inu,thisnuexitice,interaction1->nnu,50., // then back up and find it more precisely +// thisr_exitice)) { +// //interaction1->neverseesice=1; +// count2++; +// //cout << "inu is " << inu << " I'm here 4\n"; +// //return 0; +// } +// } +// thisnuexitice=thisr_exitice; +// if (count2>10) +// cout << "count1 is " << count2 << "\n"; +// // else return 0; // never reaches any ice or is it because our step is too big // } // if the nu leaves a rock bin // } // end wheredoesitleave // else { @@ -445,30 +523,30 @@ Position IceModel::PickBalloonPosition() const { // return 0; // } // // end finding where it leaves ice -// -// // if (thisnuexit.Mag()nnu,20., // then find it more finely -// // thisr_exitice); -// // thisnuexit=thisr_enterice; -// // // then back up and find it more precisely -// // } -// +// +// // if (thisnuexit.Mag()nnu,20., // then find it more finely +// // thisr_exitice); +// // thisnuexit=thisr_enterice; +// // // then back up and find it more precisely +// // } +// // if (WhereDoesItEnterIce(thisnuexitearth,interaction1->nnu,5.E3, // first pass with sort of course binning -// thisr_enterice)) { +// thisr_enterice)) { // thisr_enterice_tmp=thisr_enterice+5.E3*interaction1->nnu; // //cout << "inu is " << inu << " thisr_enterice is ";thisr_enterice.Print(); // if (WhereDoesItEnterIce(thisr_enterice_tmp,interaction1->nnu,20., // second pass with finer binning -// thisr_enterice)) { -// //cout << "inu is " << inu << " thisr_enterice is ";thisr_enterice.Print(); -// //cout << "entersice is ";thisr_enterice.Print(); -// //cout << "thisnuexitice is ";thisnuexitice.Print(); -// interaction1->pathlength_inice=thisr_enterice.Distance(thisnuexitice); -// //cout << "distance is " << distance << "\n"; -// //cout << "inu " << inu << " thisr_enterice, thisnuexitice are ";thisr_enterice.Print();thisnuexitice.Print(); -// interaction1->posnu=interaction1->pathlength_inice*gRandom->Rndm()*interaction1->nnu; -// interaction1->posnu=interaction1->posnu+thisr_enterice; -// //cout << "inu" << inu << " thisr_enterice, thisnuexitice are ";thisr_enterice.Print();thisnuexitice.Print(); -// //cout << "inu " << inu << " distance is " << distance << "\n"; +// thisr_enterice)) { +// //cout << "inu is " << inu << " thisr_enterice is ";thisr_enterice.Print(); +// //cout << "entersice is ";thisr_enterice.Print(); +// //cout << "thisnuexitice is ";thisnuexitice.Print(); +// interaction1->pathlength_inice=thisr_enterice.Distance(thisnuexitice); +// //cout << "distance is " << distance << "\n"; +// //cout << "inu " << inu << " thisr_enterice, thisnuexitice are ";thisr_enterice.Print();thisnuexitice.Print(); +// interaction1->posnu=interaction1->pathlength_inice*gRandom->Rndm()*interaction1->nnu; +// interaction1->posnu=interaction1->posnu+thisr_enterice; +// //cout << "inu" << inu << " thisr_enterice, thisnuexitice are ";thisr_enterice.Print();thisnuexitice.Print(); +// //cout << "inu " << inu << " distance is " << distance << "\n"; // } // } // else { @@ -479,7 +557,7 @@ Position IceModel::PickBalloonPosition() const { // } // interaction1->nuexitice=thisnuexitice; // interaction1->r_enterice=thisr_enterice; -// +// // if (interaction1->posnu.Mag()-Surface(interaction1->posnu)>0) { // interaction1->toohigh=1; // //cout << "inu, toohigh is " << inu << " " << interaction1->toohigh << "\n"; @@ -491,25 +569,25 @@ Position IceModel::PickBalloonPosition() const { // //cout << "inu, toolow is " << inu << " " << interaction1->toolow << "\n"; // interaction1->pickunbiased = 0; // return 0; -// } +// } // interaction1->pickunbiased = 1; // return 1; -// +// // } -//-------------------------------------------------- +//-------------------------------------------------- //-------------------------------------------------- // int IceModel::PickNear() { // } -//-------------------------------------------------- +//-------------------------------------------------- Vector IceModel::GetSurfaceNormal(const Position &r_out) const { Vector n_surf = r_out.Unit(); - if (FLATSURFACE) + if (FLATSURFACE) return n_surf; if (ice_model==0) { @@ -517,29 +595,29 @@ Vector IceModel::GetSurfaceNormal(const Position &r_out) const { int ilon,ilat; GetILonILat(r_out,ilon,ilat); - + int ilon_previous=ilon-1; if (ilon_previous<0) ilon_previous=NLON-1; - + int ilon_next=ilon+1; if (ilon_next==NLON) ilon_next=0; - + double r=(geoid[ilat]+surfacer[ilon][ilat])*sin(theta); - + double slope_phi=(surfacer[ilon_next][ilat]-surfacer[ilon_previous][ilat])/(r*2*phistep); - + int ilat_previous=ilat-1; if (ilat_previous<0) ilat_previous=0; - + int ilat_next=ilat+1; if (ilat_next==NLAT) ilat_next=NLAT-1; - + double slope_costheta=(surfacer[ilon][ilat_next]-surfacer[ilon][ilat_previous])/((geoid[ilat]+surfacer[ilon][ilat])*2*thetastep); - + // first rotate n_surf according to tilt in costheta and position on continent - rotate around the y axis. double angle=atan(slope_costheta); @@ -547,7 +625,7 @@ Vector IceModel::GetSurfaceNormal(const Position &r_out) const { // now rotate n_surf according to tilt in phi - rotate around the z axis. angle=atan(slope_phi); - + n_surf = n_surf.RotateZ(angle); } //end if(Crust 2.0) else if (ice_model==1) { @@ -562,8 +640,8 @@ Vector IceModel::GetSurfaceNormal(const Position &r_out) const { lat_next = lat + dist_to_check * (180 / (local_surface_elevation * PI)); //the latitude 7.5 km south of the interaction lat_prev = lat - dist_to_check * (180 / (local_surface_elevation * PI)); //the latitude 7.5 km north of the interaction - lon_next = lon + dist_to_check * (180 / (sin(lat*RADDEG) * local_surface_elevation * PI)); - lon_prev = lon - dist_to_check * (180 / (sin(lat*RADDEG) * local_surface_elevation * PI)); + lon_next = lon + dist_to_check * (180 / (sin(lat*RADDEG) * local_surface_elevation * PI)); + lon_prev = lon - dist_to_check * (180 / (sin(lat*RADDEG) * local_surface_elevation * PI)); if (lat_next > 90) { //cout<<"lat_next is > 90"<COASTLINE) - left_edge=1; - + if (lat>COASTLINE) + left_edge=1; + rock2=pow((local_surface - IceThickness(lon,lat) - WaterDepth(lon,lat)),2); - surface2=pow(local_surface,2); + surface2=pow(local_surface,2); if (ice_model==0) { - if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) - left_edge=1; + if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) + left_edge=1; } //if (Crust 2.0) } //if (neutrino has stepped into new lon/lat bin) if ((x_previous2>rock_previous2 && x2surface2) - || left_edge) { - + || (x_previous2surface2) + || left_edge) { + r_enterice = x; // this gets you out of the loop. distance=3*Geoid(lat); @@ -699,30 +777,30 @@ Position IceModel::WhereDoesItEnter(const Position &posnu,const Vector &nnu) con double p = posnu.Mag(); // radius of interaction double costheta = (nnu*posnu) / p; // theta of neutrino at interaction position double sintheta = sqrt(1-costheta*costheta); - + double lon = posnu.Lon(); double lat = posnu.Lat(); - + double a=0; // length of chord - + double R = Surface(lon,lat); double delta = R - p; // depth of the interaction // if interaction occurs below surface, as it should - + if (delta>-0.001) { - a=p*costheta+sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta); // chord length - if (a<0) { - cout << "Negative chord length: " << a << "\n"; - } //end if - } //end if (interaction below surface) + a=p*costheta+sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta); // chord length + if (a<0) { + cout << "Negative chord length: " << a << "\n"; + } //end if + } //end if (interaction below surface) else if (delta<=-0.001) { - - //cout << "Error in interaction position. whichray is " << whichray << "\n"; - // cout << "lon, lat from WhereDoesItEnter is " << " " << lon << " " << lat << "\n"; - // cout << "geoid, surface, p, surface-p are " << Geoid(lat) << " " << Surface(lon,lat) << ", " << p << " , "<<(Surface(lon,lat)-p)<<"\n"; - + + //cout << "Error in interaction position. whichray is " << whichray << "\n"; + // cout << "lon, lat from WhereDoesItEnter is " << " " << lon << " " << lat << "\n"; + // cout << "geoid, surface, p, surface-p are " << Geoid(lat) << " " << Surface(lon,lat) << ", " << p << " , "<<(Surface(lon,lat)-p)<<"\n"; + } //else if: error: interaction takes place above the surface - + // first approx Position r_in = posnu - a*nnu; @@ -732,7 +810,7 @@ Position IceModel::WhereDoesItEnter(const Position &posnu,const Vector &nnu) con // delta = r_in.Mag() - Surface( r_in ); // r_in = r_in + (delta * nnu); //} - + delta = r_in.Mag() - Surface( r_in ); while ( fabs(delta) >= 0.1 ) { r_in = r_in + (delta * nnu); @@ -745,12 +823,12 @@ Position IceModel::WhereDoesItEnter(const Position &posnu,const Vector &nnu) con } } - + //lon = r_in.Lon(); //lat = r_in.Lat(); - + //r_in = Surface(lon,lat) * r_in.Unit(); - + return r_in; } //method WhereDoesItEnter @@ -764,40 +842,40 @@ int IceModel::WhereDoesItEnter_sphere(const Position &sphere_in, const Vector &n double p = sphere_in.Mag(); // radius of interaction double costheta = (nnu*sphere_in) / p; // theta of neutrino at interaction position double sintheta = sqrt(1-costheta*costheta); - + double lon = sphere_in.Lon(); double lat = sphere_in.Lat(); - + double a=0; // length of chord - + double R = Surface(lon,lat); double delta = R - p; // depth of the interaction // if interaction occurs below surface, as it should - + // if sphere_in is inside the earth if (delta>-0.001) { - //a=p*costheta+sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta); // chord length - a=p*costheta + sqrt(R*R-p*p*sintheta*sintheta); // chord length - if (a<0) { - cout << "Negative chord length: " << a << "\n"; - } //end if + //a=p*costheta+sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta); // chord length + a=p*costheta + sqrt(R*R-p*p*sintheta*sintheta); // chord length + if (a<0) { + cout << "Negative chord length: " << a << "\n"; + } //end if // first approx r_in = sphere_in - a*nnu; - } //end if (sphere_in below surface) + } //end if (sphere_in below surface) // if sphere_in is outside the earth else if (delta<=-0.001) { - + // D : shortest distance between earth center and neutrino trajectory Position D = sphere_in + (p*costheta)*nnu; // neutrino pass through the earth if ( D.Mag() < Surface(D) ) { - + // first approx r_in = sphere_in - (sqrt(R*R-D.Mag()*D.Mag())+costheta*p)*nnu; } @@ -805,9 +883,9 @@ int IceModel::WhereDoesItEnter_sphere(const Position &sphere_in, const Vector &n else { return 0; } - + } //else if (sphere_in above surface) - + int iter = 0; // now do correction 3 times @@ -815,7 +893,7 @@ int IceModel::WhereDoesItEnter_sphere(const Position &sphere_in, const Vector &n // delta = r_in.Mag() - Surface( r_in ); // r_in = r_in + (delta * nnu); //} - + delta = r_in.Mag() - Surface( r_in ); while ( fabs(delta) >= 0.1 ) { r_in = r_in + (delta * nnu); @@ -845,37 +923,37 @@ Position IceModel::WhereDoesItLeave(const Position &posnu,const Vector &nnu) con double p = posnu.Mag(); // radius of interaction double costheta = (nnu*posnu) / p; // theta of neutrino at interaction position double sintheta = sqrt(1-costheta*costheta); - + double lon = posnu.Lon(); double lat = posnu.Lat(); - + double a=0; // length of chord - + double R = Surface(lon,lat); double delta = R - p; // depth of the interaction // if interaction occurs below surface, as it should - + if (delta>-0.001) { - a=sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta) - p*costheta; // chord length - if (a<0) { - cout << "Negative chord length: " << a << "\n"; - } //end if - } //end if (interaction below surface) + a=sqrt(R*R*costheta*costheta+2*delta*R*sintheta*sintheta) - p*costheta; // chord length + if (a<0) { + cout << "Negative chord length: " << a << "\n"; + } //end if + } //end if (interaction below surface) else if (delta<=-0.001) { - - //cout << "Error in interaction position. whichray is " << whichray << "\n"; - // cout << "lon, lat from WhereDoesItLeave is " << " " << lon << " " << lat << "\n"; - // cout << "geoid, surface, p, surface-p are " << Geoid(lat) << " " << Surface(lon,lat) << " " << p << " , "<<(Surface(lon,lat)-p)<<"\n"; - + + //cout << "Error in interaction position. whichray is " << whichray << "\n"; + // cout << "lon, lat from WhereDoesItLeave is " << " " << lon << " " << lat << "\n"; + // cout << "geoid, surface, p, surface-p are " << Geoid(lat) << " " << Surface(lon,lat) << " " << p << " , "<<(Surface(lon,lat)-p)<<"\n"; + } //else if: error: interaction takes place above the surface - + Position r_in = posnu + a*nnu; - + lon = r_in.Lon(); lat = r_in.Lat(); - + r_in = Surface(lon,lat) * r_in.Unit(); - + return r_in; } //method WhereDoesItLeave @@ -886,66 +964,66 @@ Position IceModel::WhereDoesItLeave(const Position &posnu,const Vector &nnu) con // Below WhereDoesItEnterIce is from icemodel in icemc. //-------------------------------------------------- // int IceModel::WhereDoesItEnterIce(const Position &posnu, -// const Vector &nnu, -// double stepsize, -// Position &r_enterice) { +// const Vector &nnu, +// double stepsize, +// Position &r_enterice) { // // now get exit point... // // see my geometry notes. // // parameterize the neutrino trajectory and just see where it // // crosses the earth radius. -// +// // // Position r_enterice; // double distance=0; // int left_edge=0; // Position x = posnu; // double x2; -// +// // Position x_previous = posnu; -// +// // double x_previous2= x_previous * x_previous; // x2=x_previous2; -// +// // double lon = x.Lon(),lat = x.Lat(); // double lon_old = lon,lat_old = lat; // double local_surface = Surface(lon,lat); // double rock_previous2= pow((local_surface - IceThickness(lon,lat) - WaterDepth(lon,lat)),2); // double surface_previous2=pow(local_surface,2); -// +// // double rock2=rock_previous2; // double surface2=surface_previous2; // int foundit=0; // keeps track of whether you found an ice entrance point -// +// // // cout << "lon, lat are " << posnu.Lon() << " " << posnu.Lat() << "\n"; // //cout << "x2 at start is " << x2 << "\n"; // while (distance<2*local_surface+1000) { -// +// // distance+=stepsize; -// +// // x -= stepsize*nnu; // x2=x*x; // //cout << "x2 is " << x2 << "\n"; // lon = x.Lon(); // lat = x.Lat(); -// +// // double ice_thickness=IceThickness(lon,lat); // if (lon!=lon_old || lat!=lat_old) { // local_surface = Surface(lon,lat); -// -// //if (lat>COASTLINE) +// +// //if (lat>COASTLINE) // //left_edge=1; -// +// // rock2=pow((local_surface - IceThickness(lon,lat) - WaterDepth(lon,lat)),2); -// surface2=pow(local_surface,2); -// +// surface2=pow(local_surface,2); +// // if (ice_model==0) { -// if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) -// left_edge=1; +// if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) +// left_edge=1; // } //if (Crust 2.0) // } //if (neutrino has stepped into new lon/lat bin) -// +// // if ((((x_previous2>rock_previous2 && x2surface2)) && ice_thickness>0 && latsurface2)) && ice_thickness>0 && latCOASTLINE) +// +// //if (lat>COASTLINE) // //left_edge=1; -// +// // rock2=pow((local_surface - IceThickness(lon,lat) - WaterDepth(lon,lat)),2); -// surface2=pow(local_surface,2); -// +// surface2=pow(local_surface,2); +// // if (ice_model==0) { -// if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) -// left_edge=1; +// if ((int)(lat)==COASTLINE && rock_previous2 < x2 && surface2 > x2) +// left_edge=1; // } //if (Crust 2.0) // } //if (neutrino has stepped into new lon/lat bin) -// +// // if (inu==1491 && nsteps<10) // cout << "inu, x_previous2, rock_previous2, x2, rock2 are " << inu << " " << x_previous2 << " " << rock_previous2 << " " << x2 << " " << rock2 << "\n"; -// +// // if ((((x_previous2rock2) // crosses rock boundary from above -// || (x_previous2>surface_previous2 && x20 && latsurface_previous2 && x20 && lat=174&&ilat>=4&&ilat<=5) return 1; - else + else return 0; } @@ -1262,9 +1340,9 @@ double IceModel::GetN(double altitude) const { double b1=0.0140157; double n=0; - if (altitude < FIRNDEPTH) + if (altitude < FIRNDEPTH) n=NICE; - else if (altitude >= FIRNDEPTH && altitude <=0 && DEPTH_DEPENDENT_N) + else if (altitude >= FIRNDEPTH && altitude <=0 && DEPTH_DEPENDENT_N) // N_DEPTH=NFIRN-(4.6198+13.62*(altitude_int/1000.))* //(altitude_int/1000.); // Besson's equation for n(z) n=NFIRN+a1*(1.0-exp(b1*altitude)); // Peter's equation for n(z) @@ -1283,61 +1361,61 @@ double IceModel::GetN(const Position &pos) const{ double IceModel::EffectiveAttenuationLength(const Position &pos,const int &whichray) const { double localmaxdepth = IceThickness(pos); double depth = Surface(pos) - pos.Mag(); - + int depth_index=0; double attenuation_length=0.0; // if (inu<10) { // cout << "pos is ";pos.Print(); // cout << "surface is " << Surface(pos) << "\n"; // } - if(WestLand(pos) && !CONSTANTICETHICKNESS) + if(WestLand(pos) && !CONSTANTICETHICKNESS) { depth_index=int(depth*419.9/localmaxdepth);//use 420 m ice shelf attenuation length data as the standard, squeeze or stretch if localmaxdepth is longer or shorter than 420m. - if(RossIceShelf(pos) || RonneIceShelf(pos)) - { - if(whichray==0) - attenuation_length=l_shelfup[depth_index]; - else if(whichray==1) - attenuation_length=l_shelfdown[depth_index]; - else - cerr << " wrong attenuation length " <MOOREBAY)//if use Moore's Bay measured data for the west land - attenuation_length*=1.717557; //about 450 m (field attenuation length) for one whole way when assuming -3dB for the power loss at the bottom + attenuation_length*=1.717557; //about 450 m (field attenuation length) for one whole way when assuming -3dB for the power loss at the bottom } else //in east antarctica or constant ice thickness - { + { // if (inu<10) { // cout << "localmaxdepth is " << localmaxdepth << "\n"; // cout << "depth is " << depth << "\n"; // } depth_index =int(depth*(2809.9/localmaxdepth)); //if (inu<10) - // cout << "depth_index is " << depth_index << "\n"; + // cout << "depth_index is " << depth_index << "\n"; if(whichray==0) - attenuation_length =l_sheetup[depth_index]; + attenuation_length =l_sheetup[depth_index]; else if(whichray==1) - attenuation_length =l_sheetdown[depth_index]; + attenuation_length =l_sheetdown[depth_index]; else - cerr << " wrong attenuation length " <160 && lon<165) //cout << "e_coord, n_coord, easting, northing, lon are " << e_coord << " " << n_coord << " " << easting << " " << northing << " " << lon << "\n"; return; - + } //method ENtoLonLat void IceModel::IceENtoLonLat(int e, int n, double& lon, double& lat) const { @@ -1538,11 +1616,11 @@ void IceModel::ReadIceThickness() { string tempBuf5; string tempBuf6; int temp1,temp2,temp3,temp4,temp5,temp6; - - IceThicknessFile >> tempBuf1 >> temp1 >> tempBuf2 >> temp2 - >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 - >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; - + + IceThicknessFile >> tempBuf1 >> temp1 >> tempBuf2 >> temp2 + >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 + >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; + if(tempBuf1 == string("ncols")) { nCols_ice=temp1; } @@ -1563,17 +1641,17 @@ void IceModel::ReadIceThickness() { } //cout<<"nCols_ice, nRows_ice "<> theValue; if(theValue==NODATA) - theValue=0; //Set ice depth to 0 where we have no data. + theValue=0; //Set ice depth to 0 where we have no data. ice_thickness_array[colNum][rowNum] = double(theValue); //This stores data as ice_thickness_array[easting][northing] }//for }//for - + IceThicknessFile.close(); return; } //method ReadIceThickness @@ -1595,11 +1673,11 @@ void IceModel::ReadGroundBed() { string tempBuf5; string tempBuf6; int temp1,temp2,temp3,temp4,temp5,temp6; - - GroundBedFile >> tempBuf1 >> temp1 >> tempBuf2 >> temp2 - >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 - >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; - + + GroundBedFile >> tempBuf1 >> temp1 >> tempBuf2 >> temp2 + >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 + >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; + if(tempBuf1 == string("ncols")) { nCols_ground=temp1; } @@ -1621,20 +1699,20 @@ void IceModel::ReadGroundBed() { //cout<<"nCols_ground, nRows_ground "<> theValue; - + if(theValue==NODATA) - theValue=0; //Set elevation to 0 where we have no data. + theValue=0; //Set elevation to 0 where we have no data. ground_elevation[colNum][rowNum] = double(theValue); //if (theValue != -96 && theValue != 0) //cout<<"ground_elevation: "<> tempBuf1 >> temp1 >> tempBuf2 >> temp2 - >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 - >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; - + + WaterDepthFile >> tempBuf1 >> temp1 >> tempBuf2 >> temp2 + >> tempBuf3 >> temp3 >> tempBuf4 >> temp4 + >> tempBuf5 >> temp5 >> tempBuf6 >> temp6; + if(tempBuf1 == string("ncols")) { nCols_water=temp1; } @@ -1682,18 +1760,18 @@ void IceModel::ReadWaterDepth() { //cout<<"nCols_water, nRows_water "<> theValue; - + if(theValue==NODATA) - theValue=0; //Set depth to 0 where we have no data. + theValue=0; //Set depth to 0 where we have no data. water_depth[colNum][rowNum] = double(theValue); }//for }//for - + WaterDepthFile.close(); return; } //method ReadWaterDepth @@ -1809,7 +1887,7 @@ void IceModel::GetFresnel ( //void IceModel::FillArraysforTree(double icethck[1200][1000],double elev[1068][869],double lon_ground[1068][869],double lat_ground[1068][869],double lon_ice[1200][1000],double lat_ice[1200][1000],double h20_depth[1200][1000],double lon_water[1200][1000],double lat_water[1200][1000]) { // void IceModel::FillArraysforTree(double lon_ground[1068][869],double lat_ground[1068][869],double lon_ice[1200][1000],double lat_ice[1200][1000],double lon_water[1200][1000],double lat_water[1200][1000]) { - + // for (int rowNum=0;rowNumIceENtoLonLat(i,j,test1,test2); //Recall that the e / n coordinates in horizon were picked from the ground bed array. // //icethck[colNum][rowNum]=IceThickness(lon_ice[colNum][rowNum],lat_ice[colNum][rowNum]); - + // // WaterENtoLonLat(colNum,rowNum,lon_water[colNum][rowNum],lat_water[colNum][rowNum]); // //h20_depth[colNum][rowNum]=WaterDepth(lon_water[colNum][rowNum],lat_water[colNum][rowNum]); diff --git a/IceModel.h b/IceModel.h index 01e0da2e..e4adb14b 100644 --- a/IceModel.h +++ b/IceModel.h @@ -27,49 +27,49 @@ class IceModel : public EarthModel { int mooreBayFlag; //Information on horizons - what ice the balloon can see at each position along its path. - - + + // double volume_inhorizon_average; // average volume of ice seen by balloon // vector ilon_inhorizon[NBNPOSITIONS_MAX]; // indices in lon and lat for bins in horizon for NPHI balloon positions along 80 deg latitude line. // vector ilat_inhorizon[NBNPOSITIONS_MAX]; // vector easting_inhorizon[NBNPOSITIONS_MAX]; //indicies in easting and northing for bins in horizon for NPHI balloon positions along 80 deg latitude line. // vector northing_inhorizon[NBNPOSITIONS_MAX]; -// double maxvol_inhorizon[NBNPOSITIONS_MAX]; // maximum volume of ice for a bin +// double maxvol_inhorizon[NBNPOSITIONS_MAX]; // maximum volume of ice for a bin //BEDMAP utility methods double Area(double latitude) const; -void ENtoLonLat(int e_coord, +void ENtoLonLat(int e_coord, int n_coord, double xLowerLeft, double yLowerLeft, - - double& lon, + + double& lon, double& lat) const; void WaterENtoLonLat(int e, int n, - + double& lon, double& lat) const; - void LonLattoEN(double lon, + void LonLattoEN(double lon, double lat, double xLowerLeft, double yLowerLeft, - - int& e_coord, + + int& e_coord, int& n_coord) const; - - void GroundLonLattoEN(double lon, + + void GroundLonLattoEN(double lon, double lat, - - int& e_coord, + + int& e_coord, int& n_coord) const; void WaterLonLattoEN(double lon, double lat, - + int& e_coord, int& n_coord) const; @@ -107,22 +107,22 @@ void ENtoLonLat(int e_coord, void IceENtoLonLat(int e, int n, - + double& lon, - double& lat) const; + double& lat) const; void GroundENtoLonLat(int e, int n, - + double& lon, double& lat) const; // const static int NBNPOSITIONS_MAX=26000; - //double volume_inhorizon[NBNPOSITIONS_MAX]; // volume of ice within horizon for each balloon phi position + //double volume_inhorizon[NBNPOSITIONS_MAX]; // volume of ice within horizon for each balloon phi position // IceModel(); //default constructor - IceModel(int model=0,int earth_model=0,int mooreBay=0); + IceModel(int model=0,int earth_model=0,int mooreBay=0, int SYSTEMATICS_IceAtten = 0); ~IceModel(); - void setUpIceModel(int model=0); + void setUpIceModel(int model=0, int SYSTEMATICS_IceAtten=0); double IceThickness(double lon,double lat) const; double IceThickness(const Position& pos) const; double Surface(double lon,double lat) const; @@ -134,12 +134,12 @@ void ENtoLonLat(int e_coord, Position PickBalloonPosition() const; //void GetMAXHORIZON(double bn_altitude); // get upper limit on the horizon wrt the balloon. - int RossIceShelf(const Position &position) const; + int RossIceShelf(const Position &position) const; int IceOnWater(const Position &postition) const; int RossExcept(const Position &position) const; int RonneIceShelf(const Position &position) const; - int WestLand(const Position &pos) const; - int AcceptableRfexit(const Vector &nsurf_rfexit,const Position &rfexit,const Vector &n_exit2rx) const; + int WestLand(const Position &pos) const; + int AcceptableRfexit(const Vector &nsurf_rfexit,const Position &rfexit,const Vector &n_exit2rx) const; //double GetBalloonPositionWeight(int ibnpos) const; int OutsideAntarctica(const Position &pos) const; int OutsideAntarctica(double lat) const; @@ -160,11 +160,11 @@ void ENtoLonLat(int e_coord, double GetN(const Position &pos) const; double EffectiveAttenuationLength(const Position &pos, const int &whichray) const; double EffectiveAttenuationLength(Settings *settings1, const Position &pos, const int &whichray) const; - - void IceLonLattoEN(double lon, + + void IceLonLattoEN(double lon, double lat, - - int& e_coord, + + int& e_coord, int& n_coord) const; int Getice_model(); @@ -183,7 +183,6 @@ void GetFresnel ( int ARA_IceAtten_bin; double GetARAIceAttenuLength(double depth); - // void FillArraysforTree(double lon_ground[1068][869],double lat_ground[1068][869],double lon_ice[1200][1000],double lat_ice[1200][1000],double lon_water[1200][1000],double lat_water[1200][1000]); // below three members are copied from icemc icemodel. @@ -194,12 +193,12 @@ void GetFresnel ( // const Vector &nnu, // double stepsize, // Position &r_enterice); -// +// // int WhereDoesItExitIce(int inu,const Position &posnu, // const Vector &nnu, // double stepsize, // Position &r_enterice); -//-------------------------------------------------- +//-------------------------------------------------- // end three copied members from icemc icemodel. diff --git a/Primaries.cc b/Primaries.cc index 9220bb46..f95cb45c 100644 --- a/Primaries.cc +++ b/Primaries.cc @@ -258,16 +258,216 @@ Primaries::Primaries(){//constructor ymax_low=1.E-3; ymin_high=ymax_low; ymax_high=1.; + + // cooper-sarkar cross-section version + + vector energy; // energy [GeV] + vector nu_cc; // nu cc cross section [pb] + vector nu_cc_ul; // nu cc cross section upper limit [pb] + vector nu_cc_ll; // nu cc cross section lower limit [pb] + vector nu_cc_uu; // nu cc cross section upper uncertainties [%] + vector nu_cc_lu; // nu cc cross section lower uncertainties [%] + vector nu_nc; // nu nc cross section + vector nu_nc_ul; // nu nc cross section upper limit [pb] + vector nu_nc_ll; // nu nc cross section lower limit [pb] + vector nu_nc_uu; // nu cc cross section upper uncertainties [%] + vector nu_nc_lu; // nu cc cross section lower uncertainties [%] + + vector nubar_cc; // nubar cc cross section [pb] + vector nubar_cc_ul; // nubar cc cross section upper limit [pb] + vector nubar_cc_ll; // nubar cc cross section lower limit [pb] + vector nubar_cc_uu; // nu cc cross section upper uncertainties [%] + vector nubar_cc_lu; // nu cc cross section lower uncertainties [%] + vector nubar_nc; // nubar nc cross section [pb] + vector nubar_nc_ul; // nubar nc cross section upper limit [pb] + vector nubar_nc_ll; // nubar nc cross section lower limit [pb] + vector nubar_nc_uu; // nu cc cross section upper uncertainties [%] + vector nubar_nc_lu; // nu cc cross section lower uncertainties [%] + + // first, load the neutrino (nu) cross sections + ifstream fin_nu("./data/coopersarkar_sigma_nu.csv"); + string line; + if(fin_nu.is_open()){ + while(fin_nu.good()){ + getline(fin_nu, line); + stringstream s_stream(line); + vector result; + while(s_stream.good()){ + string substr; + getline(s_stream, substr, ','); + result.push_back(atof(substr.c_str())); + } + energy.push_back(result[0]); // energy + + nu_cc.push_back(result[1]); // charged current cross-section + double cc_ul = (result[2]); + double cc_ll = (result[4]); + nu_cc_uu.push_back(cc_ul); + nu_cc_lu.push_back(cc_ll); + cc_ul/=100.; // convert from % to fraction + cc_ll/=100.; // convert from % to fraction + cc_ul+=1.; // 1 + upper uncertainty on cc (result[2]>0) + cc_ll+=1.; // 1 + lower uncertainty on cc (result[4]<0) + nu_cc_ul.push_back(result[1]*cc_ul); + nu_cc_ll.push_back(result[1]*cc_ll); + + + nu_nc.push_back(result[5]); // neutral current cross-section + double nc_ul = (result[6]); + double nc_ll = (result[8]); + nu_nc_uu.push_back(nc_ul); + nu_nc_lu.push_back(nc_ll); + nc_ul/=100.; + nc_ll/=100.; + nc_ul+=1.; // 1 + upper uncertainty on nc (result[6]>0) + nc_ll+=1.; // 1 + lower uncertainty on nc (result[8]<0) + nu_nc_ul.push_back(result[5]*nc_ul); + nu_nc_ll.push_back(result[5]*nc_ll); + } + } + fin_nu.close(); + + // for(int i=0; i result; + while(s_stream.good()){ + string substr; + getline(s_stream, substr, ','); + result.push_back(atof(substr.c_str())); + } + nubar_cc.push_back(result[1]); // charged current cross-section + double cc_ul = (result[2]); + double cc_ll = (result[4]); + nubar_cc_uu.push_back(cc_ul); + nubar_cc_lu.push_back(cc_ll); + cc_ul/=100.; // convert from % to fraction + cc_ll/=100.; // convert from % to fraction + cc_ul+=1.; // 1 + upper uncertainty on cc (result[2]>0) + cc_ll+=1.; // 1 + lower uncertainty on cc (result[4]<0) + nubar_cc_ul.push_back(result[1]*cc_ul); + nubar_cc_ll.push_back(result[1]*cc_ll); + + nubar_nc.push_back(result[5]); // neutral current cross-section + double nc_ul = (result[6]); + double nc_ll = (result[8]); + nubar_nc_uu.push_back(nc_ul); + nubar_nc_lu.push_back(nc_ll); + nc_ul/=100.; + nc_ll/=100.; + nc_ul+=1.; // 1 + upper uncertainty on nc (result[6]>0) + nc_ll+=1.; // 1 + lower uncertainty on nc (result[8]<0) + nubar_nc_ul.push_back(result[5]*nc_ul); + nubar_nc_ll.push_back(result[5]*nc_ll); + } + } + fin_nubar.close(); + + // for(int i=0; i logenergy; + + vector nu_logcc; + vector nu_logcc_ul; + vector nu_logcc_ll; + vector nu_lognc; + vector nu_lognc_ul; + vector nu_lognc_ll; + + vector nubar_logcc; + vector nubar_logcc_ul; + vector nubar_logcc_ll; + vector nubar_lognc; + vector nubar_lognc_ul; + vector nubar_lognc_ll; + + for(int i=0; iSIGMA_FACTOR*(m_fsigma_lower[nu_nubar][currentint]->Eval(epsilon))/1.E4;//convert cm to meters. multiply by (1m^2/10^4 cm^2). sigma_total = (settings1->SIGMA_FACTOR*(m_fsigma_lower[nu_nubar][0]->Eval(epsilon))/1.E4) + (settings1->SIGMA_FACTOR*(m_fsigma_lower[nu_nubar][1]->Eval(epsilon))/1.E4); } + else if (settings1->SIGMA_SELECT==3){ // use Cooper-Sarkar upper uncertainties + double cs_uncertainty_this = cs_fsigma_uncertainty_upper[nu_nubar][currentint]->Eval(epsilon); + cs_uncertainty_this/=100.; // change from % to fraction + cs_uncertainty_this+=1.; // turn it into a multiplicative factor + double cs_uncertainty_nc = cs_fsigma_uncertainty_upper[nu_nubar][0]->Eval(epsilon); + cs_uncertainty_nc/=100.; + cs_uncertainty_nc+=1.; + double cs_uncertainty_cc = cs_fsigma_uncertainty_upper[nu_nubar][1]->Eval(epsilon); + cs_uncertainty_cc/=100.; + cs_uncertainty_cc+=1.; + sigma=settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][currentint]->Eval(epsilon))/1.E4*cs_uncertainty_this ;//convert cm to meters. multiply by (1m^2/10^4 cm^2). + sigma_total = (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][0]->Eval(epsilon))/1.E4*cs_uncertainty_nc) + (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][1]->Eval(epsilon))/1.E4*cs_uncertainty_cc); + } + else if(settings1->SIGMA_SELECT==4){ // use Cooper-Sarkar lower uncertainties + double cs_uncertainty_this = cs_fsigma_uncertainty_lower[nu_nubar][currentint]->Eval(epsilon); + cs_uncertainty_this/=100.; // change from % to fraction + cs_uncertainty_this+=1.; // turn it into a multiplicative factor + double cs_uncertainty_nc = cs_fsigma_uncertainty_lower[nu_nubar][0]->Eval(epsilon); + cs_uncertainty_nc/=100.; + cs_uncertainty_nc+=1.; + double cs_uncertainty_cc = cs_fsigma_uncertainty_lower[nu_nubar][1]->Eval(epsilon); + cs_uncertainty_cc/=100.; + cs_uncertainty_cc+=1.; + sigma=settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][currentint]->Eval(epsilon))/1.E4*cs_uncertainty_this ;//convert cm to meters. multiply by (1m^2/10^4 cm^2). + sigma_total = (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][0]->Eval(epsilon))/1.E4*cs_uncertainty_nc) + (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][1]->Eval(epsilon))/1.E4*cs_uncertainty_cc); + } else {// if other values are chosen, just use mean value sigma=settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][currentint]->Eval(epsilon))/1.E4;//convert cm to meters. multiply by (1m^2/10^4 cm^2). sigma_total = (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][0]->Eval(epsilon))/1.E4) + (settings1->SIGMA_FACTOR*(m_fsigma[nu_nubar][1]->Eval(epsilon))/1.E4); - } - - - + } if(m_hsigma->GetEntries()<2000){ - m_hsigma->Fill(epsilon, log10(sigma)); + m_hsigma->Fill(epsilon, log10(sigma)); } }//else current code + else if(settings1->SIGMAPARAM==2){//Cooper-Sarkar et al. + double pnuGeV=pnu/1.E9; + double epsilon=log10(pnuGeV); + if(settings1->SIGMA_SELECT==0){// use mean value + sigma=settings1->SIGMA_FACTOR*(pow(10.,cs_fsigma[nu_nubar][currentint]->Eval(epsilon)))/1.E40; //convert picobarns to m^2 + sigma_total = (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma[nu_nubar][0]->Eval(epsilon)))/1.E40) + (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma[nu_nubar][1]->Eval(epsilon)))/1.E40); + } + else if(settings1->SIGMA_SELECT==1){// use upper bound value + sigma=settings1->SIGMA_FACTOR*(pow(10.,cs_fsigma_upper[nu_nubar][currentint]->Eval(epsilon)))/1.E40; //convert picobarns to m^2 + sigma_total = (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma_upper[nu_nubar][0]->Eval(epsilon)))/1.E40) + (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma_upper[nu_nubar][1]->Eval(epsilon)))/1.E40); + } + else if(settings1->SIGMA_SELECT==1){// use lower bound value + sigma=settings1->SIGMA_FACTOR*(pow(10.,cs_fsigma_lower[nu_nubar][currentint]->Eval(epsilon)))/1.E40; //convert picobarns to m^2 + sigma_total = (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma_lower[nu_nubar][0]->Eval(epsilon)))/1.E40) + (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma_lower[nu_nubar][1]->Eval(epsilon)))/1.E40); + } + else{// if other values are chosen, just use mean value + sigma=settings1->SIGMA_FACTOR*(pow(10.,cs_fsigma[nu_nubar][currentint]->Eval(epsilon)))/1.0E40; //convert picobarns to m^2 + sigma_total = (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma[nu_nubar][0]->Eval(epsilon)))/1.E40) + (settings1->SIGMA_FACTOR*(pow(10.,m_fsigma[nu_nubar][1]->Eval(epsilon)))/1.E40); + } + } }//if + // interaction length in kg/m^2 len_int_kgm2=M_NUCL/sigma; // kg/m^2 diff --git a/Primaries.h b/Primaries.h index 8e9a371c..f952395c 100644 --- a/Primaries.h +++ b/Primaries.h @@ -19,6 +19,7 @@ #include "Vector.h" #include #include "Position.h" +#include "TSpline.h" //-------------------------------------------------- // class Interaction; @@ -125,10 +126,19 @@ class Primaries { double c3_lower[2][2]; double c4_lower[2][2]; + // cooper sarkar + // first index is nu/nu bar [0][x] = nu, [1][x] = nu-bar + // second index is nc/cc [x][0] = nc, [x][1] = cc + TSpline3* cs_fsigma[2][2]; // spline for cooper-sarkar central sigma values + TSpline3* cs_fsigma_upper[2][2]; // spline for cooper-sarkar upper limit sigma values + TSpline3* cs_fsigma_lower[2][2]; // spline for cooper-sarkar lower limit sigma values + TSpline3* cs_fsigma_uncertainty_upper[2][2]; // the *relative* [%] upper uncertainties + TSpline3* cs_fsigma_uncertainty_lower[2][2]; // the rrelative* [%] lower uncertainties - static const int NSIGMAS=2;// number of possible cross section models + static const int NSIGMAS=3;// number of possible cross section models // 0=Gandhi et al. // 1=Connolly et al. 2011 + // 2=Cooper-Sarkar et. al. 2011 (https://arxiv.org/abs/1106.3723) double mine[NSIGMAS];// minimum energy for cross section parametrizations, in eV double maxe[NSIGMAS]; //max diff --git a/RaySolver.cc b/RaySolver.cc index 0e5bb847..2e86a3d3 100644 --- a/RaySolver.cc +++ b/RaySolver.cc @@ -1076,12 +1076,38 @@ void RaySolver::Solve_Ray (Position &source, Position &target, IceModel *antarct // Defaults!!!! src = source_tmp; trg = target_tmp; - + if (settings1->RAY_TRACE_ICE_MODEL_PARAMS == 0){ // South Pole Values (AraSim original default, based on RICE) ns = 1.35; nd = 1.78; nc = 0.0132; + + // printf("Old ns, nd, nc: %.4f, %.4f, %.4f \n", ns, nd, nc); + + // if we wan to wiggle parameter uncertaintties + double adjust_ns=0.; + double adjust_nd=0.; + double adjust_nc=0.; + + if(settings1->SYSTEMATICS_nofz==1){ // upper bound + adjust_ns=0.022; + adjust_nd=0.016; + adjust_nc=0.0017; + } + if(settings1->SYSTEMATICS_nofz==2){ // lower bound + adjust_ns=-0.022; + adjust_nd=-0.016; + adjust_nc=-0.0017; + } + + ns+=adjust_ns; + nd+=adjust_nd; + nc+=adjust_nc; + + // printf("New ns, nd, nc: %.4f, %.4f, %.4f \n", ns, nd, nc); + + } else if (settings1->RAY_TRACE_ICE_MODEL_PARAMS == 1){ // South Pole Values (RICE (2004)) ns = 1.35; @@ -1123,10 +1149,7 @@ void RaySolver::Solve_Ray (Position &source, Position &target, IceModel *antarct ns = 1.35; nd = 1.78; nc = 0.0132; - } - - - + } // cout << "ns, nd, nc: " << ns << ", " << nd << ", " << nc << endl; diff --git a/Report.cc b/Report.cc index 02d03e30..6891d090 100644 --- a/Report.cc +++ b/Report.cc @@ -34,7 +34,7 @@ Report::Report(Detector *detector, Settings *settings1) { // Default constructor Initialize(detector, settings1); - + } @@ -71,7 +71,7 @@ void Report::delete_all() { } void Report::Initialize(Detector *detector, Settings *settings1) { - + // clear information stored in (but there shouldn't be. just to make sure) // //stations.clear(); @@ -102,23 +102,23 @@ void Report::Initialize(Detector *detector, Settings *settings1) { if(settings1->TRIG_SCAN_MODE>0){// scan Pthresh mode - int numChan=0; + int numChan=0; int numChanVpol=0; int numChanHpol=0; - + for(int j=0;jstations[i].strings.size(); j++){ - + for (int k=0;kstations[i].strings[j].antennas.size();k++) { - + int string_i = detector->getStringfromArbAntID( i, numChan); int antenna_i = detector->getAntennafromArbAntID( i, numChan); if (detector->stations[i].strings[string_i].antennas[antenna_i].type == 0) numChanVpol++; if (detector->stations[i].strings[string_i].antennas[antenna_i].type == 1) numChanHpol++; numChan++; }// for k - + }// for j - + stations[i].TDR_all.clear(); for(int ch=0;chTRIG_MODE==1) for(int ch=0;chDATA_SAVE_MODE == 1) { Heff.clear(); - + //VHz_antfactor.clear(); //VHz_filter.clear(); Vfft.clear(); @@ -237,8 +237,8 @@ void Antenna_r::clear_useless(Settings *settings1) { // to reduce the size of } else if (settings1->DATA_SAVE_MODE == 2) { - - + + Heff.clear(); //VHz_antfactor.clear(); //VHz_filter.clear(); @@ -264,7 +264,7 @@ void Antenna_r::clear_useless(Settings *settings1) { // to reduce the size of //Mag.clear(); //Fresnel.clear(); //Pol_factor.clear(); - + // clear global trigger waveform info also time.clear(); time_mimic.clear(); @@ -275,7 +275,7 @@ void Antenna_r::clear_useless(Settings *settings1) { // to reduce the size of //Vm_wo_antfactor.clear(); Vm_zoom.clear(); Vm_zoom_T.clear(); - + } @@ -300,7 +300,7 @@ void Report::clear_useless(Settings *settings1) { // to reduce the size of out //V_noise_timedomain.clear(); // done clear vector info in report head // - + V_total_forconvlv.clear(); RayStep.clear(); @@ -345,7 +345,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray int waveformLength = settings1->WAVEFORM_LENGTH; int waveformCenter = settings1->WAVEFORM_CENTER; - + //double dF_outbin; double dF_Nnew; @@ -378,63 +378,63 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //else if ( settings1->DEBUG_MODE_ON == 1 && evt >= settings1->DEBUG_SKIP_EVT ) cout<<"After DEBUG_SKIP_EVT"<DEBUG_MODE_ON == 1 && evt >= settings1->DEBUG_SKIP_EVT ) cout<params.number_of_stations; i++) { - + min_arrival_time_tmp = 10.; // first min_arrival_time is unreasonably big value max_arrival_time_tmp = 0.; // first max_arrival_time is unreasonably small value max_PeakV_tmp = 0.; // first max_PeakV_tmp is 0. - + stations[i].Total_ray_sol=0; // initial Total_ray_sol value - - - + + + for (int j=0; j< detector->stations[i].strings.size(); j++) { - + for (int k=0; k< detector->stations[i].strings[j].antennas.size(); k++) { // cout << i << " : " << j << " : " << k << endl; - + stations[i].strings[j].antennas[k].clear(); // clear data in antenna which stored in previous event - + // run ray solver, see if solution exist // if not, skip (set something like Sol_No = 0; // if solution exist, calculate view angle and calculate TaperVmMHz - + // added one more condition to run raysolver ( direct distance is less than 3km ) // // cout << event->Nu_Interaction[0].posnu.GetX() << " : " << event->Nu_Interaction[0].posnu.GetY() << " : " << event->Nu_Interaction[0].posnu.GetZ() << endl; - // cout << event->Nu_Interaction[0].pickposnu << " : " << event->Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[j].antennas[k] ) << " : " << settings1->RAYSOL_RANGE << endl; + // cout << event->Nu_Interaction[0].pickposnu << " : " << event->Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[j].antennas[k] ) << " : " << settings1->RAYSOL_RANGE << endl; if (event->Nu_Interaction[0].pickposnu && event->Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[j].antennas[k] ) <= settings1->RAYSOL_RANGE ) { // if posnu is selected inside the antarctic ic:"<Nu_Interaction[0].pickposnu && event->Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[j].antennas[k] ) <= settings1->RAYSOL_RANGE && debugmode == 0 ) { // if posnu is selected inside the antarctic ic:"<Solve_Ray(event->Nu_Interaction[0].posnu, detector->stations[i].strings[j].antennas[k], icemodel, ray_output, settings1); // solve ray between source and antenna RayStep.clear(); // remove previous values raysolver->Solve_Ray(event->Nu_Interaction[0].posnu, detector->stations[i].strings[j].antennas[k], icemodel, ray_output, settings1, RayStep); // solve ray between source and antenna - + ray_sol_cnt = 0; - + if (raysolver->solution_toggle) { // if there are solution from raysolver //if (raysolver->solution_toggle && debugmode==0 ) { // if there are solution from raysolver - - + + while ( ray_sol_cnt < ray_output[0].size() ) { // for number of soultions (could be 1 or 2) - - + + stations[i].strings[j].antennas[k].arrival_time.push_back(ray_output[4][ray_sol_cnt]); - - + + // get ice attenuation factor // - double IceAttenFactor = 1.; + double IceAttenFactor = 1.; if ( settings1->USE_ARA_ICEATTENU==1 ) {// use new ARA measured ice attenuation values - + double dx, dz, dl; for (int steps=1; steps<(int)RayStep[ray_sol_cnt][0].size(); steps++) { @@ -448,7 +448,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //cout<<"new iceattenfactor : "<EffectiveAttenuationLength(settings1, event->Nu_Interaction[0].posnu, 0))<USE_ARA_ICEATTENU==0 ) {// use old method - + IceAttenFactor = exp(-ray_output[0][ray_sol_cnt]/icemodel->EffectiveAttenuationLength(settings1, event->Nu_Interaction[0].posnu, 0)); } @@ -487,11 +487,11 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray stations[i].strings[j].antennas[k].L_att.push_back( icemodel->EffectiveAttenuationLength(settings1, event->Nu_Interaction[0].posnu, 0) ); //stations[i].strings[j].antennas[k].arrival_time.push_back(ray_output[4][ray_sol_cnt]); stations[i].strings[j].antennas[k].reflect_ang.push_back(ray_output[3][ray_sol_cnt]); - + stations[i].strings[j].antennas[k].vmmhz.resize(ray_sol_cnt+1); stations[i].strings[j].antennas[k].Heff.resize(ray_sol_cnt+1); - + stations[i].strings[j].antennas[k].Vm_zoom.resize(ray_sol_cnt+1); stations[i].strings[j].antennas[k].Vm_zoom_T.resize(ray_sol_cnt+1); @@ -547,7 +547,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray GetAngleAnt(receive_vector, detector->stations[i].strings[j].antennas[k], antenna_theta, antenna_phi); // get theta, phi for signal ray arrived at antenna - //cout<<"antenna theta : "<GetFreqBin(); l++) { // for detector freq bin numbers - + //cout<<"TaperVmMHz inputs VA:"<Nu_Interaction[0].d_theta_em[l]<<" th_had:"<Nu_Interaction[0].d_theta_had[l]<<" emfrac:"<Nu_Interaction[0].emfrac<<" hadfrac:"<Nu_Interaction[0].hadfrac<<" vmmhz1m:"<Nu_Interaction[0].vmmhz1m[l]<IsCalpulser){ // case 0: @@ -576,8 +576,8 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray vmmhz1m_tmp = event->Nu_Interaction[0].vmmhz1m[l]; signal->TaperVmMHz( viewangle, event->Nu_Interaction[0].d_theta_em[l], event->Nu_Interaction[0].d_theta_had[l], event->Nu_Interaction[0].emfrac, event->Nu_Interaction[0].hadfrac, vmmhz1m_tmp, vmmhz1m_em); } - - + + // break; // case 1: // vmmhz1m_tmp = 0; @@ -589,9 +589,9 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // vmmhz1m_tmp = event->Nu_Interaction[0].vmmhz1m[l]; // break; // } - - - + + + // signal->TaperVmMHz( viewangle, event->Nu_Interaction[0].d_theta_em[l], event->Nu_Interaction[0].d_theta_had[l], event->Nu_Interaction[0].emfrac, event->Nu_Interaction[0].hadfrac, vmmhz1m_tmp, vmmhz1m_em); //cout<<"TaperVmMHz (1m at view angle) at "<stations[i].strings[j].antennas[k].GetG(detector, freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi), + antenna_theta, antenna_phi), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0, k), + antenna_theta, antenna_phi, 0, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } @@ -665,7 +665,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //cout<<"set signal pol as Vpol + Hpol for Calpulser2 evts"<stations[i].strings[j].antennas[k].type, Pol_factor, vmmhz1m_tmp); cout << "Check 2" << endl; @@ -687,7 +687,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray }// end for freq bin - + stations[i].strings[j].antennas[k].Pol_factor.push_back( Pol_factor ); @@ -712,13 +712,13 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //cout<<"Finished getting V signal part!!"<NFOUR/2) ); // Vfft_noise_org is in fft freq bin!! // same unit with Vfft [V] but filter not applied - + Tools::NormalTimeOrdering(settings1->NFOUR/2, volts_forfft); //cout<<"finished NormalTimeOrdering!!"<IsCalpulser == 0){ @@ -758,7 +758,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // initially give raysol has actual signal stations[i].strings[j].antennas[k].SignalExt[ray_sol_cnt] = 1; - + // let's make NFOUR/2 bin of time domain pure signal part for now // later once we understand how to apply antenna phase, total electronics with phase, apply those @@ -769,10 +769,22 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // signal before the antenna (get signal at 1m and apply atten factor) signal->GetVm_FarField_Tarray( event, settings1, viewangle, atten_factor, outbin, Tarray, Earray, stations[i].strings[j].antennas[k].skip_bins[ray_sol_cnt] ); + // cout << "\033[1;31mAskaryan Signal accessed here\033[0m\n"; + if(settings1->SYSTEMATICS_Askaryan>0){ + if(settings1->SYSTEMATICS_Askaryan==1) for(int kk=0;kk<64;kk++){ + // printf("Before:%e \n",Earray[kk]); + Earray[kk]*=1.12; + // printf("After:%e \n",Earray[kk]); + } + if(settings1->SYSTEMATICS_Askaryan==2) for(int kk=0;kk<64;kk++){ + // printf("Before:%e \n",Earray[kk]); + Earray[kk]*=0.88; + // printf("After:%e \n",Earray[kk]); + } + } - dT_forfft = Tarray[1] - Tarray[0]; // step in ns int Ntmp = settings1->TIMESTEP*1.e9 / dT_forfft; @@ -814,7 +826,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else V_forfft[n] = 0.; - + //stations[i].strings[j].antennas[k].Vm_wo_antfactor[ray_sol_cnt].push_back( V_forfft[n] ); @@ -856,37 +868,37 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray /* - // Get ant gain with 2-D interpolation (may have bug?) + // Get ant gain with 2-D interpolation (may have bug?) // heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { - + if (settings1->ANTENNA_MODE == 0){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0, k), + antenna_theta, antenna_phi, 0, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } - + } @@ -903,31 +915,31 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray /* heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } - + if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0, k), + antenna_theta, antenna_phi, 0, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } @@ -945,7 +957,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if ( n > 0 ) { if ( settings1->ALL_ANT_V_ON==0 ) { - + ApplyAntFactors_Tdomain( detector->GetAntPhase_1D( freq_tmp*1.e-6, antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } @@ -1045,11 +1057,11 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // initially give raysol has actual signal stations[i].strings[j].antennas[k].SignalExt[ray_sol_cnt] = 1; - + int waveform_bin = (int)signal->ArbitraryWaveform_V.size(); // cout << waveform_bin << endl; - + //dT_forfft = Tarray[1] - Tarray[0]; // step in ns //dT_forfft = detector->CalPulserWF_ns[1] - detector->CalPulserWF_ns[0]; // step in ns dT_forfft = signal->ArbitraryWaveform_T[1]-signal->ArbitraryWaveform_T[0]; // step in ns @@ -1065,17 +1077,17 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] = stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] * settings1->NFOUR/2; // now new NFOUR for zero padding - - - + + + // now we have to make NFOUR/2 number of bins with random init time // // as a test, make first as it is and zero pad - - + + double V_forfft[ stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] ]; double T_forfft[ stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] ]; - + for (int n=0; nArbitraryWaveform_T[n] ); //cout << signal->ArbitraryWaveform_T[n] << " : " << signal->ArbitraryWaveform_V[n] << endl; } - + // make Tarray, Earray located at the center of Nnew array //T_forfft[n] = Tarray[outbin/2] - (dT_forfft*(double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2)) + (double)n*dT_forfft; - + T_forfft[n] = signal->ArbitraryWaveform_T[waveform_bin/2] - (dT_forfft*(double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - n)); - + if ( (n >= stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - waveform_bin/2) && (n < stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 + waveform_bin/2) ) { V_forfft[n] = signal->ArbitraryWaveform_V[ n - (stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - waveform_bin/2) ]; - + } else V_forfft[n] = 0.; - - - + + + //stations[i].strings[j].antennas[k].Vm_wo_antfactor[ray_sol_cnt].push_back( V_forfft[n] ); - + } - - + + // just get peak from the array //stations[i].strings[j].antennas[k].PeakV.push_back( FindPeak(detector->CalPulserWF_V, CP_bin) ); stations[i].strings[j].antennas[k].PeakV.push_back( -1. );// just let -1. - - + + // get spectrum with zero padded WF //Tools::realft(volts_forfft,1,settings1->NFOUR/2); Tools::realft(V_forfft,1,stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]); - + //dF_outbin = 1./( (double)(outbin) * (Tarray[1]-Tarray[0])*1.e-9 ); // in Hz dF_Nnew = 1./( (double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]) * (dT_forfft)*1.e-9 ); // in Hz - + //freq_tmp = dF_Nnew*((double)stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2.+1.+0.5);// in Hz 0.5 to place the middle of the bin and avoid zero freq freq_tmp = dF_Nnew*((double)stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2.+0.5);// in Hz 0.5 to place the middle of the bin and avoid zero freq - + freq_lastbin = freq_tmp; - - + + /* // heff last bin for transmitter ant double heff_lastbin_trans; @@ -1130,47 +1142,47 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //cout<<"ant theta trans : "<ALL_ANT_V_ON==0 ) { heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } else if ( settings1->ALL_ANT_V_ON==1 ) { heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0), + ant_theta_trans, antenna_phi, 0), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } - - - - + + + + // heff last bin for receiver ant /* - // Get ant gain with 2-D interpolation (may have bug?) + // Get ant gain with 2-D interpolation (may have bug?) // heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ - /* + /* if ( settings1->ALL_ANT_V_ON==0 ) { heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } else if ( settings1->ALL_ANT_V_ON==1 ) { heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } - */ + */ // Pol_vector = n_trg_slappy; - Pol_vector = n_trg_pokey; - - + Pol_vector = n_trg_pokey; + + // // for (int n=0; nALL_ANT_V_ON==0 ) { heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } else if ( settings1->ALL_ANT_V_ON==1 ) { heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0), + ant_theta_trans, antenna_phi, 0), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } // if ( n > 0 ) { - + if ( settings1->ALL_ANT_V_ON==0 ) { - + ApplyAntFactors_Tdomain_Transmitter( detector->GetAntPhase_1D( freq_tmp*1.e-6, ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } @@ -1198,32 +1210,32 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray ApplyAntFactors_Tdomain_Transmitter( detector->GetAntPhase_1D( freq_tmp*1.e-6, ant_theta_trans, antenna_phi, 0 ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } - - - + + + } else { ApplyAntFactors_Tdomain_FirstTwo( heff, heff_lastbin_trans, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1] ); } - + // // apply ant factors (receiver ant) // /* heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ - + if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type,k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type,k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } @@ -1231,25 +1243,25 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0,k), + antenna_theta, antenna_phi, 0,k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); - - } + + } } - + stations[i].strings[j].antennas[k].Heff[ray_sol_cnt].push_back( heff ); - - + + if ( n > 0 ) { - + if ( settings1->ALL_ANT_V_ON==0 ) { - + ApplyAntFactors_Tdomain( detector->GetAntPhase_1D( freq_tmp*1.e-6, antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } @@ -1257,14 +1269,14 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray ApplyAntFactors_Tdomain( detector->GetAntPhase_1D( freq_tmp*1.e-6, antenna_theta, antenna_phi, 0 ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } - - - + + + } else { ApplyAntFactors_Tdomain_FirstTwo( heff, heff_lastbin, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1] ); } - + // // apply entire elect chain gain, phase // @@ -1274,33 +1286,33 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else { ApplyElect_Tdomain_FirstTwo( freq_tmp*1.e-6, freq_lastbin*1.e-6, detector, V_forfft[2*n], V_forfft[2*n+1] ); } - - - + + + }// end for freq bin - + // now get time domain waveform back by inv fft Tools::realft(V_forfft,-1,stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]); - - + + // we need to do normal time ordering as we did zero padding(?) // If signal is located at the center, we don't need to do NormalTimeOrdering??? //Tools::NormalTimeOrdering(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt], V_forfft); - - + + // skip linear interpolation for now Tools::SimpleLinearInterpolation_OutZero( stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt], T_forfft, V_forfft, settings1->NFOUR/2, T_forint, volts_forint ); - + // check what we save as V[], volts_forint? or volts_forfft - - - - - + + + + + for (int n=0; nNFOUR/2; n++) { - + if (settings1->TRIG_ANALYSIS_MODE != 2) { // not pure noise mode (we need signal) //stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( volts_forfft[n] ); //stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( V_forfft[n] * 2./(double)(settings1->NFOUR/2) ); // 2/N for inverse FFT normalization factor @@ -1310,27 +1322,27 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else if (settings1->TRIG_ANALYSIS_MODE == 2) { // pure noise mode (set signal to 0) stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( 0. ); } - + } - + }// Arbitrary Events - + } // if not calpulser event - + // if calpulser event else if (event->IsCalpulser > 0){ // initially give raysol has actual signal stations[i].strings[j].antennas[k].SignalExt[ray_sol_cnt] = 1; - + int CP_bin = (int)detector->CalPulserWF_ns.size(); - - + + //dT_forfft = Tarray[1] - Tarray[0]; // step in ns dT_forfft = detector->CalPulserWF_ns[1] - detector->CalPulserWF_ns[0]; // step in ns - + int Ntmp = settings1->TIMESTEP*1.e9 / dT_forfft; stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] = 1; @@ -1340,65 +1352,65 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] = stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] * settings1->NFOUR/2; // now new NFOUR for zero padding - - - + + + // now we have to make NFOUR/2 number of bins with random init time // // as a test, make first as it is and zero pad - - + + double V_forfft[ stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] ]; double T_forfft[ stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt] ]; - + for (int n=0; nCalPulserWF_V[n] ); stations[i].strings[j].antennas[k].Vm_zoom_T[ray_sol_cnt].push_back( detector->CalPulserWF_ns[n] ); - + } - + // make Tarray, Earray located at the center of Nnew array //T_forfft[n] = Tarray[outbin/2] - (dT_forfft*(double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2)) + (double)n*dT_forfft; - + T_forfft[n] = detector->CalPulserWF_ns[CP_bin/2] - (dT_forfft*(double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - n)); - + if ( (n >= stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - CP_bin/2) && (n < stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 + CP_bin/2) ) { V_forfft[n] = detector->CalPulserWF_V[ n - (stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2 - CP_bin/2) ]; } else V_forfft[n] = 0.; - - - + + + //stations[i].strings[j].antennas[k].Vm_wo_antfactor[ray_sol_cnt].push_back( V_forfft[n] ); - + } - - - + + + // just get peak from the array //stations[i].strings[j].antennas[k].PeakV.push_back( FindPeak(detector->CalPulserWF_V, CP_bin) ); stations[i].strings[j].antennas[k].PeakV.push_back( -1. );// just let -1. - - + + // get spectrum with zero padded WF //Tools::realft(volts_forfft,1,settings1->NFOUR/2); Tools::realft(V_forfft,1,stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]); - + //dF_outbin = 1./( (double)(outbin) * (Tarray[1]-Tarray[0])*1.e-9 ); // in Hz dF_Nnew = 1./( (double)(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]) * (dT_forfft)*1.e-9 ); // in Hz - + //freq_tmp = dF_Nnew*((double)stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2.+1.+0.5);// in Hz 0.5 to place the middle of the bin and avoid zero freq freq_tmp = dF_Nnew*((double)stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]/2.+0.5);// in Hz 0.5 to place the middle of the bin and avoid zero freq - + freq_lastbin = freq_tmp; - - - + + + // heff last bin for transmitter ant double heff_lastbin_trans; double ant_theta_trans = ray_output[1][ray_sol_cnt] * DEGRAD; // from 0 to 180 @@ -1406,67 +1418,67 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0), + ant_theta_trans, antenna_phi, 0), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin_trans = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0,k), + ant_theta_trans, antenna_phi, 0,k), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } } - - - - + + + + // heff last bin for receiver ant /* - // Get ant gain with 2-D interpolation (may have bug?) + // Get ant gain with 2-D interpolation (may have bug?) // heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type,k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type,k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE == 1){ heff_lastbin = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0, k), + antenna_theta, antenna_phi, 0, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } - - - - + + + + // apply calpulser waveform // apply pol factor, heff if (event->IsCalpulser == 1){ @@ -1485,51 +1497,51 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray //cout<<"set signal pol as Vpol + Hpol for Calpulser2 evts"<ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE == 0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0), + ant_theta_trans, antenna_phi, 0), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } if (settings1->ANTENNA_MODE == 1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - ant_theta_trans, antenna_phi, 0, k), + ant_theta_trans, antenna_phi, 0, k), freq_tmp, icemodel->GetN(event->Nu_Interaction[0].posnu) ); } } // if ( n > 0 ) { - + if ( settings1->ALL_ANT_V_ON==0 ) { - + ApplyAntFactors_Tdomain_Transmitter( detector->GetAntPhase_1D( freq_tmp*1.e-6, ant_theta_trans, antenna_phi, detector->stations[i].strings[j].antennas[k].type ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } @@ -1537,56 +1549,56 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray ApplyAntFactors_Tdomain_Transmitter( detector->GetAntPhase_1D( freq_tmp*1.e-6, ant_theta_trans, antenna_phi, 0 ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } - - - + + + } else { ApplyAntFactors_Tdomain_FirstTwo( heff, heff_lastbin_trans, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1] ); } - + // // apply ant factors (receiver ant) // /* heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); */ if ( settings1->ALL_ANT_V_ON==0 ) { if (settings1->ANTENNA_MODE==0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE==1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), + antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type, k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } else if ( settings1->ALL_ANT_V_ON==1 ) { if (settings1->ANTENNA_MODE ==0){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0), + antenna_theta, antenna_phi, 0), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } if (settings1->ANTENNA_MODE ==1){ heff = GaintoHeight(detector->GetGain_1D_OutZero(freq_tmp*1.E-6, // to MHz - antenna_theta, antenna_phi, 0,k), + antenna_theta, antenna_phi, 0,k), freq_tmp, icemodel->GetN(detector->stations[i].strings[j].antennas[k]) ); } } - - + + stations[i].strings[j].antennas[k].Heff[ray_sol_cnt].push_back( heff ); - - + + if ( n > 0 ) { - + if ( settings1->ALL_ANT_V_ON==0 ) { - + ApplyAntFactors_Tdomain( detector->GetAntPhase_1D( freq_tmp*1.e-6, antenna_theta, antenna_phi, detector->stations[i].strings[j].antennas[k].type ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } @@ -1594,14 +1606,14 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray ApplyAntFactors_Tdomain( detector->GetAntPhase_1D( freq_tmp*1.e-6, antenna_theta, antenna_phi, 0 ), heff, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1], settings1 ); } - - - + + + } else { ApplyAntFactors_Tdomain_FirstTwo( heff, heff_lastbin, n_trg_pokey, n_trg_slappy, Pol_vector, detector->stations[i].strings[j].antennas[k].type, Pol_factor, V_forfft[2*n], V_forfft[2*n+1] ); } - + // // apply entire elect chain gain, phase // @@ -1611,33 +1623,33 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else { ApplyElect_Tdomain_FirstTwo( freq_tmp*1.e-6, freq_lastbin*1.e-6, detector, V_forfft[2*n], V_forfft[2*n+1] ); } - - - + + + }// end for freq bin - - + + // now get time domain waveform back by inv fft Tools::realft(V_forfft,-1,stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt]); - - + + // we need to do normal time ordering as we did zero padding(?) // If signal is located at the center, we don't need to do NormalTimeOrdering??? //Tools::NormalTimeOrdering(stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt], V_forfft); - - + + // skip linear interpolation for now Tools::SimpleLinearInterpolation_OutZero( stations[i].strings[j].antennas[k].Nnew[ray_sol_cnt], T_forfft, V_forfft, settings1->NFOUR/2, T_forint, volts_forint ); - + // check what we save as V[], volts_forint? or volts_forfft - - - - - - + + + + + + for (int n=0; nNFOUR/2; n++) { - + if (settings1->TRIG_ANALYSIS_MODE != 2) { // not pure noise mode (we need signal) //stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( volts_forfft[n] ); //stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( V_forfft[n] * 2./(double)(settings1->NFOUR/2) ); // 2/N for inverse FFT normalization factor @@ -1647,9 +1659,9 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray else if (settings1->TRIG_ANALYSIS_MODE == 2) { // pure noise mode (set signal to 0) stations[i].strings[j].antennas[k].V[ray_sol_cnt].push_back( 0. ); } - + } - + }// Calpulser events } // if SIMULATION_MODE = 1 @@ -1682,17 +1694,17 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray ray_sol_cnt++; - + }// end while number of solutions - + }// end if solution exist else { - + //cout<<"station["<TRIG_ANALYSIS_MODE != 2) { // if there is any ray_sol (don't check trigger if there is no ray_sol at all) and TRIG_ANALYSIS_MODE is 0 (signal + noise mode) - + //cout<<"3"<NOISE==1 && settings1->DETECTOR==4) { // detector->ReadRayleigh_Station(settings1); // } - - + + // reset Trigger class noise temp values trigger->Reset_V_noise_freqbin(settings1, detector); @@ -1834,7 +1846,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if ( debugmode == 1 ) N_noise = 1; // now, check if DATA_BIN_SIZE is enough for total time delay between antennas else { - + N_noise = (int)( max_total_bin / settings1->DATA_BIN_SIZE ) + 1; } //cout<<"N_noise : "< USE_MANUAL_GAINOFFSET == 1 ) Apply_Gain_Offset(settings1, trigger, detector, ch_ID, i ); // last i for stationID - - - + + + } // if it's not debugmode @@ -2175,7 +2187,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } // for strings - + // do only if it's not in debugmode if ( debugmode == 0 ) { @@ -2187,7 +2199,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // - + int trig_i, trig_j, trig_bin; int trig_search_init; @@ -2205,9 +2217,9 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray // global trigger mode // 0 for orginal N_TRIG out of 16 channels // 1 for new stations, N_TRIG_V out of Vpol channels or N_TRIG_H out of Hpol channels - + int check_ch; - + //trig_i = trigger->maxt_diode_bin; //trig_i = trigger->maxt_diode_bin + settings1->NFOUR; // give some time shift for mimicing force trig events trig_search_init = trigger->maxt_diode_bin + settings1->NFOUR; // give some time shift for mimicing force trig events @@ -2220,31 +2232,104 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if(settings1->TRIG_SCAN_MODE==0){// ******************** old mode left as-is ******************** - // avoid really long trig_window_bin case (change trig_window to check upto max_total_bin) - if (max_total_bin - trig_window_bin <= trig_i) trig_window_bin = max_total_bin - trig_i -1; - - - //while (trig_i < settings1->DATA_BIN_SIZE - trig_window_bin ) { - while (trig_i < max_total_bin - trig_window_bin ) { + /* + We need to add some logic to deal with what happens when we are running in A2 and A3 mode + with config specific trigger delay settings + */ - N_pass = 0; - N_pass_V = 0; - N_pass_H = 0; - last_trig_bin = 0; - Passed_chs.clear(); + // these must always be set + for(int localchan=0; localchan<16; localchan++){ + triggerDelay[localchan]=0; + mostDelay=0; + } + if(settings1->DETECTOR==4 && settings1->DETECTOR_STATION_LIVETIME_CONFIG>0){ // if emulating a real station, and we want config selection power - //for ( trig_j=0; trig_jDETECTOR_STATION==2){ // if station 2 - int string_i = detector->getStringfromArbAntID( i, trig_j); - int antenna_i = detector->getAntennafromArbAntID( i, trig_j); + if(settings1->DETECTOR_STATION_LIVETIME_CONFIG==2 || settings1->DETECTOR_STATION_LIVETIME_CONFIG==5){ // if config 5 or 5 in A2 + triggerDelay[4] = 81.4 + 100; + triggerDelay[5] = 73.2 + 100; + triggerDelay[6] = 15.4 + 100; + triggerDelay[7] = 7.2 + 100; - int channel_num = detector->GetChannelfromStringAntenna ( i, string_i, antenna_i, settings1 ); - // check if we want to use BH chs only for trigger analysis - //if (settings1->TRIG_ONLY_BH_ON == 1) { - if ( (settings1->TRIG_ONLY_BH_ON == 1)&&(settings1->DETECTOR==3) ) { // trig by BH is only for TestBed case + // string 0 = D2, string 2 = D4, string3 = D1 + triggerDelay[0] = triggerDelay[8] = triggerDelay[12] = 81.4; + triggerDelay[1] = triggerDelay[9] = triggerDelay[13] = 73.2; + triggerDelay[2] = triggerDelay[10] = triggerDelay[14] = 15.4; + triggerDelay[3] = triggerDelay[11] = triggerDelay[15] = 7.2; + + mostDelay = triggerDelay[4]; + + } + } + + if(settings1->DETECTOR_STATION==3){ + + if(settings1->DETECTOR_STATION_LIVETIME_CONFIG==2 || settings1->DETECTOR_STATION_LIVETIME_CONFIG==4){ // if config 2 or 4 in A3 + + // string 0 = D2, order 0-3 BV-BH-TV-TH + triggerDelay[0] = 81.4 + 100; + triggerDelay[1] = 73.2 + 100; + triggerDelay[2] = 15.4 + 100; + triggerDelay[3] = 7.2 + 100; + + // string 1 = D3, string 2 = D4, string3 = D1 + triggerDelay[4] = triggerDelay[8] = triggerDelay[12] = 81.4; + triggerDelay[5] = triggerDelay[9] = triggerDelay[13] = 73.2; + triggerDelay[6] = triggerDelay[10] = triggerDelay[14] = 15.4; + triggerDelay[7] = triggerDelay[11] = triggerDelay[15] = 7.2; + + mostDelay = triggerDelay[0]; + + } + } + } + + // avoid really long trig_window_bin case (change trig_window to check upto max_total_bin) + if (max_total_bin - trig_window_bin <= trig_i) trig_window_bin = max_total_bin - trig_i -1; + + + //while (trig_i < settings1->DATA_BIN_SIZE - trig_window_bin ) { + while (trig_i < max_total_bin - trig_window_bin ) { + + N_pass = 0; + N_pass_V = 0; + N_pass_H = 0; + last_trig_bin = 0; + Passed_chs.clear(); + + + //for ( trig_j=0; trig_jDETECTOR==4 && settings1->DETECTOR_STATION==2){ + if(settings1->DETECTOR_STATION_LIVETIME_CONFIG>2){ + if(trig_j==9){ + trig_j++; + continue; + } + } + } + + int offset=0; + if(settings1->DETECTOR==4){ + // only try to calculate the offset of DETECTOR=4, and we can guarantee that there will be an entry for triggerDelay[trig_j] + // otherwise, if someone simulates an ideal station and changes the number of channels, this will segfault in a very hard to debug way + offset = int((mostDelay - triggerDelay[trig_j]) / (settings1->TIMESTEP * 1e9)); + } + + int string_i = detector->getStringfromArbAntID( i, trig_j); + int antenna_i = detector->getAntennafromArbAntID( i, trig_j); + + int channel_num = detector->GetChannelfromStringAntenna ( i, string_i, antenna_i, settings1 ); + // check if we want to use BH chs only for trigger analysis + //if (settings1->TRIG_ONLY_BH_ON == 1) { + if ( (settings1->TRIG_ONLY_BH_ON == 1)&&(settings1->DETECTOR==3) ) { // trig by BH is only for TestBed case // check if this channel is BH ch (DAQchan) if ( detector->stations[i].strings[string_i].antennas[antenna_i].DAQchan == 0 ) { @@ -2256,7 +2341,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if ( settings1->NOISE_CHANNEL_MODE==0) { // with threshold offset by chs - if ( trigger->Full_window[trig_j][trig_i+trig_bin] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! + if ( trigger->Full_window[trig_j][trig_i+trig_bin] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! //cout<<"trigger passed at bin "<NOISE_CHANNEL_MODE==0) { // with threshold offset by chs - if ( trigger->Full_window[trig_j][trig_i+trig_bin] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! + if( trig_i+offset+trig_bin >= settings1->DATA_BIN_SIZE ) break; //if trigger window hits wf end, cannot scan this channel further with this trig_i + if ( trigger->Full_window[trig_j][trig_i+trig_bin+offset] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! //cout<<"trigger passed at bin "<stations[i].strings[string_i].antennas[antenna_i].type == 0) { // Vpol N_pass_V++; @@ -2445,8 +2531,9 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } else if ( settings1->NOISE_CHANNEL_MODE==1) { // with threshold offset by chs - if ( trigger->Full_window[trig_j][trig_i+trig_bin] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! - stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = trig_i+trig_bin; + if( trig_i+offset+trig_bin >= settings1->DATA_BIN_SIZE ) break; //if trigger window hits wf end, cannot scan this channel further with this trig_i + if ( trigger->Full_window[trig_j][trig_i+trig_bin+offset] < (detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1) ) ) { // if this channel passed the trigger! + stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = trig_i+trig_bin+offset; N_pass++; if (detector->stations[i].strings[string_i].antennas[antenna_i].type == 0) { // Vpol N_pass_V++; @@ -2545,7 +2632,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray if ( stations[i].strings[string_i].antennas[antenna_i].SignalExt[m] ) { dBin = abs( stations[i].strings[string_i].antennas[antenna_i].SignalBin[m] - stations[i].strings[string_i].antennas[antenna_i].Trig_Pass ); - + if ( dBin < mindBin ) { stations[i].strings[string_i].antennas[antenna_i].Likely_Sol = m; // store the ray sol number which is minimum difference between Trig_Pass bin mindBin = dBin; @@ -2556,7 +2643,7 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } - + //skip this passed ch as it already has bin info //cout<<"trigger passed at bin "<Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[(int)((ch_loop)/4)].antennas[(int)((ch_loop)%4)] )<stations[i].strings[string_i].antennas[antenna_i].type<<"type) Direct dist btw posnu : "<Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[string_i].antennas[antenna_i] )<<" noiseID : "<NFOUR/4; // so that global trig is + //stations[i].strings[(int)((ch_loop)/4)].antennas[(int)((ch_loop)%4)].Trig_Pass = stations[i].Global_Pass + settings1->NFOUR/4; // so that global trig is //stations[i].strings[(int)((ch_loop)/4)].antennas[(int)((ch_loop)%4)].Trig_Pass = 0.; stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = 0.; @@ -2731,18 +2818,18 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } // while trig_i }// if TRIG_SCAN_MODE==0 - + else if(settings1->TRIG_SCAN_MODE>0) triggerCheckLoop(settings1, detector, event, trigger, i, trig_search_init, max_total_bin, trig_window_bin, settings1->TRIG_SCAN_MODE); - + // else if(settings1->TRIG_SCAN_MODE==2) triggerCheckLoopScan(); - + // else if(settings1->TRIG_SCAN_MODE==3) triggerCheckLoopScanNumbers(); - + } // if it's not debugmode - // delete noise waveforms + // delete noise waveforms if (settings1->NOISE_WAVEFORM_GENERATE_MODE == 0) {// noise waveforms will be generated for each evts // remove noise waveforms for next evt trigger->ClearNoiseWaveforms(); @@ -2774,9 +2861,9 @@ void Report::Connect_Interaction_Detector (Event *event, Detector *detector, Ray } // end Connect_Interaction_Detector int Report::triggerCheckLoop(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int scan_mode ){ - + class CircularBuffer { - + public: int i; int mode; // in mode 1 only check number of values above threshold, in >1 check what the best value is too @@ -2789,59 +2876,59 @@ int Report::triggerCheckLoop(Settings *settings1, Detector *detector, Event *eve double epsilon; // best value needs to be this close to current last value double last_value; // value leaving buffer int addToNPass; // number of values above pthresh inside buffer - - - + + + CircularBuffer(int size, double threshold, int scan_mode) : N(size), pthresh(threshold), mode(scan_mode) {i=0; best_value=0; temp_value=0; last_value=0; addToNPass=0; epsilon=1e-6; buffer=new double[N]; for(int j=0;j1) last_value=buffer[i];// in mode 1 we don't care about the values, just about the addToNPass - + if(input_value1&&buffer[i]1&&std::fabs(last_value-best_value)1: return value is zero if no changes, and non-zero if there are changes to best_value (for mode==1 it's always zero); - - }// add + + }// add int fill(double input_value){// buffer is just filling, don't use last_value - + changelog=0; temp_value=best_value; - + if(input_value1&&buffer[i]POWERTHRESHOLD; - // this value is compared to POWERTHRESHOLD for local trigger. - + // this value is compared to POWERTHRESHOLD for local trigger. + int first_trigger=0; - + double Pthresh_value[numChan]; CircularBuffer **buffer=new CircularBuffer*[numChan]; for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - + stations[i].strings[string_i].antennas[antenna_i].SingleChannelTriggers=0; stations[i].strings[string_i].antennas[antenna_i].TotalBinsScannedPerChannel=0; - + // int string_i = detector->getStringfromArbAntID( i, trig_j); // int antenna_i = detector->getAntennafromArbAntID( i, trig_j); // stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = 0.; - + }// for trig_j - + double *TDR_all_sorted_temp; double *TDR_Vpol_sorted_temp; double *TDR_Hpol_sorted_temp; - + if(scan_mode>1){ - + TDR_all_sorted_temp=new double[numChan]; TDR_Vpol_sorted_temp=new double[numChanVpol]; TDR_Hpol_sorted_temp=new double[numChanHpol]; - + // only need to initialize for scan_mode>1 for(int trig_j=0;trig_j1 int global_pass_bit=0; int check_TDR_configuration=0; // check if we need to reorder our TDR arrays - int SCTR_cluster_bit[numChan]; - + int SCTR_cluster_bit[numChan]; + for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - + if (settings1->TRIG_ONLY_BH_ON==0 - || + || (settings1->TRIG_ONLY_BH_ON==1 && settings1->DETECTOR==3 && detector->stations[i].strings[string_i].antennas[antenna_i].DAQchan==0) || (settings1->TRIG_ONLY_LOW_CH_ON==1 && settings1->DETECTOR!=3 && antenna_i<2 ) ){ // channel filter: choose if to use lower/borehole channels or not - + int channel_num = detector->GetChannelfromStringAntenna ( i, string_i, antenna_i, settings1 ); - // assign Pthresh a value + // assign Pthresh a value if(settings1->NOISE_CHANNEL_MODE==0) Pthresh_value[trig_j]=trigger->Full_window[trig_j][trig_i]/(trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1) ); if(settings1->NOISE_CHANNEL_MODE==1) Pthresh_value[trig_j]=trigger->Full_window[trig_j][trig_i]/(trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1) ); if(settings1->NOISE_CHANNEL_MODE==2){ - + if(channel_num-1 < 8) Pthresh_value[trig_j]=trigger->Full_window[trig_j][trig_i]/(trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1) ); else Pthresh_value[trig_j]=trigger->Full_window[trig_j][trig_i]/(trigger->rmsdiode_ch[8] * detector->GetThresOffset( i, channel_num-1,settings1) ); - + } - // this is to count how many local trigger clusters there are + // this is to count how many local trigger clusters there are if(Pthresh_value[trig_j]TRIG_SCAN_MODE>2){ - + if(settings1->TRIG_SCAN_MODE>2){ + if(SCTR_cluster_bit[trig_j]==0){// if first trigger in cluster - + stations[i].strings[string_i].antennas[antenna_i].SCT_threshold_pass.push_back(Pthresh_value[trig_j]); - - + + } else{// choose the highest trigger value (most negative) in cluster - + if(Pthresh_value[trig_j] 2 - + SCTR_cluster_bit[trig_j]=1; - + }// if local trigger else SCTR_cluster_bit[trig_j]=0;// if no local trigger, set zero to start a new cluster at next local trigger - + // and how many bins scanned stations[i].strings[string_i].antennas[antenna_i].TotalBinsScannedPerChannel++; - - - + + + // fill the buffers (if any changes occur mark check_TDR_configuration as non-zero) if(trig_ifill(Pthresh_value[trig_j]); else check_TDR_configuration+=buffer[trig_j]->add(Pthresh_value[trig_j]); - + if(buffer[trig_j]->addToNPass>0){// if there is at least one value above threshold in the buffer, this is ++ - + N_pass++; if(detector->stations[i].strings[string_i].antennas[antenna_i].type == 0) N_pass_V++; if(detector->stations[i].strings[string_i].antennas[antenna_i].type == 1) N_pass_H++; - -// if(last_trig_bin0 - + }// non-testbed case (i.e. use all channels) - + }// for trig_j (channel scan) // check if global trigger... - - if( (settings1->TRIG_MODE==0&&( N_pass >= settings1->N_TRIG )) || - (settings1->TRIG_MODE==1&&( N_pass_V >= settings1->N_TRIG_V || + + if( (settings1->TRIG_MODE==0&&( N_pass >= settings1->N_TRIG )) || + (settings1->TRIG_MODE==1&&( N_pass_V >= settings1->N_TRIG_V || N_pass_H >= settings1->N_TRIG_H ) - ) + ) //|| (settings1->TRIG_MODE==2&&( N_pass_0 >= settings1->N_TRIG_0 || N_pass_1 >= settings1->N_TRIG_1 )) ){ // if there's a trigger ! - - global_pass_bit=1; + + global_pass_bit=1; if(first_trigger==0){ // if this is the first trigger, mark this position and save event first_trigger=1; for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); // if(buffer[trig_j]->addToNPass>0) stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = trig_i-buffer[trig_j]->numBinsToLatestTrigger(); // mark the bin on which we triggered... if(buffer[trig_j]->addToNPass>0) stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = trig_i-buffer[trig_j]->numBinsToOldestTrigger(); // mark the bin on which we triggered... else stations[i].strings[string_i].antennas[antenna_i].Trig_Pass = 0.; - + }// for trig_j - + saveTriggeredEvent(settings1, detector, event, trigger, stationID, trig_search_init, max_total_bin, trig_window_bin, trig_i); // cout<<"\nPthresh value="; // if(scan_mode==1) for(int trig_j=0;trig_j1) for(int trig_j=0;trig_jbest_value; // cout<<"\n"; - + }// first trigger - + // if(scan_mode==1) return last_trig_bin; // if we aren't going to scan all the Pthresh values, just return if(scan_mode==1) return trig_i; // if we aren't going to scan all the Pthresh values, just return } else global_pass_bit=0;// no trigger - + if(scan_mode>1&&check_TDR_configuration&&global_pass_bit){// if there's a trigger and anything changes in the buffers, restock the TDR arrays - + for(int trig_j=0;trig_jbest_valuebest_value; }// for trig_j if(settings1->TRIG_MODE==0){ // for N out of 16 mode - + if(N_pass>=settings1->N_TRIG) for(int ii=0;iitemp_valuetemp_value; best_chan=trig_j;} - + buffer[best_chan]->temp_value=0; - + TDR_all_sorted_temp[ii]=best_thresh; - + }// for ii - - + + // debug output: if(TDR_all_sorted_temp[0]>TDR_all_sorted_temp[1]||TDR_all_sorted_temp[1]>TDR_all_sorted_temp[2]){ - + cout<<"\n"; for(int p=0;p<80;p++) cout<<"*"; cout<<"\n ordering problem: "<TRIG_MODE==1){ // for N out of either polarization @@ -3130,75 +3217,75 @@ int Report::triggerCheckLoop(Settings *settings1, Detector *detector, Event *eve double best_thresh=0; int best_chan=0; - + for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); - int antenna_i = detector->getAntennafromArbAntID( i, trig_j); + int antenna_i = detector->getAntennafromArbAntID( i, trig_j); + + if(detector->stations[i].strings[string_i].antennas[antenna_i].type == 0&&buffer[trig_j]->temp_valuestations[i].strings[string_i].antennas[antenna_i].type == 0&&buffer[trig_j]->temp_valuetemp_value; + best_thresh=buffer[trig_j]->temp_value; best_chan=trig_j; - + }// if best }// for trig_j buffer[best_chan]->temp_value=0; - + TDR_Vpol_sorted_temp[ii]=best_thresh; - + }// for ii - + // debug output: // if(TDR_Vpol_sorted_temp[0]>TDR_Vpol_sorted_temp[1]||TDR_Vpol_sorted_temp[1]>TDR_Vpol_sorted_temp[2]){ -// +// // cout<<"\n"; // for(int p=0;p<80;p++) cout<<"*"; // cout<<"\n ordering problem, Vpol: "<=settings1->N_TRIG_H) for(int ii=0;iigetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - - if(detector->stations[i].strings[string_i].antennas[antenna_i].type==1&&buffer[trig_j]->temp_valuetemp_value; + + if(detector->stations[i].strings[string_i].antennas[antenna_i].type==1&&buffer[trig_j]->temp_valuetemp_value; best_chan=trig_j; - + }// if best }// for trig_j - + buffer[best_chan]->temp_value=0; - + TDR_Hpol_sorted_temp[ii]=best_thresh; - - + + }// for ii - + // // debug output: // if(TDR_Hpol_sorted_temp[0]>TDR_Hpol_sorted_temp[1]||TDR_Hpol_sorted_temp[1]>TDR_Hpol_sorted_temp[2]){ -// +// // cout<<"\n"; // for(int p=0;p<80;p++) cout<<"*"; // cout<<"\n ordering problem, Hpol: "<TRIG_MODE==2){ // for N out of arbitrary sets of antennas // for Set 0 only: @@ -3206,167 +3293,167 @@ int Report::triggerCheckLoop(Settings *settings1, Detector *detector, Event *eve double best_thresh=0; int best_chan=0; - + for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); - int antenna_i = detector->getAntennafromArbAntID( i, trig_j); + int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - if((antenna_i == 0 || antenna_i == 2 ) && buffer[trig_j]->temp_valuetemp_value; + if((antenna_i == 0 || antenna_i == 2 ) && buffer[trig_j]->temp_valuetemp_value; best_chan=trig_j; - + }// if best }// for trig_j buffer[best_chan]->temp_value=0; - + TDR_Vpol_sorted_temp[ii]=best_thresh; - + }// for ii - + // debug output: // if(TDR_Vpol_sorted_temp[0]>TDR_Vpol_sorted_temp[1]||TDR_Vpol_sorted_temp[1]>TDR_Vpol_sorted_temp[2]){ -// +// // cout<<"\n"; // for(int p=0;p<80;p++) cout<<"*"; // cout<<"\n ordering problem, Vpol: "<=settings1->N_TRIG_1) for(int ii=0;iigetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - - if((antenna_i==1 || antenna_i == 3) && buffer[trig_j]->temp_valuetemp_value; + + if((antenna_i==1 || antenna_i == 3) && buffer[trig_j]->temp_valuetemp_value; best_chan=trig_j; - + }// if best }// for trig_j - + buffer[best_chan]->temp_value=0; - + TDR_Hpol_sorted_temp[ii]=best_thresh; - - + + }// for ii */ - + // check if temp TDR arrays improved, if so update TDR arrays: if(settings1->TRIG_MODE==0){ - + if(N_pass>=settings1->N_TRIG) for(int ii=0;iiTRIG_MODE==1){ - + if(N_pass_V>=settings1->N_TRIG_V) for(int ii=0;ii=settings1->N_TRIG_H) for(int ii=0;iiTRIG_MODE==2){ - + if(N_pass_0>=settings1->N_TRIG_0) for(int ii=0;ii=settings1->N_TRIG_1) for(int ii=0;ii1&&stations[i].Global_Pass){ - + if(settings1->TRIG_MODE==0){ - + cout<<"\nPthresh best: "; for(int ii=0;ii<3;ii++) cout<<" "<stations[i].TDR_all_sorted[1]||stations[i].TDR_all_sorted[1]>stations[i].TDR_all_sorted[2]){ - + cout<<"\n"; for(int p=0;p<80;p++) cout<<"*"; cout<<"\n ordering problem: "<TRIG_MODE==1){ cout<<"\nPthresh best: "; cout<<" Vpol: "; for(int ii=0;iistations[i].TDR_Vpol_sorted[1]||stations[i].TDR_Vpol_sorted[1]>stations[i].TDR_Vpol_sorted[2]){ - + cout<<"\n"; for(int p=0;p<80;p++) cout<<"*"; cout<<"\n ordering problem (final) Vpol: "<stations[i].TDR_Hpol_sorted[1]||stations[i].TDR_Hpol_sorted[1]>stations[i].TDR_Hpol_sorted[2]){ - + cout<<"\n"; for(int p=0;p<80;p++) cout<<"*"; cout<<"\n ordering problem (final), Hpol: "<1 and global pass - + for(int trig_j=0;trig_j1){ - + delete [] TDR_all_sorted_temp; delete [] TDR_Vpol_sorted_temp; delete [] TDR_Hpol_sorted_temp; } - - + + return stations[i].Global_Pass; - + } int Report::saveTriggeredEvent(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int last_trig_bin){ - + int i=stationID; int numChan=stations[i].TDR_all.size(); cout<<"saving event"<getStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); - + if(stations[i].strings[string_i].antennas[antenna_i].Trig_Pass){// if this channel triggered - + stations[i].strings[string_i].antennas[antenna_i].Likely_Sol = -1; // no likely init - + int mindBin = 1.e9; // init big values int dBin = 0; - + for (int m=0; mTRIG_ONLY_LOW_CH_ON==0 ) { cout<stations[i].strings[string_i].antennas[antenna_i].type<<"type) Direct dist btw posnu : "<Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[string_i].antennas[antenna_i] )<<" noiseID : "<TRIG_ONLY_LOW_CH_ON==1 ) { - + cout<stations[i].strings[string_i].antennas[antenna_i].type<<"type) Direct dist btw posnu : "<Nu_Interaction[0].posnu.Distance( detector->stations[i].strings[string_i].antennas[antenna_i] )<<" noiseID : "<V_MIMIC_MODE == 0) { // Global passed bin is the center of the window - + stations[i].strings[string_i].antennas[antenna_i].V_mimic.push_back( ( trigger->Full_window_V[trig_j][ last_trig_bin - waveformLength/2 + waveformCenter + mimicbin ] )*1.e3 );// save in mV stations[i].strings[string_i].antennas[antenna_i].time.push_back( last_trig_bin - waveformLength/2 + waveformCenter + mimicbin ); stations[i].strings[string_i].antennas[antenna_i].time_mimic.push_back( ( waveformLength/2 + waveformCenter + mimicbin) * settings1->TIMESTEP*1.e9 );// save in ns @@ -3451,20 +3538,20 @@ int Report::saveTriggeredEvent(Settings *settings1, Detector *detector, Event *e stations[i].strings[string_i].antennas[antenna_i].V_mimic.push_back( ( trigger->Full_window_V[trig_j][ last_trig_bin - (detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin) - waveformLength/2 + waveformCenter + mimicbin ] )*1.e3 );// save in mV stations[i].strings[string_i].antennas[antenna_i].time.push_back( last_trig_bin - (detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin) - waveformLength/2 + waveformCenter + mimicbin ); stations[i].strings[string_i].antennas[antenna_i].time_mimic.push_back( ( -(detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin) - waveformLength/2 + waveformCenter + mimicbin) * settings1->TIMESTEP*1.e9 );// save in ns - + } - + else if (settings1->V_MIMIC_MODE == 2) { // Global passed bin is the center of the window + delay to each chs from araGeom + fitted by eye - + stations[i].strings[string_i].antennas[antenna_i].V_mimic.push_back( ( trigger->Full_window_V[trig_j][ last_trig_bin - (detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin + detector->stations[i].strings[string_i].antennas[antenna_i].manual_delay_bin) - waveformLength/2 + waveformCenter + mimicbin ] )*1.e3 );// save in mV stations[i].strings[string_i].antennas[antenna_i].time.push_back( last_trig_bin - (detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin + detector->stations[i].strings[string_i].antennas[antenna_i].manual_delay_bin) - waveformLength/2 + waveformCenter + mimicbin ); stations[i].strings[string_i].antennas[antenna_i].time_mimic.push_back( ( -(detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin + detector->stations[i].strings[string_i].antennas[antenna_i].manual_delay_bin) - waveformLength/2 + waveformCenter + mimicbin) * settings1->TIMESTEP*1.e9 + detector->params.TestBed_WFtime_offset_ns );// save in ns - + } - + } - - + + // set global_trig_bin values if (settings1->V_MIMIC_MODE == 0) { // Global passed bin is the center of the window stations[i].strings[string_i].antennas[antenna_i].global_trig_bin = waveformLength/2 + waveformCenter ; @@ -3475,65 +3562,65 @@ int Report::saveTriggeredEvent(Settings *settings1, Detector *detector, Event *e else if (settings1->V_MIMIC_MODE == 2) { // Global passed bin is the center of the window + delay to each chs from araGeom + fitted by eye stations[i].strings[string_i].antennas[antenna_i].global_trig_bin = (detector->params.TestBed_Ch_delay_bin[trig_j] - detector->params.TestBed_BH_Mean_delay_bin + detector->stations[i].strings[string_i].antennas[antenna_i].manual_delay_bin) + waveformLength/2 + waveformCenter ; } - - + + double arrivtime = stations[i].strings[string_i].antennas[antenna_i].arrival_time[0]; double X = detector->stations[i].strings[string_i].antennas[antenna_i].GetX(); double Y = detector->stations[i].strings[string_i].antennas[antenna_i].GetY(); double Z = detector->stations[i].strings[string_i].antennas[antenna_i].GetZ(); - - + + stations[i].total_trig_search_bin = stations[i].Global_Pass + trig_window_bin - trig_search_init; - - - - - - - - + + + + + + + + }// for trig_j - - + + if(settings1->OUTPUT_TDR_GRAPH>0){ - + settings1->OUTPUT_TDR_GRAPH--; - + TGraph **gr=new TGraph*[numChan]; - + for(int trig_j=0;trig_jgetStringfromArbAntID( i, trig_j); int antenna_i = detector->getAntennafromArbAntID( i, trig_j); int channel_num = detector->GetChannelfromStringAntenna ( i, string_i, antenna_i, settings1 ); double thresh_value=0; - - // assign Pthresh a value + + // assign Pthresh a value if(settings1->NOISE_CHANNEL_MODE==0) thresh_value=detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode * detector->GetThresOffset( i, channel_num-1,settings1); if(settings1->NOISE_CHANNEL_MODE==1) thresh_value=detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1); if(settings1->NOISE_CHANNEL_MODE==2){ - + if(channel_num-1 < 8) thresh_value=detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode_ch[channel_num-1] * detector->GetThresOffset( i, channel_num-1,settings1); else thresh_value=detector->GetThres(i, channel_num-1, settings1) * trigger->rmsdiode_ch[8] * detector->GetThresOffset( i, channel_num-1,settings1); - + } - + gr[trig_j]=new TGraph(); for(int trig_i=0;trig_iDATA_BIN_SIZE/2;trig_i++) gr[trig_j]->SetPoint(trig_i, (trig_search_init+trig_i), trigger->Full_window[trig_j][trig_i]); gr[trig_j]->SetNameTitle(Form("TDR_waveform%dC%02d", settings1->OUTPUT_TDR_GRAPH, trig_j), Form("Tunnel diode response waveform %d, channel %02d, trig_pass= %d, P_{th}= %le; time bins; power after convolution with tunnel diode", settings1->OUTPUT_TDR_GRAPH, trig_j, stations[i].strings[string_i].antennas[antenna_i].Trig_Pass, thresh_value)); gr[trig_j]->Write(); delete gr[trig_j]; } - + delete [] gr; - - + + } - + return 1; - - - + + + }// saveTriggeredEvent #ifdef ARA_UTIL_EXISTS @@ -3553,11 +3640,11 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t int antenna_i = detector->getAntennafromArbAntID( stationIndex, ch_loop); int AraRootChannel = 0; AraRootChannel = detector->GetChannelfromStringAntenna (i, string_i, antenna_i, settings1); - + int UsefulEventBin; if ( settings1->NFOUR/2 < EFFECTIVE_LAB3_SAMPLES*2) UsefulEventBin = settings1->NFOUR/2; else UsefulEventBin = EFFECTIVE_LAB3_SAMPLES*2; - + //for (int mimicbin=0; mimicbinNFOUR/2; mimicbin++) { for (int mimicbin=0; mimicbin 0){ @@ -3584,9 +3671,9 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t cout << "StationID: " << stationID << endl; theUsefulEvent->fNumChannels = 32; theUsefulEvent->stationId = stationID; - + // cout << endl << stationID << endl; - + int ch_limit; if (stationID == 0){ ch_limit = 14; @@ -3595,7 +3682,7 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t } int maxElecChans = 32; - + for (int ch_loop=0; ch_loop < ch_limit; ch_loop++) { // int elecChan = AraGeom->getElecChanFromRFChan(ch_loop, stationID); int elecChan = AraGeomTool::Instance()->getElecChanFromRFChan(ch_loop, stationID); @@ -3609,7 +3696,7 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t // int antenna_i = detector->getAntennafromArbAntID( stationIndex, ch_loop); int AraRootChannel = 0; AraRootChannel = detector->GetChannelfromStringAntenna (stationID, string_i, antenna_i, settings1); - + int UsefulEventBin; // if ( settings1->NFOUR/2 < EFFECTIVE_LAB3_SAMPLES*2) UsefulEventBin = settings1->NFOUR/2; // else UsefulEventBin = EFFECTIVE_LAB3_SAMPLES*2; @@ -3624,15 +3711,15 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t // theUsefulEvent->fVolts[AraRootChannel-1].resize(UsefulEventBin); // theUsefulEvent->fTimes[AraRootChannel-1].resize(UsefulEventBin); // cout << string_i << " : " << antenna_i << endl; - + //for (int mimicbin=0; mimicbinNFOUR/2; mimicbin++) { for (int mimicbin=0; mimicbin 0){ // cout << "Test 1" << endl; volts[mimicbin] = stations[stationIndex].strings[string_i].antennas[antenna_i].V_mimic[mimicbin]; times[mimicbin] = stations[stationIndex].strings[string_i].antennas[antenna_i].time_mimic[mimicbin]; - - + + } else { volts[mimicbin] = 0.; @@ -3656,7 +3743,7 @@ void Report::MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *t void Report::ClearUselessfromConnect(Detector *detector, Settings *settings1, Trigger *trigger){ - + for (int i = 0; i< detector->params.number_of_stations; i++) { // now remove all information which are useless for (int c_j=0; c_j< detector->stations[i].strings.size(); c_j++) { @@ -3680,15 +3767,15 @@ void Report::Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, // int BINSIZE = detector->stations[StationIndex].NFOUR/2; int bin_value; //vector V_total_forconvlv; // total time domain waveform (noise + signal) - + V_total_forconvlv.clear(); - + // first, fill the noise values for (int bin=0; binNOISE_CHANNEL_MODE==0) { V_total_forconvlv.push_back( trigger->v_noise_timedomain[ noise_ID[ (int)( bin_value / settings1->DATA_BIN_SIZE) ] ][ (int)( bin_value % settings1->DATA_BIN_SIZE ) ] + V[bin] ); } @@ -3734,7 +3821,7 @@ void Report::Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, -// this one is for two connected signals +// this one is for two connected signals void Report::Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin1, int signalbin2, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex) { int BINSIZE = settings1->NFOUR/2; @@ -3747,9 +3834,9 @@ void Report::Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, for(int bin_tmp=0; bin_tmp &V0, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex) { int BINSIZE = settings1->NFOUR/2; @@ -3826,9 +3913,9 @@ void Report::Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, for(int bin_tmp=0; bin_tmpGetGainOffset( StationIndex, channel_num, settings1 )<<" applying"<DATA_BIN_SIZE; bin++) { // test for full window - + trigger->Full_window[ID][bin] = ( trigger->Full_window[ID][bin] * detector->GetGainOffset( StationIndex, channel_num-1, settings1 ) * detector->GetGainOffset( StationIndex, channel_num-1, settings1 ) ); // offset in voltage factor so we need power (V^2 factor to diode response) trigger->Full_window_V[ID][bin] = ( trigger->Full_window_V[ID][bin] * detector->GetGainOffset( StationIndex, channel_num-1, settings1 ) ); // gain in voltage factor } @@ -3927,13 +4014,13 @@ int Report::GetChNumFromArbChID( Detector *detector, int ID, int StationIndex, S int string_num = detector->getStringfromArbAntID( StationIndex, ID ); int ant_num = detector->getAntennafromArbAntID( StationIndex, ID ); - + int StationID = detector->stations[StationIndex].StationID; // cout << "Station ID: " << StationID << endl; // cout << "string_num: " << string_num << endl; // cout << "ant_num: " << ant_num << endl; // cout << StationID << " : " << string_num << " : " << ant_num << endl; - + //int channel_num = detector->GetChannelfromStringAntenna ( StationIndex, string_num, ant_num ); int channel_num = detector->GetChannelfromStringAntenna ( StationID, string_num, ant_num, settings1 ); @@ -3948,21 +4035,21 @@ Vector Report::GetPolarization (Vector &nnu, Vector &launch_vector) { // Want to find a unit vector in the same plane as // nnu and launch_vector, but perpendicular to launch_vector, pointing away // from nnu. - + // cross nnu with launch_vector to get the direction of the B field. Vector n_bfield = nnu.Cross(launch_vector); - + // cross b-field with nrf2_iceside to get the polarization vector. Vector n_pol = n_bfield.Cross(launch_vector); - + n_pol = n_pol.Unit(); - + // check and make sure E-field is pointing in the right direction. if (nnu*launch_vector>0 && n_pol*nnu>0) cout << "error in GetPolarization. \n"; - - - + + + return n_pol; } //GetPolarization @@ -3993,7 +4080,7 @@ double Report::GaintoHeight(double gain, double freq, double n_medium) { // from gain=4*pi*A_eff/lambda^2 // and h_eff=2*sqrt(A_eff*Z_rx/Z_air) // gain is unitless value - + return 2*sqrt(gain/4/PI*CLIGHT*CLIGHT/(freq*freq*n_medium*n_medium)*Zr/(Z0/n_medium)); // n_medium parts are changed from icemc(I believe this is correct one; E. Hong) } @@ -4340,35 +4427,35 @@ void Report::ApplyRFCM_databin(int ch, int bin_n, Detector *detector, double &vm void Report::ApplyNoiseFig_databin(int ch, int bin_n, Detector *detector, double &vmmhz, Settings *settings1) { // read noise figure and apply unitless gain to vmmhz //cout<<"Entered ApplyNoiseFig_databin "; //cout<<"vmmhz: "<GetNoiseFig_databin(ch,bin_n); // cout<<" 2: "<GetTransm_databin(ch, bin_n); // cout<<" 3: "<NOISE_TEMP; //FILE *fp = fopen("noiseTemp_NOISE_CHANNEL_MODE_0.txt","a+"); - if(detector->GetNoiseFig_databin(ch,bin_n)>1.0){vmmhz = TMath::Sqrt( tempNoise*(detector->GetTransm_databin(ch, bin_n)) + tempNoise/(settings1->NOISE_TEMP)*220.0*(detector->GetNoiseFig_databin(ch,bin_n) - 1.0) ) ; + if(detector->GetNoiseFig_databin(ch,bin_n)>1.0){vmmhz = TMath::Sqrt( tempNoise*(detector->GetTransm_databin(ch, bin_n)) + tempNoise/(settings1->NOISE_TEMP)*220.0*(detector->GetNoiseFig_databin(ch,bin_n) - 1.0) ) ; //cout<<" vmmhz "<GetFreq(bin_n) << " noise temp: " << 246.0*((detector->GetTransm_databin(ch, bin_n)) + 1.0/(settings1->NOISE_TEMP)*220.0*(detector->GetNoiseFig_databin(ch,bin_n) - 1.0) ) << endl; + //cout<<" bin: "<GetFreq(bin_n) << " noise temp: " << 246.0*((detector->GetTransm_databin(ch, bin_n)) + 1.0/(settings1->NOISE_TEMP)*220.0*(detector->GetNoiseFig_databin(ch,bin_n) - 1.0) ) << endl; //fprintf(fp, "%f ",246.0*((detector->GetTransm_databin(ch, bin_n)) + 1.0/(settings1->NOISE_TEMP)*220.0*(detector->GetNoiseFig_databin(ch,bin_n) - 1.0) )); } else{ vmmhz = vmmhz; //fprintf(fp, "%f ",246.0); } - + //fclose(fp); // if(ch==0 && bin_n==2050) cout << "Noise ch: "<< ch <<" "<< detector->GetNoiseFig_databin(ch,bin_n) << " " << detector->GetTransm_databin(ch, bin_n) // << " " << TMath::Sqrt( tempNoise ) << " " << vmmhz << endl; // if(ch==8 && bin_n==2050) cout << "Noise ch: "<< ch <<" "<< detector->GetNoiseFig_databin(ch,bin_n) << " " << detector->GetTransm_databin(ch, bin_n) // << " " << TMath::Sqrt( tempNoise ) << " " << vmmhz << endl; // if(ch==24 && bin_n==2000) cout << "Noise ch: "<< ch << " " << detector->GetNoiseFig_databin(ch,bin_n)*220.0/246.0 << " " << TMath::Sqrt(detector->GetTransm_databin(ch, bin_n) ) << endl; - + } -void Report::GetAngleAnt(Vector &rec_vector, Position &antenna, double &ant_theta, double &ant_phi) { //ant_theta and ant_phi is in degree +void Report::GetAngleAnt(Vector &rec_vector, Position &antenna, double &ant_theta, double &ant_phi) { //ant_theta and ant_phi is in degree // need to fix some parts. // currently phi is not correct. @@ -4397,7 +4484,7 @@ void Report::GetAngleAnt(Vector &rec_vector, Position &antenna, double &ant_thet void Report::GetNoiseWaveforms(Settings *settings1, Detector *detector, double v_noise, double *vnoise) { if (settings1->NOISE == 0) { // NOISE == 0 : flat thermal noise with Johnson-Nyquist noise - //V_noise_fft_bin = sqrt( (double)(NFOUR/2) * 50. * KBOLTZ * T_noise / (2. * TIMESTEP) ); + //V_noise_fft_bin = sqrt( (double)(NFOUR/2) * 50. * KBOLTZ * T_noise / (2. * TIMESTEP) ); Vfft_noise_after.clear(); // remove previous Vfft_noise values Vfft_noise_before.clear(); // remove previous Vfft_noise values @@ -4452,7 +4539,7 @@ void Report::GetNoiseWaveforms(Settings *settings1, Detector *detector, double v //vnoise[2 * k] = (V_tmp) * cos(noise_phase[k]); //vnoise[2 * k + 1] = (V_tmp) * sin(noise_phase[k]); - + Vfft_noise_after.push_back( vnoise[2*k] ); Vfft_noise_after.push_back( vnoise[2*k+1] ); @@ -4468,7 +4555,7 @@ void Report::GetNoiseWaveforms(Settings *settings1, Detector *detector, double v // now vnoise is time domain waveform Tools::realft( vnoise, -1, settings1->DATA_BIN_SIZE); - + // save timedomain noise to Report class /* for (int k=0; kDATA_BIN_SIZE; k++) { @@ -4522,7 +4609,7 @@ void Report::GetNoiseWaveforms_ch(Settings *settings1, Detector *detector, doubl Vfft_noise_before.push_back( V_tmp ); - + current_phase = noise_phase[k]; @@ -4551,7 +4638,7 @@ void Report::GetNoiseWaveforms_ch(Settings *settings1, Detector *detector, doubl // now vnoise is time domain waveform Tools::realft( vnoise, -1, settings1->DATA_BIN_SIZE); - + // save timedomain noise to Report class /* for (int k=0; kDATA_BIN_SIZE; k++) { @@ -4639,7 +4726,7 @@ void Report::GetNoiseWaveforms_ch(Settings *settings1, Detector *detector, doubl // now vnoise is time domain waveform Tools::realft( vnoise, -1, settings1->DATA_BIN_SIZE); - + // save timedomain noise to Report class /* for (int k=0; kDATA_BIN_SIZE; k++) { @@ -4670,7 +4757,7 @@ void Report::GetNoisePhase(Settings *settings1) { } - + void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int StationIndex, vector &vsignal_array, double *vsignal_forfft) { @@ -4683,7 +4770,7 @@ void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int Stati // int NFOUR = detector->stations[StationIndex].NFOUR; // int TIMESTEP = detector->stations[StationIndex].TIMESTEP; Tools::Zero(vsignal_forfft,NFOUR/2); - + if (settings1->AVZ_NORM_FACTOR_MODE == 0) { // use previous normalization factors @@ -4697,41 +4784,41 @@ void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int Stati int ilastnonzero=2000; //for (int i=0;iGetFreqBin();i++) { - + // freq_forfft has NFOUR/2 elements because it is meant to cover real and imaginary values // but there are only NFOUR/4 different values // it's the index among the NFOUR/4 that we're interested in int ifour=Tools::Getifreq(detector->GetFreq(i),detector->freq_forfft[0],detector->freq_forfft[NFOUR/2-1],NFOUR/4); - + if (ifour!=-1 && 2*ifour+1PHASE*PI/180.); vsignal_forfft[2*ifour+1]*=sin(settings1->PHASE*PI/180.); - + //-------------------------------------------------- // if (!PULSER) { - // + // // vsignal_forfft[2*ifour]*=cos(phase*PI/180.); // vsignal_forfft[2*ifour+1]*=sin(phase*PI/180.); - // - // + // + // // } // else { // vsignal_forfft[2*ifour]*=cos(v_phases[ifour]*PI/180.); // vsignal_forfft[2*ifour+1]*=sin(v_phases[ifour]*PI/180.); - // - // } - //-------------------------------------------------- - - + // + // } + //-------------------------------------------------- + + } } else if (settings1->AVZ_NORM_FACTOR_MODE == 1) { // use new (fixed) normalization factors - + double dF = 1. / ((double)(NFOUR/2) * TIMESTEP); // in Hz //cout<<"dF1 : "<GetFreq(1) - detector->GetFreq(0); // in Hz - + //double dF_factor = sqrt( dF_org / dF ); double dF_factor = 1.; //double dF_factor = sqrt( dF / dF_org ); - + int Norg = detector->GetFreqBin(); - + double FreqOrg[Norg+1]; double VmMHzOrg[Norg+1]; - + double FreqNFOUR[NFOUR/4+1]; // one more bin double VmMHzNFOUR[NFOUR/4+1]; // one more bin - + for (int i=0;iGetFreq(i-1); } - + } - + for (int ifour=0;ifourPHASE*PI/180.); vsignal_forfft[2*ifour+1]*=sin(settings1->PHASE*PI/180.); } - + // first and last freq bin read values to 0, 1 bin vsignal_forfft[0] = VmMHzNFOUR[0] * 2/((double)NFOUR/2) * dF_factor / TIMESTEP; vsignal_forfft[1] = VmMHzNFOUR[NFOUR/4] * 2/((double)NFOUR/2) * dF_factor / TIMESTEP; @@ -4840,7 +4927,7 @@ void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int Stati - + } @@ -4861,7 +4948,7 @@ void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int Stati if (settings1->AVZ_NORM_FACTOR_MODE == 0) { // use previous normalization factors - + double previous_value_e_even=0.; double previous_value_e_odd=0.; int count_nonzero=0; @@ -4870,41 +4957,41 @@ void Report::MakeArraysforFFT(Settings *settings1, Detector *detector, int Stati int ilastnonzero=2000; //for (int i=0;iGetFreqBin();i++) { - + // freq_forfft has NFOUR/2 elements because it is meant to cover real and imaginary values // but there are only NFOUR/4 different values // it's the index among the NFOUR/4 that we're interested in int ifour=Tools::Getifreq(detector->GetFreq(i),detector->freq_forfft[0],detector->freq_forfft[NFOUR/2-1],NFOUR/4); - + if (ifour!=-1 && 2*ifour+1PHASE*PI/180.); vsignal_forfft[2*ifour+1]*=sin(settings1->PHASE*PI/180.); - + //-------------------------------------------------- // if (!PULSER) { - // + // // vsignal_forfft[2*ifour]*=cos(phase*PI/180.); // vsignal_forfft[2*ifour+1]*=sin(phase*PI/180.); - // - // + // + // // } // else { // vsignal_forfft[2*ifour]*=cos(v_phases[ifour]*PI/180.); // vsignal_forfft[2*ifour+1]*=sin(v_phases[ifour]*PI/180.); - // - // } - //-------------------------------------------------- - - + // + // } + //-------------------------------------------------- + + } } else if (settings1->AVZ_NORM_FACTOR_MODE == 1) { // use new (fixed) normalization factors - + double dF = 1. / ((double)(NFOUR/2) * TIMESTEP); // in Hz //cout<<"dF1 : "<GetFreq(1) - detector->GetFreq(0); // in Hz - + //double dF_factor = sqrt( dF_org / dF ); double dF_factor = 1.; //double dF_factor = sqrt( dF / dF_org ); - + int Norg = detector->GetFreqBin(); - + double FreqOrg[Norg+1]; double VmMHzOrg[Norg+1]; - + double FreqNFOUR[NFOUR/4+1]; // one more bin double VmMHzNFOUR[NFOUR/4+1]; // one more bin - + for (int i=0;iGetFreq(i-1); } - + } - + for (int ifour=0;ifourPHASE*PI/180.); vsignal_forfft[2*ifour+1]*=sin(settings1->PHASE*PI/180.); } - + // first and last freq bin read values to 0, 1 bin vsignal_forfft[0] = VmMHzNFOUR[0] * 2/((double)NFOUR/2) * dF_factor / TIMESTEP; vsignal_forfft[1] = VmMHzNFOUR[NFOUR/4] * 2/((double)NFOUR/2) * dF_factor / TIMESTEP; @@ -5030,9 +5117,9 @@ void Report::MakeArraysforFFT_noise(Settings *settings1, Detector *detector, int // int NFOUR = detector->stations[StationIndex].NFOUR; // int TIMESTEP = detector->stations[StationIndex].TIMESTEP; - + Tools::Zero(vsignal_forfft,NFOUR/2); - + double previous_value_e_even=0.; double previous_value_e_odd=0.; int count_nonzero=0; @@ -5041,41 +5128,41 @@ void Report::MakeArraysforFFT_noise(Settings *settings1, Detector *detector, int int ilastnonzero=2000; //for (int i=0;iGetFreqBin();i++) { - + // freq_forfft has NFOUR/2 elements because it is meant to cover real and imaginary values // but there are only NFOUR/4 different values // it's the index among the NFOUR/4 that we're interested in int ifour=Tools::Getifreq(detector->GetFreq(i),detector->freq_forfft[0],detector->freq_forfft[NFOUR/2-1],NFOUR/4); - + if (ifour!=-1 && 2*ifour+1getStringfromArbAntID( station_i, ch); int antenna_i = detector->getAntennafromArbAntID( station_i, ch); - + TGraph *gr=new TGraph(); - + int N=stations[station_i].strings[string_i].antennas[antenna_i].V_mimic.size(); - + for(int i=0;iSetPoint(i,stations[station_i].strings[string_i].antennas[antenna_i].time_mimic[i], stations[station_i].strings[string_i].antennas[antenna_i].V_mimic[i]); - + }// for i - + gr->SetNameTitle(Form("WF%dS%02dC%02d", event_num, station_i, ch), Form("Simulated waveform %d, station %d, channel %d;time (ns); voltage (mV)", event_num, station_i, ch)); - + return gr; - + } vector Report::getWaveformVector(Detector *detector, int station_i, int event_num, int run_num){ vector waveforms; - + for(int ch=0;chstations[station_i].number_of_antennas; ch++){ - + int string_i = detector->getStringfromArbAntID( station_i, ch); int antenna_i = detector->getAntennafromArbAntID( station_i, ch); - + TGraph *gr=new TGraph(); - + int N=stations[station_i].strings[string_i].antennas[antenna_i].V_mimic.size(); - + for(int i=0;iSetPoint(i,stations[station_i].strings[string_i].antennas[antenna_i].time_mimic[i], stations[station_i].strings[string_i].antennas[antenna_i].V_mimic[i]); - + }// for i - + gr->SetNameTitle(Form("WF%dS%02dC%02d", event_num, station_i, ch), Form("Simulated waveform %d, station %d, channel %d;time (ns); voltage (mV)", event_num, station_i, ch)); - + waveforms.push_back(gr); - + }// for ch - + return waveforms; - + } vector Report::getWaveformVectorVpol(Detector *detector, int station_i, int event_num, int run_num){ - + vector waveforms; - + for(int ch=0;chstations[station_i].number_of_antennas; ch++){ - + int string_i = detector->getStringfromArbAntID( station_i, ch); int antenna_i = detector->getAntennafromArbAntID( station_i, ch); - + if(detector->stations[station_i].strings[string_i].antennas[antenna_i].type!=0) continue; // jump to next channel if this isn't Vpol - + TGraph *gr=new TGraph(); - + int N=stations[station_i].strings[string_i].antennas[antenna_i].V_mimic.size(); - + for(int i=0;iSetPoint(i,stations[station_i].strings[string_i].antennas[antenna_i].time_mimic[i], stations[station_i].strings[string_i].antennas[antenna_i].V_mimic[i]); - + }// for i - + gr->SetNameTitle(Form("WF%dS%02dC%02d", event_num, station_i, ch), Form("Simulated waveform %d, station %d, channel %d;time (ns); voltage (mV)", event_num, station_i, ch)); - + waveforms.push_back(gr); - + }// for ch - + return waveforms; - + } vector Report::getWaveformVectorHpol(Detector *detector, int station_i, int event_num, int run_num){ - + vector waveforms; - + for(int ch=0;chstations[station_i].number_of_antennas; ch++){ - + int string_i = detector->getStringfromArbAntID( station_i, ch); int antenna_i = detector->getAntennafromArbAntID( station_i, ch); - + if(detector->stations[station_i].strings[string_i].antennas[antenna_i].type!=1) continue; // jump to next channel if this isn't Hpol - + TGraph *gr=new TGraph(); - + int N=stations[station_i].strings[string_i].antennas[antenna_i].V_mimic.size(); - + for(int i=0;iSetPoint(i,stations[station_i].strings[string_i].antennas[antenna_i].time_mimic[i], stations[station_i].strings[string_i].antennas[antenna_i].V_mimic[i]); - + }// for i - + gr->SetNameTitle(Form("WF%dS%02dC%02d", event_num, station_i, ch), Form("Simulated waveform %d, station %d, channel %d;time (ns); voltage (mV)", event_num, station_i, ch)); - + waveforms.push_back(gr); - + }// for ch - + return waveforms; - + } vector Report::getHitTimesVector(Detector *detector, int station_i, int polarization){ vector times; - + for(int ch=0;chstations[station_i].number_of_antennas;ch++){ - + int string_i = detector->getStringfromArbAntID( station_i, ch); int antenna_i = detector->getAntennafromArbAntID( station_i, ch); - + if(polarization>=0 && detector->stations[station_i].strings[string_i].antennas[antenna_i].type!=polarization) continue; // jump to next channel if this isn't Hpol/Vpol - + if(stations[station_i].strings[string_i].antennas[antenna_i].arrival_time.size()){ - + times.push_back(1e9*stations[station_i].strings[string_i].antennas[antenna_i].arrival_time[0]);// get the direct beam arrival time - + } - + else times.push_back(-1000); // if there's no ray-trace solution just put something in. - + } - + return times; - + } vector Report::getHitTimesVectorVpol(Detector *detector, int station_i){ return getHitTimesVector(detector, station_i, 0); - + } vector Report::getHitTimesVectorHpol(Detector *detector, int station_i){ - - return getHitTimesVector(detector, station_i, 1); - -} + return getHitTimesVector(detector, station_i, 1); +} diff --git a/Report.h b/Report.h index 31553e5f..ba8b3801 100644 --- a/Report.h +++ b/Report.h @@ -38,336 +38,340 @@ class FFTWComplex; using namespace std; class Surface_antenna_r { - public: + public: - ClassDef(Surface_antenna_r,1); + ClassDef(Surface_antenna_r,1); }; class Antenna_r { - public: + public: - // one dimention for number of solutions, (if there,) another dimention for array of information - // + // one dimention for number of solutions, (if there,) another dimention for array of information + // - int ray_sol_cnt; // number of RaySolver solutions + int ray_sol_cnt; // number of RaySolver solutions - //vector trg; // if antenna recieved any signal or not. 0 : no signal, 1 : yes signal + //vector trg; // if antenna recieved any signal or not. 0 : no signal, 1 : yes signal - vector view_ang; //viewing angle - vector launch_ang; //launch angle - vector rec_ang; //receiving angle - vector reflect_ang; // surface reflection angle (if 100 : no reflection case) - vector Dist; //Distance between posnu and antenna - vector L_att; //Attenuation factor - vector arrival_time; //time from posnu to antenna (t:0 at posnu) - vector reflection; // non-reflected : 0, reflected : 1 - vector Pol_vector; // polarization vector at the antenna - //vector n_H; // normalized vector for H pol - //vector n_V; // normalized vector for V pol + vector view_ang; //viewing angle + vector launch_ang; //launch angle + vector rec_ang; //receiving angle + vector reflect_ang; // surface reflection angle (if 100 : no reflection case) + vector Dist; //Distance between posnu and antenna + vector L_att; //Attenuation factor + vector arrival_time; //time from posnu to antenna (t:0 at posnu) + vector reflection; // non-reflected : 0, reflected : 1 + vector Pol_vector; // polarization vector at the antenna + //vector n_H; // normalized vector for H pol + //vector n_V; // normalized vector for V pol - // below freq domain simulation output - vector < vector > vmmhz; // signal V/m/MHz for each freq bin - // - vector < vector > Heff; // effective height for each freq bin - vector Mag; // magnification factor - vector Fresnel; // Fresnel factor - vector Pol_factor; // Polarization factor - - vector < vector > Vm_zoom; // E field before ant T-domain - vector < vector > Vm_zoom_T; // E field before ant T-domain time - //vector < vector > Vm_wo_antfactor; // before applying ApplyAntFactors - //vector < vector > VHz_antfactor; // after applying ApplyAntFactors to vmmhz above ( 1/sqrt2 * 1/dt * 0.5 * heff * pol_factor ) - //vector < vector > VHz_filter; // after applying ApplyAntFactors above and then apply filter gain from detector->GetFilterGain - // - int skip_bins[2]; // for two ray sols + // below freq domain simulation output + vector < vector > vmmhz; // signal V/m/MHz for each freq bin + // + vector < vector > Heff; // effective height for each freq bin + vector Mag; // magnification factor + vector Fresnel; // Fresnel factor + vector Pol_factor; // Polarization factor + + vector < vector > Vm_zoom; // E field before ant T-domain + vector < vector > Vm_zoom_T; // E field before ant T-domain time + //vector < vector > Vm_wo_antfactor; // before applying ApplyAntFactors + //vector < vector > VHz_antfactor; // after applying ApplyAntFactors to vmmhz above ( 1/sqrt2 * 1/dt * 0.5 * heff * pol_factor ) + //vector < vector > VHz_filter; // after applying ApplyAntFactors above and then apply filter gain from detector->GetFilterGain + // + int skip_bins[2]; // for two ray sols - int Nnew[2]; // new number of bins for V_fotfft array + int Nnew[2]; // new number of bins for V_fotfft array - vector < vector > Vfft; // signal V preparing for FFT - vector < vector > Vfft_noise; // noise V preparing for FFT + vector < vector > Vfft; // signal V preparing for FFT + vector < vector > Vfft_noise; // noise V preparing for FFT - // below time domain simulation output - vector time; // time of time domain Askaryan radiation - vector time_mimic; // time of time domain Askaryan radiation (same time range with data) - vector V_mimic; // signal + noise waveform which mimics the data (size : NFOUR/2 bin) + // below time domain simulation output + vector time; // time of time domain Askaryan radiation + vector time_mimic; // time of time domain Askaryan radiation (same time range with data) + vector V_mimic; // signal + noise waveform which mimics the data (size : NFOUR/2 bin) - int global_trig_bin; // from V_mimic [0, NFOUR/2] bins, where global trigger occured + int global_trig_bin; // from V_mimic [0, NFOUR/2] bins, where global trigger occured - vector < vector > Ax; // vector potential x component - vector < vector > Ay; - vector < vector > Az; - vector < vector > V; // volt signal with all factors applied (as far as we can) (from fft) + vector < vector > Ax; // vector potential x component + vector < vector > Ay; + vector < vector > Az; + vector < vector > V; // volt signal with all factors applied (as far as we can) (from fft) - vector SignalExt; // flag if actual signal exist for the ray trace solution + vector SignalExt; // flag if actual signal exist for the ray trace solution - vector SignalBin; // the bin number where the center of signal located. we can compare this value to Trig_Pass value to have likely triggered ray trace solution + vector SignalBin; // the bin number where the center of signal located. we can compare this value to Trig_Pass value to have likely triggered ray trace solution - vector noise_ID; // information about which pure noise waveform is used for trigger analysis + vector noise_ID; // information about which pure noise waveform is used for trigger analysis - //vector < vector > V_noise; // volt noise signal (with all factors applied as far as we can) (from thermal noise + fft) + //vector < vector > V_noise; // volt noise signal (with all factors applied as far as we can) (from thermal noise + fft) - //vector < vector > V_total; // volt signal + noise with all factors applied as far as we can + //vector < vector > V_total; // volt signal + noise with all factors applied as far as we can - //vector < vector > V_total_diode; // volt signal + noise with all factors (as far as we can) and convlution with diode (time domain) + //vector < vector > V_total_diode; // volt signal + noise with all factors (as far as we can) and convlution with diode (time domain) - //vector < vector > V_total_timedelay; // volt signal + noise with all factors applied and time delay between antennas - // - // - vector PeakV; // peak voltage in time domain - vector Rank; // rank of peak voltage between antennas (Rank = 0 for 0 signal) + //vector < vector > V_total_timedelay; // volt signal + noise with all factors applied and time delay between antennas + // + // + vector PeakV; // peak voltage in time domain + vector Rank; // rank of peak voltage between antennas (Rank = 0 for 0 signal) - // vector PeakV_fromFullWaveform; // peak voltage in time domain taken from full waveform, including noise at the time of signal insertion - // vector Rank_fromFullWaveform; // rank of peak voltage between antennas (Rank = 0 for 0 signal) + // vector PeakV_fromFullWaveform; // peak voltage in time domain taken from full waveform, including noise at the time of signal insertion + // vector Rank_fromFullWaveform; // rank of peak voltage between antennas (Rank = 0 for 0 signal) - int Trig_Pass; // 0 if not passed the trigger, 1 if passed the trigger - //vector Trig_Pass; // 0 if not passed the trigger, 1 if passed the trigger + int Trig_Pass; // 0 if not passed the trigger, 1 if passed the trigger + //vector Trig_Pass; // 0 if not passed the trigger, 1 if passed the trigger - int Likely_Sol; // comparing Trig_Pass and SignalBin value, this value returns which ray trace solution has been triggered (not perfect but most likely) + int Likely_Sol; // comparing Trig_Pass and SignalBin value, this value returns which ray trace solution has been triggered (not perfect but most likely) - int SingleChannelTriggers; // how many bins passed the threshold in this channel (should be equal to size of SCT_threshold_pass). - vector SCT_threshold_pass; // for each bin that passed, what was the threshold value at which it passed (for TRIG_SCAN_MODE only). + int SingleChannelTriggers; // how many bins passed the threshold in this channel (should be equal to size of SCT_threshold_pass). + vector SCT_threshold_pass; // for each bin that passed, what was the threshold value at which it passed (for TRIG_SCAN_MODE only). - long TotalBinsScannedPerChannel; + long TotalBinsScannedPerChannel; - vector TooMuch_Tdelay; // 0 is PeakV is located inside the DATA_BIN_SIZE array, 1 is when PeakV is located outside the DATA_BIN_SIZE so that we can't correctly check if it is triggered or not + vector TooMuch_Tdelay; // 0 is PeakV is located inside the DATA_BIN_SIZE array, 1 is when PeakV is located outside the DATA_BIN_SIZE so that we can't correctly check if it is triggered or not - - void clear (); // clear all vector format information for next event - void clear_useless ( Settings *settings1 ); // clear all vector information which are useless + + void clear (); // clear all vector format information for next event + void clear_useless ( Settings *settings1 ); // clear all vector information which are useless - ClassDef(Antenna_r,1); + ClassDef(Antenna_r,1); }; class String_r { - public: - //int trg; // if any antenna trigg in the event. 0 : no antenna in the string trg - // 1 : 1 or more antenna trg + public: + //int trg; // if any antenna trigg in the event. 0 : no antenna in the string trg + // 1 : 1 or more antenna trg - vector antennas; + vector antennas; - ClassDef(String_r,1); + ClassDef(String_r,1); }; class Station_r { - public: - //int trg; // if any antenna trigg in the event. 0 : no antenna trg - // 1: 1 or more antenna trg - vector strings; - vector surfaces; - - double min_arrival_time; // for each station, minimum arrival time (include all ray_solves). this will be used for time delay between antennas. - double max_arrival_time; // for each station, maximum arrival time (include all ray_solves). this will be used for time delay between antennas. - double max_PeakV; // for each station, maximum PeakV value (include all ray_solves). this will also be used for time delay plot (to set same vertical scale) - int Total_ray_sol; // total number of ray_sols in the stations. If there is 0 Total_ray_sol, we don't need to do trigger check while there is any Total_ray_sol, we do trigger check. - int Global_Pass; // if global trigger passed or not: 0 = not passed, >0 passed, number indicates the first bin in the triggered window of the waveform at which the global trigger passed - - int total_trig_search_bin; // total number of bins for searching trigger. - -// int numChan; -// int numChanVpol; -// int numChanHpol; - - // TDR is for Tunnel Diode Response i.e. the value on which the trigger happened - vector TDR_all; - vector TDR_all_sorted; - vector TDR_Hpol_sorted; - vector TDR_Vpol_sorted; - - ClassDef(Station_r,3); + public: + //int trg; // if any antenna trigg in the event. 0 : no antenna trg + // 1: 1 or more antenna trg + vector strings; + vector surfaces; + + double min_arrival_time; // for each station, minimum arrival time (include all ray_solves). this will be used for time delay between antennas. + double max_arrival_time; // for each station, maximum arrival time (include all ray_solves). this will be used for time delay between antennas. + double max_PeakV; // for each station, maximum PeakV value (include all ray_solves). this will also be used for time delay plot (to set same vertical scale) + int Total_ray_sol; // total number of ray_sols in the stations. If there is 0 Total_ray_sol, we don't need to do trigger check while there is any Total_ray_sol, we do trigger check. + int Global_Pass; // if global trigger passed or not: 0 = not passed, >0 passed, number indicates the first bin in the triggered window of the waveform at which the global trigger passed + + int total_trig_search_bin; // total number of bins for searching trigger. + + // int numChan; + // int numChanVpol; + // int numChanHpol; + + // TDR is for Tunnel Diode Response i.e. the value on which the trigger happened + vector TDR_all; + vector TDR_all_sorted; + vector TDR_Hpol_sorted; + vector TDR_Vpol_sorted; + + ClassDef(Station_r,3); }; class Report { - private: - vector noise_phase; // random noise phase generated in GetNoisePhase() - - - // variables we need for trigger - // test selecting noise waveform - - int noise_pass_nogo; // index for checking if any same noise_ID is used in different chs. - int N_noise; // needed number of noise waveforms (most cases, we will need only 1) - int noise_ID[5]; // selected noise waveform ID (we should not need 5 noise waveforms, but just in case) - int ch_ID; // channel ID - //double Full_window[detector->params.number_of_strings_station * detector->params.number_of_antennas_string][settings1->DATA_BIN_SIZE]; // entire window for trigger check (diode convlv results for all antennas in a station) - //vector < vector > Full_window; // entire window for trigger check (diode convlv results for all antennas in a station) - int max_total_bin; // to save time, use only necessary number of bins - int remain_bin; // the bin number for not using entire DATA_BIN_SIZE array - vector signal_bin; // the center of bin where signal should locate - vector signal_dbin; // the bin difference between signal bins - vector connect_signals; // if ray_sol time delay is small enough to connect each other - - int triggerCheckLoop(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int scan_mode=1); -// int triggerCheckLoopScan(); -// int triggerCheckLoopScanNumbers(); + private: + vector noise_phase; // random noise phase generated in GetNoisePhase() + + + // variables we need for trigger + // test selecting noise waveform + + int noise_pass_nogo; // index for checking if any same noise_ID is used in different chs. + int N_noise; // needed number of noise waveforms (most cases, we will need only 1) + int noise_ID[5]; // selected noise waveform ID (we should not need 5 noise waveforms, but just in case) + int ch_ID; // channel ID + //double Full_window[detector->params.number_of_strings_station * detector->params.number_of_antennas_string][settings1->DATA_BIN_SIZE]; // entire window for trigger check (diode convlv results for all antennas in a station) + //vector < vector > Full_window; // entire window for trigger check (diode convlv results for all antennas in a station) + int max_total_bin; // to save time, use only necessary number of bins + int remain_bin; // the bin number for not using entire DATA_BIN_SIZE array + vector signal_bin; // the center of bin where signal should locate + vector signal_dbin; // the bin difference between signal bins + vector connect_signals; // if ray_sol time delay is small enough to connect each other + + int triggerCheckLoop(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int scan_mode=1); + // int triggerCheckLoopScan(); + // int triggerCheckLoopScanNumbers(); - int saveTriggeredEvent(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int last_trig_bin); + int saveTriggeredEvent(Settings *settings1, Detector *detector, Event *event, Trigger *trigger, int stationID, int trig_search_init, int max_total_bin, int trig_window_bin, int last_trig_bin); - vector < vector < vector > > RayStep; + vector < vector < vector > > RayStep; - public: - /* - double Full_window[16][16384]; // test with array, not vector, diode response - double Full_window_V[16][16384]; // test with array, not vector, voltage waveform - */ - vector Passed_chs; - //int trg; // if any antenna in entire detectors trg. 0 : no antenna trg - // 1 : 1 or more antenna trg + public: + /* + double Full_window[16][16384]; // test with array, not vector, diode response + double Full_window_V[16][16384]; // test with array, not vector, voltage waveform + */ + vector Passed_chs; + //int trg; // if any antenna in entire detectors trg. 0 : no antenna trg + // 1 : 1 or more antenna trg - Report (); - Report (Detector *detector, Settings *settings1); - ~Report (); - //make the UsefulIcrrStationEvent for use with AraRoot - //UsefulIcrrStationEvent theUsefulEvent; + Report (); + Report (Detector *detector, Settings *settings1); + ~Report (); + //make the UsefulIcrrStationEvent for use with AraRoot + //UsefulIcrrStationEvent theUsefulEvent; - - void Initialize (Detector *detector, Settings *settings1); - - //void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger); - //void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, UsefulIcrrStationEvent *theUsefulEvent); + + void Initialize (Detector *detector, Settings *settings1); + //void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger); + //void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, UsefulIcrrStationEvent *theUsefulEvent); -// void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, UsefulIcrrStationEvent *theUsefulEvent); - -// void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger); - - void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, int evt); - - -#ifdef ARA_UTIL_EXISTS - void MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *trigger, int stationID, int stationIndex, UsefulIcrrStationEvent *theUsefulEvent); - void MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *trigger, int stationID, int stationIndex, UsefulAtriStationEvent *theUsefulEvent); -#endif - - void ClearUselessfromConnect(Detector *detector, Settings *settings1, Trigger *trigger); + // void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, UsefulIcrrStationEvent *theUsefulEvent); + + // void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger); + + void Connect_Interaction_Detector (Event *event, Detector *detector, RaySolver *raysolver, Signal *signal, IceModel *icemodel, Settings *settings1, Trigger *trigger, int evt); + + + #ifdef ARA_UTIL_EXISTS + void MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *trigger, int stationID, int stationIndex, UsefulIcrrStationEvent *theUsefulEvent); + void MakeUsefulEvent(Detector *detector, Settings *settings1, Trigger *trigger, int stationID, int stationIndex, UsefulAtriStationEvent *theUsefulEvent); + #endif + + void ClearUselessfromConnect(Detector *detector, Settings *settings1, Trigger *trigger); - - void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin, vector &V, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array - - void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin_1, int signalbin_2, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array + + void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin, vector &V, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array + + void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin_1, int signalbin_2, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array - void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin_0, int signalbin_1, int signalbin_2, vector &V0, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array + void Select_Wave_Convlv_Exchange(Settings *settings1, Trigger *trigger, Detector *detector, int signalbin_0, int signalbin_1, int signalbin_2, vector &V0, vector &V1, vector &V2, int *noise_ID, int ID, int StationIndex); // literally get noise waveform from trigger class and add signal voltage "V" and do convlv. convlv result will replace the value in Full_window array - void Apply_Gain_Offset(Settings *settings1, Trigger *trigger, Detector *detector, int ID, int StationIndex); // we need to apply a gain offset to the basic waveforms. + void Apply_Gain_Offset(Settings *settings1, Trigger *trigger, Detector *detector, int ID, int StationIndex); // we need to apply a gain offset to the basic waveforms. - int GetChNumFromArbChID( Detector *detector, int ID, int StationIndex, Settings *settings1);// get actual ch number from arb chID + int GetChNumFromArbChID( Detector *detector, int ID, int StationIndex, Settings *settings1);// get actual ch number from arb chID - Vector GetPolarization (Vector &nnu, Vector &launch_vector); + Vector GetPolarization (Vector &nnu, Vector &launch_vector); - void GetParameters (Position &src, Position &trg, Vector &nnu, double &viewangle, double receive_angle, Vector &launch_vector, Vector &receive_vector, Vector &n_trg_slappy, Vector &n_trg_pokey ); // get viewangle, launch, receive vectors (it reads launch angle as a viewangle and returns actual viewangle) + void GetParameters (Position &src, Position &trg, Vector &nnu, double &viewangle, double receive_angle, Vector &launch_vector, Vector &receive_vector, Vector &n_trg_slappy, Vector &n_trg_pokey ); // get viewangle, launch, receive vectors (it reads launch angle as a viewangle and returns actual viewangle) - double GaintoHeight(double gain, double freq, double n_medium); + double GaintoHeight(double gain, double freq, double n_medium); - void ApplyAntFactors(double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vmmhz); + void ApplyAntFactors(double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vmmhz); - void ApplyAntFactors_Tdomain(double AntPhase, double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_real, double &vm_img, Settings *settings1); + void ApplyAntFactors_Tdomain(double AntPhase, double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_real, double &vm_img, Settings *settings1); - void ApplyAntFactors_Tdomain_Transmitter(double AntPhase, double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_real, double &vm_img, Settings *settings1); + void ApplyAntFactors_Tdomain_Transmitter(double AntPhase, double heff, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_real, double &vm_img, Settings *settings1); - void ApplyAntFactors_Tdomain_FirstTwo ( double heff, double heff_lastbin, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_bin0, double &vm_bin1); + void ApplyAntFactors_Tdomain_FirstTwo ( double heff, double heff_lastbin, Vector &n_trg_pokey, Vector &n_trg_slappy, Vector &Pol_vector, int ant_type, double &pol_factor, double &vm_bin0, double &vm_bin1); - void ApplyElect_Tdomain(double freq, Detector *detector, double &vm_real, double &vm_img, Settings *settings1); + void ApplyElect_Tdomain(double freq, Detector *detector, double &vm_real, double &vm_img, Settings *settings1); - void ApplyElect_Tdomain_FirstTwo(double freq0, double freq1, Detector *detector, double &vm_bin0, double &vm_bin1); + void ApplyElect_Tdomain_FirstTwo(double freq0, double freq1, Detector *detector, double &vm_bin0, double &vm_bin1); - void ApplyFilter(int bin_n, Detector *detector, double &vmmhz); - void ApplyFilter_databin(int bin_n, Detector *detector, double &vmmhz); - void ApplyFilter_NFOUR(int bin_n, Detector *detector, double &vmmhz); - void ApplyFilter_OutZero (double freq, Detector *detector, double &vmmhz); + void ApplyFilter(int bin_n, Detector *detector, double &vmmhz); + void ApplyFilter_databin(int bin_n, Detector *detector, double &vmmhz); + void ApplyFilter_NFOUR(int bin_n, Detector *detector, double &vmmhz); + void ApplyFilter_OutZero (double freq, Detector *detector, double &vmmhz); - // apply gain in Preamp - void ApplyPreamp(int bin_n, Detector *detector, double &vmmhz); - void ApplyPreamp_databin(int bin_n, Detector *detector, double &vmmhz); - void ApplyPreamp_NFOUR(int bin_n, Detector *detector, double &vmmhz); - void ApplyPreamp_OutZero (double freq, Detector *detector, double &vmmhz); + // apply gain in Preamp + void ApplyPreamp(int bin_n, Detector *detector, double &vmmhz); + void ApplyPreamp_databin(int bin_n, Detector *detector, double &vmmhz); + void ApplyPreamp_NFOUR(int bin_n, Detector *detector, double &vmmhz); + void ApplyPreamp_OutZero (double freq, Detector *detector, double &vmmhz); - void ApplyNoiseFig_databin(int ch, int bin_n, Detector *detector, double &vmmhz, Settings *settings1); + void ApplyNoiseFig_databin(int ch, int bin_n, Detector *detector, double &vmmhz, Settings *settings1); - // apply gain in FOAM - void ApplyFOAM(int bin_n, Detector *detector, double &vmmhz); - void ApplyFOAM_databin(int bin_n, Detector *detector, double &vmmhz); - void ApplyFOAM_NFOUR(int bin_n, Detector *detector, double &vmmhz); - void ApplyFOAM_OutZero (double freq, Detector *detector, double &vmmhz); + // apply gain in FOAM + void ApplyFOAM(int bin_n, Detector *detector, double &vmmhz); + void ApplyFOAM_databin(int bin_n, Detector *detector, double &vmmhz); + void ApplyFOAM_NFOUR(int bin_n, Detector *detector, double &vmmhz); + void ApplyFOAM_OutZero (double freq, Detector *detector, double &vmmhz); - // apply RFCM gain - void ApplyRFCM(int ch, int bin_n, Detector *detector, double &vmmhz, double RFCM_OFFSET); - void ApplyRFCM_databin(int ch, int bin_n, Detector *detector, double &vmmhz, double RFCM_OFFSET); + // apply RFCM gain + void ApplyRFCM(int ch, int bin_n, Detector *detector, double &vmmhz, double RFCM_OFFSET); + void ApplyRFCM_databin(int ch, int bin_n, Detector *detector, double &vmmhz, double RFCM_OFFSET); - void GetAngleAnt(Vector &rec_vector, Position &antenna, double &ant_theta, double &ant_phi); + void GetAngleAnt(Vector &rec_vector, Position &antenna, double &ant_theta, double &ant_phi); - void GetNoiseWaveforms(Settings *settings1, Detector *detector, double vhz_noise, double *vnoise); - void GetNoiseWaveforms_ch(Settings *settings1, Detector *detector, double vhz_noise, double *vnoise, int ch); + void GetNoiseWaveforms(Settings *settings1, Detector *detector, double vhz_noise, double *vnoise); + void GetNoiseWaveforms_ch(Settings *settings1, Detector *detector, double vhz_noise, double *vnoise, int ch); - void GetNoisePhase(Settings *settings1); + void GetNoisePhase(Settings *settings1); - void MakeArraysforFFT(Settings *settings1, Detector *detector, int StationIndex, vector &vsignal_array, double *vsignal_forfft); - void MakeArraysforFFT(Settings *settings1, Detector *detector, int StationIndex, double *vsignal_array, double *vsignal_forfft); + void MakeArraysforFFT(Settings *settings1, Detector *detector, int StationIndex, vector &vsignal_array, double *vsignal_forfft); + void MakeArraysforFFT(Settings *settings1, Detector *detector, int StationIndex, double *vsignal_array, double *vsignal_forfft); - void MakeArraysforFFT_noise(Settings *settings1, Detector *detector, int StationIndex, vector &vsignal_array, double *vsignal_forfft); + void MakeArraysforFFT_noise(Settings *settings1, Detector *detector, int StationIndex, vector &vsignal_array, double *vsignal_forfft); - double FindPeak (double *waveform, int n); // same with icemc; trigger->AntTrigger::FindPeak + double FindPeak (double *waveform, int n); // same with icemc; trigger->AntTrigger::FindPeak - void SetRank(Detector *detector); // set rank (rank of strength of signal at each antenna) + void SetRank(Detector *detector); // set rank (rank of strength of signal at each antenna) - int GetChannelNum8_LowAnt(int string_num, int antenna_num); // just return ch numbers 1-8 for antenna 0-1 (bottom antennas) and higher ch numbers for antenna 2-3 (top antennas) this is used for only TRIG_ONLY_LOW_CH_ON=1 mode with + int GetChannelNum8_LowAnt(int string_num, int antenna_num); // just return ch numbers 1-8 for antenna 0-1 (bottom antennas) and higher ch numbers for antenna 2-3 (top antennas) this is used for only TRIG_ONLY_LOW_CH_ON=1 mode with - TGraph *getWaveform(Detector *detector, int ch, int station_i=0, int event_num=0, int run_num=0); + TGraph *getWaveform(Detector *detector, int ch, int station_i=0, int event_num=0, int run_num=0); - vector getWaveformVector(Detector *detector, int station_i=0, int event_num=0, int run_num=0); - vector getWaveformVectorVpol(Detector *detector, int station_i=0, int event_num=0, int run_num=0); - vector getWaveformVectorHpol(Detector *detector, int station_i=0, int event_num=0, int run_num=0); + vector getWaveformVector(Detector *detector, int station_i=0, int event_num=0, int run_num=0); + vector getWaveformVectorVpol(Detector *detector, int station_i=0, int event_num=0, int run_num=0); + vector getWaveformVectorHpol(Detector *detector, int station_i=0, int event_num=0, int run_num=0); - vector getHitTimesVector(Detector *detector, int station_i=0, int polarization=-1);// -1 for all pol, 0 for Vpol, 1: for Hpol - vector getHitTimesVectorVpol(Detector *detector, int station_i=0); - vector getHitTimesVectorHpol(Detector *detector, int station_i=0); + vector getHitTimesVector(Detector *detector, int station_i=0, int polarization=-1);// -1 for all pol, 0 for Vpol, 1: for Hpol + vector getHitTimesVectorVpol(Detector *detector, int station_i=0); + vector getHitTimesVectorHpol(Detector *detector, int station_i=0); - vector Vfft_noise_after; // noise Vfft after get_random_rician - vector Vfft_noise_before; // noise Vfft before get_random_rician - //vector V_noise_timedomain; // noise V timedomain after get_random_rician and inverse fft - double Vfft_noise_org; // V/Hz for thermal noise from Johnson-Nyquist + vector Vfft_noise_after; // noise Vfft after get_random_rician + vector Vfft_noise_before; // noise Vfft before get_random_rician + //vector V_noise_timedomain; // noise V timedomain after get_random_rician and inverse fft + double Vfft_noise_org; // V/Hz for thermal noise from Johnson-Nyquist + + vector V_total_forconvlv; // vector array for pure signal diode convlv result - vector V_total_forconvlv; // vector array for pure signal diode convlv result + void clear_useless(Settings *settings1); // to reduce the size of output AraOut.root, remove some information - void clear_useless(Settings *settings1); // to reduce the size of output AraOut.root, remove some information + void delete_all(); // delete all informations test - void delete_all(); // delete all informations test + vector stations; + vector strings; - vector stations; - vector strings; + double RandomTshift; // for t-domain signal, a factor for random init time shift - double RandomTshift; // for t-domain signal, a factor for random init time shift + // test T domain waveform + //static const int outbin = 50; + static const int outbin = 64; + double Tarray[outbin]; + double Earray[outbin]; - // test T domain waveform - //static const int outbin = 50; - static const int outbin = 64; - double Tarray[outbin]; - double Earray[outbin]; + double init_T; // locate zero time at the middle and give random time shift (for interpolated waveforms) - double init_T; // locate zero time at the middle and give random time shift (for interpolated waveforms) + // two parameters for controlling the trigger delay for each channel (only use in real station emulation mode) + // and a variable for setting which has the "most" delay + double triggerDelay[16]; + double mostDelay; - ClassDef(Report,1); + ClassDef(Report,1); }; diff --git a/Settings.cc b/Settings.cc index c71fa38e..48e83e01 100644 --- a/Settings.cc +++ b/Settings.cc @@ -18,161 +18,156 @@ using namespace std; Settings::Settings() { Initialize(); -// ReadFile(); - + // ReadFile(); } Settings::~Settings() { - //default destructor + //default destructor } void Settings::Initialize() { + // below : values from icemc Settings class + NDISCONES_PASS=3; -// below : values from icemc Settings class - NDISCONES_PASS=3; + DEBUG=false; // debugging option + outputdir="outputs"; // directory where outputs go + FREQ_LOW_SEAVEYS=200.E6; + FREQ_HIGH_SEAVEYS=1200.E6; + BW_SEAVEYS=FREQ_HIGH_SEAVEYS-FREQ_LOW_SEAVEYS; + SIGMAPARAM=1; // Connolly et al. 2011 default cross section parametrization + SIGMA_FACTOR=1.; // default sigma factor : 1 + YPARAM=1; // 1: Connolly et al. 2011 default y parametrization, 2: Set ELAST_Y yourself + ELAST_Y = 0.0; + UNBIASED_SELECTION=1.; // (0) pick neutrino interaction in the ice and neutrino from any direction or (1) choose neutrino interaction point in the horizon on the balloon in the ice and neutrino direction on the cerenkov cone - DEBUG=false; // debugging option -outputdir="outputs"; // directory where outputs go - FREQ_LOW_SEAVEYS=200.E6; - FREQ_HIGH_SEAVEYS=1200.E6; - BW_SEAVEYS=FREQ_HIGH_SEAVEYS-FREQ_LOW_SEAVEYS; - SIGMAPARAM=1; // Connolly et al. 2011 default cross section parametrization - SIGMA_FACTOR=1.; // default sigma factor : 1 - YPARAM=1; // 1: Connolly et al. 2011 default y parametrization, 2: Set ELAST_Y yourself - ELAST_Y = 0.0; - UNBIASED_SELECTION=1.; // (0) pick neutrino interaction in the ice and neutrino from any direction or (1) choose neutrino interaction point in the horizon on the balloon in the ice and neutrino direction on the cerenkov cone + SIGMA_SELECT=0; // when in SIGMAPARAM=1 case, 0 : (default) use mean value, 1 : use upper bound, 2 : use lower bound + // end of values from icemc - SIGMA_SELECT=0; // when in SIGMAPARAM=1 case, 0 : (default) use mean value, 1 : use upper bound, 2 : use lower bound + ARASIM_VERSION_MAJOR = ARASIM_MAJOR; + ARASIM_VERSION_MINOR = ARASIM_MINOR; + ARASIM_VERSION_SUBMINOR = ARASIM_SUBMINOR; + ARASIM_VERSION = (double)ARASIM_VERSION_MAJOR + (double)ARASIM_VERSION_MINOR * 0.001 + (double)ARASIM_VERSION_SUBMINOR * 0.000001; + ARAROOT_VERSION = 0.; -// end of values from icemc + ARAUTIL_EXISTS = false; + #ifdef ARA_UTIL_EXISTS + ARAUTIL_EXISTS = true; + ARAROOT_VERSION = (double)ARA_ROOT_MAJOR + (double)ARA_ROOT_MINOR * 0.01; + #endif - ARASIM_VERSION_MAJOR = ARASIM_MAJOR; - ARASIM_VERSION_MINOR = ARASIM_MINOR; - ARASIM_VERSION_SUBMINOR = ARASIM_SUBMINOR; - ARASIM_VERSION = (double)ARASIM_VERSION_MAJOR + (double)ARASIM_VERSION_MINOR * 0.001 + (double)ARASIM_VERSION_SUBMINOR * 0.000001; - - ARAROOT_VERSION = 0.; + NNU=100; - ARAUTIL_EXISTS = false; -#ifdef ARA_UTIL_EXISTS - ARAUTIL_EXISTS = true; - ARAROOT_VERSION = (double)ARA_ROOT_MAJOR + (double)ARA_ROOT_MINOR * 0.01; -#endif - + // NEED TO FIGURE OUT A GOOD WAY TO READ THIS IN AND STORE THEM. + // INPUT FILE AGAIN? SOMETHING ELSE? + //These were moved here from IceModel under the new compilation scheme + ICE_MODEL=0; //Select ice model to be used. 0 = Crust 2.0 , 1 = BEDMAP. + NOFZ=1; // 1=depth dependent index of refraction,0=off + CONSTANTCRUST=0; // set crust density and thickness to constant values. + CONSTANTICETHICKNESS=0; // set ice thickness to constant value + FIXEDELEVATION=0; // fix the elevation to the thickness of ice. + MOOREBAY=0; //1=use Moore's Bay measured ice field attenuation length for the west land, otherwise use South Pole data + USE_ARA_ICEATTENU=1; // use ARA measured ice attenuation value + + EXPONENT=19.; // 10^19 eV neutrinos only + + DETECTOR=1; //ARA layout with small number of stations - NNU=100; + INTERACTION_MODE=1; //PickNear mode (0: Aeff mode using sphere surface around station, 1: Veff mode using cylinder volume around station) - // NEED TO FIGURE OUT A GOOD WAY TO READ THIS IN AND STORE THEM. - // INPUT FILE AGAIN? SOMETHING ELSE? - //These were moved here from IceModel under the new compilation scheme - ICE_MODEL=0; //Select ice model to be used. 0 = Crust 2.0 , 1 = BEDMAP. - NOFZ=1; // 1=depth dependent index of refraction,0=off - CONSTANTCRUST=0; // set crust density and thickness to constant values. - CONSTANTICETHICKNESS=0; // set ice thickness to constant value - FIXEDELEVATION=0; // fix the elevation to the thickness of ice. - MOOREBAY=0; //1=use Moore's Bay measured ice field attenuation length for the west land, otherwise use South Pole data - USE_ARA_ICEATTENU=1; // use ARA measured ice attenuation value - - EXPONENT=19.; // 10^19 eV neutrinos only + POSNU_RADIUS=3000; //radius for PickNear method - DETECTOR=1; //ARA layout with small number of stations + WHICHPARAMETERIZATION=0; // - INTERACTION_MODE=1; //PickNear mode (0: Aeff mode using sphere surface around station, 1: Veff mode using cylinder volume around station) + SIMULATION_MODE=1; // default freq domain simulation - POSNU_RADIUS=3000; //radius for PickNear method + EVENT_TYPE=0; // default neutrino only events - WHICHPARAMETERIZATION=0; // + WAVE_TYPE=0; // default wave type : plane wave (inside the ice) - SIMULATION_MODE=1; // default freq domain simulation + LPM=1; //default : enable LPM effect - EVENT_TYPE=0; // default neutrino only events + SECONDARIES=1; //default : enable secondary interactions - WAVE_TYPE=0; // default wave type : plane wave (inside the ice) + TAUDECAY=1; //default : let taudecay as secondary interactions - LPM=1; //default : enable LPM effect + TIMESTEP=(0.625)*1.E-9; // default, in sec (old default: 0.5E-9, new default 0.625E-9 - SECONDARIES=1; //default : enable secondary interactions + PHASE=90.; // default : 90 deg phase (it means all imaginary values) - TAUDECAY=1; //default : let taudecay as secondary interactions + NFOUR=1024; // default : 1024, same as in icemc - TIMESTEP=(0.625)*1.E-9; // default, in sec (old default: 0.5E-9, new default 0.625E-9 + NOISE=0; // degault : 0, flat thermal noise, 1 : for TestBed (DETECTOR=3), use Rayleigh distribution fitted for borehole channels - PHASE=90.; // default : 90 deg phase (it means all imaginary values) + ATMOSPHERE=1; // default : 1, include atmosphere - NFOUR=1024; // default : 1024, same as in icemc - - NOISE=0; // degault : 0, flat thermal noise, 1 : for TestBed (DETECTOR=3), use Rayleigh distribution fitted for borehole channels + TRIG_SCAN_MODE=0; // default 0 (old mode) 1: new mode (faster) 2: scan all Pthresh values 3: scan also all N out of 8 - ATMOSPHERE=1; // default : 1, include atmosphere + POWERTHRESHOLD=-6.06; // old default : -6.15, new default: -6.06 - TRIG_SCAN_MODE=0; // default 0 (old mode) 1: new mode (faster) 2: scan all Pthresh values 3: scan also all N out of 8 - - POWERTHRESHOLD=-6.06; // old default : -6.15, new default: -6.06 + MAXT_DIODE=70.E-9; // default : 70 ns - MAXT_DIODE=70.E-9; // default : 70 ns + IDELAYBEFOREPEAK_DIODE=(int)(13.E-9 / TIMESTEP); // default : 13.e-9/TIMESTEP = 33 - IDELAYBEFOREPEAK_DIODE=(int)(13.E-9 / TIMESTEP); // default : 13.e-9/TIMESTEP = 33 + IWINDOW_DIODE=(int)(4.E-9 / TIMESTEP); // default : 4.e-9 / TIMESTEP = 10 - IWINDOW_DIODE=(int)(4.E-9 / TIMESTEP); // default : 4.e-9 / TIMESTEP = 10 + DATA_BIN_SIZE=16384; // default : 16384 - DATA_BIN_SIZE=16384; // default : 16384 + NOISE_TEMP=325.; // default : 325 K - NOISE_TEMP=325.; // default : 325 K + TRIG_ANALYSIS_MODE=0; // default : 0, signal + noise - TRIG_ANALYSIS_MODE=0; // default : 0, signal + noise + TRIG_TIMEOUT=1.E-6; // default : 1us - TRIG_TIMEOUT=1.E-6; // default : 1us + TRIG_WINDOW=1.7E-7; // old default : 110 ns, new default: 170 ns - TRIG_WINDOW=1.7E-7; // old default : 110 ns, new default: 170 ns + NOISE_EVENTS=16; // default : 16 events - NOISE_EVENTS=16; // default : 16 events + DATA_SAVE_MODE=0; // default : 0 (full mode) - DATA_SAVE_MODE=0; // default : 0 (full mode) + N_TRIG=3; // default : 3 (3 out of all channels in a station) - N_TRIG=3; // default : 3 (3 out of all channels in a station) + RANDOM_MODE=1; // default : 1 (seed is unique in time/space) - RANDOM_MODE=1; // default : 1 (seed is unique in time/space) + SEED=1; // default: 1, only applies if RANDOM_MODE=0, provides base seed value and run number taken from arguments is added to this value in order to submit multiple repeatable runs instead of only one single long repeatable run - SEED=1; // default: 1, only applies if RANDOM_MODE=0, provides base seed value and run number taken from arguments is added to this value in order to submit multiple repeatable runs instead of only one single long repeatable run - - BORE_HOLE_ANTENNA_LAYOUT=0; // default : 0 (VHVH) + BORE_HOLE_ANTENNA_LAYOUT=0; // default : 0 (VHVH) - DATA_LIKE_OUTPUT=1; //default : 0 (doesn't write out data-like events) - - RAYSOL_RANGE=5000; // default : 5000 m + DATA_LIKE_OUTPUT=1; //default : 0 (doesn't write out data-like events) - PICK_POSNU_DEPTH=0; //default : 0 pick posnu depth from 0 to ice depth + RAYSOL_RANGE=5000; // default : 5000 m - MAX_POSNU_DEPTH=200.; // default : 200m depth max + PICK_POSNU_DEPTH=0; //default : 0 pick posnu depth from 0 to ice depth - NNU_THIS_THETA=0; // default 0: nnu angle pure random, 1: set a specific theta + MAX_POSNU_DEPTH=200.; // default : 200m depth max - NNU_THETA=0.785; // default : nnu theta : 45 deg + NNU_THIS_THETA=0; // default 0: nnu angle pure random, 1: set a specific theta - NNU_D_THETA=0.0873; // default : nnu d_theta : 5 deg + NNU_THETA=0.785; // default : nnu theta : 45 deg - NNU_THIS_PHI=0;//default 0: random phi, 1: a specific phi + NNU_D_THETA=0.0873; // default : nnu d_theta : 5 deg - NNU_PHI=0.785;// default : nnu phi : 45 deg + NNU_THIS_PHI=0;//default 0: random phi, 1: a specific phi + + NNU_PHI=0.785;// default : nnu phi : 45 deg + + NNU_D_PHI=0.0873;// default : nnu_d_phi : 5 deg - NNU_D_PHI=0.0873;// default : nnu_d_phi : 5 deg - CALPULSER_ON=0; // default : calpulsers off - + TESTBED_ON=0; // default : 0 stations[0] is ARA1 not Testbed - + READGEOM=0; // default : 0 : use idealized geometry and do not read in from sqlite database - + V_MIMIC_MODE = 0; // default : 0 - write out all chs where global triggered bin is center of the window - // 1 - same as above 0 mode but apply TestBed ch delay - average BH ch delay - // 2 - same as above 0 mode but apply TestBed ch delay - average BH ch delay + additional delay to match with actual TestBed data waveforms - + // 1 - same as above 0 mode but apply TestBed ch delay - average BH ch delay + // 2 - same as above 0 mode but apply TestBed ch delay - average BH ch delay + additional delay to match with actual TestBed data waveforms + USE_INSTALLED_TRIGGER_SETTINGS = 0; // default : 0 - use idealized settings for the trigger - + NUM_INSTALLED_STATIONS = 4; CALPUL_OFFCONE_ANGLE = 35.; @@ -194,7 +189,7 @@ outputdir="outputs"; // directory where outputs go CONST_RMSDIODE = 1.346e-13; // also from one run USE_MANUAL_GAINOFFSET = 0; //if use gain offset file to read values or just use constant gain offset from setup file (default 0 : use file) - + MANUAL_GAINOFFSET_VALUE = 1.; // gain offset value NOISE_WAVEFORM_GENERATE_MODE = 0; // mode 0 (default) will generate noise waveforms newly for each events. other values will use first generated noise waveforms for later events (huge mem usage) @@ -253,7 +248,7 @@ outputdir="outputs"; // directory where outputs go ACCUM_TRIG_SEARCH_BINS_STATION0 = 0.; // not actually setting value but gives us how much trigger searched bins there were in the run for station0 - NU_NUBAR_SELECT_MODE = 3; // default : 3 = random nu_nubar based on arXiv:1108.3163, section 3, 0 = just nu, 1 = just nubar + NU_NUBAR_SELECT_MODE = 3; // default : 3 = random nu_nubar based on arXiv:1108.3163, section 3, 0 = just nu, 1 = just nubar SELECT_FLAVOR = 0; // default : 0 = randomly 1:1:1 ratio, 1 : el. 2 : mu, 3 : tau @@ -269,7 +264,7 @@ outputdir="outputs"; // directory where outputs go RAY_TRACE_ICE_MODEL_PARAMS=0; // Default: South Pole values fitted from RICE data WAVEFORM_LENGTH = 64/2*20; // Default: 64 digitization samples per block / 2 samples per waveform value * 20 blocks (value used for 2013-2016) - + WAVEFORM_CENTER = 0; // Default: 0, no offset in waveform centering POSNU_R = 1000.; @@ -286,9 +281,8 @@ outputdir="outputs"; // directory where outputs go CUSTOM_ELECTRONICS=0; //default: 0 -- don't use custom electronics, load regular "ARA_Electronics_TotalGain_TwoFilter.tst" - /* -//arrays for saving read in event features in EVENT_GENERATION_MODE=1 + //arrays for saving read in event features in EVENT_GENERATION_MODE=1 EVID[100] = {0}; NUFLAVORINT[100] = {0}; NUBAR[100] = {0}; @@ -300,364 +294,393 @@ outputdir="outputs"; // directory where outputs go IND_NNU_THETA[100] = {0}; IND_NNU_PHI[100] = {0}; */ + + DETECTOR_STATION=2; //default: 2, meaning ARA02 (A2) + DETECTOR_STATION_LIVETIME_CONFIG=0; //default 0: no special config + + USE_SIGNAL_CHAIN_LOWER_BOUND = 0; // default: 0 -- don't replace signal chain efficiency with lower bound. 1: replace with lower bound + SC_EFFICIENCY_ERROR_V = 0.9; //Lower bound of Vpol signal chain efficiency + SC_EFFICIENCY_ERROR_H = 0.68; //Lower bound of Hpol signal chain efficiency + SYSTEMATICS_IceAtten = 0; //Default: Average value (red line) from Eugene's attenuation model (http://radiorm.physics.ohio-state.edu/elog/Write-Ups/170504_105713/Thesis_-_Eugene_Hong.pdf, p. 54), 1 = lower bound, 2 = upper bound + SYSTEMATICS_Askaryan = 0; //Default:askaryan signal is not changed at all. =1 scale up the askaryan signal by 12%, =2 scale down the askaryan signal by 12%. The 12% comes from Eugene's thesis, Fg. 5.12. + SYSTEMATICS_nofz = 0; // = 0 = default = do nothing; for NOFZ=1 and RAY_TRACE_ICE_MODEL_PARAMS=0, apply the upper bound (=1) and lower bound (=2) + } void Settings::ReadFile(string setupfile) { - ifstream setFile (setupfile.c_str()); - - string line, label; + ifstream setFile (setupfile.c_str()); - if ( setFile.is_open() ) { - while (setFile.good() ) { - getline (setFile,line); + string line, label; - if (line[0] != "/"[0]) { - label = line.substr(0, line.find_first_of("=")); - - if (label == "NNU") { - NNU = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ICE_MODEL") { - ICE_MODEL = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOFZ") { - NOFZ = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CONSTANTCRUST") { - CONSTANTCRUST = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CONSTANTICETHICKNESS") { - CONSTANTICETHICKNESS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "FIXEDELEVATION") { - FIXEDELEVATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "MOOREBAY") { - MOOREBAY = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "EXPONENT") { - EXPONENT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DETECTOR") { - DETECTOR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DETECTOR_STATION") { - DETECTOR_STATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "INTERACTION_MODE") { - INTERACTION_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "POSNU_RADIUS") { - POSNU_RADIUS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "WHICHPARAMETERIZATION") { - WHICHPARAMETERIZATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SIMULATION_MODE") { - SIMULATION_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "EVENT_TYPE") { - EVENT_TYPE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "WAVE_TYPE") { - WAVE_TYPE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "LPM") { - LPM = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SECONDARIES") { - SECONDARIES = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TAUDECAY") { - TAUDECAY = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TIMESTEP") { - TIMESTEP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "PHASE") { - PHASE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NFOUR") { - NFOUR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOISE") { - NOISE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ATMOSPHERE") { - ATMOSPHERE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if(label == "TRIG_SCAN_MODE"){ - TRIG_SCAN_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "POWERTHRESHOLD") { - POWERTHRESHOLD = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DATA_BIN_SIZE") { - DATA_BIN_SIZE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOISE_TEMP") { - NOISE_TEMP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_ANALYSIS_MODE") { - TRIG_ANALYSIS_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_TIMEOUT") { - TRIG_TIMEOUT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_WINDOW") { - TRIG_WINDOW = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOISE_EVENTS") { - NOISE_EVENTS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DATA_SAVE_MODE") { - DATA_SAVE_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "N_TRIG") { - N_TRIG = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "RANDOM_MODE") { - RANDOM_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SEED") { - SEED = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "BORE_HOLE_ANTENNA_LAYOUT") { - BORE_HOLE_ANTENNA_LAYOUT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "RAYSOL_RANGE") { - RAYSOL_RANGE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CALPULSER_ON") { - CALPULSER_ON = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TESTBED_ON") { - TESTBED_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "READGEOM") { - cout << "Read in READGEOM" << endl; - READGEOM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "PICK_POSNU_DEPTH") { - PICK_POSNU_DEPTH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "MAX_POSNU_DEPTH") { - MAX_POSNU_DEPTH = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_THIS_THETA") { - NNU_THIS_THETA = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_THETA") { - NNU_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_D_THETA") { - NNU_D_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_THIS_PHI") { - NNU_THIS_PHI = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_PHI") { - NNU_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_D_PHI") { - NNU_D_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } + if ( setFile.is_open() ) { + while (setFile.good() ) { + getline (setFile,line); + if (line[0] != "/"[0]) { - else if (label == "DATA_LIKE_OUTPUT") { - DATA_LIKE_OUTPUT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "V_MIMIC_MODE") { - V_MIMIC_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "USE_INSTALLED_TRIGGER_SETTINGS") { - USE_INSTALLED_TRIGGER_SETTINGS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NUM_INSTALLED_STATIONS") { - NUM_INSTALLED_STATIONS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CALPUL_OFFCONE_ANGLE") { - CALPUL_OFFCONE_ANGLE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CALPUL_AMP") { - CALPUL_AMP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_ONLY_BH_ON") { - TRIG_ONLY_BH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_THRES_MODE") { - TRIG_THRES_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOISE_CHANNEL_MODE") { - NOISE_CHANNEL_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CONST_MEANDIODE") { - CONST_MEANDIODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "CONST_RMSDIODE") { - CONST_RMSDIODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "USE_TESTBED_RFCM_ON") { - USE_TESTBED_RFCM_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + label = line.substr(0, line.find_first_of("=")); + + if (label == "NNU") { + NNU = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ICE_MODEL") { + ICE_MODEL = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOFZ") { + NOFZ = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CONSTANTCRUST") { + CONSTANTCRUST = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CONSTANTICETHICKNESS") { + CONSTANTICETHICKNESS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "FIXEDELEVATION") { + FIXEDELEVATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "MOOREBAY") { + MOOREBAY = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "EXPONENT") { + EXPONENT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DETECTOR") { + DETECTOR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DETECTOR_STATION") { + DETECTOR_STATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DETECTOR_STATION_LIVETIME_CONFIG") { + DETECTOR_STATION_LIVETIME_CONFIG = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "INTERACTION_MODE") { + INTERACTION_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "POSNU_RADIUS") { + POSNU_RADIUS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "WHICHPARAMETERIZATION") { + WHICHPARAMETERIZATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SIMULATION_MODE") { + SIMULATION_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "EVENT_TYPE") { + EVENT_TYPE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "WAVE_TYPE") { + WAVE_TYPE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "LPM") { + LPM = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SECONDARIES") { + SECONDARIES = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TAUDECAY") { + TAUDECAY = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TIMESTEP") { + TIMESTEP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "PHASE") { + PHASE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NFOUR") { + NFOUR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOISE") { + NOISE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ATMOSPHERE") { + ATMOSPHERE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if(label == "TRIG_SCAN_MODE"){ + TRIG_SCAN_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "POWERTHRESHOLD") { + POWERTHRESHOLD = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DATA_BIN_SIZE") { + DATA_BIN_SIZE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOISE_TEMP") { + NOISE_TEMP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_ANALYSIS_MODE") { + TRIG_ANALYSIS_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_TIMEOUT") { + TRIG_TIMEOUT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_WINDOW") { + TRIG_WINDOW = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOISE_EVENTS") { + NOISE_EVENTS = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DATA_SAVE_MODE") { + DATA_SAVE_MODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "N_TRIG") { + N_TRIG = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "RANDOM_MODE") { + RANDOM_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SEED") { + SEED = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "BORE_HOLE_ANTENNA_LAYOUT") { + BORE_HOLE_ANTENNA_LAYOUT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "RAYSOL_RANGE") { + RAYSOL_RANGE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CALPULSER_ON") { + CALPULSER_ON = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TESTBED_ON") { + TESTBED_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "READGEOM") { + cout << "Read in READGEOM" << endl; + READGEOM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "PICK_POSNU_DEPTH") { + PICK_POSNU_DEPTH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "MAX_POSNU_DEPTH") { + MAX_POSNU_DEPTH = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_THIS_THETA") { + NNU_THIS_THETA = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_THETA") { + NNU_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_D_THETA") { + NNU_D_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_THIS_PHI") { + NNU_THIS_PHI = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_PHI") { + NNU_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_D_PHI") { + NNU_D_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DATA_LIKE_OUTPUT") { + DATA_LIKE_OUTPUT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "V_MIMIC_MODE") { + V_MIMIC_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "USE_INSTALLED_TRIGGER_SETTINGS") { + USE_INSTALLED_TRIGGER_SETTINGS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NUM_INSTALLED_STATIONS") { + NUM_INSTALLED_STATIONS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CALPUL_OFFCONE_ANGLE") { + CALPUL_OFFCONE_ANGLE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CALPUL_AMP") { + CALPUL_AMP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_ONLY_BH_ON") { + TRIG_ONLY_BH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_THRES_MODE") { + TRIG_THRES_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOISE_CHANNEL_MODE") { + NOISE_CHANNEL_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CONST_MEANDIODE") { + CONST_MEANDIODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "CONST_RMSDIODE") { + CONST_RMSDIODE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "USE_TESTBED_RFCM_ON") { + USE_TESTBED_RFCM_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "RFCM_OFFSET") { + RFCM_OFFSET = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "USE_MANUAL_GAINOFFSET") { + USE_MANUAL_GAINOFFSET = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "MANUAL_GAINOFFSET_VALUE") { + MANUAL_GAINOFFSET_VALUE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NOISE_WAVEFORM_GENERATE_MODE") { + NOISE_WAVEFORM_GENERATE_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "USE_CH_GAINOFFSET") { + USE_CH_GAINOFFSET = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + //else if (label == "GETCHORD_MODE") { + //GETCHORD_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + //} + else if (label == "taumodes") { + taumodes = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "BH_ANT_SEP_DIST_ON") { + BH_ANT_SEP_DIST_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_MODE") { + TRIG_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "N_TRIG_V") { + N_TRIG_V = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "N_TRIG_H") { + N_TRIG_H = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "FILL_TREE_MODE") { + FILL_TREE_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ONLY_PASSED_EVENTS") { + ONLY_PASSED_EVENTS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NNU_PASSED") { + NNU_PASSED = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "PICKNEARUNBIASED_R") { + PICKNEARUNBIASED_R = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SHOWER_MODE") { + SHOWER_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SHOWER_STEP") { + SHOWER_STEP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SHOWER_PARAM_MODEL") { + SHOWER_PARAM_MODEL = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ALL_ANT_V_ON") { + ALL_ANT_V_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "PHASE_SKIP_MODE") { + PHASE_SKIP_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DEBUG_MODE_ON") { + DEBUG_MODE_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "DEBUG_SKIP_EVT") { + DEBUG_SKIP_EVT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "V_SATURATION") { + V_SATURATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "OFFCONE_LIMIT") { + OFFCONE_LIMIT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ADDITIONAL_DEPTH_ON") { + ADDITIONAL_DEPTH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ADDITIONAL_DEPTH") { + ADDITIONAL_DEPTH = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "TRIG_ONLY_LOW_CH_ON") { + TRIG_ONLY_LOW_CH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "USE_ARA_ICEATTENU") { + USE_ARA_ICEATTENU = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SIGMA_SELECT") { + SIGMA_SELECT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SIGMAPARAM") { + SIGMAPARAM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SIGMA_FACTOR") { + SIGMA_FACTOR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "YPARAM") { + YPARAM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ELAST_Y") { + ELAST_Y = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "NU_NUBAR_SELECT_MODE") { + NU_NUBAR_SELECT_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SELECT_FLAVOR") { + SELECT_FLAVOR = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "SELECT_CURRENT") { + SELECT_CURRENT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "OUTPUT_TDR_GRAPH") { + OUTPUT_TDR_GRAPH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "AVZ_NORM_FACTOR_MODE") { + AVZ_NORM_FACTOR_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "number_of_stations") { + number_of_stations = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "RAY_TRACE_ICE_MODEL_PARAMS") { + RAY_TRACE_ICE_MODEL_PARAMS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "WAVEFORM_LENGTH") { + WAVEFORM_LENGTH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "WAVEFORM_CENTER") { + WAVEFORM_CENTER = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "POSNU_R") { + POSNU_R = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "POSNU_THETA") { + POSNU_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "POSNU_PHI") { + POSNU_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "ARBITRARY_EVENT_ATTENUATION") { + ARBITRARY_EVENT_ATTENUATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "PICK_ABOVE_HEIGHT") { + PICK_ABOVE_HEIGHT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); + } + else if (label == "EVENT_GENERATION_MODE"){ + EVENT_GENERATION_MODE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + // else if (label == "EVENT_NUM"){ + // EVENT_NUM = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + // } + else if (label == "ANTENNA_MODE"){ + ANTENNA_MODE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "APPLY_NOISE_FIGURE"){ + APPLY_NOISE_FIGURE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "CUSTOM_ELECTRONICS"){ + CUSTOM_ELECTRONICS = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "USE_SIGNAL_CHAIN_LOWER_BOUND"){ + USE_SIGNAL_CHAIN_LOWER_BOUND = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "SC_EFFICIENCY_ERROR_V"){ + SC_EFFICIENCY_ERROR_V = atof(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "SC_EFFICIENCY_ERROR_H"){ + SC_EFFICIENCY_ERROR_H = atof(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "SYSTEMATICS_IceAtten"){ + SYSTEMATICS_IceAtten = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "SYSTEMATICS_Askaryan"){ + SYSTEMATICS_Askaryan = atoi(line.substr(line.find_first_of("=") + 1).c_str()); + } + else if (label == "SYSTEMATICS_nofz"){ + SYSTEMATICS_nofz = atoi(line.substr(line.find_first_of("=") + 1).c_str()); } - else if (label == "RFCM_OFFSET") { - RFCM_OFFSET = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "USE_MANUAL_GAINOFFSET") { - USE_MANUAL_GAINOFFSET = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "MANUAL_GAINOFFSET_VALUE") { - MANUAL_GAINOFFSET_VALUE = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NOISE_WAVEFORM_GENERATE_MODE") { - NOISE_WAVEFORM_GENERATE_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "USE_CH_GAINOFFSET") { - USE_CH_GAINOFFSET = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - //else if (label == "GETCHORD_MODE") { - //GETCHORD_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - //} - else if (label == "taumodes") { - taumodes = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "BH_ANT_SEP_DIST_ON") { - BH_ANT_SEP_DIST_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_MODE") { - TRIG_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "N_TRIG_V") { - N_TRIG_V = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "N_TRIG_H") { - N_TRIG_H = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "FILL_TREE_MODE") { - FILL_TREE_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ONLY_PASSED_EVENTS") { - ONLY_PASSED_EVENTS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NNU_PASSED") { - NNU_PASSED = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "PICKNEARUNBIASED_R") { - PICKNEARUNBIASED_R = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SHOWER_MODE") { - SHOWER_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SHOWER_STEP") { - SHOWER_STEP = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SHOWER_PARAM_MODEL") { - SHOWER_PARAM_MODEL = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ALL_ANT_V_ON") { - ALL_ANT_V_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "PHASE_SKIP_MODE") { - PHASE_SKIP_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DEBUG_MODE_ON") { - DEBUG_MODE_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "DEBUG_SKIP_EVT") { - DEBUG_SKIP_EVT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "V_SATURATION") { - V_SATURATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "OFFCONE_LIMIT") { - OFFCONE_LIMIT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ADDITIONAL_DEPTH_ON") { - ADDITIONAL_DEPTH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ADDITIONAL_DEPTH") { - ADDITIONAL_DEPTH = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "TRIG_ONLY_LOW_CH_ON") { - TRIG_ONLY_LOW_CH_ON = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "USE_ARA_ICEATTENU") { - USE_ARA_ICEATTENU = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SIGMA_SELECT") { - SIGMA_SELECT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SIGMAPARAM") { - SIGMAPARAM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SIGMA_FACTOR") { - SIGMA_FACTOR = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "YPARAM") { - YPARAM = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ELAST_Y") { - ELAST_Y = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "NU_NUBAR_SELECT_MODE") { - NU_NUBAR_SELECT_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SELECT_FLAVOR") { - SELECT_FLAVOR = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "SELECT_CURRENT") { - SELECT_CURRENT = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "OUTPUT_TDR_GRAPH") { - OUTPUT_TDR_GRAPH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "AVZ_NORM_FACTOR_MODE") { - AVZ_NORM_FACTOR_MODE = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "number_of_stations") { - number_of_stations = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "RAY_TRACE_ICE_MODEL_PARAMS") { - RAY_TRACE_ICE_MODEL_PARAMS = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "WAVEFORM_LENGTH") { - WAVEFORM_LENGTH = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "WAVEFORM_CENTER") { - WAVEFORM_CENTER = atoi( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "POSNU_R") { - POSNU_R = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "POSNU_THETA") { - POSNU_THETA = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "POSNU_PHI") { - POSNU_PHI = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "ARBITRARY_EVENT_ATTENUATION") { - ARBITRARY_EVENT_ATTENUATION = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "PICK_ABOVE_HEIGHT") { - PICK_ABOVE_HEIGHT = atof( line.substr(line.find_first_of("=") + 1).c_str() ); - } - else if (label == "EVENT_GENERATION_MODE"){ - EVENT_GENERATION_MODE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); - } - // else if (label == "EVENT_NUM"){ - // EVENT_NUM = atoi(line.substr(line.find_first_of("=") + 1).c_str()); - // } - else if (label == "ANTENNA_MODE"){ - ANTENNA_MODE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); - } - else if (label == "APPLY_NOISE_FIGURE"){ - APPLY_NOISE_FIGURE = atoi(line.substr(line.find_first_of("=") + 1).c_str()); - } - else if (label == "CUSTOM_ELECTRONICS"){ - CUSTOM_ELECTRONICS = atoi(line.substr(line.find_first_of("=") + 1).c_str()); - } - - } @@ -683,7 +706,9 @@ void Settings::ReadEvtFile(string evtfile){ double d, f, g, h, i, j, k; if (!(iss >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j >> k)) break; -/* EVID[i] = atoi(a.c_str()); + + /* + EVID[i] = atoi(a.c_str()); NUFLAVORINT[i] = atoi(b.c_str()); NUBAR[i] = atoi(c.c_str()); PNU[i] = atof(d.c_str()); @@ -693,8 +718,8 @@ void Settings::ReadEvtFile(string evtfile){ Z[i] = atof(h.c_str()); THETA[i] = atof(i.c_str()); PHI[i] = atof(j.c_str()); -*/ -/* + */ + /* EVID[l] = a; NUFLAVORINT[l] = b; NUBAR[l] = c; @@ -705,7 +730,7 @@ void Settings::ReadEvtFile(string evtfile){ IND_POSNU_PHI[l] = h; IND_NNU_THETA[l] = i; IND_NNU_PHI[l] = j; -*/ + */ EVID.push_back(a); NUFLAVORINT.push_back(b); NUBAR.push_back(c); @@ -723,11 +748,10 @@ void Settings::ReadEvtFile(string evtfile){ } } evtFile.close(); - if (NNU == 0 || NNU > EVID.size()){ - // EVENT_NUM = EVID.size(); - NNU = EVID.size(); - } - + if (NNU == 0 || NNU > EVID.size()){ + // EVENT_NUM = EVID.size(); + NNU = EVID.size(); + } } else cout << "Unable to open " << evtfile << " file!" << endl; @@ -778,8 +802,8 @@ int Settings::CheckCompatibilitiesDetector(Detector *detector) { // check if there's enough system temperature values prepared for NOISE_CHANNEL_MODE=1 if (NOISE_CHANNEL_MODE==1) {// use different system temperature values for different chs - if (DETECTOR==3 && (detector->params.number_of_antennas > (int)(detector->Temp_TB_ch.size())) ) { - cout << detector->params.number_of_antennas << " : " <<(int)(detector->Temp_TB_ch.size()) << endl; + if (DETECTOR==3 && (detector->params.number_of_antennas > (int)(detector->Temp_TB_ch.size())) ) { + cout << detector->params.number_of_antennas << " : " <<(int)(detector->Temp_TB_ch.size()) << endl; cerr<<"System temperature values are not enough for all channels! Check number of channels you are using and numbers in data/system_temperature.csv"< 0 && (USE_ARA_ICEATTENU==0)) { + cerr<<"SYSTEMATICS_IceAtten=1,2 doesn't work with USE_ARA_ICEATTENU=0"<= NUM_INSTALLED_STATIONS){ - cerr << "DETECTOR_STATION is not set to a valid station number" << endl; - num_err++; - } - - } + if (ARAUTIL_EXISTS == false){ + cerr << "DETECTOR=4 only works with an installation of AraRoot" << endl; + num_err++; + } else { + + cerr << "DETECTOR is set to 4" << endl; + cerr << "Setting READGEOM to 1" << endl; + READGEOM=1; + + cerr << "Setting number_of_stations to 1" << endl; + number_of_stations = 1; + + if (DETECTOR_STATION <0 || DETECTOR_STATION >= NUM_INSTALLED_STATIONS){ + cerr << "DETECTOR_STATION is not set to a valid station number" << endl; + num_err++; + } + if(DETECTOR_STATION_LIVETIME_CONFIG>0){ + if((int)DETECTOR_STATION==2 || (int)DETECTOR_STATION==3){ + cerr<<"DETECTOR_STATION_LIVETIME_CONFIG is set to "<5){ + cerr<<" DETECTOR_STATION_LIVETIME_CONFIG is set to "< 0){ + cerr<<"USE_SIGNAL_CHAIN_LOWER_BOUND>0 doesn't work with ANTENNA_MODE!=1"< 0){ + cerr<<"USE_SIGNAL_CHAIN_LOWER_BOUND>0 doesn't work with DETECTOR!=4."< 0){ + cerr<<"USE_SIGNAL_CHAIN_LOWER_BOUND>0 doesn't work with DETECTOR_STATION==0. The signal chain measurements are done with ARA deep stations."<0 && RAY_TRACE_ICE_MODEL_PARAMS!=0){ + cerr<<"SYSTEMATICS_nofz>0 only works with the default AraSim model RAY_TRACE_ICE_MODEL_PARAMS=0."< EVID; vector NUFLAVORINT; vector NUBAR; @@ -305,125 +309,130 @@ class Settings - // below : values from icemc - - - int UNBIASED_SELECTION; - int WHICH; // which payload to use 0=Anita-lite,1=Ross,2=Smex,3=make your own - int CYLINDRICALSYMMETRY; // is it cylindrically symmetric =1 if which=1,2, =0 if which=0 - // if which=3 then 0 or 1 - double SIGMA_FACTOR; // factor to multiply cross section by for error analysis - int SIGMAPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization - int YPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization, 2 = a specific elast_y - double ELAST_Y; + // below : values from icemc + + int UNBIASED_SELECTION; + int WHICH; // which payload to use 0=Anita-lite,1=Ross,2=Smex,3=make your own + int CYLINDRICALSYMMETRY; // is it cylindrically symmetric =1 if which=1,2, =0 if which=0 + // if which=3 then 0 or 1 + double SIGMA_FACTOR; // factor to multiply cross section by for error analysis + int SIGMAPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization + int YPARAM; // 0=Reno, 1=Connolly et al. 2011 for cross section parametrization, 2 = a specific elast_y + double ELAST_Y; - int SIGMA_SELECT; // when in SIGMAPARAM=1 case, 0 : (default) use mean value, 1 : use upper bound, 2 : use lower bound + int SIGMA_SELECT; // when in SIGMAPARAM=1 case, 0 : (default) use mean value, 1 : use upper bound, 2 : use lower bound - int SIGNAL_FLUCT; // 1=add noise fluctuation to signal or 0=do not - int TRIGGERSCHEME; // frequency domain voltage, frequency domain energy, time domain diode integration - int ZEROSIGNAL; // zero the signal to see how many of our hits are noise hits - int REMOVEPOLARIZATION; //Disable polarizations - - int EVENTSMAP;//whether draw the events distribution map - - int WHICHRAYS; // how many rays to look at (1) direct only (2) direct and down-going. + int SIGNAL_FLUCT; // 1=add noise fluctuation to signal or 0=do not + int TRIGGERSCHEME; // frequency domain voltage, frequency domain energy, time domain diode integration + int ZEROSIGNAL; // zero the signal to see how many of our hits are noise hits + int REMOVEPOLARIZATION; //Disable polarizations -// trigger -int LCPRCP; // 1 for circular polarization trigger, 0 for V and H -int JUSTVPOL; // 0 for both polarizations, 1 for just V polarization -// doesn't allow for both LCPRCP=1 and JUSTVPOL=1 -//int FIFTHBAND; // 1 to include 0.2-1.2 GHz as a frequency band if JUSTVPOL==1 -//int NFOLD=3; // how many channels must pass the trigger - in old mechanism - only used for anita-lite -int NFOLD; // how many channels must pass the trigger - in old mechanism - only used for anita-lite + int EVENTSMAP;//whether draw the events distribution map + int WHICHRAYS; // how many rays to look at (1) direct only (2) direct and down-going. -//int CHMASKING=1; // whether or not to include channel masking -//int PHIMASKING=1; // whether or not to include phi masking -int CHMASKING; // whether or not to include channel masking -int PHIMASKING; // whether or not to include phi masking + // trigger + int LCPRCP; // 1 for circular polarization trigger, 0 for V and H + int JUSTVPOL; // 0 for both polarizations, 1 for just V polarization + // doesn't allow for both LCPRCP=1 and JUSTVPOL=1 + //int FIFTHBAND; // 1 to include 0.2-1.2 GHz as a frequency band if JUSTVPOL==1 + //int NFOLD=3; // how many channels must pass the trigger - in old mechanism - only used for anita-lite + int NFOLD; // how many channels must pass the trigger - in old mechanism - only used for anita-lite -//int NLAYERS=0; -//int NANTENNAS=0; -int NLAYERS; -int NANTENNAS; + //int CHMASKING=1; // whether or not to include channel masking + //int PHIMASKING=1; // whether or not to include phi masking + int CHMASKING; // whether or not to include channel masking + int PHIMASKING; // whether or not to include phi masking -/* int ONLYFINAL=1; // only write to final histogram */ -/* int HIST_MAX_ENTRIES=10000; //maximum number of events to put in histograms */ -/* int HIST=1; //write to histograms */ + //int NLAYERS=0; + //int NANTENNAS=0; -int ONLYFINAL; // only write to final histogram -int HIST_MAX_ENTRIES; //maximum number of events to put in histograms -int HIST; //write to histograms -double BW; // BANDWIDTH -//int DISCONES=1; // whether or not to use discones -int DISCONES; // whether or not to use discones + int NLAYERS; + int NANTENNAS; -//double NDISCONES_PASS=3; // number of discones needed to pass -double NDISCONES_PASS; // number of discones needed to pass + /* int ONLYFINAL=1; // only write to final histogram */ + /* int HIST_MAX_ENTRIES=10000; //maximum number of events to put in histograms */ + /* int HIST=1; //write to histograms */ -int BORESIGHTS; // whether to loop over boresights -int SLAC; // whether or not we are simulating the slac run -double SLACSLOPE; // slope of the ice -double SLACICELENGTH; // length of the block of ice -double SLAC_HORIZDIST; // horizontal distance from interaction to center of payload at slac beam test -double SLAC_DEPTH; // vertical depth of interaction at slac beam test -double SLAC_HORIZ_DEPTH; // horizontal depth of interaction at slac + int ONLYFINAL; // only write to final histogram + int HIST_MAX_ENTRIES; //maximum number of events to put in histograms + int HIST; //write to histograms + double BW; // BANDWIDTH + //int DISCONES=1; // whether or not to use discones + int DISCONES; // whether or not to use discones -int ROUGHNESS; // include effects of surface roughness -int FIRN; // whether or not to include the firn + //double NDISCONES_PASS=3; // number of discones needed to pass + double NDISCONES_PASS; // number of discones needed to pass -//int SLOPEY=1; // 1=slopeyness on, 0=slopeyness off -//double SLOPEYSIZE=0.012; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean) + int BORESIGHTS; // whether to loop over boresights + int SLAC; // whether or not we are simulating the slac run + double SLACSLOPE; // slope of the ice + double SLACICELENGTH; // length of the block of ice + double SLAC_HORIZDIST; // horizontal distance from interaction to center of payload at slac beam test + double SLAC_DEPTH; // vertical depth of interaction at slac beam test + double SLAC_HORIZ_DEPTH; // horizontal depth of interaction at slac -int SLOPEY; // 1=slopeyness on, 0=slopeyness off -double SLOPEYSIZE; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean) + int ROUGHNESS; // include effects of surface roughness + int FIRN; // whether or not to include the firn - bool DEBUG; -string outputdir; // directory where outputs go + //int SLOPEY=1; // 1=slopeyness on, 0=slopeyness off + //double SLOPEYSIZE=0.012; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean) -//double THERMALNOISE_FACTOR=1.0; // factor to multiply thermal noise for error analysis -double THERMALNOISE_FACTOR; // factor to multiply thermal noise for error analysis + int SLOPEY; // 1=slopeyness on, 0=slopeyness off + double SLOPEYSIZE; // This determines size of the slopeyness (0.10=5.4, 0.20=7.4 deg mean) -//double FREQ_LOW_SEAVEYS=200.E6; // min frequency for seaveys -//const double FREQ_HIGH_SEAVEYS=1200.E6; // max frequency for seaveys + bool DEBUG; + string outputdir; // directory where outputs go -double FREQ_LOW_SEAVEYS; // min frequency for seaveys -double FREQ_HIGH_SEAVEYS; // max frequency for seaveys - double BW_SEAVEYS; - //int FORSECKEL=1; // Make array of strength of signal across frequencies for different viewing angles. -int FORSECKEL; // Make array of strength of signal across frequencies for different viewing angles. + //double THERMALNOISE_FACTOR=1.0; // factor to multiply thermal noise for error analysis + double THERMALNOISE_FACTOR; // factor to multiply thermal noise for error analysis -double ROUGHSIZE; // roughness size + //double FREQ_LOW_SEAVEYS=200.E6; // min frequency for seaveys + //const double FREQ_HIGH_SEAVEYS=1200.E6; // max frequency for seaveys + double FREQ_LOW_SEAVEYS; // min frequency for seaveys + double FREQ_HIGH_SEAVEYS; // max frequency for seaveys + double BW_SEAVEYS; + //int FORSECKEL=1; // Make array of strength of signal across frequencies for different viewing angles. + int FORSECKEL; // Make array of strength of signal across frequencies for different viewing angles. -/* int ICE_MODEL=0; //Select ice model to be used. 0 = Crust 2.0 , 1 = BEDMAP. */ -/* int NOFZ=1; // 1=depth dependent index of refraction,0=off */ -/* int CONSTANTCRUST=0; // set crust density and thickness to constant values. */ -/* int CONSTANTICETHICKNESS=0; // set ice thickness to constant value */ -/* int FIXEDELEVATION=0; // fix the elevation to the thickness of ice. */ -/* int MOOREBAY=0; //1=use Moore's Bay measured ice field attenuation length for the west land, otherwise use South Pole data */ -/* int USEPOSITIONWEIGHTS=1;// whether or not to restrict the neutrino position so it is within the horizon of the balloon */ -/* int WRITE_FILE=0; //Select whether or not to write a new input file for CreateHorizons */ + double ROUGHSIZE; // roughness size -int USEPOSITIONWEIGHTS;// whether or not to restrict the neutrino position so it is within the horizon of the balloon -int WRITE_FILE; //Select whether or not to write a new input file for CreateHorizons -int MINRAY; -int MAXRAY; + /* int ICE_MODEL=0; //Select ice model to be used. 0 = Crust 2.0 , 1 = BEDMAP. */ + /* int NOFZ=1; // 1=depth dependent index of refraction,0=off */ + /* int CONSTANTCRUST=0; // set crust density and thickness to constant values. */ + /* int CONSTANTICETHICKNESS=0; // set ice thickness to constant value */ + /* int FIXEDELEVATION=0; // fix the elevation to the thickness of ice. */ + /* int MOOREBAY=0; //1=use Moore's Bay measured ice field attenuation length for the west land, otherwise use South Pole data */ + /* int USEPOSITIONWEIGHTS=1;// whether or not to restrict the neutrino position so it is within the horizon of the balloon */ + /* int WRITE_FILE=0; //Select whether or not to write a new input file for CreateHorizons */ -int horizontal_banana_points; - int vertical_banana_points; + int USEPOSITIONWEIGHTS;// whether or not to restrict the neutrino position so it is within the horizon of the balloon + int WRITE_FILE; //Select whether or not to write a new input file for CreateHorizons + int MINRAY; + int MAXRAY; + //Implemented for signal chain calibration uncertainty estimate - 12/17/2019 MYL + int USE_SIGNAL_CHAIN_LOWER_BOUND; //Switch to replace the signal chain efficiency by its error lower bound. Use this for systematic estimation. Default 0: do not use lower bound. 1: use lower bound. + double SC_EFFICIENCY_ERROR_V; //Total estimated signal chain efficiency error for Vpol from Meures. Measured in power. Only used when USE_SIGNAL_CHAIN_LOWER_BOUND=1. Default: 0.9, representing a 10% deficiency + double SC_EFFICIENCY_ERROR_H; //Total estimated signal chain efficiency error for Hpol from Meures. Measured in power. Only used when USE_SIGNAL_CHAIN_LOWER_BOUND=1. Default: 0.68, representing a 32% deficiency - // end of values from icemc + int horizontal_banana_points; + int vertical_banana_points; + int SYSTEMATICS_IceAtten; //Default: Average value (red line) from Eugene's attenuation model (http://radiorm.physics.ohio-state.edu/elog/Write-Ups/170504_105713/Thesis_-_Eugene_Hong.pdf, p. 54), 1 = lower bound, 2 = upper bound + int SYSTEMATICS_Askaryan; //Default:askaryan signal is not changed at all. =1 scale up the askaryan signal by 12%, =2 scale down the askaryan signal by 12%. The 12% comes from Eugene's thesis, Fg. 5.12. + int SYSTEMATICS_nofz; // = 0 = default = do nothing; for NOFZ=1 and RAY_TRACE_ICE_MODEL_PARAMS=0, apply the upper bound (=1) and lower bound (=2) - ClassDef(Settings,1); + // end of values from icemc + + + ClassDef(Settings,1); }; #endif - diff --git a/Spectra.cc b/Spectra.cc index 4c75763c..a6c8acf4 100644 --- a/Spectra.cc +++ b/Spectra.cc @@ -33,7 +33,7 @@ Spectra::Spectra(double EXPONENT) { double Emuons[E_bin]; // E dN/dE/dA/dt for neutrinos that are produced as muon neutrinos or muon antineutrinos. double Eelectrons[E_bin];// E dN/dE/dA/dt for neutrinos that are produced as electron neutrinos or muon antineutrinos. - + for (int i=0;i=510. && EXPONENT_model<=650.) // g.n. added so we can have simulations at E^2=17.8 not just whole numbers { pnu_EXPONENT = (EXPONENT_model - 400)/10; cout<<"**************** energy is "<=10. && EXPONENT_model<30.) { return pow(10.,pnu_EXPONENT); } else { - + while(thisflux>max) { - // pick an energy + // pick an energy thisenergy=Rand3.Rndm()*(maxenergy-minenergy)+minenergy; // pick energy at random between the highest and lowest - // the energy array is actually filled with energy exponents + // the energy array is actually filled with energy exponents // and thisenergy starts from 0 so it has an offset - + energybin=Tools::Getifreq(thisenergy,minenergy,maxenergy,E_bin); //max=gspectrum[(int)EXPONENT]->Eval(thisenergy,0,"S")/maxflux; // this is the maximum the normalized flux can be in this bin, always less than 1 max=EdNdEdAdt[energybin]/maxflux; @@ -394,7 +401,7 @@ double Spectra::GetNuEnergy_bin() { } //while return pow(10.,thisenergy); } - + } //Pick Neutrino Energy @@ -402,7 +409,7 @@ double Spectra::GetNuEnergy_bin() { double Spectra::GetNuEnergy() { - + double thisenergy=16.; // arbitrary initialisation double thisflux=2.; // initialise higher than max double max=1.; @@ -411,19 +418,19 @@ double Spectra::GetNuEnergy() { double minenergy=Tools::dMin(energy,E_bin); // this uses the dartboard approach //cout << "minenergy, maxenergy are " << minenergy << " " << maxenergy << "\n"; - + if ((EXPONENT_model>=10. && EXPONENT_model<30.) || (EXPONENT_model>=510. && EXPONENT_model<=650.)) { return pow(10.,pnu_EXPONENT); } else { - + while(thisflux>max) { - // pick an energy + // pick an energy thisenergy=Rand3.Rndm()*(maxenergy-minenergy)+minenergy; // pick energy at random between the highest and lowest - // the energy array is actually filled with energy exponents + // the energy array is actually filled with energy exponents // and thisenergy starts from 0 so it has an offset - + // get interpolated flux at "thisenergy" max=SimpleLinearInterpolation_value(E_bin, energy, EdNdEdAdt, thisenergy ) / maxflux; // normalize to 1 //cout<<"interpolated max : "<>energy[i]>>E2dNdEdAdt[i]; } - + for(int i=0;i EdN @@ -510,19 +517,19 @@ inline void Spectra::GetFlux(string filename) // TGraph *Spectra::GetGEdNdEdAdt() { // return gEdNdEdAdt; // } -// +// // TGraph *Spectra::GetGE2dNdEdAdt() { // return gE2dNdEdAdt; // } -// +// // TSpline3 *Spectra::GetSEdNdEdAdt() { // return sEdNdEdAdt; // } -// +// // TSpline3 *Spectra::GetSE2dNdEdAdt() { // return sE2dNdEdAdt; // } -//-------------------------------------------------- +//-------------------------------------------------- double *Spectra::Getenergy() { return energy; @@ -609,4 +616,3 @@ int Spectra::IsMonoenergetic() { } return out; } - diff --git a/data/atten_TB_paper_avg.txt b/data/atten_TB_paper_avg.txt new file mode 100644 index 00000000..d6f49c48 --- /dev/null +++ b/data/atten_TB_paper_avg.txt @@ -0,0 +1,34 @@ +#Attenuation model in ice from https://arxiv.org/pdf/1105.2854.pdf, fig 23. Average attenuation length (blue line) +2.76e+2, 2.61e+3 +3.25e+2, 2.53e+3 +3.76e+2, 2.45e+3 +4.32e+2, 2.36e+3 +4.93e+2, 2.28e+3 +5.58e+2, 2.20e+3 +6.24e+2, 2.12e+3 +6.92e+2, 2.04e+3 +7.64e+2, 1.95e+3 +8.38e+2, 1.87e+3 +9.11e+2, 1.79e+3 +9.84e+2, 1.71e+3 +1.06e+3, 1.63e+3 +1.13e+3, 1.55e+3 +1.20e+3, 1.47e+3 +1.27e+3, 1.38e+3 +1.33e+3, 1.30e+3 +1.40e+3, 1.22e+3 +1.46e+3, 1.14e+3 +1.51e+3, 1.06e+3 +1.56e+3, 9.78e+2 +1.61e+3, 8.96e+2 +1.66e+3, 8.13e+2 +1.71e+3, 7.31e+2 +1.75e+3, 6.50e+2 +1.78e+3, 5.70e+2 +1.82e+3, 4.87e+2 +1.86e+3, 4.04e+2 +1.89e+3, 3.20e+2 +1.92e+3, 2.39e+2 +1.96e+3, 1.56e+2 +1.99e+3, 7.24e+1 +2.02e+3, 7.66e+0 diff --git a/data/atten_TB_paper_lower.txt b/data/atten_TB_paper_lower.txt new file mode 100644 index 00000000..17779608 --- /dev/null +++ b/data/atten_TB_paper_lower.txt @@ -0,0 +1,31 @@ +#Attenuation model in ice from https://arxiv.org/pdf/1105.2854.pdf, fig 23. Lower limit attenuation length +3.28e+2, 2.60e+3 +3.91e+2, 2.51e+3 +4.55e+2, 2.42e+3 +5.15e+2, 2.35e+3 +6.01e+2, 2.25e+3 +6.94e+2, 2.14e+3 +7.71e+2, 2.07e+3 +8.46e+2, 1.99e+3 +9.46e+2, 1.89e+3 +1.03e+3, 1.82e+3 +1.11e+3, 1.74e+3 +1.18e+3, 1.67e+3 +1.26e+3, 1.59e+3 +1.36e+3, 1.49e+3 +1.45e+3, 1.39e+3 +1.55e+3, 1.29e+3 +1.63e+3, 1.19e+3 +1.71e+3, 1.10e+3 +1.79e+3, 9.96e+2 +1.87e+3, 8.87e+2 +1.92e+3, 8.02e+2 +1.98e+3, 7.12e+2 +2.03e+3, 6.25e+2 +2.07e+3, 5.37e+2 +2.12e+3, 4.43e+2 +2.16e+3, 3.55e+2 +2.20e+3, 2.81e+2 +2.25e+3, 1.67e+2 +2.29e+3, 8.31e+1 +2.33e+3, 5.23e+0 diff --git a/data/atten_TB_paper_upper.txt b/data/atten_TB_paper_upper.txt new file mode 100644 index 00000000..8c0dbbe6 --- /dev/null +++ b/data/atten_TB_paper_upper.txt @@ -0,0 +1,29 @@ +#Attenuation model in ice from https://arxiv.org/pdf/1105.2854.pdf, fig 23. Upper limit attenuation length +2.60e+2, 2.60e+3 +3.13e+2, 2.51e+3 +3.70e+2, 2.41e+3 +4.42e+2, 2.30e+3 +5.10e+2, 2.21e+3 +5.85e+2, 2.11e+3 +6.70e+2, 2.00e+3 +7.55e+2, 1.90e+3 +8.34e+2, 1.80e+3 +9.21e+2, 1.70e+3 +9.98e+2, 1.60e+3 +1.08e+3, 1.50e+3 +1.16e+3, 1.40e+3 +1.24e+3, 1.29e+3 +1.31e+3, 1.20e+3 +1.37e+3, 1.11e+3 +1.43e+3, 1.02e+3 +1.47e+3, 9.41e+2 +1.52e+3, 8.56e+2 +1.57e+3, 7.54e+2 +1.60e+3, 6.86e+2 +1.64e+3, 5.98e+2 +1.68e+3, 4.98e+2 +1.72e+3, 3.96e+2 +1.76e+3, 2.82e+2 +1.80e+3, 1.84e+2 +1.84e+3, 8.81e+1 +1.87e+3, 5.81e+0 diff --git a/data/coopersarkar_sigma_nu.csv b/data/coopersarkar_sigma_nu.csv new file mode 100644 index 00000000..450a64b6 --- /dev/null +++ b/data/coopersarkar_sigma_nu.csv @@ -0,0 +1,31 @@ +50,0.32,4.1,-2.3,-2.4,0.1,3.8,-1.9,-2 +100,0.65,3.8,-2,-2,0.2,3.5,-1.8,-1.8 +200,1.3,3.5,-1.8,-1.9,0.41,3.2,-1.6,-1.7 +500,3.2,3.2,-1.7,-1.8,1,2.9,-1.5,-1.5 +1000,6.2,3,-1.6,-1.7,2,2.7,-1.4,-1.5 +2000,12,2.7,-1.6,-1.6,3.8,2.4,-1.3,-1.4 +5000,27,2.3,-1.5,-1.5,8.6,2.1,-1.3,-1.3 +10000,47,2,-1.4,-1.4,15,1.8,-1.2,-1.2 +20000,77,1.8,-1.3,-1.4,26,1.6,-1.1,-1.1 +50000,140,1.5,-1.2,-1.2,49,1.3,-1,-1.1 +100000,210,1.4,-1.2,-1.2,75,1.2,-1,-1 +200000,310,1.5,-1.1,-1.1,110,1.2,-0.9,-0.9 +500000,490,1.6,-1,-1,180,1.3,-0.8,-0.8 +1.00E+06,690,1.7,-0.9,-0.9,260,1.4,-0.8,-0.8 +2.00E+06,950,1.9,-0.9,-0.9,360,1.6,-0.8,-0.8 +5.00E+06,1400,2,-0.9,-0.9,540,1.8,-0.8,-0.8 +1.00E+07,1900,2.2,-0.9,-0.9,730,2,-0.8,-0.8 +2.00E+07,2600,2.3,-0.9,-1,980,2.2,-0.8,-0.9 +5.00E+07,3700,2.5,-0.9,-1.2,1400,2.4,-0.9,-1.1 +1.00E+08,4800,2.7,-0.9,-1.5,1900,2.6,-0.9,-1.3 +2.00E+08,6200,2.8,-1,-2,2400,2.7,-1,-1.8 +5.00E+08,8700,3,-1.1,-3,3400,2.9,-1,-2.6 +1.00E+09,11000,3.1,-1.2,-3.9,4400,3,-1.1,-3.4 +2.00E+09,14000,3.3,-1.2,-5,5600,3.2,-1.2,-4.4 +5.00E+09,19000,3.4,-1.4,-6.8,7600,3.4,-1.3,-6.1 +1.00E+10,24000,3.6,-1.5,-8.5,9600,3.5,-1.4,-7.6 +2.00E+10,30000,3.7,-1.6,-10.3,12000,3.6,-1.5,-9.3 +5.00E+10,39000,3.8,-1.7,-13.1,16000,3.8,-1.7,-11.8 +1.00E+11,48000,4,-1.8,-15.2,20000,3.9,-1.8,-13.9 +2.00E+11,59000,4.1,-1.9,-17.5,24000,4,-1.9,-16.1 +5.00E+11,75000,4.2,-2.0,-20.3,31000,4.2,-2.0,-18.8 \ No newline at end of file diff --git a/data/coopersarkar_sigma_nubar.csv b/data/coopersarkar_sigma_nubar.csv new file mode 100644 index 00000000..828e17d8 --- /dev/null +++ b/data/coopersarkar_sigma_nubar.csv @@ -0,0 +1,31 @@ +50,0.15,15,-9,-9,0.05,12,-6.4,-6.4 +100,0.33,13.3,-7.4,-7.4,0.12,10.7,-5.7,-5.7 +200,0.69,11.9,-6.5,-6.5,0.24,9.6,-5.1,-5.1 +500,1.8,10.5,-5.7,-5.7,0.61,8.6,-4.6,-4.6 +1000,3.6,9.4,-5.2,-5.2,1.2,7.8,-4.2,-4.2 +2000,7,8.3,-4.6,-4.6,2.4,7,-3.8,-3.8 +5000,17,6.5,-3.7,-3.7,5.8,5.7,-3.2,-3.2 +10000,31,5.1,-3,-3,11,4.6,-2.7,-2.7 +20000,55,3.8,-2.3,-2.3,19,3.6,-2.1,-2.1 +50000,110,2.5,-1.7,-1.7,39,2.4,-1.5,-1.5 +100000,180,1.9,-1.4,-1.4,64,1.7,-1.2,-1.2 +200000,270,1.7,-1.2,-1.2,99,1.4,-1,-1 +500000,460,1.7,-1.1,-1.1,170,1.4,-0.9,-0.9 +1.00E+06,660,1.8,-1,-1,240,1.5,-0.8,-0.8 +2.00E+06,920,1.9,-1,-1,350,1.6,-0.8,-0.8 +5.00E+06,1400,2.1,-0.9,-0.9,530,1.9,-0.8,-0.8 +1.00E+07,1900,2.2,-0.9,-0.9,730,2,-0.8,-0.8 +2.00E+07,2500,2.3,-0.9,-1,980,2.2,-0.8,-0.9 +5.00E+07,3700,2.5,-0.9,-1.2,1400,2.4,-0.9,-1.1 +1.00E+08,4800,2.7,-1,-1.5,1900,2.6,-0.9,-1.3 +2.00E+08,6200,2.8,-1,-2,2400,2.7,-1,-1.8 +5.00E+08,8700,3,-1.1,-3,3400,2.9,-1,-2.6 +1.00E+09,11000,3.1,-1.2,-3.9,4400,3,-1.1,-3.4 +2.00E+09,14000,3.3,-1.2,-5,5600,3.2,-1.2,-4.4 +5.00E+09,19000,3.4,-1.4,-6.8,7600,3.4,-1.3,-6.1 +1.00E+10,24000,3.6,-1.5,-8.5,9600,3.5,-1.4,-7.6 +2.00E+10,30000,3.7,-1.6,-10.3,12000,3.6,-1.5,-9.3 +5.00E+10,39000,3.8,-1.7,-13.1,16000,3.8,-1.7,-11.8 +1.00E+11,48000,4,-1.8,-15.2,20000,3.9,-1.8,-13.9 +2.00E+11,59000,4.1,-1.9,-17.5,24000,4,-1.9,-16.1 +5.00E+11,75000,4.2,-2.0,-20.3,31000,4.2,-2.0,-18.8 \ No newline at end of file diff --git a/filter7pole600MHz.txt b/filter7pole600MHz.txt new file mode 100644 index 00000000..6401c425 --- /dev/null +++ b/filter7pole600MHz.txt @@ -0,0 +1,60 @@ +83330000.000000 0.999531 +99990000.000000 0.999390 +116650000.000000 0.999234 +133310000.000000 0.999062 +149970000.000000 0.998873 +166630000.000000 0.998668 +183290000.000000 0.998443 +199950000.000000 0.998200 +216610000.000000 0.997936 +233270000.000000 0.997650 +249930000.000000 0.997338 +266590000.000000 0.996998 +283250000.000000 0.996621 +299910000.000000 0.996197 +316570000.000000 0.995704 +333230000.000000 0.995105 +349890000.000000 0.994336 +366550000.000000 0.993290 +383210000.000000 0.991792 +399870000.000000 0.989559 +416530000.000000 0.986147 +433190000.000000 0.980883 +449850000.000000 0.972766 +466510000.000000 0.960372 +483170000.000000 0.941786 +499830000.000000 0.914615 +516490000.000000 0.876203 +533150000.000000 0.824154 +549810000.000000 0.757243 +566470000.000000 0.676422 +583130000.000000 0.585408 +599790000.000000 0.490266 +616450000.000000 0.397892 +633110000.000000 0.314115 +649770000.000000 0.242475 +666430000.000000 0.184069 +683090000.000000 0.138138 +699750000.000000 0.102946 +716410000.000000 0.076457 +733070000.000000 0.056743 +749730000.000000 0.042161 +766390000.000000 0.031403 +783050000.000000 0.023470 +799710000.000000 0.017612 +816370000.000000 0.013273 +833030000.000000 0.010049 +849690000.000000 0.007643 +866350000.000000 0.005841 +883010000.000000 0.004484 +899670000.000000 0.003458 +916330000.000000 0.002679 +932990000.000000 0.002085 +949650000.000000 0.001629 +966310000.000000 0.001278 +982970000.000000 0.001007 +999630000.000000 0.000797 +1016290000.000000 0.000000 +1032950000.000000 0.000000 +1049610000.000000 0.000000 +1066270000.000000 0.000000 diff --git a/fluxes/Cuoco_CenA.dat b/fluxes/Cuoco_CenA.dat new file mode 100644 index 00000000..0dc13f21 --- /dev/null +++ b/fluxes/Cuoco_CenA.dat @@ -0,0 +1,15 @@ +14 +15.188 -9.974 +15.392 -9.716 +15.587 -9.469 +15.983 -9.250 +16.489 -9.101 +16.984 -8.953 +17.489 -8.803 +17.984 -8.656 +18.490 -8.506 +18.984 -8.360 +19.490 -8.210 +19.985 -8.062 +20.495 -7.911 +20.974 -7.769 diff --git a/fluxes/Kotera2010_Fe_rich.dat b/fluxes/Kotera2010_Fe_rich.dat index 09e245ce..f6cf7312 100644 --- a/fluxes/Kotera2010_Fe_rich.dat +++ b/fluxes/Kotera2010_Fe_rich.dat @@ -1,5 +1,5 @@ 21 -14.0054 -11.5952 +14.0054 -11.5952 14.1573 -11.4549 14.4069 -11.1848 14.7649 -10.8523 diff --git a/fluxes/README b/fluxes/README index ca9813b3..1c7a25a3 100644 --- a/fluxes/README +++ b/fluxes/README @@ -4,7 +4,7 @@ EXPONENT from 12 ~ 100 dat files are from Fenfang Wu in UC Irvine. Can add more models (EXPONENT >= 100 && EXPONENT < 200 is empty). In the file, first line is the number of data points, -and from the second line, first column : energy in log, second column : flux E^2dN/dE [GeV/(cm^2*str*s)]. +and from the second line, first column : energy (in eV) in log, second column : flux E^2dN/dE [GeV/(cm^2*str*s)]. 32. essfig9.dat-----ESS's paper in Physical Review D, Volume 64, 093010 scaled(using fig4 for the ratio of nu_e/nu_mu) FIG 9 for nu_mu+nu_e @@ -57,5 +57,5 @@ and from the second line, first column : energy in log, second column : flux E^2 224. Kotera2010_max.dat-----Kotera flux max from ARA paper arXiv:1105.2854v1, Fig.27 Kotera et al. '10 max - +225. Cuoco_CenA.dat-------Cuoco et. al. flux from Centarurs A (Cen A). Fig 2, arXiv:0712.1830 diff --git a/log.txt b/log.txt index db688e93..14c1a413 100644 --- a/log.txt +++ b/log.txt @@ -45,7 +45,7 @@ Also, we can change the center of pentagon array (core_x, core_y), distance between stations (station_spacing) In mode 1 : total number of stations (number_of_stations) - + In mode 2 : number of stations on the side (stations_per_side) More detail will be shown on AraSim_doc.pdf file. @@ -82,7 +82,7 @@ More detail, see AraSim_doc.pdf file. GetGain function in Detector -> use freq_step, ang_step, freq_width, freq_init in Detector instead of same values in Parameters class (it causes returning wrong vales... and I don't understand why) -3) some other minor changes : +3) some other minor changes : Ray class : added WhereDoesItLeave function from icemc ray class EarthModel class : added TRandom3.h header file counting class : add from icemc (need for Primaries class) @@ -498,7 +498,7 @@ AraRoot like output data in AraOut.root file. For that, if your machine doesn't have AraRoot installed, AraSim may not compile or run correctly. In that case, try to add new environment variables and try again. -For example, you can add +For example, you can add export ARASIM_SYS=( the location where your AraSim is located ) export LD_LIBRARY_PATH=$ARASIM_SYS/lib:$LD_LIBRARY_PATH @@ -581,7 +581,7 @@ cout<Nu_Interaction[0].changle; Fixed few bugs. -1) fixed switched NC, CC mode. Previously in Primary class it recognized NC : 1 and CC : 0 index while the array (m_fsigma) to calculate the cross setion used opposite way. +1) fixed switched NC, CC mode. Previously in Primary class it recognized NC : 1 and CC : 0 index while the array (m_fsigma) to calculate the cross setion used opposite way. 2) When we calcuate the weight (probability to survive to posnu), so far AraSim used either NC or CC cross section (depending on which interaction it is at posnu). Now when we calcuate the weight, AraSim uses the total cross section (NC + CC). @@ -598,12 +598,12 @@ For example, noise_ID is a vector array as there could be more than 1 pure noise waveform used for trigger analysis (almost all cases it will be just one value, actually if there's more than one value, current AraSim can't handle that case correctly). - If above noise_ID value is 10, that means for that event, antenna, - + If above noise_ID value is 10, that means for that event, antenna, + trigger->v_noise_timedomain[ 10 ][ noise waveform data, size : settings->DATA_BIN_SIZE, default 16384 ] above pure noise waveform is used fot trigger analysis. - For the channels which passed the trigger (report->stations[i].strings[j].antennas[k].Trig_Pass is not 0), V_mimic waveform should used the pure noise waveform + For the channels which passed the trigger (report->stations[i].strings[j].antennas[k].Trig_Pass is not 0), V_mimic waveform should used the pure noise waveform trigger->v_noise_timedomain[ noise_ID ][ 512 bins where Trig_Pass bin value is located at the center ] @@ -741,7 +741,7 @@ By default, if you use different system temperature modes (NOISE_TEMP_MODE=1 or Additional to this difference, you can give an offset to the threshold to each channels. TRIG_THRES_MODE=0 will not give any threshold offset (default) TRIG_THRES_MODE=1 will read data/threshold_offset.csv file and apply those values to each channels. (ex. if the value for ch1 in csv file is 2, threshold will be rms_diode * powerthreshold * 2) -TRIG_THRES_MODE=2 will not read data/threshold_offset.csv file but use the gain offset for each channels as threshold offset. (ex. if gain offset for ch1 is 2, threshold will be rms_diode * powerthreshold * 2^2) +TRIG_THRES_MODE=2 will not read data/threshold_offset.csv file but use the gain offset for each channels as threshold offset. (ex. if gain offset for ch1 is 2, threshold will be rms_diode * powerthreshold * 2^2) =============================================================================== @@ -837,7 +837,7 @@ Added new NOISE mode. After obtaining the Rayleigh distribution fit from force t NOISE=0 uses just flat thermal noise spectrum from constant temperature and apply preamp, filter gains to them. NOISE=1 uses Rayleigh distribution bit value from TestBed data (distribution at different freq values) so don't use any preamp filter gain for noise waveforms. -Currently NOISE=1 mode is available with +Currently NOISE=1 mode is available with DETECTOR=3 READGEOM=1 NOISE_TEMP_MODE=1 or 2 @@ -970,7 +970,7 @@ Massive update 3) minor update : saturation in electronics chain is implemented. - + V_SATURATION in setup wil set the limit voltage in degitized waveform. Degitized waveform values which have outside the range +-V_SATURATION will be forced to + or - V_SATURATION value. By default V_SATURATION = 1.0 which is 1.0 V or 1000 mV @@ -1037,7 +1037,7 @@ Like old Calpulser mode, currently Calpulser mode will work only with DETECTOR=3 Added ability to define output directory for argc==4, at argv[3] added inverse exponential index of refraction model with NOFZ=2 added conditional dependence on AraRoot for AraRoot-like output - checks if ARA_UTIL_INSTALL_DIR exists and links against the libraries there to make a UsefulIcrrStationEvent + checks if ARA_UTIL_INSTALL_DIR exists and links against the libraries there to make a UsefulIcrrStationEvent =============================================================================== @@ -1122,22 +1122,22 @@ AraOut.setup.txt.run0.root instead of AraOut.setupdirectory/setup.txt.run0.root * can now add third parameter to AraSim for output directory: -./AraSim setup.txt 0 /path/to/output/dir/ +./AraSim setup.txt 0 /path/to/output/dir/ can add slash in the end or not * in Spectra.cc : added new EXPONENT values between 510 and 650 (including), so we can have non-integer energy values: -the formula is E=10^X with X=(EXPONENT-400)/10 +the formula is E=10^X with X=(EXPONENT-400)/10 so if you want 10^18.3eV use EXPONENT=400+18.3*10=583 -added a bash script to make a dynamic load library "library.sh" -run it and get "libSim.so" which is useful for loading all the simulation files you need to link with. +added a bash script to make a dynamic load library "library.sh" +run it and get "libSim.so" which is useful for loading all the simulation files you need to link with. -added the user guide in its own directory. +added the user guide in its own directory. -modified the StandardDefinitions.mk : commented out the parts where it calls ARA_UTIL_INSTALL_DIR +modified the StandardDefinitions.mk : commented out the parts where it calls ARA_UTIL_INSTALL_DIR (it messed up my installation and I think in general AraRoot conflicts with AraSim) @@ -1151,10 +1151,10 @@ Triggering upgrade: -in TRIG_SCAN_MODE=0 triggering works same as before (default) -in TRIG_SCAN_MODE=1 triggering is faster using circular buffer (10-15% for time domain, 40-50% for freq domain) --in TRIG_SCAN_MODE=2 choose low POWERTHRESHOLD, for each triggered event get above what Pthresh this would trigger (e.g. event can trigger if threshold was -5.7). --results for mode 2 saved in report->stations[].TDR_all and TDR_Hpol and TDR_Vpol and sorted from highest to lowest in TDR_Vpol_sorted etc. (TDR= Tunnel Diode Response). +-in TRIG_SCAN_MODE=2 choose low POWERTHRESHOLD, for each triggered event get above what Pthresh this would trigger (e.g. event can trigger if threshold was -5.7). +-results for mode 2 saved in report->stations[].TDR_all and TDR_Hpol and TDR_Vpol and sorted from highest to lowest in TDR_Vpol_sorted etc. (TDR= Tunnel Diode Response). -So for one run at TRIG_SCAN_MODE=2 and POWERTHRESHOLD=-4 and TRIG_MODE=1 (trigger on Hpol and Vpol seperately) and N_TRIG_H=N_TRIG_V=3 we will get for each event the maximum number of channels and maximum POWERTHRESHOLD combination on which it would trigger (e.g. it could trigger at -6.1 in 3 channels or -5.9 at 4 channels). Don't need to run different runs for different Pthresh or N_TRIG, can make the cuts out of the outputfile. +So for one run at TRIG_SCAN_MODE=2 and POWERTHRESHOLD=-4 and TRIG_MODE=1 (trigger on Hpol and Vpol seperately) and N_TRIG_H=N_TRIG_V=3 we will get for each event the maximum number of channels and maximum POWERTHRESHOLD combination on which it would trigger (e.g. it could trigger at -6.1 in 3 channels or -5.9 at 4 channels). Don't need to run different runs for different Pthresh or N_TRIG, can make the cuts out of the outputfile. ============================================================================ @@ -1169,7 +1169,7 @@ So for one run at TRIG_SCAN_MODE=2 and POWERTHRESHOLD=-4 and TRIG_MODE=1 (trigge 04/24/14 Eugene Hong; Added new ARA measured Ice Attenuation factor mode. -Settings, +Settings, USE_ARA_ICEATTENU=1 uses new ARA measured Ice Attenuation length (300MHz value across entire frequencies). Also it uses ray trace steps information to account different attenuation length as a function of depth. @@ -1185,9 +1185,9 @@ To go back to old method, use USE_ARA_ICEATTENU=0 Added new sigma (neutrino cross section) boundary values. When we use Connolly et al 2011 (http://arxiv.org/abs/1102.0691, Fig1, Fig2 plots and Table 3 and 4 for parameter values) cross section mode (SIGMAPARAM=1), -We can use mean cross section (by default) with -Settings, -SIGMA_SELECT=0 +We can use mean cross section (by default) with +Settings, +SIGMA_SELECT=0 and upper bound value by SIGMA_SELECT=1 @@ -1248,13 +1248,13 @@ So Veff/Aeff will be simply decided by INTERACTION_MODE=1 or 0. 06/23/14 Guy Nir: -Added SingleChannelTriggers to Antenna_r in Report class. Saves the total number of triggers in each channel. -Added SCT_threshold_pass Antenna_r in Report class. A vector of the Pthresh values for each single channel trigger. -Added TRIG_SCAN_MODE=3 to settings, that tells AraSim to fill SCT_threshold_pass with values. +Added SingleChannelTriggers to Antenna_r in Report class. Saves the total number of triggers in each channel. +Added SCT_threshold_pass Antenna_r in Report class. A vector of the Pthresh values for each single channel trigger. +Added TRIG_SCAN_MODE=3 to settings, that tells AraSim to fill SCT_threshold_pass with values. -Added OUTPUT_TDR_GRAPH to settings, which tells AraSim to save some tunnel diode output waveforms, for debugging. +Added OUTPUT_TDR_GRAPH to settings, which tells AraSim to save some tunnel diode output waveforms, for debugging. -Added TGraph *getWaveform(...) function to Report class, to get the waveforms from V_mimic and time_mimic vectors. +Added TGraph *getWaveform(...) function to Report class, to get the waveforms from V_mimic and time_mimic vectors. ============================================================================ @@ -1266,9 +1266,9 @@ I am still working to confirm the effective area mode is working properly. 07/08/14 Guy Nir: -Added Interaction::clear_useless() method to clear the shower profile vectors. +Added Interaction::clear_useless() method to clear the shower profile vectors. These vectors took a very large volume in the output files, especially when saving all events. -This only applies in DATA_SAVE_MODE>0. +This only applies in DATA_SAVE_MODE>0. ============================================================================ @@ -1333,8 +1333,6 @@ removed useless/problematic option in makefile added namespace definition in Tools.h ============================================================================ -<<<<<<< .working - 04/07/2017 Carl Pfendner: Added option to import geometry from AraRoot for stations 2, 3 - use @@ -1410,11 +1408,11 @@ See Settings.h for more details 10/12/2017 Carl Pfendner: -Added APPLY_NOISE_FIGURE mode to settings to attempt to include the calibration information from Thomas +Added APPLY_NOISE_FIGURE mode to settings to attempt to include the calibration information from Thomas WARNING!!: this is incomplete as of this edit. The channel dependent noise figures do not work correctly yet. Added ANTENNA_MODE mode to settings to allow for new antenna models to -be imported +be imported The newest mode allows the use of a separate antenna model for the top VPol antennas in the layout. @@ -1495,13 +1493,45 @@ Added flexible antennas_per_string and strings_per_station to setup file read-in Cleanup tabs in the Tools class, including the removal of several deprecated functions which are not used anywhere else in AraSim currently -// static void SimpleLinearInterpolation_extend_180cut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); -// static void SimpleLinearInterpolation_extend_PIcut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); -// static void SimpleLinearInterpolation_OutZero_180cut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); +// static void SimpleLinearInterpolation_extend_180cut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); +// static void SimpleLinearInterpolation_extend_PIcut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); +// static void SimpleLinearInterpolation_OutZero_180cut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); // static void SimpleLinearInterpolation_OutZero_PIcut(int n1, double *x1, double *y1, int n2, double *x2, double *y2 ); Also clean-up tabs in Vector class +============================================================================ + +2019/12/12 Brian Clark + +- Cleanup Settings class with correct tabs + +- Add DETECTOR_STATION_LIVETIME_CONFIG, which allows for configuration selection when run in detector 2/3 mode + =0 is default (do nothing special) + =1,2,3,4,5 are the five configs from the A2/A3 4yr analysis + >5 is not supported currently and will throw an error + will also throw an error if attempt to use for stations besides 2 and 3 + +- in Report.h and Report.cc add triggerDelay and mostDelay variables, and fill them correctly, for when we need + to adjust triggering and readout parameters + +- additionally, add trigger masking to Report.cc when in ==0 trig mode ("old" mode) for emulating station a2 in configs >2 + +============================================================================ + +2019/12/19 + +In the a23_4yr_diffuse branch, added feature to estimate signal chain efficiency uncertainty. The uncertainty is represented as a scale-down of the antenna gains consisting of a 600MHz low-pass filter and a drop in gain values by 10% and 32% for Vpol and Hpol, respectively. + +Three Settings paramters are added: +- USE_SIGNAL_CHAIN_LOWER_BOUND: default 0 - pre-scaling antenna gains, the default AraSim values. 1 - scale the gains to produce lower bound values as described above. +- SC_EFFICIENCY_ERROR_V: default 0.9 - the gain drop for Vpol to be used when USE_SIGNAL_CHAIN_LOWER_BOUND=1 +- SC_EFFICIENCY_ERROR_H: default 0.68 - the gain drop for Vpol to be used when USE_SIGNAL_CHAIN_LOWER_BOUND=1 + +One data file is added: +- filter7pole600MHz.txt: 600MHz low-pass curve data (vs freq) + +============================================================================ 2019/12/21 Ming-Yuan Lu @@ -1511,6 +1541,42 @@ Split Settings::CheckCompatibilities function to two - one that does not require The former is moved to be called right after the setup file is read, which spares having to instantiate all class objects before we even check parameter compatibility. The latter is left as is. +============================================================================ + +2020/01/14 Jorge Torres + +In the a23_4yr_diffuse branch, added feature to estimate signal chain efficiency uncertainty. The uncertainty is represented as a scale-down of the antenna gains consisting of a 600MHz low-pass filter and a drop in gain values by 10% and 32% for Vpol and Hpol, respectively. + +- Added the parameter SYSTEMATICS_IceAtten. The default value is zero, which uses Eugene's attenuation model (http://radiorm.physics.ohio-state.edu/elog/Write-Ups/170504_105713/Thesis_-_Eugene_Hong.pdf, p. 54), red line. +Values 1 and 2 are used for lower and upper bound, respectively. The values are hardcoded in the IceModel class. + +============================================================================ + + 2020/01/15 Ming-Yuan Lu Rename overloaded Settings::CheckCompatibilities functions to Settings::CheckCompatibilitiesSettings() & Settings::CheckCompatibilitiesDetector(Detector *detector) to avoid confusion. +============================================================================ +2020/01/24 Ming-Yuan Lu +Initialize Settings::DETECTOR_STATION to be 2, and Settings::DETECTOR_STATION_LIVETIME_CONFIG to be 0 +============================================================================ + +2020/01/27 Brian Clark +Add SYSTEMATICS_nofz to wiggle RAY_TRACE_ICE_MODEL_PARAMS within uncertainties. +=0=default fit values +=1=make larger by uncertainties +=2=make smaller by uncertainties + +============================================================================ + + +2020/03/15 Brian Clark +Add Cooper-Sarkar cross-section model. Activated by using SIGMAPARAM=2. +Also, add two new SIGMA_SELECT modes (3 and 4) for use with SIGMAPARAM=1. +Modes 3 and 4 allow you to use the upper and lower bounds (respectively) +from Cooper-Sarkar, but apply them to the Connolly cross-section calculation. +So, if SIGMAPARAM=1 and SIGMA_SELECT=3, then the cross-section used will +be the Connolly cross section, but increased by the upper bound uncertainty +as computed by Cooper-Sarkar. This is a "hack" to see what happens to +the Connolly result if you assume the Cooper-Sarkar uncertainties +which are smaller than those derived in Connolly et. al. \ No newline at end of file diff --git a/outputs/TrigWindowStudy.txt b/outputs/TrigWindowStudy.txt new file mode 100644 index 00000000..e69de29b diff --git a/sigmaCrossSection.pdf b/sigmaCrossSection.pdf new file mode 100644 index 00000000..e146de10 Binary files /dev/null and b/sigmaCrossSection.pdf differ