added missing t0 handling

This commit is contained in:
nemu 2009-04-01 06:07:51 +00:00
parent 4b561aa598
commit ac0fe26844
4 changed files with 58 additions and 13 deletions

View File

@ -950,6 +950,33 @@ bool PMsrHandler::SetMsrParamPosError(unsigned int i, double value)
return true;
}
//--------------------------------------------------------------------------
// SetMsrT0Entry (public)
//--------------------------------------------------------------------------
/**
* <p>
*
* \param runNo
* \param idx
* \param bin
*/
void PMsrHandler::SetMsrT0Entry(unsigned int runNo, unsigned int idx, int bin)
{
if ((runNo < 0) || (runNo > fRuns.size())) { // error
cout << endl << "**ERROR** in PMsrHandler::SetMsrT0Entry: runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
cout << endl;
return;
}
if ((idx < 0) || (idx > fRuns[runNo].fT0.size())) { // error
cout << endl << "**ERROR** in PMsrHandler::SetMsrT0Entry: idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].fT0.size();
cout << endl;
return;
}
fRuns[runNo].fT0[idx] = bin;
}
//--------------------------------------------------------------------------
// SetMsrDataRangeEntry (public)
//--------------------------------------------------------------------------

View File

@ -394,6 +394,25 @@ void PMusrT0::SetT0Channel()
Int_t binx = fHisto->GetXaxis()->FindFixBin(x);
// set t0 bin in msr-Handler
unsigned int idx = 0;
switch(fDetectorTag) {
case DETECTOR_TAG_FORWARD:
idx = fAddRunNo * fAddRunOffset / 2;
break;
case DETECTOR_TAG_BACKWARD:
idx = 1 + fAddRunNo * fAddRunOffset / 2;
break;
case DETECTOR_TAG_LEFT:
idx = 2 + fAddRunNo * fAddRunOffset / 2;
break;
case DETECTOR_TAG_RIGHT:
idx = 3 + fAddRunNo * fAddRunOffset / 2;
break;
default:
break;
}
fMsrHandler->SetMsrT0Entry(fRunNo, idx, binx);
// shift line to the proper position
fT0Line->SetX1(x);

View File

@ -687,12 +687,11 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
}
}
// check if packed forward and backward hist have the same size, otherwise something is wrong
// check if packed forward and backward hist have the same size, otherwise take the minimum size
unsigned int noOfBins = forwardPacked.fValue.size();
if (forwardPacked.fValue.size() != backwardPacked.fValue.size()) {
cout << endl << "PRunAsymmetry::PrepareFitData(): **PANIC ERROR**:";
cout << endl << " packed forward and backward histo should have the same number of bins!";
cout << endl << " however found (f/b) : " << forwardPacked.fValue.size() << "/" << backwardPacked.fValue.size();
return false;
if (forwardPacked.fValue.size() > backwardPacked.fValue.size())
noOfBins = backwardPacked.fValue.size();
}
// form asymmetry including error propagation
@ -702,7 +701,7 @@ bool PRunAsymmetry::PrepareFitData(PRawRunData* runData, unsigned int histoNo[2]
// data start at data_start-t0
fData.fDataTimeStart = fTimeResolution*(((double)start[0]-t0[0])+(double)fRunInfo->fPacking/2.0);
fData.fDataTimeStep = fTimeResolution*(double)fRunInfo->fPacking;
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
for (unsigned int i=0; i<noOfBins; i++) {
// to make the formulae more readable
f = forwardPacked.fValue[i];
b = backwardPacked.fValue[i];
@ -840,17 +839,16 @@ bool PRunAsymmetry::PrepareViewData(PRawRunData* runData, unsigned int histoNo[2
error += fBackwardErr[i]*fBackwardErr[i];
}
// check if packed forward and backward hist have the same size, otherwise something is wrong
// check if packed forward and backward hist have the same size, otherwise take the minimum size
unsigned int noOfBins = forwardPacked.fValue.size();
if (forwardPacked.fValue.size() != backwardPacked.fValue.size()) {
cout << endl << "PRunAsymmetry::PrepareViewData(): **PANIC ERROR**:";
cout << endl << " packed forward and backward histo should have the same number of bins!";
cout << endl << " however found (f/b) : " << forwardPacked.fValue.size() << "/" << backwardPacked.fValue.size();
return false;
if (forwardPacked.fValue.size() > backwardPacked.fValue.size())
noOfBins = backwardPacked.fValue.size();
}
// form asymmetry including error propagation
double asym;
double f, b, ef, eb, alpha, beta;
double f, b, ef, eb, alpha = 1.0, beta = 1.0;
// fill data time start, and step
// data start at data_start-t0
fData.fDataTimeStart = fTimeResolution*(((double)start[0]-t0[0])+(double)fRunInfo->fPacking/2.0);
@ -879,7 +877,7 @@ bool PRunAsymmetry::PrepareViewData(PRawRunData* runData, unsigned int histoNo[2
}
//cout << endl << ">> alpha = " << alpha << ", beta = " << beta;
for (unsigned int i=0; i<forwardPacked.fValue.size(); i++) {
for (unsigned int i=0; i<noOfBins; i++) {
// to make the formulae more readable
f = forwardPacked.fValue[i];
b = backwardPacked.fValue[i];

View File

@ -71,6 +71,7 @@ class PMsrHandler
virtual bool SetMsrParamPosErrorPresent(unsigned int i, bool value);
virtual bool SetMsrParamPosError(unsigned int i, double value);
virtual void SetMsrT0Entry(unsigned int runNo, unsigned int idx, int bin);
virtual void SetMsrDataRangeEntry(unsigned int runNo, unsigned int idx, int bin);
virtual void SetMsrBkgRangeEntry(unsigned int runNo, unsigned int idx, int bin);