// Simple code which parses Hrec, extracts the FrSimEvent and // also recomputes their approximate SNR { char buffer[256]; int numInjections = 2; FrFile * iFile = FrFileINew("/virgoData/ffl/hrecOnline.ffl"); double GPSlist[2] = {843170931, 843170962}; double duration[2] = {7200, 9000}; double calGainBurst[2] = {1.0, 1.0}; double calGainCB[2] = {1.0, 1.0}; double originalDistanceCB = 1.0; double originalDistanceDFM = 0.01; double originalSnrCB[2] = {8.73895,8.73895}; double originalHrssCB[2] = {8.4933e-21,8.4933e-21}; double originalSnrDFM[2] = {0.188621,0.188621}; double originalHrssDFM[2] = {3.79892e-22,3.79892e-22}; double originalSnrGaussian[2] = {7.52412e+20,7.52412e+20}; double originalSnrSineGaussian920[2] = {2.05268e+21,2.05268e+21}; double scaleCB[2] = {0.924094,0.924094}; double scaleDFM[2] = {59.0587,59.0587}; double scaleGaussian[2] = {1.48783e-20, 1.48783e-20}; double scaleSineGaussian920[2] = {3.1065e-21, 3.1065e-21}; double amplitudeCB = 2.4e-20; double amplitudeDFM = 4.85e-21; double amplitudeGaussian = 23.7527; double amplitudeSineGaussian920 = 20.6417; char * day[2] = {"none","25-Sep-2006"}; FrSimEvent * simEvent; FrSimEvent * copyEvent; for(int block = 1; block < numInjections; block++) { sprintf(buffer,"V-WSR2-Injections-%s",day[block]); FrFile * oFile = FrFileONewM(buffer,6,"hrec",duration[block]); FrameH * frameH = FrameHNew("InjectionsFrame"); frameH->dt = duration[block]; frameH->GTimeS = GPSlist[block]; frameH->GTimeN = 0; frameH->ULeapS = 32; simEvent = FrSimEventReadTF(iFile, "HI*", GPSlist[block], duration[block], 0, 0); while(simEvent != NULL) { double gtime = ((double) simEvent->GTimeS + 1.0e-9 * ((double) simEvent->GTimeN)); /* print about the event found */ FrSimEventDump(simEvent, stderr, 2); /* Act differently depending on the event */ if(strcmp(simEvent->name,"HI_CB") == 0) { copyEvent = FrSimEventNew(frameH, "HI_CB", "NS-NS injected event", "Sc_NI_LoopIn", gtime - 11.0e-3, (float) simEvent->timeBefore - 11.0e-3, (float) simEvent->timeAfter + 11.0e-3, amplitudeCB * scaleCB[block] * calGainCB[block], 0); FrSimEventAddParam(copyEvent,"m1",1.39); FrSimEventAddParam(copyEvent,"m2",1.47); FrSimEventAddParam(copyEvent,"nuLow",50.0); FrSimEventAddParam(copyEvent,"distance", originalDistanceCB/ (scaleCB[block]*calGainCB[block])); FrSimEventAddParam(copyEvent,"fAverage",136.395); FrSimEventAddParam(copyEvent,"deltaf",163.042); FrSimEventAddParam(copyEvent,"deltat",4.03731); FrSimEventAddParam(copyEvent,"hrss", originalHrssCB[block] * scaleCB[block] * calGainCB[block]); FrSimEventAddParam(copyEvent,"SNR", originalSnrCB[block] * scaleCB[block] * calGainCB[block]); } else if(strcmp(simEvent->name,"HI_Burst") == 0 && (simEvent->timeBefore + simEvent->timeAfter) < 0.02) { copyEvent = FrSimEventNew(frameH, "HI_Burst_Gaussian", "Gaussian injected event", "Sc_NI_LoopIn", gtime - simEvent->timeBefore/2., simEvent->timeBefore/2., simEvent->timeBefore/2., amplitudeGaussian * scaleGaussian[block] * calGainBurst[block], 0); FrSimEventAddParam(copyEvent,"sigma",0.001); FrSimEventAddParam(copyEvent,"width",0.002); FrSimEventAddParam(copyEvent,"hrss",1.0 * scaleGaussian[block] * calGainBurst[block]); FrSimEventAddParam(copyEvent,"deltat",0.000707107); FrSimEventAddParam(copyEvent,"fAverage",89.79); FrSimEventAddParam(copyEvent,"deltaf",67.84); FrSimEventAddParam(copyEvent,"SNR", originalSnrGaussian[block] * scaleGaussian[block] * calGainBurst[block]); } else if(strcmp(simEvent->name,"HI_Burst") == 0 && ((simEvent->timeBefore + simEvent->timeAfter) > 0.02) && ((simEvent->timeBefore + simEvent->timeAfter) < 0.04)) { copyEvent = FrSimEventNew(frameH, "HI_Burst_SineGaussian920", "SineGaussian920 injected event", "Sc_NI_LoopIn", gtime - simEvent->timeBefore/2., simEvent->timeBefore/2., simEvent->timeBefore/2., amplitudeSineGaussian920 * scaleSineGaussian920[block] * calGainBurst[block], 0); FrSimEventAddParam(copyEvent,"Q",15); FrSimEventAddParam(copyEvent,"f0",920); FrSimEventAddParam(copyEvent,"hrss", 1.0 * scaleSineGaussian920[block] * calGainBurst[block]); FrSimEventAddParam(copyEvent,"sigma",0.002595); FrSimEventAddParam(copyEvent,"width",0.00519); FrSimEventAddParam(copyEvent,"deltat",0.00183488); FrSimEventAddParam(copyEvent,"fAverage",920); FrSimEventAddParam(copyEvent,"deltaf",43.3692); FrSimEventAddParam(copyEvent,"SNR", originalSnrSineGaussian920[block] * scaleSineGaussian920[block] * calGainBurst[block]); } else if(strcmp(simEvent->name,"HI_Burst") == 0) { copyEvent = FrSimEventNew(frameH, "HI_Burst_DFM_a:2_b:4_g:1", "DFM a:2 b:4 g:1 injected event", "Sc_NI_LoopIn", gtime - simEvent->timeBefore/2., simEvent->timeBefore/2., simEvent->timeBefore/2., amplitudeDFM * scaleDFM[block] * calGainBurst[block], 0); FrSimEventAddParam(copyEvent,"a",2); FrSimEventAddParam(copyEvent,"b",4); FrSimEventAddParam(copyEvent,"g",1); FrSimEventAddParam(copyEvent,"hrss", originalHrssDFM[block] * scaleDFM[block] * calGainBurst[block]); FrSimEventAddParam(copyEvent,"deltat",0.0255508); FrSimEventAddParam(copyEvent,"fAverage",55.8127); FrSimEventAddParam(copyEvent,"deltaf",65.5145); FrSimEventAddParam(copyEvent,"SNR", originalSnrDFM[block] * scaleDFM[block] * calGainBurst[block]); FrSimEventAddParam(copyEvent,"distance", originalDistanceDFM/ (scaleDFM[block]*calGainCB[block])); } else { copyEvent = FrSimEventNew(frameH, "HI_Glitch", "CaRT glitch", "Sc_NI_LoopIn", gtime, simEvent->timeBefore, simEvent->timeAfter, simEvent->amplitude, 0); } simEvent = simEvent->next; } FrameWrite(frameH,oFile); FrameFree(frameH); FrFileOEnd(oFile); } }