make sure that for PSI-BIN export the 4 char detector names are unique.
This commit is contained in:
parent
4b6654ca2a
commit
b8ce741534
@ -2055,11 +2055,15 @@ Bool_t PRunDataHandler::ReadRootFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
dataSet.Clear();
|
dataSet.Clear();
|
||||||
dataSet.SetName(histo->GetTitle());
|
dataSet.SetTitle(histo->GetTitle());
|
||||||
dataSet.SetHistoNo(redGreenOffsets[i]+j+1);
|
dataSet.SetHistoNo(redGreenOffsets[i]+j+1);
|
||||||
|
|
||||||
// get detector info
|
// get detector info
|
||||||
path.Form("DetectorInfo/Detector%03d/", redGreenOffsets[i]+j+1);
|
path.Form("DetectorInfo/Detector%03d/", redGreenOffsets[i]+j+1);
|
||||||
|
pathName = path + "Name";
|
||||||
|
header->Get(pathName, str, ok);
|
||||||
|
if (ok)
|
||||||
|
dataSet.SetName(str);
|
||||||
pathName = path + "Time Zero Bin";
|
pathName = path + "Time Zero Bin";
|
||||||
header->Get(pathName, dval, ok);
|
header->Get(pathName, dval, ok);
|
||||||
if (ok)
|
if (ok)
|
||||||
@ -5582,6 +5586,29 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
|
|||||||
Int_t ival = 0;
|
Int_t ival = 0;
|
||||||
PRawRunDataSet *dataSet;
|
PRawRunDataSet *dataSet;
|
||||||
UInt_t size = fData[0].GetNoOfHistos();
|
UInt_t size = fData[0].GetNoOfHistos();
|
||||||
|
// collect histo names in order to see if they are still unique after cropping to 4 char.
|
||||||
|
PStringVector hName, hNCrop;
|
||||||
|
TString sCrop;
|
||||||
|
for (UInt_t i=0; i<size; i++) {
|
||||||
|
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
||||||
|
// detector name
|
||||||
|
str = dataSet->GetName();
|
||||||
|
hName.push_back(str);
|
||||||
|
sCrop = str;
|
||||||
|
sCrop.Remove(4);
|
||||||
|
hNCrop.push_back(sCrop);
|
||||||
|
}
|
||||||
|
// check cropped for uniqueness
|
||||||
|
ival = 1;
|
||||||
|
for (UInt_t i=0; i<size; i++) {
|
||||||
|
for (UInt_t j=i+1; j<size; j++) {
|
||||||
|
if (hNCrop[i] == hNCrop[j]) {
|
||||||
|
std::string nn = std::to_string(ival);
|
||||||
|
hNCrop[j][3] = nn[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// handle rest of the detectors
|
||||||
for (UInt_t i=0; i<size; i++) {
|
for (UInt_t i=0; i<size; i++) {
|
||||||
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
dataSet = fData[0].GetDataSet(i, false); // i.e. the false means, that i is the index and NOT the histo number
|
||||||
if (dataSet == nullptr) { // something is really wrong
|
if (dataSet == nullptr) { // something is really wrong
|
||||||
@ -5591,10 +5618,7 @@ Bool_t PRunDataHandler::WritePsiBinFile(TString fln)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// detector name
|
// detector name
|
||||||
str = dataSet->GetName();
|
psibin.PutNameHisto(hNCrop[i].Data(), i);
|
||||||
if (!str.CompareTo("n/a"))
|
|
||||||
str.Form("Detector%3d", i+1);
|
|
||||||
psibin.PutNameHisto(str.Data(), i);
|
|
||||||
// time zero bin
|
// time zero bin
|
||||||
ival = static_cast<Int_t>(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin);
|
ival = static_cast<Int_t>(dataSet->GetTimeZeroBin()/fAny2ManyInfo->rebin);
|
||||||
psibin.PutT0Int(i, ival);
|
psibin.PutT0Int(i, ival);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user