improved handling for grouping and addrun
This commit is contained in:
parent
c3316e9676
commit
d5d36d21fd
@ -324,6 +324,14 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||||
t0TagMissing.push_back(true);
|
t0TagMissing.push_back(true);
|
||||||
}
|
}
|
||||||
|
vector<PBoolVector> addt0TagMissing; // needed for proper musrt0 handling
|
||||||
|
PBoolVector bvec;
|
||||||
|
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||||
|
bvec.clear();
|
||||||
|
for (UInt_t j=0; j<fRuns[i].GetAddT0Entries(); j++)
|
||||||
|
bvec.push_back(true);
|
||||||
|
addt0TagMissing.push_back(bvec);
|
||||||
|
}
|
||||||
PBoolVector backgroundTagMissing; // needed for proper musrt0 handling
|
PBoolVector backgroundTagMissing; // needed for proper musrt0 handling
|
||||||
for (UInt_t i=0; i<fRuns.size(); i++) {
|
for (UInt_t i=0; i<fRuns.size(); i++) {
|
||||||
backgroundTagMissing.push_back(true);
|
backgroundTagMissing.push_back(true);
|
||||||
@ -726,7 +734,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
for (UInt_t j=0; j<4; j++) {
|
for (UInt_t j=0; j<4; j++) {
|
||||||
if (fRuns[runNo].GetBkgRange(j) > 0) {
|
if (fRuns[runNo].GetBkgRange(j) > 0) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetBkgRange(j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetBkgRange(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
@ -737,7 +745,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
for (UInt_t j=0; j<4; j++) {
|
for (UInt_t j=0; j<4; j++) {
|
||||||
if (fRuns[runNo].GetDataRange(j) > 0) {
|
if (fRuns[runNo].GetDataRange(j) > 0) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetDataRange(j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetDataRange(j);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
@ -747,10 +755,11 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
fout << left << "t0";
|
fout << left << "t0";
|
||||||
for (UInt_t j=0; j<fRuns[runNo].GetT0Size(); j++) {
|
for (UInt_t j=0; j<fRuns[runNo].GetT0Size(); j++) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetT0(j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetT0(j);
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
} else if (sstr.BeginsWith("addt0")) {
|
} else if (sstr.BeginsWith("addt0")) {
|
||||||
|
addt0TagMissing[runNo][addT0Counter] = false;
|
||||||
if (fRuns[runNo].GetAddT0Size(addT0Counter) <=0) {
|
if (fRuns[runNo].GetAddT0Size(addT0Counter) <=0) {
|
||||||
cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!";
|
cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addt0' tag without any data found!";
|
||||||
cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl;
|
cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl;
|
||||||
@ -759,7 +768,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
fout << left << "addt0";
|
fout << left << "addt0";
|
||||||
for (Int_t j=0; j<fRuns[runNo].GetAddT0Size(addT0Counter); j++) {
|
for (Int_t j=0; j<fRuns[runNo].GetAddT0Size(addT0Counter); j++) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetAddT0(addT0Counter, j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetAddT0(addT0Counter, j);
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
addT0Counter++;
|
addT0Counter++;
|
||||||
@ -786,7 +795,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
fout << endl;
|
fout << endl;
|
||||||
}
|
}
|
||||||
} else if (sstr.BeginsWith("fit")) {
|
} else if (sstr.BeginsWith("fit")) {
|
||||||
// check if missing t0/background/data tag are present eventhough the values are present, if so write these data values
|
// check if missing t0/addt0/background/data tag are present eventhough the values are present, if so write these data values
|
||||||
if (t0TagMissing[runNo]) {
|
if (t0TagMissing[runNo]) {
|
||||||
if (fRuns[runNo].GetT0Size() > 0) {
|
if (fRuns[runNo].GetT0Size() > 0) {
|
||||||
fout.width(16);
|
fout.width(16);
|
||||||
@ -798,13 +807,26 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
fout << endl;
|
fout << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (UInt_t i=0; i<fRuns[runNo].GetAddT0Entries(); i++) {
|
||||||
|
if (addt0TagMissing[runNo][i]) {
|
||||||
|
if (fRuns[runNo].GetAddT0Size(i) > 0) {
|
||||||
|
fout.width(16);
|
||||||
|
fout << left << "addt0";
|
||||||
|
for (Int_t j=0; j<fRuns[runNo].GetAddT0Size(i); j++) {
|
||||||
|
fout.width(8);
|
||||||
|
fout << left << fRuns[runNo].GetAddT0(i, j);
|
||||||
|
}
|
||||||
|
fout << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (backgroundTagMissing[runNo]) {
|
if (backgroundTagMissing[runNo]) {
|
||||||
if (fRuns[runNo].GetBkgRange(0) >= 0) {
|
if (fRuns[runNo].GetBkgRange(0) >= 0) {
|
||||||
fout.width(16);
|
fout.width(16);
|
||||||
fout << left << "background";
|
fout << left << "background";
|
||||||
for (UInt_t j=0; j<2; j++) {
|
for (UInt_t j=0; j<2; j++) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetBkgRange(j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetBkgRange(j);
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
}
|
}
|
||||||
@ -815,7 +837,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages)
|
|||||||
fout << left << "data";
|
fout << left << "data";
|
||||||
for (UInt_t j=0; j<2; j++) {
|
for (UInt_t j=0; j<2; j++) {
|
||||||
fout.width(8);
|
fout.width(8);
|
||||||
fout << left << fRuns[runNo].GetDataRange(j)+1; // +1 since internally the data start at 0
|
fout << left << fRuns[runNo].GetDataRange(j);
|
||||||
}
|
}
|
||||||
fout << endl;
|
fout << endl;
|
||||||
}
|
}
|
||||||
@ -1209,21 +1231,55 @@ Bool_t PMsrHandler::SetMsrParamPosError(UInt_t i, Double_t value)
|
|||||||
*/
|
*/
|
||||||
void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||||
{
|
{
|
||||||
if ((runNo < 0) || (runNo > fRuns.size())) { // error
|
if (runNo >= fRuns.size()) { // error
|
||||||
cerr << endl << "PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((idx < 0) || (idx > fRuns[runNo].GetT0Size())) { // error
|
if (idx >= fRuns[runNo].GetT0Size()) { // error
|
||||||
cerr << endl << "PMsrHandler::SetMsrT0Entry: **ERROR** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0Size();
|
cerr << endl << ">> PMsrHandler::SetMsrT0Entry: **WARNING** idx = " << idx << ", is out of valid range 0.." << fRuns[runNo].GetT0Size();
|
||||||
|
cerr << endl << ">> Will add it anyway.";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fRuns[runNo].SetT0(bin, idx);
|
fRuns[runNo].SetT0(bin, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// SetMsrAddT0Entry (public)
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p> Sets a t0 value for an addrun entry.
|
||||||
|
*
|
||||||
|
* \param runNo msr-file run number
|
||||||
|
* \param addRunIdx msr-file addrun index, e.g. if 2 addruns are present addRunIdx can take the values 0 or 1.
|
||||||
|
* \param histoIdx msr-file histogram index for an addrun.
|
||||||
|
* \param bin histogram t0 value.
|
||||||
|
*/
|
||||||
|
void PMsrHandler::SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Int_t bin)
|
||||||
|
{
|
||||||
|
if (runNo >= fRuns.size()) { // error
|
||||||
|
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||||
|
cerr << endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (addRunIdx >= fRuns[runNo].GetAddT0Entries()) { // error
|
||||||
|
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** addRunIdx = " << addRunIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0Entries();
|
||||||
|
cerr << endl << ">> Will add it anyway.";
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (histoIdx > fRuns[runNo].GetAddT0Size(addRunIdx)) { // error
|
||||||
|
cerr << endl << ">> PMsrHandler::SetMsrAddT0Entry: **WARNING** histoIdx = " << histoIdx << ", is out of valid range 0.." << fRuns[runNo].GetAddT0Size(addRunIdx);
|
||||||
|
cerr << endl << ">> Will add it anyway.";
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
fRuns[runNo].SetAddT0(bin, addRunIdx, histoIdx);
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// SetMsrDataRangeEntry (public)
|
// SetMsrDataRangeEntry (public)
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -1236,18 +1292,12 @@ void PMsrHandler::SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin)
|
|||||||
*/
|
*/
|
||||||
void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
|
void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||||
{
|
{
|
||||||
if ((runNo < 0) || (runNo > fRuns.size())) { // error
|
if (runNo > fRuns.size()) { // error
|
||||||
cerr << endl << "PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
cerr << endl << "PMsrHandler::SetMsrDataRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx < 0) { // error
|
|
||||||
cerr << endl << "PMsrHandler::SetMsrDataRangeEntry: **ERROR** idx = " << idx << ", is out of valid range, i.e. idx >= 0 needed.";
|
|
||||||
cerr << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fRuns[runNo].SetDataRange(bin, idx);
|
fRuns[runNo].SetDataRange(bin, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1263,18 +1313,12 @@ void PMsrHandler::SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
|
|||||||
*/
|
*/
|
||||||
void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
|
void PMsrHandler::SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin)
|
||||||
{
|
{
|
||||||
if ((runNo < 0) || (runNo > fRuns.size())) { // error
|
if (runNo > fRuns.size()) { // error
|
||||||
cerr << endl << "PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
cerr << endl << "PMsrHandler::SetMsrBkgRangeEntry: **ERROR** runNo = " << runNo << ", is out of valid range 0.." << fRuns.size();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idx < 0) { // error
|
|
||||||
cerr << endl << "PMsrHandler::SetMsrBkgRangeEntry: idx = " << idx << ", is out of valid range, i.e. idx >= 0 needed.";
|
|
||||||
cerr << endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fRuns[runNo].SetBkgRange(bin, idx);
|
fRuns[runNo].SetBkgRange(bin, idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3740,6 +3784,32 @@ Bool_t PMsrHandler::CheckHistoGrouping()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// check grouping entries are not identical, e.g. forward 1 1 2
|
||||||
|
if (fRuns[i].GetForwardHistoNoSize() > 1) {
|
||||||
|
for (UInt_t j=0; j<fRuns[i].GetForwardHistoNoSize(); j++) {
|
||||||
|
for (UInt_t k=j+1; k<fRuns[i].GetForwardHistoNoSize(); k++) {
|
||||||
|
if (fRuns[i].GetForwardHistoNo(j) == fRuns[i].GetForwardHistoNo(k)) {
|
||||||
|
cerr << endl << ">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
|
||||||
|
cerr << endl << ">> run no " << i+1 << ", forward histo " << j+1 << " == forward histo " << k+1 << ".";
|
||||||
|
cerr << endl << ">> this really doesn't make any sense, but you are the boss.";
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fRuns[i].GetBackwardHistoNoSize() > 1) {
|
||||||
|
for (UInt_t j=0; j<fRuns[i].GetBackwardHistoNoSize(); j++) {
|
||||||
|
for (UInt_t k=j+1; k<fRuns[i].GetBackwardHistoNoSize(); k++) {
|
||||||
|
if (fRuns[i].GetBackwardHistoNo(j) == fRuns[i].GetBackwardHistoNo(k)) {
|
||||||
|
cerr << endl << ">> PMsrHandler::CheckHistoGrouping: **WARNING** grouping identical histograms!!";
|
||||||
|
cerr << endl << ">> run no " << i+1 << ", backward histo " << j+1 << " == backward histo " << k+1 << ".";
|
||||||
|
cerr << endl << ">> this really doesn't make any sense, but you are the boss.";
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -317,7 +317,7 @@ const Int_t PRawRunData::GetT0(const UInt_t idx)
|
|||||||
cerr << endl;
|
cerr << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return fT0s[idx]-1; // -1 because the counting of the data vector starts at 0!
|
return fT0s[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -335,7 +335,7 @@ const Int_t PRawRunData::GetT0Estimated(const UInt_t idx)
|
|||||||
cerr << endl;
|
cerr << endl;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return fT0Estimated[idx]-1; // -1 because the counting of the data vector starts at 0!
|
return fT0Estimated[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -354,8 +354,8 @@ const PIntPair PRawRunData::GetBkgBin(const UInt_t idx)
|
|||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
pair.first = fBkgBin[idx].first - 1; // -1 because the counting of the data vector starts at 0!
|
pair.first = fBkgBin[idx].first;
|
||||||
pair.second = fBkgBin[idx].second - 1; // -1 because the counting of the data vector starts at 0!
|
pair.second = fBkgBin[idx].second;
|
||||||
|
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
@ -376,8 +376,8 @@ const PIntPair PRawRunData::GetGoodDataBin(const UInt_t idx)
|
|||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
|
|
||||||
pair.first = fGoodDataBin[idx].first - 1; // -1 because the counting of the data vector starts at 0!
|
pair.first = fGoodDataBin[idx].first;
|
||||||
pair.second = fGoodDataBin[idx].second - 1; // -1 because the counting of the data vector starts at 0!
|
pair.second = fGoodDataBin[idx].second;
|
||||||
|
|
||||||
return pair;
|
return pair;
|
||||||
}
|
}
|
||||||
@ -1062,7 +1062,7 @@ Int_t PMsrRunBlock::GetBkgRange(UInt_t idx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fBkgRange[idx]-1; // -1 because the counting of the data vector starts at 0!
|
return fBkgRange[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -1100,7 +1100,7 @@ Int_t PMsrRunBlock::GetDataRange(UInt_t idx)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return fDataRange[idx]-1; // -1 because the counting of the data vector starts at 0!
|
return fDataRange[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -1133,10 +1133,10 @@ void PMsrRunBlock::SetDataRange(Int_t ival, Int_t idx)
|
|||||||
*/
|
*/
|
||||||
Int_t PMsrRunBlock::GetT0(UInt_t idx)
|
Int_t PMsrRunBlock::GetT0(UInt_t idx)
|
||||||
{
|
{
|
||||||
if (idx>fT0.size())
|
if (idx >= fT0.size())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return fT0[idx]-1; // -1 because the counting of the data vector starts at 0!
|
return fT0[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -1174,7 +1174,7 @@ Int_t PMsrRunBlock::GetAddT0Size(UInt_t addRunIdx)
|
|||||||
if (fAddT0.empty())
|
if (fAddT0.empty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (addRunIdx > fAddT0.size())
|
if (addRunIdx >= fAddT0.size())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return fAddT0[addRunIdx].size();
|
return fAddT0[addRunIdx].size();
|
||||||
@ -1194,16 +1194,16 @@ Int_t PMsrRunBlock::GetAddT0(UInt_t addRunIdx, UInt_t histoIdx)
|
|||||||
if (fAddT0.empty())
|
if (fAddT0.empty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (addRunIdx > fAddT0.size())
|
if (addRunIdx >= fAddT0.size())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (fAddT0[addRunIdx].empty())
|
if (fAddT0[addRunIdx].empty())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (histoIdx > fAddT0[addRunIdx].size())
|
if (histoIdx >= fAddT0[addRunIdx].size())
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return fAddT0[addRunIdx][histoIdx]-1; // -1 because the counting of the data vector starts at 0!
|
return fAddT0[addRunIdx][histoIdx];
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
@ -42,8 +42,167 @@ using namespace std;
|
|||||||
|
|
||||||
#define DETECTOR_TAG_FORWARD 0
|
#define DETECTOR_TAG_FORWARD 0
|
||||||
#define DETECTOR_TAG_BACKWARD 1
|
#define DETECTOR_TAG_BACKWARD 1
|
||||||
#define DETECTOR_TAG_RIGHT 2
|
|
||||||
#define DETECTOR_TAG_LEFT 3
|
//--------------------------------------------------------------------------
|
||||||
|
// Constructor
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PMusrT0Data::PMusrT0Data()
|
||||||
|
{
|
||||||
|
InitData();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// Destructor
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PMusrT0Data::~PMusrT0Data()
|
||||||
|
{
|
||||||
|
fRawRunData.clear();
|
||||||
|
fHistoNo.clear();
|
||||||
|
fT0.clear();
|
||||||
|
for (UInt_t i=0; i<fAddT0.size(); i++)
|
||||||
|
fAddT0[i].clear();
|
||||||
|
fAddT0.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// InitData
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PMusrT0Data::InitData()
|
||||||
|
{
|
||||||
|
fSingleHisto = true;
|
||||||
|
fRunNo = -1;
|
||||||
|
fAddRunIdx = -1;
|
||||||
|
fHistoNoIdx = -1;
|
||||||
|
fDetectorTag = -1;
|
||||||
|
fCmdTag = -1;
|
||||||
|
fRawRunData.clear();
|
||||||
|
fHistoNo.clear();
|
||||||
|
fT0.clear();
|
||||||
|
for (UInt_t i=0; i<fAddT0.size(); i++)
|
||||||
|
fAddT0[i].clear();
|
||||||
|
fAddT0.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetRawRunData
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
PRawRunData* PMusrT0Data::GetRawRunData(Int_t idx)
|
||||||
|
{
|
||||||
|
if ((idx < 0) || (idx >= static_cast<Int_t>(fRawRunData.size())))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return fRawRunData[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetHistoNo
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Int_t PMusrT0Data::GetHistoNo(UInt_t idx)
|
||||||
|
{
|
||||||
|
if (idx >= fHistoNo.size())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return fHistoNo[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Int_t PMusrT0Data::GetT0(UInt_t idx)
|
||||||
|
{
|
||||||
|
if (idx >= fT0.size())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return fT0[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetAddT0Size
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
UInt_t PMusrT0Data::GetAddT0Size(UInt_t idx)
|
||||||
|
{
|
||||||
|
if (idx >= fAddT0.size())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return fAddT0[idx].size();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// GetAddT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Int_t PMusrT0Data::GetAddT0(UInt_t addRunIdx, UInt_t idx)
|
||||||
|
{
|
||||||
|
if (addRunIdx >= fAddT0.size())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (idx >= fAddT0[addRunIdx].size())
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return fAddT0[addRunIdx][idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// SetT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PMusrT0Data::SetT0(UInt_t val, UInt_t idx)
|
||||||
|
{
|
||||||
|
//cout << endl << "debug+> SetT0: size=" << fT0.size();
|
||||||
|
//cout << endl << "debug+> SetT0: val=" << val << ", idx=" << idx << endl;
|
||||||
|
|
||||||
|
if (idx >= fT0.size())
|
||||||
|
fT0.resize(idx+1);
|
||||||
|
|
||||||
|
fT0[idx] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// SetAddT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PMusrT0Data::SetAddT0(UInt_t val, UInt_t addRunIdx, UInt_t idx)
|
||||||
|
{
|
||||||
|
//cout << endl << "debug+> SetAddT0: size=" << fAddT0.size();
|
||||||
|
//cout << endl << "debug+> SetAddT0: val=" << val << ", addRunIdx=" << addRunIdx << ", idx=" << idx << endl;
|
||||||
|
|
||||||
|
if (addRunIdx >= fAddT0.size())
|
||||||
|
fAddT0.resize(addRunIdx+1);
|
||||||
|
|
||||||
|
if (idx >= fAddT0[addRunIdx].size())
|
||||||
|
fAddT0[addRunIdx].resize(idx+1);
|
||||||
|
|
||||||
|
fAddT0[addRunIdx][idx] = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
|
||||||
ClassImpQ(PMusrT0)
|
ClassImpQ(PMusrT0)
|
||||||
|
|
||||||
@ -55,8 +214,9 @@ ClassImpQ(PMusrT0)
|
|||||||
*/
|
*/
|
||||||
PMusrT0::PMusrT0()
|
PMusrT0::PMusrT0()
|
||||||
{
|
{
|
||||||
fRunNo = -1;
|
fValid = false;
|
||||||
fDetectorTag = -1;
|
|
||||||
|
fStatus = 0; // default is quit locally
|
||||||
|
|
||||||
fMainCanvas = 0;
|
fMainCanvas = 0;
|
||||||
|
|
||||||
@ -64,6 +224,11 @@ PMusrT0::PMusrT0()
|
|||||||
fData = 0;
|
fData = 0;
|
||||||
fBkg = 0;
|
fBkg = 0;
|
||||||
|
|
||||||
|
fToDoInfo = 0;
|
||||||
|
|
||||||
|
fDataAndBkgEnabled = false;
|
||||||
|
fT0Enabled = false;
|
||||||
|
|
||||||
fDataRange[0] = 0;
|
fDataRange[0] = 0;
|
||||||
fDataRange[1] = 0;
|
fDataRange[1] = 0;
|
||||||
fBkgRange[0] = 0;
|
fBkgRange[0] = 0;
|
||||||
@ -80,40 +245,241 @@ PMusrT0::PMusrT0()
|
|||||||
// Constructor
|
// Constructor
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
|
* <p>
|
||||||
*
|
*
|
||||||
* \param rawRunData
|
* \param data
|
||||||
* \param histoNo
|
|
||||||
*/
|
*/
|
||||||
PMusrT0::PMusrT0(PRawRunData *rawRunData, Int_t runNo, Int_t histoNo, Int_t detectorTag, Int_t addRunNo) :
|
PMusrT0::PMusrT0(PMusrT0Data &data) : fMusrT0Data(data)
|
||||||
fRunNo(runNo), fDetectorTag(detectorTag), fAddRunNo(addRunNo)
|
|
||||||
{
|
{
|
||||||
cout << endl << "run Name = " << rawRunData->GetRunName()->Data() << ", runNo = " << fRunNo << ", histoNo = " << histoNo << endl;
|
fValid = true;
|
||||||
|
|
||||||
fStatus = 0; // default is quit locally
|
fStatus = 0; // default is quit locally
|
||||||
|
|
||||||
fAddRunOffset = 0;
|
fMainCanvas = 0;
|
||||||
|
|
||||||
TString str = *rawRunData->GetRunName() + TString(" : ");
|
fHisto = 0;
|
||||||
str += histoNo;
|
fData = 0;
|
||||||
|
fBkg = 0;
|
||||||
|
|
||||||
|
fToDoInfo = 0;
|
||||||
|
|
||||||
|
fDataAndBkgEnabled = false;
|
||||||
|
fT0Enabled = false;
|
||||||
|
|
||||||
|
fDataRange[0] = 0;
|
||||||
|
fDataRange[1] = 0;
|
||||||
|
fBkgRange[0] = 0;
|
||||||
|
fBkgRange[1] = 0;
|
||||||
|
|
||||||
|
fT0Line = 0;
|
||||||
|
fFirstBkgLine = 0;
|
||||||
|
fLastBkgLine = 0;
|
||||||
|
fFirstDataLine = 0;
|
||||||
|
fLastDataLine = 0;
|
||||||
|
|
||||||
// feed necessary objects
|
// feed necessary objects
|
||||||
|
TString str;
|
||||||
|
|
||||||
// feed raw data histo
|
if ((fMusrT0Data.GetCmdTag() == PMUSRT0_GET_T0) || (fMusrT0Data.GetCmdTag() == PMUSRT0_GET_T0_DATA_AND_BKG_RANGE)) {
|
||||||
Int_t noOfBins = rawRunData->GetDataBin(histoNo-1)->size();
|
str = *fMusrT0Data.GetRawRunData(fMusrT0Data.GetAddRunIdx())->GetRunName() + TString(" : ");
|
||||||
Double_t start = -0.5;
|
str += fMusrT0Data.GetHistoNo(fMusrT0Data.GetHistoNoIdx());
|
||||||
Double_t end = noOfBins - 0.5; // -0.5 is correct since the data start at 0.0
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
fHisto = new TH1F("fHisto", str.Data(), noOfBins, start, end);
|
str += " (f)";
|
||||||
fHisto->SetMarkerStyle(21);
|
else
|
||||||
fHisto->SetMarkerSize(0.5);
|
str += " (b)";
|
||||||
fHisto->SetMarkerColor(TColor::GetColor(0,0,0)); // black
|
str += ", msr runNo = ";
|
||||||
|
str += fMusrT0Data.GetRunNo()+1;
|
||||||
|
|
||||||
|
|
||||||
|
// feed raw data histo
|
||||||
|
PRawRunData *rawRunData = fMusrT0Data.GetRawRunData(fMusrT0Data.GetAddRunIdx());
|
||||||
|
if (rawRunData == 0) {
|
||||||
|
fValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Int_t histoNo = fMusrT0Data.GetHistoNo(fMusrT0Data.GetHistoNoIdx())-1;
|
||||||
|
Int_t noOfBins = rawRunData->GetDataBin(histoNo)->size();
|
||||||
|
Double_t start = -0.5;
|
||||||
|
Double_t end = noOfBins - 0.5; // -0.5 is correct since the data start at 0.0
|
||||||
|
fHisto = new TH1F("fHisto", str.Data(), noOfBins, start, end);
|
||||||
|
fHisto->SetMarkerStyle(21);
|
||||||
|
fHisto->SetMarkerSize(0.5);
|
||||||
|
fHisto->SetMarkerColor(TColor::GetColor(0,0,0)); // black
|
||||||
|
|
||||||
|
Double_t maxVal = 0.0;
|
||||||
|
fT0Estimated = 0;
|
||||||
|
for (UInt_t i=0; i<rawRunData->GetDataBin(histoNo)->size(); i++) {
|
||||||
|
fHisto->SetBinContent(i+1, rawRunData->GetDataBin(histoNo)->at(i));
|
||||||
|
if (rawRunData->GetDataBin(histoNo)->at(i) > maxVal) {
|
||||||
|
maxVal = rawRunData->GetDataBin(histoNo)->at(i);
|
||||||
|
fT0Estimated = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
cout << endl << "debug> all t0's:" << endl;
|
||||||
|
for (UInt_t i=0; i<fMusrT0Data.GetT0Size(); i++) {
|
||||||
|
cout << fMusrT0Data.GetT0(i) << ",";
|
||||||
|
}
|
||||||
|
cout << endl << "debug> all addt0's:" << endl;
|
||||||
|
for (UInt_t j=0; j<fMusrT0Data.GetAddT0Entries(); j++) {
|
||||||
|
cout << "debug> j=" << j << endl;
|
||||||
|
for (UInt_t i=0; i<fMusrT0Data.GetAddT0Size(j); i++)
|
||||||
|
cout << fMusrT0Data.GetAddT0(j,i) << ",";
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
*/
|
||||||
|
str = *fMusrT0Data.GetRawRunData(0)->GetRunName() + TString(" : ");
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
str += " forward grouped and runs added";
|
||||||
|
else
|
||||||
|
str += " backward grouped and runs added";
|
||||||
|
str += ", msr runNo = ";
|
||||||
|
str += fMusrT0Data.GetRunNo()+1;
|
||||||
|
|
||||||
|
// feed raw data histo
|
||||||
|
PRawRunData *rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||||
|
if (rawRunData == 0) {
|
||||||
|
fValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get run and first histo of grouping and feed it into fHisto
|
||||||
|
Int_t histoNo = fMusrT0Data.GetHistoNo(0)-1;
|
||||||
|
Int_t noOfBins = rawRunData->GetDataBin(histoNo)->size();
|
||||||
|
Double_t start = -0.5;
|
||||||
|
Double_t end = noOfBins - 0.5; // -0.5 is correct since the data start at 0.0
|
||||||
|
fHisto = new TH1F("fHisto", str.Data(), noOfBins, start, end);
|
||||||
|
fHisto->SetMarkerStyle(21);
|
||||||
|
fHisto->SetMarkerSize(0.5);
|
||||||
|
fHisto->SetMarkerColor(TColor::GetColor(0,0,0)); // black
|
||||||
|
|
||||||
|
// sum up all necessary histograms by taking care of the proper t0's
|
||||||
|
Int_t t00;
|
||||||
|
Int_t t0;
|
||||||
|
Double_t dval;
|
||||||
|
|
||||||
|
// check if asymmetry fit
|
||||||
|
UInt_t factor=1;
|
||||||
|
if (!fMusrT0Data.IsSingleHisto())
|
||||||
|
factor=2;
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t00 = fMusrT0Data.GetT0(0);
|
||||||
|
else
|
||||||
|
t00 = fMusrT0Data.GetT0(1);
|
||||||
|
|
||||||
|
// check if there are addruns and grouping
|
||||||
|
if ((fMusrT0Data.GetRawRunDataSize() > 1) && (fMusrT0Data.GetHistoNoSize() > 1)) { // addruns and grouping present
|
||||||
|
|
||||||
|
for (Int_t i=0; i<noOfBins; i++) { // loop over all entries in fHisto
|
||||||
|
|
||||||
|
dval = 0;
|
||||||
|
|
||||||
|
for (UInt_t k=0; k<fMusrT0Data.GetHistoNoSize(); k++) { // loop over all histograms (grouping)
|
||||||
|
|
||||||
|
histoNo = fMusrT0Data.GetHistoNo(k)-1;
|
||||||
|
|
||||||
|
// get t0
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t0 = fMusrT0Data.GetT0(factor*k);
|
||||||
|
else
|
||||||
|
t0 = fMusrT0Data.GetT0(factor*k+1);
|
||||||
|
|
||||||
|
// get proper rawRunData
|
||||||
|
rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||||
|
|
||||||
|
// get bin value from run/grouping
|
||||||
|
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||||
|
dval += rawRunData->GetDataBin(histoNo)->at(i+t0-t00);
|
||||||
|
|
||||||
|
for (UInt_t j=1; j<fMusrT0Data.GetRawRunDataSize(); j++) { // loop over all potential addruns
|
||||||
|
|
||||||
|
rawRunData = fMusrT0Data.GetRawRunData(j);
|
||||||
|
|
||||||
|
// get t0
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t0 = fMusrT0Data.GetAddT0(j-1, factor*k);
|
||||||
|
else
|
||||||
|
t0 = fMusrT0Data.GetAddT0(j-1, factor*k+1);
|
||||||
|
|
||||||
|
// get bin value from addrun/grouping
|
||||||
|
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||||
|
dval += rawRunData->GetDataBin(histoNo)->at(i+t0-t00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// set bin value of fHisto
|
||||||
|
fHisto->SetBinContent(i+1, dval);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (fMusrT0Data.GetRawRunDataSize() > 1) { // only addruns present
|
||||||
|
|
||||||
|
for (Int_t i=0; i<noOfBins; i++) { // loop over all entries in fHisto
|
||||||
|
|
||||||
|
dval = 0;
|
||||||
|
|
||||||
|
histoNo = fMusrT0Data.GetHistoNo(0)-1;
|
||||||
|
|
||||||
|
// get t0
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t0 = fMusrT0Data.GetT0(0);
|
||||||
|
else
|
||||||
|
t0 = fMusrT0Data.GetT0(1);
|
||||||
|
|
||||||
|
// get proper rawRunData
|
||||||
|
rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||||
|
|
||||||
|
// get bin value from run/grouping
|
||||||
|
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||||
|
dval += rawRunData->GetDataBin(histoNo)->at(i+t0-t00);
|
||||||
|
|
||||||
|
for (UInt_t j=1; j<fMusrT0Data.GetRawRunDataSize(); j++) { // loop over all potential addruns
|
||||||
|
|
||||||
|
// get proper rawRunData
|
||||||
|
rawRunData = fMusrT0Data.GetRawRunData(j);
|
||||||
|
|
||||||
|
// get t0
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t0 = fMusrT0Data.GetAddT0(j-1, 0);
|
||||||
|
else
|
||||||
|
t0 = fMusrT0Data.GetAddT0(j-1, 1);
|
||||||
|
|
||||||
|
// get bin value from addrun/grouping
|
||||||
|
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||||
|
dval += rawRunData->GetDataBin(histoNo)->at(i+t0-t00);
|
||||||
|
}
|
||||||
|
// set bin value of fHisto
|
||||||
|
fHisto->SetBinContent(i+1, dval);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if (fMusrT0Data.GetHistoNoSize() > 1) { // only grouping persent
|
||||||
|
|
||||||
|
for (Int_t i=0; i<noOfBins; i++) { // loop over all entries in fHisto
|
||||||
|
|
||||||
|
dval = 0;
|
||||||
|
|
||||||
|
// get proper rawRunData
|
||||||
|
rawRunData = fMusrT0Data.GetRawRunData(0);
|
||||||
|
|
||||||
|
for (UInt_t k=0; k<fMusrT0Data.GetHistoNoSize(); k++) { // loop over all histograms (grouping)
|
||||||
|
|
||||||
|
histoNo = fMusrT0Data.GetHistoNo(k)-1;
|
||||||
|
|
||||||
|
// get t0
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_FORWARD)
|
||||||
|
t0 = fMusrT0Data.GetT0(factor*k);
|
||||||
|
else
|
||||||
|
t0 = fMusrT0Data.GetT0(factor*k+1);
|
||||||
|
|
||||||
|
// get bin value from run/grouping
|
||||||
|
if ((i+t0-t00 > 0) && (i+t0-t00 < static_cast<Int_t>(rawRunData->GetDataBin(histoNo)->size())))
|
||||||
|
dval += rawRunData->GetDataBin(histoNo)->at(i+t0-t00);
|
||||||
|
|
||||||
|
}
|
||||||
|
// set bin value of fHisto
|
||||||
|
fHisto->SetBinContent(i+1, dval);
|
||||||
|
}
|
||||||
|
|
||||||
Double_t maxVal = 0.0;
|
|
||||||
fT0Estimated = 0;
|
|
||||||
for (UInt_t i=0; i<rawRunData->GetDataBin(histoNo-1)->size(); i++) {
|
|
||||||
fHisto->SetBinContent(i+1, rawRunData->GetDataBin(histoNo-1)->at(i));
|
|
||||||
if (rawRunData->GetDataBin(histoNo-1)->at(i) > maxVal) {
|
|
||||||
maxVal = rawRunData->GetDataBin(histoNo-1)->at(i);
|
|
||||||
fT0Estimated = i;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,13 +487,46 @@ cout << endl << "run Name = " << rawRunData->GetRunName()->Data() << ", runNo =
|
|||||||
fMainCanvas = new TCanvas("fMainCanvas", str);
|
fMainCanvas = new TCanvas("fMainCanvas", str);
|
||||||
fMainCanvas->SetFillColor(TColor::GetColor(255,255,255));
|
fMainCanvas->SetFillColor(TColor::GetColor(255,255,255));
|
||||||
|
|
||||||
|
|
||||||
fMainCanvas->Show();
|
fMainCanvas->Show();
|
||||||
|
|
||||||
fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "PMusrT0",
|
fMainCanvas->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)", "PMusrT0",
|
||||||
this, "HandleCmdKey(Int_t,Int_t,Int_t,TObject*)");
|
this, "HandleCmdKey(Int_t,Int_t,Int_t,TObject*)");
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetCmdTag() != PMUSRT0_GET_T0)
|
||||||
|
fDataAndBkgEnabled = true;
|
||||||
|
else
|
||||||
|
fDataAndBkgEnabled = false;
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetCmdTag() != PMUSRT0_GET_DATA_AND_BKG_RANGE)
|
||||||
|
fT0Enabled = true;
|
||||||
|
else
|
||||||
|
fT0Enabled = false;
|
||||||
|
|
||||||
|
// do not show root statistics block
|
||||||
|
fHisto->SetStats(kFALSE);
|
||||||
|
|
||||||
// draw histos etc
|
// draw histos etc
|
||||||
fHisto->Draw("p0 9 hist");
|
fHisto->Draw("p0 9 hist");
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetCmdTag() == PMUSRT0_GET_T0) {
|
||||||
|
str = "please set t0 bin only.";
|
||||||
|
fToDoInfo = new TLatex();
|
||||||
|
fToDoInfo->SetTextFont(51);
|
||||||
|
fToDoInfo->SetTextSize(0.030);
|
||||||
|
fToDoInfo->SetLineWidth(2);
|
||||||
|
fToDoInfo->SetNDC(kTRUE);
|
||||||
|
fToDoInfo->DrawLatex(0.1, 0.91, str.Data());
|
||||||
|
}
|
||||||
|
if (fMusrT0Data.GetCmdTag() == PMUSRT0_GET_DATA_AND_BKG_RANGE) {
|
||||||
|
str = "please set data and bkg range.";
|
||||||
|
fToDoInfo = new TLatex();
|
||||||
|
fToDoInfo->SetTextFont(51);
|
||||||
|
fToDoInfo->SetTextSize(0.030);
|
||||||
|
fToDoInfo->SetLineWidth(2);
|
||||||
|
fToDoInfo->SetNDC(kTRUE);
|
||||||
|
fToDoInfo->DrawLatex(0.1, 0.91, str.Data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -150,6 +549,10 @@ PMusrT0::~PMusrT0()
|
|||||||
delete fBkg;
|
delete fBkg;
|
||||||
fBkg = 0;
|
fBkg = 0;
|
||||||
}
|
}
|
||||||
|
if (fToDoInfo) {
|
||||||
|
delete fToDoInfo;
|
||||||
|
fToDoInfo = 0;
|
||||||
|
}
|
||||||
if (fT0Line) {
|
if (fT0Line) {
|
||||||
delete fT0Line;
|
delete fT0Line;
|
||||||
fT0Line = 0;
|
fT0Line = 0;
|
||||||
@ -212,6 +615,8 @@ void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
|||||||
Done(0);
|
Done(0);
|
||||||
} else if (x == 'u') { // unzoom to the original range
|
} else if (x == 'u') { // unzoom to the original range
|
||||||
UnZoom();
|
UnZoom();
|
||||||
|
} else if (x == 'z') { // zoom to the region around t0, and the estimated t0
|
||||||
|
ZoomT0();
|
||||||
} else if (x == 'T') { // set estimated t0 channel
|
} else if (x == 'T') { // set estimated t0 channel
|
||||||
SetEstimatedT0Channel();
|
SetEstimatedT0Channel();
|
||||||
} else if (x == 't') { // set t0 channel
|
} else if (x == 't') { // set t0 channel
|
||||||
@ -237,8 +642,50 @@ void PMusrT0::HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected)
|
|||||||
void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
|
void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
|
||||||
{
|
{
|
||||||
fMsrHandler = msrHandler;
|
fMsrHandler = msrHandler;
|
||||||
|
}
|
||||||
|
|
||||||
InitDataAndBkg();
|
//--------------------------------------------------------------------------
|
||||||
|
// InitT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PMusrT0::InitT0()
|
||||||
|
{
|
||||||
|
// t0 line
|
||||||
|
Int_t t0Bin = 0;
|
||||||
|
Int_t histoIdx = fMusrT0Data.GetHistoNoIdx();
|
||||||
|
Int_t addRunIdx = fMusrT0Data.GetAddRunIdx();
|
||||||
|
UInt_t factor=1;
|
||||||
|
if (!fMusrT0Data.IsSingleHisto())
|
||||||
|
factor=2;
|
||||||
|
switch (fMusrT0Data.GetDetectorTag() ) {
|
||||||
|
case PMUSRT0_FORWARD:
|
||||||
|
if (addRunIdx == 0)
|
||||||
|
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0(factor*histoIdx);
|
||||||
|
else if (addRunIdx > 0)
|
||||||
|
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0(addRunIdx-1, factor*histoIdx);
|
||||||
|
break;
|
||||||
|
case PMUSRT0_BACKWARD:
|
||||||
|
if (addRunIdx == 0)
|
||||||
|
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetT0(factor*histoIdx+1);
|
||||||
|
else if (addRunIdx > 0)
|
||||||
|
t0Bin = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetAddT0(addRunIdx-1, factor*histoIdx+1);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// not clear yet what to be done
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Double_t max = fHisto->GetMaximum();
|
||||||
|
|
||||||
|
//cout << "debug-> histoIdx=" << histoIdx << ", addRunIdx=" << addRunIdx << ", t0Bin=" << t0Bin << endl;
|
||||||
|
|
||||||
|
fT0Line = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
|
||||||
|
fT0Line->SetLineStyle(1); // solid
|
||||||
|
fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green
|
||||||
|
fT0Line->SetLineWidth(2);
|
||||||
|
fT0Line->Draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
@ -250,31 +697,15 @@ void PMusrT0::SetMsrHandler(PMsrHandler *msrHandler)
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::InitDataAndBkg()
|
void PMusrT0::InitDataAndBkg()
|
||||||
{
|
{
|
||||||
// get addRun offset which depends on the fit type
|
|
||||||
Int_t fitType = fMsrHandler->GetMsrRunList()->at(fRunNo).GetFitType();
|
|
||||||
if (fitType == MSR_FITTYPE_SINGLE_HISTO) {
|
|
||||||
fAddRunOffset = 2;
|
|
||||||
} else if (fitType == MSR_FITTYPE_ASYM) {
|
|
||||||
fAddRunOffset = 4;
|
|
||||||
} else if (fitType == MSR_FITTYPE_MU_MINUS) {
|
|
||||||
fAddRunOffset = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// feed data range histo
|
// feed data range histo
|
||||||
switch (fDetectorTag) {
|
switch (fMusrT0Data.GetDetectorTag()) {
|
||||||
case DETECTOR_TAG_FORWARD:
|
case PMUSRT0_FORWARD:
|
||||||
fDataRange[0] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetDataRange(0 + fAddRunNo * fAddRunOffset);
|
fDataRange[0] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetDataRange(0);
|
||||||
fDataRange[1] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetDataRange(1 + fAddRunNo * fAddRunOffset);
|
fDataRange[1] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetDataRange(1);
|
||||||
break;
|
break;
|
||||||
case DETECTOR_TAG_BACKWARD:
|
case PMUSRT0_BACKWARD:
|
||||||
fDataRange[0] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetDataRange(2 + fAddRunNo * fAddRunOffset);
|
fDataRange[0] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetDataRange(2);
|
||||||
fDataRange[1] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetDataRange(3 + fAddRunNo * fAddRunOffset);
|
fDataRange[1] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetDataRange(3);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// not clear yet what to be done
|
// not clear yet what to be done
|
||||||
@ -295,20 +726,14 @@ void PMusrT0::InitDataAndBkg()
|
|||||||
fData->Draw("p0 9 hist same");
|
fData->Draw("p0 9 hist same");
|
||||||
|
|
||||||
// feed background histo
|
// feed background histo
|
||||||
switch (fDetectorTag) {
|
switch (fMusrT0Data.GetDetectorTag()) {
|
||||||
case DETECTOR_TAG_FORWARD:
|
case PMUSRT0_FORWARD:
|
||||||
fBkgRange[0] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetBkgRange(0 + fAddRunNo * fAddRunOffset);
|
fBkgRange[0] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetBkgRange(0);
|
||||||
fBkgRange[1] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetBkgRange(1 + fAddRunNo * fAddRunOffset);
|
fBkgRange[1] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetBkgRange(1);
|
||||||
break;
|
break;
|
||||||
case DETECTOR_TAG_BACKWARD:
|
case PMUSRT0_BACKWARD:
|
||||||
fBkgRange[0] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetBkgRange(2 + fAddRunNo * fAddRunOffset);
|
fBkgRange[0] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetBkgRange(2);
|
||||||
fBkgRange[1] = fMsrHandler->GetMsrRunList()->at(fRunNo).GetBkgRange(3 + fAddRunNo * fAddRunOffset);
|
fBkgRange[1] = fMsrHandler->GetMsrRunList()->at(fMusrT0Data.GetRunNo()).GetBkgRange(3);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// not clear yet what to be done
|
// not clear yet what to be done
|
||||||
@ -329,31 +754,7 @@ void PMusrT0::InitDataAndBkg()
|
|||||||
fBkg->Draw("p0 9 hist same");
|
fBkg->Draw("p0 9 hist same");
|
||||||
|
|
||||||
// add lines
|
// add lines
|
||||||
// t0 line
|
|
||||||
Int_t t0Bin = 0;
|
|
||||||
switch (fDetectorTag) {
|
|
||||||
case DETECTOR_TAG_FORWARD:
|
|
||||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fRunNo).GetT0(0 + fAddRunNo * fAddRunOffset/2);
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_BACKWARD:
|
|
||||||
t0Bin = fMsrHandler->GetMsrRunList()->at(fRunNo).GetT0(1 + fAddRunNo * fAddRunOffset/2);
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// not clear yet what to be done
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Double_t max = fHisto->GetMaximum();
|
Double_t max = fHisto->GetMaximum();
|
||||||
fT0Line = new TLine((Double_t)t0Bin, 0.0, (Double_t)t0Bin, max);
|
|
||||||
fT0Line->SetLineStyle(1); // solid
|
|
||||||
fT0Line->SetLineColor(TColor::GetColor(0,255,0)); // green
|
|
||||||
fT0Line->SetLineWidth(2);
|
|
||||||
fT0Line->Draw();
|
|
||||||
|
|
||||||
// data lines
|
// data lines
|
||||||
fFirstDataLine = new TLine((Double_t)fDataRange[0], 0.0, (Double_t)fDataRange[0], max);
|
fFirstDataLine = new TLine((Double_t)fDataRange[0], 0.0, (Double_t)fDataRange[0], max);
|
||||||
@ -393,33 +794,35 @@ void PMusrT0::InitDataAndBkg()
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetT0Channel()
|
void PMusrT0::SetT0Channel()
|
||||||
{
|
{
|
||||||
|
if (!fT0Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
Double_t x=0, y=0;
|
Double_t x=0, y=0;
|
||||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||||
|
|
||||||
// get binx to set t0 corresponding to fPx
|
// get binx to set t0 corresponding to fPx
|
||||||
Int_t binx = fHisto->GetXaxis()->FindFixBin(x) - 1;
|
Int_t binx = fHisto->GetXaxis()->FindFixBin(x) - 1;
|
||||||
|
|
||||||
cout << endl << ">> PMusrT0::SetT0Channel(): binx = " << binx << endl;
|
cout << endl << ">> PMusrT0::SetT0Channel(): t0 = " << binx << endl;
|
||||||
|
|
||||||
// set t0 bin in msr-Handler
|
// set t0 bin in msr-Handler
|
||||||
UInt_t idx = 0;
|
UInt_t idx;
|
||||||
switch(fDetectorTag) {
|
if (fMusrT0Data.IsSingleHisto()) {
|
||||||
case DETECTOR_TAG_FORWARD:
|
idx = fMusrT0Data.GetHistoNoIdx();
|
||||||
idx = fAddRunNo * fAddRunOffset / 2;
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
break;
|
idx += 1;
|
||||||
case DETECTOR_TAG_BACKWARD:
|
} else {
|
||||||
idx = 1 + fAddRunNo * fAddRunOffset / 2;
|
idx = 2*fMusrT0Data.GetHistoNoIdx();
|
||||||
break;
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
case DETECTOR_TAG_LEFT:
|
idx += 1;
|
||||||
idx = 2 + fAddRunNo * fAddRunOffset / 2;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
idx = 3 + fAddRunNo * fAddRunOffset / 2;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
fMsrHandler->SetMsrT0Entry(fRunNo, idx, binx);
|
|
||||||
|
//cout << endl << "debug> SetT0Channel: t0-idx=" << idx << ", t0-value=" << binx;
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetAddRunIdx() == 0)
|
||||||
|
fMsrHandler->SetMsrT0Entry(fMusrT0Data.GetRunNo(), idx, binx);
|
||||||
|
else if (fMusrT0Data.GetAddRunIdx() > 0)
|
||||||
|
fMsrHandler->SetMsrAddT0Entry(fMusrT0Data.GetRunNo(), fMusrT0Data.GetAddRunIdx()-1, idx, binx);
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fT0Line->SetX1(x);
|
fT0Line->SetX1(x);
|
||||||
@ -438,27 +841,29 @@ cout << endl << ">> PMusrT0::SetT0Channel(): binx = " << binx << endl;
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetEstimatedT0Channel()
|
void PMusrT0::SetEstimatedT0Channel()
|
||||||
{
|
{
|
||||||
// set t0 bin in msr-Handler
|
if (!fT0Enabled)
|
||||||
UInt_t idx = 0;
|
return;
|
||||||
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, fT0Estimated);
|
|
||||||
|
|
||||||
Double_t x = fHisto->GetXaxis()->GetBinCenter(fT0Estimated);
|
// set t0 bin in msr-Handler
|
||||||
|
UInt_t idx;
|
||||||
|
if (fMusrT0Data.IsSingleHisto()) {
|
||||||
|
idx = fMusrT0Data.GetHistoNoIdx();
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
|
idx += 1;
|
||||||
|
} else {
|
||||||
|
idx = 2*fMusrT0Data.GetHistoNoIdx();
|
||||||
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
|
idx += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fMusrT0Data.GetAddRunIdx() == 0)
|
||||||
|
fMsrHandler->SetMsrT0Entry(fMusrT0Data.GetRunNo(), idx, fT0Estimated);
|
||||||
|
else if (fMusrT0Data.GetAddRunIdx() > 0)
|
||||||
|
fMsrHandler->SetMsrAddT0Entry(fMusrT0Data.GetRunNo(), fMusrT0Data.GetAddRunIdx()-1, idx, fT0Estimated);
|
||||||
|
|
||||||
|
Double_t x = fHisto->GetXaxis()->GetBinCenter(fT0Estimated)+1.0; // +1.0 needed since the first bin == 1 not 0.
|
||||||
|
|
||||||
|
cout << endl << ">> PMusrT0::SetEstimatedT0Channel(): estimated t0 = " << fT0Estimated << endl;
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fT0Line->SetX1(x);
|
fT0Line->SetX1(x);
|
||||||
@ -477,6 +882,9 @@ void PMusrT0::SetEstimatedT0Channel()
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetDataFirstChannel()
|
void PMusrT0::SetDataFirstChannel()
|
||||||
{
|
{
|
||||||
|
if (!fDataAndBkgEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
Double_t x=0, y=0;
|
Double_t x=0, y=0;
|
||||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||||
|
|
||||||
@ -487,23 +895,9 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa
|
|||||||
|
|
||||||
// set the data first bin in msr-Handler
|
// set the data first bin in msr-Handler
|
||||||
UInt_t idx = 0;
|
UInt_t idx = 0;
|
||||||
switch(fDetectorTag) {
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
case DETECTOR_TAG_FORWARD:
|
idx = 2;
|
||||||
idx = fAddRunNo * fAddRunOffset;
|
fMsrHandler->SetMsrDataRangeEntry(fMusrT0Data.GetRunNo(), idx, fDataRange[0]);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_BACKWARD:
|
|
||||||
idx = 2 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
idx = 4 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
idx = 6 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fMsrHandler->SetMsrDataRangeEntry(fRunNo, idx, fDataRange[0]);
|
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fFirstDataLine->SetX1(x);
|
fFirstDataLine->SetX1(x);
|
||||||
@ -539,6 +933,9 @@ cout << endl << ">> PMusrT0::SetDataFirstChannel(): fDataRange[0] = " << fDataRa
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetDataLastChannel()
|
void PMusrT0::SetDataLastChannel()
|
||||||
{
|
{
|
||||||
|
if (!fDataAndBkgEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
Double_t x=0, y=0;
|
Double_t x=0, y=0;
|
||||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||||
|
|
||||||
@ -548,24 +945,10 @@ void PMusrT0::SetDataLastChannel()
|
|||||||
cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl;
|
cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRange[1] << endl;
|
||||||
|
|
||||||
// set the data first bin in msr-Handler
|
// set the data first bin in msr-Handler
|
||||||
UInt_t idx = 0;
|
UInt_t idx = 1;
|
||||||
switch(fDetectorTag) {
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
case DETECTOR_TAG_FORWARD:
|
idx = 3;
|
||||||
idx = 1 + fAddRunNo * fAddRunOffset;
|
fMsrHandler->SetMsrDataRangeEntry(fMusrT0Data.GetRunNo(), idx, fDataRange[1]);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_BACKWARD:
|
|
||||||
idx = 3 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
idx = 5 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
idx = 7 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fMsrHandler->SetMsrDataRangeEntry(fRunNo, idx, fDataRange[1]);
|
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fLastDataLine->SetX1(x);
|
fLastDataLine->SetX1(x);
|
||||||
@ -601,6 +984,9 @@ cout << endl << ">> PMusrT0::SetDataLastChannel(): fDataRange[1] = " << fDataRan
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetBkgFirstChannel()
|
void PMusrT0::SetBkgFirstChannel()
|
||||||
{
|
{
|
||||||
|
if (!fDataAndBkgEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
Double_t x=0, y=0;
|
Double_t x=0, y=0;
|
||||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||||
|
|
||||||
@ -611,23 +997,9 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange
|
|||||||
|
|
||||||
// set the background first bin in msr-Handler
|
// set the background first bin in msr-Handler
|
||||||
UInt_t idx = 0;
|
UInt_t idx = 0;
|
||||||
switch(fDetectorTag) {
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
case DETECTOR_TAG_FORWARD:
|
idx = 2;
|
||||||
idx = fAddRunNo * fAddRunOffset;
|
fMsrHandler->SetMsrBkgRangeEntry(fMusrT0Data.GetRunNo(), idx, fBkgRange[0]);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_BACKWARD:
|
|
||||||
idx = 2 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
idx = 4 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
idx = 6 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fMsrHandler->SetMsrBkgRangeEntry(fRunNo, idx, fBkgRange[0]);
|
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fFirstBkgLine->SetX1(x);
|
fFirstBkgLine->SetX1(x);
|
||||||
@ -663,6 +1035,9 @@ cout << endl << ">> PMusrT0::SetBkgFirstChannel(): fBkgRange[0] = " << fBkgRange
|
|||||||
*/
|
*/
|
||||||
void PMusrT0::SetBkgLastChannel()
|
void PMusrT0::SetBkgLastChannel()
|
||||||
{
|
{
|
||||||
|
if (!fDataAndBkgEnabled)
|
||||||
|
return;
|
||||||
|
|
||||||
Double_t x=0, y=0;
|
Double_t x=0, y=0;
|
||||||
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
fMainCanvas->AbsPixeltoXY(fPx,fPy,x,y);
|
||||||
|
|
||||||
@ -672,24 +1047,10 @@ void PMusrT0::SetBkgLastChannel()
|
|||||||
cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl;
|
cout << endl << ">> PMusrT0::SetBkgLastChannel(): fBkgRange[1] = " << fBkgRange[1] << endl;
|
||||||
|
|
||||||
// set the background first bin in msr-Handler
|
// set the background first bin in msr-Handler
|
||||||
UInt_t idx = 0;
|
UInt_t idx = 1;
|
||||||
switch(fDetectorTag) {
|
if (fMusrT0Data.GetDetectorTag() == PMUSRT0_BACKWARD)
|
||||||
case DETECTOR_TAG_FORWARD:
|
idx = 3;
|
||||||
idx = 1 + fAddRunNo * fAddRunOffset;
|
fMsrHandler->SetMsrBkgRangeEntry(fMusrT0Data.GetRunNo(), idx, fBkgRange[1]);
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_BACKWARD:
|
|
||||||
idx = 3 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_LEFT:
|
|
||||||
idx = 5 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
case DETECTOR_TAG_RIGHT:
|
|
||||||
idx = 7 + fAddRunNo * fAddRunOffset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fMsrHandler->SetMsrBkgRangeEntry(fRunNo, idx, fBkgRange[1]);
|
|
||||||
|
|
||||||
// shift line to the proper position
|
// shift line to the proper position
|
||||||
fLastBkgLine->SetX1(x);
|
fLastBkgLine->SetX1(x);
|
||||||
@ -731,6 +1092,48 @@ void PMusrT0::UnZoom()
|
|||||||
fMainCanvas->Update();
|
fMainCanvas->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
// ZoomT0
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void PMusrT0::ZoomT0()
|
||||||
|
{
|
||||||
|
if (!fT0Enabled)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const Int_t range = 75;
|
||||||
|
|
||||||
|
// get current t0 position
|
||||||
|
Double_t t0x = fT0Line->GetX1();
|
||||||
|
Int_t t0 = fHisto->GetXaxis()->FindBin(t0x)-1;
|
||||||
|
|
||||||
|
Int_t min = t0 - range;
|
||||||
|
Int_t max = t0 + range;
|
||||||
|
|
||||||
|
// check if t0 is defined at all
|
||||||
|
if (t0 <= 0) {
|
||||||
|
min = fT0Estimated - range;
|
||||||
|
max = fT0Estimated + range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fT0Estimated < min) {
|
||||||
|
min = fT0Estimated - range;
|
||||||
|
}
|
||||||
|
if (fT0Estimated > max) {
|
||||||
|
max = fT0Estimated + range;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cout << endl << "debug> ZoomT0: min=" << min << ", max=" << max << endl;
|
||||||
|
|
||||||
|
fHisto->GetXaxis()->SetRangeUser(min, max);
|
||||||
|
|
||||||
|
fMainCanvas->Modified(); // needed that Update is actually working
|
||||||
|
fMainCanvas->Update();
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
// END
|
// END
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
|
@ -354,8 +354,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: forward t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: backward t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1));
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -394,14 +394,14 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
if (fabs(fRunInfo->GetT0(2*i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) {
|
if (fabs(fRunInfo->GetT0(2*i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) {
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: forward histo #" << i+1;
|
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: forward histo #" << i+1;
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i)+1;
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i)+1;
|
||||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
if (fabs(fRunInfo->GetT0(2*i+1)-runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1))>5.0) { // given in bins!!
|
if (fabs(fRunInfo->GetT0(2*i+1)-runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1))>5.0) { // given in bins!!
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: backward histo #" << i+1;
|
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARNING**: backward histo #" << i+1;
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i+1)+1;
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(2*i+1)+1;
|
||||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1)+1;
|
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetBackwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -447,8 +447,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1));
|
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1));
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunAsymmetry::PrepareData(): **WARRNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> addRun: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> addRun: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1)+1;
|
cerr << endl << ">> will try the estimated one: forward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> will try the estimated one: backward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1)+1;
|
cerr << endl << ">> will try the estimated one: backward t0 = " << addRunData->GetT0Estimated(fRunInfo->GetBackwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -461,7 +461,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
if (fabs(fRunInfo->GetAddT0(i,2*j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
if (fabs(fRunInfo->GetAddT0(i,2*j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j)+1; // +1 since vector starts at 0
|
||||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -469,7 +469,7 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
if (fabs(fRunInfo->GetAddT0(i,2*j+1)-addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1))>5.0) { // given in bins!!
|
if (fabs(fRunInfo->GetAddT0(i,2*j+1)-addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j+1)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,2*j+1)+1; // +1 since vector starts at 0
|
||||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetBackwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -497,8 +497,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
addRunSize = addRunData->GetDataBin(forwardHistoNo[k])->size();
|
addRunSize = addRunData->GetDataBin(forwardHistoNo[k])->size();
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[k])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[k])->size(); j++) {
|
||||||
// make sure that the index stays in the proper range
|
// make sure that the index stays in the proper range
|
||||||
if ((j-t0Add[2*k]+fT0s[2*k] >= 0) && (j-t0Add[2*k]+fT0s[2*k] < addRunSize)) {
|
if ((j+t0Add[2*k]-fT0s[2*k] >= 0) && (j+t0Add[2*k]-fT0s[2*k] < addRunSize)) {
|
||||||
fForward[j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j-t0Add[2*k]+fT0s[2*k]);
|
fForward[j] += addRunData->GetDataBin(forwardHistoNo[k])->at(j+t0Add[2*k]-fT0s[2*k]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -508,8 +508,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
addRunSize = addRunData->GetDataBin(backwardHistoNo[k])->size();
|
addRunSize = addRunData->GetDataBin(backwardHistoNo[k])->size();
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(backwardHistoNo[k])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(backwardHistoNo[k])->size(); j++) {
|
||||||
// make sure that the index stays in the proper range
|
// make sure that the index stays in the proper range
|
||||||
if ((j-t0Add[2*k+1]+fT0s[2*k+1] >= 0) && (j-t0Add[2*k+1]+fT0s[2*k+1] < addRunSize)) {
|
if ((j+t0Add[2*k+1]-fT0s[2*k+1] >= 0) && (j+t0Add[2*k+1]-fT0s[2*k+1] < addRunSize)) {
|
||||||
fBackward[j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j-t0Add[2*k+1]+fT0s[2*k+1]);
|
fBackward[j] += addRunData->GetDataBin(backwardHistoNo[k])->at(j+t0Add[2*k+1]-fT0s[2*k+1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,8 +523,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
for (UInt_t i=1; i<forwardHistoNo.size(); i++) {
|
for (UInt_t i=1; i<forwardHistoNo.size(); i++) {
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[i])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(forwardHistoNo[i])->size(); j++) {
|
||||||
// make sure that the index stays within proper range
|
// make sure that the index stays within proper range
|
||||||
if ((j-fT0s[0]+fT0s[2*i] >= 0) && (j-fT0s[0]+fT0s[2*i] < runData->GetDataBin(forwardHistoNo[i])->size())) {
|
if ((j+fT0s[2*i]-fT0s[0] >= 0) && (j+fT0s[2*i]-fT0s[0] < runData->GetDataBin(forwardHistoNo[i])->size())) {
|
||||||
fForward[j] += runData->GetDataBin(forwardHistoNo[i])->at(j-fT0s[0]+fT0s[2*i]);
|
fForward[j] += runData->GetDataBin(forwardHistoNo[i])->at(j+fT0s[2*i]-fT0s[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,8 +532,8 @@ Bool_t PRunAsymmetry::PrepareData()
|
|||||||
for (UInt_t i=1; i<backwardHistoNo.size(); i++) {
|
for (UInt_t i=1; i<backwardHistoNo.size(); i++) {
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(backwardHistoNo[i])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(backwardHistoNo[i])->size(); j++) {
|
||||||
// make sure that the index stays within proper range
|
// make sure that the index stays within proper range
|
||||||
if ((j-fT0s[1]+fT0s[2*i+1] >= 0) && (j-fT0s[1]+fT0s[2*i+1] < runData->GetDataBin(backwardHistoNo[i])->size())) {
|
if ((j+fT0s[2*i+1]-fT0s[1] >= 0) && (j+fT0s[2*i+1]-fT0s[1] < runData->GetDataBin(backwardHistoNo[i])->size())) {
|
||||||
fBackward[j] += runData->GetDataBin(backwardHistoNo[i])->at(j-fT0s[1]+fT0s[2*i+1]);
|
fBackward[j] += runData->GetDataBin(backwardHistoNo[i])->at(j+fT0s[2*i+1]-fT0s[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -788,6 +788,24 @@ Bool_t PRunAsymmetry::PrepareFitData(PRawRunData* runData, UInt_t histoNo[2])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check that start-t0 is the same for forward as for backward, otherwise take max(start[i]-t0[i])
|
||||||
|
if (fabs(static_cast<Double_t>(start[0])-t0[0]) > fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||||
|
start[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(start[0]) - t0[0]);
|
||||||
|
end[1] = static_cast<Int_t>(t0[1] + static_cast<Double_t>(end[0]) - t0[0]);
|
||||||
|
cerr << endl << ">> PRunAsymmetry::PrepareFitData **WARNING** needed to shift backward data range.";
|
||||||
|
cerr << endl << ">> given: " << fRunInfo->GetDataRange(2) << ", " << fRunInfo->GetDataRange(3);
|
||||||
|
cerr << endl << ">> used : " << start[1] << ", " << end[1];
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
if (fabs(static_cast<Double_t>(start[0])-t0[0]) < fabs(static_cast<Double_t>(start[1])-t0[1])){
|
||||||
|
start[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(start[1]) - t0[1]);
|
||||||
|
end[0] = static_cast<Int_t>(t0[0] + static_cast<Double_t>(end[1]) - t0[1]);
|
||||||
|
cerr << endl << ">> PRunAsymmetry::PrepareFitData **WARNING** needed to shift forward data range.";
|
||||||
|
cerr << endl << ">> given: " << fRunInfo->GetDataRange(0) << ", " << fRunInfo->GetDataRange(1);
|
||||||
|
cerr << endl << ">> used : " << start[0] << ", " << end[0];
|
||||||
|
cerr << endl;
|
||||||
|
}
|
||||||
|
|
||||||
// everything looks fine, hence fill packed forward and backward histo
|
// everything looks fine, hence fill packed forward and backward histo
|
||||||
PRunData forwardPacked;
|
PRunData forwardPacked;
|
||||||
PRunData backwardPacked;
|
PRunData backwardPacked;
|
||||||
@ -919,24 +937,30 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
|||||||
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
Double_t t0[2] = {fT0s[0], fT0s[1]};
|
||||||
// check if data range has been provided, and if not try to estimate them
|
// check if data range has been provided, and if not try to estimate them
|
||||||
if (fRunInfo->GetDataRange(0) < 0) {
|
if (fRunInfo->GetDataRange(0) < 0) {
|
||||||
start[0] = ((Int_t)t0[0]+5) - (((Int_t)t0[0]+5)/packing)*packing;
|
start[0] = (static_cast<Int_t>(t0[0])+5) - ((static_cast<Int_t>(t0[0])+5)/packing)*packing;
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** data range (forward) was not provided, will try data range start = " << start[0] << ".";
|
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** data range (forward) was not provided, will try data range start = " << start[0] << ".";
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
} else if (fRunInfo->GetDataRange(2) < 0) {
|
} else if (fRunInfo->GetDataRange(2) < 0) {
|
||||||
start[1] = ((Int_t)t0[1]+5) - (((Int_t)t0[1]+5)/packing)*packing;
|
start[1] = (static_cast<Int_t>(t0[1])+5) - ((static_cast<Int_t>(t0[1])+5)/packing)*packing;
|
||||||
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** data range (backward) was not provided, will try data range start = " << start[1] << ".";
|
cerr << endl << ">> PRunAsymmetry::PrepareViewData(): **WARNING** data range (backward) was not provided, will try data range start = " << start[1] << ".";
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
cerr << endl << ">> NO WARRANTY THAT THIS DOES MAKE ANY SENSE.";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
} else {
|
} else {
|
||||||
Int_t val = fRunInfo->GetDataRange(0)-packing*(fRunInfo->GetDataRange(0)/packing);
|
// calculate the max(data range start[i]-t0[i])
|
||||||
|
Int_t diff = fRunInfo->GetDataRange(0)-static_cast<Int_t>(t0[0]);
|
||||||
|
if (abs(diff) < abs(fRunInfo->GetDataRange(2)-static_cast<Int_t>(t0[1])))
|
||||||
|
diff = fRunInfo->GetDataRange(0)-static_cast<Int_t>(t0[0]);
|
||||||
|
|
||||||
|
// calculate start position for plotting
|
||||||
|
Int_t val = static_cast<Int_t>(t0[1])+diff-packing*((static_cast<Int_t>(t0[1])+diff)/packing);
|
||||||
do {
|
do {
|
||||||
if (fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0)
|
if (static_cast<Double_t>(val)+t0[1]-t0[0] < 0.0)
|
||||||
val += packing;
|
val += packing;
|
||||||
} while (val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0) < 0);
|
} while (static_cast<Double_t>(val) + t0[1] - t0[0] < 0.0);
|
||||||
|
|
||||||
start[0] = val;
|
start[0] = val;
|
||||||
start[1] = val + fRunInfo->GetDataRange(2) - fRunInfo->GetDataRange(0);
|
start[1] = val + static_cast<Int_t>(t0[1] - t0[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure that there are equal number of rebinned bins in forward and backward
|
// make sure that there are equal number of rebinned bins in forward and backward
|
||||||
@ -1002,6 +1026,7 @@ Bool_t PRunAsymmetry::PrepareViewData(PRawRunData* runData, UInt_t histoNo[2])
|
|||||||
error += fForwardErr[i]*fForwardErr[i];
|
error += fForwardErr[i]*fForwardErr[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// backward
|
// backward
|
||||||
for (Int_t i=start[1]; i<end[1]; i++) {
|
for (Int_t i=start[1]; i<end[1]; i++) {
|
||||||
if (packing == 1) {
|
if (packing == 1) {
|
||||||
|
@ -334,7 +334,7 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -343,13 +343,13 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
for (UInt_t i=0; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||||
// check if enough t0's are given in the msr-file, if not try to get the rest from the data file
|
// check if enough t0's are given in the msr-file, if not try to get the rest from the data file
|
||||||
if (fRunInfo->GetT0Size() <= i) { // t0 for i not present in the msr-file, i.e. #t0's != #forward histos
|
if (fRunInfo->GetT0Size() <= i) { // t0 for i not present in the msr-file, i.e. #t0's != #forward histos
|
||||||
if (runData->GetT0Size() > fRunInfo->GetForwardHistoNo(i)-1) { // t0 for i present in the data file
|
if (static_cast<Int_t>(runData->GetT0Size()) > fRunInfo->GetForwardHistoNo(i)-1) { // t0 for i present in the data file
|
||||||
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1));
|
||||||
} else { // t0 is neither in the run data nor in the msr-file -> will try estimated ones!
|
} else { // t0 is neither in the run data nor in the msr-file -> will try estimated ones!
|
||||||
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
fT0s.push_back(runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1));
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the run data nor in the msr-file!";
|
||||||
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
cerr << endl << ">> run: " << fRunInfo->GetRunName()->Data();
|
||||||
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> will try the estimated one: t0 = " << runData->GetT0Estimated(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -360,8 +360,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
// compare t0's of the msr-file with the one in the data file
|
// compare t0's of the msr-file with the one in the data file
|
||||||
if (fabs(fRunInfo->GetT0(i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) { // given in bins!!
|
if (fabs(fRunInfo->GetT0(i)-runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1))>5.0) { // given in bins!!
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(i)+1;
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetT0(i);
|
||||||
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1)+1;
|
cerr << endl << ">> t0 from the data file is " << runData->GetT0(fRunInfo->GetForwardHistoNo(i)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -407,7 +407,7 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1));
|
t0Add.push_back(addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1));
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data nor in the msr-file!";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING** NO t0's found, neither in the addrun data nor in the msr-file!";
|
||||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||||
cerr << endl << ">> will try the estimated one: t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1)+1;
|
cerr << endl << ">> will try the estimated one: t0 = " << addRunData->GetT0Estimated(fRunInfo->GetForwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
cerr << endl << ">> NO WARRANTY THAT THIS OK!! For instance for LEM this is almost for sure rubbish!";
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
}
|
}
|
||||||
@ -419,8 +419,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
// compare t0's of the msr-file with the one in the data file
|
// compare t0's of the msr-file with the one in the data file
|
||||||
if (fabs(fRunInfo->GetAddT0(i,j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
if (fabs(fRunInfo->GetAddT0(i,j)-addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1))>5.0) { // given in bins!!
|
||||||
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
cerr << endl << ">> PRunSingleHisto::PrepareData(): **WARNING**:";
|
||||||
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,j)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the msr-file is " << fRunInfo->GetAddT0(i,j);
|
||||||
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1)+1; // +1 since vector starts at 0
|
cerr << endl << ">> t0 from the data file is " << addRunData->GetT0(fRunInfo->GetForwardHistoNo(j)-1);
|
||||||
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
cerr << endl << ">> This is quite a deviation! Is this done intentionally??";
|
||||||
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
cerr << endl << ">> addrun: " << fRunInfo->GetRunName(i)->Data();
|
||||||
cerr << endl;
|
cerr << endl;
|
||||||
@ -444,8 +444,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
for (UInt_t k=0; k<fRunInfo->GetForwardHistoNoSize(); k++) {
|
for (UInt_t k=0; k<fRunInfo->GetForwardHistoNoSize(); k++) {
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[k])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(histoNo[k])->size(); j++) {
|
||||||
// make sure that the index stays within proper range
|
// make sure that the index stays within proper range
|
||||||
if ((j-t0Add[k]+fT0s[k] >= 0) && (j-t0Add[k]+fT0s[k] < addRunData->GetDataBin(histoNo[k])->size())) {
|
if ((j+t0Add[k]-fT0s[k] >= 0) && (j+t0Add[k]-fT0s[k] < addRunData->GetDataBin(histoNo[k])->size())) {
|
||||||
runData->AddDataBin(histoNo[k], j, addRunData->GetDataBin(histoNo[k])->at(j-t0Add[k]+fT0s[k]));
|
runData->AddDataBin(histoNo[k], j, addRunData->GetDataBin(histoNo[k])->at(j+t0Add[k]-fT0s[k]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -459,8 +459,8 @@ Bool_t PRunSingleHisto::PrepareData()
|
|||||||
for (UInt_t i=1; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
for (UInt_t i=1; i<fRunInfo->GetForwardHistoNoSize(); i++) {
|
||||||
for (UInt_t j=0; j<runData->GetDataBin(histoNo[0])->size(); j++) {
|
for (UInt_t j=0; j<runData->GetDataBin(histoNo[0])->size(); j++) {
|
||||||
// make sure that the index stays within proper range
|
// make sure that the index stays within proper range
|
||||||
if ((j-fT0s[0]+fT0s[i] >= 0) && (j-fT0s[0]+fT0s[i] < runData->GetDataBin(histoNo[i])->size())) {
|
if ((j+fT0s[i]-fT0s[0] >= 0) && (j+fT0s[i]-fT0s[0] < runData->GetDataBin(histoNo[i])->size())) {
|
||||||
runData->AddDataBin(histoNo[0], j, runData->GetDataBin(histoNo[i])->at(j-fT0s[0]+fT0s[i]));
|
runData->AddDataBin(histoNo[0], j, runData->GetDataBin(histoNo[i])->at(j+fT0s[i]-fT0s[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,7 @@ class PMsrHandler
|
|||||||
virtual Bool_t SetMsrParamPosError(UInt_t i, Double_t value);
|
virtual Bool_t SetMsrParamPosError(UInt_t i, Double_t value);
|
||||||
|
|
||||||
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin);
|
virtual void SetMsrT0Entry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||||
|
virtual void SetMsrAddT0Entry(UInt_t runNo, UInt_t addRunIdx, UInt_t histoIdx, Int_t bin);
|
||||||
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
virtual void SetMsrDataRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||||
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
virtual void SetMsrBkgRangeEntry(UInt_t runNo, UInt_t idx, Int_t bin);
|
||||||
|
|
||||||
|
@ -40,12 +40,76 @@
|
|||||||
#include <TCanvas.h>
|
#include <TCanvas.h>
|
||||||
#include <TH1.h>
|
#include <TH1.h>
|
||||||
#include <TLine.h>
|
#include <TLine.h>
|
||||||
|
#include <TLatex.h>
|
||||||
|
|
||||||
#include "PMusr.h"
|
#include "PMusr.h"
|
||||||
#ifndef __MAKECINT__
|
#ifndef __MAKECINT__
|
||||||
#include "PMsrHandler.h"
|
#include "PMsrHandler.h"
|
||||||
#endif // __MAKECINT__
|
#endif // __MAKECINT__
|
||||||
|
|
||||||
|
#define PMUSRT0_FORWARD 0
|
||||||
|
#define PMUSRT0_BACKWARD 1
|
||||||
|
|
||||||
|
#define PMUSRT0_GET_T0 0
|
||||||
|
#define PMUSRT0_GET_DATA_AND_BKG_RANGE 1
|
||||||
|
#define PMUSRT0_GET_T0_DATA_AND_BKG_RANGE 2
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define PMUSRT0_NOADDRUN_NOGROUPING 0
|
||||||
|
#define PMUSRT0_ADDRUN_NOGROUPING 1
|
||||||
|
#define PMUSRT0_NOADDRUN_GROUPING 2
|
||||||
|
#define PMUSRT0_ADDRUN_GROUPING 3
|
||||||
|
*/
|
||||||
|
|
||||||
|
class PMusrT0Data {
|
||||||
|
public:
|
||||||
|
PMusrT0Data();
|
||||||
|
virtual ~PMusrT0Data();
|
||||||
|
|
||||||
|
|
||||||
|
virtual void InitData();
|
||||||
|
|
||||||
|
virtual Bool_t IsSingleHisto() { return fSingleHisto; }
|
||||||
|
virtual UInt_t GetRawRunDataSize() { return fRawRunData.size(); }
|
||||||
|
virtual PRawRunData* GetRawRunData(Int_t idx);
|
||||||
|
virtual Int_t GetRunNo() { return fRunNo; }
|
||||||
|
virtual Int_t GetAddRunIdx() { return fAddRunIdx; }
|
||||||
|
virtual Int_t GetHistoNoIdx() { return fHistoNoIdx; }
|
||||||
|
virtual UInt_t GetHistoNoSize() { return fHistoNo.size(); }
|
||||||
|
virtual Int_t GetHistoNo(UInt_t idx);
|
||||||
|
virtual Int_t GetDetectorTag() { return fDetectorTag; }
|
||||||
|
virtual Int_t GetCmdTag() { return fCmdTag; }
|
||||||
|
virtual UInt_t GetT0Size() { return fT0.size(); }
|
||||||
|
virtual Int_t GetT0(UInt_t idx);
|
||||||
|
virtual UInt_t GetAddT0Entries() { return fAddT0.size(); }
|
||||||
|
virtual UInt_t GetAddT0Size(UInt_t idx);
|
||||||
|
virtual Int_t GetAddT0(UInt_t addRunIdx, UInt_t idx);
|
||||||
|
|
||||||
|
virtual void SetSingleHisto(const Bool_t flag) { fSingleHisto = flag; }
|
||||||
|
virtual void SetRawRunData(const vector<PRawRunData*> rawRunData) { fRawRunData = rawRunData; }
|
||||||
|
virtual void SetRunNo(const UInt_t runNo) { fRunNo = runNo; }
|
||||||
|
virtual void SetAddRunIdx(const UInt_t addRunIdx) { fAddRunIdx = addRunIdx; }
|
||||||
|
virtual void SetHistoNoIdx(const UInt_t histoNoIdx) { fHistoNoIdx = histoNoIdx; }
|
||||||
|
virtual void SetHistoNo(const PIntVector histoNo) { fHistoNo = histoNo; }
|
||||||
|
virtual void SetDetectorTag(const UInt_t detectorTag) { fDetectorTag = detectorTag; }
|
||||||
|
virtual void SetCmdTag(const UInt_t cmdTag) { fCmdTag = cmdTag; }
|
||||||
|
virtual void SetT0(UInt_t val, UInt_t idx);
|
||||||
|
virtual void SetAddT0(UInt_t val, UInt_t addRunIdx, UInt_t idx);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Bool_t fSingleHisto; ///< true if single histo fit, false for asymmetry fit
|
||||||
|
vector<PRawRunData*> fRawRunData; ///< holds the raw data of the needed runs, idx=0 the run, idx>0 the addruns
|
||||||
|
Int_t fRunNo; ///< msr-file run number
|
||||||
|
Int_t fAddRunIdx; ///< msr-file addrun index
|
||||||
|
Int_t fHistoNoIdx; ///< msr-file histo number index
|
||||||
|
PIntVector fHistoNo; ///< msr-file histo numbers
|
||||||
|
Int_t fDetectorTag; ///< detector tag. forward=0,backward=1
|
||||||
|
Int_t fCmdTag; ///< command tag. 0=get t0, 1=get data-/bkg-range, 2=get t0, and data-/bkg-range
|
||||||
|
PIntVector fT0; ///< holding the t0's of the run
|
||||||
|
vector<PIntVector> fAddT0; ///< holding the t0's of the addruns
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>The preprocessor tag __MAKECINT__ is used to hide away from rootcint
|
* <p>The preprocessor tag __MAKECINT__ is used to hide away from rootcint
|
||||||
@ -55,10 +119,12 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PMusrT0();
|
PMusrT0();
|
||||||
PMusrT0(PRawRunData *rawRunData, Int_t runNo, Int_t histoNo, Int_t detectorTag, Int_t addRunNo);
|
PMusrT0(PMusrT0Data &data);
|
||||||
|
|
||||||
virtual ~PMusrT0();
|
virtual ~PMusrT0();
|
||||||
|
|
||||||
|
virtual Bool_t IsValid() { return fValid; }
|
||||||
|
|
||||||
virtual void Done(Int_t status=0); // *SIGNAL*
|
virtual void Done(Int_t status=0); // *SIGNAL*
|
||||||
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
|
virtual void HandleCmdKey(Int_t event, Int_t x, Int_t y, TObject *selected); // SLOT
|
||||||
|
|
||||||
@ -66,6 +132,8 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
virtual void SetMsrHandler(PMsrHandler *msrHandler);
|
virtual void SetMsrHandler(PMsrHandler *msrHandler);
|
||||||
#endif // __MAKECINT__
|
#endif // __MAKECINT__
|
||||||
|
|
||||||
|
virtual void InitT0();
|
||||||
|
virtual void InitDataAndBkg();
|
||||||
virtual Int_t GetStatus() { return fStatus; }
|
virtual Int_t GetStatus() { return fStatus; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -73,13 +141,15 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
PMsrHandler *fMsrHandler;
|
PMsrHandler *fMsrHandler;
|
||||||
#endif // __MAKECINT__
|
#endif // __MAKECINT__
|
||||||
|
|
||||||
|
Bool_t fValid;
|
||||||
|
|
||||||
Int_t fStatus;
|
Int_t fStatus;
|
||||||
|
|
||||||
Int_t fRunNo;
|
PMusrT0Data fMusrT0Data;
|
||||||
Int_t fDetectorTag;
|
|
||||||
Int_t fAddRunNo;
|
Bool_t fDataAndBkgEnabled;
|
||||||
Int_t fAddRunOffset;
|
Bool_t fT0Enabled;
|
||||||
Int_t fT0Estimated;
|
Int_t fT0Estimated;
|
||||||
|
|
||||||
// canvas related variables
|
// canvas related variables
|
||||||
TCanvas *fMainCanvas;
|
TCanvas *fMainCanvas;
|
||||||
@ -88,6 +158,8 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
TH1F *fData;
|
TH1F *fData;
|
||||||
TH1F *fBkg;
|
TH1F *fBkg;
|
||||||
|
|
||||||
|
TLatex *fToDoInfo;
|
||||||
|
|
||||||
TLine *fT0Line;
|
TLine *fT0Line;
|
||||||
TLine *fFirstBkgLine;
|
TLine *fFirstBkgLine;
|
||||||
TLine *fLastBkgLine;
|
TLine *fLastBkgLine;
|
||||||
@ -100,7 +172,6 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
Int_t fDataRange[2];
|
Int_t fDataRange[2];
|
||||||
Int_t fBkgRange[2];
|
Int_t fBkgRange[2];
|
||||||
|
|
||||||
void InitDataAndBkg();
|
|
||||||
void SetT0Channel();
|
void SetT0Channel();
|
||||||
void SetEstimatedT0Channel();
|
void SetEstimatedT0Channel();
|
||||||
void SetDataFirstChannel();
|
void SetDataFirstChannel();
|
||||||
@ -108,6 +179,7 @@ class PMusrT0 : public TObject, public TQObject
|
|||||||
void SetBkgFirstChannel();
|
void SetBkgFirstChannel();
|
||||||
void SetBkgLastChannel();
|
void SetBkgLastChannel();
|
||||||
void UnZoom();
|
void UnZoom();
|
||||||
|
void ZoomT0();
|
||||||
|
|
||||||
ClassDef(PMusrT0, 1)
|
ClassDef(PMusrT0, 1)
|
||||||
};
|
};
|
||||||
|
395
src/musrt0.cpp
395
src/musrt0.cpp
@ -47,7 +47,6 @@ using namespace std;
|
|||||||
#include "PRunDataHandler.h"
|
#include "PRunDataHandler.h"
|
||||||
#include "PMusrT0.h"
|
#include "PMusrT0.h"
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -69,36 +68,46 @@ void musrt0_syntax()
|
|||||||
*
|
*
|
||||||
* \param app
|
* \param app
|
||||||
* \param msrHandler
|
* \param msrHandler
|
||||||
* \param rawRunData
|
* \param data
|
||||||
* \param runNo
|
|
||||||
* \param histoNo
|
|
||||||
* \param detectorTag 0=forward, 1=backward, 2=left, 3=right
|
|
||||||
* \param addRunNo
|
|
||||||
*/
|
*/
|
||||||
bool musrt0_item(TApplication &app, PMsrHandler *msrHandler, PRawRunData *rawRunData,
|
Bool_t musrt0_item(TApplication &app, PMsrHandler *msrHandler, PMusrT0Data &data, UInt_t idx)
|
||||||
unsigned int runNo, int histoNo, int detectorTag, int addRunNo)
|
|
||||||
{
|
{
|
||||||
PMusrT0 *musrT0 = new PMusrT0(rawRunData, runNo, histoNo, detectorTag, addRunNo);
|
//cout << endl << "debug> &app=" << &app << ", msrHandler=" << msrHandler << ", &data=" << &data << endl;
|
||||||
|
|
||||||
|
PMusrT0 *musrT0 = new PMusrT0(data);
|
||||||
|
|
||||||
if (musrT0 == 0) {
|
if (musrT0 == 0) {
|
||||||
cout << endl << "**ERROR** Couldn't invoke musrT0 ...";
|
cerr << endl << ">> **ERROR** Couldn't invoke musrT0 ...";
|
||||||
cout << endl << " run name " << rawRunData->GetRunName()->Data();
|
cerr << endl << ">> run name " << data.GetRawRunData(idx)->GetRunName()->Data();
|
||||||
cout << endl << " histo No " << histoNo;
|
cerr << endl;
|
||||||
cout << endl;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!musrT0->IsValid()) {
|
||||||
|
cerr << endl << ">> **ERROR** invalid item found! (idx=" << idx << ")";
|
||||||
|
cerr << endl;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
musrT0->SetMsrHandler(msrHandler);
|
musrT0->SetMsrHandler(msrHandler);
|
||||||
|
|
||||||
|
if (data.GetCmdTag() != PMUSRT0_GET_DATA_AND_BKG_RANGE)
|
||||||
|
musrT0->InitT0();
|
||||||
|
|
||||||
|
if (data.GetCmdTag() != PMUSRT0_GET_T0)
|
||||||
|
musrT0->InitDataAndBkg();
|
||||||
|
|
||||||
musrT0->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)");
|
musrT0->Connect("Done(Int_t)", "TApplication", &app, "Terminate(Int_t)");
|
||||||
|
|
||||||
app.Run(true); // true needed that Run will return after quit
|
app.Run(true); // true needed that Run will return after quit
|
||||||
bool result = true;
|
Bool_t result = true;
|
||||||
if (musrT0->GetStatus() == 1)
|
if (musrT0->GetStatus() == 1)
|
||||||
result = false;
|
result = false;
|
||||||
else
|
else
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
|
musrT0->Disconnect(musrT0);
|
||||||
|
|
||||||
delete musrT0;
|
delete musrT0;
|
||||||
musrT0 = 0;
|
musrT0 = 0;
|
||||||
|
|
||||||
@ -131,12 +140,12 @@ void musrt0_cleanup(TSAXParser *saxParser, PStartupHandler *startupHandler, PMsr
|
|||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------
|
//--------------------------------------------------------------------------
|
||||||
int main(int argc, char *argv[])
|
Int_t main(Int_t argc, Char_t *argv[])
|
||||||
{
|
{
|
||||||
bool show_syntax = false;
|
Bool_t show_syntax = false;
|
||||||
int status;
|
Int_t status;
|
||||||
bool success = true;
|
Bool_t success = true;
|
||||||
char filename[1024];
|
Char_t filename[1024];
|
||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
case 1:
|
case 1:
|
||||||
@ -169,7 +178,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
// read startup file
|
// read startup file
|
||||||
char startup_path_name[128];
|
Char_t startup_path_name[128];
|
||||||
TSAXParser *saxParser = new TSAXParser();
|
TSAXParser *saxParser = new TSAXParser();
|
||||||
PStartupHandler *startupHandler = new PStartupHandler();
|
PStartupHandler *startupHandler = new PStartupHandler();
|
||||||
if (!startupHandler->StartupFileFound()) {
|
if (!startupHandler->StartupFileFound()) {
|
||||||
@ -225,7 +234,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// check if the fittype is not NonMusr
|
// check if the fittype is not NonMusr
|
||||||
PMsrRunList *runList = msrHandler->GetMsrRunList();
|
PMsrRunList *runList = msrHandler->GetMsrRunList();
|
||||||
for (unsigned int i=0; i<runList->size(); i++) {
|
for (UInt_t i=0; i<runList->size(); i++) {
|
||||||
if (runList->at(i).GetFitType() == MSR_FITTYPE_NON_MUSR) {
|
if (runList->at(i).GetFitType() == MSR_FITTYPE_NON_MUSR) {
|
||||||
cout << endl << "**ERROR** t0 setting for NonMusr fittype doesn't make any sense, will quit ..." << endl;
|
cout << endl << "**ERROR** t0 setting for NonMusr fittype doesn't make any sense, will quit ..." << endl;
|
||||||
success = false;
|
success = false;
|
||||||
@ -248,59 +257,349 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// set t0's, data-range and bkg-range. There are 4 different cases, namely:
|
||||||
|
// 1. no addruns / no grouping of histos
|
||||||
|
// 2. addruns / no grouping of histos
|
||||||
|
// 3. no addruns / grouping of histos
|
||||||
|
// 4. addruns / grouping of histos
|
||||||
|
// case 1 is different form the others since t0, data-, and bkg-range can be collected for the given histogram
|
||||||
|
// cases 2-4 the procedure will be the following:
|
||||||
|
// 1) set for each given histogram the t0's
|
||||||
|
// 2) build the added up histogram, i.e. add all runs and/or histograms for the msr-run.
|
||||||
|
// 3) set the data-, and bkg-range
|
||||||
if (success) {
|
if (success) {
|
||||||
// generate Root application needed for PMusrCanvas
|
// generate Root application needed for PMusrCanvas
|
||||||
TApplication app("App", &argc, argv);
|
TApplication app("App", &argc, argv);
|
||||||
|
|
||||||
|
PMusrT0Data musrT0Data;
|
||||||
|
vector<PRawRunData*> rawRunData;
|
||||||
|
PIntVector forwardHistos;
|
||||||
|
PIntVector backwardHistos;
|
||||||
// generate vector of all necessary PMusrT0 objects
|
// generate vector of all necessary PMusrT0 objects
|
||||||
for (unsigned int i=0; i<runList->size(); i++) {
|
for (UInt_t i=0; i<runList->size(); i++) {
|
||||||
switch (runList->at(i).GetFitType()) {
|
switch (runList->at(i).GetFitType()) {
|
||||||
case MSR_FITTYPE_SINGLE_HISTO:
|
case MSR_FITTYPE_SINGLE_HISTO:
|
||||||
for (unsigned int j=0; j<runList->at(i).GetRunNameSize(); j++) { // necessary in case of ADDRUN
|
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetForwardHistoNo(), 0, j)) {
|
// feed necessary data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(true);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetAddRunIdx(0); // no addruns
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
forwardHistos.clear();
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
|
// execute cmd
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// get t0's
|
||||||
|
if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // addruns / no grouping
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(true);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
forwardHistos.clear();
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) { // no addruns / grouping
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(true);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
forwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetAddRunIdx(0);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
|
||||||
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // addruns / grouping
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(true);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
forwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) { // addrun / grouping
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) { // forward histo grouping
|
||||||
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// get data- and bkg-range
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_DATA_AND_BKG_RANGE);
|
||||||
|
// feed all t0's
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetT0Size(); j++) {
|
||||||
|
musrT0Data.SetT0(runList->at(i).GetT0(j), j);
|
||||||
|
for (UInt_t k=0; k<runList->at(i).GetAddT0Entries(); k++) {
|
||||||
|
musrT0Data.SetAddT0(runList->at(i).GetAddT0(k, j), k, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSR_FITTYPE_ASYM:
|
case MSR_FITTYPE_ASYM:
|
||||||
for (unsigned int j=0; j<runList->at(i).GetRunNameSize(); j++) { // necessary in case of ADDRUN
|
if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // no addruns / no grouping
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetForwardHistoNo(), 0, j)) {
|
// feed necessary data forward
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetAddRunIdx(0); // no addruns
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
forwardHistos.clear();
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
|
// execute cmd
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetBackwardHistoNo(), 1, j)) {
|
// feed necessary data backward
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetAddRunIdx(0); // no addruns
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
backwardHistos.clear();
|
||||||
|
backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0_DATA_AND_BKG_RANGE);
|
||||||
|
// execute cmd
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// get t0's
|
||||||
|
if ((runList->at(i).GetRunNameSize() > 1) && (runList->at(i).GetForwardHistoNoSize() == 1)) { // addruns / no grouping
|
||||||
|
// feed necessary forward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
forwardHistos.clear();
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// feed necessary backward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
musrT0Data.SetHistoNoIdx(0);
|
||||||
|
backwardHistos.clear();
|
||||||
|
backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(0));
|
||||||
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) {
|
||||||
|
// feed necessary data
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((runList->at(i).GetRunNameSize() == 1) && (runList->at(i).GetForwardHistoNoSize() > 1)) { // no addruns / grouping
|
||||||
|
// feed necessary forward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
forwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetAddRunIdx(0);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++) {
|
||||||
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// feed necessary backward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
backwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++)
|
||||||
|
backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(0))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
musrT0Data.SetAddRunIdx(0);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++) {
|
||||||
|
musrT0Data.SetHistoNoIdx(j);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // addruns / grouping
|
||||||
|
// feed necessary forward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
forwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetForwardHistoNoSize(); j++)
|
||||||
|
forwardHistos.push_back(runList->at(i).GetForwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) { // addrun / grouping
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
for (UInt_t k=0; k<runList->at(i).GetForwardHistoNoSize(); k++) { // forward histo grouping
|
||||||
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// feed necessary backward data
|
||||||
|
musrT0Data.InitData();
|
||||||
|
musrT0Data.SetSingleHisto(false);
|
||||||
|
musrT0Data.SetRunNo(i);
|
||||||
|
backwardHistos.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetBackwardHistoNoSize(); j++)
|
||||||
|
backwardHistos.push_back(runList->at(i).GetBackwardHistoNo(j));
|
||||||
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_T0);
|
||||||
|
rawRunData.clear();
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++)
|
||||||
|
rawRunData.push_back(dataHandler->GetRunData(*(runList->at(i).GetRunName(j))));
|
||||||
|
musrT0Data.SetRawRunData(rawRunData);
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetRunNameSize(); j++) { // addrun / grouping
|
||||||
|
musrT0Data.SetAddRunIdx(j); // addruns
|
||||||
|
for (UInt_t k=0; k<runList->at(i).GetBackwardHistoNoSize(); k++) { // backward histo grouping
|
||||||
|
musrT0Data.SetHistoNoIdx(k);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, j)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// get data- and bkg-range
|
||||||
|
musrT0Data.SetCmdTag(PMUSRT0_GET_DATA_AND_BKG_RANGE);
|
||||||
|
// feed all t0's
|
||||||
|
for (UInt_t j=0; j<runList->at(i).GetT0Size(); j++) {
|
||||||
|
musrT0Data.SetT0(runList->at(i).GetT0(j), j);
|
||||||
|
for (UInt_t k=0; k<runList->at(i).GetAddT0Entries(); k++) {
|
||||||
|
musrT0Data.SetAddT0(runList->at(i).GetAddT0(k, j), k, j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
musrT0Data.SetHistoNo(forwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_FORWARD);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
musrT0Data.SetHistoNo(backwardHistos);
|
||||||
|
musrT0Data.SetDetectorTag(PMUSRT0_BACKWARD);
|
||||||
|
if (!musrt0_item(app, msrHandler, musrT0Data, 0)) {
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MSR_FITTYPE_MU_MINUS:
|
case MSR_FITTYPE_MU_MINUS:
|
||||||
/*
|
|
||||||
for (unsigned int j=0; j<runList->at(i).GetRunNameSize(); j++) { // necessary in case of ADDRUN
|
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetForwardHistoNo(), 0, j)) {
|
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetBackwardHistoNo(), 1, j)) {
|
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetRightHistoNo(), 2, j)) {
|
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
if (!musrt0_item(app, msrHandler, dataHandler->GetRunData(*(runList->at(i).GetRunName(j))), i, runList->at(i).GetLeftHistoNo(), 3, j)) {
|
|
||||||
musrt0_cleanup(saxParser, startupHandler, msrHandler, dataHandler);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// cleanup
|
||||||
|
rawRunData.clear();
|
||||||
|
forwardHistos.clear();
|
||||||
|
backwardHistos.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// write msr-file
|
// write msr-file
|
||||||
@ -311,7 +610,7 @@ int main(int argc, char *argv[])
|
|||||||
gSystem->CopyFile(filename, "__temp.msr", kTRUE);
|
gSystem->CopyFile(filename, "__temp.msr", kTRUE);
|
||||||
// copy mlog-file -> msr-file
|
// copy mlog-file -> msr-file
|
||||||
TString fln = TString(filename);
|
TString fln = TString(filename);
|
||||||
char ext[32];
|
Char_t ext[32];
|
||||||
strcpy(ext, ".mlog");
|
strcpy(ext, ".mlog");
|
||||||
fln.ReplaceAll(".msr", 4, ext, strlen(ext));
|
fln.ReplaceAll(".msr", 4, ext, strlen(ext));
|
||||||
gSystem->CopyFile(fln.Data(), filename, kTRUE);
|
gSystem->CopyFile(fln.Data(), filename, kTRUE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user