From a8043ce89cb28335ce8bd8e5b085eb36b786fd4d Mon Sep 17 00:00:00 2001 From: nemu Date: Wed, 12 May 2010 13:10:22 +0000 Subject: [PATCH] massive cleanup --- src/classes/PMsrHandler.cpp | 139 +----------------------------------- src/classes/PMusr.cpp | 138 ----------------------------------- src/include/PMusr.h | 10 --- 3 files changed, 2 insertions(+), 285 deletions(-) diff --git a/src/classes/PMsrHandler.cpp b/src/classes/PMsrHandler.cpp index ee5aa70c..5f661f83 100644 --- a/src/classes/PMsrHandler.cpp +++ b/src/classes/PMsrHandler.cpp @@ -342,8 +342,6 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } // add some counters needed in connection to addruns - Int_t addForwardHistoNoCounter = 0; - Int_t addBackwardHistoNoCounter = 0; Int_t addT0Counter = 0; ifstream fin; @@ -429,10 +427,7 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) tag = MSR_TAG_RUN; runNo++; - // reset addrun helper counters - addForwardHistoNoCounter = 0; - addBackwardHistoNoCounter = 0; - addT0Counter = 0; + addT0Counter = 0; // reset counter } else if (str.BeginsWith("COMMANDS")) { // COMMANDS block tag tag = MSR_TAG_COMMANDS; fout << str.Data() << endl; @@ -669,23 +664,6 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } fout << endl; } - } else if (sstr.BeginsWith("addforward")) { - if (fRuns[runNo].GetAddForwardHistoNoSize(addForwardHistoNoCounter) <= 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addforward' tag without any data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; - } else if (addForwardHistoNoCounter >= fRuns[runNo].GetAddForwardHistoNoSize(addForwardHistoNoCounter)) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** More 'addforward' tags present than addforward data!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; - } else { - fout.width(16); - fout << left << "addforward"; - for (Int_t i=0; i> PMsrHandler::WriteMsrLogFile: **WARNING** 'backward' tag without any data found!"; @@ -699,23 +677,6 @@ Int_t PMsrHandler::WriteMsrLogFile(const Bool_t messages) } fout << endl; } - } else if (sstr.BeginsWith("addbackward")) { - if (fRuns[runNo].GetAddBackwardHistoNoSize(addBackwardHistoNoCounter) <= 0) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** 'addbackward' tag without any data found!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; - } else if (addBackwardHistoNoCounter >= fRuns[runNo].GetAddBackwardHistoNoSize(addBackwardHistoNoCounter)) { - cerr << endl << ">> PMsrHandler::WriteMsrLogFile: **WARNING** More 'addbackward' tags present than addbackward data!"; - cerr << endl << ">> Something is VERY fishy, please check your msr-file carfully." << endl; - } else { - fout.width(16); - fout << left << "addbackward"; - for (Int_t i=0; ifLine.BeginsWith("addforward", TString::kIgnoreCase)) { - - runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following - - if (tokens->GetEntries() < 2) { - error = true; - } else { - for (Int_t i=1; iGetEntries(); i++) { - ostr = dynamic_cast(tokens->At(i)); - str = ostr->GetString(); - if (str.IsDigit()) { - ival = str.Atoi(); - if (ival > 0) - param.SetAddForwardHistoNo(ival, addForwardHistoNoCounter, i-1); - else - error = true; - } else { - error = true; - } - } - } - - addForwardHistoNoCounter++; - } - // backward ----------------------------------------------- if (iter->fLine.BeginsWith("backward", TString::kIgnoreCase)) { @@ -1971,32 +1900,6 @@ Bool_t PMsrHandler::HandleRunEntry(PMsrLines &lines) } } - // addbackward --------------------------------------------- - if (iter->fLine.BeginsWith("addbackward", TString::kIgnoreCase)) { - - runLinePresent = false; // this is needed to make sure that a run line is present before and ADDRUN is following - - if (tokens->GetEntries() < 2) { - error = true; - } else { - for (Int_t i=1; iGetEntries(); i++) { - ostr = dynamic_cast(tokens->At(i)); - str = ostr->GetString(); - if (str.IsDigit()) { - ival = str.Atoi(); - if (ival > 0) - param.SetAddBackwardHistoNo(ival, addBackwardHistoNoCounter, i-1); - else - error = true; - } else { - error = true; - } - } - } - - addBackwardHistoNoCounter++; - } - // backgr.fix ---------------------------------------------- if (iter->fLine.BeginsWith("backgr.fix", TString::kIgnoreCase)) { @@ -3827,35 +3730,6 @@ Bool_t PMsrHandler::CheckAddRunParameters() for (UInt_t i=0; i 1) { - // checks concerning forward <-> backward, addforward <-> addbackward - if (fRuns[i].GetAddForwardHistoNoEntries() != 0) { // addforward given, make some consistency checks - if (fRuns[i].GetRunNameSize()-1 != fRuns[i].GetAddForwardHistoNoEntries()) { - cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addruns != # of addforwards found."; - cerr << endl << ">> Run #" << i+1; - cerr << endl; - result = false; - break; - } - if (fRuns[i].GetFitType() == MSR_FITTYPE_ASYM) { - if (fRuns[i].GetAddForwardHistoNoEntries() != fRuns[i].GetAddBackwardHistoNoEntries()) { - cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addforward entries != # of addbackward entries."; - cerr << endl << ">> Run #" << i+1; - cerr << endl; - result = false; - break; - } - } - for (UInt_t j=0; j(fRuns[i].GetForwardHistoNoSize())) { - cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **ERROR** # of addforward histos != # of forward histos."; - cerr << endl << ">> Run #" << i+1; - cerr << endl; - result = false; - break; - } - } - } - // check concerning the addt0 tags if (fRuns[i].GetAddT0Entries() != 0) { if (fRuns[i].GetAddT0Entries() != fRuns[i].GetRunNameSize()-1) { @@ -3866,15 +3740,6 @@ Bool_t PMsrHandler::CheckAddRunParameters() break; } } - } else { // no addrun present, check if addforward, addbackward, ... is present (which doesn't make any sense) - if ((fRuns[i].GetAddForwardHistoNoEntries() != 0) || (fRuns[i].GetAddBackwardHistoNoEntries() != 0) || - (fRuns[i].GetAddT0Entries() != 0)) { - cerr << endl << ">> PMsrHandler::CheckAddRunParameters: **WARNING** found one of the following tags in Run #" << i+1 << ":"; - cerr << endl << ">> addforward, addbackward, or addt0"; - cerr << endl << ">> this doesn't make any sense if there no addrun present."; - cerr << endl << ">> Will ignore these entires for this run!"; - cerr << endl; - } } } diff --git a/src/classes/PMusr.cpp b/src/classes/PMusr.cpp index 03c4c6a0..b02214b1 100644 --- a/src/classes/PMusr.cpp +++ b/src/classes/PMusr.cpp @@ -596,13 +596,7 @@ void PMsrRunBlock::CleanUp() fInstitute.clear(); fFileFormat.clear(); fForwardHistoNo.clear(); - for (UInt_t i=0; i get forward histo number size of the addrun at index addRunIdx - * - * \param addRunIdx index of the addrun - */ -Int_t PMsrRunBlock::GetAddForwardHistoNoSize(UInt_t addRunIdx) -{ - if (fAddForwardHistoNo.empty()) - return -1; - - if (addRunIdx > fAddForwardHistoNo.size()) - return -1; - - return fAddForwardHistoNo[addRunIdx].size(); -} - -//-------------------------------------------------------------------------- -// GetAddForwardHistoNo -//-------------------------------------------------------------------------- -/** - *

