00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00038
00039
00040
00041
00042
00043 #ifdef linux
00044 #undef WORDS_BIGENDIAN
00045 #endif
00046
00047
00048 #define MAXNBURSTS 50000
00049
00050
00051 #define MAXBLOB 800000
00052
00053
00054 #define GW_STRAIN_DATA "GW_STRAIN_DATA"
00055 #define GW_STRAIN_PSD "GW_STRAIN_PSD"
00056
00057
00058 #define CACHEFILENAME "FrCacheFile"
00059
00060
00061 #define SABORT(I,M) fprintf(stderr,"ERROR: %i\n%s\n%s:%i\n",I,M,__FILE__,__LINE__); return 1
00062
00063
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
00074
00075
00076
00077
00078
00079
00080
00081
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
00090 typedef struct tagBurstParameterList {
00091
00092 struct tagBurstParameterList *next;
00093
00094 BurstParameter param;
00095
00096 } BurstParameterList;
00097
00098
00099
00100 typedef enum {TFCLUSTERS,SLOPE,POWER} BurstETG;
00101
00102
00103 typedef struct tagBurstSearchParams {
00104
00105 CHAR channel[LIGOMETA_CHANNEL_MAX];
00106
00107 UINT4 Ndata;
00108
00109 BurstParameter waveforms;
00110
00111 UINT4 Nwaveforms;
00112
00113 REAL4TimeVectorSeries *wave_pc;
00114
00115 BurstParameter waveform_amplitudes;
00116
00117 UINT4 Nwaveform_amplitude;
00118
00119 BurstParameter alpha;
00120
00121 UINT4 Nalpha;
00122
00123 BurstParameter delta;
00124
00125 UINT4 Ndelta;
00126
00127 BurstParameter psi;
00128
00129 UINT4 Npsi;
00130
00131 UINT4 MAXinj;
00132
00133 UINT4 Ninj;
00134
00135 BurstParameter injTimes;
00136
00137 UINT4 Ninj_per_segment;
00138
00139 BurstETG ETG;
00140
00141 BurstParameterList ETGparams;
00142
00143 BOOLEAN ETGparamsLOCK;
00144
00145 UINT4 Nparams;
00146
00147 UINT4 *NNparams;
00148
00149 BurstOutputDataSegment data;
00150
00151 BurstOutputParameters oparams;
00152
00153 BOOLEAN searchMaster;
00154
00155 void (*ETGfun)(LALStatus *, EventIDColumn *, REAL4TimeVectorSeries *, BurstParameter *);
00156
00157 INT4 outputMethod;
00158
00159 BOOLEAN noLALBurstOutput;
00160
00161 CHAR dsoOutput[1024];
00162
00163 BOOLEAN allowNoResponse;
00164
00165 } BurstSearchParams;
00166
00167
00168 void ParseParameter(
00169 LALStatus *stat,
00170 BurstParameter *params,
00171 CHAR *argv,
00172 UINT4 *N
00173 );
00174
00175
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
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