BankEfficiency.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Thomas Cokelaer
00003 *
00004 *  This program is free software; you can redistribute it and/or modify
00005 *  it under the terms of the GNU General Public License as published by
00006 *  the Free Software Foundation; either version 2 of the License, or
00007 *  (at your option) any later version.
00008 *
00009 *  This program is distributed in the hope that it will be useful,
00010 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 *  GNU General Public License for more details.
00013 *
00014 *  You should have received a copy of the GNU General Public License
00015 *  along with with program; see the file COPYING. If not, write to the
00016 *  Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00017 *  MA  02111-1307  USA
00018 */
00019 
00020 #include <processtable.h>
00021 #include <stdio.h>
00022 #include <stdlib.h>
00023 #include <gsl/gsl_histogram.h>
00024 #include <gsl/gsl_matrix.h>
00025 #include <lalapps.h>
00026 
00027 #include <lal/LALNoiseModels.h>
00028 #include <lal/LALInspiralBank.h>
00029 #include <lal/RealFFT.h>
00030 #include <lal/AVFactories.h>
00031 #include <lal/SeqFactories.h>
00032 #include <lal/LIGOMetadataUtils.h>
00033 #include <lal/LIGOMetadataTables.h>
00034 
00035 #include <lal/LIGOLwXMLHeaders.h>
00036 #include <lal/LALConfig.h>
00037 #include <lal/LALStdio.h>
00038 #include <lal/LALStdlib.h>
00039 #include <lal/LALError.h>
00040 #include <lal/LALDatatypes.h>
00041 #include <lal/AVFactories.h>
00042 #include <lal/LIGOMetadataTables.h>
00043 #include <lal/LIGOLwXML.h>
00044 #include <lal/LIGOLwXMLRead.h>
00045 #include <lal/LIGOLwXMLInspiralHeaders.h>
00046 #include <lal/Date.h>
00047 #include <lal/Units.h>
00048 
00049 
00050 
00051 /* Here, I defined my own xml table outside the lal strcuture although
00052    it can be put  into the liXmlHeader files I guess. I dont want to
00053    use the lal definition for the  time being in order to avoid any 
00054    overlap with other users. */
00055 
00056 
00057 #define myfprintf(fp,oldmacro) PRINT_ ## oldmacro(fp)
00058 
00059 #define MAXIFO 2
00060 
00061 /* --- the macro to read/print the results --- */
00062 #define BANKEFFICIENCY_PARAMS_ROW \
00063 "       %f, %f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%d,%d,%u,%u,%f"
00064 
00065 /* --- the macro to read/print the results --- */
00066 #define BANKEFFICIENCY_PARAMS_ROW_SPACE \
00067 "%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %f %d %d %u %u %f"
00068 
00069 /* --- the XML output --- */
00070 #define PRINT_LIGOLW_XML_BANKEFFICIENCY(fp) (\
00071 fputs( "   <Table Name=\"bankefficiencygroup:bankefficiency:table\">\n", fp) == EOF || \
00072 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:psi0\"               Type=\"real_4\"/>\n", fp) == EOF ||  \
00073 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:psi3\"               Type=\"real_4\"/>\n", fp) == EOF ||  \
00074 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:psi0_sim\"           Type=\"real_4\"/>\n", fp) == EOF ||  \
00075 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:psi3_sim\"           Type=\"real_4\"/>\n", fp) == EOF ||  \
00076 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:tau0\"               Type=\"real_4\"/>\n", fp) == EOF ||  \
00077 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:tau3\"               Type=\"real_4\"/>\n", fp) == EOF ||  \
00078 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:tau0_sim\"           Type=\"real_4\"/>\n", fp) == EOF ||  \
00079 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:tau3_sim\"           Type=\"real_4\"/>\n", fp) == EOF ||  \
00080 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ecc\"                Type=\"real_4\"/>\n", fp) == EOF ||  \
00081 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ecc_sim\"            Type=\"real_4\"/>\n", fp) == EOF ||  \
00082 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ecc_sim_fl\"         Type=\"real_4\"/>\n", fp) == EOF ||  \
00083 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ffinal\"             Type=\"real_4\"/>\n", fp) == EOF ||  \
00084 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ffinal_sim\"         Type=\"real_4\"/>\n", fp) == EOF ||  \
00085 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:mass1_sim\"          Type=\"real_4\"/>\n", fp) == EOF ||  \
00086 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:mass2_sim\"          Type=\"real_4\"/>\n", fp) == EOF ||  \
00087 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:inclination_sim\"    Type=\"real_4\"/>\n", fp) == EOF ||  \
00088 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:polarisation_sim\"   Type=\"real_4\"/>\n", fp) == EOF ||  \
00089 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:phase_sim\"          Type=\"real_4\"/>\n", fp) == EOF ||  \
00090 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:snr\"                Type=\"real_4\"/>\n", fp) == EOF ||  \
00091 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:snr_at_ta\"          Type=\"real_4\"/>\n", fp) == EOF ||  \
00092 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:phase\"              Type=\"real_4\"/>\n", fp) == EOF ||  \
00093 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:alpha_f\"            Type=\"real_4\"/>\n", fp) == EOF ||  \
00094 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:time\"               Type=\"int_4s\"/>\n", fp) == EOF ||  \
00095 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:time_sim\"           Type=\"int_4s\"/>\n", fp) == EOF ||  \
00096 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:nfast\"              Type=\"int_4s\"/>\n", fp) == EOF ||  \
00097 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:nfast_max\"          Type=\"int_4s\"/>\n", fp) == EOF ||  \
00098 fputs( "      <Column Name=\"bankefficiencygroup:bankefficiency:ematch\"             Type=\"real_4\"/>\n", fp) == EOF ||  \
00099 fputs( "      <Stream Name=\"bankefficiencygroup:bankefficiency:table\"              Type=\"Local\" Delimiter=\",\">\n", fp) == EOF )
00100 
00101 
00102 
00103 /* --- some CVS macros --- */
00104 #define CVS_ID_STRING      "$Id: BankEfficiency.h,v 1.52 2008/07/07 17:36:46 devanka Exp $"
00105 #define CVS_NAME_STRING    "$Name:  $"
00106 #define CVS_REVISION       "$Revision: 1.52 $"
00107 #define CVS_SOURCE         "$Source: /usr/local/cvs/lscsoft/lalapps/src/findchirp/BankEfficiency.h,v $"
00108 #define CVS_DATE           "$Date: 2008/07/07 17:36:46 $"
00109 #define PROGRAM_NAME       "BankEfficiency"
00110 
00111 /* --- Some Error messages --- */
00112 #define BANKEFFICIENCY_ENORM  0
00113 #define BANKEFFICIENCY_ESUB   1
00114 #define BANKEFFICIENCY_EARG   2
00115 #define BANKEFFICIENCY_EVAL   3
00116 #define BANKEFFICIENCY_EFILE  4
00117 #define BANKEFFICIENCY_EINPUT 5
00118 #define BANKEFFICIENCY_EMEM   6
00119 
00120 #define BANKEFFICIENCY_MSGENORM  "Normal exit"
00121 #define BANKEFFICIENCY_MSGESUB   "Subroutine failed"
00122 #define BANKEFFICIENCY_MSGEARG   "Error parsing arguments"
00123 #define BANKEFFICIENCY_MSGEVAL   "Input argument out of valid range"
00124 #define BANKEFFICIENCY_MSGEFILE  "Could not open file"
00125 #define BANKEFFICIENCY_MSGEINPUT "Error reading file"
00126 #define BANKEFFICIENCY_MSGEMEM   "Out of memory"
00127 #define BANKEFFICIENCY_MSGPARSER "Missing arguments ??  "
00128 
00129 /* --- Some flags --- */
00130 #define BANKEFFICIENCY_ALPHAFCONSTRAINT     1 /* alphaF between 0 and 1       */
00131 #define BANKEFFICIENCY_ALPHAFUNCONSTRAINT   0 /* alphaF between 0 and 1       */
00132 #define BANKEFFICIENCY_QUIETFLAG            0 /* silent                       */ 
00133 #define BANKEFFICIENCY_FASTSIMULATION       0 /* cheating code (dont use temp
00134                                                  late far from injection; use 
00135                                                  with care                    */
00136 #define BANKEFFICIENCY_PRINTOVERLAP         0 /* Print Best Overlap           */
00137 #define BANKEFFICIENCY_PRINTBESTOVERLAP     0 /* Print Best Overlap           */
00138 #define BANKEFFICIENCY_PRINTBESTTEMPLATE    0 /* Print Best Template          */
00139 #define BANKEFFICIENCY_PRINTSNRHISTO        0 /* Print histogram of all SNRs. */
00140 #define BANKEFFICIENCY_PRINTFILTER          0 /* Print corresponding Filter   */
00141 #define BANKEFFICIENCY_PRINTBANK            0 /* print the template bank      */
00142 #define BANKEFFICIENCY_PRINTBANKXML         0 /* print the template bank      */
00143 #define BANKEFFICIENCY_PRINTRESULT          1 /* print the result (ascii)     */
00144 #define BANKEFFICIENCY_PRINTRESULTXML       0 /* print the template bank      */
00145 #define BANKEFFICIENCY_PRINTPROTOTYPE       0 /* print the prototype          */
00146 #define BANKEFFICIENCY_PRINTBANKOVERLAP     0 /* print template's overlap     */
00147 #define BANKEFFICIENCY_PRINTPSD             0 /* print psd used in <x|x>      */
00148 #define BANKEFFICIENCY_PRINTTEMPLATE        0 /* print BCV's final template   */
00149 #define BANKEFFICIENCY_FAITHFULNESS         0               
00150 #define BANKEFFICIENCY_PROTOTYPE            "BankEfficiency-Proto"  
00151 #define BANKEFFICIENCY_ASCIIRESULTS         "Trigger.dat"
00152 #define BANKEFFICIENCY_XMLBANK              "BankEfficiency-Bank.xml"
00153 #define BANKEFFICIENCY_ASCIIBANK            "BankEfficiency-Bank.dat"
00154 #define BANKEFFICIENCY_ASCIISIGNAL          "BankEfficiency-Signal.dat"
00155 #define BANKEFFICIENCY_PRINTOVERLAP_FILE    "BankEfficiency-BestOverlap.dat"
00156 #define BANKEFFICIENCY_PRINTBANK_FILEASCII  "BankEfficiency-Bank.dat"       
00157 #define BANKEFFICIENCY_PRINTBANK_FILEXML    "BankEfficiency-Bank.xml"       
00158 #define BANKEFFICIENCY_XMLRESULTS           "BankEfficiency-Result.xml"     
00159 #define BANKEFFICIENCY_PRINTPSD_FILE        "BankEfficiency-PSD.dat"        
00160 #define BANKEFFICIENCY_SNRHISTOGRAM         "BankEfficiency-SNR_histrogram.dat"
00161 
00162 
00163 /* ==================== local structures ==================== */
00164 /* 
00165  *  */
00166  
00167 /* --- Eccentric bank parameters --- */
00168 typedef struct {
00169   REAL8 min;
00170   REAL8 max;
00171   REAL8 step;
00172   INT4 bins;
00173 } EccentricBank;
00174   
00175 
00176 /* --- Type of BCV filtering--- */
00177 typedef enum {
00178   ALPHAFConstraint,
00179   ALPHAFUnconstraint,
00180   BOTHAlphaMethod
00181 } AlphaConstraint;
00182 
00183 
00184 /* --- Type of injections */
00185 typedef enum {
00186   NoUserChoice,
00187   BBH,
00188   BNS,
00189   BHNS
00190 } BinaryInjection;
00191 
00192 /* --- type of noisemodels --- */
00193 typedef enum{
00194   UNITY,
00195   LIGOI,
00196   LIGOA,
00197   GEO,
00198   TAMA,
00199   VIRGO,
00200   REALPSD,
00201   READPSD,
00202   EGO
00203 } DetectorName;
00204 
00205 /* --- type of fast option --- */
00206 typedef enum{
00207   None,
00208   EMatch,
00209   Heuristic1    
00210 } FastOption;
00211 
00212 typedef struct{
00213   AlphaConstraint alphaFConstraint; /* force alpha_F to be  between 0 and 1   */
00214   INT4 signal;                      /* name of the random signal to inject    */  
00215   INT4 template;                    /* name of the template in the bank       */
00216   INT4 ntrials;                     /* number of simulations                  */
00217   FastOption fastSimulation;              /* target the injection in the bank --> less 
00218                                        computation but Match might be less than 
00219                                        the optimal  is noise is injected or 
00220                                        template andsignal are not faithful (ie:
00221                                        BCV against physical template          */
00222 
00223   INT4 lengthFactor;                /* multiply estimated length by this number*/
00224   INT4 printSNRHisto;       
00225   INT4 printBank;                   /* print bank of templates      */
00226   INT4 printResultXml;
00227   INT4 printPrototype;
00228   INT4 printPsd;                    /* print the psd used in <x|x>            */
00229   BinaryInjection binaryInjection;  /*injection will be set by the mass-range */
00230   INT4 printBestOverlap, printBestTemplate, extraFinalPrinting ;
00231 
00232   INT4 faithfulness;
00233   INT4 snrAtCoaTime;
00234   REAL8 m1,m2, psi0,psi3, tau0, tau3;
00235   DetectorName noiseModel;
00236   REAL4 maxTotalMass;
00237   REAL4 minTotalMass;
00238   INT4 startTime;
00239   INT4 numSeconds;
00240   INT4 increaseVector;
00241   REAL4 signalfFinal;
00242   INT4 startPhase;
00243   CHAR *inputPSD;
00244   INT4 useed;
00245   INT4 ambiguity;
00246   REAL8 eMatch;
00247   REAL8 mmFine;
00248   REAL8 t0FineMin, t0FineMax, t3FineMin, t3FineMax, t0FineBin, t3FineBin;
00249   EccentricBank eccentricBank;
00250   EccentricBank eccentricSignal;
00251   CHAR tag[256];
00252   INT4 fastParam1;
00253 }
00254 UserParametersIn;
00255 
00256 /* struct to save the results */
00257 typedef struct{
00258   REAL4  rhoMax;
00259   INT4   rhoBin;
00260   REAL4  alpha;
00261   REAL4  phase;
00262   REAL4  freq;
00263   INT4   layer;
00264   INT4   templateNumber;
00265   InspiralTemplate bestTemplate;
00266   REAL4 eccentricity;
00267   REAL4 spin1_x, spin1_y,spin1_z;
00268   REAL4 spin2_x, spin2_y,spin2_z;
00269   REAL4 sourceTheta0, sourcePhi0;
00270   REAL4 polarisationAngle, inclination;
00271   InspiralTemplate bestUTemplate;
00272   REAL4 snrAtCoaTime; 
00273 } OverlapOutputIn;
00274 
00275 /* structure to output the results */
00276 typedef struct{
00277   REAL4 tau0_inject;
00278   REAL4 tau0_trigger;
00279   REAL4 tau3_inject;
00280   REAL4 tau3_trigger;
00281   REAL4 psi0_trigger;
00282   REAL4 psi3_trigger;
00283   REAL4 beta_trigger;
00284   REAL4 beta_inject;
00285   REAL4 psi0_inject;
00286   REAL4 psi3_inject;
00287   REAL4 fend_trigger;
00288   REAL4 fend_inject;
00289   REAL4 mass1_inject;
00290   REAL4 mass2_inject;
00291   INT4 layer;
00292   REAL4 rho_final;
00293   REAL4 alphaF;
00294   INT4 bin;
00295   REAL4 phase;
00296   UINT4 ntrial;
00297   UINT4 nfast;
00298   REAL4 snrAtCoaTime; 
00299   REAL4 eccentricity;
00300   REAL4 spin1_x, spin1_y,spin1_z;
00301   REAL4 spin2_x, spin2_y,spin2_z;
00302   REAL4 sourceTheta0, sourcePhi0;
00303   REAL4 inclination, polarisationAngle;
00304 } ResultIn;
00305 
00306 
00307 /* BCV moments */
00308 typedef struct{
00309   REAL4Vector a11;
00310   REAL4Vector a21;
00311   REAL4Vector a22;
00312 } BankEfficiencyMoments;
00313 
00314 
00315 /* vectors for BCV storage*/
00316 typedef struct{
00317   REAL4Vector fm5_3;
00318   REAL4Vector fm2_3;
00319   REAL4Vector fm7_6;
00320   REAL4Vector fm1_2;
00321 } BankEfficiencyPowerVector;
00322 
00323 
00324 typedef struct{
00325   BankEfficiencyPowerVector powerVector;
00326   BankEfficiencyMoments     moments;
00327   REAL4Vector               FilterBCV1;
00328   REAL4Vector               FilterBCV2;
00329 } BankEfficiencyBCV;
00330         
00331 typedef struct{
00332   INT4  filteringIndex;
00333   INT4  ntrials;     /* number of simulations done                            */
00334   INT4  N;           /* number of simulations to be done                      */
00335   REAL4 lastEMatch;  /* keep the last value of ematch (reset for each simulation)*/
00336   INT4  filter_processed;/* number of filtering done in each simulation       */
00337   INT4  stop;            /* flag to carry on the current simulation           */
00338   REAL4 bestSNR;         /* keep the best SNR                                 */
00339   INT4  bestSNRIndex;    /* keep the best SNR index                           */
00340   REAL4 tau0best;
00341   REAL4 tau3best;
00342   INT4  SNRMax; /* Index to know how many filtering ago the max SNr was found */
00343   REAL4 eMatch;        /* keep track of the original requested ematch         */
00344   REAL4 bestEMatch;    /* keep track of the best ematch for a given simulation*/
00345   RandomInspiralSignalIn randIn;
00346   INT4 fastParam1; 
00347 } BankEfficiencySimulation;
00348         
00349 
00350       
00351     
00352 
00353 /* As to be cleaned
00354  * Function to store the optimal  parameters of the overlap 
00355  * lmax : number of the layer
00356  * fMax : frequency cutoff of the template
00357  * jmax: number of the best template. use if one want to use the FMaximization 
00358  * option. 
00359  * */
00360 void
00361 BankEfficiencyKeepHighestValues(
00362   OverlapOutputIn  in , 
00363   OverlapOutputIn *out,
00364   InspiralTemplate insptmplt);
00365           
00366 /* function to create the filters in the BCV overlap.
00367  * Input:   - Vectors F^(-5/3) and so on
00368  *      - Matrix of the moments for the amplitude
00369  *      - indice at which the template starts
00370  *      - psi0 and psi3 for the phase
00371  * Output   - The two orthogonal filters 
00372  * */
00373 void 
00374 BankEfficiencyCreateBCVFilters(
00375   BankEfficiencyBCV *bankEfficiencyBCV,
00376   UINT4              kMin,
00377   UINT4              kMax,
00378   REAL4              psi0,
00379   REAL4              psi3);
00380         
00381 void BankEfficiencyBankPrintAscii(
00382   MetadataTable          templateBank ,
00383   UINT4                  numCoarse,
00384   InspiralCoarseBankIn   coarseBankIn );
00385 
00386 
00387 void BankEfficiencyBankPrintXML(
00388   MetadataTable          templateBank,
00389   InspiralCoarseBankIn   coarseBankIn,
00390   RandomInspiralSignalIn randIn,
00391   UserParametersIn       userParam);
00392 
00393 
00394 void BankEfficiencyGenerateInputData(
00395   LALStatus              *status,
00396   REAL4Vector            *signal,
00397   RandomInspiralSignalIn *randIn,
00398   UserParametersIn        userParam);
00399 
00400 void BankEfficiencyInitOverlapOutputIn(
00401   OverlapOutputIn *this);
00402 
00403 /* Function to compute a orthogonal vector in BCV
00404  * */
00405 void BankEfficiencyGetOrthogonalFilter(
00406   REAL4Vector *filter);
00407 
00408 
00409 /* Functon to compute the overlap between an injected signal 
00410  * and a set of templates based on BCV templates. 
00411  * It returns the overlap, the phase and alpha parameter. 
00412  * */
00413 void BankEfficiencyWaveOverlapBCV(
00414   LALStatus               *status,
00415   REAL4Vector             *correlation,
00416   InspiralWaveOverlapIn   *overlapin,
00417   REAL4Vector             *Filter1, 
00418   REAL4Vector             *Filter2,
00419   UserParametersIn         userParam, 
00420   OverlapOutputIn         *OverlapOutput,
00421   BankEfficiencyMoments   *moments);
00422 
00423 /* Function to store the moments needed by the BCV overlap process 
00424  * a11, a22, a21 are three vectors which stored the three components 
00425  * of the matrix needed in the BCV maximization process. 
00426  * */
00427 void
00428 BankEfficiencyCreateBCVMomentVector(
00429   BankEfficiencyMoments *moments,
00430   REAL8FrequencySeries  *psd,
00431   REAL8                  sampling, 
00432   REAL8                  fLower,
00433   INT4                   length);
00434 
00435 /* Function to create Vectors of the form y(f)= f^(-a/b). 
00436  * where f is the frequency. 
00437  * */
00438 void BankEfficiencyCreateVectorFreqPower( 
00439   REAL4Vector      *vector,
00440   InspiralTemplate  params,
00441   INT4              a,
00442   INT4              b);
00443 
00444 
00445 /* function to generate waveform (has to be tested). 
00446  * */
00447 void BankEfficiencyGenerateWaveform(
00448   LALStatus              *status,
00449   REAL4Vector            *signal,
00450   RandomInspiralSignalIn *params);
00451 
00452 
00453 void BankEfficiencyGetResult(
00454   LALStatus        *status,
00455   InspiralTemplate *list,
00456   InspiralTemplate  injected,
00457   OverlapOutputIn   bestOverlapout, 
00458   ResultIn         *result,
00459   UserParametersIn  userParam );
00460 
00461 /* Init the CoarseBank structure 
00462  * */
00463 void
00464 BankEfficiencyInitInspiralCoarseBankIn(
00465     InspiralCoarseBankIn    *coarseIn);
00466 
00467 /* Init the random structure 
00468  * */
00469 void BankEfficiencyInitRandomInspiralSignalIn(
00470   RandomInspiralSignalIn *randIn);
00471 
00472 /* Init the UserParametersIn structure
00473  * */
00474 void BankEfficiencyInitUserParametersIn(
00475   UserParametersIn *userParam);
00476 
00477 /* Function to initialize the different strucutre */
00478 void BankEfficiencyParametersInitialization(
00479   InspiralCoarseBankIn   *coarseIn, 
00480   RandomInspiralSignalIn *randIn, 
00481   UserParametersIn       *userParam);
00482 
00483 /* Parsing function 
00484  * */
00485 void BankEfficiencyParseParameters(
00486   INT4                    *argc, 
00487   CHAR                   **argv,
00488   InspiralCoarseBankIn    *coarseIn,
00489   RandomInspiralSignalIn  *randIn,
00490   UserParametersIn        *userParam);             
00491 
00492 /* function to check validity of some parameters
00493  * */
00494 void BankEfficiencyUpdateParams(
00495   InspiralCoarseBankIn   *coarseIn,
00496   RandomInspiralSignalIn *randIn,
00497   UserParametersIn       *userParam);
00498 
00499 
00500 /* Default values
00501  * */
00502 void BankEfficiencySetDefault(
00503   InspiralCoarseBankIn   *coarseIn, 
00504   RandomInspiralSignalIn *randIn,
00505   UserParametersIn       *userParam);
00506 
00507 /* Help Function 
00508  * */
00509 void BankEfficiencyHelp(void);
00510 
00511 /* Print Function for final results 
00512  * */
00513 void BankEfficiencyPrintResults(
00514   ResultIn                    result,
00515   RandomInspiralSignalIn      randIn,
00516   BankEfficiencySimulation    simulation);
00517 
00518 
00519 /* Print each  template bank overlap 
00520  * */
00521 void BankEfficiencyPrintBankOverlap(
00522   InspiralTemplateList **list,
00523   INT4                   sizeBank,
00524   REAL4                 *overlap,
00525   InspiralCoarseBankIn   coarseIn);
00526 
00527 /* Print the template bank coordinates in ascii format 
00528  * */
00529 void BankEfficiencyPrintBank(
00530   InspiralCoarseBankIn   coarse, 
00531   InspiralTemplateList **list,
00532   UINT4                  sizeBank);
00533 
00534 /* print the template bank coordinates  in xml format 
00535  * */
00536 void BankEfficiencyPrintBankXml(
00537   InspiralTemplateList  *coarseList,
00538   UINT4                  numCoarse,
00539   InspiralCoarseBankIn   coarseIn,
00540   RandomInspiralSignalIn randIn,
00541   UserParametersIn       userParam);
00542 
00543 void BankEfficiencyGetMaximumSize(
00544   LALStatus             *status,               
00545   RandomInspiralSignalIn randIn,
00546   InspiralCoarseBankIn   coarseBankIn, 
00547   UserParametersIn       userParam, 
00548   UINT4                 *length);
00549 
00550 
00551 void BankEfficiencyCreatePsd(
00552   LALStatus                   *status, 
00553   InspiralCoarseBankIn        *coarseBankIn, 
00554   RandomInspiralSignalIn      *randIn,
00555   UserParametersIn             userParam);
00556 
00557 /* print an error  message 
00558  * */
00559 void BankEfficiencyPrintError(char *error);
00560 
00561 void BankEfficiencyFillProc(
00562   ProcessParamsTable          *proc,
00563   InspiralCoarseBankIn        coarseIn,
00564   RandomInspiralSignalIn      randIn,
00565   UserParametersIn            userParam);
00566 
00567 /* xml file for the standalone code */
00568 void BankEfficiencyPrintResultsXml( 
00569   InspiralCoarseBankIn     coarseBankIn,
00570   RandomInspiralSignalIn   randIn,
00571   UserParametersIn         userParam,
00572   ResultIn                 trigger,
00573   BankEfficiencySimulation simulation);
00574 
00575 void BankEfficiencyPrintProtoXml(
00576   InspiralCoarseBankIn   coarseIn,
00577   RandomInspiralSignalIn randIn,
00578   UserParametersIn       userParam);
00579 
00580 void BankEfficiencyReadXmlBank(  
00581   LALStatus             *status, 
00582   CHAR                  *bankFileName, 
00583   InspiralTemplateList **list,
00584   INT4                  *sizeBank, 
00585   InspiralCoarseBankIn   coarseIn);
00586 
00587 
00588 void BankEfficiencyCreateBank(
00589   LALStatus             *status, 
00590   InspiralCoarseBankIn  *coarseBankIn,  
00591   InspiralTemplateList **list,
00592   INT4                  *sizeBank);
00593 
00594 
00595 void BankEfficiencyCreatePowerVector(
00596   LALStatus                 *status, 
00597   BankEfficiencyPowerVector *powerVector,
00598   RandomInspiralSignalIn     randIn,
00599   INT4                       length);
00600 
00601 
00602 void 
00603 BankEfficiencyInspiralOverlapBCV(
00604   LALStatus                   *status,
00605   InspiralTemplate            *list,
00606   UserParametersIn             userParam, 
00607   RandomInspiralSignalIn      *randIn,
00608   InspiralWaveOverlapIn       *overlapin,
00609   OverlapOutputIn             *output,
00610   REAL4Vector                 *correlation,
00611   BankEfficiencyBCV           *bankefficiencyBCV);
00612 
00613 void BankEfficiencyParseGetInt(CHAR **argv, INT4  *index, INT4 *data);
00614 void BankEfficiencyParseGetDouble(CHAR **argv, INT4  *index, REAL8 *data);
00615 void BankEfficiencyParseGetDouble2(CHAR **argv, INT4  *index, REAL8 *data1, 
00616   REAL8 *data2);
00617 
00618 void BankEfficiencyParseGetString(CHAR **argv, INT4  *index );
00619 CHAR* BankEfficiencyGetStringFromGridType(INT4 input);
00620 CHAR* BankEfficiencyGetStringFromSimulationType(INT4 input);
00621 CHAR* BankEfficiencyGetStringFromDetector(INT4 input);
00622 CHAR* BankEfficiencyGetStringFromTemplate(INT4 input);
00623 CHAR* BankEfficiencyGetStringFromNoiseModel(INT4 input);
00624 CHAR* BankEfficiencyGetStringFromScientificRun(INT4 input);
00625 CHAR* BankEfficiencyGetStringFromFastSimulation(INT4 input);
00626 
00627 
00628 void BankEfficiencyAscii2Xml(void);
00629 
00630 void BankEfficiencyInspiralBankGeneration(
00631   LALStatus            *status,
00632   InspiralCoarseBankIn *input,
00633   SnglInspiralTable   **first,
00634   INT4                 *ntiles,
00635   UserParametersIn      userParam);
00636 
00637 void BankEfficiencyInspiralCreateFineBank(
00638   LALStatus             *status,
00639   InspiralTemplateList **outlist,
00640   INT4                  *nlist,
00641   InspiralFineBankIn     fineIn, 
00642   UserParametersIn       param);
00643 
00644 
00645 void BankEfficiencyCreateTemplateBank(
00646   LALStatus              *status,
00647   InspiralCoarseBankIn   *coarseBankIn,
00648   MetadataTable          *templateBank,
00649   SnglInspiralTable      **tmpltHead,
00650   UserParametersIn        userParam,
00651   RandomInspiralSignalIn *randIn,
00652   INT4                   *sizeBank);
00653 
00654 void BankEfficiencyUpdateSNRHistogram(
00655   REAL4Vector   *correlation,
00656   gsl_histogram *histogramNoise);
00657 
00658 static int vrbflg = 0;
00659 
00660 REAL4 GetMaxVector(REAL4 *vect, INT4 n);
00661 REAL4 GetMinVectorNonZero(REAL4 *vect, INT4 n);
00662 
00663 void BankEfficiencyWaveOverlap(
00664   LALStatus             *status,
00665   REAL4Vector            *correlation, 
00666   InspiralWaveOverlapIn  *overlapin,
00667   OverlapOutputIn        *test,
00668   INT4                    startPad);
00669   
00670 void BankEfficiencySaveVector(
00671   const char  *filename, 
00672   REAL4Vector  correlation, 
00673   REAL4        tSampling);
00674 
00675 void BankEfficiencySaveVectorAppend(
00676   const char  *filename, 
00677   REAL4Vector  correlation, 
00678   REAL4        tSampling);
00679 
00680 void BankEfficiencyPrintMessage(const char *str);
00681 
00682 
00683   
00684   
00685 void BankEfficiencyPopulateAmbiguityFunction(
00686   gsl_matrix      *amb1,
00687   REAL4Vector      correlation,
00688   INT4             tmpltIndex,
00689   OverlapOutputIn  outputTemplate,
00690   INT4             startPad, 
00691   InspiralTemplate insptmplt);
00692 
00693 
00694 typedef struct {
00695 REAL4 *mass1;
00696 REAL4 *mass2;
00697 REAL4 *fFinal;
00698 REAL4 *tau0;
00699 REAL4 *tau3;
00700 REAL4 *psi0;
00701 REAL4 *psi3;
00702 REAL4 *alpha;
00703 UINT4 *index;
00704 UINT4 *used;
00705 UINT4 size;
00706 REAL4 *eccentricity;
00707 REAL4 *snr;
00708 REAL4 *gamma0;
00709 REAL4 *gamma1;
00710 REAL4 *gamma2;
00711 REAL4 *gamma3;
00712 REAL4 *gamma4;
00713 REAL4 *gamma5;
00714 Approximant approximant;
00715 } Mybank;    
00716 
00717   
00718 /* --- initialise and create a template bank structure for the fast option ---*/   
00719 void BankEfficiencyInitMyBank(
00720   Mybank            *mybank, 
00721   INT4              *sizeBank,
00722   SnglInspiralTable *tmpltHead,
00723   UserParametersIn   userParam);
00724   
00725   
00726 /* --- initialise the eccentric template bank parameters --- */  
00727 void BankEfficiencyEccentricBankInit(
00728   UserParametersIn *userParam);
00729   
00730 /* --- print the ambiguity function in a file --- */  
00731 void BankEfficiencyPrintAmbiguity(
00732   UserParametersIn userParam,
00733   INT4             sizebank,
00734   gsl_matrix       *amb1  
00735 );
00736 
00737 void BankEfficiencyError(const char * str);
00738 void BankEfficiencyCompare(REAL4 a, REAL4 b, const char *str);
00739 void BankEfficiencyValidity(REAL4 a,  REAL4 min,  REAL4 max, const char * str);
00740 REAL4 BankEfficiencyRandom(REAL4 min, REAL4 max);
00741 
00742 
00743 void GetClosestValidTemplate(Mybank bank, RandomInspiralSignalIn randIn, 
00744     UINT4 *fast_index);
00745   
00746 void GetTau03FromMasses(RandomInspiralSignalIn randIn,REAL4 *tau0, REAL4 *tau3);
00747   
00748 REAL4 BankEfficiencyComputeEMatch(
00749   RandomInspiralSignalIn *randIn, Mybank mybank, INT4 index);
00750 
00751 void BankEfficiencyCreateListFromTmplt(
00752   LALStatus         *status,
00753   InspiralTemplate  *insptmplt, 
00754   Mybank             mybank,
00755   INT4               index);
00756 
00757 void  BankEfficiencyFinalise(
00758   LALStatus              *status,
00759   Mybank                  mybank,
00760   OverlapOutputIn         overlapOutputBestTemplate,
00761   RandomInspiralSignalIn  randIn,
00762   UserParametersIn        userParam,
00763   BankEfficiencySimulation simulation,
00764   InspiralCoarseBankIn    coarseBankIn);
00765 
00766 void BankEfficiencyInitAmbiguity(gsl_matrix *amb, INT4 sizeBank);
00767 
00768  

Generated on Tue Oct 14 02:31:24 2008 for LAL by  doxygen 1.5.2