burstdso.h

Go to the documentation of this file.
00001 /*
00002 *  Copyright (C) 2007 Julien Sylvestre
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 #ifndef BURSTDSOH
00021 #define BURSTDSOH
00022 
00023 #include "datacondAPI/DatacondCaller.h"
00024 #include <lal/StdBurstSearch.h>
00025 #include <lal/LALDatatypes.h>
00026 #include <lal/LIGOMetadataTables.h>
00027 
00028 #include "FrameL.h"
00029 #include <lal/FrameStream.h>
00030 
00031 #ifdef  __cplusplus
00032 extern "C" {
00033 #endif
00034 
00035   /*****************************************************************/
00036 
00037   /* Define DEBUGBURST for debug info to be sent to disk */
00038   /*
00039 #define DEBUGBURST 
00040   */
00041 
00042   /* big endian when not linux */
00043 #ifdef linux
00044 #undef WORDS_BIGENDIAN
00045 #endif
00046 
00047   /* max number of triggers */
00048 #define MAXNBURSTS 50000
00049 
00050   /* max size of a blob object */
00051 #define MAXBLOB 800000
00052 
00053   /* names of the channels used by the wrapper */
00054 #define GW_STRAIN_DATA "GW_STRAIN_DATA"
00055 #define GW_STRAIN_PSD "GW_STRAIN_PSD"
00056 
00057   /* name of the frame cache file */
00058 #define CACHEFILENAME "FrCacheFile"
00059 
00060   /* abort macro for LAL functions */
00061 #define SABORT(I,M) fprintf(stderr,"ERROR: %i\n%s\n%s:%i\n",I,M,__FILE__,__LINE__); return 1
00062 
00063   /* macro to check LAL status pointer */
00064 #define RCHECKSTATUSPTR( statusptr ) \
00065   if ( (statusptr)->statusPtr->statusCode ) \
00066   { \
00067     SETSTATUS( statusptr, -1, "Recursive error" ); \
00068     DETATCHSTATUSPTR(status); \
00069     RETURN (status); \
00070   } else (void)(0)
00071 
00072   /*
00073 #define LALCALL (x) ((x), \
00074   if ( stat.statusPtr->statusCode ) \
00075   { \
00076     fprintf(stderr,"LAL error: %s, line %i\n",__FILE__,__LINE__); \
00077     return 1; \
00078   } else (void)(0)
00079   */
00080 
00081   /* Assert/Abort macros for LAL functions */
00082 #define SASSERT(p1,p3,p4) if(!(p1)) {SABORT(p3,p4);}
00083 
00084 #define RASSERT(p1,p2,p3,p4) if(!(p1)) {ABORT(p2,p3,p4);}
00085 
00086 #define TASSERT(p1,p2,p3,p4) if(!(p1)) {SABORT(p3,p4);}
00087 
00088 
00089   /* linked list for burst parameters */
00090   typedef struct tagBurstParameterList {
00091     
00092     struct tagBurstParameterList *next;
00093 
00094     BurstParameter param;
00095 
00096   } BurstParameterList;
00097 
00098 
00099   /* implemented ETGs */
00100   typedef enum {TFCLUSTERS,SLOPE,POWER} BurstETG;
00101 
00102   /* burst search structure */
00103   typedef struct tagBurstSearchParams {
00104 
00105     CHAR channel[LIGOMETA_CHANNEL_MAX]; /* channel name */
00106     
00107     UINT4 Ndata; /* number of data points */
00108 
00109     BurstParameter waveforms; /* linked list of waveform names */
00110 
00111     UINT4 Nwaveforms; /* number of waveforms */
00112 
00113     REAL4TimeVectorSeries *wave_pc; /* input data */
00114 
00115     BurstParameter waveform_amplitudes; /* linked list of amplitudes */
00116 
00117     UINT4 Nwaveform_amplitude; /* number of amplitudes */
00118 
00119     BurstParameter alpha; /* linked list of alpha */
00120 
00121     UINT4 Nalpha; /* numebr of alpha */
00122 
00123     BurstParameter delta; /* linked list of delta */
00124 
00125     UINT4 Ndelta; /* number of delta */
00126 
00127     BurstParameter psi; /* linked list of psi */
00128 
00129     UINT4 Npsi; /* number of psi */
00130 
00131     UINT4 MAXinj; 
00132 
00133     UINT4 Ninj; /* number of injections */
00134 
00135     BurstParameter injTimes; /* linked list of injection times */
00136 
00137     UINT4 Ninj_per_segment; /* number of injection times */
00138 
00139     BurstETG ETG; /* which ETG */
00140 
00141     BurstParameterList ETGparams; /* linked list of ETG parameters; each parameter can be a linked list */
00142 
00143     BOOLEAN ETGparamsLOCK; /* ETG parameters are locked: when matrix input, don't permute order of parameters */
00144 
00145     UINT4 Nparams; /* number of ETG parameters */
00146 
00147     UINT4 *NNparams; /* number of element of each ETG parameter */
00148 
00149     BurstOutputDataSegment data; /* data for Parameter Estimation function */
00150 
00151     BurstOutputParameters oparams; /* parameters for PEst function */
00152 
00153     BOOLEAN searchMaster; /* Am I searchMaster? */
00154 
00155     void (*ETGfun)(LALStatus *, EventIDColumn *, REAL4TimeVectorSeries *, BurstParameter *); /* pointer to LAL function implementing the ETG */
00156 
00157     INT4 outputMethod; /* flag for output method */
00158 
00159     BOOLEAN noLALBurstOutput; /* flag for disabling the PEst function */
00160 
00161     CHAR dsoOutput[1024]; /* output file */
00162 
00163     BOOLEAN allowNoResponse; /* flag to avoid using response files */
00164 
00165   } BurstSearchParams;
00166 
00167 
00168   void ParseParameter( 
00169                       LALStatus *stat,
00170                       BurstParameter *params,
00171                       CHAR *argv,
00172                       UINT4 *N
00173                       );
00174 
00175 /******** <lalErrTable file="TFCInitSearchHErrTab"> ********/
00176 #define INITSEARCHH_ENULL     1
00177 #define INITSEARCHH_ENNUL     2
00178 #define INITSEARCHH_EALOC     3
00179 #define INITSEARCHH_EARGS     4
00180 #define INITSEARCHH_ESPOS      5
00181 #define INITSEARCHH_ENAN      6
00182 #define INITSEARCHH_EAOR      7
00183 #define INITSEARCHH_EPOS      8
00184 #define INITSEARCHH_EMMF      9
00185 #define INITSEARCHH_ENAM      10
00186 #define INITSEARCHH_ETAB      11
00187 #define INITSEARCHH_EIN      12
00188 #define INITSEARCHH_ERANK     13
00189 #define INITSEARCHH_EMAXBLOB 14
00190 #define INITSEARCHH_EETG 15
00191 #define INITSEARCHH_EETGDATA 16
00192 #define INITSEARCHH_ENB 17
00193 #define INITSEARCHH_EUI 18
00194 #define INITSEARCHH_EFILE 19
00195 
00196 #define INITSEARCHH_MSGENULL     "Null pointer"
00197 #define INITSEARCHH_MSGENNUL     "Non-null pointer"
00198 #define INITSEARCHH_MSGEALOC     "Memory allocation error"
00199 #define INITSEARCHH_MSGEARGS     "Wrong number of arguments"
00200 #define INITSEARCHH_MSGESPOS      "Parameter <= 0 expected to be strictly positive"
00201 #define INITSEARCHH_MSGENAN       "Numerical parameter is NaN"
00202 #define INITSEARCHH_MSGEAOR      "Parameter expected to be in [0,1] is out of range"
00203 #define INITSEARCHH_MSGEPOS      "Parameter < 0 when expected to be positive or zero"
00204 #define INITSEARCHH_MSGEMMF      "Parameter minf > maxf"
00205 #define INITSEARCHH_MSGENAM       "Channel/IFO name is zero length"
00206 #define INITSEARCHH_MSGETAB       "Unknown table name"
00207 #define INITSEARCHH_MSGEIN       "invalid input"
00208 #define INITSEARCHH_MSGERANK     "rank of node"
00209 #define INITSEARCHH_MSGEMAXBLOB "Maximum allowed BLOB size (1 Mo) exceeded"
00210 #define INITSEARCHH_MSGEETG "ETG function generated a SIGSEGV or SIGBUS signal!"
00211 #define INITSEARCHH_MSGEETGDATA "ETG function modifies its input!"
00212 #define INITSEARCHH_MSGENB "Maximum number of burst exceeded!"
00213 #define INITSEARCHH_MSGEUI "Unimplemented feature!"
00214 #define INITSEARCHH_MSGEFILE "File error!"
00215 
00216 /******** </lalErrTable> ********/
00217 
00218 
00219   /*****************************************************************/
00220 
00221 typedef enum {Unknown, TimeSeries, FrequencySeries, Other1D, TimeFrequency, Wavelets, MultiDimensional} ObjectType;
00222 
00223 void
00224 LALFrGetSeriesType(
00225     LALStatus   *status,
00226     LALTYPECODE *output,
00227     ObjectType *objtype,
00228     FrChanIn    *chanin,
00229     FrStream    *stream
00230     );
00231 
00232 int OutputSymbols(char *algorithms, 
00233                  int *Nsymbols,
00234                   datacond_symbol_type **symbols);
00235 
00236 int getFrameCache(char *fQuery, 
00237                   char *dataserver);
00238 
00239 int getFrameData(char *fQuery, 
00240                  char *dataserver,
00241                  int *Nsymbols,
00242                  datacond_symbol_type **symbols);
00243 
00244 int getNonFrameData(char *rFiles, 
00245                     char **algorithms, 
00246                     int *Nsymbols,
00247                     datacond_symbol_type **symbols);
00248 
00249 int InitSearch(char *filterParams, 
00250                BurstSearchParams *bparams);
00251 
00252 int ConditionData(int Nsymbols,
00253                   datacond_symbol_type *symbols,
00254                   char *algorithms);
00255 
00256 int ReConditionData(int Nsymbols,
00257                     datacond_symbol_type *symbols,
00258                     char *algorithms,
00259                     BurstSearchParams *bparams);
00260 
00261 int RunSearch(BurstSearchParams *bparams,
00262               double f0, 
00263               double f1
00264               );
00265 
00266 int ExtractResponse( COMPLEX8FrequencySeries *respPtr, 
00267                      int Nsymbols, 
00268                      datacond_symbol_type *symbols, 
00269                      char *ifo );
00270 
00271 int symbolsfree(datacond_symbol_type *symbols);
00272 
00273 int bparamsfree(BurstSearchParams *bparams); 
00274 
00275 #ifdef  __cplusplus
00276 }
00277 #endif
00278 
00279 #endif

Generated on Tue Sep 2 02:40:52 2008 for LAL by  doxygen 1.5.2