get forward histo number of the addrun (index addRunIdx) at index histoIdx - * - * \param addRunIdx index of the addrun - * \param histoIdx index of the add forward histo number value - */ -Int_t PMsrRunBlock::GetAddForwardHistoNo(UInt_t addRunIdx, UInt_t histoIdx) -{ - if (fAddForwardHistoNo.empty()) - return -1; - - if (addRunIdx > fAddForwardHistoNo.size()) - return -1; - - if (fAddForwardHistoNo[addRunIdx].empty()) - return -1; - - if (histoIdx > fAddForwardHistoNo[addRunIdx].size()) - return -1; - - return fAddForwardHistoNo[addRunIdx][histoIdx]; -} - -//-------------------------------------------------------------------------- -// SetAddForwardHistoNo -//-------------------------------------------------------------------------- -/** - *

set add forward histogram value at index idx - * - * \param histoNo histogram value - * \param addRunIdx addrun index - * \param histoNoIdx index whithin the fAddForwardHistoNo vector where to set the value. - */ -void PMsrRunBlock::SetAddForwardHistoNo(Int_t histoNo, UInt_t addRunIdx, UInt_t histoNoIdx) -{ - if (addRunIdx >= fAddForwardHistoNo.size()) - fAddForwardHistoNo.resize(addRunIdx+1); - - if (histoNoIdx >= fAddForwardHistoNo[addRunIdx].size()) - fAddForwardHistoNo[addRunIdx].resize(histoNoIdx+1); - - fAddForwardHistoNo[addRunIdx][histoNoIdx] = histoNo; -} - //-------------------------------------------------------------------------- // GetBackwardHistoNo //-------------------------------------------------------------------------- @@ -908,72 +836,6 @@ void PMsrRunBlock::SetBackwardHistoNo(Int_t histoNo, Int_t idx) } } -//-------------------------------------------------------------------------- -// GetAddBackwardHistoNoSize -//-------------------------------------------------------------------------- -/** - *

get backward histo number size of the addrun at index addRunIdx - * - * \param addRunIdx index of the addrun - */ -Int_t PMsrRunBlock::GetAddBackwardHistoNoSize(UInt_t addRunIdx) -{ - if (fAddBackwardHistoNo.empty()) - return -1; - - if (addRunIdx > fAddBackwardHistoNo.size()) - return -1; - - return fAddBackwardHistoNo[addRunIdx].size(); -} - -//-------------------------------------------------------------------------- -// GetAddBackwardHistoNo -//-------------------------------------------------------------------------- -/** - *

