Skip to content

Commit

Permalink
Merged: Weird oscillations warning + Different preBuffers in the libr…
Browse files Browse the repository at this point in the history
…ary + Adaptation to XIFUSIM081 (EXTEND and PH_ID columns)
  • Loading branch information
bcobo committed Mar 10, 2021
1 parent 5fc4906 commit d538d04
Show file tree
Hide file tree
Showing 16 changed files with 6,514 additions and 1,109 deletions.
1,643 changes: 1,643 additions & 0 deletions libsixt/advdet.c

Large diffs are not rendered by default.

671 changes: 671 additions & 0 deletions libsixt/advdet.h

Large diffs are not rendered by default.

784 changes: 572 additions & 212 deletions libsixt/integraSIRENA.cpp

Large diffs are not rendered by default.

47 changes: 27 additions & 20 deletions libsixt/integraSIRENA.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,24 +316,26 @@ typedef struct PulseDetected
/** tstart(i)-tstart(i-1)*/
int grade2;

int grade2_1;
int grade2_1;

/** PIX_ID of the detected pulse*/
int pixid;

/** PH_ID of the detected pulse*/
///** PH_IDs corresponding to the record where is the detected pulse*/
int phid;
int phid2;
int phid3;

/** Vector containing the pulse adc values */
gsl_vector *pulse_adc;

/** Vector containing the pulse adc values and the preBuffer*/
/** Vector containing the pulse adc values and the preBuffer*/
gsl_vector *pulse_adc_preBuffer;

/** Start time of the Pulse */
double Tstart;

/** Start time of the Pulse in samples */
/** Start time of the Pulse in samples */
double TstartSamples;

/** End time of the Pulse */
Expand All @@ -357,32 +359,32 @@ typedef struct PulseDetected
/** Energy (KeV) of the Pulse */
double energy;

/** Pulse grade */
/** Pulse grade */
int grading;

/** Average of the first 4 samples of the derivative of the Pulse */
/** Average of the first 4 samples of the derivative of the Pulse */
double avg_4samplesDerivative;

/** Low resolution energy estimator (4 samples-long filter) */
/** Low resolution energy estimator (4 samples-long filter) */
double E_lowres;

/** Offset relative to the central point of the parabola */
double phi;
/** Offset relative to the central point of the parabola */
double phi;

/** Number of samples shifted to find the maximum of the parabola */
int lagsShift;
/** Number of samples shifted to find the maximum of the parabola */
int lagsShift;

/** Quality of the Pulse */
double quality;

/**Number of lags used in detection*/
int numLagsUsed;
/**Number of lags used in detection*/
int numLagsUsed;

/** Baseline calculated, in general, by using the previous Lb samples to the pulse */
double bsln;
/** Baseline calculated, in general, by using the previous Lb samples to the pulse */
double bsln;

/** Rms of the baseline calculated, in general, by using the previous Lb samples to the pulse */
double rmsbsln;
/** Rms of the baseline calculated, in general, by using the previous Lb samples to the pulse */
double rmsbsln;
#ifdef __cplusplus
PulseDetected();
PulseDetected(const PulseDetected& other);
Expand Down Expand Up @@ -535,6 +537,12 @@ typedef struct ReconstructInitSIRENA

//0-padding filter if 0 (from pulseLength to OFLength filter filled in with 0's) or filter with a filter+preBuffer if different from 0
int preBuffer;
int preBuffer_min_value;
int preBuffer_max_value;

// Values from the grading info in the XML file
int post_min_value;
int post_max_value;

