29 #include "TObjString.h" 30 #include "TObjArray.h" 44 #include "TMultiGraph.h" 49 #include "Math/VectorUtil.h" 79 #define LAL_USE_OLD_COMPLEX_STRUCTS 80 #define restrict // this is to getrid of restrict which is defined only in c99 88 #include <lal/LIGOLwXMLInspiralRead.h> 89 #include <lal/LALConfig.h> 90 #include <lal/LALStdio.h> 91 #include <lal/LALStdlib.h> 92 #include <lal/LALError.h> 93 #include <lal/LALDatatypes.h> 94 #include <lal/LIGOMetadataUtils.h> 95 #include <lal/LIGOMetadataTables.h> 96 #include <lal/AVFactories.h> 97 #include <lal/NRWaveIO.h> 98 #include <lal/NRWaveInject.h> 100 #include <lal/FileIO.h> 101 #include <lal/Units.h> 102 #include <lal/FrequencySeries.h> 103 #include <lal/TimeSeries.h> 104 #include <lal/TimeFreqFFT.h> 105 #include <lal/VectorOps.h> 106 #include <lal/LALDetectors.h> 107 #include <lal/FindChirp.h> 108 #include <lal/Random.h> 109 #include <lal/LALNoiseModels.h> 110 #include <lal/Date.h> 111 #include <lal/LALStatusMacros.h> 112 #include <lal/LALSimulation.h> 113 #include <lal/LALInspiral.h> 114 #include <lal/LALSimInspiralWaveformFlags.h> 115 #include <lal/LALSimIMR.h> 116 #if LAL_VERSION_MAJOR > 6 || (LAL_VERSION_MAJOR == 6 && \ 117 (LAL_VERSION_MINOR > 14 || (LAL_VERSION_MINOR == 14 && \ 118 LAL_VERSION_MICRO >= 0 ))) // LAL_VERSION >= 6.14.0 119 #include <lal/SnglBurstUtils.h> 121 #include <lal/LIGOMetadataBurstUtils.h> 123 #include <lal/LIGOLwXMLBurstRead.h> 124 #include <lal/GenerateBurst.h> 125 #include <lal/LIGOLwXML.h> 126 #if LAL_VERSION_MAJOR > 6 || (LAL_VERSION_MAJOR == 6 && \ 127 (LAL_VERSION_MINOR > 19 || (LAL_VERSION_MINOR == 19 && \ 128 LAL_VERSION_MICRO >= 2 ))) // LAL_VERSION >= 6.19.2 129 #include <lal/LIGOLwXMLlegacy.h> 139 #define MDC_INJ_RATE 0.01 // sec^-1 140 #define MDC_INJ_JITTER 10. // sec 141 #define MDC_INJ_LENGTH 1. // sec 142 #define MDC_INJ_HRSS 2.5e-21 144 #define MDC_SAMPLE_RATE 16384. // sample/sec 146 #define EPZOOM 0.9999999 197 default:
return "MDC_RANDOM";
248 class mdc :
public TNamed {
260 mdc& operator = (
const mdc&);
266 double srate, vector<mdcpar> par=vector<mdcpar>());
268 double srate, vector<mdcpar> par=vector<mdcpar>());
299 void GetSourceCoordinates(
double&
theta,
double&
phi,
double&
psi,
double&
rho,
300 double& iota,
double&
hrss,
int&
ID,
int&
id);
301 void GetSourceCoordinates(
double gps,
double& theta,
double& phi,
double& psi,
double& rho,
302 double& iota,
double& hrss,
int& ID,
int&
id);
309 this->inj_hrss = inj_hrss>=0 ? inj_hrss :
MDC_INJ_HRSS;}
315 this->inj_offset = inj_offset>0 ? inj_offset : 0;}
321 this->srcList_seed = srcList_seed;}
351 int GetWaveformID(
TString name);
362 double GetAntennaPattern(
TString ifo,
double phi,
double theta,
double psi=0.,
TString polarization=
"hp");
365 void Print(
int level=0);
377 static void AddCGBurst(
wavearray<double> &td,
double a,
double f,
double s,
double d=0.);
381 size_t length=1000,
bool log=
false, vector<TString>
chName=vector<TString>());
396 double GetPar(
TString name, vector<mdcpar> par,
bool&
error);
399 waveform GetSourceWaveform(
int& ID,
int&
id);
400 vector<source> GetSourceList(
double start,
double stop);
401 TString GetBurstLog(
source src,
double FrameGPS,
double SimHpHp,
double SimHcHc,
double SimHpHc);
411 TString GenInspiralXML(
int gps_start_time,
int gps_end_time,
bool rmFile=
false);
412 TString GetInspName() {
return inspName;}
413 TString GetWaveName() {
return waveName;}
415 TString GetInspiralLog(
TString inspName,
double FrameGPS, SimInspiralTable *thisInj);
418 void CreateBurstXML(
TString fName, vector<mdcpar> xml_parms);
420 void CloseBurstXML();
422 int XLALInspiralTDWaveformFromSimInspiral(REAL8TimeSeries **hplus, REAL8TimeSeries **hcross, SimInspiralTable *thisRow, REAL8 deltaT);
423 static double SimIMRSEOBNRv4ROMTimeOfFrequency(
double freq,
double m1,
double m2,
double chi1,
double chi2);
424 static double SimIMRSEOBNRv4ROMFrequencyOfTime(
double time,
double m1,
double m2,
double chi1,
double chi2);
426 static double e2cosi(
double e);
427 static double cosi2e(
double cosi);
441 static std::map<TString, double> GetPsample(std::map<TString, int> hsample, vector<double> sample,
442 float if_lower=-1,
float if_ref=-1);
445 void SetInspiralCLB(
TString inspCLB) {
446 TString extension = inspCLB(inspCLB.Last(
'.'),inspCLB.Sizeof()-inspCLB.Last(
'.')-1);
447 if(extension!=
".clb") {
448 cout <<
"CWB::mdc::SetInspiralCLB - Error : Calibration file extension must be .clb" << endl;
451 this->inspCLB=inspCLB;
453 TString GetInspiralCLB() {
return this->inspCLB;}
485 vector<double>
tstart=DEFAULT_VECtOR_DOUBLE, vector<double>
tstop=DEFAULT_VECtOR_DOUBLE);
496 void Init(
int seed=0);
497 void exit(
int err) {gSystem->Exit(err);}
547 ProcessTable *xml_process_table_head;
548 ProcessTable *xml_process;
549 ProcessParamsTable *xml_process_params_table_head;
550 SearchSummaryTable *xml_search_summary_table_head;
551 SearchSummaryTable *xml_search_summary;
552 TimeSlide *xml_time_slide_table_head;
553 SimBurst *xml_sim_burst_table_head;
554 SimBurst **xml_sim_burst;
double GetTimeBoundaries(wavearray< double > x, double P, double &bT, double &eT)
vector< mdcpar > GetSkyParms()
vector< mdcpar > sky_parms
std::vector< float > psiList
std::vector< std::string > mdcList
void SetInjRate(double inj_rate=MDC_INJ_RATE)
wavearray< double > a(hp.size())
void SetSourceListSeed(unsigned int srcList_seed)
std::vector< std::string > mdcType
MDC SetSkyDistribution(MDC_CELESTIAL_FIX, par, seed)
cout<< endl;cout<< "ts size = "<< ts.size()<< " ts rate = "<< ts.rate()<< endl;tf.Forward(ts, wdm);int levels=tf.getLevel();cout<< "tf size = "<< tf.size()<< endl;double dF=tf.resolution();double dT=1./(2 *dF);cout<< "rate(hz) : "<< RATE<< "\ layers : "<< nLAYERS<< "\ dF(hz) : "<< dF<< "\ dT(ms) : "<< dT *1000.<< endl;int itime=TIME_PIXEL_INDEX;int ifreq=FREQ_PIXEL_INDEX;int index=(levels+1) *itime+ifreq;double time=itime *dT;double freq=(ifreq >0) ? ifreq *dF :dF/4;cout<< endl;cout<< "PIXEL TIME = "<< time<< " sec "<< endl;cout<< "PIXEL FREQ = "<< freq<< " Hz "<< endl;cout<< endl;wavearray< double > x
unsigned int srcList_seed
std::vector< double > gpsList
void SetInjLength(double inj_length=MDC_INJ_LENGTH)
std::vector< float > phList
std::vector< int > IDList
vector< waveform > GetWaveformList()
cout<< "SNR "<< xsnr<< endl;wavearray< double > f
virtual void Browse(TBrowser *b)
r add(tfmap, const_cast< char *>("hchannel"))
std::vector< std::string > nameList
network ** net
NOISE_MDC_SIMULATION.
double GetFrequencyBoundaries(wavearray< double > x, double P, double &bF, double &eF)
std::vector< std::string > xmlType
void SetInjOffset(double inj_offset=0)
MDC TimeShift(MDC.wfList[14].hx, 0.001)
const char * DistributionToString(MDC_DISTRIBUTION n)
cout<< "Injected signals: "<< mdc.GetEntries()<< endl;cout<< "Injected signals in histogram factor_events_inj: "<< NEVTS<< endl;float myifar, ecor, m1, m2, netcc[3], neted, penalty;float rho[2];float chirp[6];float range[2];float frequency[2];float iSNR[3], sSNR[3];sim.SetBranchAddress("mass", mass);sim.SetBranchAddress("factor", &factor);sim.SetBranchAddress("range", range);sim.SetBranchAddress("chirp", chirp);sim.SetBranchAddress("rho", rho);sim.SetBranchAddress("netcc", netcc);sim.SetBranchAddress("neted", &neted);sim.SetBranchAddress("ifar", &myifar);sim.SetBranchAddress("ecor", &ecor);sim.SetBranchAddress("penalty", &penalty);sim.SetBranchAddress("time", mytime);sim.SetBranchAddress("iSNR", iSNR);sim.SetBranchAddress("sSNR", sSNR);sim.SetBranchAddress("spin", spin);sim.SetBranchAddress("frequency", frequency);float **volume=new float *[NBINS_mass1];float **volume_first_shell=new float *[NBINS_mass1];float **radius=new float *[NBINS_mass1];float **error_volume=new float *[NBINS_mass1];float **error_volume_first_shell=new float *[NBINS_mass1];float **error_radius=new float *[NBINS_mass1];for(int i=0;i< NBINS_mass1;i++) { volume[i]=new float[NBINS_mass2];volume_first_shell[i]=new float[NBINS_mass2];radius[i]=new float[NBINS_mass2];error_volume[i]=new float[NBINS_mass2];error_volume_first_shell[i]=new float[NBINS_mass2];error_radius[i]=new float[NBINS_mass2];for(int j=0;j< NBINS_mass2;j++) { volume[i][j]=0.;volume_first_shell[i][j]=0.;radius[i][j]=0.;error_volume[i][j]=0.;error_volume_first_shell[i][j]=0.;error_radius[i][j]=0.;} } float **spin_mtot_volume=new float *[NBINS_MTOT+1];float **spin_mtot_radius=new float *[NBINS_MTOT+1];float **error_spin_mtot_volume=new float *[NBINS_MTOT+1];float **error_spin_mtot_radius=new float *[NBINS_MTOT+1];for(int i=0;i< NBINS_MTOT+1;i++) { spin_mtot_volume[i]=new float[NBINS_SPIN+1];spin_mtot_radius[i]=new float[NBINS_SPIN+1];error_spin_mtot_volume[i]=new float[NBINS_SPIN+1];error_spin_mtot_radius[i]=new float[NBINS_SPIN+1];for(int j=0;j< NBINS_SPIN+1;j++) { spin_mtot_volume[i][j]=0.;error_spin_mtot_volume[i][j]=0.;spin_mtot_radius[i][j]=0.;error_spin_mtot_radius[i][j]=0.;} } char fname[1024];sprintf(fname, "%s/recovered_signals.txt", netdir);ofstream fev;fev.open(fname, std::ofstream::out);sprintf(line, "#GPS@L1 FAR[Hz] eFAR[Hz] Pval " "ePval factor rho frequency iSNR sSNR \");fev<< line<< endl;ofstream *fev_single=new ofstream[nfactor];for(int l=1;l< nfactor+1;l++) { sprintf(fname, "%s/recovered_signals_%d.txt", netdir, l);fev_single[l - 1].open(fname, std::ofstream::out);fev_single[l - 1]<< line<< endl;} double Vrho[RHO_NBINS], eVrho[RHO_NBINS], Rrho[RHO_NBINS], eRrho[RHO_NBINS], Trho[RHO_NBINS];for(int i=0;i< RHO_NBINS;i++) { Vrho[i]=0.;eVrho[i]=0.;Rrho[i]=0.;eRrho[i]=0.;Trho[i]=RHO_MIN+i *RHO_BIN;} double dV, dV1, dV_spin_mtot, nevts, internal_volume;int nT;int countv=0;int cnt=0;int cnt2=0;int cntfreq=0;bool bcut=false;double liveTot=sim.GetMaximum("ifar");double BKG_LIVETIME_yr=liveTot/CYS;double BKG_LIVETIME_Myr=BKG_LIVETIME_yr/(1.e6);cout.precision(14);cout<< "Total live time ---> background
void Dump(WSeries< double > &w, double t1, double t2, const char *fname)
MDC_COORDINATES GetCoordinatesSystem()
void SetInjJitter(double inj_jitter=MDC_INJ_JITTER)
std::vector< int > idList
double GetCentralFrequency(wavearray< double > x)
double GetCentralTime(wavearray< double > x)
vector< waveform > wfList
double GetSourceListSeed()
MDC_COORDINATES mdc_coordinates
std::vector< std::string > mdcName
MDC_DISTRIBUTION sky_distribution
std::vector< float > rhoList
MDC_DISTRIBUTION GetSkyDistribution()
wavearray< double > GetWaveform(int ifoId, network *NET, int lag, int id, char type, bool shift=true)
void SetZoom(double epzoom=EPZOOM)
std::vector< double > hrssList
std::vector< float > iotaList
MDC AddWaveform(MDC_SGC, par)
void SetInjHrss(double inj_hrss=MDC_INJ_HRSS)
std::vector< source > srcList
double GetDelay(network *NET, TString ifo, double theta, double phi)
std::vector< double > mdcTime
MDC DumpLog("GHLTV-GWGC_v1-968600000-300000.root","CIAO")
static vector< double > DEFAULT_VECtOR_DOUBLE
void SetCoordinatesSystem(MDC_COORDINATES mdc_coordinates=MDC_EARTH)
TString frLabel[NIFO_MAX]
std::vector< float > thList
MDC SetInspiral("inspNameTEST", inspOptions)