83 std::ifstream file_name;
89 file_name.open(fileName, std::ios_base::binary);
96 char *buffer_file =
new char[3];
103 file_name.read(buffer_file, 2);
105 if (file_name.fail())
108 delete [] buffer_file;
117 delete [] buffer_file;
121 std::cout <<
"**WARNING** found '" <<
fFormatId <<
"'. Will change it to '1N'" << std::endl;
167 std::string fln = fileName;
168 size_t found = fln.find_last_of(
".");
169 if (found == fln.npos) {
172 std::string ext = fln.substr(found+1);
176 else if (ext ==
"mdu")
190#if ((defined(__DECC) || defined(__VAXC)) && !defined(unix) && !defined(OS_OSF1))
193typedef short int Int16;
197typedef long int Int32;
201#elif defined (__osf__)
204typedef short int Int16;
208typedef long int Int32;
214#if (defined(_WIN32) || defined(__linux__) || defined(_Darwin_) || defined(_WIN32GCC))
247 std::ifstream file_name;
253 Int16 tdc_resolution;
258 Int32 mon_num_events;
261 Int16 num_data_records_file;
262 Int16 length_data_records_bins;
263 Int16 num_data_records_histo;
270 if (
sizeof(
Int16) != 2)
272 fReadStatus =
"ERROR Size of Int16 data type is not 2 bytes!";
276 if (
sizeof(
Int32) != 4)
278 fReadStatus =
"ERROR Sizeof Int32 data type is not 4 bytes";
284 fReadStatus =
"ERROR Sizeof Float32 data type is not 4 bytes";
290 file_name.open(fileName, std::ios_base::binary);
291 if (file_name.fail())
297 char *buffer_file =
new char[1024];
300 fReadStatus =
"ERROR Allocating buffer to read header failed!";
304 file_name.read(buffer_file, 1024);
305 if (file_name.fail())
308 delete [] buffer_file;
322 delete [] buffer_file;
327 dum_Int16 = (
Int16 *) &buffer_file[2];
328 tdc_resolution = *dum_Int16;
330 dum_Int16 = (
Int16 *) &buffer_file[4];
331 tdc_overflow = *dum_Int16;
333 dum_Int16 = (
Int16 *) &buffer_file[6];
336 dum_Int16 = (
Int16 *) &buffer_file[28];
339 dum_Int16 = (
Int16 *) &buffer_file[30];
342 strncpy(
fSample,buffer_file+138,10);
345 strncpy(
fTemp,buffer_file+148,10);
348 strncpy(
fField,buffer_file+158,10);
351 strncpy(
fOrient,buffer_file+168,10);
354 strncpy(
fSetup, buffer_file+178, 10);
357 strncpy(
fComment,buffer_file+860,62);
372 dum_Int32 = (
Int32 *) &buffer_file[424];
375 for (i=0; i<=15; i++) {
379 dum_Int32 = (
Int32 *) &buffer_file[296+i*4];
382 dum_Int16 = (
Int16 *) &buffer_file[458+i*2];
385 dum_Int16 = (
Int16 *) &buffer_file[490+i*2];
388 dum_Int16 = (
Int16 *) &buffer_file[522+i*2];
392 for (i=0; i<=15; i++) {
393 dum_Float32 = (
Float32 *) &buffer_file[792+i*4];
399 for (i=0; i<=5; i++) {
400 dum_Int32 = (
Int32 *) &buffer_file[670+i*4];
408 dum_Int32 = (
Int32 *) &buffer_file[360+(i-6)*4];
415 dum_Float32 = (
Float32 *) &buffer_file[1012];
416 fBinWidth =
static_cast<double>(*dum_Float32);
420 fBinWidth=0.125*(625.E-6)*pow(
static_cast<double>(2.0),
static_cast<double>(tdc_resolution));
427 dum_Float32 = (
Float32 *) &buffer_file[716+i*4];
430 dum_Float32 = (
Float32 *) &buffer_file[738+i*4];
433 dum_Float32 = (
Float32 *) &buffer_file[72+i*4];
434 mon_low[i] = *dum_Float32;
436 dum_Float32 = (
Float32 *) &buffer_file[88+i*4];
437 mon_high[i] = *dum_Float32;
440 dum_Int32 = (
Int32 *) &buffer_file[712];
441 mon_num_events = *dum_Int32;
442 strncpy(mon_dev,buffer_file+60,12);
445 dum_Int16 = (
Int16 *) &buffer_file[128];
446 num_data_records_file = *dum_Int16;
448 dum_Int16 = (
Int16 *) &buffer_file[130];
449 length_data_records_bins = *dum_Int16;
451 dum_Int16 = (
Int16 *) &buffer_file[132];
452 num_data_records_histo = *dum_Int16;
454 dum_Int16 = (
Int16 *) &buffer_file[134];
455 if (*dum_Int16 != 1) {
456 std::cout <<
"ERROR number of histograms/record not equals 1!"
457 <<
" Required algorithm is not implemented!" << std::endl;
458 delete [] buffer_file;
460 fReadStatus =
"ERROR Algorithm to read multiple histograms in one block -"
461 " necessary to read " +
fFilename +
" - is not implemented!";
465 dum_Int32 = (
Int32 *) &buffer_file[654];
466 period_save = *dum_Int32;
468 dum_Int32 = (
Int32 *) &buffer_file[658];
469 period_mon = *dum_Int32;
471 if (buffer_file)
delete [] buffer_file;
487 char *buffer_file_histo =
new char[
Int32(num_data_records_file)
488 *
Int32(length_data_records_bins)*4];
489 if (!buffer_file_histo) {
492 fReadStatus =
"ERROR Allocating buffer to read histogram failed!";
495 file_name.seekg(1024, std::ios_base::beg);
497 file_name.read(buffer_file_histo,
Int32(num_data_records_file)
498 *
Int32(length_data_records_bins)*4);
499 if (file_name.fail()) {
501 delete [] buffer_file_histo;
509 std::vector<double> dummy_vector;
513 dummy_vector.clear();
515 dum_Int32 = (
Int32 *) &buffer_file_histo[(i*
Int32(num_data_records_histo)*
516 Int32(length_data_records_bins)+j)*
sizeof(
Int32)];
518 dummy_vector.push_back(
double(
fHisto[i][j]));
523 if (buffer_file_histo)
delete [] buffer_file_histo;
551 fWriteStatus =
"ERROR Given data set is incompatible with the PSI-BIN format!";
558 char *buffer =
new char[1024];
559 if (buffer ==
nullptr) {
560 fWriteStatus =
"ERROR Allocating buffer to write header failed!";
564 memset(buffer, 0, 1024);
568 fout.open(fileName, std::ios_base::binary);
570 fWriteStatus =
"ERROR Open " + std::string(fileName) +
" failed!";
579 strncpy(buffer,
"1N", 2);
582 memcpy(buffer+2, &dum_Int16, 2);
585 memcpy(buffer+6, &dum_Int16, 2);
588 memcpy(buffer+28, &dum_Int16, 2);
591 memcpy(buffer+30, &dum_Int16, 2);
594 memcpy(buffer+128, &dum_Int16, 2);
597 memcpy(buffer+130, (
const char*)&dum_Int16, 2);
600 memcpy(buffer+132, &dum_Int16, 2);
603 memcpy(buffer+134, &dum_Int16, 2);
605 strncpy(buffer+138,
fSample, 10);
607 strncpy(buffer+148,
fTemp, 10);
609 strncpy(buffer+158,
fField, 10);
611 strncpy(buffer+168,
fOrient, 10);
613 strncpy(buffer+178,
fSetup, 10);
625 Int32 totalEvents = 0;
631 totalEvents += noEvents;
632 memcpy(buffer+296+4*i, &noEvents, 4);
635 for (
int i=0; i<12; i++) {
637 memcpy(buffer+360+4*i, &dum_Int32, 4);
640 memcpy(buffer+424, &totalEvents, 4);
645 memcpy(buffer+458+2*i, (
const char *)&dum_Int16, 2);
648 memcpy(buffer+490+2*i, (
const char *)&dum_Int16, 2);
651 memcpy(buffer+522+2*i, (
const char *)&dum_Int16, 2);
658 for (
int i=0; i<6; i++) {
660 memcpy(buffer+670+i*4, &dum_Int32, 4);
664 memcpy(buffer+712, (
const char *)&dum_Int32, 4);
668 memcpy(buffer+716+i*4, (
const char *)&dum_Float32, 4);
671 memcpy(buffer+738+i*4, (
const char *)&dum_Float32, 4);
676 for (
int i=0; i<6; i++) {
685 memcpy(buffer+1012, (
const char*)&dum_Float32, 4);
688 fout.write(buffer, 1024);
697 buffer =
new char[4*
MAXREC];
699 fWriteStatus =
"ERROR Allocating buffer to write data failed!";
703 memset(buffer, 0, 4*
MAXREC);
705 bool buffer_empty =
false;
709 memcpy(buffer+(4*j)%(4*
MAXREC), &dum_Int32, 4);
710 buffer_empty =
false;
711 if ((j > 0) && (j%
MAXREC == 0)) {
712 fout.write(buffer, 4*
MAXREC);
714 memset(buffer, 0, 4*
MAXREC);
720 fout.write(buffer, 4*
MAXREC);
722 memset(buffer, 0, 4*
MAXREC);
747#define SUBTITLESTR 62
748#define DATAFORMATSTR 20
749#define DETECTLISTSTR 200
750#define TEMPLISTSTR 50
753#define PTAMODE_NONE 0
754#define PTAMODE_NORMAL 1
755#define PTAMODE_CLOCK 2
757#define PTAMODE_ECHO 4
760#define PTATAGC_NONE 'N'
761#define PTATAGC_MUON 'M'
762#define PTATAGC_POSITRON 'P'
763#define PTATAGC_CLOCK 'C'
764#define PTATAGC_ECHO 'E'
765#define PTATAGC_VETO 'V'
766#define PTATAGC_UNKNOWN 'U'
770#define TDCMAXTAGS16 16
771#define TDCMAXTAGS32 32
1007 std::ifstream file_name;
1012 if (
sizeof(
Int32) != 4)
1014 fReadStatus =
"ERROR Sizeof( Int32 ) data type is not 4 bytes";
1020 file_name.open(fileName, std::ios_base::binary);
1021 if (file_name.fail())
1030 file_name.read((
char *)&gpTAfhead,
sizeof gpTAfhead);
1031 if (file_name.fail())
1096 cout <<
"Header.MeanTemp = " << gpTAfhead.
Header.
MeanTemp << endl;
1097 cout <<
"Header.TempDev = " << gpTAfhead.
Header.
TempDev << endl;
1133 selected[i] =
false;
1141 if ((it >= 0) && (it <
MAXHISTO)) {
1142 selected[it] =
true;
1144 cout <<
"Histogram " << it <<
" is selected " << endl;
1147 std::cout <<
"error " << it <<
" is out of range |0 - " <<
MAXHISTO-1 <<
"|"
1157 int resolutionfactor = 1;
1179 file_name.read((
char *)&gpTAsetpta,
sizeof gpTAsetpta);
1180 if (file_name.fail()) {
1187 file_name.read((
char *)&gpTAstattotpta,
sizeof gpTAstattotpta);
1188 if (file_name.fail()) {
1204 resolutionfactor = 1;
1209 else if (gpTAsetpta.
timespan == 10)
1225 if (timespan+8-gpTAsetpta.
timespan < 0) {
1240 for (i=0; i < timespan+8-gpTAsetpta.
timespan; i++)
1241 resolutionfactor *= 2;
1246 for (i=0; i<tothist; i++) {
1252 cout <<
"Tag[" << i <<
"] Histomin = " << gpTAsetpta.
tag[i].
Histominb
1253 <<
" Histomax = " << gpTAsetpta.
tag[i].
Histomaxb << endl;
1265 std::cout <<
"Different histogram lengths!" << std::endl;
1275 std::cout <<
"Number of found histos " <<
fNumberHisto <<
" and number in header "
1281 }
else if (strcmp(
fFormatId,
"T4") == 0) {
1300 file_name.read((
char *)&gpTAsettdc,
sizeof gpTAsettdc);
1301 if (file_name.fail()) {
1307 file_name.read((
char *)&gpTAstattottdc,
sizeof gpTAstattottdc);
1308 if (file_name.fail()) {
1339 for (i=0; i<tothist; i++) {
1345 cout <<
"Tag[" << i <<
"] Histomin = " << gpTAsettdc.
tag[i].
Histominb
1346 <<
" Histomax = " << gpTAsettdc.
tag[i].
Histomaxb << endl;
1355 std::cout <<
"Different histogram lengths!" << std::endl;
1362 }
else if (strcmp(
fFormatId,
"T5") == 0) {
1382 file_name.read((
char *)&gpTAsettdc32,
sizeof gpTAsettdc32);
1383 if (file_name.fail()) {
1390 file_name.read((
char *)&gpTAstattottdc32,
sizeof gpTAstattottdc32);
1391 if (file_name.fail()) {
1423 for (i=0; i<tothist; i++) {
1429 cout <<
"Tag[" << i <<
"] Histomin = " << gpTAsettdc32.
tag[i].
Histominb
1430 <<
" Histomax = " << gpTAsettdc32.
tag[i].
Histomaxb << endl;
1440 std::cout <<
"Different histogram lengths!" << std::endl;
1460 std::cout <<
"ERROR number of histograms " << tothist <<
" exceedes maximum "
1461 <<
MAXHISTO <<
"! - Setting maximum number " << std::endl;
1466 cout <<
"Number of histograms is " <<
fNumberHisto << endl;
1467 cout <<
"Histogram length is " <<
fLengthHisto << endl;
1468 cout <<
"Resolutionfactor for t0, fg, lg is " << resolutionfactor << endl;
1488 Int32 *thist =
nullptr;
1489 std::vector<double> dummy_vector;
1492 for (i=0,ihist=0; i< tothist; i++) {
1493 file_name.read((
char *)&tag,
sizeof tag);
1494 if (file_name.fail()) {
1495 dummy_vector.clear();
1497 if (thist !=
nullptr) {
1510 cout <<
"Tag[" << i <<
"] " << tag.Label <<
" : Histomin = " << tag.Histominb
1511 <<
" Histomax = " << tag.Histomaxb << endl;
1514 if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1) {
1515 if (thist ==
nullptr)
1516 thist =
new Int32[nbins];
1517 if (thist ==
nullptr) {
1520 fReadStatus =
"ERROR Allocating histogram buffer failed!";
1524 file_name.read((
char *)thist,
sizeof(
Int32)*nbins);
1525 if (file_name.fail()) {
1527 if (thist !=
nullptr) {
1538 if (selected[i] || (strcmp(
fFormatId,
"M3") != 0)) {
1541 dummy_vector.clear();
1553 fIntegerT0[ihist] = (tag.t0b+1)*resolutionfactor -1;
1554 fFirstGood[ihist] = (tag.tfb+1)*resolutionfactor -1;
1555 fLastGood[ihist] = tag.tlb*resolutionfactor;
1559 for (j=0; j<tag.Histominb; j++) {
1561 dummy_vector.push_back(
double(
fHisto[ihist][j]));
1565 fHisto[ihist][j]= *(thist+j-tag.Histominb);
1566 dummy_vector.push_back(
double(
fHisto[ihist][j]));
1584 if (thist !=
nullptr) {
1617 std::cerr << std::endl <<
"MuSR_td_PSI_bin::WriteMdu - not yet implemented" << std::endl;
1695 fConsistencyStatus =
"**ERROR** histogram length is too large (maximum being 32767)!";
1711 if (
fHisto.size() == 0) {
1798 if (( histo_num < 0) || (histo_num >=
int(
fNumberHisto)) ||
1802 cout <<
"fHistosVector[0][0] = " <<
fHistosVector[0][0] << endl;
1804 return fHisto[histo_num][j];
1821 if (( histo_num < 0) || (histo_num >=
int(
fNumberHisto)) ||
1825 cout <<
"fHistosVector[0][0] = " <<
fHistosVector[0][0] << endl;
1827 return static_cast<double>(
fHisto[histo_num][j]);
1848 std::vector<double> histo_array;
1852 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
1857 if (histo_array.size() == 0)
return histo_array;
1861 for (
int j = 0; j < binning; j++)
1862 histo_array[i] +=
double(
fHisto[histo_num][i*binning+j]);
1894 if ((histoData.size() == 0) || (histoData.size() > 32)) {
1896 fConsistencyStatus =
"**ERROR** number of histograms out of range! Must be > 0 and < 32.";
1901 unsigned int size = histoData[0].size();
1903 for (
unsigned int i=1; i<histoData.size(); i++) {
1904 if (histoData[i].size() != size) {
1919 int lengthHisto = (65536 / histoData.size()) - ((65536 / histoData.size()) % 256);
1920 if (lengthHisto > 32512)
1921 lengthHisto = 32512;
1923 if (lengthHisto > 32512)
1924 lengthHisto = 32512;
1928 int dataLength = ((int)histoData[0].size());
1929 int rebin = (int)histoData[0].size() / lengthHisto;
1932 if ((
int)histoData[0].size() % lengthHisto != 0)
1934 if ((((
int)histoData[0].size()/rebin) % 256) == 0)
1935 dataLength = (int)histoData[0].size()/rebin;
1937 dataLength = (((int)histoData[0].size()/rebin/256)+1)*256;
1938 }
else if ((tag == 1) || (tag == 2)) {
1939 if (((
int)histoData[0].size() % 256) != 0)
1940 dataLength = (((int)histoData[0].size()/256)+1)*256;
1947 int noOfHistos = histoData.size();
1948 fHisto.resize(noOfHistos);
1950 for (
unsigned int i=0; i<noOfHistos; i++) {
1957 std::vector< std::vector<int> > data;
1962 for (
unsigned int j=0; j<histoData[i].size(); j++) {
1963 if ((j>0) && (j%rebin == 0)) {
1964 data[i].push_back(val);
1967 val += histoData[i][j];
1974 if (j<(
int)data[i].size())
1975 fHisto[i][j] = data[i][j];
1989 }
else if ((tag == 1) || (tag == 2)) {
1993 if (j < histoData[i].size())
1994 fHisto[i][j] = histoData[i][j];
2036 std::vector<double> histo_vector;
2040 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2041 return histo_vector;
2044 histo_vector.push_back(0.);
2047 for (
int j = 0; j < binning; j++)
2048 histo_vector[i] +=
double(
fHisto[histo_num][i*binning+j]);
2051 return histo_vector;
2072 std::vector<double> histo_vector;
2076 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2077 return histo_vector;
2080 histo_vector.push_back(0.);
2083 for (
int j = 0; j < binning; j++)
2084 histo_vector[i] +=
double(
fHisto[histo_num][i*binning+j]);
2086 if (histo_vector[i] < 0.5 ) {
2087 histo_vector[i] = 0.1;
2091 return histo_vector;
2112 std::vector<int> histo_array;
2121 if (histo_array.size() == 0)
2124 histo_array =
fHisto[histo_num];
2151 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2154 double *histo_fromt0_array =
2157 if (!histo_fromt0_array)
return nullptr;
2160 histo_fromt0_array[i] = 0;
2161 for (
int j = 0; j < binning; j++)
2162 histo_fromt0_array[i] +=
2163 double(
fHisto[histo_num][i*binning+j+
GetT0Int(histo_num)+offset]);
2166 return histo_fromt0_array;
2188 std::vector<double> histo_fromt0_vector;
2192 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2193 return histo_fromt0_vector;
2196 histo_fromt0_vector.push_back(0.);
2199 for (
int j = 0; j < binning; j++)
2200 histo_fromt0_vector[i] +=
2201 double(
fHisto[histo_num][i*binning+j+
GetT0Int(histo_num)+offset]);
2204 return histo_fromt0_vector;
2227 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2230 double *histo_goodBins_array =
2233 if (!histo_goodBins_array)
return nullptr;
2236 histo_goodBins_array[i] = 0;
2237 for (
int j = 0; j < binning; j++)
2238 histo_goodBins_array[i] +=
2242 return histo_goodBins_array;
2264 std::vector<double> histo_goodBins_vector;
2266 if (!
fReadingOk)
return histo_goodBins_vector;
2268 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2269 return histo_goodBins_vector;
2272 histo_goodBins_vector.push_back(0.);
2275 for (
int j = 0; j < binning; j++)
2276 histo_goodBins_vector[i] +=
2280 return histo_goodBins_vector;
2308 int lower_bckgrd,
int higher_bckgrd,
int binning,
int offset)
2312 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2315 if ( lower_bckgrd < 0 || higher_bckgrd >=
int(
fLengthHisto) || lower_bckgrd > higher_bckgrd )
2320 for (
int k = lower_bckgrd; k <= higher_bckgrd; k++) {
2321 bckgrd += double(
fHisto[histo_num][k]);
2323 bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1);
2325 double *histo_fromt0_minus_bckgrd_array =
2328 if (!histo_fromt0_minus_bckgrd_array)
return NULL;
2331 histo_fromt0_minus_bckgrd_array[i] = 0;
2332 for (
int j = 0; j < binning; j++)
2333 histo_fromt0_minus_bckgrd_array[i] +=
2334 double(
fHisto[histo_num][i*binning+j+
GetT0Int(histo_num)+offset]) - bckgrd;
2337 return histo_fromt0_minus_bckgrd_array;
2363 int higher_bckgrd,
int binning,
int offset)
2365 std::vector<double> histo_fromt0_minus_bckgrd_vector;
2367 if (!
fReadingOk)
return histo_fromt0_minus_bckgrd_vector;
2369 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2370 return histo_fromt0_minus_bckgrd_vector;
2372 if ( lower_bckgrd < 0 || higher_bckgrd >=
int(
fLengthHisto) || lower_bckgrd > higher_bckgrd )
2373 return histo_fromt0_minus_bckgrd_vector;
2376 for (
int k = lower_bckgrd; k <= higher_bckgrd; k++) {
2377 bckgrd += double(
fHisto[histo_num][k]);
2379 bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1);
2382 histo_fromt0_minus_bckgrd_vector.push_back(0.);
2385 for (
int j = 0; j < binning; j++)
2386 histo_fromt0_minus_bckgrd_vector[i] +=
2387 double(
fHisto[histo_num][i*binning+j+
GetT0Int(histo_num)+offset]) - bckgrd;
2390 return histo_fromt0_minus_bckgrd_vector;
2418 int higher_bckgrd,
int binning)
2422 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2425 if ( lower_bckgrd < 0 || higher_bckgrd >=
int(
fLengthHisto) || lower_bckgrd > higher_bckgrd )
2429 for (
int k = lower_bckgrd; k <= higher_bckgrd; k++) {
2430 bckgrd += double(
fHisto[histo_num][k]);
2432 bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1);
2434 double *histo_goodBins_minus_bckgrd_array =
2437 if (!histo_goodBins_minus_bckgrd_array)
return nullptr;
2440 histo_goodBins_minus_bckgrd_array[i] = 0;
2441 for (
int j = 0; j < binning; j++)
2442 histo_goodBins_minus_bckgrd_array[i] +=
2446 return histo_goodBins_minus_bckgrd_array;
2473 int higher_bckgrd,
int binning)
2475 std::vector<double> histo_goodBins_minus_bckgrd_vector; ;
2477 if (!
fReadingOk)
return histo_goodBins_minus_bckgrd_vector;
2479 if ( histo_num < 0 || histo_num >=
int(
fNumberHisto) || binning <= 0 )
2480 return histo_goodBins_minus_bckgrd_vector;
2482 if ( lower_bckgrd < 0 || higher_bckgrd >=
int(
fLengthHisto) || lower_bckgrd > higher_bckgrd )
2483 return histo_goodBins_minus_bckgrd_vector;
2486 for (
int k = lower_bckgrd; k <= higher_bckgrd; k++) {
2487 bckgrd += double(
fHisto[histo_num][k]);
2489 bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1);
2492 histo_goodBins_minus_bckgrd_vector.push_back(0.);
2495 for (
int j = 0; j < binning; j++)
2496 histo_goodBins_minus_bckgrd_vector[i] +=
2500 return histo_goodBins_minus_bckgrd_vector;
2530 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2531 int lower_bckgrd_minus,
int higher_bckgrd_minus,
int offset,
2538 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2541 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2544 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2547 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2552 higher_bckgrd_plus, binning, offset);
2553 if (dummy_1 ==
nullptr)
return nullptr;
2556 higher_bckgrd_minus, binning, offset);
2557 if (dummy_2 ==
nullptr) {
2562 double *asymmetry_array =
new double[int((
int(
fLengthHisto)-max_t0-offset+1)/binning)];
2564 if (!asymmetry_array)
return nullptr;
2566 for (
int i = 0; i < int((
int(
fLengthHisto)-max_t0)/binning); i++) {
2567 asymmetry_array[i] = (dummy_1[i] - alpha_param * dummy_2[i]) /
2568 (dummy_1[i] + alpha_param * dummy_2[i]) + y_offset;
2574 return asymmetry_array;
2601 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2602 int lower_bckgrd_minus,
int higher_bckgrd_minus,
int offset,
double y_offset)
2606 std::vector<double> asymmetry_vector;
2610 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2611 return asymmetry_vector;
2613 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2614 return asymmetry_vector;
2616 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2617 return asymmetry_vector;
2619 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2620 return asymmetry_vector;
2623 higher_bckgrd_plus, binning, offset);
2624 if (dummy_1 ==
nullptr)
return asymmetry_vector;
2627 higher_bckgrd_minus, binning, offset);
2628 if (dummy_2 ==
nullptr) {
2630 return asymmetry_vector;
2633 for (
int i = 0; i < int((
int(
fLengthHisto)-max_t0-offset)/binning); i++)
2634 asymmetry_vector.push_back(0.);
2636 for (
int i = 0; i < int((
int(
fLengthHisto)-max_t0-offset)/binning); i++) {
2637 asymmetry_vector[i] = (dummy_1[i] - alpha_param * dummy_2[i]) /
2638 (dummy_1[i] + alpha_param * dummy_2[i]) + y_offset;
2644 return asymmetry_vector;
2671 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2672 int lower_bckgrd_minus,
int higher_bckgrd_minus,
int offset)
2678 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2681 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2684 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2687 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2691 higher_bckgrd_plus, binning, offset);
2692 if (dummy_1 ==
nullptr)
return nullptr;
2695 higher_bckgrd_minus, binning, offset);
2696 if (dummy_2 ==
nullptr) {
2701 double *error_asymmetry_array =
new double[int((
int(
fLengthHisto)-max_t0-offset+1)/binning)];
2703 if (!error_asymmetry_array)
return nullptr;
2705 for (
int i = 0; i < int((
fLengthHisto-max_t0-offset)/binning); i++) {
2706 if (dummy_1[i] < 0.5 || dummy_2[i] < 0.5 )
2707 error_asymmetry_array[i] = 1.0;
2709 error_asymmetry_array[i] = double(2.) * alpha_param * sqrt(dummy_1[i]*dummy_2[i]*(dummy_1[i]+dummy_2[i])) /
2710 pow(dummy_1[i] + alpha_param * dummy_2[i],2.);
2716 return error_asymmetry_array;
2742 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2743 int lower_bckgrd_minus,
int higher_bckgrd_minus,
int offset)
2747 std::vector<double> error_asymmetry_vector;
2749 if (!
fReadingOk)
return error_asymmetry_vector;
2751 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2752 return error_asymmetry_vector;
2754 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2755 return error_asymmetry_vector;
2757 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2758 return error_asymmetry_vector;
2760 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2761 return error_asymmetry_vector;
2764 higher_bckgrd_plus, binning, offset);
2765 if (dummy_1 ==
nullptr)
return error_asymmetry_vector;
2768 higher_bckgrd_minus, binning, offset);
2769 if (dummy_2 ==
nullptr) {
2771 return error_asymmetry_vector;
2774 for (
int i = 0; i < int((
int(
fLengthHisto)-max_t0-offset)/binning); i++)
2775 error_asymmetry_vector.push_back(0.);
2777 for (
int i = 0; i < int((
int(
fLengthHisto-max_t0-offset))/binning); i++) {
2778 if (dummy_1[i] < 0.5 || dummy_2[i] < 0.5 )
2779 error_asymmetry_vector[i] = 1.0;
2781 error_asymmetry_vector[i] = double(2.) * alpha_param * sqrt(dummy_1[i]*dummy_2[i]*(dummy_1[i]+dummy_2[i])) /
2782 pow(dummy_1[i] + alpha_param * dummy_2[i],2.);
2788 return error_asymmetry_vector;
2816 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2817 int lower_bckgrd_minus,
int higher_bckgrd_minus)
2824 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2827 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2830 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2833 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2837 higher_bckgrd_plus, binning);
2838 if (dummy_1 ==
nullptr)
return nullptr;
2841 higher_bckgrd_minus, binning);
2842 if (dummy_2 ==
nullptr) {
2849 double *asymmetry_goodBins_array =
new double[hsize];
2851 if (!asymmetry_goodBins_array)
return nullptr;
2853 for (
int i = 0; i < hsize; i++) {
2854 asymmetry_goodBins_array[i] = (dummy_1[i+hstart] - alpha_param * dummy_2[i+hstart]) /
2855 (dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart]);
2861 return asymmetry_goodBins_array;
2888 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2889 int lower_bckgrd_minus,
int higher_bckgrd_minus)
2894 std::vector<double> asymmetry_goodBins_vector;
2896 if (!
fReadingOk)
return asymmetry_goodBins_vector;
2898 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2899 return asymmetry_goodBins_vector;
2901 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2902 return asymmetry_goodBins_vector;
2904 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2905 return asymmetry_goodBins_vector;
2907 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2908 return asymmetry_goodBins_vector;
2911 higher_bckgrd_plus, binning);
2912 if (dummy_1 ==
nullptr)
return asymmetry_goodBins_vector;
2915 higher_bckgrd_minus, binning);
2916 if (dummy_2 ==
nullptr) {
2918 return asymmetry_goodBins_vector;
2921 for (
int i = 0; i < hsize; i++)
2922 asymmetry_goodBins_vector.push_back(0.);
2926 for (
int i = 0; i < hsize; i++) {
2927 asymmetry_goodBins_vector[i] = (dummy_1[i+hstart] - alpha_param * dummy_2[i+hstart]) /
2928 (dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart]);
2933 return asymmetry_goodBins_vector;
2960 int binning,
int lower_bckgrd_plus,
int higher_bckgrd_plus,
2961 int lower_bckgrd_minus,
int higher_bckgrd_minus)
2970 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
2973 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
2976 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
2979 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
2983 lower_bckgrd_plus, higher_bckgrd_plus, binning);
2984 if (dummy_1 ==
nullptr)
return nullptr;
2987 lower_bckgrd_minus, higher_bckgrd_minus, binning);
2988 if (dummy_2 ==
nullptr) {
2995 double *error_asymmetry_goodBins_array =
new double[hsize];
2997 if (!error_asymmetry_goodBins_array)
return nullptr;
2999 for (
int i = 0; i < hsize; i++) {
3000 if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 )
3001 error_asymmetry_goodBins_array[i] = 1.0;
3003 error_asymmetry_goodBins_array[i] =
3004 double(2.) * alpha_param * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]
3005 *(dummy_1[i+hstart]+dummy_2[i+hstart])) /
3006 pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.);
3012 return error_asymmetry_goodBins_array;
3042 int histo_num_minus,
double alpha_param,
3043 int binning,
int lower_bckgrd_plus,
3044 int higher_bckgrd_plus,
3045 int lower_bckgrd_minus,
int higher_bckgrd_minus)
3050 std::vector<double> error_asymmetry_goodBins_vector;
3052 if (!
fReadingOk)
return error_asymmetry_goodBins_vector;
3054 if ( histo_num_plus < 0 || histo_num_plus >=
int(
fNumberHisto) || binning <= 0 )
3055 return error_asymmetry_goodBins_vector;
3057 if ( histo_num_minus < 0 || histo_num_minus >=
int(
fNumberHisto) )
3058 return error_asymmetry_goodBins_vector;
3060 if ( lower_bckgrd_plus < 0 || higher_bckgrd_plus >=
int(
fLengthHisto) || lower_bckgrd_plus > higher_bckgrd_plus )
3061 return error_asymmetry_goodBins_vector;
3063 if ( lower_bckgrd_minus < 0 || higher_bckgrd_minus >=
int(
fLengthHisto) || lower_bckgrd_minus > higher_bckgrd_minus )
3064 return error_asymmetry_goodBins_vector;
3067 higher_bckgrd_plus, binning);
3068 if (dummy_1 ==
nullptr)
return error_asymmetry_goodBins_vector;
3071 higher_bckgrd_minus, binning);
3072 if (dummy_2 ==
nullptr) {
3074 return error_asymmetry_goodBins_vector;
3077 for (
int i = 0; i < hsize; i++)
3078 error_asymmetry_goodBins_vector.push_back(0.);
3082 for (
int i = 0; i < hsize; i++) {
3083 if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 )
3084 error_asymmetry_goodBins_vector[i] = 1.0;
3086 error_asymmetry_goodBins_vector[i] = double(2.) * alpha_param
3087 * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]*(dummy_1[i+hstart]+dummy_2[i+hstart])) /
3088 pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.);
3094 return error_asymmetry_goodBins_vector;
3145 scalers_vect[i] =
long(
fScalers[i]);
3147 return scalers_vect;
3168 for (
unsigned int i=0; i<scalerData.size(); i++)
3433 if ((histoNo < 0) || (histoNo >=
MAXHISTO))
3471 if (
static_cast<int>(t0Data.size()) >=
MAXHISTO)
3474 for (
unsigned int i=0; i<t0Data.size(); i++)
3581 int max_lastGood = 0;
3588 return max_lastGood;
3610 return max_lastGood;
3630 return min_lastGood;
3652 return min_lastGood;
3704 std::string strData;
3726 if (sampleStr.size() >= 11)
3729 strcpy(
fSample, sampleStr.c_str());
3743 std::string strData;
3765 if (tempStr.size() >= 11)
3768 strcpy(
fTemp, tempStr.c_str());
3782 std::string strData;
3804 if (orientStr.size() >= 11)
3807 strcpy(
fOrient, orientStr.c_str());
3821 std::string strData;
3843 if (fieldStr.size() >= 11)
3846 strcpy(
fField, fieldStr.c_str());
3860 std::string strData;
3882 if (setupStr.size() >= 11)
3885 strcpy(
fSetup, setupStr.c_str());
3899 std::string strData;
3920 strncpy(
fComment, commentStr.c_str(), 62);
3937 std::string strData{
""};
3965 if (
static_cast<int>(histoName.length()) >=
MAXLABELSIZE)
3982 std::vector<std::string> str_Vector;
3984 std::string strData;
3987 str_Vector.push_back(strData);
4009 if (
static_cast<int>(histoNames.size()) >
fNumberHisto)
4012 for (
unsigned int i=0; i<histoNames.size(); i++) {
4013 if (
static_cast<int>(histoNames[i].length()) >=
MAXLABELSIZE)
4031 std::vector<std::string> str_Vector;
4033 std::string strData;
4036 str_Vector.push_back(strData);
4057 if (
static_cast<int>(scalersName.size()) >
MAXSCALER)
4060 for (
unsigned int i=0; i<scalersName.size(); i++) {
4083 if ((noOfTemps < 0) || (noOfTemps >
MAXTEMPER))
4100 std::vector<double> dbl_Temper;
4103 dbl_Temper.push_back(
double(
fTemper[i]));
4124 if (
static_cast<int>(tempVals.size()) >
MAXTEMPER)
4127 for (
unsigned int i=0; i<tempVals.size(); i++)
4142 std::vector<double> dbl_devTemper;
4148 return dbl_devTemper;
4166 if (
static_cast<int>(devTempVals.size()) >
MAXTEMPER)
4169 for (
unsigned int i=0; i<devTempVals.size(); i++)
4186 std::vector<std::string> timeStart(2);
4212 if (timeStart.size() != 2)
4216 if (timeStart[0].length() > 9)
4220 if (timeStart[1].length() > 8)
4239 std::vector<std::string> timeStop(2);
4265 if (timeStop.size() != 2)
4269 if (timeStop[0].length() > 9)
4273 if (timeStop[1].length() > 8)
4368 std::cout <<
"Filename is " <<
fFilename << std::endl;
4372 std::cout <<
"Format Identifier is " <<
fFormatId << std::endl;
4374 std::cout <<
"Run number is " <<
fNumRun << std::endl;
4375 std::cout <<
"Sample is " <<
fSample << std::endl;
4376 std::cout <<
"Temperature is " <<
fTemp << std::endl;
4377 std::cout <<
"Field is " <<
fField << std::endl;
4378 std::cout <<
"Orientation is " <<
fOrient << std::endl;
4379 std::cout <<
"Comment is " <<
fComment << std::endl;
4381 std::cout <<
"Start Date is " <<
fDateStart << std::endl;
4382 std::cout <<
"Start Time is " <<
fTimeStart << std::endl;
4384 std::cout <<
"End Date is " <<
fDateStop << std::endl;
4385 std::cout <<
"End Time is " <<
fTimeStop << std::endl;
4387 std::cout <<
"Bin width is " <<
fBinWidth <<
" [usec]" << std::endl;
4388 std::cout <<
"Number of histograms is " <<
fNumberHisto << std::endl;
4389 std::cout <<
"Histogram length is " <<
fLengthHisto << std::endl;
4391 std::cout <<
"Total number of events is " <<
fTotalEvents << std::endl;
4394 std::cout <<
"Histogram " << i <<
" Name is >" <<
fLabelsHisto[i]
4396 std::cout <<
" real t0 is " <<
fRealT0[i] << std::endl;
4397 std::cout <<
" t0 is " <<
fIntegerT0[i] << std::endl;
4398 std::cout <<
" first good bin is " <<
fFirstGood[i] << std::endl;
4399 std::cout <<
" last good bin is " <<
fLastGood[i] << std::endl;
4402 std::cout <<
"Number of scalers is " <<
fNumberScaler << std::endl;
4405 <<
"< Value is " <<
fScalers[i] << std::endl;
4408 std::cout <<
"Number of temperatures is " <<
fNumberTemper << std::endl;
4410 std::cout <<
"Temperature " << i <<
" is " <<
fTemper[i]
struct _pTATDC32SettingsRec * pTATDC32SettingsPtr
struct _pTAStatisticRec pTAStatisticRec
struct _pTATagRec * pTATagPtr
struct _FeFileHeaderRec * FeFileHeaderPtr
struct _pTASettingsRec * pTASettingsPtr
struct _pTATDCStatisticRec pTATDCStatisticRec
struct _pTASettingsRec pTASettingsRec
struct _pTATDCSettingsRec * pTATDCSettingsPtr
struct _pTATDCStatisticRec * pTATDCStatisticPtr
struct _pTAStatisticRec * pTAStatisticPtr
struct _pTAFileHeaderRec * pTAFileHeaderPtr
struct _pTATagRec pTATagRec
struct _FeFileHeaderRec FeFileHeaderRec
struct _pTATDC32SettingsRec pTATDC32SettingsRec
struct _pTATDCSettingsRec pTATDCSettingsRec
struct _pTATDC32StatisticRec * pTATDC32StatisticPtr
struct _pTATDC32StatisticRec pTATDC32StatisticRec
struct _pTAFileHeaderRec pTAFileHeaderRec
int Write(const char *fileName)
Method to write a PSI-bin or an MDU file.
double GetBinWidthPicoSec()
Method returning a double representing the bin-width in picoseconds.
std::string GetOrient()
Method returning a string containing the orientation specified in the title.
std::vector< double > GetHistoArray(int histo_num, int binning)
Method to obtain an array of type double containing the values of the histogram <histo_num> with binn...
int GetT0Int(int i)
Method returning an integer representing the t0 point (from the "integer" t0 in the header) for a spe...
int PutDevTemperaturesVector(std::vector< double > &devTemps)
Method setting a vector of doubles containing standard deviations of the monitored values (usually te...
int PutNameHisto(std::string histoName, int i)
Method setting a string containing the name of the histogram <i>
int PutT0Vector(std::vector< int > &t0Data)
Method setting a vector of integer containing the t0 values of the histograms specified in the header...
int GetMinT0Int()
Method to determine the minimum value of the t0 bins.
double * 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=0, double y_offset=0.)
Method to obtain an array of double containing the values of the asymmetry between 2 histograms.
int GetLastGoodInt(int i)
Method returning an integer representing the last good bin specified in the header for a specified hi...
std::vector< double > GetHistoFromT0MinusBkgVector(int histo_num, int lower_bckgdr, int higher_bckgdr, int binning, int offset=0)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
std::vector< int > GetT0Vector()
Method returning a vector of integer containing the t0 values of the histograms specified in the head...
std::string GetNameHisto(int i)
Method returning a string containing the name of the histogram <i>
int PutNumberTemperatureInt(int noOfTemps)
Method setting an integer representing the number of temperatures.
std::vector< double > GetHistoGoodBinsVector(int histo_num, int binning)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
int PutFirstGoodInt(int i, int j)
Method setting an integer representing the first good bin specified in the header for a specified his...
int PutTemp(std::string temp)
Method setting a string containing the fSample temperature.
bool WritingOK() const
Method to obtain if writing and processing of the data file was OK.
bool CheckDataConsistency(int tag=0)
Check if a given set of data is consistent with the PSI-BIN limitations. If false,...
int PutSample(std::string sample)
Method setting a string containing the fSample name.
std::vector< double > GetTemperaturesVector()
Method returning a vector of doubles containing monitored values (usually temperatures)
~MuSR_td_PSI_bin()
Simple Destructor clearing some pointers and variables.
std::vector< std::string > GetHistoNamesVector()
Method returning a vector of strings containing the names of the histograms.
std::vector< double > 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=0)
Method to obtain a vector of double containing the values of the error of the asymmetry between 2 his...
std::vector< int > GetLastGoodVector()
Method returning a vector of integer containing the last good bin values of the histograms specified ...
double * GetHistoGoodBinsMinusBkgArray(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning)
Method to obtain an array of type double containing the values of the histogram <histo_num> with binn...
std::vector< int > GetHistoArrayInt(int histo_num)
Method to obtain an array of type integer containing the values of the histogram <histo_num>
int GetMax2T0Int(int k, int j)
Method to determine the maximum value of the last good bins of 2 histograms.
int PutT0Int(int histoNo, int t0)
Method setting an integer representing the t0 point (from the "integer" t0 in the header) for a speci...
char fLabelsScalers[MAXSCALER][MAXLABELSIZE]
int PutScalersNamesVector(std::vector< std::string > scalersName)
Method setting a vector of strings containing the names of the scalers.
double GetT0Double(int i)
Method returning a double representing the t0 point (from the "real" t0 in the header) for a specifie...
std::string ConsistencyStatus() const
Method to obtain error/success information on data consistency check.
int Clear()
Method to clear member variables before using instance for next read.
char fLabelsHisto[MAXHISTO][MAXLABELSIZE]
std::string GetField()
Method returning a string containing the field specified in the title.
std::vector< long > GetScalersVector()
Method providing a vector of long containing the values of the scalers.
double GetBinWidthMicroSec()
Method returning a double representing the bin-width in microseconds.
std::vector< std::vector< double > > fHistosVector
double * GetHistoFromT0Array(int histo_num, int binning, int offset=0)
Method to obtain an array of type double containing the values of the histogram <histo_num> with binn...
int PutField(std::string field)
Method setting a string containing the field.
int GetMin2T0Int(int k, int j)
Method to determine the minimum value of the last good bins of 2 histograms.
void PutBinWidthPicoSec(double binWidth)
Method setting a double representing the bin-width in picoseconds.
std::string Filename() const
Method to obtain the file name.
std::vector< double > 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.)
Method to obtain a vector of double containing the values of the asymmetry between 2 histograms.
int PutComment(std::string comment)
Method setting a string containing the comment.
int ReadMdu(const char *fileName)
Method to read a MuSR MDU file.
int WriteBin(const char *fileName)
Method to write a PSI-bin file.
int GetMin2LastGoodInt(int k, int j)
Method to determine the minimum value of the last good bins of 2 histograms.
std::string GetTemp()
Method returning a string containing the temperature specified in the title.
int GetMinLastGoodInt()
Method providing the minimum value of the last good bins.
int Show() const
Method to show current values of member variables.
int ReadBin(const char *fileName)
Method to read a PSI-bin file.
std::vector< std::string > GetTimeStartVector()
Method returning a vector of strings containing 1) the date when the run was started and 2) the time ...
std::vector< double > GetHistoFromT0Vector(int histo_num, int binning, int offset=0)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
int PutHistoArrayInt(std::vector< std::vector< int > > &histo, int tag=0)
Method to set the histograms which is a vector of vector of int's (histogram). There are two differen...
void PutBinWidthMicroSec(double binWidth)
Method setting a double representing the bin-width in microseconds.
std::vector< int > GetFirstGoodVector()
Method returning a vector of integer containing the first good bin values of the histograms specified...
double * GetHistoGoodBinsArray(int histo_num, int binning)
Method to obtain an array of type double containing the values of the histogram <histo_num> with binn...
int PutLastGoodInt(int i, int j)
Method to modify the last good bin (value <j>) of the histogram <i>
int PutScalersVector(std::vector< int > scalerData)
Method set a vector of long containing the values of the scalers.
long GetEventsHistoLong(int i)
Method returning a long representing the number of events in a specified histograms.
std::vector< std::string > GetScalersNamesVector()
Method returning a vector of strings containing the names of the scalers.
std::vector< std::string > GetTimeStopVector()
Method returning a vector of strings containing 1) the date when the run was stopped and 2) the time ...
void PutBinWidthNanoSec(double binWidth)
Method setting a double representing the bin-width in nanoseconds.
std::vector< double > GetDevTemperaturesVector()
Method returning a vector of doubles containing standard deviations of the monitored values (usually ...
int GetMax2LastGoodInt(int k, int j)
Method to determine the maximum value of the "last good bins" of 2 histograms.
std::string WriteStatus() const
Method to obtain error/success information after writing.
std::string fConsistencyStatus
int PutTimeStartVector(std::vector< std::string > timeStart)
Method setting a vector of strings containing 1) the date when the run was started and 2) the time wh...
double * 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)
Method to obtain an array of double containing the values of the error of the asymmetry between 2 his...
std::vector< double > GetHistoVectorNo0(int histo_num, int binning)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
double GetBinWidthNanoSec()
Method returning a double representing the bin-width in nanoseconds.
int PutHistoNamesVector(std::vector< std::string > &histoNames)
Method setting a vector containing the names of all the histograms.
int PutRunNumberInt(int i)
Method to modify the run number (value <i>)
std::string ReadStatus() const
Method to obtain error/success information after reading.
std::vector< double > 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)
Method to obtain a vector of double containing the values of the error of the asymmetry between 2 his...
std::vector< double > GetHistoGoodBinsMinusBkgVector(int histo_num, int lower_bckgrd, int higher_bckgrd, int binning)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
int Read(const char *fileName)
Method to read a PSI-bin or an MDU file.
int GetMaxT0Int()
Method to determine the maximum value of the t0 bins.
double * 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)
Method to obtain an array of double containing the values of the asymmetry between 2 histograms.
int PutSetup(std::string setup)
Method setting a string containing the setup.
int GetNumberScalerInt()
Method returning an integer representing the number of histograms.
int PutNumberScalerInt(int val)
Method seting the number of scalers present.
double GetHisto(int histo_num, int j)
Method to return the value of a single bin as double.
int GetMaxLastGoodInt()
Method returning an integer containing the maximum value of the "last good bins" of all histograms.
bool ReadingOK() const
Method to obtain if reading and processing of the data file was OK.
std::string GetSample()
Method returning a string containing the fSample name.
int GetFirstGoodInt(int i)
Method returning an integer representing the first good bin specified in the header for a specified h...
int GetDefaultBinning()
Method returning an integer representing the default binning.
std::vector< std::vector< int > > fHisto
float fTempDeviation[MAXTEMPER]
int GetHistoInt(int histo_num, int j)
Method to return the value of a single bin as integer.
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)
Method to obtain an array of double containing the values of the error of the asymmetry between 2 his...
double * GetHistoFromT0MinusBkgArray(int histo_num, int lower_bckgdr, int higher_bckgdr, int binning, int offset=0)
Method to obtain an array of type double containing the values of the histogram <histo_num> with binn...
std::vector< double > GetHistoVector(int histo_num, int binning)
Method to obtain a vector of double containing the values of the histogram <histo_num> with binning <...
std::string GetComment()
Method returning a string containing the comment specified in the title.
std::string GetSetup()
Method returning a string containing the setup.
int PutTemperaturesVector(std::vector< double > &temps)
Method setting a vector of doubles containing monitored values (usually temperatures)
std::vector< double > 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)
Method to obtain a vector of double containing the values of the asymmetry between 2 histograms.
int PutOrient(std::string orientation)
Method setting a string containing the fSample orientation.
int WriteMdu(const char *fileName)
Method to write a MuSR MDU file.
int fEventsPerHisto[MAXHISTO]
std::vector< long > GetEventsHistoVector()
Method returning a vector of long containing the number of events in the histograms.
MuSR_td_PSI_bin()
Simple Constructor setting some pointers and variables.
int PutTimeStopVector(std::vector< std::string > timeStop)
Method setting a vector of strings containing 1) the date when the run was started and 2) the time wh...
pTATagRec tag[PTAMAXTAGS]
Int32 HistogramScaler[PTAMAXTAGS]
Int32 TagScaler[PTAMAXTAGS]
pTATagRec tag[TDCMAXTAGS32]
Int32 HistogramScaler[TDCMAXTAGS32]
Int32 TagScaler[TDCMAXTAGS32]
pTATagRec tag[TDCMAXTAGS16]
Int32 HistogramScaler[TDCMAXTAGS16]
Int32 TagScaler[TDCMAXTAGS16]