a first implementation for the triumf mud-format. Start migrating towards real CERN ROOT notation int->Int_t, etc.
This commit is contained in:
parent
dcb77c2e48
commit
e38d0793ba
@ -92,9 +92,9 @@ PRunDataHandler::PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataP
|
||||
*/
|
||||
PRunDataHandler::~PRunDataHandler()
|
||||
{
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
for (UInt_t i=0; i<fData.size(); i++) {
|
||||
fData[i].fT0s.clear();
|
||||
for (unsigned int j=0; j<fData[i].fDataBin.size(); j++)
|
||||
for (UInt_t j=0; j<fData[i].fDataBin.size(); j++)
|
||||
fData[i].fDataBin[j].clear();
|
||||
}
|
||||
fData.clear();
|
||||
@ -113,7 +113,7 @@ PRunDataHandler::~PRunDataHandler()
|
||||
*/
|
||||
PRawRunData* PRunDataHandler::GetRunData(const TString &runName)
|
||||
{
|
||||
unsigned int i;
|
||||
UInt_t i;
|
||||
|
||||
for (i=0; i<fData.size(); i++) {
|
||||
if (!fData[i].fRunName.CompareTo(runName)) // run found
|
||||
@ -135,9 +135,9 @@ PRawRunData* PRunDataHandler::GetRunData(const TString &runName)
|
||||
*
|
||||
* <b>return:</b> true if reading was successful, false if reading failed.
|
||||
*/
|
||||
bool PRunDataHandler::ReadFile()
|
||||
Bool_t PRunDataHandler::ReadFile()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// loop over the full RUN list to see what needs to be read
|
||||
PMsrRunList *runList = 0;
|
||||
@ -147,8 +147,8 @@ bool PRunDataHandler::ReadFile()
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i=0; i<runList->size(); i++) {
|
||||
for (unsigned int j=0; j<runList->at(i).fRunName.size(); j++) {
|
||||
for (UInt_t i=0; i<runList->size(); i++) {
|
||||
for (UInt_t j=0; j<runList->at(i).fRunName.size(); j++) {
|
||||
fRunName = runList->at(i).fRunName[j];
|
||||
// check is file is already read
|
||||
if (FileAlreadyRead(runList->at(i).fRunName[j]))
|
||||
@ -190,9 +190,9 @@ bool PRunDataHandler::ReadFile()
|
||||
*
|
||||
* <b>return:</b> true if the file has been read before, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::FileAlreadyRead(TString runName)
|
||||
Bool_t PRunDataHandler::FileAlreadyRead(TString runName)
|
||||
{
|
||||
for (unsigned int i=0; i<fData.size(); i++) {
|
||||
for (UInt_t i=0; i<fData.size(); i++) {
|
||||
if (!fData[i].fRunName.CompareTo(runName)) { // run alread read
|
||||
return true;
|
||||
}
|
||||
@ -212,9 +212,9 @@ bool PRunDataHandler::FileAlreadyRead(TString runName)
|
||||
*
|
||||
* <b>return:</b> true if data file exists, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned int idx)
|
||||
Bool_t PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const UInt_t idx)
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// local init
|
||||
TROOT root("PRunBase", "PRunBase", 0);
|
||||
@ -236,7 +236,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
else if (!runInfo.fFileFormat[idx].CompareTo("psi-bin"))
|
||||
ext = TString("bin");
|
||||
else if (!runInfo.fFileFormat[idx].CompareTo("mud"))
|
||||
ext = TString("mud");
|
||||
ext = TString("msr");
|
||||
else if (!runInfo.fFileFormat[idx].CompareTo("wkm")) {
|
||||
if (!runInfo.fBeamline[idx].CompareTo("mue4"))
|
||||
ext = TString("nemu");
|
||||
@ -285,7 +285,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
|
||||
// check if the file is found in the directory given in the startup file
|
||||
if (pathName.CompareTo("???") == 0) { // not found in local directory search
|
||||
for (unsigned int i=0; i<fDataPath.size(); i++) {
|
||||
for (UInt_t i=0; i<fDataPath.size(); i++) {
|
||||
str = fDataPath[i] + TString("/") + runInfo.fRunName[idx] + TString(".") + ext;
|
||||
if (gSystem->AccessPathName(str.Data())!=true) { // found
|
||||
pathName = str;
|
||||
@ -295,13 +295,13 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
}
|
||||
|
||||
// check if the file is found in the directories given by WKMFULLDATAPATH
|
||||
const char *wkmpath = gSystem->Getenv("WKMFULLDATAPATH");
|
||||
const Char_t *wkmpath = gSystem->Getenv("WKMFULLDATAPATH");
|
||||
if (pathName.CompareTo("???") == 0) { // not found in local directory and xml path
|
||||
str = TString(wkmpath);
|
||||
// WKMFULLDATAPATH has the structure: path_1:path_2:...:path_n
|
||||
TObjArray *tokens = str.Tokenize(":");
|
||||
TObjString *ostr;
|
||||
for (int i=0; i<tokens->GetEntries(); i++) {
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString() + TString("/") + runInfo.fRunName[idx] + TString(".") + ext;
|
||||
if (gSystem->AccessPathName(str.Data())!=true) { // found
|
||||
@ -322,7 +322,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
TDatime datetime;
|
||||
TString dt;
|
||||
dt += datetime.GetYear();
|
||||
for (int i=0; i<tokens->GetEntries(); i++) {
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString() + TString("/DATA/") +
|
||||
runInfo.fInstitute[idx] + TString("/") +
|
||||
@ -363,7 +363,7 @@ bool PRunDataHandler::FileExistsCheck(PMsrRunStructure &runInfo, const unsigned
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
Bool_t PRunDataHandler::ReadRootFile(Bool_t notPostPileup)
|
||||
{
|
||||
PDoubleVector histoData;
|
||||
PRawRunData runData;
|
||||
@ -416,15 +416,15 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
runData.fTimeResolution = runHeader->GetTimeResolution();
|
||||
|
||||
// get number of histogramms
|
||||
int noOfHistos = runHeader->GetNHist();
|
||||
Int_t noOfHistos = runHeader->GetNHist();
|
||||
|
||||
// get t0's
|
||||
Double_t *t0 = runHeader->GetTimeZero();
|
||||
// check if t0's are there
|
||||
if (t0[0] != -1) { // ugly, but at the moment there is no other way
|
||||
// copy t0's so they are not lost
|
||||
for (int i=0; i<noOfHistos; i++) {
|
||||
runData.fT0s.push_back((int)t0[i]);
|
||||
for (Int_t i=0; i<noOfHistos; i++) {
|
||||
runData.fT0s.push_back((Int_t)t0[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -534,9 +534,9 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
return false;
|
||||
}
|
||||
// get all the data
|
||||
char histoName[32];
|
||||
Char_t histoName[32];
|
||||
if (notPostPileup) { // read the data which are NOT post pileup corrected
|
||||
for (int i=0; i<noOfHistos; i++) {
|
||||
for (Int_t i=0; i<noOfHistos; i++) {
|
||||
sprintf(histoName, "hDecay%02d", i);
|
||||
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
|
||||
if (!histo) {
|
||||
@ -544,7 +544,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
return false;
|
||||
}
|
||||
// fill data
|
||||
for (int j=1; j<histo->GetNbinsX(); j++)
|
||||
for (Int_t j=1; j<histo->GetNbinsX(); j++)
|
||||
histoData.push_back(histo->GetBinContent(j));
|
||||
// store them in runData vector
|
||||
runData.fDataBin.push_back(histoData);
|
||||
@ -552,7 +552,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
histoData.clear();
|
||||
}
|
||||
} else { // read the data which ARE post pileup corrected
|
||||
for (int i=0; i<noOfHistos; i++) {
|
||||
for (Int_t i=0; i<noOfHistos; i++) {
|
||||
sprintf(histoName, "hDecay%02d", i+POST_PILEUP_HISTO_OFFSET);
|
||||
TH1F *histo = dynamic_cast<TH1F*>(folder->FindObjectAny(histoName));
|
||||
if (!histo) {
|
||||
@ -560,7 +560,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
return false;
|
||||
}
|
||||
// fill data
|
||||
for (int j=1; j<histo->GetNbinsX(); j++)
|
||||
for (Int_t j=1; j<histo->GetNbinsX(); j++)
|
||||
histoData.push_back(histo->GetBinContent(j));
|
||||
// store them in runData vector
|
||||
runData.fDataBin.push_back(histoData);
|
||||
@ -578,7 +578,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
fData.push_back(runData);
|
||||
|
||||
// clean up
|
||||
for (unsigned int i=0; i<runData.fDataBin.size(); i++)
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
|
||||
@ -596,7 +596,7 @@ bool PRunDataHandler::ReadRootFile(bool notPostPileup)
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadNexusFile()
|
||||
Bool_t PRunDataHandler::ReadNexusFile()
|
||||
{
|
||||
cout << endl << "PRunDataHandler::ReadNexusFile(): Sorry, not yet implemented, ask Alex Amato ...";
|
||||
return false;
|
||||
@ -611,7 +611,7 @@ bool PRunDataHandler::ReadNexusFile()
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadWkmFile()
|
||||
Bool_t PRunDataHandler::ReadWkmFile()
|
||||
{
|
||||
PDoubleVector histoData;
|
||||
PRawRunData runData;
|
||||
@ -639,13 +639,13 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
}
|
||||
|
||||
// read header
|
||||
bool headerInfo = true;
|
||||
char instr[512];
|
||||
Bool_t headerInfo = true;
|
||||
Char_t instr[512];
|
||||
TString line, linecp;
|
||||
double dval;
|
||||
int ival;
|
||||
bool ok;
|
||||
int groups = 0, channels = 0;
|
||||
Double_t dval;
|
||||
Int_t ival;
|
||||
Bool_t ok;
|
||||
Int_t groups = 0, channels = 0;
|
||||
|
||||
// skip leading empty lines
|
||||
do {
|
||||
@ -769,8 +769,8 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
}
|
||||
|
||||
// read data ---------------------------------------------------------
|
||||
unsigned int group_counter = 0;
|
||||
int val;
|
||||
UInt_t group_counter = 0;
|
||||
Int_t val;
|
||||
TObjArray *tokens;
|
||||
TObjString *ostr;
|
||||
TString str;
|
||||
@ -793,12 +793,12 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
if (!tokens) { // no tokens found
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data.";
|
||||
// clean up
|
||||
for (unsigned int i=0; i<group_counter; i++)
|
||||
for (UInt_t i=0; i<group_counter; i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
return false;
|
||||
}
|
||||
for (int i=0; i<tokens->GetEntries(); i++) {
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
val = ToInt(str, ok);
|
||||
@ -807,7 +807,7 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
} else {
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values.";
|
||||
// clean up
|
||||
for (unsigned int i=0; i<group_counter; i++)
|
||||
for (UInt_t i=0; i<group_counter; i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
delete tokens;
|
||||
@ -833,12 +833,12 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
if (!tokens) { // no tokens found
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: coulnd't tokenize run data.";
|
||||
// clean up
|
||||
for (unsigned int i=0; i<group_counter; i++)
|
||||
for (UInt_t i=0; i<group_counter; i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
return false;
|
||||
}
|
||||
for (int i=0; i<tokens->GetEntries(); i++) {
|
||||
for (Int_t i=0; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
str = ostr->GetString();
|
||||
val = ToInt(str, ok);
|
||||
@ -847,7 +847,7 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
} else {
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR** while reading data: data line contains non-integer values.";
|
||||
// clean up
|
||||
for (unsigned int i=0; i<group_counter; i++)
|
||||
for (UInt_t i=0; i<group_counter; i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
delete tokens;
|
||||
@ -871,23 +871,23 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
f.close();
|
||||
|
||||
// check if all groups are found
|
||||
if ((int) runData.fDataBin.size() != groups) {
|
||||
if ((Int_t) runData.fDataBin.size() != groups) {
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR**";
|
||||
cerr << endl << " expected " << groups << " histos, but found " << runData.fDataBin.size();
|
||||
// clean up
|
||||
for (unsigned int i=0; i<runData.fDataBin.size(); i++)
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if all groups have enough channels
|
||||
for (unsigned int i=0; i<runData.fDataBin.size(); i++) {
|
||||
if ((int) runData.fDataBin[i].size() != channels) {
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++) {
|
||||
if ((Int_t) runData.fDataBin[i].size() != channels) {
|
||||
cerr << endl << "PRunDataHandler::ReadWkmFile(): **ERROR**";
|
||||
cerr << endl << " expected " << channels << " bins in histo " << i << ", but found " << runData.fDataBin[i].size();
|
||||
// clean up
|
||||
for (unsigned int j=0; j<runData.fDataBin.size(); j++)
|
||||
for (UInt_t j=0; j<runData.fDataBin.size(); j++)
|
||||
runData.fDataBin[j].clear();
|
||||
runData.fDataBin.clear();
|
||||
return false;
|
||||
@ -901,7 +901,7 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
fData.push_back(runData);
|
||||
|
||||
// clean up
|
||||
for (unsigned int i=0; i<runData.fDataBin.size(); i++)
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
|
||||
@ -917,11 +917,11 @@ bool PRunDataHandler::ReadWkmFile()
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadPsiBinFile()
|
||||
Bool_t PRunDataHandler::ReadPsiBinFile()
|
||||
{
|
||||
MuSR_td_PSI_bin psiBin;
|
||||
int status;
|
||||
bool success;
|
||||
Int_t status;
|
||||
Bool_t success;
|
||||
|
||||
// read psi bin file
|
||||
status = psiBin.read(fRunPathName.Data());
|
||||
@ -961,7 +961,7 @@ bool PRunDataHandler::ReadPsiBinFile()
|
||||
// fill necessary header informations
|
||||
PIntVector ivec;
|
||||
PRawRunData runData;
|
||||
double dval;
|
||||
Double_t dval;
|
||||
// keep run name
|
||||
runData.fRunName = fRunName;
|
||||
// get run title
|
||||
@ -983,7 +983,7 @@ bool PRunDataHandler::ReadPsiBinFile()
|
||||
runData.fTemp.resize(2);
|
||||
// take only the first two values for now...
|
||||
//maybe that's not enough - e.g. in older GPD data I saw the "correct values in the second and third entry..."
|
||||
for (unsigned int i(0); i<2; i++){
|
||||
for (UInt_t i(0); i<2; i++){
|
||||
runData.fTemp[i].first = tempVec[i];
|
||||
runData.fTemp[i].second = tempDevVec[i];
|
||||
}
|
||||
@ -1006,15 +1006,15 @@ bool PRunDataHandler::ReadPsiBinFile()
|
||||
cerr << endl;
|
||||
return false;
|
||||
}
|
||||
for (unsigned int i=0; i<ivec.size(); i++)
|
||||
for (UInt_t i=0; i<ivec.size(); i++)
|
||||
runData.fT0s.push_back(ivec[i]);
|
||||
|
||||
// fill raw data
|
||||
PDoubleVector histoData;
|
||||
int *histo;
|
||||
for (int i=0; i<psiBin.get_numberHisto_int(); i++) {
|
||||
Int_t *histo;
|
||||
for (Int_t i=0; i<psiBin.get_numberHisto_int(); i++) {
|
||||
histo = psiBin.get_histo_array_int(i);
|
||||
for (int j=0; j<psiBin.get_histoLength_bin(); j++) {
|
||||
for (Int_t j=0; j<psiBin.get_histoLength_bin(); j++) {
|
||||
histoData.push_back(histo[j]);
|
||||
}
|
||||
delete histo;
|
||||
@ -1027,7 +1027,7 @@ bool PRunDataHandler::ReadPsiBinFile()
|
||||
|
||||
// clean up
|
||||
runData.fT0s.clear();
|
||||
for (unsigned int i=0; i<runData.fDataBin.size(); i++)
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
|
||||
@ -1042,12 +1042,17 @@ bool PRunDataHandler::ReadPsiBinFile()
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadMudFile()
|
||||
Bool_t PRunDataHandler::ReadMudFile()
|
||||
{
|
||||
Int_t fh;
|
||||
UINT32 type;
|
||||
UINT32 type, val;
|
||||
Int_t success;
|
||||
Char_t str[1024];
|
||||
Double_t dval;
|
||||
|
||||
fh = MUD_openRead((char *)fRunPathName.Data(), &type);
|
||||
PRawRunData runData;
|
||||
|
||||
fh = MUD_openRead((Char_t *)fRunPathName.Data(), &type);
|
||||
if (fh == -1) {
|
||||
cerr << endl << "**ERROR** Couldn't open mud-file " << fRunPathName.Data() << ", sorry.";
|
||||
cerr << endl;
|
||||
@ -1055,13 +1060,241 @@ bool PRunDataHandler::ReadMudFile()
|
||||
}
|
||||
|
||||
// read necessary header information
|
||||
// STILL MISSING
|
||||
|
||||
// keep run name
|
||||
runData.fRunName = fRunName;
|
||||
|
||||
// get run title
|
||||
success = MUD_getTitle( fh, str, sizeof(str) );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't obtain the run title of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
}
|
||||
runData.fRunTitle = TString(str);
|
||||
|
||||
// get setup
|
||||
success = MUD_getLab( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
runData.fSetup = TString(str) + TString("/");
|
||||
}
|
||||
success = MUD_getArea( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
runData.fSetup += TString(str) + TString("/");
|
||||
}
|
||||
success = MUD_getApparatus( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
runData.fSetup += TString(str) + TString("/");
|
||||
}
|
||||
success = MUD_getSample( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
runData.fSetup += TString(str);
|
||||
}
|
||||
|
||||
// set LEM specific information to default value since it is not in the file and not used...
|
||||
runData.fEnergy = -999.0;
|
||||
runData.fTransport = -999.0;
|
||||
runData.fRingAnode.clear();
|
||||
|
||||
// get field
|
||||
success = MUD_getField( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
success = sscanf(str, "%lf G", &dval);
|
||||
if (success == 1) {
|
||||
runData.fField = dval;
|
||||
} else {
|
||||
runData.fField = -9.9e99;
|
||||
}
|
||||
} else {
|
||||
runData.fField = -9.9e99;
|
||||
}
|
||||
|
||||
// get temperature
|
||||
success = MUD_getTemperature( fh, str, sizeof(str) );
|
||||
if (success) {
|
||||
runData.fTemp.resize(1);
|
||||
success = sscanf(str, "%lf K", &dval);
|
||||
if (success == 1) {
|
||||
runData.fTemp[0].first = dval;
|
||||
runData.fTemp[0].second = 0.0;
|
||||
} else {
|
||||
runData.fTemp[0].first = -9.9e99;
|
||||
runData.fTemp[0].second = 0.0;
|
||||
}
|
||||
} else {
|
||||
runData.fTemp[0].first = -9.9e99;
|
||||
runData.fTemp[0].second = 0.0;
|
||||
}
|
||||
|
||||
// get number of histogramms
|
||||
success = MUD_getHists(fh, &type, &val);
|
||||
if ( !success ) {
|
||||
cerr << endl << "**ERROR** Couldn't obtain the number of histograms of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
MUD_closeRead(fh);
|
||||
return false;
|
||||
}
|
||||
Int_t noOfHistos = (Int_t)val;
|
||||
|
||||
// get time resolution (ns)
|
||||
// check that time resolution is identical for all histograms
|
||||
// >> currently it is not forseen to handle histos with different time resolutions <<
|
||||
// >> perhaps this needs to be reconsidered later on <<
|
||||
UINT32 fsTimeResolution = 0;
|
||||
for (Int_t i=1; i<=noOfHistos; i++) {
|
||||
success = MUD_getHistFsPerBin( fh, i, &val );
|
||||
if (!success) {
|
||||
cerr << endl << "**ERROR** Couldn't obtain the time resolution of run " << fRunName.Data();
|
||||
cerr << endl << " which is fatal, sorry.";
|
||||
cerr << endl;
|
||||
MUD_closeRead(fh);
|
||||
return false;
|
||||
}
|
||||
if (i==1) {
|
||||
fsTimeResolution = val;
|
||||
} else {
|
||||
if (val != fsTimeResolution) {
|
||||
cerr << endl << "**ERROR** various time resolutions found in run " << fRunName.Data();
|
||||
cerr << endl << " this is currently not supported, sorry.";
|
||||
cerr << endl;
|
||||
MUD_closeRead(fh);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
runData.fTimeResolution = (Double_t)fsTimeResolution / 1.0e6; // fs -> ns
|
||||
|
||||
// read histograms
|
||||
// STILL MISSING
|
||||
pair<Int_t, Int_t> valPair;
|
||||
UINT32 *pData; // histo memory
|
||||
pData = NULL;
|
||||
PDoubleVector histoData;
|
||||
UInt_t noOfBins;
|
||||
|
||||
for (Int_t i=1; i<=noOfHistos; i++) {
|
||||
|
||||
// get t0's
|
||||
success = MUD_getHistT0_Bin( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't get t0 of histo " << i << " of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
}
|
||||
runData.fT0s.push_back((Int_t)val);
|
||||
|
||||
// get bkg bins
|
||||
success = MUD_getHistBkgd1( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't get bkg bin 1 of histo " << i << " of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
valPair.first = -1;
|
||||
} else {
|
||||
valPair.first = (Int_t)val;
|
||||
}
|
||||
|
||||
success = MUD_getHistBkgd2( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't get bkg bin 2 of histo " << i << " of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
valPair.second = -1;
|
||||
}
|
||||
valPair.second = (Int_t)val;
|
||||
|
||||
if ((valPair.first != -1) && (valPair.second != -1)) { // bkg bin1 && bkg bin2 found
|
||||
runData.fBkgBin.push_back(valPair);
|
||||
} else {
|
||||
runData.fBkgBin.clear();
|
||||
}
|
||||
|
||||
// get good data bins
|
||||
success = MUD_getHistGoodBin1( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't get good bin 1 of histo " << i << " of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
valPair.first = -1;
|
||||
} else {
|
||||
valPair.first = (Int_t)val;
|
||||
}
|
||||
|
||||
success = MUD_getHistGoodBin2( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**WARNING** Couldn't get good bin 2 of histo " << i << " of run " << fRunName.Data();
|
||||
cerr << endl;
|
||||
valPair.second = -1;
|
||||
}
|
||||
valPair.second = (Int_t)val;
|
||||
|
||||
if ((valPair.first != -1) && (valPair.second != -1)) { // good bin1 && good bin2 found
|
||||
runData.fGoodDataBin.push_back(valPair);
|
||||
} else {
|
||||
runData.fGoodDataBin.clear();
|
||||
}
|
||||
|
||||
// get number of bins
|
||||
success = MUD_getHistNumBins( fh, i, &val );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**ERROR** Couldn't get the number of bins of histo " << i << ".";
|
||||
cerr << endl << " This is fatal, sorry.";
|
||||
cerr << endl;
|
||||
MUD_closeRead( fh );
|
||||
return false;
|
||||
}
|
||||
noOfBins = (UInt_t)val;
|
||||
|
||||
pData = (UINT32*)malloc(noOfBins*sizeof(pData));
|
||||
if (pData == NULL) {
|
||||
cerr << endl << "**ERROR** Couldn't allocate memory for data.";
|
||||
cerr << endl << " This is fatal, sorry.";
|
||||
cerr << endl;
|
||||
MUD_closeRead( fh );
|
||||
return false;
|
||||
}
|
||||
|
||||
// get histogram
|
||||
success = MUD_getHistData( fh, i, pData );
|
||||
if ( !success ) {
|
||||
cerr << endl << "**ERROR** Couldn't get histo no " << i << ".";
|
||||
cerr << endl << " This is fatal, sorry.";
|
||||
cerr << endl;
|
||||
MUD_closeRead( fh );
|
||||
return false;
|
||||
}
|
||||
|
||||
for (UInt_t j=0; j<noOfBins; j++) {
|
||||
histoData.push_back(pData[j]);
|
||||
}
|
||||
runData.fDataBin.push_back(histoData);
|
||||
histoData.clear();
|
||||
|
||||
free(pData);
|
||||
}
|
||||
|
||||
MUD_closeRead(fh);
|
||||
|
||||
/*
|
||||
cout << endl << "fRunName : " << runData.fRunName.Data();
|
||||
cout << endl << "fRunTitle : " << runData.fRunTitle.Data();
|
||||
cout << endl << "fSetup : " << runData.fSetup.Data();
|
||||
cout << endl << "fField : " << runData.fField;
|
||||
cout << endl << "fTemp : " << runData.fTemp[0].first;
|
||||
cout << endl << "noOfHistos : " << noOfHistos;
|
||||
cout << endl << "fTimeResolution : " << runData.fTimeResolution;
|
||||
for (Int_t i=0; i<noOfHistos; i++) {
|
||||
cout << endl << "------";
|
||||
cout << endl << i << " : t0 = " << runData.fT0s[i];
|
||||
cout << endl << i << " : bkg bins = " << runData.fBkgBin[i].first << "..." << runData.fBkgBin[i].second;
|
||||
cout << endl << i << " : good bins = " << runData.fGoodDataBin[i].first << "..." << runData.fGoodDataBin[i].second;
|
||||
}
|
||||
cout << endl;
|
||||
*/
|
||||
|
||||
// add run to the run list
|
||||
fData.push_back(runData);
|
||||
|
||||
// clean up
|
||||
runData.fT0s.clear();
|
||||
for (UInt_t i=0; i<runData.fDataBin.size(); i++)
|
||||
runData.fDataBin[i].clear();
|
||||
runData.fDataBin.clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1102,9 +1335,9 @@ bool PRunDataHandler::ReadMudFile()
|
||||
*
|
||||
* <b>return:</b> true at successful reading, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::ReadAsciiFile()
|
||||
Bool_t PRunDataHandler::ReadAsciiFile()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// open file
|
||||
ifstream f;
|
||||
@ -1126,12 +1359,12 @@ bool PRunDataHandler::ReadAsciiFile()
|
||||
|
||||
runData.fRunName = fRunName; // keep the run name
|
||||
|
||||
int lineNo = 0;
|
||||
char instr[512];
|
||||
Int_t lineNo = 0;
|
||||
Char_t instr[512];
|
||||
TString line, workStr;
|
||||
bool headerTag = false;
|
||||
bool dataTag = false;
|
||||
double x, y, ey;
|
||||
Bool_t headerTag = false;
|
||||
Bool_t dataTag = false;
|
||||
Double_t x, y, ey;
|
||||
PDoubleVector xVec, exVec, yVec, eyVec;
|
||||
|
||||
while (!f.eof()) {
|
||||
@ -1410,9 +1643,9 @@ bool PRunDataHandler::ReadAsciiFile()
|
||||
* <p>Some db-files do have a '\-e' or '\e' label just between the DATA tag line and the real data.
|
||||
* This tag will just be ignored.
|
||||
*/
|
||||
bool PRunDataHandler::ReadDBFile()
|
||||
Bool_t PRunDataHandler::ReadDBFile()
|
||||
{
|
||||
bool success = true;
|
||||
Bool_t success = true;
|
||||
|
||||
// open file
|
||||
ifstream f;
|
||||
@ -1429,14 +1662,14 @@ bool PRunDataHandler::ReadDBFile()
|
||||
|
||||
runData.fDataNonMusr.fFromAscii = false;
|
||||
|
||||
int lineNo = 0;
|
||||
int idx;
|
||||
int dbTag = -1;
|
||||
char instr[512];
|
||||
Int_t lineNo = 0;
|
||||
Int_t idx;
|
||||
Int_t dbTag = -1;
|
||||
Char_t instr[512];
|
||||
TString line, workStr;
|
||||
double val;
|
||||
bool firstData = true; // needed as a switch to check in which format the data are given.
|
||||
bool labelledFormat = true; // flag showing if the data are given in row format, or as labelled format (see description above, default is labelled format)
|
||||
Double_t val;
|
||||
Bool_t firstData = true; // needed as a switch to check in which format the data are given.
|
||||
Bool_t labelledFormat = true; // flag showing if the data are given in row format, or as labelled format (see description above, default is labelled format)
|
||||
|
||||
// variables needed to tokenize strings
|
||||
TString tstr;
|
||||
@ -1477,7 +1710,7 @@ bool PRunDataHandler::ReadDBFile()
|
||||
|
||||
// filter out all data tags
|
||||
tokens = workStr.Tokenize(" ,\t");
|
||||
for (int i=1; i<tokens->GetEntries(); i++) {
|
||||
for (Int_t i=1; i<tokens->GetEntries(); i++) {
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
runData.fDataNonMusr.fDataTags.push_back(ostr->GetString());
|
||||
}
|
||||
@ -1530,7 +1763,7 @@ bool PRunDataHandler::ReadDBFile()
|
||||
|
||||
// prepare data vector for use
|
||||
PDoubleVector dummy;
|
||||
for (unsigned int i=0; i<runData.fDataNonMusr.fDataTags.size(); i++) {
|
||||
for (UInt_t i=0; i<runData.fDataNonMusr.fDataTags.size(); i++) {
|
||||
runData.fDataNonMusr.fData.push_back(dummy);
|
||||
runData.fDataNonMusr.fErrData.push_back(dummy);
|
||||
}
|
||||
@ -1540,7 +1773,7 @@ bool PRunDataHandler::ReadDBFile()
|
||||
|
||||
if (labelledFormat) { // handle labelled formated data
|
||||
// check if run line
|
||||
const char *str = workStr.Data();
|
||||
const Char_t *str = workStr.Data();
|
||||
if (isdigit(str[0])) { // run line
|
||||
TString run("run");
|
||||
idx = GetDataTagIndex(run, runData.fDataNonMusr.fDataTags);
|
||||
@ -1646,7 +1879,7 @@ bool PRunDataHandler::ReadDBFile()
|
||||
} else { // handle row formated data
|
||||
// split string in tokens
|
||||
tokens = workStr.Tokenize(","); // line has structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle
|
||||
if (tokens->GetEntries() != (int)(3*runData.fDataNonMusr.fDataTags.size()+1)) {
|
||||
if (tokens->GetEntries() != (Int_t)(3*runData.fDataNonMusr.fDataTags.size()+1)) {
|
||||
cerr << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo << ":";
|
||||
cerr << endl << ">> " << workStr.Data();
|
||||
cerr << endl << ">> Expected db-data line with structure: val1, err11, err12, ..., valn, errn1, errn2, runNo, , , , runTitle";
|
||||
@ -1656,8 +1889,8 @@ bool PRunDataHandler::ReadDBFile()
|
||||
return false;
|
||||
}
|
||||
// extract data
|
||||
int j=0;
|
||||
for (int i=0; i<tokens->GetEntries()-1; i+=3) {
|
||||
Int_t j=0;
|
||||
for (Int_t i=0; i<tokens->GetEntries()-1; i+=3) {
|
||||
// handle value
|
||||
ostr = dynamic_cast<TObjString*>(tokens->At(i));
|
||||
tstr = ostr->GetString();
|
||||
@ -1711,7 +1944,7 @@ bool PRunDataHandler::ReadDBFile()
|
||||
}
|
||||
|
||||
// check if all vectors have the same size
|
||||
for (unsigned int i=1; i<runData.fDataNonMusr.fData.size(); i++) {
|
||||
for (UInt_t i=1; i<runData.fDataNonMusr.fData.size(); i++) {
|
||||
if (runData.fDataNonMusr.fData[i].size() != runData.fDataNonMusr.fData[i-1].size()) {
|
||||
cerr << endl << "PRunDataHandler::ReadDBFile **ERROR** in line no " << lineNo;
|
||||
cerr << endl << ">> label: " << runData.fDataNonMusr.fDataTags[i-1].Data() << ", number data elements = " << runData.fDataNonMusr.fData[i-1].size();
|
||||
@ -1755,22 +1988,22 @@ bool PRunDataHandler::ReadDBFile()
|
||||
*
|
||||
* <b>return:</b> true at success, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::StripWhitespace(TString &str)
|
||||
Bool_t PRunDataHandler::StripWhitespace(TString &str)
|
||||
{
|
||||
char *s = 0;
|
||||
char *subs = 0;
|
||||
int i;
|
||||
int start;
|
||||
int end;
|
||||
int size;
|
||||
Char_t *s = 0;
|
||||
Char_t *subs = 0;
|
||||
Int_t i;
|
||||
Int_t start;
|
||||
Int_t end;
|
||||
Int_t size;
|
||||
|
||||
size = (int)str.Length();
|
||||
s = new char[size+1];
|
||||
size = (Int_t)str.Length();
|
||||
s = new Char_t[size+1];
|
||||
|
||||
if (!s)
|
||||
return false;
|
||||
|
||||
for (int i=0; i<size+1; i++)
|
||||
for (Int_t i=0; i<size+1; i++)
|
||||
s[i] = str[i];
|
||||
s[size] = 0;
|
||||
|
||||
@ -1792,7 +2025,7 @@ bool PRunDataHandler::StripWhitespace(TString &str)
|
||||
return false;
|
||||
|
||||
// make substring
|
||||
subs = new char[end-start+2];
|
||||
subs = new Char_t[end-start+2];
|
||||
if (!subs)
|
||||
return false;
|
||||
|
||||
@ -1825,9 +2058,9 @@ bool PRunDataHandler::StripWhitespace(TString &str)
|
||||
*
|
||||
* <b>return:</b> true if string consist only of white spaces, otherwise false.
|
||||
*/
|
||||
bool PRunDataHandler::IsWhitespace(const char *str)
|
||||
Bool_t PRunDataHandler::IsWhitespace(const Char_t *str)
|
||||
{
|
||||
unsigned int i=0;
|
||||
UInt_t i=0;
|
||||
|
||||
while (isblank(str[i]) || iscntrl(str[i])) {
|
||||
if (str[i] == 0)
|
||||
@ -1845,23 +2078,23 @@ bool PRunDataHandler::IsWhitespace(const char *str)
|
||||
// ToDouble (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Convert a string to a double.
|
||||
* <p> Convert a string to a Double_t.
|
||||
*
|
||||
* \param str string to be converted
|
||||
* \param ok true on success, otherwise false.
|
||||
*
|
||||
* <b>return:</b> returns the converted string, or 0.0 in case of ok==false
|
||||
*/
|
||||
double PRunDataHandler::ToDouble(TString &str, bool &ok)
|
||||
Double_t PRunDataHandler::ToDouble(TString &str, Bool_t &ok)
|
||||
{
|
||||
char *s;
|
||||
double value;
|
||||
int size, status;
|
||||
Char_t *s;
|
||||
Double_t value;
|
||||
Int_t size, status;
|
||||
|
||||
ok = true;
|
||||
|
||||
size = (int)str.Length();
|
||||
s = new char[size+1];
|
||||
size = (Int_t)str.Length();
|
||||
s = new Char_t[size+1];
|
||||
|
||||
if (!s) {
|
||||
ok = false;
|
||||
@ -1869,7 +2102,7 @@ double PRunDataHandler::ToDouble(TString &str, bool &ok)
|
||||
}
|
||||
|
||||
// copy string; stupid way but it works
|
||||
for (int i=0; i<size+1; i++)
|
||||
for (Int_t i=0; i<size+1; i++)
|
||||
s[i] = str[i];
|
||||
s[size] = 0;
|
||||
|
||||
@ -1893,23 +2126,23 @@ double PRunDataHandler::ToDouble(TString &str, bool &ok)
|
||||
// ToInt (private)
|
||||
//--------------------------------------------------------------------------
|
||||
/**
|
||||
* <p> Convert a string to an int.
|
||||
* <p> Convert a string to an Int_t.
|
||||
*
|
||||
* \param str string to be converted
|
||||
* \param ok true on success, otherwise false.
|
||||
*
|
||||
* <b>return:</b> returns the converted string, or 0 in case of ok==false
|
||||
*/
|
||||
int PRunDataHandler::ToInt(TString &str, bool &ok)
|
||||
Int_t PRunDataHandler::ToInt(TString &str, Bool_t &ok)
|
||||
{
|
||||
char *s;
|
||||
int value;
|
||||
int size, status;
|
||||
Char_t *s;
|
||||
Int_t value;
|
||||
Int_t size, status;
|
||||
|
||||
ok = true;
|
||||
|
||||
size = (int)str.Length();
|
||||
s = new char[size+1];
|
||||
size = (Int_t)str.Length();
|
||||
s = new Char_t[size+1];
|
||||
|
||||
if (!s) {
|
||||
ok = false;
|
||||
@ -1917,7 +2150,7 @@ int PRunDataHandler::ToInt(TString &str, bool &ok)
|
||||
}
|
||||
|
||||
// copy string; stupid way but it works
|
||||
for (int i=0; i<size+1; i++)
|
||||
for (Int_t i=0; i<size+1; i++)
|
||||
s[i] = str[i];
|
||||
s[size] = 0;
|
||||
|
||||
@ -1948,12 +2181,12 @@ int PRunDataHandler::ToInt(TString &str, bool &ok)
|
||||
*
|
||||
* <b>return:</b> if found returns the data tag index (from the dataTags vector), otherwise -1
|
||||
*/
|
||||
int PRunDataHandler::GetDataTagIndex(TString &str, PStringVector &dataTags)
|
||||
Int_t PRunDataHandler::GetDataTagIndex(TString &str, PStringVector &dataTags)
|
||||
{
|
||||
int result = -1;
|
||||
Int_t result = -1;
|
||||
|
||||
// check all the other possible data tags
|
||||
for (unsigned int i=0; i<dataTags.size(); i++) {
|
||||
for (UInt_t i=0; i<dataTags.size(); i++) {
|
||||
if (!dataTags[i].CompareTo(str, TString::kIgnoreCase)) {
|
||||
result = i;
|
||||
break;
|
||||
|
9
src/external/mud/src/mud.h
vendored
9
src/external/mud/src/mud.h
vendored
@ -1,5 +1,10 @@
|
||||
#ifndef _MUD_H_
|
||||
#define _MUD_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
* v1.2
|
||||
*
|
||||
@ -679,5 +684,9 @@ int MUD_setIndVarTimeData _ANSI_ARGS_(( int fd, int num, UINT32* pTimeData ));
|
||||
int MUD_setIndVarpData _ANSI_ARGS_(( int fd, int num, void* pData ));
|
||||
int MUD_setIndVarpTimeData _ANSI_ARGS_(( int fd, int num, UINT32* pTimeData ));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MUD_H_ */
|
||||
|
||||
|
@ -117,13 +117,25 @@ using namespace std;
|
||||
/**
|
||||
* <p> typedef to make to code more readable.
|
||||
*/
|
||||
typedef vector<int> PIntVector;
|
||||
typedef vector<Int_t> PIntVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
typedef vector<double> PDoubleVector;
|
||||
typedef vector< pair<Int_t, Int_t> > PIntPairVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
typedef vector<Double_t> PDoubleVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
* <p>
|
||||
*/
|
||||
typedef vector< pair<Double_t, Double_t> > PDoublePairVector;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
/**
|
||||
@ -149,14 +161,14 @@ enum EPMusrHandleTag { kEmpty, kFit, kView };
|
||||
*/
|
||||
typedef struct {
|
||||
// data related info
|
||||
double fDataTimeStart;
|
||||
double fDataTimeStep;
|
||||
Double_t fDataTimeStart;
|
||||
Double_t fDataTimeStep;
|
||||
PDoubleVector fX; // only used for non-muSR
|
||||
PDoubleVector fValue;
|
||||
PDoubleVector fError;
|
||||
// theory related info
|
||||
double fTheoryTimeStart;
|
||||
double fTheoryTimeStep;
|
||||
Double_t fTheoryTimeStart;
|
||||
Double_t fTheoryTimeStep;
|
||||
PDoubleVector fXTheory; // only used for non-muSR
|
||||
PDoubleVector fTheory;
|
||||
} PRunData;
|
||||
@ -166,7 +178,7 @@ typedef struct {
|
||||
* <p>
|
||||
*/
|
||||
typedef struct {
|
||||
bool fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file
|
||||
Bool_t fFromAscii; ///< if true: data file was an ascii input file, otherwise it is a db input file
|
||||
PStringVector fLabels; ///< vector of all labels (used for x-, y-axis title in view)
|
||||
PStringVector fDataTags; ///< vector of all data tags
|
||||
vector<PDoubleVector> fData; ///< vector of all data
|
||||
@ -181,14 +193,15 @@ typedef struct {
|
||||
TString fRunName; ///< name of the run
|
||||
TString fRunTitle; ///< run title
|
||||
TString fSetup; ///< description of the setup of this run
|
||||
double fField; ///< magnetic field value
|
||||
// double fTemp; ///< temperature during the run
|
||||
vector< pair<double, double> > fTemp; ///< measured temperatures and standard deviations during the run
|
||||
double fEnergy; ///< implantation energy of the muon
|
||||
double fTransport; ///< LEM transport settings (Moderator HV)
|
||||
Double_t fField; ///< magnetic field value
|
||||
PDoublePairVector fTemp; ///< measured temperatures and standard deviations during the run
|
||||
Double_t fEnergy; ///< implantation energy of the muon
|
||||
Double_t fTransport; ///< LEM transport settings (Moderator HV)
|
||||
PDoubleVector fRingAnode; ///< LEM ring anode HVs (L,R[,T,B])
|
||||
double fTimeResolution; ///< time resolution of the run
|
||||
Double_t fTimeResolution; ///< time resolution of the run
|
||||
PIntVector fT0s; ///< vector of t0's of a run
|
||||
PIntPairVector fBkgBin; ///< background bins (first/last)
|
||||
PIntPairVector fGoodDataBin; ///< data bins (first/last)
|
||||
vector<PDoubleVector> fDataBin; ///< vector of all histos of a run
|
||||
PNonMusrRawRunData fDataNonMusr; ///< keeps all ascii- or db-file info in case of nonMusr fit
|
||||
} PRawRunData;
|
||||
@ -204,7 +217,7 @@ typedef vector<PRawRunData> PRawRunDataList;
|
||||
* <p> Helper structure for parsing. Keeps a msr-file line string and the corresponding line number.
|
||||
*/
|
||||
typedef struct {
|
||||
int fLineNo; ///< original line number of the msr-file
|
||||
Int_t fLineNo; ///< original line number of the msr-file
|
||||
TString fLine; ///< msr-file line
|
||||
} PMsrLineStructure;
|
||||
|
||||
@ -219,17 +232,17 @@ typedef vector<PMsrLineStructure> PMsrLines;
|
||||
* <p> Holds the information of a parameter.
|
||||
*/
|
||||
typedef struct {
|
||||
int fNoOfParams; ///< how many parameters are given
|
||||
int fNo; ///< parameter number
|
||||
Int_t fNoOfParams; ///< how many parameters are given
|
||||
Int_t fNo; ///< parameter number
|
||||
TString fName; ///< name
|
||||
double fValue; ///< value
|
||||
double fStep; ///< step / error / neg_error, depending on the situation
|
||||
bool fPosErrorPresent; ///< positive error is defined (as a number)
|
||||
double fPosError; ///< positive error if present
|
||||
bool fLowerBoundaryPresent; ///< flag showing if a lower boundary is present
|
||||
double fLowerBoundary; ///< lower boundary for the fit parameter
|
||||
bool fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
|
||||
double fUpperBoundary; ///< upper boundary for the fit parameter
|
||||
Double_t fValue; ///< value
|
||||
Double_t fStep; ///< step / error / neg_error, depending on the situation
|
||||
Bool_t fPosErrorPresent; ///< positive error is defined (as a number)
|
||||
Double_t fPosError; ///< positive error if present
|
||||
Bool_t fLowerBoundaryPresent; ///< flag showing if a lower boundary is present
|
||||
Double_t fLowerBoundary; ///< lower boundary for the fit parameter
|
||||
Bool_t fUpperBoundaryPresent; ///< flag showing if an upper boundary is present
|
||||
Double_t fUpperBoundary; ///< upper boundary for the fit parameter
|
||||
} PMsrParamStructure;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@ -248,30 +261,30 @@ typedef struct {
|
||||
PStringVector fBeamline; ///< e.g. mue4, mue1, pim3, emu, m15, ... (former: run type)
|
||||
PStringVector fInstitute; ///< e.g. psi, ral, triumf (former: run format)
|
||||
PStringVector fFileFormat; ///< e.g. root, nexus, psi-bin, mud, ascii, db
|
||||
int fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR
|
||||
int fAlphaParamNo; ///< alpha parameter number (fit type 2, 4)
|
||||
int fBetaParamNo; ///< beta parameter number (fit type 2, 4)
|
||||
int fNormParamNo; ///< N0 parameter number (fit type 0)
|
||||
int fBkgFitParamNo; ///< background fit parameter number (fit type 0)
|
||||
int fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!!
|
||||
int fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
|
||||
bool fLifetimeCorrection; ///< lifetime correction flag for viewing (fit type 0)
|
||||
Int_t fFitType; ///< fit type: 0=single histo fit, 2=asymmetry fit, 4=asymmetry in RRF, 8=non muSR
|
||||
Int_t fAlphaParamNo; ///< alpha parameter number (fit type 2, 4)
|
||||
Int_t fBetaParamNo; ///< beta parameter number (fit type 2, 4)
|
||||
Int_t fNormParamNo; ///< N0 parameter number (fit type 0)
|
||||
Int_t fBkgFitParamNo; ///< background fit parameter number (fit type 0)
|
||||
Int_t fPhaseParamNo; ///< ??? NEEDED ??? NEEDS TO BE CHECKED !!!
|
||||
Int_t fLifetimeParamNo; ///< muon lifetime parameter number (fit type 0)
|
||||
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
|
||||
int fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
|
||||
int fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
|
||||
Int_t fForwardHistoNo; ///< forward histogram number (fit type 0, 2, 4)
|
||||
Int_t fBackwardHistoNo; ///< backward histogram number (fit type 2, 4)
|
||||
PDoubleVector fBkgFix; ///< fixed background in (1/ns) (fit type 0, 2, 4)
|
||||
PIntVector fBkgRange; ///< background bin range (fit type 0, 2, 4)
|
||||
PIntVector fDataRange; ///< data bin range (fit type 0, 2, 4)
|
||||
PIntVector fT0; ///< t0 bins (fit type 0, 2, 4). if fit type 0 -> f0, f1, f2, ...; if fit type 2, 4 -> f0, b0, f1, b1, ...
|
||||
double fFitRange[2]; ///< fit range in (us)
|
||||
int fPacking; ///< packing/rebinning
|
||||
double fRRFFreq; ///< rotating reference frequency (fit type 4)
|
||||
int fRRFPacking; ///< rotating reference packing (fit type 4)
|
||||
int fAlpha2ParamNo; ///< rotating reference alpha2 (fit type 4)
|
||||
int fBeta2ParamNo; ///< rotating reference beta2 (fit type 4)
|
||||
int fRightHistoNo; ///< rotating reference right histogram number (fit type 4)
|
||||
int fLeftHistoNo; ///< rotating reference left histogram number (fit type 4)
|
||||
int fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
|
||||
Double_t fFitRange[2]; ///< fit range in (us)
|
||||
Int_t fPacking; ///< packing/rebinning
|
||||
Double_t fRRFFreq; ///< rotating reference frequency (fit type 4)
|
||||
Int_t fRRFPacking; ///< rotating reference packing (fit type 4)
|
||||
Int_t fAlpha2ParamNo; ///< rotating reference alpha2 (fit type 4)
|
||||
Int_t fBeta2ParamNo; ///< rotating reference beta2 (fit type 4)
|
||||
Int_t fRightHistoNo; ///< rotating reference right histogram number (fit type 4)
|
||||
Int_t fLeftHistoNo; ///< rotating reference left histogram number (fit type 4)
|
||||
Int_t fXYDataIndex[2]; ///< used to get the data indices when using db-files (fit type 8)
|
||||
TString fXYDataLabel[2]; ///< used to get the indices via labels when using db-files (fit type 8)
|
||||
} PMsrRunStructure;
|
||||
|
||||
@ -286,16 +299,16 @@ typedef vector<PMsrRunStructure> PMsrRunList;
|
||||
* <p> Holds the information of the Fourier block
|
||||
*/
|
||||
typedef struct {
|
||||
bool fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
|
||||
int fUnits; ///< flag used to indicate the units. 0=field units (G); 1=frequency units (MHz); 2=Mc/s
|
||||
int fFourierPower; ///< i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
|
||||
int fApodization; ///< tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
|
||||
int fPlotTag; ///< tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
|
||||
int fPhaseParamNo; ///< parameter number if used instead of a phase value
|
||||
double fPhase; ///< phase
|
||||
double fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
|
||||
double fPlotRange[2]; ///< field/frequency plot range
|
||||
double fPhaseIncrement; ///< phase increment for manual phase optimization
|
||||
Bool_t fFourierBlockPresent; ///< flag indicating if a Fourier block is present in the msr-file
|
||||
Int_t fUnits; ///< flag used to indicate the units. 0=field units (G); 1=frequency units (MHz); 2=Mc/s
|
||||
Int_t fFourierPower; ///< i.e. zero padding up to 2^fFourierPower, default = 0 which means NO zero padding
|
||||
Int_t fApodization; ///< tag indicating the kind of apodization wished, 0=no appodization (default), 1=weak, 2=medium, 3=strong (for details see the docu)
|
||||
Int_t fPlotTag; ///< tag used for initial plot. 0=real, 1=imaginary, 2=real & imaginary (default), 3=power, 4=phase
|
||||
Int_t fPhaseParamNo; ///< parameter number if used instead of a phase value
|
||||
Double_t fPhase; ///< phase
|
||||
Double_t fRangeForPhaseCorrection[2]; ///< field/frequency range for automatic phase correction
|
||||
Double_t fPlotRange[2]; ///< field/frequency plot range
|
||||
Double_t fPhaseIncrement; ///< phase increment for manual phase optimization
|
||||
} PMsrFourierStructure;
|
||||
|
||||
//-------------------------------------------------------------
|
||||
@ -303,11 +316,11 @@ typedef struct {
|
||||
* <p> Holds the information of a single plot block
|
||||
*/
|
||||
typedef struct {
|
||||
int fPlotType; ///< plot type
|
||||
bool fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
|
||||
bool fLogX; ///< yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
|
||||
bool fLogY; ///< yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
|
||||
int fViewPacking; ///< -1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs.
|
||||
Int_t fPlotType; ///< plot type
|
||||
Bool_t fUseFitRanges; ///< yes -> use the fit ranges to plot the data, no (default) -> use range information if present
|
||||
Bool_t fLogX; ///< yes -> x-axis in log-scale, no (default) -> x-axis in lin-scale
|
||||
Bool_t fLogY; ///< yes -> y-axis in log-scale, no (default) -> y-axis in lin-scale
|
||||
Int_t fViewPacking; ///< -1 -> use the run packing to generate the view, otherwise is fViewPacking for the binning of ALL runs.
|
||||
PComplexVector fRuns; ///< list of runs to be plotted
|
||||
PDoubleVector fTmin; ///< time minimum
|
||||
PDoubleVector fTmax; ///< time maximum
|
||||
@ -326,12 +339,12 @@ typedef vector<PMsrPlotStructure> PMsrPlotList;
|
||||
* <p>
|
||||
*/
|
||||
typedef struct {
|
||||
bool fValid;
|
||||
Bool_t fValid;
|
||||
PMsrLines fStatLines;
|
||||
TString fDate; ///< string holding fitting date and time
|
||||
bool fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
|
||||
double fMin; ///< chi2 or max. likelyhood
|
||||
unsigned int fNdf; ///< number of degrees of freedom
|
||||
Bool_t fChisq; ///< flag telling if min = chi2 or min = max.likelyhood
|
||||
Double_t fMin; ///< chi2 or max. likelyhood
|
||||
UInt_t fNdf; ///< number of degrees of freedom
|
||||
} PMsrStatisticStructure;
|
||||
|
||||
#endif // _PMUSR_H_
|
||||
|
@ -47,34 +47,34 @@ class PRunDataHandler
|
||||
PRunDataHandler(PMsrHandler *msrInfo, const PStringVector dataPath);
|
||||
virtual ~PRunDataHandler();
|
||||
|
||||
virtual bool IsAllDataAvailable() const { return fAllDataAvailable; }
|
||||
virtual Bool_t IsAllDataAvailable() const { return fAllDataAvailable; }
|
||||
virtual PRawRunData* GetRunData(const TString &runName);
|
||||
|
||||
private:
|
||||
PMsrHandler *fMsrInfo;
|
||||
PStringVector fDataPath;
|
||||
|
||||
bool fAllDataAvailable; ///< flag indicating if all data sets could be read
|
||||
Bool_t fAllDataAvailable; ///< flag indicating if all data sets could be read
|
||||
TString fRunName; ///< current run name
|
||||
TString fRunPathName; ///< current path file name
|
||||
PRawRunDataList fData; ///< keeping all the raw data
|
||||
|
||||
virtual bool ReadFile();
|
||||
virtual bool FileAlreadyRead(TString runName);
|
||||
virtual bool FileExistsCheck(PMsrRunStructure &runInfo, const unsigned int idx);
|
||||
virtual bool ReadRootFile(bool notPostPileup);
|
||||
virtual bool ReadNexusFile();
|
||||
virtual bool ReadWkmFile();
|
||||
virtual bool ReadPsiBinFile();
|
||||
virtual bool ReadMudFile();
|
||||
virtual bool ReadAsciiFile();
|
||||
virtual bool ReadDBFile();
|
||||
virtual Bool_t ReadFile();
|
||||
virtual Bool_t FileAlreadyRead(TString runName);
|
||||
virtual Bool_t FileExistsCheck(PMsrRunStructure &runInfo, const UInt_t idx);
|
||||
virtual Bool_t ReadRootFile(Bool_t notPostPileup);
|
||||
virtual Bool_t ReadNexusFile();
|
||||
virtual Bool_t ReadWkmFile();
|
||||
virtual Bool_t ReadPsiBinFile();
|
||||
virtual Bool_t ReadMudFile();
|
||||
virtual Bool_t ReadAsciiFile();
|
||||
virtual Bool_t ReadDBFile();
|
||||
|
||||
virtual bool StripWhitespace(TString &str);
|
||||
virtual bool IsWhitespace(const char *str);
|
||||
virtual double ToDouble(TString &str, bool &ok);
|
||||
virtual int ToInt(TString &str, bool &ok);
|
||||
virtual int GetDataTagIndex(TString &str, PStringVector &fLabels);
|
||||
virtual Bool_t StripWhitespace(TString &str);
|
||||
virtual Bool_t IsWhitespace(const char *str);
|
||||
virtual Double_t ToDouble(TString &str, Bool_t &ok);
|
||||
virtual Int_t ToInt(TString &str, Bool_t &ok);
|
||||
virtual Int_t GetDataTagIndex(TString &str, PStringVector &fLabels);
|
||||
};
|
||||
|
||||
#endif // _PRUNDATAHANDLER_H_
|
||||
|
@ -233,6 +233,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
MUD_closeRead( fh );
|
||||
|
||||
free(pData);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user