/** Write intermediate files **/
int intermediate;
Expand Down Expand Up @@ -633,7 +641,7 @@ void initializeReconstructionSIRENA(ReconstructInitSIRENA* reconstruct_init,
double filtEev, double Ifit, char* ofnoise,
int lagsornot, int nLags, int Fitting35, int ofiter, char oflib,
char *ofinterp, char* oflength_strategy,
int oflength, int preBuffer,
int oflength, char preBuffer,
double monoenergy, char hduPRECALWN,
char hduPRCLOFWM, int largeFilter,
int interm, char* detectFile,
Expand Down Expand Up @@ -671,8 +679,7 @@ extern "C"
#endif
void reconstructRecordSIRENA(TesRecord* record, int trig_reclength, TesEventList* event_list, ReconstructInitSIRENA* reconstruct_init, int lastRecord, int nRecord, PulsesCollection **pulsesAll, OptimalFilterSIRENA **optimalFilter, int* const status);


LibraryCollection* getLibraryCollection(const char* const filename, int opmode, int hduPRECALWN, int hduPRCLOFWM, int largeFilter, char *filter_domain, int pulse_length, char *energy_method, char *ofnoise, char *filter_method, char oflib, char **ofinterp, double filtEev, int lagsornot, int preBuffer, int* const status);
LibraryCollection* getLibraryCollection(const char* const filename, int opmode, int hduPRECALWN, int hduPRCLOFWM, int largeFilter, char *filter_domain, int pulse_length, char *energy_method, char *ofnoise, char *filter_method, char oflib, char **ofinterp, double filtEev, int lagsornot, int preBuffer, gsl_vector *pBi, gsl_vector *posti, int* const status);

NoiseSpec* getNoiseSpec(const char* const filename,int opmode,int hduPRCLOFWM,char *energy_method,char *ofnoise,char *filter_method,int* const status);

Expand Down
23 changes: 16 additions & 7 deletions libsixt/scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void energy_worker()
if(energy_queue.wait_and_pop(data)){
//log_trace("Extracting energy data from queue...");
//log_debug("Energy data in record %i",data->n_record);
th_runEnergy(data->rec, data->trig_reclength,
th_runEnergy(data->rec, data->n_record, data->trig_reclength,
&(data->rec_init),
&(data->record_pulses),
//&(data->optimal_filter));
Expand All @@ -89,7 +89,7 @@ void energy_worker_v2()
if(detected_queue.wait_and_pop(data)){
//log_trace("Extracting energy data from queue...");
//log_debug("Energy data in record %i",data->n_record);
th_runEnergy(data->rec, data->trig_reclength,
th_runEnergy(data->rec, data->n_record, data->trig_reclength,
&(data->rec_init),
&(data->record_pulses),
//&(data->optimal_filter);
Expand Down Expand Up @@ -156,12 +156,13 @@ void scheduler::push_detection(TesRecord* record, int trig_reclength,
input->event_list->grades2 = new int[event_list->size];
input->event_list->pulse_heights = new double[event_list->size];
input->event_list->ph_ids = new long[event_list->size];
input->event_list->ph_ids2 = new long[event_list->size];
input->event_list->ph_ids3 = new long[event_list->size];
input->event_list->grading = new int[event_list->size];
input->event_list->phis = new double[event_list->size];
input->event_list->lagsShifts = new int[event_list->size];
input->event_list->bsln = new double[event_list->size];
input->event_list->pix_ids = new long[event_list->size];
input->event_list->ph_ids = new long[event_list->size];
log_trace("push_detection 3");
detection_queue.push(input);
log_trace("push_detection 4");
Expand Down Expand Up @@ -316,12 +317,14 @@ void scheduler::finish_reconstruction(ReconstructInitSIRENA* reconstruct_init,
event_list->grades1[ip] = record_pulses->pulses_detected[ip].grade1;
event_list->grades2[ip] = record_pulses->pulses_detected[ip].grade2;
event_list->pulse_heights[ip] = record_pulses->pulses_detected[ip].pulse_height;
event_list->ph_ids[ip] = 0;
//event_list->ph_ids[ip] = 0;
event_list->phis[ip] = record_pulses->pulses_detected[ip].phi;
event_list->lagsShifts[ip] = record_pulses->pulses_detected[ip].lagsShift;
event_list->bsln[ip] = record_pulses->pulses_detected[ip].bsln;
event_list->pix_ids[ip] = record_pulses->pulses_detected[ip].pixid;
event_list->ph_ids[ip] = record_pulses->pulses_detected[ip].phid;
event_list->ph_ids2[ip] = record_pulses->pulses_detected[ip].phid2;
event_list->ph_ids3[ip] = record_pulses->pulses_detected[ip].phid3;
}
if (data_array[i]->last_record == 1) {
//log_debug("eventlist last record");
Expand Down Expand Up @@ -362,12 +365,14 @@ void scheduler::finish_reconstruction(ReconstructInitSIRENA* reconstruct_init,
event_list->grades1[ip] = (*pulsesAll)->pulses_detected[ip].grade1;
event_list->grades2[ip] = (*pulsesAll)->pulses_detected[ip].grade2;
event_list->pulse_heights[ip] = (*pulsesAll)->pulses_detected[ip].pulse_height;
event_list->ph_ids[ip] = 0;
//event_list->ph_ids[ip] = 0;
event_list->phis[ip] = record_pulses->pulses_detected[ip].phi;
event_list->lagsShifts[ip] = record_pulses->pulses_detected[ip].lagsShift;
event_list->bsln[ip] = record_pulses->pulses_detected[ip].bsln;
event_list->pix_ids[ip] = record_pulses->pulses_detected[ip].pixid;
event_list->ph_ids[ip] = record_pulses->pulses_detected[ip].phid;
event_list->ph_ids2[ip] = record_pulses->pulses_detected[ip].phid2;
event_list->ph_ids3[ip] = record_pulses->pulses_detected[ip].phid3;
}
}
}
Expand Down Expand Up @@ -538,12 +543,14 @@ void scheduler::finish_reconstruction_v2(ReconstructInitSIRENA* reconstruct_init
event_list->grades1[ip] = record_pulses->pulses_detected[ip].grade1;
event_list->grades2[ip] = record_pulses->pulses_detected[ip].grade2;
event_list->pulse_heights[ip] = record_pulses->pulses_detected[ip].pulse_height;
event_list->ph_ids[ip] = 0;
//event_list->ph_ids[ip] = 0;
event_list->phis[ip] = record_pulses->pulses_detected[ip].phi;
event_list->lagsShifts[ip] = record_pulses->pulses_detected[ip].lagsShift;
event_list->bsln[ip] = record_pulses->pulses_detected[ip].bsln;
event_list->pix_ids[ip] = record_pulses->pulses_detected[ip].pixid;
event_list->ph_ids[ip] = record_pulses->pulses_detected[ip].phid;
event_list->ph_ids2[ip] = record_pulses->pulses_detected[ip].phid2;
event_list->ph_ids3[ip] = record_pulses->pulses_detected[ip].phid3;
}
if (data_array[i]->last_record == 1) {
//log_debug("eventlist last record");
Expand Down Expand Up @@ -584,12 +591,14 @@ void scheduler::finish_reconstruction_v2(ReconstructInitSIRENA* reconstruct_init
event_list->grades1[ip] = (*pulsesAll)->pulses_detected[ip].grade1;
event_list->grades2[ip] = (*pulsesAll)->pulses_detected[ip].grade2;
event_list->pulse_heights[ip] = (*pulsesAll)->pulses_detected[ip].pulse_height;
event_list->ph_ids[ip] = 0;
//event_list->ph_ids[ip] = 0;
event_list->phis[ip] = record_pulses->pulses_detected[ip].phi;
event_list->lagsShifts[ip] = record_pulses->pulses_detected[ip].lagsShift;
event_list->bsln[ip] = record_pulses->pulses_detected[ip].bsln;
event_list->pix_ids[ip] = record_pulses->pulses_detected[ip].pixid;
event_list->ph_ids[ip] = record_pulses->pulses_detected[ip].phid;
event_list->ph_ids2[ip] = record_pulses->pulses_detected[ip].phid2;
event_list->ph_ids3[ip] = record_pulses->pulses_detected[ip].phid3;
}
}
}
Expand Down

0 comments on commit d538d04

Please sign in to comment.