diff --git a/src/external/MuSR_software/Class_MuSR_PSI/CMakeLists.txt b/src/external/MuSR_software/Class_MuSR_PSI/CMakeLists.txt index 6822f600..e3df5938 100644 --- a/src/external/MuSR_software/Class_MuSR_PSI/CMakeLists.txt +++ b/src/external/MuSR_software/Class_MuSR_PSI/CMakeLists.txt @@ -5,7 +5,7 @@ set(prefix "${CMAKE_INSTALL_PREFIX}") set(exec_prefix "\$\{prefix\}") set(libdir "\$\{exec_prefix\}/lib") set(includedir "\$\{prefix\}/include") -set(PSIBIN_VERSION "0.1.0") +set(PSIBIN_VERSION "0.2.0") set(PSIBIN_LIBRARY_NAME "Class_MuSR_PSI") configure_file("Class_MuSR_PSI.pc.in" "Class_MuSR_PSI.pc" @ONLY) diff --git a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp index 99bd5af0..2e52e090 100644 --- a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp +++ b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.cpp @@ -10,6 +10,7 @@ begin : Alex Amato, October 2005 modified : Andrea Raselli, October 2009 + : Andreas Suter, May 2020 copyright : (C) 2005 by email : alex.amato@psi.ch @@ -41,7 +42,6 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() { - histo = nullptr; Clear(); } @@ -60,7 +60,7 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() //******************************* -//Implementation read (generic read) +//Implementation Read (generic read) //******************************* /*! \brief Method to read a PSI-bin or an MDU file @@ -78,25 +78,25 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() * be opened. */ - int MuSR_td_PSI_bin::read(const char * fileName) + int MuSR_td_PSI_bin::Read(const char * fileName) { std::ifstream file_name; Clear(); - filename = fileName; + fFilename = fileName; file_name.open(fileName, std::ios_base::binary); // open file if (file_name.fail()) { - readstatus = "ERROR Open "+filename+" failed!"; + fReadStatus = "ERROR Open "+fFilename+" failed!"; return 1; // ERROR open failed } char *buffer_file = new char[3]; if (!buffer_file) { - readstatus = "ERROR Allocating data buffer"; + fReadStatus = "ERROR Allocating data buffer"; return 3; // ERROR allocating data buffer } @@ -106,45 +106,45 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() { file_name.close(); delete [] buffer_file; - readstatus = "ERROR Reading "+filename+" header failed!"; + fReadStatus = "ERROR Reading "+fFilename+" header failed!"; return 1; // ERROR reading header failed } - strncpy(format_id,buffer_file,2); - format_id[2] = '\0'; + strncpy(fFormatId,buffer_file,2); + fFormatId[2] = '\0'; file_name.close(); delete [] buffer_file; - if (format_id[0] == '1') { - if (format_id[1] != 'N') { - std::cout << "**WARNING** found '" << format_id << "'. Will change it to '1N'" << std::endl; - format_id[1] = 'N'; + if (fFormatId[0] == '1') { + if (fFormatId[1] != 'N') { + std::cout << "**WARNING** found '" << fFormatId << "'. Will change it to '1N'" << std::endl; + fFormatId[1] = 'N'; } } // file may either be PSI binary format - if (strncmp(format_id,"1N",2) == 0) + if (strncmp(fFormatId,"1N",2) == 0) { - return readbin(fileName); // then read it as PSI bin + return ReadBin(fileName); // then read it as PSI bin } // or MDU format (pTA, TDC or 32 channel TDC) - else if ((strncmp(format_id,"M3",2) == 0) ||(strncmp(format_id,"T4",2) == 0) || - (strncmp(format_id,"T5",2) == 0)) + else if ((strncmp(fFormatId,"M3",2) == 0) ||(strncmp(fFormatId,"T4",2) == 0) || + (strncmp(fFormatId,"T5",2) == 0)) { - return readmdu(fileName); // else read it as MDU + return ReadMdu(fileName); // else read it as MDU } else { - readstatus = "ERROR Unknown file format in "+filename+"!"; + fReadStatus = "ERROR Unknown file format in "+fFilename+"!"; return 2; // ERROR unsupported version } } //******************************* - //Implementation write (generic write) + //Implementation Write (generic write) //******************************* /*! \brief Method to write a PSI-bin or an MDU file @@ -162,7 +162,7 @@ MuSR_td_PSI_bin::MuSR_td_PSI_bin() * be opened. */ -int MuSR_td_PSI_bin::write(const char *fileName) +int MuSR_td_PSI_bin::Write(const char *fileName) { std::string fln = fileName; size_t found = fln.find_last_of("."); @@ -172,9 +172,9 @@ int MuSR_td_PSI_bin::write(const char *fileName) std::string ext = fln.substr(found+1); int status = 0; if (ext == "bin") - status = writebin(fileName); + status = WriteBin(fileName); else if (ext == "mdu") - status = writemdu(fileName); + status = WriteMdu(fileName); else return 2; @@ -224,7 +224,7 @@ typedef long int Int32; typedef float Float32; //******************************* -//Implementation readbin +//Implementation ReadBin //******************************* /*! \brief Method to read a PSI-bin file @@ -242,7 +242,7 @@ typedef float Float32; * be opened. */ -int MuSR_td_PSI_bin::readbin(const char * fileName) +int MuSR_td_PSI_bin::ReadBin(const char * fileName) { std::ifstream file_name; Int16 *dum_Int16; @@ -269,35 +269,35 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) if (sizeof(Int16) != 2) { - readstatus = "ERROR Size of Int16 data type is not 2 bytes!"; + fReadStatus = "ERROR Size of Int16 data type is not 2 bytes!"; return 1; // ERROR open failed } if (sizeof(Int32) != 4) { - readstatus = "ERROR Sizeof Int32 data type is not 4 bytes"; + fReadStatus = "ERROR Sizeof Int32 data type is not 4 bytes"; return 1; // ERROR open failed } if (sizeof(Float32) != 4) { - readstatus = "ERROR Sizeof Float32 data type is not 4 bytes"; + fReadStatus = "ERROR Sizeof Float32 data type is not 4 bytes"; return 1; // ERROR open failed } - filename = fileName; + fFilename = fileName; file_name.open(fileName, std::ios_base::binary); // open PSI bin file if (file_name.fail()) { - readstatus = "ERROR Open "+filename+" failed!"; + fReadStatus = "ERROR Open "+fFilename+" failed!"; return 1; // ERROR open failed } char *buffer_file = new char[1024]; if (!buffer_file) { - readstatus = "ERROR Allocating buffer to read header failed!"; + fReadStatus = "ERROR Allocating buffer to read header failed!"; return 3; // ERROR allocating data buffer } @@ -306,21 +306,21 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) { file_name.close(); delete [] buffer_file; - readstatus = "ERROR Reading "+filename+" header failed!"; + fReadStatus = "ERROR Reading "+fFilename+" header failed!"; return 1; // ERROR reading header failed } // fill header data into member variables - strncpy(format_id,buffer_file,2); - format_id[2] = '\0'; + strncpy(fFormatId,buffer_file,2); + fFormatId[2] = '\0'; - if (format_id[1] != 'N') // the warning is already issued in read() - format_id[1] = 'N'; + if (fFormatId[1] != 'N') // the warning is already issued in read() + fFormatId[1] = 'N'; - if (strcmp(format_id,"1N") != 0) + if (strcmp(fFormatId,"1N") != 0) { file_name.close(); delete [] buffer_file; - readstatus = "ERROR Unknown file format in "+filename+"!"; + fReadStatus = "ERROR Unknown file format in "+fFilename+"!"; return 2; // ERROR unsupported version } @@ -331,109 +331,104 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) tdc_overflow = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[6]; - num_run = *dum_Int16; + fNumRun = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[28]; - length_histo = *dum_Int16; + fLengthHisto = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[30]; - number_histo = *dum_Int16; + fNumberHisto = *dum_Int16; - strncpy(sample,buffer_file+138,10); - sample[10] = '\0'; + strncpy(fSample,buffer_file+138,10); + fSample[10] = '\0'; - strncpy(temp,buffer_file+148,10); - temp[10] = '\0'; + strncpy(fTemp,buffer_file+148,10); + fTemp[10] = '\0'; - strncpy(field,buffer_file+158,10); - field[10] = '\0'; + strncpy(fField,buffer_file+158,10); + fField[10] = '\0'; - strncpy(orient,buffer_file+168,10); - orient[10] = '\0'; + strncpy(fOrient,buffer_file+168,10); + fOrient[10] = '\0'; - strncpy(setup, buffer_file+178, 10); - setup[10] = '\0'; + strncpy(fSetup, buffer_file+178, 10); + fSetup[10] = '\0'; - strncpy(comment,buffer_file+860,62); - comment[62] = '\0'; + strncpy(fComment,buffer_file+860,62); + fComment[62] = '\0'; - strncpy(date_start,buffer_file+218,9); - date_start[9] = '\0'; + strncpy(fDateStart,buffer_file+218,9); + fDateStart[9] = '\0'; - strncpy(date_stop,buffer_file+227,9); - date_stop[9] = '\0'; + strncpy(fDateStop,buffer_file+227,9); + fDateStop[9] = '\0'; - strncpy(time_start,buffer_file+236,8); - time_start[8] = '\0'; + strncpy(fTimeStart,buffer_file+236,8); + fTimeStart[8] = '\0'; - strncpy(time_stop,buffer_file+244,8); - time_stop[8] = '\0'; + strncpy(fTimeStop,buffer_file+244,8); + fTimeStop[8] = '\0'; dum_Int32 = (Int32 *) &buffer_file[424]; - total_events = *dum_Int32; + fTotalEvents = *dum_Int32; - for (i=0; i<=15; i++) - { - strncpy(labels_histo[i],buffer_file+948+i*4,4); - labels_histo[i][4] = '\0'; + for (i=0; i<=15; i++) { + strncpy(fLabelsHisto[i],buffer_file+948+i*4,4); + fLabelsHisto[i][4] = '\0'; dum_Int32 = (Int32 *) &buffer_file[296+i*4]; - events_per_histo[i] = *dum_Int32; + fEventsPerHisto[i] = *dum_Int32; dum_Int16 = (Int16 *) &buffer_file[458+i*2]; - integer_t0[i] = *dum_Int16; + fIntegerT0[i] = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[490+i*2]; - first_good[i] = *dum_Int16; + fFirstGood[i] = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[522+i*2]; - last_good[i] = *dum_Int16; + fLastGood[i] = *dum_Int16; } - for (i=0; i<=15; i++) - { + for (i=0; i<=15; i++) { dum_Float32 = (Float32 *) &buffer_file[792+i*4]; - real_t0[i] = *dum_Float32; + fRealT0[i] = *dum_Float32; } - number_scaler = 18; + fNumberScaler = 18; - for (i=0; i<=5; i++) - { + for (i=0; i<=5; i++) { dum_Int32 = (Int32 *) &buffer_file[670+i*4]; - scalers[i] = *dum_Int32; + fScalers[i] = *dum_Int32; - strncpy(labels_scalers[i],buffer_file+924+i*4,4); - labels_scalers[i][4] = '\0'; + strncpy(fLabelsScalers[i],buffer_file+924+i*4,4); + fLabelsScalers[i][4] = '\0'; } - for (i=6; i(*dum_Float32); + fBinWidth = static_cast(*dum_Float32); - if (bin_width == 0.) + if (fBinWidth == 0.) { - bin_width=0.125*(625.E-6)*pow(static_cast(2.0),static_cast(tdc_resolution)); + fBinWidth=0.125*(625.E-6)*pow(static_cast(2.0),static_cast(tdc_resolution)); } - default_binning = 1; + fDefaultBinning = 1; - number_temper = 4; - for (i=0; i< number_temper; i++) - { + fNumberTemper = 4; + for (i=0; i< fNumberTemper; i++) { dum_Float32 = (Float32 *) &buffer_file[716+i*4]; - temper[i] = *dum_Float32; + fTemper[i] = *dum_Float32; dum_Float32 = (Float32 *) &buffer_file[738+i*4]; - temp_deviation[i] = *dum_Float32; + fTempDeviation[i] = *dum_Float32; dum_Float32 = (Float32 *) &buffer_file[72+i*4]; mon_low[i] = *dum_Float32; @@ -457,14 +452,13 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) num_data_records_histo = *dum_Int16; dum_Int16 = (Int16 *) &buffer_file[134]; // khidaf - if (*dum_Int16 != 1) - { + if (*dum_Int16 != 1) { std::cout << "ERROR number of histograms/record not equals 1!" << " Required algorithm is not implemented!" << std::endl; delete [] buffer_file; file_name.close(); - readstatus = "ERROR Algorithm to read multiple histograms in one block -" - " necessary to read " + filename + " - is not implemented!"; + fReadStatus = "ERROR Algorithm to read multiple histograms in one block -" + " necessary to read " + fFilename + " - is not implemented!"; return 4; // ERROR algorithm not implemented } @@ -476,59 +470,37 @@ int MuSR_td_PSI_bin::readbin(const char * fileName) if (buffer_file) delete [] buffer_file; - if (number_histo <= 0) + if (fNumberHisto <= 0) { file_name.close(); - readstatus = "ERROR Less than 1 histogram in " + filename; + fReadStatus = "ERROR Less than 1 histogram in " + fFilename; return 5; // ERROR number of histograms < 1 } // allocate histograms - histo = new int* [int(number_histo)]; - if (!histo) - { - Clear(); - file_name.close(); - readstatus = "ERROR Allocating histo[] failed!"; - return 3; // ERROR allocating histogram buffer - } + fHisto.resize(fNumberHisto); - for (i=0; i dummy_vector; - histos_vector.clear(); - for (i=0; i(bin_width); + dum_Float32 = static_cast(fBinWidth); memcpy(buffer+1012, (const char*)&dum_Float32, 4); // write header information @@ -720,22 +690,22 @@ int MuSR_td_PSI_bin::writebin(const char *fileName) // handle histograms ----------------------------------------------------------------- // prepare write buffer - if (buffer) { // get rid of the header buffer + if (buffer) { // Get rid of the header buffer delete [] buffer; - buffer = 0; + buffer = nullptr; } buffer = new char[4*MAXREC]; if (!buffer) { - writestatus = "ERROR Allocating buffer to write data failed!"; + fWriteStatus = "ERROR Allocating buffer to write data failed!"; return 3; // ERROR allocating data buffer } // initialize buffer memset(buffer, 0, 4*MAXREC); bool buffer_empty = false; - for (int i=0; i 0) && (j%MAXREC == 0)) { @@ -758,7 +728,7 @@ int MuSR_td_PSI_bin::writebin(const char *fileName) // clean up if (buffer) { delete [] buffer; - buffer = 0; + buffer = nullptr; } return 0; @@ -843,13 +813,13 @@ typedef struct _FeFileHeaderRec { char RunTitle[TITLESTR+1]; char RunSubTitle[SUBTITLESTR+1]; char DataFormat[DATAFORMATSTR];// data format (automatically converted to) - Int32 HistoResolution; // TDC resolution factor for target format + Int32 HistoResolution; // TDC resolution factor for tarGet format // or pTA timespan Int32 BinOffset; Int32 BinsPerHistogram; Int32 NumberOfDetectors; char DetectorNumberList[DETECTLISTSTR]; // list of detectors to be converted - // to the target data format + // to the tarGet data format /* additional information */ char MeanTemp[TEMPLISTSTR]; char TempDev[TEMPLISTSTR]; @@ -882,7 +852,7 @@ typedef struct _pTATagRec { Int32 Histominb; Int32 Histomaxb; Int32 t0b; /* t0, tfirst tlast in [bins] for automatic data conversion */ - Int32 tfb; /* NOTE: t0b, tfb, tlb are in bin units of the target format!! */ + Int32 tfb; /* NOTE: t0b, tfb, tlb are in bin units of the tarGet format!! */ Int32 tlb; } pTATagRec, *pTATagPtr; @@ -1015,7 +985,7 @@ typedef struct _pTATDC32StatisticRec { /* ---------------------------------------------------------------------- */ //******************************* -//Implementation readmdu +//Implementation ReadMdu //******************************* /*! \brief Method to read a MuSR MDU file @@ -1032,7 +1002,7 @@ typedef struct _pTATDC32StatisticRec { * file to be opened. */ -int MuSR_td_PSI_bin::readmdu(const char * fileName) +int MuSR_td_PSI_bin::ReadMdu(const char * fileName) { std::ifstream file_name; int i, j; @@ -1041,16 +1011,16 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) if (sizeof(Int32) != 4) { - readstatus = "ERROR Sizeof( Int32 ) data type is not 4 bytes"; + fReadStatus = "ERROR Sizeof( Int32 ) data type is not 4 bytes"; return 1; // ERROR open failed } - filename = fileName; + fFilename = fileName; file_name.open(fileName, std::ios_base::binary); // open PSI bin file if (file_name.fail()) { - readstatus = "ERROR Open "+filename+" failed!"; + fReadStatus = "ERROR Open "+fFilename+" failed!"; return 1; // ERROR open failed } @@ -1061,65 +1031,64 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) if (file_name.fail()) { file_name.close(); - readstatus = "ERROR Reading "+filename+" header failed!"; + fReadStatus = "ERROR Reading "+fFilename+" header failed!"; return 1; // ERROR reading header failed } // fill header data into member variables - format_id[0] = gpTAfhead.Header.FmtId; - format_id[1] = gpTAfhead.Header.FmtVersion; - format_id[2] = '\0'; + fFormatId[0] = gpTAfhead.Header.FmtId; + fFormatId[1] = gpTAfhead.Header.FmtVersion; + fFormatId[2] = '\0'; - if ((strcmp(format_id,"M3") != 0) && (strcmp(format_id,"T4") != 0) && - (strcmp(format_id,"T5") != 0)) + if ((strcmp(fFormatId,"M3") != 0) && (strcmp(fFormatId,"T4") != 0) && + (strcmp(fFormatId,"T5") != 0)) { file_name.close(); - readstatus = "ERROR Unknown file format in "+filename+"!"; + fReadStatus = "ERROR Unknown file format in "+fFilename+"!"; return 2; // ERROR unsupported version } if (sizeof(pTAFileHeaderRec) != gpTAfhead.NumBytesHeader) { file_name.close(); - readstatus = "ERROR Reading "+filename+" incorrect pTAFileHeaderRec size"; + fReadStatus = "ERROR Reading "+fFilename+" incorrect pTAFileHeaderRec size"; return 1; // ERROR reading header failed } // header size OK read header information - strncpy(sample,&gpTAfhead.Header.RunTitle[0],10); - sample[10] = '\0'; + strncpy(fSample,&gpTAfhead.Header.RunTitle[0],10); + fSample[10] = '\0'; - strncpy(temp, &gpTAfhead.Header.RunTitle[10],10); - temp[10] = '\0'; + strncpy(fTemp, &gpTAfhead.Header.RunTitle[10],10); + fTemp[10] = '\0'; - strncpy(field, &gpTAfhead.Header.RunTitle[20],10); - field[10] = '\0'; + strncpy(fField, &gpTAfhead.Header.RunTitle[20],10); + fField[10] = '\0'; - strncpy(orient,&gpTAfhead.Header.RunTitle[30],10); - orient[10] = '\0'; + strncpy(fOrient,&gpTAfhead.Header.RunTitle[30],10); + fOrient[10] = '\0'; - strncpy(comment,&gpTAfhead.Header.RunSubTitle[0],62); - comment[62] = '\0'; + strncpy(fComment,&gpTAfhead.Header.RunSubTitle[0],62); + fComment[62] = '\0'; - strncpy(&date_start[0],&gpTAfhead.Header.StartDate[0],7); - strncpy(&date_start[7],&gpTAfhead.Header.StartDate[9],2); - date_start[9] = '\0'; + strncpy(&fDateStart[0],&gpTAfhead.Header.StartDate[0],7); + strncpy(&fDateStart[7],&gpTAfhead.Header.StartDate[9],2); + fDateStart[9] = '\0'; - strncpy(&date_stop[0],&gpTAfhead.Header.EndDate[0],7); - strncpy(&date_stop[7],&gpTAfhead.Header.EndDate[9],2); - date_stop[9] = '\0'; + strncpy(&fDateStop[0],&gpTAfhead.Header.EndDate[0],7); + strncpy(&fDateStop[7],&gpTAfhead.Header.EndDate[9],2); + fDateStop[9] = '\0'; - strncpy(time_start,&gpTAfhead.Header.StartTime[0],8); - time_start[8] = '\0'; + strncpy(fTimeStart,&gpTAfhead.Header.StartTime[0],8); + fTimeStart[8] = '\0'; - strncpy(time_stop,&gpTAfhead.Header.EndTime[0],8); - time_stop[8] = '\0'; + strncpy(fTimeStop,&gpTAfhead.Header.EndTime[0],8); + fTimeStop[8] = '\0'; - num_run = gpTAfhead.Header.RunNumber; + fNumRun = gpTAfhead.Header.RunNumber; - if (sizeof(pTATagRec) != gpTAfhead.NumBytesTag) - { + if (sizeof(pTATagRec) != gpTAfhead.NumBytesTag) { file_name.close(); - readstatus = "ERROR Reading "+filename+" incorrect pTATagRec size"; + fReadStatus = "ERROR Reading "+fFilename+" incorrect pTATagRec size"; return 1; // ERROR reading header failed } @@ -1129,23 +1098,22 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) #endif // read temperature deviation from header string (td0 [td1 [td2 [td3]]]) - number_temper = sscanf(gpTAfhead.Header.TempDev,"%f %f %f %f", - &temp_deviation[0], &temp_deviation[1], &temp_deviation[2], - &temp_deviation[3]); + fNumberTemper = sscanf(gpTAfhead.Header.TempDev,"%f %f %f %f", + &fTempDeviation[0], &fTempDeviation[1], &fTempDeviation[2], + &fTempDeviation[3]); // fill unused - for (i=number_temper; i 0) length_histo -= 1; + // special case: subtract 1 from stored histogram to Get desired histogram length + if (fLengthHisto > 0) fLengthHisto -= 1; - } - else if (strcmp(format_id,"T4") == 0) - { + } else if (strcmp(fFormatId,"T4") == 0) { - if (sizeof(pTATDCSettingsRec) != gpTAfhead.NumBytesSettings) - { + if (sizeof(pTATDCSettingsRec) != gpTAfhead.NumBytesSettings) { file_name.close(); - readstatus = "ERROR Reading "+filename+" incorrect pTATDCSettingsRec size"; + fReadStatus = "ERROR Reading "+fFilename+" incorrect pTATDCSettingsRec size"; return 1; // ERROR reading header failed } - if (sizeof(pTATDCStatisticRec) != gpTAfhead.NumBytesStatistics) - { + if (sizeof(pTATDCStatisticRec) != gpTAfhead.NumBytesStatistics) { file_name.close(); - readstatus = "ERROR Reading "+filename+" incorrect pTATDCStatisticRec size"; + fReadStatus = "ERROR Reading "+fFilename+" incorrect pTATDCStatisticRec size"; return 1; // ERROR reading header failed } @@ -1347,53 +1298,47 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) tothist = TDCMAXTAGS16; file_name.read((char *)&gpTAsettdc, sizeof gpTAsettdc);//read settings into buffer - if (file_name.fail()) - { + if (file_name.fail()) { file_name.close(); - readstatus = "ERROR Reading "+filename+" settings failed!"; + fReadStatus = "ERROR Reading "+fFilename+" settings failed!"; return 1; // ERROR reading settings failed } file_name.read((char *)&gpTAstattottdc, sizeof gpTAstattottdc); // read stat into buffer - if (file_name.fail()) - { + if (file_name.fail()) { file_name.close(); - readstatus = "ERROR Reading "+filename+" statistics failed!"; + fReadStatus = "ERROR Reading "+fFilename+" statistics failed!"; return 1; // ERROR reading statistics failed } - number_scaler = TDCMAXTAGS16; - for (i=0; i < number_scaler; i++) - { - strncpy(labels_scalers[i],gpTAsettdc.tag[i].Label,MAXLABELSIZE); - labels_scalers[i][MAXLABELSIZE-1] = '\0'; + fNumberScaler = TDCMAXTAGS16; + for (i=0; i < fNumberScaler; i++) { + strncpy(fLabelsScalers[i],gpTAsettdc.tag[i].Label,MAXLABELSIZE); + fLabelsScalers[i][MAXLABELSIZE-1] = '\0'; - scalers[i] = gpTAstattottdc.TagScaler[i]; + fScalers[i] = gpTAstattottdc.TagScaler[i]; } resolutionfactor = gpTAfhead.Header.HistoResolution; if (gpTAsettdc.resolutioncode == 25) - bin_width = 0.0000244140625; + fBinWidth = 0.0000244140625; else if (gpTAsettdc.resolutioncode == 100) - bin_width = 0.00009765625; + fBinWidth = 0.00009765625; else if (gpTAsettdc.resolutioncode == 200) - bin_width = 0.0001953125; + fBinWidth = 0.0001953125; else if (gpTAsettdc.resolutioncode == 800) - bin_width = 0.0007812500; - else - { + fBinWidth = 0.0007812500; + else { file_name.close(); - readstatus = "ERROR "+filename+" settings resolution code failed!"; + fReadStatus = "ERROR "+fFilename+" settings resolution code failed!"; return 1; // ERROR reading settings failed } - length_histo = 0; - number_histo = 0; - for (i=0; i MAXHISTO) - { + if (tothist > MAXHISTO) { std::cout << "ERROR number of histograms " << tothist << " exceedes maximum " << MAXHISTO << "! - Setting maximum number " << std::endl; tothist = MAXHISTO; } #ifdef MIDEBUG1 - cout << "Number of histograms is " << number_histo << endl; - cout << "Histogram length is " << length_histo << endl; + cout << "Number of histograms is " << fNumberHisto << endl; + cout << "Histogram length is " << fLengthHisto << endl; cout << "Resolutionfactor for t0, fg, lg is " << resolutionfactor << endl; #endif - default_binning = resolutionfactor; + fDefaultBinning = resolutionfactor; // allocate histograms - histo = new int* [int(number_histo)]; - if (!histo) - { - Clear(); - file_name.close(); - readstatus = "ERROR Allocating histo failed!"; - return 3; // ERROR allocating histogram buffer - } + fHisto.resize(int(fNumberHisto)); - for (i=0; i dummy_vector; - histos_vector.clear(); - for (i=0,ihist=0; i< tothist; i++) - { + fHistosVector.clear(); + for (i=0,ihist=0; i< tothist; i++) { file_name.read((char *)&tag, sizeof tag); // read tag into buffer - if (file_name.fail()) - { + if (file_name.fail()) { dummy_vector.clear(); Clear(); if (thist != nullptr) { @@ -1594,12 +1499,11 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) thist = nullptr; } file_name.close(); - readstatus = "ERROR Reading "+filename+" tag failed!"; + fReadStatus = "ERROR Reading "+fFilename+" tag failed!"; return 6; // ERROR reading tag failed } /* read histogram data */ - if (tag.Type == PTATAGC_POSITRON) - { + if (tag.Type == PTATAGC_POSITRON) { int nbins; #ifdef MIDEBUG1 @@ -1607,75 +1511,69 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) << " Histomax = " << tag.Histomaxb << endl; #endif // is a histogram there? - if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1) - { + if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1) { if (thist == nullptr) thist = new Int32[nbins]; if (thist == nullptr) { Clear(); file_name.close(); - readstatus = "ERROR Allocating histogram buffer failed!"; + fReadStatus = "ERROR Allocating histogram buffer failed!"; return 3; // ERROR allocating histogram buffer } file_name.read((char *)thist, sizeof(Int32)*nbins);// read hist into buffer - if (file_name.fail()) - { + if (file_name.fail()) { Clear(); if (thist != nullptr) { delete [] thist; thist = nullptr; } file_name.close(); - readstatus = "ERROR Reading "+filename+" hist failed!"; + fReadStatus = "ERROR Reading "+fFilename+" hist failed!"; return 6; // ERROR reading hist failed } // for pTA only: use histogram only, if histogram was selected // else take all histos but mark not selected - if (selected[i] || (strcmp(format_id,"M3") != 0)) - { + if (selected[i] || (strcmp(fFormatId,"M3") != 0)) { - if (ihist < MAXHISTO) // max number of histos not yet reached? - { + if (ihist < MAXHISTO) { // max number of histos not yet reached? dummy_vector.clear(); - strncpy(labels_histo[ihist],tag.Label,MAXLABELSIZE); - labels_histo[ihist][MAXLABELSIZE-1] = '\0'; + strncpy(fLabelsHisto[ihist],tag.Label,MAXLABELSIZE); + fLabelsHisto[ihist][MAXLABELSIZE-1] = '\0'; // mark with ** when not selected - if (!selected[i] && (strlen(labels_histo[ihist])= first_good[ihist]) && (j <= last_good[ihist])) - events_per_histo[ihist] += *(thist+j-tag.Histominb); + if ((j >= fFirstGood[ihist]) && (j <= fLastGood[ihist])) + fEventsPerHisto[ihist] += *(thist+j-tag.Histominb); } - histos_vector.push_back(dummy_vector); + fHistosVector.push_back(dummy_vector); // only add selected histo(s) to total events if (selected[i]) - total_events += events_per_histo[ihist]; + fTotalEvents += fEventsPerHisto[ihist]; } ihist++; } @@ -1690,14 +1588,14 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) file_name.close(); - readstatus = "SUCCESS"; - readingok = true; + fReadStatus = "SUCCESS"; + fReadingOk = true; return 0; } //******************************* -//Implementation writemdu +//Implementation WriteMdu //******************************* /*! \brief Method to write a MuSR MDU file @@ -1714,15 +1612,15 @@ int MuSR_td_PSI_bin::readmdu(const char * fileName) * file to be opened. */ -int MuSR_td_PSI_bin::writemdu(const char * fileName) +int MuSR_td_PSI_bin::WriteMdu(const char * fileName) { - std::cerr << std::endl << "MuSR_td_PSI_bin::writemdu - not yet implemented" << std::endl; + std::cerr << std::endl << "MuSR_td_PSI_bin::WriteMdu - not yet implemented" << std::endl; return 0; } //******************************* -//Implementation readingOK +//Implementation ReadingOK //******************************* /*! \brief Method to obtain if reading and processing of the data file was OK. @@ -1731,13 +1629,13 @@ int MuSR_td_PSI_bin::writemdu(const char * fileName) * - true if reading was OK * - false if reading was NOT OK */ -bool MuSR_td_PSI_bin::readingOK() const +bool MuSR_td_PSI_bin::ReadingOK() const { - return readingok; + return fReadingOk; } //******************************* -//Implementation writingOK +//Implementation WritingOK //******************************* /*! \brief Method to obtain if writing and processing of the data file was OK. @@ -1746,9 +1644,9 @@ bool MuSR_td_PSI_bin::readingOK() const * - true if writing was OK * - false if writing was NOT OK */ -bool MuSR_td_PSI_bin::writingOK() const +bool MuSR_td_PSI_bin::WritingOK() const { - return writingok; + return fWritingOk; } //******************************* @@ -1767,59 +1665,59 @@ bool MuSR_td_PSI_bin::writingOK() const * - true if everything is within the PSI-BIN limitations * - false otherwise * - * \param tag tag provided to tell how strict the tests should be. 0=reasonable, 1=strict + * \param tag tag provided to tell how strict the tests should be. 0=reasonable, 1=strict, 2=loose */ bool MuSR_td_PSI_bin::CheckDataConsistency(int tag) { - if (number_histo <= 0) { - consistencyOk = false; - consistencyStatus = "**ERROR** number histograms is zero or less!"; - return consistencyOk; + if (fNumberHisto <= 0) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** number histograms is zero or less!"; + return fConsistencyOk; } - if (number_histo > MAXHISTO) { - consistencyOk = false; - consistencyStatus = "**ERROR** number of histograms requested: "; - consistencyStatus += number_histo; - consistencyStatus += ", which is larger than the possible maximum of 32."; - return consistencyOk; + if (fNumberHisto > MAXHISTO) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** number of histograms requested: "; + fConsistencyStatus += fNumberHisto; + fConsistencyStatus += ", which is larger than the possible maximum of 32."; + return fConsistencyOk; } - if (length_histo <= 0) { - consistencyOk = false; - consistencyStatus = "**ERROR** histogram length is zero or less!"; - return consistencyOk; + if (fLengthHisto <= 0) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** histogram length is zero or less!"; + return fConsistencyOk; } - if (length_histo > 32767) { - consistencyOk = false; - consistencyStatus = "**ERROR** histogram length is too large (maximum being 32767)!"; - return consistencyOk; + if (fLengthHisto > 32767) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** histogram length is too large (maximum being 32767)!"; + return fConsistencyOk; } - if ((length_histo % 256 != 0) && (tag == 1)) { - consistencyOk = false; - consistencyStatus = "**ERROR** histogram length is not a multiple of 256!"; - return consistencyOk; + if ((fLengthHisto % 256 != 0) && (tag == 1)) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** histogram length is not a multiple of 256!"; + return fConsistencyOk; } - if (number_histo * length_histo > 65536) { - consistencyOk = false; - consistencyStatus = "**ERROR** number_histo * length_histo > 65536!"; - return consistencyOk; + if ((fNumberHisto * fLengthHisto > 65536) && (tag != 2)) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** fNumberHisto * fLengthHisto > 65536!"; + return fConsistencyOk; } - if (histo == 0) { - consistencyOk = false; - consistencyStatus = "**ERROR** no histograms present!"; - return consistencyOk; + if (fHisto.size() == 0) { + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** no histograms present!"; + return fConsistencyOk; } - consistencyOk = true; - consistencyStatus = "SUCCESS"; + fConsistencyOk = true; + fConsistencyStatus = "SUCCESS"; - return consistencyOk; + return fConsistencyOk; } @@ -1835,7 +1733,7 @@ bool MuSR_td_PSI_bin::CheckDataConsistency(int tag) */ std::string MuSR_td_PSI_bin::ReadStatus() const { - return readstatus; + return fReadStatus; } //******************************* @@ -1850,7 +1748,7 @@ std::string MuSR_td_PSI_bin::ReadStatus() const */ std::string MuSR_td_PSI_bin::WriteStatus() const { - return writestatus; + return fWriteStatus; } //******************************* @@ -1865,7 +1763,7 @@ std::string MuSR_td_PSI_bin::WriteStatus() const */ std::string MuSR_td_PSI_bin::ConsistencyStatus() const { - return consistencyStatus; + return fConsistencyStatus; } //******************************* @@ -1875,16 +1773,16 @@ std::string MuSR_td_PSI_bin::ConsistencyStatus() const /*! \brief Method to obtain the file name. * * This method gives back: - * - + * - */ std::string MuSR_td_PSI_bin::Filename() const { - return filename; + return fFilename; } //******************************* -//Implementation get_histo_int +//Implementation GetHistoInt //******************************* /*! \brief Method to return the value of a single bin as integer. @@ -1893,21 +1791,21 @@ std::string MuSR_td_PSI_bin::Filename() const * - bin value as int * - 0 if an invalid histogram number or bin is choosen */ -int MuSR_td_PSI_bin::get_histo_int(int histo_num, int j) +int MuSR_td_PSI_bin::GetHistoInt(int histo_num, int j) { - if (!readingok) return 0; + if (!fReadingOk) return 0; - if (( histo_num < 0) || (histo_num >= int(number_histo)) || - (j < 0 ) || (j >= length_histo)) + if (( histo_num < 0) || (histo_num >= int(fNumberHisto)) || + (j < 0 ) || (j >= fLengthHisto)) return 0; #ifdef MIDEBUG - cout << "histos_vector[0][0] = " << histos_vector[0][0] << endl; + cout << "fHistosVector[0][0] = " << fHistosVector[0][0] << endl; #endif - return histo[histo_num][j]; + return fHisto[histo_num][j]; } //******************************* -//Implementation get_histo +//Implementation GetHisto //******************************* /*! \brief Method to return the value of a single bin as double. @@ -1916,62 +1814,63 @@ int MuSR_td_PSI_bin::get_histo_int(int histo_num, int j) * - bin value as double * - 0 if an invalid histogram number or bin is choosen */ -double MuSR_td_PSI_bin::get_histo(int histo_num, int j) +double MuSR_td_PSI_bin::GetHisto(int histo_num, int j) { - if (!readingok) return 0.; + if (!fReadingOk) return 0.; - if (( histo_num < 0) || (histo_num >= int(number_histo)) || - (j < 0 ) || (j >= length_histo)) + if (( histo_num < 0) || (histo_num >= int(fNumberHisto)) || + (j < 0 ) || (j >= fLengthHisto)) return 0.; #ifdef MIDEBUG - cout << "histos_vector[0][0] = " << histos_vector[0][0] << endl; + cout << "fHistosVector[0][0] = " << fHistosVector[0][0] << endl; #endif - return static_cast(histo[histo_num][j]); + return static_cast(fHisto[histo_num][j]); } //******************************* -//Implementation get_histo_array +//Implementation GetHistoArray //******************************* /*! \brief Method to obtain an array of type double containing the values of the histogram \ with binning \ * * This method gives back: - * - an pointer of a double array - * - the NULL pointer if an invalid histogram number or binning is choosen or + * - a double vector + * - an empty vector if an invalid histogram number or binning is choosen or * allocation failed * * The parameters of the method are the integers \ and \ representing the desired histogram number and binning. */ -double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) +std::vector MuSR_td_PSI_bin::GetHistoArray(int histo_num, int binning) { - if (!readingok) return nullptr; + std::vector histo_array; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) - return nullptr; + if (!fReadingOk) return histo_array; - double *histo_array = new double[int(int(length_histo)/binning)]; + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) + return histo_array; - if (!histo_array) return nullptr; + histo_array.resize((int)(fLengthHisto/binning)); - for (int i = 0; i < int(int(length_histo)/binning); i++) - { + if (histo_array.size() == 0) return histo_array; + + for (int i=0; i > histoData, int tag) + int MuSR_td_PSI_bin::PutHistoArrayInt(std::vector > &histoData, int tag) { // check that the number of histograms are within allowed boundaries if ((histoData.size() == 0) || (histoData.size() > 32)) { - consistencyOk = false; - consistencyStatus = "**ERROR** number of histograms out of range! Must be > 0 and < 32."; + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** number of histograms out of range! Must be > 0 and < 32."; return -1; } @@ -2008,18 +1907,22 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } } if (!ok) { - consistencyOk = false; - consistencyStatus = "**ERROR** not all histograms have the same length!"; + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** not all histograms have the same length!"; return -2; } - // overwrite number_histo - number_histo = static_cast(histoData.size()); + // overwrite fNumberHisto + fNumberHisto = static_cast(histoData.size()); // calculate the allowed histo length int lengthHisto = (65536 / histoData.size()) - ((65536 / histoData.size()) % 256); if (lengthHisto > 32512) lengthHisto = 32512; + if (tag == 2) { + if (lengthHisto > 32512) + lengthHisto = 32512; + } // calculate the needed data length int dataLength = ((int)histoData[0].size()); @@ -2032,56 +1935,30 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) dataLength = (int)histoData[0].size()/rebin; else dataLength = (((int)histoData[0].size()/rebin/256)+1)*256; - } else if (tag == 1) { + } else if ((tag == 1) || (tag == 2)) { if (((int)histoData[0].size() % 256) != 0) dataLength = (((int)histoData[0].size()/256)+1)*256; } - // overwrite length_histo - length_histo = dataLength; - - // clean up if needed - if (histo) { - for (int i=0; i > data; - data.resize(number_histo); + data.resize(fNumberHisto); int val = 0; - for (int i=0; i0) && (j%rebin == 0)) { data[i].push_back(val); @@ -2092,44 +1969,47 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } // fill the histograms - for (int i=0; i length_histo) - integer_t0[i] = 0; - real_t0[i] = bin_width*integer_t0[i]; - if (first_good[i] > length_histo) - first_good[i] = 0; - if (last_good[i] > length_histo) - last_good[i] = length_histo-1; + for (int i=0; i fLengthHisto) + fIntegerT0[i] = 0; + fRealT0[i] = fBinWidth*fIntegerT0[i]; + if (fFirstGood[i] > fLengthHisto) + fFirstGood[i] = 0; + if (fLastGood[i] > fLengthHisto) + fLastGood[i] = fLengthHisto-1; } } else { - consistencyOk = false; - consistencyStatus = "**ERROR** found unsupported tag!"; + fConsistencyOk = false; + fConsistencyStatus = "**ERROR** found unsupported tag!"; return -3; } @@ -2137,7 +2017,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } //******************************* -//Implementation get_histo_vector +//Implementation GetHistoVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the histogram @@ -2151,29 +2031,28 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) representing the desired histogram number and binning. */ - std::vector MuSR_td_PSI_bin::get_histo_vector(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::GetHistoVector(int histo_num, int binning) { - std::vector histo_vector; //(int(length_histo/binning)) + std::vector histo_vector; //(int(fLengthHisto/binning)) - if (!readingok) return histo_vector; + if (!fReadingOk) return histo_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_vector; - for (int i = 0; i < int(length_histo/binning); i++) + for (int i = 0; i < int(fLengthHisto/binning); i++) histo_vector.push_back(0.); - for (int i = 0; i < int(length_histo/binning); i++) - { + for (int i = 0; i < int(fLengthHisto/binning); i++) { for (int j = 0; j < binning; j++) - histo_vector[i] += double(histo[histo_num][i*binning+j]); + histo_vector[i] += double(fHisto[histo_num][i*binning+j]); } return histo_vector; } //******************************* -//Implementation get_histo_vector_no0 +//Implementation GetHistoVectorNo0 //******************************* /*! \brief Method to obtain a vector of double containing the values of the @@ -2188,25 +2067,23 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - std::vector MuSR_td_PSI_bin::get_histo_vector_no0(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::GetHistoVectorNo0(int histo_num, int binning) { - std::vector histo_vector; //(int(length_histo/binning)); + std::vector histo_vector; //(int(fLengthHisto/binning)); - if (!readingok) return histo_vector; + if (!fReadingOk) return histo_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_vector; - for (int i = 0; i < int(length_histo/binning); i++) + for (int i = 0; i < int(fLengthHisto/binning); i++) histo_vector.push_back(0.); - for (int i = 0; i < int(length_histo/binning); i++) - { + for (int i = 0; i < int(fLengthHisto/binning); i++) { for (int j = 0; j < binning; j++) - histo_vector[i] += double(histo[histo_num][i*binning+j]); + histo_vector[i] += double(fHisto[histo_num][i*binning+j]); - if (histo_vector[i] < 0.5 ) - { + if (histo_vector[i] < 0.5 ) { histo_vector[i] = 0.1; } } @@ -2216,42 +2093,42 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //********************************** -//Implementation get_histo_array_int +//Implementation GetHistoArrayInt //********************************** /*! \brief Method to obtain an array of type integer containing the values of the * histogram \ * * This method gives back: - * - an pointer of an integer array - * - the NULL pointer if an invalid histogram number is choosen or allocate failed + * - integer vectors + * - an vector of size 0 if an invalid histogram number is choosen or allocate failed * * The parameter of the method is the integer \ representing the desired * histogram number. */ - int * MuSR_td_PSI_bin::get_histo_array_int(int histo_num) + std::vector MuSR_td_PSI_bin::GetHistoArrayInt(int histo_num) { - if (!readingok) return nullptr; + std::vector histo_array; - if ( histo_num < 0 || histo_num >= int(number_histo)) - return nullptr; + if (!fReadingOk) return histo_array; - int *histo_array = new int[length_histo]; + if ( histo_num < 0 || histo_num >= int(fNumberHisto)) + return histo_array; - if (!histo_array) return nullptr; + histo_array.resize(fLengthHisto); - for (int i = 0; i < int(length_histo); i++) - { - histo_array[i] = int(histo[histo_num][i]); - } + if (histo_array.size() == 0) + return histo_array; + + histo_array = fHisto[histo_num]; return histo_array; } //******************************* -//Implementation get_histo_fromt0_array +//Implementation GetHistoFromT0Array //******************************* /*! \brief Method to obtain an array of type double containing the values of the @@ -2267,24 +2144,23 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - double * MuSR_td_PSI_bin::get_histo_fromt0_array(int histo_num, int binning, int offset) + double* MuSR_td_PSI_bin::GetHistoFromT0Array(int histo_num, int binning, int offset) { - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return nullptr; double *histo_fromt0_array = - new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)]; + new double[int((int(fLengthHisto)-GetT0Int(histo_num)-offset+1)/binning)]; if (!histo_fromt0_array) return nullptr; - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) { histo_fromt0_array[i] = 0; for (int j = 0; j < binning; j++) histo_fromt0_array[i] += - double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]); + double(fHisto[histo_num][i*binning+j+GetT0Int(histo_num)+offset]); } return histo_fromt0_array; @@ -2292,7 +2168,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_fromt0_vector +//Implementation GetHistoFromT0Vector //******************************* /*! \brief Method to obtain a vector of double containing the values of the histogram @@ -2307,23 +2183,22 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - std::vector MuSR_td_PSI_bin::get_histo_fromt0_vector(int histo_num, int binning, int offset) + std::vector MuSR_td_PSI_bin::GetHistoFromT0Vector(int histo_num, int binning, int offset) { - std::vector histo_fromt0_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); + std::vector histo_fromt0_vector; // (int((int(fLengthHisto)-GetT0Int(histo_num)+1)/binning)); - if (!readingok) return histo_fromt0_vector; + if (!fReadingOk) return histo_fromt0_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_fromt0_vector; - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) histo_fromt0_vector.push_back(0.); - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) { for (int j = 0; j < binning; j++) histo_fromt0_vector[i] += - double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]); + double(fHisto[histo_num][i*binning+j+GetT0Int(histo_num)+offset]); } return histo_fromt0_vector; @@ -2331,12 +2206,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_goodBins_array +//Implementation GetHistoGoodBinsArray //******************************* /*! \brief Method to obtain an array of type double containing the values of the - * histogram \ with binning \ from the point first_good until - * last_good + * histogram \ with binning \ from the point fFirstGood until + * fLastGood * * This method gives back: * - an pointer of a double array @@ -2346,23 +2221,22 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - double * MuSR_td_PSI_bin::get_histo_goodBins_array(int histo_num, int binning) + double * MuSR_td_PSI_bin::GetHistoGoodBinsArray(int histo_num, int binning) { - if (!readingok) return nullptr; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if (!fReadingOk) return nullptr; + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return nullptr; double *histo_goodBins_array = - new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)]; + new double[int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num)+1)/binning)]; if (!histo_goodBins_array) return nullptr; - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) - { + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) { histo_goodBins_array[i] = 0; for (int j = 0; j < binning; j++) histo_goodBins_array[i] += - double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]); + double(fHisto[histo_num][i*binning+j+GetFirstGoodInt(histo_num)]); } return histo_goodBins_array; @@ -2370,12 +2244,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_goodBins_vector +//Implementation GetHistoGoodBinsVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the - * histogram \ with binning \ from the point first_good until - * last_good + * histogram \ with binning \ from the point fFirstGood until + * fLastGood * * This method gives back: * - a vector of double @@ -2385,23 +2259,22 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * representing the desired histogram number and binning. */ - std::vector MuSR_td_PSI_bin::get_histo_goodBins_vector(int histo_num, int binning) + std::vector MuSR_td_PSI_bin::GetHistoGoodBinsVector(int histo_num, int binning) { std::vector histo_goodBins_vector; - if (!readingok) return histo_goodBins_vector; + if (!fReadingOk) return histo_goodBins_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_goodBins_vector; - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) histo_goodBins_vector.push_back(0.); - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) - { + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) { for (int j = 0; j < binning; j++) histo_goodBins_vector[i] += - double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]); + double(fHisto[histo_num][i*binning+j+GetFirstGoodInt(histo_num)]); } return histo_goodBins_vector; @@ -2409,7 +2282,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_fromt0_minus_bckgrd_array +//Implementation GetHistoFromT0MinusBkgArray //******************************* /*! \brief Method to obtain an array of type double containing the values of the @@ -2431,43 +2304,41 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num, - int lower_bckgrd, int higher_bckgrd, int binning, int offset) + double * MuSR_td_PSI_bin::GetHistoFromT0MinusBkgArray(int histo_num, + int lower_bckgrd, int higher_bckgrd, int binning, int offset) { - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) + if ( lower_bckgrd < 0 || higher_bckgrd >= int(fLengthHisto) || lower_bckgrd > higher_bckgrd ) return nullptr; double bckgrd = 0; - for (int k = lower_bckgrd; k <= higher_bckgrd; k++) - { - bckgrd += double(histo[histo_num][k]); + for (int k = lower_bckgrd; k <= higher_bckgrd; k++) { + bckgrd += double(fHisto[histo_num][k]); } bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1); double *histo_fromt0_minus_bckgrd_array = - new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)]; + new double[int((int(fLengthHisto)-GetT0Int(histo_num)-offset+1)/binning)]; if (!histo_fromt0_minus_bckgrd_array) return NULL; - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) { histo_fromt0_minus_bckgrd_array[i] = 0; for (int j = 0; j < binning; j++) histo_fromt0_minus_bckgrd_array[i] += - double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) - bckgrd; + double(fHisto[histo_num][i*binning+j+GetT0Int(histo_num)+offset]) - bckgrd; } return histo_fromt0_minus_bckgrd_array; } //******************************* -//Implementation get_histo_fromt0_minus_bckgrd_vector +//Implementation GetHistoFromT0MinusBkgVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the @@ -2488,34 +2359,32 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - std::vector MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_vector(int histo_num, int lower_bckgrd, - int higher_bckgrd, int binning, int offset) + std::vector MuSR_td_PSI_bin::GetHistoFromT0MinusBkgVector(int histo_num, int lower_bckgrd, + int higher_bckgrd, int binning, int offset) { - std::vector histo_fromt0_minus_bckgrd_vector; // (int((int(length_histo)-get_t0_int(histo_num)+1)/binning)); + std::vector histo_fromt0_minus_bckgrd_vector; // (int((int(fLengthHisto)-GetT0Int(histo_num)+1)/binning)); - if (!readingok) return histo_fromt0_minus_bckgrd_vector; + if (!fReadingOk) return histo_fromt0_minus_bckgrd_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_fromt0_minus_bckgrd_vector; - if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) + if ( lower_bckgrd < 0 || higher_bckgrd >= int(fLengthHisto) || lower_bckgrd > higher_bckgrd ) return histo_fromt0_minus_bckgrd_vector; double bckgrd = 0; - for (int k = lower_bckgrd; k <= higher_bckgrd; k++) - { - bckgrd += double(histo[histo_num][k]); + for (int k = lower_bckgrd; k <= higher_bckgrd; k++) { + bckgrd += double(fHisto[histo_num][k]); } bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1); - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) histo_fromt0_minus_bckgrd_vector.push_back(0.); - for (int i = 0; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-GetT0Int(histo_num)-offset)/binning); i++) { for (int j = 0; j < binning; j++) histo_fromt0_minus_bckgrd_vector[i] += - double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) - bckgrd; + double(fHisto[histo_num][i*binning+j+GetT0Int(histo_num)+offset]) - bckgrd; } return histo_fromt0_minus_bckgrd_vector; @@ -2523,12 +2392,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_goodBins_minus_bckgrd_array +//Implementation GetHistoGoodBinsMinusBkgArray //******************************* /*! \brief Method to obtain an array of type double containing the values of the - * histogram \ with binning \ from the point first_good until - * the point last_good. A background calculated from the points \ and + * histogram \ with binning \ from the point fFirstGood until + * the point fLastGood. A background calculated from the points \ and * \ is subtracted * * This method gives back: @@ -2545,35 +2414,33 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num, int lower_bckgrd, - int higher_bckgrd, int binning) + double * MuSR_td_PSI_bin::GetHistoGoodBinsMinusBkgArray(int histo_num, int lower_bckgrd, + int higher_bckgrd, int binning) { - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) + if ( lower_bckgrd < 0 || higher_bckgrd >= int(fLengthHisto) || lower_bckgrd > higher_bckgrd ) return nullptr; double bckgrd = 0; - for (int k = lower_bckgrd; k <= higher_bckgrd; k++) - { - bckgrd += double(histo[histo_num][k]); + for (int k = lower_bckgrd; k <= higher_bckgrd; k++) { + bckgrd += double(fHisto[histo_num][k]); } bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1); double *histo_goodBins_minus_bckgrd_array = - new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)]; + new double[int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num)+1)/binning)]; if (!histo_goodBins_minus_bckgrd_array) return nullptr; - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) - { + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) { histo_goodBins_minus_bckgrd_array[i] = 0; for (int j = 0; j < binning; j++) histo_goodBins_minus_bckgrd_array[i] += - double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) - bckgrd; + double(fHisto[histo_num][i*binning+j+GetFirstGoodInt(histo_num)]) - bckgrd; } return histo_goodBins_minus_bckgrd_array; @@ -2581,11 +2448,11 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_histo_goodBins_minus_bckgrd_vector +//Implementation GetHistoGoodBinsMinusBkgVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the histogram \ - * with binning \ from the point first_good until the point last_good. + * with binning \ from the point fFirstGood until the point fLastGood. * A background calculated from the points \ and \ * is subtracted * @@ -2602,34 +2469,32 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * between which the background is calculated. */ - std::vector MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_vector(int histo_num, int lower_bckgrd, - int higher_bckgrd, int binning) + std::vector MuSR_td_PSI_bin::GetHistoGoodBinsMinusBkgVector(int histo_num, int lower_bckgrd, + int higher_bckgrd, int binning) { std::vector histo_goodBins_minus_bckgrd_vector; ; - if (!readingok) return histo_goodBins_minus_bckgrd_vector; + if (!fReadingOk) return histo_goodBins_minus_bckgrd_vector; - if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) + if ( histo_num < 0 || histo_num >= int(fNumberHisto) || binning <= 0 ) return histo_goodBins_minus_bckgrd_vector; - if ( lower_bckgrd < 0 || higher_bckgrd >= int(length_histo) || lower_bckgrd > higher_bckgrd ) + if ( lower_bckgrd < 0 || higher_bckgrd >= int(fLengthHisto) || lower_bckgrd > higher_bckgrd ) return histo_goodBins_minus_bckgrd_vector; double bckgrd = 0; - for (int k = lower_bckgrd; k <= higher_bckgrd; k++) - { - bckgrd += double(histo[histo_num][k]); + for (int k = lower_bckgrd; k <= higher_bckgrd; k++) { + bckgrd += double(fHisto[histo_num][k]); } bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1); - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) histo_goodBins_minus_bckgrd_vector.push_back(0.); - for (int i = 0; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning); i++) - { + for (int i = 0; i < int((GetLastGoodInt(histo_num)-GetFirstGoodInt(histo_num))/binning); i++) { for (int j = 0; j < binning; j++) histo_goodBins_minus_bckgrd_vector[i] += - double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) - bckgrd; + double(fHisto[histo_num][i*binning+j+GetFirstGoodInt(histo_num)]) - bckgrd; } return histo_goodBins_minus_bckgrd_vector; @@ -2637,7 +2502,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_asymmetry_array +//Implementation GetAsymmetryArray //******************************* /*! \brief Method to obtain an array of double containing the values of the asymmetry between 2 histograms. @@ -2661,46 +2526,44 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * also required. */ - double * MuSR_td_PSI_bin::get_asymmetry_array(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus, int offset, - double y_offset) + double* MuSR_td_PSI_bin::GetAsymmetryArray(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus, int offset, + double y_offset) { - int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); + int max_t0 = Tmax(GetT0Int(histo_num_plus),GetT0Int(histo_num_minus)); - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return nullptr; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return nullptr; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return nullptr; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning, offset); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning, offset); if (dummy_1 == nullptr) return nullptr; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning, offset); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning, offset); + if (dummy_2 == nullptr) { delete [] dummy_1; return nullptr; } - double *asymmetry_array = new double[int((int(length_histo)-max_t0-offset+1)/binning)]; + double *asymmetry_array = new double[int((int(fLengthHisto)-max_t0-offset+1)/binning)]; if (!asymmetry_array) return nullptr; - for (int i = 0; i < int((int(length_histo)-max_t0)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-max_t0)/binning); i++) { asymmetry_array[i] = (dummy_1[i] - alpha_param * dummy_2[i]) / (dummy_1[i] + alpha_param * dummy_2[i]) + y_offset; } @@ -2713,7 +2576,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_asymmetry_vector +//Implementation GetAsymmetryVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the asymmetry between 2 histograms. @@ -2734,45 +2597,43 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - std::vector MuSR_td_PSI_bin::get_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus, int offset, double y_offset) + std::vector MuSR_td_PSI_bin::GetAsymmetryVector(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus, int offset, double y_offset) { - int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); + int max_t0 = Tmax(GetT0Int(histo_num_plus),GetT0Int(histo_num_minus)); - std::vector asymmetry_vector; // (int((int(length_histo)-max_t0+1)/binning)); + std::vector asymmetry_vector; // (int((int(fLengthHisto)-max_t0+1)/binning)); - if (!readingok) return asymmetry_vector; + if (!fReadingOk) return asymmetry_vector; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return asymmetry_vector; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return asymmetry_vector; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return asymmetry_vector; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return asymmetry_vector; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning, offset); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning, offset); if (dummy_1 == nullptr) return asymmetry_vector; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning, offset); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning, offset); + if (dummy_2 == nullptr) { delete [] dummy_1; return asymmetry_vector; } - for (int i = 0; i < int((int(length_histo)-max_t0-offset)/binning); i++) + for (int i = 0; i < int((int(fLengthHisto)-max_t0-offset)/binning); i++) asymmetry_vector.push_back(0.); - for (int i = 0; i < int((int(length_histo)-max_t0-offset)/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto)-max_t0-offset)/binning); i++) { asymmetry_vector[i] = (dummy_1[i] - alpha_param * dummy_2[i]) / (dummy_1[i] + alpha_param * dummy_2[i]) + y_offset; } @@ -2785,7 +2646,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_error_asymmetry_array +//Implementation GetErrorAsymmetryArray //******************************* /*! \brief Method to obtain an array of double containing the values of the error of the asymmetry between 2 histograms. @@ -2806,44 +2667,42 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - double * MuSR_td_PSI_bin::get_error_asymmetry_array(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus, int offset) + double * MuSR_td_PSI_bin::GetErrorAsymmetryArray(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus, int offset) { - int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); + int max_t0 = Tmax(GetT0Int(histo_num_plus),GetT0Int(histo_num_minus)); - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return nullptr; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return nullptr; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return nullptr; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning, offset); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning, offset); if (dummy_1 == nullptr) return nullptr; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning, offset); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning, offset); + if (dummy_2 == nullptr) { delete [] dummy_1; return nullptr; } - double *error_asymmetry_array = new double[int((int(length_histo)-max_t0-offset+1)/binning)]; + double *error_asymmetry_array = new double[int((int(fLengthHisto)-max_t0-offset+1)/binning)]; if (!error_asymmetry_array) return nullptr; - for (int i = 0; i < int((length_histo-max_t0-offset)/binning); i++) - { + for (int i = 0; i < int((fLengthHisto-max_t0-offset)/binning); i++) { if (dummy_1[i] < 0.5 || dummy_2[i] < 0.5 ) error_asymmetry_array[i] = 1.0; else @@ -2859,7 +2718,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_error_asymmetry_vector +//Implementation GetErrorAsymmetryVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the error of the asymmetry between 2 histograms. @@ -2879,45 +2738,43 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - std::vector MuSR_td_PSI_bin::get_error_asymmetry_vector(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus, int offset) + std::vector MuSR_td_PSI_bin::GetErrorAsymmetryVector(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus, int offset) { - int max_t0 = tmax(get_t0_int(histo_num_plus),get_t0_int(histo_num_minus)); + int max_t0 = Tmax(GetT0Int(histo_num_plus),GetT0Int(histo_num_minus)); - std::vector error_asymmetry_vector; //(int((int(length_histo)-max_t0+1)/binning)); + std::vector error_asymmetry_vector; //(int((int(fLengthHisto)-max_t0+1)/binning)); - if (!readingok) return error_asymmetry_vector; + if (!fReadingOk) return error_asymmetry_vector; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return error_asymmetry_vector; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return error_asymmetry_vector; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return error_asymmetry_vector; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return error_asymmetry_vector; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning, offset); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning, offset); if (dummy_1 == nullptr) return error_asymmetry_vector; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning, offset); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning, offset); + if (dummy_2 == nullptr) { delete [] dummy_1; return error_asymmetry_vector; } - for (int i = 0; i < int((int(length_histo)-max_t0-offset)/binning); i++) + for (int i = 0; i < int((int(fLengthHisto)-max_t0-offset)/binning); i++) error_asymmetry_vector.push_back(0.); - for (int i = 0; i < int((int(length_histo-max_t0-offset))/binning); i++) - { + for (int i = 0; i < int((int(fLengthHisto-max_t0-offset))/binning); i++) { if (dummy_1[i] < 0.5 || dummy_2[i] < 0.5 ) error_asymmetry_vector[i] = 1.0; else @@ -2933,13 +2790,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_asymmetry_goodBins_array +//Implementation GetAsymmetryGoodBinsArray //******************************* /*! \brief Method to obtain an array of double containing the values of the asymmetry between 2 histograms. * - * The array has a size corresponding to the minimum interval between first_good and last_good. - * It begins at the first_good coming at the latest after the corresponding t_0. + * The array has a size corresponding to the minimum interval between fFirstGood and fLastGood. + * It begins at the fFirstGood coming at the latest after the corresponding t_0. * The asymmetry is calculated between the histograms \ and \ with an alpha parameter * \. This method requires also a binning value \, as well as the background limits for both histograms. * @@ -2955,47 +2812,45 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - double * MuSR_td_PSI_bin::get_asymmetry_goodBins_array(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus) + double * MuSR_td_PSI_bin::GetAsymmetryGoodBinsArray(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus) { - int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), - get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); + int hsize = int((Tmin(GetLastGoodInt(histo_num_plus)-GetFirstGoodInt(histo_num_plus), + GetLastGoodInt(histo_num_minus)-GetFirstGoodInt(histo_num_minus))+1)/binning); - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return nullptr; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return nullptr; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return nullptr; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning); if (dummy_1 == nullptr) return nullptr; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning); + if (dummy_2 == nullptr) { delete [] dummy_1; return nullptr; } - int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus),get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); + int hstart = Tmax(GetFirstGoodInt(histo_num_plus)-GetT0Int(histo_num_plus),GetFirstGoodInt(histo_num_minus)-GetT0Int(histo_num_minus)); double *asymmetry_goodBins_array = new double[hsize]; if (!asymmetry_goodBins_array) return nullptr; - for (int i = 0; i < hsize; i++) - { + for (int i = 0; i < hsize; i++) { asymmetry_goodBins_array[i] = (dummy_1[i+hstart] - alpha_param * dummy_2[i+hstart]) / (dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart]); } @@ -3008,13 +2863,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_asymmetry_goodBins_vector +//Implementation GetAsymmetryGoodBinsVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the asymmetry between 2 histograms. * - * The vector has a size corresponding to the minimum interval between first_good and last_good. - * It begins at the first_good coming at the latest after the corresponding t_0. + * The vector has a size corresponding to the minimum interval between fFirstGood and fLastGood. + * It begins at the fFirstGood coming at the latest after the corresponding t_0. * The asymmetry is calculated between the histograms \ and \ with an alpha parameter * \. This method requires also a binning value \, as well as the background limits for both histograms. * @@ -3029,37 +2884,36 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - std::vector MuSR_td_PSI_bin::get_asymmetry_goodBins_vector(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus) + std::vector MuSR_td_PSI_bin::GetAsymmetryGoodBinsVector(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus) { - int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), - get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); + int hsize = int((Tmin(GetLastGoodInt(histo_num_plus)-GetFirstGoodInt(histo_num_plus), + GetLastGoodInt(histo_num_minus)-GetFirstGoodInt(histo_num_minus))+1)/binning); std::vector asymmetry_goodBins_vector; - if (!readingok) return asymmetry_goodBins_vector; + if (!fReadingOk) return asymmetry_goodBins_vector; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return asymmetry_goodBins_vector; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return asymmetry_goodBins_vector; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return asymmetry_goodBins_vector; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return asymmetry_goodBins_vector; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning); if (dummy_1 == nullptr) return asymmetry_goodBins_vector; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning); + if (dummy_2 == nullptr) { delete [] dummy_1; return asymmetry_goodBins_vector; } @@ -3067,10 +2921,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) for (int i = 0; i < hsize; i++) asymmetry_goodBins_vector.push_back(0.); - int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus),get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); + int hstart = Tmax(GetFirstGoodInt(histo_num_plus)-GetT0Int(histo_num_plus),GetFirstGoodInt(histo_num_minus)-GetT0Int(histo_num_minus)); - for (int i = 0; i < hsize; i++) - { + for (int i = 0; i < hsize; i++) { asymmetry_goodBins_vector[i] = (dummy_1[i+hstart] - alpha_param * dummy_2[i+hstart]) / (dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart]); } @@ -3082,7 +2935,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_error_asymmetry_goodBins_array +//Implementation GetErrorAsymmetryGoodBinsArray //******************************* /*! \brief Method to obtain an array of double containing the values of the error of the asymmetry between 2 histograms. @@ -3103,49 +2956,47 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms are also required. */ - double * MuSR_td_PSI_bin::get_error_asymmetry_goodBins_array(int histo_num_plus, int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus) + double * MuSR_td_PSI_bin::GetErrorAsymmetryGoodBinsArray(int histo_num_plus, int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus) { - int hsize = int((tmin(get_lastGood_int(histo_num_plus) - -get_firstGood_int(histo_num_plus), - get_lastGood_int(histo_num_minus) - -get_firstGood_int(histo_num_minus))+1)/binning); + int hsize = int((Tmin(GetLastGoodInt(histo_num_plus) + -GetFirstGoodInt(histo_num_plus), + GetLastGoodInt(histo_num_minus) + -GetFirstGoodInt(histo_num_minus))+1)/binning); - if (!readingok) return nullptr; + if (!fReadingOk) return nullptr; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return nullptr; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return nullptr; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return nullptr; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return nullptr; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, - lower_bckgrd_plus, higher_bckgrd_plus, binning); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, + lower_bckgrd_plus, higher_bckgrd_plus, binning); if (dummy_1 == nullptr) return nullptr; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, - lower_bckgrd_minus, higher_bckgrd_minus, binning); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, + lower_bckgrd_minus, higher_bckgrd_minus, binning); + if (dummy_2 == nullptr) { delete [] dummy_1; return nullptr; } - int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus), - get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); + int hstart = Tmax(GetFirstGoodInt(histo_num_plus)-GetT0Int(histo_num_plus), + GetFirstGoodInt(histo_num_minus)-GetT0Int(histo_num_minus)); double *error_asymmetry_goodBins_array = new double[hsize]; if (!error_asymmetry_goodBins_array) return nullptr; - for (int i = 0; i < hsize; i++) - { + for (int i = 0; i < hsize; i++) { if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 ) error_asymmetry_goodBins_array[i] = 1.0; else @@ -3163,7 +3014,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_error_asymmetry_goodBins_vector +//Implementation GetErrorAsymmetryGoodBinsVector //******************************* /*! \brief Method to obtain a vector of double containing the values of the error of @@ -3187,39 +3038,38 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * Integers for the binning and for the background limits for both histograms.are also required. */ - std::vector MuSR_td_PSI_bin::get_error_asymmetry_goodBins_vector(int histo_num_plus, - int histo_num_minus, double alpha_param, - int binning, int lower_bckgrd_plus, - int higher_bckgrd_plus, - int lower_bckgrd_minus, int higher_bckgrd_minus) + std::vector MuSR_td_PSI_bin::GetErrorAsymmetryGoodBinsVector(int histo_num_plus, + int histo_num_minus, double alpha_param, + int binning, int lower_bckgrd_plus, + int higher_bckgrd_plus, + int lower_bckgrd_minus, int higher_bckgrd_minus) { - int hsize = int((tmin(get_lastGood_int(histo_num_plus)-get_firstGood_int(histo_num_plus), - get_lastGood_int(histo_num_minus)-get_firstGood_int(histo_num_minus))+1)/binning); + int hsize = int((Tmin(GetLastGoodInt(histo_num_plus)-GetFirstGoodInt(histo_num_plus), + GetLastGoodInt(histo_num_minus)-GetFirstGoodInt(histo_num_minus))+1)/binning); std::vector error_asymmetry_goodBins_vector; - if (!readingok) return error_asymmetry_goodBins_vector; + if (!fReadingOk) return error_asymmetry_goodBins_vector; - if ( histo_num_plus < 0 || histo_num_plus >= int(number_histo) || binning <= 0 ) + if ( histo_num_plus < 0 || histo_num_plus >= int(fNumberHisto) || binning <= 0 ) return error_asymmetry_goodBins_vector; - if ( histo_num_minus < 0 || histo_num_minus >= int(number_histo) ) + if ( histo_num_minus < 0 || histo_num_minus >= int(fNumberHisto) ) return error_asymmetry_goodBins_vector; - if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(length_histo) || lower_bckgrd_plus > higher_bckgrd_plus ) + if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >= int(fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus ) return error_asymmetry_goodBins_vector; - if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus ) + if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >= int(fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus ) return error_asymmetry_goodBins_vector; - double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus, lower_bckgrd_plus, - higher_bckgrd_plus, binning); + double *dummy_1 = GetHistoFromT0MinusBkgArray(histo_num_plus, lower_bckgrd_plus, + higher_bckgrd_plus, binning); if (dummy_1 == nullptr) return error_asymmetry_goodBins_vector; - double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus, lower_bckgrd_minus, - higher_bckgrd_minus, binning); - if (dummy_2 == nullptr) - { + double *dummy_2 = GetHistoFromT0MinusBkgArray(histo_num_minus, lower_bckgrd_minus, + higher_bckgrd_minus, binning); + if (dummy_2 == nullptr) { delete [] dummy_1; return error_asymmetry_goodBins_vector; } @@ -3227,10 +3077,9 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) for (int i = 0; i < hsize; i++) error_asymmetry_goodBins_vector.push_back(0.); - int hstart = tmax(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus),get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)); + int hstart = Tmax(GetFirstGoodInt(histo_num_plus)-GetT0Int(histo_num_plus),GetFirstGoodInt(histo_num_minus)-GetT0Int(histo_num_minus)); - for (int i = 0; i < hsize; i++) - { + for (int i = 0; i < hsize; i++) { if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 ) error_asymmetry_goodBins_vector[i] = 1.0; else @@ -3247,19 +3096,19 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_numberScaler_int +//Implementation GetNumberScalerInt //******************************* /*! \brief Method returning an integer representing the number of histograms */ - int MuSR_td_PSI_bin::get_numberScaler_int() + int MuSR_td_PSI_bin::GetNumberScalerInt() { - return int(number_scaler); + return int(fNumberScaler); } //******************************* - //Implementation put_numberScaler_int + //Implementation PutNumberScalerInt //******************************* /*! \brief Method seting the number of scalers present @@ -3271,35 +3120,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param val the number of scalers present */ - int MuSR_td_PSI_bin::put_numberScaler_int(int val) + int MuSR_td_PSI_bin::PutNumberScalerInt(int val) { if ((val < 0) || (val >= MAXSCALER)) return -1; - number_scaler = val; + fNumberScaler = val; return 0; } //******************************* -//Implementation get_scalers_vector +//Implementation GetScalersVector //******************************* /*! \brief Method providing a vector of long containing the values of the scalers */ - std::vector MuSR_td_PSI_bin::get_scalers_vector() + std::vector MuSR_td_PSI_bin::GetScalersVector() { - std::vector scalers_vect(number_scaler); + std::vector scalers_vect(fNumberScaler); - for ( int i = 0; i < number_scaler; i++ ) - scalers_vect[i] = long(scalers[i]); + for ( int i = 0; i < fNumberScaler; i++ ) + scalers_vect[i] = long(fScalers[i]); return scalers_vect; } //******************************* - //Implementation put_scalers_vector + //Implementation PutScalersVector //******************************* /*! \brief Method set a vector of long containing the values of the scalers @@ -3311,39 +3160,38 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param scalerData vector */ - int MuSR_td_PSI_bin::put_scalers_vector(std::vector scalerData) + int MuSR_td_PSI_bin::PutScalersVector(std::vector scalerData) { if ((int)scalerData.size() > MAXSCALER) return -1; for (unsigned int i=0; i max_t0) - max_t0 = int(integer_t0[i]); + for (int i = 0; i < int(fNumberHisto); i++) { + if (int(fIntegerT0[i]) > max_t0) + max_t0 = int(fIntegerT0[i]); } return max_t0; } //******************************* -//Implementation get_max_2_t0_int +//Implementation GetMax2T0Int //******************************* /*! \brief Method to determine the maximum value of the last good bins of 2 histograms @@ -3351,20 +3199,20 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if the numbers of the histograms are invalid */ - int MuSR_td_PSI_bin::get_max_2_t0_int(int k, int j) + int MuSR_td_PSI_bin::GetMax2T0Int(int k, int j) { - if (( k < 0 || k >= int(number_histo)) || ( j < 0 || j >= int(number_histo))) + if (( k < 0 || k >= int(fNumberHisto)) || ( j < 0 || j >= int(fNumberHisto))) return -1; - int max_t0 = int(integer_t0[j]); - if (int(integer_t0[k]) >= max_t0) - max_t0 = int(integer_t0[k]); + int max_t0 = int(fIntegerT0[j]); + if (int(fIntegerT0[k]) >= max_t0) + max_t0 = int(fIntegerT0[k]); return max_t0; } //******************************* -//Implementation get_min_2_t0_int +//Implementation GetMin2T0Int //******************************* /*! \brief Method to determine the minimum value of the last good bins of 2 histograms @@ -3372,33 +3220,32 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if the numbers of the histograms are invalid */ - int MuSR_td_PSI_bin::get_min_2_t0_int(int k, int j) + int MuSR_td_PSI_bin::GetMin2T0Int(int k, int j) { - if (( k < 0 || k >= int(number_histo)) || ( j < 0 || j >= int(number_histo))) + if (( k < 0 || k >= int(fNumberHisto)) || ( j < 0 || j >= int(fNumberHisto))) return -1; - int min_t0 = int(integer_t0[j]); - if (int(integer_t0[k]) <= min_t0) - min_t0 = int(integer_t0[k]); + int min_t0 = int(fIntegerT0[j]); + if (int(fIntegerT0[k]) <= min_t0) + min_t0 = int(fIntegerT0[k]); return min_t0; } //******************************* -//Implementation get_min_t0_int +//Implementation GetMinT0Int //******************************* /*! \brief Method to determine the minimum value of the t0 bins */ - int MuSR_td_PSI_bin::get_min_t0_int() + int MuSR_td_PSI_bin::GetMinT0Int() { - int min_t0 = int(length_histo); + int min_t0 = int(fLengthHisto); - for (int i = 0; i < int(number_histo); i++) - { - if (int(integer_t0[i]) < min_t0) - min_t0 = int(integer_t0[i]); + for (int i = 0; i < int(fNumberHisto); i++) { + if (int(fIntegerT0[i]) < min_t0) + min_t0 = int(fIntegerT0[i]); } return min_t0; @@ -3406,19 +3253,19 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation get_binWidth_ps +//Implementation GetBinWidthPicoSec //******************************* /*! \brief Method returning a double representing the bin-width in picoseconds */ - double MuSR_td_PSI_bin::get_binWidth_ps() + double MuSR_td_PSI_bin::GetBinWidthPicoSec() { - return bin_width*1.0e6; + return fBinWidth*1.0e6; } //******************************* - //Implementation put_binWidth_ps + //Implementation PutBinWidthPicoSec //******************************* /*! \brief Method setting a double representing the bin-width in picoseconds @@ -3426,25 +3273,25 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param binWidth bin-width given in picoseconds */ - void MuSR_td_PSI_bin::put_binWidth_ps(double binWidth) + void MuSR_td_PSI_bin::PutBinWidthPicoSec(double binWidth) { - bin_width = binWidth*1.0e-6; + fBinWidth = binWidth*1.0e-6; } //******************************* -//Implementation get_binWidth_ns +//Implementation GetBinWidthNanoSec //******************************* /*! \brief Method returning a double representing the bin-width in nanoseconds */ - double MuSR_td_PSI_bin::get_binWidth_ns() + double MuSR_td_PSI_bin::GetBinWidthNanoSec() { - return bin_width*1.0e3; + return fBinWidth*1.0e3; } //******************************* - //Implementation put_binWidth_ns + //Implementation PutBinWidthNanoSec //******************************* /*! \brief Method setting a double representing the bin-width in nanoseconds @@ -3452,25 +3299,25 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param binWidth bin-width given in nanoseconds */ - void MuSR_td_PSI_bin::put_binWidth_ns(double binWidth) + void MuSR_td_PSI_bin::PutBinWidthNanoSec(double binWidth) { - bin_width = binWidth*1.0e-3; + fBinWidth = binWidth*1.0e-3; } //******************************* -//Implementation get_binWidth_us +//Implementation GetBinWidthMicroSec //******************************* /*! \brief Method returning a double representing the bin-width in microseconds */ - double MuSR_td_PSI_bin::get_binWidth_us() + double MuSR_td_PSI_bin::GetBinWidthMicroSec() { - return bin_width; + return fBinWidth; } //******************************* - //Implementation put_binWidth_us + //Implementation PutBinWidthMicroSec //******************************* /*! \brief Method setting a double representing the bin-width in microseconds @@ -3478,49 +3325,13 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param binWidth bin-width given in microseconds */ - void MuSR_td_PSI_bin::put_binWidth_us(double binWidth) + void MuSR_td_PSI_bin::PutBinWidthMicroSec(double binWidth) { - bin_width = binWidth; + fBinWidth = binWidth; } //******************************* -//Implementation get_histoLength_bin -//******************************* - -/*! \brief Method returning an integer representing the histogram length in bins - */ - - int MuSR_td_PSI_bin::get_histoLength_bin() - { - return int(length_histo); - } - -//******************************* -//Implementation get_numberHisto_int -//******************************* - -/*! \brief Method returning an integer representing the number of histograms - */ - - int MuSR_td_PSI_bin::get_numberHisto_int() - { - return int(number_histo); - } - -//******************************* -//Implementation get_totalEvents_long -//******************************* - -/*! \brief Method returning a long representing the total number of events - */ - - long MuSR_td_PSI_bin::get_totalEvents_long() - { - return long(total_events); - } - -//******************************* -//Implementation get_eventsHisto_long +//Implementation GetEventsHistoLong //******************************* /*! \brief Method returning a long representing the number of events in a specified histograms @@ -3528,32 +3339,32 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * A value of -1 is returned if the value of the histogram \ specified is invalid. */ - long MuSR_td_PSI_bin::get_eventsHisto_long(int i) + long MuSR_td_PSI_bin::GetEventsHistoLong(int i) { - if ( i < 0 || i >= number_histo) + if ( i < 0 || i >= fNumberHisto) return -1; else - return long(events_per_histo[i]); + return long(fEventsPerHisto[i]); } //******************************* -//Implementation get_eventsHisto_vector +//Implementation GetEventsHistoVector //******************************* /*! \brief Method returning a vector of long containing the number of events in the histograms */ - std::vector MuSR_td_PSI_bin::get_eventsHisto_vector() + std::vector MuSR_td_PSI_bin::GetEventsHistoVector() { - std::vector eventsHisto(number_histo); + std::vector eventsHisto(fNumberHisto); - for ( int i = 0; i < number_histo; i++ ) - eventsHisto[i] = long(events_per_histo[i]); + for ( int i = 0; i < fNumberHisto; i++ ) + eventsHisto[i] = long(fEventsPerHisto[i]); return eventsHisto; } //******************************* -//Implementation get_t0_double +//Implementation GetT0Double //******************************* /*! \brief Method returning a double representing the t0 point (from the "real" t0 in the header) for a specified histogram @@ -3561,33 +3372,33 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * A value of -1. is returned if the value of the histogram \ specified is invalid. */ - double MuSR_td_PSI_bin::get_t0_double(int i) + double MuSR_td_PSI_bin::GetT0Double(int i) { - if ( i < 0 || i >= int(number_histo)) + if ( i < 0 || i >= int(fNumberHisto)) return -1.; else - return double(real_t0[i]); + return double(fRealT0[i]); } //******************************* -//Implementation get_default_binning +//Implementation GetDefaultBinning //******************************* /*! \brief Method returning an integer representing the default binning * */ - int MuSR_td_PSI_bin::get_default_binning() + int MuSR_td_PSI_bin::GetDefaultBinning() { - if (default_binning < 1) + if (fDefaultBinning < 1) return 1; else - return default_binning; + return fDefaultBinning; } //******************************* -//Implementation get_t0_int +//Implementation GetT0Int //******************************* /*! \brief Method returning an integer representing the t0 point (from the "integer" t0 in the header) for a specified histogram @@ -3595,16 +3406,16 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * A value of -1 is returned if the value of the histogram \ specified is invalid. */ - int MuSR_td_PSI_bin::get_t0_int(int i) + int MuSR_td_PSI_bin::GetT0Int(int i) { - if ( i < 0 || i >= int(number_histo)) + if ( i < 0 || i >= int(fNumberHisto)) return -1; else - return int(integer_t0[i]); + return int(fIntegerT0[i]); } //******************************* - //Implementation put_t0_int + //Implementation PutT0Int //******************************* /*! \brief Method setting an integer representing the t0 point (from the "integer" t0 in the header) for a specified histogram @@ -3617,35 +3428,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param t0 t0 bin value */ - int MuSR_td_PSI_bin::put_t0_int(int histoNo, int t0) + int MuSR_td_PSI_bin::PutT0Int(int histoNo, int t0) { if ((histoNo < 0) || (histoNo >= MAXHISTO)) return -1; - integer_t0[histoNo] = t0; + fIntegerT0[histoNo] = t0; return 0; } //******************************* -//Implementation get_t0_vector +//Implementation GetT0Vector //******************************* /*! \brief Method returning a vector of integer containing the t0 values of the histograms specified in the header */ - std::vector MuSR_td_PSI_bin::get_t0_vector() + std::vector MuSR_td_PSI_bin::GetT0Vector() { - std::vector t0(number_histo); + std::vector t0(fNumberHisto); - for ( int i = 0; i < int(number_histo); i++ ) - t0[i] = int(integer_t0[i]); + for ( int i = 0; i < int(fNumberHisto); i++ ) + t0[i] = int(fIntegerT0[i]); return t0; } //******************************* - //Implementation put_t0_vector + //Implementation PutT0Vector //******************************* /*! \brief Method setting a vector of integer containing the t0 values of the histograms specified in the header @@ -3655,19 +3466,19 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * - -1 if t0Data is too long (>MAXHISTO) */ - int MuSR_td_PSI_bin::put_t0_vector(std::vector &t0Data) + int MuSR_td_PSI_bin::PutT0Vector(std::vector &t0Data) { if (static_cast(t0Data.size()) >= MAXHISTO) return -1; for (unsigned int i=0; i specified is invalid. */ - int MuSR_td_PSI_bin::get_firstGood_int(int i) + int MuSR_td_PSI_bin::GetFirstGoodInt(int i) { - if ( i < 0 || i >= int(number_histo)) + if ( i < 0 || i >= int(fNumberHisto)) return -1; else - return int(first_good[i]); + return int(fFirstGood[i]); } //******************************* - //Implementation put_firstGood_int + //Implementation PutFirstGoodInt //******************************* /*! \brief Method setting an integer representing the first good bin specified in the header for a specified histogram @@ -3697,35 +3508,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param j first good bin value */ - int MuSR_td_PSI_bin::put_firstGood_int(int i, int j) + int MuSR_td_PSI_bin::PutFirstGoodInt(int i, int j) { if ((i < 0) || (i >= MAXHISTO)) return -1; - first_good[i] = j; + fFirstGood[i] = j; return 0; } //******************************* -//Implementation get_firstGood_vector +//Implementation GetFirstGoodVector //******************************* /*! \brief Method returning a vector of integer containing the first good bin values of the histograms specified in the header */ - std::vector MuSR_td_PSI_bin::get_firstGood_vector() + std::vector MuSR_td_PSI_bin::GetFirstGoodVector() { - std::vector firstGood(number_histo); + std::vector firstGood(fNumberHisto); - for ( int i = 0; i < number_histo; i++ ) - firstGood[i] = int(first_good[i]); + for ( int i = 0; i < fNumberHisto; i++ ) + firstGood[i] = int(fFirstGood[i]); return firstGood; } //******************************* -//Implementation get_lastGood_int +//Implementation GetLastGoodInt //******************************* /*! \brief Method returning an integer representing the last good bin specified in the header for a specified histogram @@ -3733,53 +3544,52 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * A value of -1 is returned if the value of the histogram \ specified is invalid. */ - int MuSR_td_PSI_bin::get_lastGood_int(int i) + int MuSR_td_PSI_bin::GetLastGoodInt(int i) { - if ( i < 0 || i >= int(number_histo)) + if ( i < 0 || i >= int(fNumberHisto)) return -1; else - return int(last_good[i]); + return int(fLastGood[i]); } //******************************* -//Implementation get_lastGood_vector +//Implementation GetLastGoodVector //******************************* /*! \brief Method returning a vector of integer containing the last good bin values of the histograms specified in the header */ - std::vector MuSR_td_PSI_bin::get_lastGood_vector() + std::vector MuSR_td_PSI_bin::GetLastGoodVector() { - std::vector lastGood(number_histo); + std::vector lastGood(fNumberHisto); - for ( int i = 0; i < number_histo; i++ ) - lastGood[i] = int(last_good[i]); + for ( int i = 0; i < fNumberHisto; i++ ) + lastGood[i] = int(fLastGood[i]); return lastGood; } //******************************* -//Implementation get_max_lastGoog_int +//Implementation GetMaxLastGoodInt //******************************* /*! \brief Method returning an integer containing the maximum value of the "last good bins" of all histograms */ - int MuSR_td_PSI_bin::get_max_lastGood_int() + int MuSR_td_PSI_bin::GetMaxLastGoodInt() { int max_lastGood = 0; - for (int i = 0; i < int(number_histo); i++) - { - if (int(last_good[i]) > max_lastGood) - max_lastGood = int(last_good[i]); + for (int i = 0; i < int(fNumberHisto); i++) { + if (int(fLastGood[i]) > max_lastGood) + max_lastGood = int(fLastGood[i]); } return max_lastGood; } //******************************* -//Implementation get_max_2_lastGood_int +//Implementation GetMax2LastGoodInt //******************************* /*! \brief Method to determine the maximum value of the "last good bins" of 2 histograms @@ -3787,43 +3597,41 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if something is invalid */ - int MuSR_td_PSI_bin::get_max_2_lastGood_int(int k, int j) + int MuSR_td_PSI_bin::GetMax2LastGoodInt(int k, int j) { - if (( k < 0 || k >= int(number_histo)) || ( j < 0 || j >= int(number_histo))) + if (( k < 0 || k >= int(fNumberHisto)) || ( j < 0 || j >= int(fNumberHisto))) return -1; - else - { - int max_lastGood = int(last_good[j]); + else { + int max_lastGood = int(fLastGood[j]); - if (int(last_good[k]) > max_lastGood) - max_lastGood = int(last_good[k]); + if (int(fLastGood[k]) > max_lastGood) + max_lastGood = int(fLastGood[k]); return max_lastGood; } } //******************************* -//Implementation get_min_lastGood_int +//Implementation GetMinLastGoodInt //******************************* /*! \brief Method providing the minimum value of the last good bins */ - int MuSR_td_PSI_bin::get_min_lastGood_int() + int MuSR_td_PSI_bin::GetMinLastGoodInt() { - int min_lastGood = int(last_good[0]); + int min_lastGood = int(fLastGood[0]); - for (int i = 1; i < int(number_histo); i++) - { - if (int(last_good[i]) < min_lastGood) - min_lastGood = int(last_good[i]); + for (int i = 1; i < int(fNumberHisto); i++) { + if (int(fLastGood[i]) < min_lastGood) + min_lastGood = int(fLastGood[i]); } return min_lastGood; } //******************************* -//Implementation get_min_2_lastGood_int +//Implementation GetMin2LastGoodInt //******************************* /*! \brief Method to determine the minimum value of the last good bins of 2 histograms @@ -3831,23 +3639,22 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if something is invalid */ - int MuSR_td_PSI_bin::get_min_2_lastGood_int(int k, int j) + int MuSR_td_PSI_bin::GetMin2LastGoodInt(int k, int j) { - if (( k < 0 || k >= int(number_histo)) || ( j < 0 || j >= int(number_histo))) + if (( k < 0 || k >= int(fNumberHisto)) || ( j < 0 || j >= int(fNumberHisto))) return -1; - else - { - int min_lastGood = int(last_good[j]); + else { + int min_lastGood = int(fLastGood[j]); - if (int(last_good[k]) < min_lastGood) - min_lastGood = int(last_good[k]); + if (int(fLastGood[k]) < min_lastGood) + min_lastGood = int(fLastGood[k]); return min_lastGood; } } //******************************* -//Implementation put_lastGood_int +//Implementation PutLastGoodInt //******************************* /*! \brief Method to modify the last good bin (value \) of the histogram \ @@ -3855,32 +3662,18 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if the histogram specified was invalid */ - int MuSR_td_PSI_bin::put_lastGood_int(int i, int j) + int MuSR_td_PSI_bin::PutLastGoodInt(int i, int j) { - if ((i < 0) || (i >= number_histo)) + if ((i < 0) || (i >= fNumberHisto)) return -1; - last_good[i] = j; + fLastGood[i] = j; return 0; } - //******************************* -//Implementation get_runNumber_int -//******************************* - -/*! \brief Method returning an integer containing the run number - */ - - int MuSR_td_PSI_bin::get_runNumber_int() - { - return int(num_run); - } - - -//******************************* -//Implementation put_runNumber_int +//Implementation PutRunNumberInt //******************************* /*! \brief Method to modify the run number (value \) @@ -3888,152 +3681,152 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * returns -1 if the integer specified was wrong */ - int MuSR_td_PSI_bin::put_runNumber_int(int i) + int MuSR_td_PSI_bin::PutRunNumberInt(int i) { if (i <= 0 ) return -1; - num_run = i; + fNumRun = i; return 0; } //******************************* -//Implementation get_sample() +//Implementation GetSample() //******************************* -/*! \brief Method returning a string containing the sample name +/*! \brief Method returning a string containing the fSample name */ - std::string MuSR_td_PSI_bin::get_sample() + std::string MuSR_td_PSI_bin::GetSample() { std::string strData; - strData = sample; + strData = fSample; return strData; } //******************************* - //Implementation put_sample() + //Implementation PutSample() //******************************* - /*! \brief Method setting a string containing the sample name + /*! \brief Method setting a string containing the fSample name * * return: * - 0 on success - * - -1 if the provided sample string is too long (>= 11 char) + * - -1 if the provided fSample string is too long (>= 11 char) * - * \param sample string containing the sample information + * \param fSample string containing the fSample information */ - int MuSR_td_PSI_bin::put_sample(std::string sampleStr) + int MuSR_td_PSI_bin::PutSample(std::string sampleStr) { if (sampleStr.size() >= 11) return -1; - strcpy(sample, sampleStr.c_str()); + strcpy(fSample, sampleStr.c_str()); return 0; } //******************************* -//Implementation get_temp() +//Implementation GetTemp() //******************************* /*! \brief Method returning a string containing the temperature specified in the title */ - std::string MuSR_td_PSI_bin::get_temp() + std::string MuSR_td_PSI_bin::GetTemp() { std::string strData; - strData = temp; + strData = fTemp; return strData; } //******************************* - //Implementation put_temp() + //Implementation PutTemp() //******************************* - /*! \brief Method setting a string containing the sample temperature + /*! \brief Method setting a string containing the fSample temperature * * return: * - 0 on success * - -1 if the provided temperature string is too long (>= 11 char) * - * \param tempStr string containing the sample information + * \param tempStr string containing the fSample information */ - int MuSR_td_PSI_bin::put_temp(std::string tempStr) + int MuSR_td_PSI_bin::PutTemp(std::string tempStr) { if (tempStr.size() >= 11) return -1; - strcpy(temp, tempStr.c_str()); + strcpy(fTemp, tempStr.c_str()); return 0; } //******************************* -//Implementation get_orient() +//Implementation GetOrient() //******************************* /*! \brief Method returning a string containing the orientation specified in the title */ - std::string MuSR_td_PSI_bin::get_orient() + std::string MuSR_td_PSI_bin::GetOrient() { std::string strData; - strData = orient; + strData = fOrient; return strData; } //******************************* - //Implementation put_orient() + //Implementation PutOrient() //******************************* - /*! \brief Method setting a string containing the sample orientation + /*! \brief Method setting a string containing the fSample orientation * * return: * - 0 on success * - -1 if the provided orientation string is too long (>= 11 char) * - * \param orientStr string containing the sample information + * \param orientStr string containing the fSample information */ - int MuSR_td_PSI_bin::put_orient(std::string orientStr) + int MuSR_td_PSI_bin::PutOrient(std::string orientStr) { if (orientStr.size() >= 11) return -1; - strcpy(orient, orientStr.c_str()); + strcpy(fOrient, orientStr.c_str()); return 0; } //******************************* -//Implementation get_field() +//Implementation GetField() //******************************* /*! \brief Method returning a string containing the field specified in the title */ - std::string MuSR_td_PSI_bin::get_field() + std::string MuSR_td_PSI_bin::GetField() { std::string strData; - strData = field; + strData = fField; return strData; } //******************************* - //Implementation put_field() + //Implementation PutField() //******************************* /*! \brief Method setting a string containing the field @@ -4045,34 +3838,34 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param fieldStr string containing the field */ - int MuSR_td_PSI_bin::put_field(std::string fieldStr) + int MuSR_td_PSI_bin::PutField(std::string fieldStr) { if (fieldStr.size() >= 11) return -1; - strcpy(field, fieldStr.c_str()); + strcpy(fField, fieldStr.c_str()); return 0; } //******************************* - //Implementation get_setup() + //Implementation GetSetup() //******************************* /*! \brief Method returning a string containing the setup */ - std::string MuSR_td_PSI_bin::get_setup() + std::string MuSR_td_PSI_bin::GetSetup() { std::string strData; - strData = setup; + strData = fSetup; return strData; } //******************************* - //Implementation put_setup() + //Implementation PutSetup() //******************************* /*! \brief Method setting a string containing the setup @@ -4084,34 +3877,34 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param commentStr string containing the setup */ - int MuSR_td_PSI_bin::put_setup(std::string setupStr) + int MuSR_td_PSI_bin::PutSetup(std::string setupStr) { if (setupStr.size() >= 11) return -1; - strcpy(setup, setupStr.c_str()); + strcpy(fSetup, setupStr.c_str()); return 0; } //******************************* -//Implementation get_comments() +//Implementation GetComment() //******************************* /*! \brief Method returning a string containing the comment specified in the title */ - std::string MuSR_td_PSI_bin::get_comment() + std::string MuSR_td_PSI_bin::GetComment() { std::string strData; - strData = comment; + strData = fComment; return strData; } //******************************* - //Implementation put_comments() + //Implementation PutComment() //******************************* /*! \brief Method setting a string containing the comment @@ -4122,38 +3915,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param commentStr string containing the comment */ - int MuSR_td_PSI_bin::put_comment(std::string commentStr) + int MuSR_td_PSI_bin::PutComment(std::string commentStr) { - strncpy(comment, commentStr.c_str(), 62); - comment[62] = '\0'; + strncpy(fComment, commentStr.c_str(), 62); + fComment[62] = '\0'; return 0; } //******************************* -//Implementation get_nameHisto() +//Implementation Get_nameHisto() //******************************* /*! \brief Method returning a string containing the name of the histogram \ * - * returns NULL if the histogram specified is invalid + * returns an empty string if the histogram specified is invalid */ - std::string MuSR_td_PSI_bin::get_nameHisto(int i) + std::string MuSR_td_PSI_bin::GetNameHisto(int i) { - std::string strData; + std::string strData{""}; - if (i < 0 || i >= int(number_histo)) - return nullptr; - else - { - strData = labels_histo[i]; - return strData; - } + if ((i >= 0) && (i < fNumberHisto)) + strData = fLabelsHisto[i]; + + return strData; } //******************************* - //Implementation put_nameHisto() + //Implementation PutNameHisto() //******************************* /*! \brief Method setting a string containing the name of the histogram \ @@ -4167,34 +3957,33 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param i index of the histogram */ - int MuSR_td_PSI_bin::put_nameHisto(std::string histoName, int i) + int MuSR_td_PSI_bin::PutNameHisto(std::string histoName, int i) { - if ((i<0) || (i>=number_histo)) + if ((i<0) || (i>=fNumberHisto)) return -1; if (static_cast(histoName.length()) >= MAXLABELSIZE) return -2; - strcpy(labels_histo[i], histoName.c_str()); + strcpy(fLabelsHisto[i], histoName.c_str()); return 0; } //******************************* -//Implementation get_histoNames_vector() +//Implementation GetHistoNamesVector() //******************************* /*! \brief Method returning a vector of strings containing the names of the histograms */ - std::vector MuSR_td_PSI_bin::get_histoNames_vector() + std::vector MuSR_td_PSI_bin::GetHistoNamesVector() { std::vector str_Vector; std::string strData; - for (int i = 0; i < number_histo; i++) - { - strData = labels_histo[i]; + for (int i = 0; i < fNumberHisto; i++) { + strData = fLabelsHisto[i]; str_Vector.push_back(strData); } @@ -4202,7 +3991,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } //******************************* - //Implementation put_histoNames_vector() + //Implementation PutHistoNamesVector() //******************************* /*! \brief Method setting a vector containing the names of all the histograms @@ -4215,36 +4004,35 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param histoName name of the histogram */ - int MuSR_td_PSI_bin::put_histoNames_vector(std::vector &histoNames) + int MuSR_td_PSI_bin::PutHistoNamesVector(std::vector &histoNames) { - if (static_cast(histoNames.size()) > number_histo) + if (static_cast(histoNames.size()) > fNumberHisto) return -1; for (unsigned int i=0; i(histoNames[i].length()) >= MAXLABELSIZE) return -2; else - strcpy(labels_histo[i], histoNames[i].c_str()); + strcpy(fLabelsHisto[i], histoNames[i].c_str()); } return 0; } //******************************* -//Implementation get_scalersNames_vector() +//Implementation GetScalersNamesVector() //******************************* /*! \brief Method returning a vector of strings containing the names of the scalers */ - std::vector MuSR_td_PSI_bin::get_scalersNames_vector() + std::vector MuSR_td_PSI_bin::GetScalersNamesVector() { std::vector str_Vector; std::string strData; - for (int i = 0; i < number_scaler; i++) - { - strData = labels_scalers[i]; + for (int i = 0; i < fNumberScaler; i++) { + strData = fLabelsScalers[i]; str_Vector.push_back(strData); } @@ -4252,7 +4040,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) } //******************************* - //Implementation put_scalersNames_vector() + //Implementation PutScalersNamesVector() //******************************* /*! \brief Method setting a vector of strings containing the names of the scalers @@ -4264,33 +4052,21 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param scalersName scaler names */ - int MuSR_td_PSI_bin::put_scalersNames_vector(std::vector scalersName) + int MuSR_td_PSI_bin::PutScalersNamesVector(std::vector scalersName) { if (static_cast(scalersName.size()) > MAXSCALER) return -1; for (unsigned int i=0; i MAXTEMPER)) return -1; - number_temper = noOfTemps; + fNumberTemper = noOfTemps; return 0; } //******************************* -//Implementation get_temperatures_vector() +//Implementation GetTemperaturesVector() //******************************* /*! \brief Method returning a vector of doubles containing monitored values (usually temperatures) */ - std::vector MuSR_td_PSI_bin::get_temperatures_vector() + std::vector MuSR_td_PSI_bin::GetTemperaturesVector() { std::vector dbl_Temper; - for (int i = 0; i < number_temper; i++) - { - dbl_Temper.push_back(double(temper[i])); + for (int i = 0; i < fNumberTemper; i++) { + dbl_Temper.push_back(double(fTemper[i])); } return dbl_Temper; } //******************************* - //Implementation put_temperatures_vector() + //Implementation PutTemperaturesVector() //******************************* /*! \brief Method setting a vector of doubles containing monitored values (usually temperatures) @@ -4344,38 +4119,37 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param tempVals vector containing the monitored values */ - int MuSR_td_PSI_bin::put_temperatures_vector(std::vector &tempVals) + int MuSR_td_PSI_bin::PutTemperaturesVector(std::vector &tempVals) { if (static_cast(tempVals.size()) > MAXTEMPER) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_devTemperatures_vector() + std::vector MuSR_td_PSI_bin::GetDevTemperaturesVector() { std::vector dbl_devTemper; - for (int i = 0; i < number_temper; i++) - { - dbl_devTemper.push_back(double(temp_deviation[i])); + for (int i = 0; i < fNumberTemper; i++) { + dbl_devTemper.push_back(double(fTempDeviation[i])); } return dbl_devTemper; } //******************************* - //Implementation put_devTemperatures_vector() + //Implementation PutDevTemperaturesVector() //******************************* /*! \brief Method setting a vector of doubles containing standard deviations of the monitored values (usually temperatures) @@ -4387,38 +4161,38 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param devTempVals vector containing standard deviations of the monitored values */ - int MuSR_td_PSI_bin::put_devTemperatures_vector(std::vector &devTempVals) + int MuSR_td_PSI_bin::PutDevTemperaturesVector(std::vector &devTempVals) { if (static_cast(devTempVals.size()) > MAXTEMPER) return -1; for (unsigned int i=0; i MuSR_td_PSI_bin::get_timeStart_vector() + std::vector MuSR_td_PSI_bin::GetTimeStartVector() { std::vector timeStart(2); - timeStart[0] = date_start; - timeStart[1] = time_start; + timeStart[0] = fDateStart; + timeStart[1] = fTimeStart; return timeStart; } //******************************* - //Implementation put_timeStart_vector() + //Implementation PutTimeStartVector() //******************************* /*! \brief Method setting a vector of strings containing 1) the date when the run was @@ -4433,7 +4207,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param timeStart vector where [0] contains the date, [1] the time string */ - int MuSR_td_PSI_bin::put_timeStart_vector(std::vector timeStart) + int MuSR_td_PSI_bin::PutTimeStartVector(std::vector timeStart) { if (timeStart.size() != 2) return -1; @@ -4446,32 +4220,32 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) if (timeStart[1].length() > 8) return -3; - strcpy(date_start, timeStart[0].c_str()); - strcpy(time_start, timeStart[1].c_str()); + strcpy(fDateStart, timeStart[0].c_str()); + strcpy(fTimeStart, timeStart[1].c_str()); return 0; } //******************************* -//Implementation get_timeStop_vector() +//Implementation GetTimeStopVector() //******************************* /*! \brief Method returning a vector of strings containing 1) the date when the run was * stopped and 2) the time when the run was stopped */ - std::vector MuSR_td_PSI_bin::get_timeStop_vector() + std::vector MuSR_td_PSI_bin::GetTimeStopVector() { std::vector timeStop(2); - timeStop[0] = date_stop; - timeStop[1] = time_stop; + timeStop[0] = fDateStop; + timeStop[1] = fTimeStop; return timeStop; } //******************************* - //Implementation put_timeStop_vector() + //Implementation PutTimeStopVector() //******************************* /*! \brief Method setting a vector of strings containing 1) the date when the run was @@ -4486,7 +4260,7 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) * \param timeStop vector where [0] contains the date, [1] the time string */ - int MuSR_td_PSI_bin::put_timeStop_vector(std::vector timeStop) + int MuSR_td_PSI_bin::PutTimeStopVector(std::vector timeStop) { if (timeStop.size() != 2) return -1; @@ -4499,8 +4273,8 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) if (timeStop[1].length() > 8) return -3; - strcpy(date_stop, timeStop[0].c_str()); - strcpy(time_stop, timeStop[1].c_str()); + strcpy(fDateStop, timeStop[0].c_str()); + strcpy(fTimeStop, timeStop[1].c_str()); return 0; } @@ -4519,78 +4293,65 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) // NIY maybe flag when histo should not be released // free private histograms - if (histo != nullptr) - { - for (i=0; i < number_histo; i++) - if (*(histo+i) != nullptr) - { - delete[] *(histo+i); - *(histo+i) = nullptr; - } - delete [] histo; - histo = nullptr; - } + fHisto.clear(); // free public vector - histos_vector.clear(); + fHistosVector.clear(); // init other member variables - filename = "?"; - readingok = false; - writingok = false; - consistencyOk = false; - readstatus = ""; - writestatus = ""; - consistencyStatus = ""; + fFilename = "?"; + fReadingOk = false; + fWritingOk = false; + fConsistencyOk = false; + fReadStatus = ""; + fWriteStatus = ""; + fConsistencyStatus = ""; - strcpy(format_id,"??"); + strcpy(fFormatId,"??"); - num_run = 0; + fNumRun = 0; //01234567890 - strcpy(sample, " "); - strcpy(temp, " "); - strcpy(field, " "); - strcpy(orient, " "); - strcpy(setup, " "); - strcpy(comment, " "); - strcpy(date_start," "); - strcpy(time_start," "); - strcpy(date_stop, " "); - strcpy(time_stop, " "); + strcpy(fSample, " "); + strcpy(fTemp, " "); + strcpy(fField, " "); + strcpy(fOrient, " "); + strcpy(fSetup, " "); + strcpy(fComment, " "); + strcpy(fDateStart," "); + strcpy(fTimeStart," "); + strcpy(fDateStop, " "); + strcpy(fTimeStop, " "); - bin_width = 0.; - number_histo = 0; - length_histo = 0; - total_events = 0; - default_binning = 1; + fBinWidth = 0.; + fNumberHisto = 0; + fLengthHisto = 0; + fTotalEvents = 0; + fDefaultBinning = 1; - for (i=0; i < MAXHISTO; i++) - { + for (i=0; i < MAXHISTO; i++) { for (j=0; j < MAXLABELSIZE-1; j++) - labels_histo[i][j] = ' '; - labels_histo[i][MAXLABELSIZE-1] = '\0'; - events_per_histo[i] = 0; - real_t0[i] = 0.f; - integer_t0[i] = 0; - first_good[i] = 0; - last_good[i] = 0; + fLabelsHisto[i][j] = ' '; + fLabelsHisto[i][MAXLABELSIZE-1] = '\0'; + fEventsPerHisto[i] = 0; + fRealT0[i] = 0.f; + fIntegerT0[i] = 0; + fFirstGood[i] = 0; + fLastGood[i] = 0; } - number_scaler = 0; - for (i=0; i < MAXSCALER; i++) - { + fNumberScaler = 0; + for (i=0; i < MAXSCALER; i++) { for (j=0; j < MAXLABELSIZE-1; j++) - labels_scalers[i][j] = ' '; - labels_scalers[i][MAXLABELSIZE-1] = '\0'; + fLabelsScalers[i][j] = ' '; + fLabelsScalers[i][MAXLABELSIZE-1] = '\0'; - scalers[i] = 0; + fScalers[i] = 0; } - number_temper = 0; - for (i=0; i < MAXTEMPER; i++) - { - temper[i] = 0.f; - temp_deviation[i] = 0.f; + fNumberTemper = 0; + for (i=0; i < MAXTEMPER; i++) { + fTemper[i] = 0.f; + fTempDeviation[i] = 0.f; } return 0; @@ -4604,66 +4365,65 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) int MuSR_td_PSI_bin::Show() const { - std::cout << "Filename is " << filename << std::endl; - if (readingok) { + std::cout << "Filename is " << fFilename << std::endl; + if (fReadingOk) { int i; - std::cout << "Format Identifier is " << format_id << std::endl; + std::cout << "Format Identifier is " << fFormatId << std::endl; - std::cout << "Run number is " << num_run << std::endl; - std::cout << "Sample is " << sample << std::endl; - std::cout << "Temperature is " << temp << std::endl; - std::cout << "Field is " << field << std::endl; - std::cout << "Orientation is " << orient << std::endl; - std::cout << "Comment is " << comment << std::endl; + std::cout << "Run number is " << fNumRun << std::endl; + std::cout << "Sample is " << fSample << std::endl; + std::cout << "Temperature is " << fTemp << std::endl; + std::cout << "Field is " << fField << std::endl; + std::cout << "Orientation is " << fOrient << std::endl; + std::cout << "Comment is " << fComment << std::endl; - std::cout << "Start Date is " << date_start << std::endl; - std::cout << "Start Time is " << time_start << std::endl; + std::cout << "Start Date is " << fDateStart << std::endl; + std::cout << "Start Time is " << fTimeStart << std::endl; - std::cout << "End Date is " << date_stop << std::endl; - std::cout << "End Time is " << time_stop << std::endl; + std::cout << "End Date is " << fDateStop << std::endl; + std::cout << "End Time is " << fTimeStop << std::endl; - std::cout << "Bin width is " << bin_width << " [usec]" << std::endl; - std::cout << "Number of histograms is " << number_histo << std::endl; - std::cout << "Histogram length is " << length_histo << std::endl; - std::cout << "Default binning is " << default_binning << std::endl; - std::cout << "Total number of events is " << total_events << std::endl; + std::cout << "Bin width is " << fBinWidth << " [usec]" << std::endl; + std::cout << "Number of histograms is " << fNumberHisto << std::endl; + std::cout << "Histogram length is " << fLengthHisto << std::endl; + std::cout << "Default binning is " << fDefaultBinning << std::endl; + std::cout << "Total number of events is " << fTotalEvents << std::endl; - for (i=0; i < number_histo; i++) { - std::cout << "Histogram " << i << " Name is >" << labels_histo[i] - << "< Events per histogram is " << events_per_histo[i] << std::endl; - std::cout << " real t0 is " << real_t0[i] << std::endl; - std::cout << " t0 is " << integer_t0[i] << std::endl; - std::cout << " first good bin is " << first_good[i] << std::endl; - std::cout << " last good bin is " << last_good[i] << std::endl; + for (i=0; i < fNumberHisto; i++) { + std::cout << "Histogram " << i << " Name is >" << fLabelsHisto[i] + << "< Events per histogram is " << fEventsPerHisto[i] << std::endl; + std::cout << " real t0 is " << fRealT0[i] << std::endl; + std::cout << " t0 is " << fIntegerT0[i] << std::endl; + std::cout << " first good bin is " << fFirstGood[i] << std::endl; + std::cout << " last good bin is " << fLastGood[i] << std::endl; } - std::cout << "Number of scalers is " << number_scaler << std::endl; - for (i=0; i < number_scaler; i++) { - std::cout << "Scaler " << i << " Name is >" << labels_scalers[i] - << "< Value is " << scalers[i] << std::endl; + std::cout << "Number of scalers is " << fNumberScaler << std::endl; + for (i=0; i < fNumberScaler; i++) { + std::cout << "Scaler " << i << " Name is >" << fLabelsScalers[i] + << "< Value is " << fScalers[i] << std::endl; } - std::cout << "Number of temperatures is " << number_temper << std::endl; - for (i=0; i < number_temper; i++) { - std::cout << "Temperature " << i << " is " << temper[i] - << " Deviation is " << temp_deviation[i] << std::endl; + std::cout << "Number of temperatures is " << fNumberTemper << std::endl; + for (i=0; i < fNumberTemper; i++) { + std::cout << "Temperature " << i << " is " << fTemper[i] + << " Deviation is " << fTempDeviation[i] << std::endl; } } else { - std::cout << readstatus << std::endl; + std::cout << fReadStatus << std::endl; } return 0; } //******************************* -//Implementation tmax +//Implementation Tmax //******************************* - int MuSR_td_PSI_bin::tmax(int x, int y) + int MuSR_td_PSI_bin::Tmax(int x, int y) { - if (x >= y) - { + if (x >= y) { return x; } return y; @@ -4671,13 +4431,12 @@ double * MuSR_td_PSI_bin::get_histo_array(int histo_num, int binning) //******************************* -//Implementation tmin +//Implementation Tmin //******************************* - int MuSR_td_PSI_bin::tmin(int x, int y) + int MuSR_td_PSI_bin::Tmin(int x, int y) { - if (x >= y) - { + if (x >= y) { return y; } return x; diff --git a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h index a0fc63f6..c7657d3d 100644 --- a/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h +++ b/src/external/MuSR_software/Class_MuSR_PSI/MuSR_td_PSI_bin.h @@ -10,7 +10,7 @@ begin : Alex Amato, October 2005 modified : Andrea Raselli, October 2009 - : Andreas Suter, April 2019 + : Andreas Suter, April 2019, May 2020 copyright : (C) 2005 by email : alex.amato@psi.ch @@ -56,57 +56,55 @@ class MuSR_td_PSI_bin { ~MuSR_td_PSI_bin(); private: -// ------------------------------------start of the variables + std::string fFilename; + std::string fReadStatus; + std::string fWriteStatus; + std::string fConsistencyStatus; + bool fReadingOk; + bool fWritingOk; + bool fConsistencyOk; - std::string filename; - std::string readstatus; - std::string writestatus; - std::string consistencyStatus; - bool readingok; - bool writingok; - bool consistencyOk; + char fFormatId[3]; - char format_id[3]; + int fNumRun; - int num_run; + char fSample[11]; + char fTemp[11]; + char fField[11]; + char fOrient[11]; + char fSetup[11]; + char fComment[63]; - char sample[11]; - char temp[11]; - char field[11]; - char orient[11]; - char setup[11]; - char comment[63]; + char fDateStart[10]; + char fDateStop[10]; + char fTimeStart[9]; + char fTimeStop[9]; - char date_start[10]; - char date_stop[10]; - char time_start[9]; - char time_stop[9]; + double fBinWidth; - double bin_width; + int fNumberHisto; + int fLengthHisto; + char fLabelsHisto[MAXHISTO][MAXLABELSIZE]; - int number_histo; - int length_histo; - char labels_histo[MAXHISTO][MAXLABELSIZE]; + int fTotalEvents; + int fEventsPerHisto[MAXHISTO]; - int total_events; - int events_per_histo[MAXHISTO]; + int fDefaultBinning; - int default_binning; + float fRealT0[MAXHISTO]; + int fIntegerT0[MAXHISTO]; + int fFirstGood[MAXHISTO]; + int fLastGood[MAXHISTO]; - float real_t0[MAXHISTO]; - int integer_t0[MAXHISTO]; - int first_good[MAXHISTO]; - int last_good[MAXHISTO]; + int fNumberScaler; + int fScalers[MAXSCALER]; + char fLabelsScalers[MAXSCALER][MAXLABELSIZE]; - int number_scaler; - int scalers[MAXSCALER]; - char labels_scalers[MAXSCALER][MAXLABELSIZE]; + int fNumberTemper; + float fTemper[MAXTEMPER]; + float fTempDeviation[MAXTEMPER]; - int number_temper; - float temper[MAXTEMPER]; - float temp_deviation[MAXTEMPER]; - - int **histo; + std::vector< std::vector > fHisto; public: @@ -118,22 +116,22 @@ class MuSR_td_PSI_bin { NOTE: Histogram information returned by \ = ..._array() methods should be freed by delete [] \; */ - std::vector< std::vector > histos_vector ; + std::vector< std::vector > fHistosVector ; // ------------------------------------end of the variables public: - int read(const char* fileName); // generic read - int write(const char *fileName); // generic write + int Read(const char* fileName); // generic read + int Write(const char *fileName); // generic write - int readbin(const char* fileName); // read MuSR PSI bin format - int writebin(const char *fileName); // write MuSR PSI bin format - int readmdu(const char* fileName); // read MuSR mdu format - int writemdu(const char* fileName); // write MuSR mdu format + int ReadBin(const char* fileName); // read MuSR PSI bin format + int WriteBin(const char *fileName); // write MuSR PSI bin format + int ReadMdu(const char* fileName); // read MuSR mdu format + int WriteMdu(const char* fileName); // write MuSR mdu format - bool readingOK() const; - bool writingOK() const; + bool ReadingOK() const; + bool WritingOK() const; bool CheckDataConsistency(int tag=0); // tag: 0=reasonable, 1=strict std::string ReadStatus() const; std::string WriteStatus() const; @@ -143,57 +141,46 @@ class MuSR_td_PSI_bin { int Show() const; int Clear(); - int get_histo_int(int histo_num, int j); - double get_histo(int histo_num, int j); + int GetHistoInt(int histo_num, int j); + double GetHisto(int histo_num, int j); - int *get_histo_array_int(int histo_num); - double *get_histo_array(int histo_num, int binning); - int put_histo_array_int(std::vector< std::vector > histo, int tag = 0); - std::vector get_histo_vector(int histo_num, int binning); - std::vector get_histo_vector_no0(int histo_num, int binning); + std::vector GetHistoArrayInt(int histo_num); + std::vector GetHistoArray(int histo_num, int binning); + int PutHistoArrayInt(std::vector< std::vector > &histo, int tag = 0); + std::vector GetHistoVector(int histo_num, int binning); + std::vector GetHistoVectorNo0(int histo_num, int binning); - double *get_histo_fromt0_array(int histo_num, int binning, int offset = 0); + double *GetHistoFromT0Array(int histo_num, int binning, int offset = 0); - std::vector get_histo_fromt0_vector(int histo_num, int binning, int offset = 0); + std::vector GetHistoFromT0Vector(int histo_num, int binning, int offset = 0); - double *get_histo_goodBins_array(int histo_num, int binning); + double *GetHistoGoodBinsArray(int histo_num, int binning); - std::vector get_histo_goodBins_vector(int histo_num, int binning); + std::vector GetHistoGoodBinsVector(int histo_num, int binning); - double *get_histo_fromt0_minus_bckgrd_array(int histo_num, - int lower_bckgdr, - int higher_bckgdr, - int binning, - int offset = 0); + double *GetHistoFromT0MinusBkgArray(int histo_num, + int lower_bckgdr, + int higher_bckgdr, + int binning, + int offset = 0); - std::vector get_histo_fromt0_minus_bckgrd_vector(int histo_num, - int lower_bckgdr, - int higher_bckgdr, - int binning, - int offset = 0); + std::vector GetHistoFromT0MinusBkgVector(int histo_num, + int lower_bckgdr, + int higher_bckgdr, + int binning, + int offset = 0); - double *get_histo_goodBins_minus_bckgrd_array(int histo_num, - int lower_bckgrd, - int higher_bckgrd, - int binning); + double *GetHistoGoodBinsMinusBkgArray(int histo_num, + int lower_bckgrd, + int higher_bckgrd, + int binning); - std::vector get_histo_goodBins_minus_bckgrd_vector(int histo_num, - int lower_bckgrd, - int higher_bckgrd, - int binning); + std::vector GetHistoGoodBinsMinusBkgVector(int histo_num, + int lower_bckgrd, + int higher_bckgrd, + int binning); - double *get_asymmetry_array(int histo_num_plus, - int histo_num_minus, - double alpha_param, - int binning, - int lower_bckgrd_plus, - int higher_bckgrd_plus, - int lower_bckgrd_minus, - int higher_bckgrd_minus, - int offset = 0, - double y_offset = 0.); - - std::vector get_asymmetry_vector(int histo_num_plus, + double *GetAsymmetryArray(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -204,7 +191,28 @@ class MuSR_td_PSI_bin { int offset = 0, double y_offset = 0.); - double *get_error_asymmetry_array(int histo_num_plus, + std::vector GetAsymmetryVector(int histo_num_plus, + int histo_num_minus, + double alpha_param, + int binning, + int lower_bckgrd_plus, + int higher_bckgrd_plus, + int lower_bckgrd_minus, + int higher_bckgrd_minus, + int offset = 0, + double y_offset = 0.); + + double *GetErrorAsymmetryArray(int histo_num_plus, + int histo_num_minus, + double alpha_param, + int binning, + int lower_bckgrd_plus, + int higher_bckgrd_plus, + int lower_bckgrd_minus, + int higher_bckgrd_minus, + int offset = 0); + + std::vector GetErrorAsymmetryVector(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -214,17 +222,7 @@ class MuSR_td_PSI_bin { int higher_bckgrd_minus, int offset = 0); - std::vector get_error_asymmetry_vector(int histo_num_plus, - int histo_num_minus, - double alpha_param, - int binning, - int lower_bckgrd_plus, - int higher_bckgrd_plus, - int lower_bckgrd_minus, - int higher_bckgrd_minus, - int offset = 0); - - double *get_asymmetry_goodBins_array(int histo_num_plus, + double *GetAsymmetryGoodBinsArray(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -233,16 +231,16 @@ class MuSR_td_PSI_bin { int lower_bckgrd_minus, int higher_bckgrd_minus); - std::vector get_asymmetry_goodBins_vector(int histo_num_plus, - int histo_num_minus, - double alpha_param, - int binning, - int lower_bckgrd_plus, - int higher_bckgrd_plus, - int lower_bckgrd_minus, - int higher_bckgrd_minus); + std::vector GetAsymmetryGoodBinsVector(int histo_num_plus, + int histo_num_minus, + double alpha_param, + int binning, + int lower_bckgrd_plus, + int higher_bckgrd_plus, + int lower_bckgrd_minus, + int higher_bckgrd_minus); - double *get_error_asymmetry_goodBins_array(int histo_num_plus, + double *GetErrorAsymmetryGoodBinsArray(int histo_num_plus, int histo_num_minus, double alpha_param, int binning, @@ -251,103 +249,103 @@ class MuSR_td_PSI_bin { int lower_bckgrd_minus, int higher_bckgrd_minus); - std::vector get_error_asymmetry_goodBins_vector(int histo_num_plus, - int histo_num_minus, - double alpha_param, - int binning, - int lower_bckgrd_plus, - int higher_bckgrd_plus, - int lower_bckgrd_minus, - int higher_bckgrd_minus); + std::vector GetErrorAsymmetryGoodBinsVector(int histo_num_plus, + int histo_num_minus, + double alpha_param, + int binning, + int lower_bckgrd_plus, + int higher_bckgrd_plus, + int lower_bckgrd_minus, + int higher_bckgrd_minus); - double get_binWidth_ps(); - void put_binWidth_ps(double binWidth); - double get_binWidth_ns(); - void put_binWidth_ns(double binWidth); - double get_binWidth_us(); - void put_binWidth_us(double binWidth); + double GetBinWidthPicoSec(); + void PutBinWidthPicoSec(double binWidth); + double GetBinWidthNanoSec(); + void PutBinWidthNanoSec(double binWidth); + double GetBinWidthMicroSec(); + void PutBinWidthMicroSec(double binWidth); - int get_histoLength_bin(); - void put_histoLength_bin(int val) { length_histo = val; } + int GetHistoLengthBin() { return fLengthHisto; } + void PutHistoLengthBin(int val) { fLengthHisto = val; } - int get_numberHisto_int(); - void put_numberHisto_int(int val) { number_histo = val; } + int GetNumberHistoInt() { return fNumberHisto; } + void PutNumberHistoInt(int val) { fNumberHisto = val; } - std::string get_nameHisto(int i); - int put_nameHisto(std::string histoName, int i); - std::vector get_histoNames_vector(); - int put_histoNames_vector(std::vector &histoNames); + std::string GetNameHisto(int i); + int PutNameHisto(std::string histoName, int i); + std::vector GetHistoNamesVector(); + int PutHistoNamesVector(std::vector &histoNames); - long get_eventsHisto_long(int i); - std::vector get_eventsHisto_vector(); + long GetEventsHistoLong(int i); + std::vector GetEventsHistoVector(); - long get_totalEvents_long(); + long GetTotalEventsLong() { return long(fTotalEvents); } - int get_numberScaler_int(); - int put_numberScaler_int(int val); - std::vector get_scalers_vector(); - int put_scalers_vector(std::vector scalerData); - std::vector get_scalersNames_vector(); - int put_scalersNames_vector(std::vector scalersName); + int GetNumberScalerInt(); + int PutNumberScalerInt(int val); + std::vector GetScalersVector(); + int PutScalersVector(std::vector scalerData); + std::vector GetScalersNamesVector(); + int PutScalersNamesVector(std::vector scalersName); - int get_default_binning(); - int get_t0_int(int i); - int put_t0_int(int histoNo, int t0); - std::vector get_t0_vector(); - int put_t0_vector(std::vector &t0Data); - double get_t0_double(int i); + int GetDefaultBinning(); + int GetT0Int(int i); + int PutT0Int(int histoNo, int t0); + std::vector GetT0Vector(); + int PutT0Vector(std::vector &t0Data); + double GetT0Double(int i); - int get_max_t0_int (); - int get_max_2_t0_int (int k, int j); - int get_min_t0_int (); - int get_min_2_t0_int (int k, int j); + int GetMaxT0Int(); + int GetMax2T0Int (int k, int j); + int GetMinT0Int(); + int GetMin2T0Int (int k, int j); - int get_firstGood_int(int i); - std::vector get_firstGood_vector(); - int put_firstGood_int(int i, int j); + int GetFirstGoodInt(int i); + std::vector GetFirstGoodVector(); + int PutFirstGoodInt(int i, int j); - int get_lastGood_int(int i); - std::vector get_lastGood_vector(); - int put_lastGood_int(int i, int j); + int GetLastGoodInt(int i); + std::vector GetLastGoodVector(); + int PutLastGoodInt(int i, int j); - int get_max_lastGood_int (); - int get_max_2_lastGood_int (int k, int j); - int get_min_lastGood_int (); - int get_min_2_lastGood_int (int k, int j); + int GetMaxLastGoodInt(); + int GetMax2LastGoodInt (int k, int j); + int GetMinLastGoodInt(); + int GetMin2LastGoodInt (int k, int j); - int get_runNumber_int(); - int put_runNumber_int(int i); + int GetRunNumberInt() { return fNumRun; } + int PutRunNumberInt(int i); - std::string get_sample(); - int put_sample(std::string sample); - std::string get_field(); - int put_field(std::string field); - std::string get_orient(); - int put_orient(std::string orientation); - std::string get_temp(); - int put_temp(std::string temp); - std::string get_setup(); - int put_setup(std::string setup); - std::string get_comment(); - int put_comment(std::string comment); + std::string GetSample(); + int PutSample(std::string sample); + std::string GetField(); + int PutField(std::string field); + std::string GetOrient(); + int PutOrient(std::string orientation); + std::string GetTemp(); + int PutTemp(std::string temp); + std::string GetSetup(); + int PutSetup(std::string setup); + std::string GetComment(); + int PutComment(std::string comment); - std::vector get_timeStart_vector(); - int put_timeStart_vector(std::vector timeStart); - std::vector get_timeStop_vector(); - int put_timeStop_vector(std::vector timeStop); + std::vector GetTimeStartVector(); + int PutTimeStartVector(std::vector timeStart); + std::vector GetTimeStopVector(); + int PutTimeStopVector(std::vector timeStop); - int get_numberTemperature_int(); - int put_numberTemperature_int(int noOfTemps); - std::vector get_temperatures_vector(); - int put_temperatures_vector(std::vector &temps); - std::vector get_devTemperatures_vector(); - int put_devTemperatures_vector(std::vector &devTemps); + int GetNumberTemperatureInt() { return fNumberTemper; } + int PutNumberTemperatureInt(int noOfTemps); + std::vector GetTemperaturesVector(); + int PutTemperaturesVector(std::vector &temps); + std::vector GetDevTemperaturesVector(); + int PutDevTemperaturesVector(std::vector &devTemps); private: - int tmax(int x, int y); - int tmin(int x, int y); + int Tmax(int x, int y); + int Tmin(int x, int y); } ; #endif