added default background estimate if not present. Update the PSIBIN/MDU class from AA/AR.

This commit is contained in:
nemu 2009-12-09 08:03:51 +00:00
parent 76cc302e78
commit 0e5d18160c
5 changed files with 252 additions and 166 deletions

View File

@ -1988,32 +1988,6 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines)
param.CleanUp(); param.CleanUp();
} }
// check if for fittypes: single histo, asymmetry, RRF any background info is given
for (UInt_t i=0; i<fRuns.size(); i++) {
if ((fRuns[i].GetFitType() == MSR_FITTYPE_SINGLE_HISTO) ||
(fRuns[i].GetFitType() == MSR_FITTYPE_ASYM) ||
(fRuns[i].GetFitType() == MSR_FITTYPE_ASYM_RRF)) {
Bool_t found;
if (fRuns[i].GetBkgFitParamNo() >= 0) { // check if backgr.fit is given
found = true;
} else if (fRuns[i].GetBkgFixSize() > 0) { // check if backgr.fix is given
found = true;
} else if (fRuns[i].GetBkgRangeSize() > 0) { // check if background window is given
found = true;
} else {
found = false;
}
if (!found) {
cerr << endl << ">> PMsrHandler::HandleRunEntry: **ERROR** for run " << fRuns[i].GetRunName()->Data() << ", forward " << fRuns[i].GetForwardHistoNo();
cerr << endl << " no background information found!";
cerr << endl << " Either of the tags 'backgr.fit', 'backgr.fix', 'background'";
cerr << endl << " with data is needed.";
cerr << endl;
return false;
}
}
}
return !error; return !error;
} }

View File