get backward histo number of the addrun (index addRunIdx) at index histoIdx - * - * \param addRunIdx index of the addrun - * \param histoIdx index of the add backward histo number value - */ -Int_t PMsrRunBlock::GetAddBackwardHistoNo(UInt_t addRunIdx, UInt_t histoIdx) -{ - if (fAddBackwardHistoNo.empty()) - return -1; - - if (addRunIdx > fAddBackwardHistoNo.size()) - return -1; - - if (fAddBackwardHistoNo[addRunIdx].empty()) - return -1; - - if (histoIdx > fAddBackwardHistoNo[addRunIdx].size()) - return -1; - - return fAddBackwardHistoNo[addRunIdx][histoIdx]; -} - -//-------------------------------------------------------------------------- -// SetAddBackwardHistoNo -//-------------------------------------------------------------------------- -/** - *

set add backward histogram value of the addrun at index histoNoIdx - * - * \param histoNo histogram value - * \param addRunIdx addrun index - * \param histoNoIdx index whithin the fAddBackwardHistoNo vector where to set the value. - */ -void PMsrRunBlock::SetAddBackwardHistoNo(Int_t histoNo, UInt_t addRunIdx, UInt_t histoNoIdx) -{ - if (addRunIdx >= fAddBackwardHistoNo.size()) - fAddBackwardHistoNo.resize(addRunIdx+1); - - if (histoNoIdx >= fAddBackwardHistoNo[addRunIdx].size()) - fAddBackwardHistoNo[addRunIdx].resize(histoNoIdx+1); - - fAddBackwardHistoNo[addRunIdx][histoNoIdx] = histoNo; -} - //-------------------------------------------------------------------------- // GetMap //-------------------------------------------------------------------------- diff --git a/src/include/PMusr.h b/src/include/PMusr.h index 06486389..eb10e637 100644 --- a/src/include/PMusr.h +++ b/src/include/PMusr.h @@ -409,14 +409,8 @@ class PMsrRunBlock { virtual Int_t GetMap(UInt_t idx); virtual UInt_t GetForwardHistoNoSize() { return fForwardHistoNo.size(); } virtual Int_t GetForwardHistoNo(UInt_t idx=0); - virtual UInt_t GetAddForwardHistoNoEntries() { return fAddForwardHistoNo.size(); } - virtual Int_t GetAddForwardHistoNoSize(UInt_t addRunIdx); - virtual Int_t GetAddForwardHistoNo(UInt_t addRunIdx, UInt_t histoIdx); virtual UInt_t GetBackwardHistoNoSize() { return fBackwardHistoNo.size(); } virtual Int_t GetBackwardHistoNo(UInt_t idx=0); - virtual UInt_t GetAddBackwardHistoNoEntries() { return fAddBackwardHistoNo.size(); } - virtual Int_t GetAddBackwardHistoNoSize(UInt_t addRunIdx); - virtual Int_t GetAddBackwardHistoNo(UInt_t addRunIdx, UInt_t histoIdx); virtual Double_t GetBkgFix(UInt_t idx); virtual Int_t GetBkgRange(UInt_t idx); virtual Int_t GetDataRange(UInt_t idx); @@ -446,9 +440,7 @@ class PMsrRunBlock { virtual void SetLifetimeCorrection(Bool_t bval) { fLifetimeCorrection = bval; } virtual void SetMap(Int_t mapVal, Int_t idx=-1); virtual void SetForwardHistoNo(Int_t histoNo, Int_t idx=-1); - virtual void SetAddForwardHistoNo(Int_t histoNo, UInt_t addRunIdx, UInt_t histoNoIdx); virtual void SetBackwardHistoNo(Int_t histoNo, Int_t idx=-1); - virtual void SetAddBackwardHistoNo(Int_t histoNo, UInt_t addRunIdx, UInt_t histoNoIdx); virtual void SetBkgFix(Double_t dval, Int_t idx=-1); virtual void SetBkgRange(Int_t ival, Int_t idx); virtual void SetDataRange(Int_t ival, Int_t idx); @@ -476,9 +468,7 @@ class PMsrRunBlock { Bool_t fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0) PIntVector fMap; ///< map vector needed to switch parameters for different runs within a single theory PIntVector fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4) - vector fAddForwardHistoNo; ///< forward histogram number for addrun's PIntVector fBackwardHistoNo; ///< backward histogram number (fit type 2, 4) - vector fAddBackwardHistoNo; ///< backward histogram number for addrun's Double_t fBkgFix[2]; ///< fixed background in (1/ns) (fit type 0, 2, 4) Int_t fBkgRange[4]; ///< background bin range (fit type 0, 2, 4) Int_t fDataRange[4]; ///< data bin range (fit type 0, 2, 4)