@ -454,10 +454,19 @@ Bool_t PRunAsymmetry::PrepareData()
if (fRunInfo->GetBkgRangeSize() != 0) { if (fRunInfo->GetBkgRangeSize() != 0) {
if (!SubtractEstimatedBkg()) if (!SubtractEstimatedBkg())
return false; return false;
} else { // no background given to do the job } else { // no background given to do the job, try to estimate it
cerr << endl << "PRunAsymmetry::PrepareData(): **ERROR** Neither fix background nor background bins are given!"; fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
cerr << endl << "One of the two is needed! Will quit ..."; fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
return false; fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.1), 2);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[1]*0.6), 3);
cerr << endl << "PRunAsymmetry::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following:";
cerr << endl << "forward: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "backward: bkg start = " << fRunInfo->GetBkgRange(2) << ", bkg end = " << fRunInfo->GetBkgRange(3);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!SubtractEstimatedBkg())
return false;
} }
} else { // fixed background given } else { // fixed background given
if (!SubtractFixBkg()) if (!SubtractFixBkg())

View File

@ -500,11 +500,15 @@ Bool_t PRunSingleHisto::PrepareFitData(PRawRunData* runData, const UInt_t histoN
if (fRunInfo->GetBkgRangeSize() != 0) { if (fRunInfo->GetBkgRangeSize() != 0) {
if (!EstimateBkg(histoNo)) if (!EstimateBkg(histoNo))
return false; return false;
} else { // no background given to do the job } else { // no background given to do the job, try estimate
cerr << endl << "PRunSingleHisto::PrepareData(): **ERROR** Neither fix background nor background bins are given!"; fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
cerr << endl << "One of the two is needed! Will quit ..."; fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareFitData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl; cerr << endl;
return false; if (!EstimateBkg(histoNo))
return false;
} }
} }
} }
@ -678,8 +682,19 @@ cout << endl << ">> data start time = " << fData.GetDataTimeStart();
Double_t bkg; Double_t bkg;
if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted
if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval) if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval)
if (!EstimateBkg(histoNo)) if (fRunInfo->GetBkgRangeSize() != 0) { // background range given
return false; if (!EstimateBkg(histoNo))
return false;
} else { // no background given to do the job, try estimate
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!EstimateBkg(histoNo))
return false;
}
bkg = fBackground; bkg = fBackground;
} else { // fixed bkg given } else { // fixed bkg given
bkg = fRunInfo->GetBkgFix(0); bkg = fRunInfo->GetBkgFix(0);
@ -812,8 +827,19 @@ Bool_t PRunSingleHisto::PrepareViewData(PRawRunData* runData, const UInt_t histo
Double_t bkg; Double_t bkg;
if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted if (fRunInfo->GetBkgFitParamNo() == -1) { // bkg not fitted
if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval) if (fRunInfo->GetBkgFixSize() == 0) { // no fixed background given (background interval)
if (!EstimateBkg(histoNo)) if (fRunInfo->GetBkgRangeSize() != 0) { // background range given
return false; if (!EstimateBkg(histoNo))
return false;
} else { // no background given to do the job, try estimate
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.1), 0);
fRunInfo->SetBkgRange(static_cast<Int_t>(fT0s[0]*0.6), 1);
cerr << endl << "PRunSingleHisto::PrepareData(): **WARNING** Neither fix background nor background bins are given!";
cerr << endl << "Will try the following: bkg start = " << fRunInfo->GetBkgRange(0) << ", bkg end = " << fRunInfo->GetBkgRange(1);
cerr << endl << "NO WARRANTY THAT THIS MAKES ANY SENSE! Better check ...";
cerr << endl;
if (!EstimateBkg(histoNo))
return false;
}
bkg = fBackground; bkg = fBackground;
} else { // fixed bkg given } else { // fixed bkg given
bkg = fRunInfo->GetBkgFix(0); bkg = fRunInfo->GetBkgFix(0);

View File

@ -78,7 +78,8 @@ using namespace std ;
* - 5 if the number of histograms is less than 1 * - 5 if the number of histograms is less than 1
* - 6 if reading data failed * - 6 if reading data failed
* *
* The parameter of the method is a const char * representing the name of the file to be open. * The parameter of the method is a const char * representing the name of the file to
* be opened.
*/ */
int MuSR_td_PSI_bin::read(const char * fileName) int MuSR_td_PSI_bin::read(const char * fileName)
@ -143,20 +144,6 @@ using namespace std ;
//Implementation readbin //Implementation readbin
//******************************* //*******************************
/*! \brief Method to read a PSI-bin file
*
* This method gives back:
* - 0 for succesful reading
* - 1 if the open file action or the reading of the header failed
* - 2 for an unsupported version of the data
* - 3 for an error when allocating data buffer
* - 4 if number of histograms per record not equals 1
* - 5 if the number of histograms is less than 1
* - 6 if reading data failed
*
* The parameter of the method is a const char * representing the name of the file to be open.
*/
/* -- type definitions taken from tydefs.h -- */ /* -- type definitions taken from tydefs.h -- */
#if ((defined(__DECC) || defined(__VAXC)) && !defined(unix) && !defined(OS_OSF1)) #if ((defined(__DECC) || defined(__VAXC)) && !defined(unix) && !defined(OS_OSF1))
@ -197,6 +184,21 @@ typedef float Float32;
/* ----------------------------------------- */ /* ----------------------------------------- */
/*! \brief Method to read a PSI-bin file
*
* This method gives back:
* - 0 for succesful reading
* - 1 if the open file action or the reading of the header failed
* - 2 for an unsupported version of the data
* - 3 for an error when allocating data buffer
* - 4 if number of histograms per record not equals 1
* - 5 if the number of histograms is less than 1
* - 6 if reading data failed
*
* The parameter of the method is a const char * representing the name of the file to
* be opened.
*/
int MuSR_td_PSI_bin::readbin(const char * fileName) int MuSR_td_PSI_bin::readbin(const char * fileName)
{ {
ifstream file_name ; ifstream file_name ;
@ -264,7 +266,7 @@ typedef float Float32;
readstatus = "ERROR Reading "+filename+" header failed!"; readstatus = "ERROR Reading "+filename+" header failed!";
return 1; // ERROR reading header failed return 1; // ERROR reading header failed
} }
// fill header data into member variables // fill header data into member variables
strncpy(format_id,buffer_file,2); strncpy(format_id,buffer_file,2);
format_id[2] = '\0' ; format_id[2] = '\0' ;
@ -511,19 +513,6 @@ typedef float Float32;
//Implementation readmdu //Implementation readmdu
//******************************* //*******************************
/*! \brief Method to read a MuSR MDU file
*
* This method gives back:
* - 0 for succesful reading
* - 1 if the open file action or the reading of the header failed
* - 2 for an unsupported version of the data
* - 3 for an error when allocating data buffer
* - 5 if the number of histograms is less than 1
* - 6 if reading data failed
*
* The parameter of the method is a const char * representing the name of the file to be open.
*/
#define DATESTR 12 /* Length of date string 01-NOV-1999 */ #define DATESTR 12 /* Length of date string 01-NOV-1999 */
#define TIMESTR 9 /* Length of time string 08:45:30 */ #define TIMESTR 9 /* Length of time string 08:45:30 */
@ -597,14 +586,14 @@ typedef struct _FeFileHeaderRec {
/* information for automatic data conversion */ /* information for automatic data conversion */
char RunTitle[TITLESTR+1]; char RunTitle[TITLESTR+1];
char RunSubTitle[SUBTITLESTR+1]; char RunSubTitle[SUBTITLESTR+1];
char DataFormat[DATAFORMATSTR]; 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 // or pTA timespan
Int32 BinOffset; Int32 BinOffset;
Int32 BinsPerHistogram; Int32 BinsPerHistogram;
Int32 NumberOfDetectors; Int32 NumberOfDetectors;
char DetectorNumberList[DETECTLISTSTR]; char DetectorNumberList[DETECTLISTSTR]; // list of detectors to be converted
// to the target data format
/* additional information */ /* additional information */
char MeanTemp[TEMPLISTSTR]; char MeanTemp[TEMPLISTSTR];
char TempDev[TEMPLISTSTR]; char TempDev[TEMPLISTSTR];
@ -769,6 +758,20 @@ typedef struct _pTATDC32StatisticRec {
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */
/*! \brief Method to read a MuSR MDU file
*
* This method gives back:
* - 0 for succesful reading
* - 1 if the open file action or the reading of the header failed
* - 2 for an unsupported version of the data
* - 3 for an error when allocating data buffer
* - 5 if the number of histograms is less than 1
* - 6 if reading data failed
*
* The parameter of the method is a const char * representing the name of the
* file to be opened.
*/
int MuSR_td_PSI_bin::readmdu(const char * fileName) int MuSR_td_PSI_bin::readmdu(const char * fileName)
{ {
ifstream file_name ; ifstream file_name ;
@ -778,7 +781,7 @@ typedef struct _pTATDC32StatisticRec {
if (sizeof(Int32) != 4) if (sizeof(Int32) != 4)
{ {
readstatus = "ERROR Sizeof Int32 data type is not 4 bytes"; readstatus = "ERROR Sizeof( Int32 ) data type is not 4 bytes";
return 1; // ERROR open failed return 1; // ERROR open failed
} }
@ -792,7 +795,7 @@ typedef struct _pTATDC32StatisticRec {
} }
pTAFileHeaderRec gpTAfhead; pTAFileHeaderRec gpTAfhead;
FeFileHeaderPtr gpFehead = &gpTAfhead.Header; //FeFileHeaderPtr gpFehead = &gpTAfhead.Header;
file_name.read((char *)&gpTAfhead, sizeof gpTAfhead) ; // read header into buffer file_name.read((char *)&gpTAfhead, sizeof gpTAfhead) ; // read header into buffer
if (file_name.fail()) if (file_name.fail())
@ -801,7 +804,7 @@ typedef struct _pTATDC32StatisticRec {
readstatus = "ERROR Reading "+filename+" header failed!"; readstatus = "ERROR Reading "+filename+" header failed!";
return 1; // ERROR reading header failed return 1; // ERROR reading header failed
} }
// fill header data into member variables // fill header data into member variables
format_id[0] = gpTAfhead.Header.FmtId; format_id[0] = gpTAfhead.Header.FmtId;
format_id[1] = gpTAfhead.Header.FmtVersion; format_id[1] = gpTAfhead.Header.FmtVersion;
format_id[2] = '\0' ; format_id[2] = '\0' ;
@ -895,12 +898,13 @@ typedef struct _pTATDC32StatisticRec {
#endif #endif
// process detector list in gpTAfhead.Header.NumberOfDetectors // process detector list in gpTAfhead.Header.NumberOfDetectors
// for pTA only histograms of selected detectors are valid
bool selected[MAXHISTO]; bool selected[MAXHISTO];
for (i=0; i < MAXHISTO; i++) for (i=0; i < MAXHISTO; i++)
selected[i] = false; selected[i] = false;
for (i=0,j=0; i <= strlen(gpTAfhead.Header.DetectorNumberList); i++) { for (i=0,j=0; i <= (int)strlen(gpTAfhead.Header.DetectorNumberList); i++) {
if ((gpTAfhead.Header.DetectorNumberList[i] == ' ') || if ((gpTAfhead.Header.DetectorNumberList[i] == ' ') ||
(gpTAfhead.Header.DetectorNumberList[i] == '\0')) { (gpTAfhead.Header.DetectorNumberList[i] == '\0')) {
int it; int it;
@ -947,7 +951,7 @@ typedef struct _pTATDC32StatisticRec {
tothist = PTAMAXTAGS; tothist = PTAMAXTAGS;
file_name.read((char *)&gpTAsetpta, sizeof gpTAsetpta) ; // read settings into buffer file_name.read((char *)&gpTAsetpta, sizeof gpTAsetpta);//read settings into buffer
if (file_name.fail()) if (file_name.fail())
{ {
file_name.close(); file_name.close();
@ -955,7 +959,8 @@ typedef struct _pTATDC32StatisticRec {
return 1; // ERROR reading settings failed return 1; // ERROR reading settings failed
} }
file_name.read((char *)&gpTAstattotpta, sizeof gpTAstattotpta) ; // read stat into buffer // read stat into buffer
file_name.read((char *)&gpTAstattotpta, sizeof gpTAstattotpta) ;
if (file_name.fail()) if (file_name.fail())
{ {
file_name.close(); file_name.close();
@ -1033,7 +1038,7 @@ typedef struct _pTATDC32StatisticRec {
if ((nbins=(gpTAsetpta.tag[i].Histomaxb-gpTAsetpta.tag[i].Histominb + 1))>1) if ((nbins=(gpTAsetpta.tag[i].Histomaxb-gpTAsetpta.tag[i].Histominb + 1))>1)
{ {
// for pTA only take histogram if histogram was selected // for pTA only: read histogram only if histogram was selected
if (selected[i]) if (selected[i])
{ {
// first histo -> take histogram length // first histo -> take histogram length
@ -1081,7 +1086,7 @@ typedef struct _pTATDC32StatisticRec {
tothist = TDCMAXTAGS16; tothist = TDCMAXTAGS16;
file_name.read((char *)&gpTAsettdc, sizeof gpTAsettdc) ; // read settings into buffer file_name.read((char *)&gpTAsettdc, sizeof gpTAsettdc);//read settings into buffer
if (file_name.fail()) if (file_name.fail())
{ {
file_name.close(); file_name.close();
@ -1174,7 +1179,8 @@ typedef struct _pTATDC32StatisticRec {
tothist = TDCMAXTAGS32; tothist = TDCMAXTAGS32;
file_name.read((char *)&gpTAsettdc32, sizeof gpTAsettdc32) ; // read settings into buffer // read settings into buffer
file_name.read((char *)&gpTAsettdc32, sizeof gpTAsettdc32) ;
if (file_name.fail()) if (file_name.fail())
{ {
file_name.close(); file_name.close();
@ -1182,7 +1188,8 @@ typedef struct _pTATDC32StatisticRec {
return 1; // ERROR reading settings failed return 1; // ERROR reading settings failed
} }
file_name.read((char *)&gpTAstattottdc32, sizeof gpTAstattottdc32) ; // read stat into buffer // read stat into buffer
file_name.read((char *)&gpTAstattottdc32, sizeof gpTAstattottdc32) ;
if (file_name.fail()) if (file_name.fail())
{ {
file_name.close(); file_name.close();
@ -1228,7 +1235,7 @@ typedef struct _pTATDC32StatisticRec {
cout << "Tag[" << i << "] Histomin = " << gpTAsettdc32.tag[i].Histominb cout << "Tag[" << i << "] Histomin = " << gpTAsettdc32.tag[i].Histominb
<< " Histomax = " << gpTAsettdc32.tag[i].Histomaxb << endl; << " Histomax = " << gpTAsettdc32.tag[i].Histomaxb << endl;
#endif #endif
// is a histogram there // is a histogram there?
if ((nbins=(gpTAsettdc32.tag[i].Histomaxb-gpTAsettdc32.tag[i].Histominb + 1)) if ((nbins=(gpTAsettdc32.tag[i].Histomaxb-gpTAsettdc32.tag[i].Histominb + 1))
>1) >1)
{ {
@ -1336,7 +1343,7 @@ typedef struct _pTATDC32StatisticRec {
cout << "Tag[" << i << "] " << tag.Label << " : Histomin = " << tag.Histominb cout << "Tag[" << i << "] " << tag.Label << " : Histomin = " << tag.Histominb
<< " Histomax = " << tag.Histomaxb << endl; << " Histomax = " << tag.Histomaxb << endl;
#endif #endif
// is a histogram there // is a histogram there?
if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1) if ((nbins=(tag.Histomaxb-tag.Histominb + 1))>1)
{ {
if (thist == NULL) thist = new Int32[nbins]; if (thist == NULL) thist = new Int32[nbins];
@ -1358,7 +1365,7 @@ typedef struct _pTATDC32StatisticRec {
return 6; // ERROR reading hist failed return 6; // ERROR reading hist failed
} }
// for pTA only take histogram if histogram was selected // for pTA only: use histogram only, if histogram was selected
// else take all histos but mark not selected // else take all histos but mark not selected
if (selected[i] || (strcmp(format_id,"M3") != 0)) if (selected[i] || (strcmp(format_id,"M3") != 0))
{ {
@ -1368,20 +1375,21 @@ typedef struct _pTATDC32StatisticRec {
dummy_vector.clear() ; dummy_vector.clear() ;
strncpy(labels_histo[ihist],tag.Label,MAXLABELSIZE) ; strncpy(labels_histo[ihist],tag.Label,MAXLABELSIZE) ;
labels_histo[ihist][MAXLABELSIZE] = '\0' ; labels_histo[ihist][MAXLABELSIZE-1] = '\0' ;
// mark with ** when not selected // mark with ** when not selected
if (!selected[i] && (strlen(labels_histo[ihist])<MAXLABELSIZE-2)) if (!selected[i] && (strlen(labels_histo[ihist])<MAXLABELSIZE-2))
strcat(labels_histo[ihist],"**"); strcat(labels_histo[ihist],"**");
// calculate t0, fg, lg for "raw" TDC /pTA // calculate t0, fg, lg for "raw" TDC /pTA actually specified for binned
// taking largest bin value for t0 and fg // histograms
// taking largest possible bin value for t0 and fg
integer_t0[ihist] = (tag.t0b+1)*resolutionfactor -1; integer_t0[ihist] = (tag.t0b+1)*resolutionfactor -1;
first_good[ihist] = (tag.tfb+1)*resolutionfactor -1; first_good[ihist] = (tag.tfb+1)*resolutionfactor -1;
last_good[ihist] = tag.tlb*resolutionfactor ; last_good[ihist] = tag.tlb*resolutionfactor ;
// store histogram // store histogram
// if non zero offset init // in case of non zero offset init
for (j=0; j<tag.Histominb; j++) for (j=0; j<tag.Histominb; j++)
{ {
histo[ihist][j]= 0; histo[ihist][j]= 0;
@ -1423,7 +1431,7 @@ typedef struct _pTATDC32StatisticRec {
//Implementation readingOK //Implementation readingOK
//******************************* //*******************************
/*! \brief Method to obtain if reading and processing of file was OK /*! \brief Method to obtain if reading and processing of the data file was OK.
* *
* This method gives back: * This method gives back:
* - true if reading was OK * - true if reading was OK
@ -1437,7 +1445,7 @@ bool MuSR_td_PSI_bin::readingOK() const {
//Implementation ReadStatus //Implementation ReadStatus
//******************************* //*******************************
/*! \brief Method to obtain error/success information after reading /*! \brief Method to obtain error/success information after reading.
* *
* This method gives back: * This method gives back:
* - "SUCCESS" if reading was OK * - "SUCCESS" if reading was OK
@ -1451,7 +1459,7 @@ string MuSR_td_PSI_bin::ReadStatus() const {
//Implementation Filename //Implementation Filename
//******************************* //*******************************
/*! \brief Method to obtain file name /*! \brief Method to obtain the file name.
* *
* This method gives back: * This method gives back:
* - <filename> * - <filename>
@ -1464,7 +1472,7 @@ string MuSR_td_PSI_bin::Filename() const {
//Implementation get_histo_int //Implementation get_histo_int
//******************************* //*******************************
/*! \brief Method to value of a single bin /*! \brief Method to return the value of a single bin as integer.
* *
* This method gives back: * This method gives back:
* - bin value as int * - bin value as int
@ -1486,7 +1494,7 @@ int MuSR_td_PSI_bin::get_histo_int(int histo_num, int j) {
//Implementation get_histo //Implementation get_histo
//******************************* //*******************************
/*! \brief Method to value of a single bin /*! \brief Method to return the value of a single bin as double.
* *
* This method gives back: * This method gives back:
* - bin value as double * - bin value as double
@ -1508,14 +1516,16 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_array //Implementation get_histo_array
//******************************* //*******************************
/*! \brief Method to obtain an array of type double containing the values of the histogram \<histo_num\> with binning \<binning\> /*! \brief Method to obtain an array of type double containing the values of the
histogram \<histo_num\> with binning \<binning\>
* *
* This method gives back: * This method gives back:
* - an pointer of a double array * - an pointer of a double array
* - the NULL pointer if an invalid histogram number or binning is choosen or * - the NULL pointer if an invalid histogram number or binning is choosen or
* allocation failed * allocation failed
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<binning\>
representing the desired histogram number and binning.
*/ */
double * MuSR_td_PSI_bin::get_histo_array(int histo_num , int binning) double * MuSR_td_PSI_bin::get_histo_array(int histo_num , int binning)
@ -1544,13 +1554,15 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_vector //Implementation get_histo_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> /*! \brief Method to obtain a vector of double containing the values of the histogram
\<histo_num\> with binning \<binning\>
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
* - an empty vector of double if an invalid number or binning is choosen * - an empty vector of double if an invalid number or binning is choosen
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<binning\>
representing the desired histogram number and binning.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_vector(int histo_num , int binning) vector<double> MuSR_td_PSI_bin::get_histo_vector(int histo_num , int binning)
@ -1579,13 +1591,16 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_vector_no0 //Implementation get_histo_vector_no0
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> but where the bins with zero counts are replaced by a count 0.1 /*! \brief Method to obtain a vector of double containing the values of the
* histogram \<histo_num\> with binning \<binning\> but where the bins with
* zero counts are replaced by a count 0.1
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
* - an empty vector of double if an invalid number or binning is choosen * - an empty vector of double if an invalid number or binning is choosen
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<binning\>
* representing the desired histogram number and binning.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_vector_no0(int histo_num , int binning) vector<double> MuSR_td_PSI_bin::get_histo_vector_no0(int histo_num , int binning)
@ -1619,13 +1634,15 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_array_int //Implementation get_histo_array_int
//********************************** //**********************************
/*! \brief Method to obtain an array of type integer containing the values of the histogram \<histo_num\> /*! \brief Method to obtain an array of type integer containing the values of the
* histogram \<histo_num\>
* *
* This method gives back: * This method gives back:
* - an pointer of a integer array * - an pointer of an integer array
* - the NULL pointer if an invalid histogram number is choosen or allocate failed * - the NULL pointer if an invalid histogram number is choosen or allocate failed
* *
* The parameter of the method is the integer \<histo_num\> representing the desired histogram number. * The parameter of the method is the integer \<histo_num\> representing the desired
* histogram number.
*/ */
int * MuSR_td_PSI_bin::get_histo_array_int(int histo_num) int * MuSR_td_PSI_bin::get_histo_array_int(int histo_num)
@ -1633,7 +1650,7 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
if (!readingok) return NULL; if (!readingok) return NULL;
if ( histo_num < 0 || histo_num >= int(number_histo)) if ( histo_num < 0 || histo_num >= int(number_histo))
return NULL ; return NULL ;
int *histo_array = new int[length_histo] ; int *histo_array = new int[length_histo] ;
@ -1652,14 +1669,17 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_fromt0_array //Implementation get_histo_fromt0_array
//******************************* //*******************************
/*! \brief Method to obtain an array of type double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point t0. An \<offset\> can also be specified (otherwise = 0). /*! \brief Method to obtain an array of type double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point t0. An \<offset\>
* can also be specified (otherwise = 0).
* *
* This method gives back: * This method gives back:
* - an pointer of a double array * - a pointer of a double array
* - the NULL pointer if an invalid histogram number or binning is choosen or * - the NULL pointer if an invalid histogram number or binning is choosen or
* allocation failed * allocation failed
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<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::get_histo_fromt0_array(int histo_num , int binning , int offset)
@ -1669,7 +1689,8 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 )
return NULL ; return NULL ;
double *histo_fromt0_array = new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)] ; double *histo_fromt0_array =
new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)] ;
if (!histo_fromt0_array) return NULL; if (!histo_fromt0_array) return NULL;
@ -1677,7 +1698,8 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
{ {
histo_fromt0_array[i] = 0 ; histo_fromt0_array[i] = 0 ;
for (int j = 0 ; j < binning ; j++) for (int j = 0 ; j < binning ; j++)
histo_fromt0_array[i] += double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) ; histo_fromt0_array[i] +=
double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) ;
} }
return histo_fromt0_array ; return histo_fromt0_array ;
@ -1688,13 +1710,16 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_fromt0_vector //Implementation get_histo_fromt0_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point t0. An \<offset\> can also be specified (otherwise = 0). /*! \brief Method to obtain a vector of double containing the values of the histogram
* \<histo_num\> with binning \<binning\> from the point t0. An \<offset\> can also
* be specified (otherwise = 0).
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
* - an empty vector of double if an invalid histogram number or binning is choosen * - an empty vector of double if an invalid histogram number or binning is choosen
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<binning\>
* representing the desired histogram number and binning.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_fromt0_vector(int histo_num , int binning , int offset) vector<double> MuSR_td_PSI_bin::get_histo_fromt0_vector(int histo_num , int binning , int offset)
@ -1712,7 +1737,8 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
for (int i = 0 ; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning) ; i++) for (int i = 0 ; i < int((int(length_histo)-get_t0_int(histo_num)-offset)/binning) ; i++)
{ {
for (int j = 0 ; j < binning ; j++) for (int j = 0 ; j < binning ; j++)
histo_fromt0_vector[i] += double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) ; histo_fromt0_vector[i] +=
double(histo[histo_num][i*binning+j+get_t0_int(histo_num)+offset]) ;
} }
return histo_fromt0_vector ; return histo_fromt0_vector ;
@ -1723,13 +1749,16 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_goodBins_array //Implementation get_histo_goodBins_array
//******************************* //*******************************
/*! \brief Method to obtain an array of type double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point first_good until last_good /*! \brief Method to obtain an array of type double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point first_good until
* last_good
* *
* This method gives back: * This method gives back:
* - an pointer of a double array * - an pointer of a double array
* - the NULL pointer if an invalid histogram number or binning is choosen or * - the NULL pointer if an invalid histogram number or binning is choosen or
* allocate failed * allocate failed
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<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::get_histo_goodBins_array(int histo_num , int binning)
@ -1738,15 +1767,17 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 ) if ( histo_num < 0 || histo_num >= int(number_histo) || binning <= 0 )
return NULL ; return NULL ;
double *histo_goodBins_array = new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)] ; double *histo_goodBins_array =
new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)] ;
if (!histo_goodBins_array) return NULL; if (!histo_goodBins_array) return NULL;
for (int i = 0 ; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning) ; i++) for (int i = 0 ; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning) ; i++)
{ {
histo_goodBins_array[i] = 0 ; histo_goodBins_array[i] = 0 ;
for (int j = 0 ; j < binning ; j++) for (int j = 0 ; j < binning ; j++)
histo_goodBins_array[i] += double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) ; histo_goodBins_array[i] +=
double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) ;
} }
return histo_goodBins_array ; return histo_goodBins_array ;
@ -1757,13 +1788,16 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_goodBins_vector //Implementation get_histo_goodBins_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point first_good until last_good /*! \brief Method to obtain a vector of double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point first_good until
* last_good
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
* - an empty vector of double if an invalid histogram number or binning is choosen * - an empty vector of double if an invalid histogram number or binning is choosen
* *
* The parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The parameters of the method are the integers \<histo_num\> and \<binning\>
* representing the desired histogram number and binning.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_goodBins_vector(int histo_num , int binning) vector<double> MuSR_td_PSI_bin::get_histo_goodBins_vector(int histo_num , int binning)
@ -1781,7 +1815,8 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
for (int i = 0 ; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning) ; i++) for (int i = 0 ; i < int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num))/binning) ; i++)
{ {
for (int j = 0 ; j < binning ; j++) for (int j = 0 ; j < binning ; j++)
histo_goodBins_vector[i] += double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) ; histo_goodBins_vector[i] +=
double(histo[histo_num][i*binning+j+get_firstGood_int(histo_num)]) ;
} }
return histo_goodBins_vector ; return histo_goodBins_vector ;
@ -1792,9 +1827,12 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
//Implementation get_histo_fromt0_minus_bckgrd_array //Implementation get_histo_fromt0_minus_bckgrd_array
//******************************* //*******************************
/*! \brief Method to obtain an array of type double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point t0. A background calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted. An \<offset\> can also be specified (otherwise = 0). /*! \brief Method to obtain an array of type double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point t0. A background
* calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted.
* An \<offset\> can also be specified (otherwise = 0.
* *
* This method gives back: * This method gives back:
* - a pointer of a double array * - a pointer of a double array
* - the NULL pointer if one provides * - the NULL pointer if one provides
* - an invalid histogram number * - an invalid histogram number
@ -1802,12 +1840,14 @@ double MuSR_td_PSI_bin::get_histo(int histo_num, int j) {
* - invalid background limits * - invalid background limits
* - allocate failed * - allocate failed
* *
* The first parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The first parameters of the method are the integers \<histo_num\> and \<binning\>
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits between which the background is calculated. * representing the desired histogram number and binning.
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits
* between which the background is calculated.
*/ */
double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , int lower_bckgrd , double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num ,
int higher_bckgrd , int binning, int offset) int lower_bckgrd , int higher_bckgrd , int binning, int offset)
{ {
if (!readingok) return NULL; if (!readingok) return NULL;
@ -1825,7 +1865,8 @@ double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , in
} }
bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1) ; 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)] ; double *histo_fromt0_minus_bckgrd_array =
new double[int((int(length_histo)-get_t0_int(histo_num)-offset+1)/binning)] ;
if (!histo_fromt0_minus_bckgrd_array) return NULL; if (!histo_fromt0_minus_bckgrd_array) return NULL;
@ -1843,8 +1884,11 @@ double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , in
//******************************* //*******************************
//Implementation get_histo_fromt0_minus_bckgrd_vector //Implementation get_histo_fromt0_minus_bckgrd_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point t0. A background calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted. An \<offset\> can also be specified (otherwise = 0). /*! \brief Method to obtain a vector of double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point t0. A background
* calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted.
* An \<offset\> can also be specified (otherwise = 0).
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
@ -1853,8 +1897,10 @@ double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , in
* - a binning smaller than 1 * - a binning smaller than 1
* - invalid background limits * - invalid background limits
* *
* The first parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The first parameters of the method are the integers \<histo_num\> and \<binning\>
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits between which the background is calculated. * representing the desired histogram number and binning.
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits
* between which the background is calculated.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_vector(int histo_num , int lower_bckgrd , vector<double> MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_vector(int histo_num , int lower_bckgrd ,
@ -1895,7 +1941,10 @@ double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , in
//Implementation get_histo_goodBins_minus_bckgrd_array //Implementation get_histo_goodBins_minus_bckgrd_array
//******************************* //*******************************
/*! \brief Method to obtain an array of type double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point first_good until the point last_good. A background calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted /*! \brief Method to obtain an array of type double containing the values of the
* histogram \<histo_num\> with binning \<binning\> from the point first_good until
* the point last_good. A background calculated from the points \<lower_bckgrd\> and
* \<higher_bckgrd\> is subtracted
* *
* This method gives back: * This method gives back:
* - a pointer of a double array * - a pointer of a double array
@ -1905,8 +1954,10 @@ double * MuSR_td_PSI_bin::get_histo_fromt0_minus_bckgrd_array(int histo_num , in
* - invalid background limits * - invalid background limits
- allocate failed - allocate failed
* *
* The first parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The first parameters of the method are the integers \<histo_num\> and \<binning\>
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits between which the background is calculated. * representing the desired histogram number and binning.
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits
* between which the background is calculated.
*/ */
double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num , int lower_bckgrd , double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num , int lower_bckgrd ,
@ -1927,7 +1978,8 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
} }
bckgrd = bckgrd/(higher_bckgrd-lower_bckgrd+1) ; 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)] ; double *histo_goodBins_minus_bckgrd_array =
new double[int((get_lastGood_int(histo_num)-get_firstGood_int(histo_num)+1)/binning)] ;
if (!histo_goodBins_minus_bckgrd_array) return NULL; if (!histo_goodBins_minus_bckgrd_array) return NULL;
@ -1947,7 +1999,10 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
//Implementation get_histo_goodBins_minus_bckgrd_vector //Implementation get_histo_goodBins_minus_bckgrd_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\> with binning \<binning\> from the point first_good until the point last_good. A background calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\> is subtracted /*! \brief Method to obtain a vector of double containing the values of the histogram \<histo_num\>
* with binning \<binning\> from the point first_good until the point last_good.
* A background calculated from the points \<lower_bckgrd\> and \<higher_bckgrd\>
* is subtracted
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
@ -1956,8 +2011,10 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
* - a binning smaller than 1 * - a binning smaller than 1
* - invalid background limits * - invalid background limits
* *
* The first parameters of the method are the integers \<histo_num\> and \<binning\> representing the desired histogram number and binning. * The first parameters of the method are the integers \<histo_num\> and \<binning\>
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits between which the background is calculated. * representing the desired histogram number and binning.
* Also the parameters \<lower_bckgrd\> and \<higher_bckgrd\> define the limits
* between which the background is calculated.
*/ */
vector<double> MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_vector(int histo_num , int lower_bckgrd , vector<double> MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_vector(int histo_num , int lower_bckgrd ,
@ -2013,8 +2070,10 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
* - invalid background limits * - invalid background limits
* - allocate failed * - allocate failed
* *
* The first parameters of the method are the integers \<histo_num_plus\> and \<histo_num_minus\>, as well as the double \<alpha_param\>. * The first parameters of the method are the integers \<histo_num_plus\> and
* Integers for the binning and for the background limits for both histograms.are also required. * \<histo_num_minus\>, as well as the double \<alpha_param\>.
* Integers for the binning and for the background limits for both histograms.are
* also required.
*/ */
double * MuSR_td_PSI_bin::get_asymmetry_array(int histo_num_plus , int histo_num_minus , double alpha_param , double * MuSR_td_PSI_bin::get_asymmetry_array(int histo_num_plus , int histo_num_minus , double alpha_param ,
@ -2315,7 +2374,8 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
int binning , int lower_bckgrd_plus , int higher_bckgrd_plus , int binning , int lower_bckgrd_plus , int higher_bckgrd_plus ,
int lower_bckgrd_minus , int higher_bckgrd_minus) 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(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) ;
if (!readingok) return NULL; if (!readingok) return NULL;
@ -2388,7 +2448,8 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
int binning , int lower_bckgrd_plus , int higher_bckgrd_plus , int binning , int lower_bckgrd_plus , int higher_bckgrd_plus ,
int lower_bckgrd_minus , int higher_bckgrd_minus) 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(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) ;
vector<double> asymmetry_goodBins_vector ; vector<double> asymmetry_goodBins_vector ;
@ -2461,7 +2522,10 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
int binning , int lower_bckgrd_plus , int higher_bckgrd_plus , int binning , int lower_bckgrd_plus , int higher_bckgrd_plus ,
int lower_bckgrd_minus , int higher_bckgrd_minus) 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(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) ;
if (!readingok) return NULL; if (!readingok) return NULL;
@ -2477,18 +2541,19 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
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(length_histo) || lower_bckgrd_minus > higher_bckgrd_minus )
return NULL ; return NULL ;
double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus , lower_bckgrd_plus , double *dummy_1 = get_histo_fromt0_minus_bckgrd_array(histo_num_plus ,
higher_bckgrd_plus , binning) ; lower_bckgrd_plus , higher_bckgrd_plus , binning) ;
if (dummy_1 == NULL) return NULL; if (dummy_1 == NULL) return NULL;
double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus , lower_bckgrd_minus , double *dummy_2 = get_histo_fromt0_minus_bckgrd_array(histo_num_minus ,
higher_bckgrd_minus , binning) ; lower_bckgrd_minus , higher_bckgrd_minus , binning) ;
if (dummy_2 == NULL) if (dummy_2 == NULL)
{ {
delete [] dummy_1; delete [] dummy_1;
return NULL; return NULL;
} }
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(get_firstGood_int(histo_num_plus)-get_t0_int(histo_num_plus),
get_firstGood_int(histo_num_minus)-get_t0_int(histo_num_minus)) ;
double *error_asymmetry_goodBins_array = new double[hsize] ; double *error_asymmetry_goodBins_array = new double[hsize] ;
@ -2499,8 +2564,10 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 ) if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 )
error_asymmetry_goodBins_array[i] = 1.0 ; error_asymmetry_goodBins_array[i] = 1.0 ;
else else
error_asymmetry_goodBins_array[i] = double(2.) * alpha_param * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]*(dummy_1[i+hstart]+dummy_2[i+hstart])) / error_asymmetry_goodBins_array[i] =
pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.) ; double(2.) * alpha_param * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]
*(dummy_1[i+hstart]+dummy_2[i+hstart])) /
pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.) ;
} }
delete [] dummy_1; delete [] dummy_1;
@ -2514,11 +2581,14 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
//Implementation get_error_asymmetry_goodBins_vector //Implementation get_error_asymmetry_goodBins_vector
//******************************* //*******************************
/*! \brief Method to obtain a vector of double containing the values of the error of the asymmetry between 2 histograms. /*! \brief Method to obtain a vector of double containing the values of the error of
* the asymmetry between 2 histograms.
* *
* The size is calculated as the asymmetry array. * The size is calculated as the asymmetry array.
* The error of the asymmetry is calculated with the histograms \<histo_num_plus\> and \<histo_num_minus\> with an alpha parameter * The error of the asymmetry is calculated with the histograms \<histo_num_plus\> and
* \<alpha_param\>. This method requires also a binning value \<binning\>, as well as the background limits for both histograms. * \<histo_num_minus\> with an alpha parameter \<alpha_param\>. This method requires
* also a binning value \<binning\>, as well as the background limits for both
* histograms.
* *
* This method gives back: * This method gives back:
* - a vector of double * - a vector of double
@ -2527,15 +2597,19 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
* - a binning smaller than 1 * - a binning smaller than 1
* - invalid background limits * - invalid background limits
* *
* The first parameters of the method are the integers \<histo_num_plus\> and \<histo_num_minus\>, as well as the double \<alpha_param\>. * The first parameters of the method are the integers \<histo_num_plus\> and
* \<histo_num_minus\>, as well as the double \<alpha_param\>.
* Integers for the binning and for the background limits for both histograms.are also required. * Integers for the binning and for the background limits for both histograms.are also required.
*/ */
vector<double> MuSR_td_PSI_bin::get_error_asymmetry_goodBins_vector(int histo_num_plus , int histo_num_minus , double alpha_param , vector<double> MuSR_td_PSI_bin::get_error_asymmetry_goodBins_vector(int histo_num_plus ,
int binning , int lower_bckgrd_plus , int higher_bckgrd_plus , int histo_num_minus , double alpha_param ,
int lower_bckgrd_minus , int higher_bckgrd_minus) 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(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) ;
vector<double> error_asymmetry_goodBins_vector ; vector<double> error_asymmetry_goodBins_vector ;
@ -2575,8 +2649,9 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 ) if (dummy_1[i+hstart] < 0.5 || dummy_2[i+hstart] < 0.5 )
error_asymmetry_goodBins_vector[i] = 1.0 ; error_asymmetry_goodBins_vector[i] = 1.0 ;
else else
error_asymmetry_goodBins_vector[i] = double(2.) * alpha_param * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]*(dummy_1[i+hstart]+dummy_2[i+hstart])) / error_asymmetry_goodBins_vector[i] = double(2.) * alpha_param
pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.) ; * sqrt(dummy_1[i+hstart]*dummy_2[i+hstart]*(dummy_1[i+hstart]+dummy_2[i+hstart])) /
pow(dummy_1[i+hstart] + alpha_param * dummy_2[i+hstart],2.) ;
} }
delete [] dummy_1; delete [] dummy_1;
@ -3324,7 +3399,8 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
//Implementation get_timeStart_vector() //Implementation get_timeStart_vector()
//******************************* //*******************************
/*! \brief Method returning a vector of strings containing 1) the date when the run was started and 2) the time when the run was started /*! \brief Method returning a vector of strings containing 1) the date when the run was
* started and 2) the time when the run was started
*/ */
vector<string> MuSR_td_PSI_bin::get_timeStart_vector() vector<string> MuSR_td_PSI_bin::get_timeStart_vector()
@ -3343,7 +3419,8 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
//Implementation get_timeStop_vector() //Implementation get_timeStop_vector()
//******************************* //*******************************
/*! \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 /*! \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
*/ */
vector<string> MuSR_td_PSI_bin::get_timeStop_vector() vector<string> MuSR_td_PSI_bin::get_timeStop_vector()
@ -3416,7 +3493,7 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
{ {
for (j=0; j < MAXLABELSIZE-1; j++) for (j=0; j < MAXLABELSIZE-1; j++)
labels_histo[i][j] = ' '; labels_histo[i][j] = ' ';
labels_histo[i][MAXLABELSIZE] = '\0'; labels_histo[i][MAXLABELSIZE-1] = '\0';
events_per_histo[i] = 0; events_per_histo[i] = 0;
real_t0[i] = 0.f; real_t0[i] = 0.f;
integer_t0[i] = 0; integer_t0[i] = 0;
@ -3429,7 +3506,7 @@ double * MuSR_td_PSI_bin::get_histo_goodBins_minus_bckgrd_array(int histo_num ,
{ {
for (j=0; j < MAXLABELSIZE-1; j++) for (j=0; j < MAXLABELSIZE-1; j++)
labels_scalers[i][j] = ' '; labels_scalers[i][j] = ' ';
labels_scalers[i][MAXLABELSIZE] = '\0'; labels_scalers[i][MAXLABELSIZE-1] = '\0';
scalers[i] = 0; scalers[i] = 0;
} }

View File

@ -108,8 +108,8 @@ class MuSR_td_PSI_bin {
Histogram information returned by ..._vector or ..._array methods return Histogram information returned by ..._vector or ..._array methods return
information based on histo bin . information based on histo bin .
NOTE: Histogram information returned by pointer_to_array = ..._array() methods NOTE: Histogram information returned by \<pointer_to_array\> = ..._array() methods
should be freed by delete [] pointer_to_array; should be freed by delete [] \<pointer_to_array\>;
*/ */
vector< vector<double> > histos_vector ; vector< vector<double> > histos_vector ;