Commit fb60704c authored by Jérémie Dudouet's avatar Jérémie Dudouet Committed by Jérémie Dudouet
Browse files

up check run

parent 0ee77083
...@@ -159,7 +159,7 @@ void FSMainWindow::LoadRightSide() ...@@ -159,7 +159,7 @@ void FSMainWindow::LoadRightSide()
fStatusBar->Draw3DCorner(kFALSE); fStatusBar->Draw3DCorner(kFALSE);
fVFRight->AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 0, 0, 2, 0)); fVFRight->AddFrame(fStatusBar, new TGLayoutHints(kLHintsBottom | kLHintsLeft | kLHintsExpandX, 0, 0, 2, 0));
// NewTab(); // NewTab();
} }
void FSMainWindow::NewTab(TString name, Int_t npx, Int_t npy) void FSMainWindow::NewTab(TString name, Int_t npx, Int_t npy)
...@@ -552,19 +552,19 @@ void FSMainWindow::ReadHistograms() ...@@ -552,19 +552,19 @@ void FSMainWindow::ReadHistograms()
TString Command = Form("ls -ltr %s | grep ^- | tail -1 | awk '{ print $(NF) }'",DataDir.Data()); TString Command = Form("ls -ltr %s | grep ^- | tail -1 | awk '{ print $(NF) }'",DataDir.Data());
Run = GetStdoutFromCommand(Command.Data()); Run = GetStdoutFromCommand(Command.Data());
Run.ReplaceAll(".lst",""); Run.ReplaceAll(".lst","");
FileName = Form("%s/%s",getenv("FSRawDataDir"),Run.Data()); FileName = Form("%s/%s",getenv("FSRawDataDir"),Run.Data());
} }
else { else {
bool ok = true; bool ok = true;
Int_t Test=fLastRun.Atoi(); Int_t Test=fLastRun.Atoi();
while(ok){ while(ok){
Test++; Test++;
FileName = Form("%s/%.06d",getenv("FSRawDataDir"),Test); FileName = Form("%s/%.06d",getenv("FSRawDataDir"),Test);
ok = gSystem->IsFileInIncludePath(FileName); ok = gSystem->IsFileInIncludePath(FileName);
} }
Test=Test-1; Test=Test-1;
Run=Form("%.06d",Test); Run=Form("%.06d",Test);
FileName = Form("%s/%s",getenv("FSRawDataDir"),Run.Data()); FileName = Form("%s/%s",getenv("FSRawDataDir"),Run.Data());
} }
ifstream file(FileName.Data()); ifstream file(FileName.Data());
...@@ -577,15 +577,15 @@ void FSMainWindow::ReadHistograms() ...@@ -577,15 +577,15 @@ void FSMainWindow::ReadHistograms()
struct stat result; struct stat result;
if(stat(FileName.Data(), &result)==0) { if(stat(FileName.Data(), &result)==0) {
TString date = Form("%s",asctime(localtime(&result.st_mtime))); TString date = Form("%s",asctime(localtime(&result.st_mtime)));
date.ReplaceAll("\n",""); date.ReplaceAll("\n","");
INFO_MESS<<"Run date: "<<date<<ENDL; INFO_MESS<<"Run date: "<<date<<ENDL;
fCurrentDate = date; fCurrentDate = date;
} }
else { else {
WARN_MESS<<"Unable to get file time modification"<<ENDL; WARN_MESS<<"Unable to get file time modification"<<ENDL;
fCurrentDate = "Undef"; fCurrentDate = "Undef";
SetWindowName(Form("FIPPSSpy v%s: Run %s - %s !! Disk not Available !!", FIPPSSpy_version,Run.Data(),fCurrentDate.Data())); SetWindowName(Form("FIPPSSpy v%s: Run %s - %s !! Disk not Available !!", FIPPSSpy_version,Run.Data(),fCurrentDate.Data()));
return; return;
} }
map<Int_t, TH1I*>::iterator itr; map<Int_t, TH1I*>::iterator itr;
...@@ -596,76 +596,89 @@ void FSMainWindow::ReadHistograms() ...@@ -596,76 +596,89 @@ void FSMainWindow::ReadHistograms()
TString Buffer; TString Buffer;
string line; string line;
getline(file,line);getline(file,line);getline(file,line);
Buffer=line;
Buffer.ReplaceAll("FIPPintern ","");
while(Buffer.EndsWith(" ")) Buffer.Remove(Buffer.Length()-1);
//fCurrentDate = Buffer;
TObjArray *arr; TObjArray *arr;
while(file) { Int_t test=0;
getline(file,line);Buffer=line; Bool_t ok=false;
while(!Buffer.BeginsWith("SSS") && file) {getline(file,line);Buffer=line;} while(ok == false && test<10) {
if(!file) break;
getline(file,line);Buffer=line; if(!file) file.open(FileName.Data());
arr = Buffer.ReplaceAll("\t"," ").Tokenize(" "); Int_t NHistRead = 0;
Int_t adc = ((TString)arr->First()->GetName()).Atoi()-1;
delete arr; getline(file,line);getline(file,line);getline(file,line);
if(!fDetectors[adc]) continue; Buffer=line;
getline(file,line);getline(file,line);Buffer=line; Buffer.ReplaceAll("FIPPintern ","");
arr = Buffer.Tokenize(" "); while(Buffer.EndsWith(" ")) Buffer.Remove(Buffer.Length()-1);
Int_t NBins = ((TString)arr->First()->GetName()).Atoi();
Int_t Array[NBins+2]; while(file) {
Int_t Val; getline(file,line);Buffer=line;
delete arr; while(!Buffer.BeginsWith("SSS") && file) {getline(file,line);Buffer=line;}
Array[0] = 0; if(!file) break;
Array[NBins+1]=0; getline(file,line);Buffer=line;
for(int i=0 ; i<NBins ; i++) { arr = Buffer.ReplaceAll("\t"," ").Tokenize(" ");
file>>Val; Array[i+1] = Val; Int_t adc = ((TString)arr->First()->GetName()).Atoi()-1;
} delete arr;
Int_t id = fDetectors[adc]->GlobId; if(fDetectors.count(adc)==0) continue;
Int_t type=CanvasTypes::kUndef;
Int_t DetNum=-1; getline(file,line);getline(file,line);Buffer=line;
DetDef *det = fDetectors[adc]; arr = Buffer.Tokenize(" ");
if(det->IsFIPPS()) { Int_t NBins = ((TString)arr->First()->GetName()).Atoi();
type = CanvasTypes::kFIPPS; Int_t Array[NBins+2];
DetNum = det->Id; Int_t Val;
} delete arr;
else if(det->IsIFIN()) { Array[0] = 0;
type = CanvasTypes::kIFIN; Array[NBins+1]=0;
DetNum = det->Id; for(int i=0 ; i<NBins ; i++) {
} file>>Val; Array[i+1] = Val;
else if(det->IsTAG()) { }
type = CanvasTypes::kTAG; Int_t id = fDetectors[adc]->GlobId;
DetNum = det->Id; Int_t type=CanvasTypes::kUndef;
} Int_t DetNum=-1;
else if(det->IsAC()) { DetDef *det = fDetectors[adc];
if(det->Type == 3) { if(det->IsFIPPS()) {
type = CanvasTypes::kIFIN_AC; type = CanvasTypes::kFIPPS;
DetNum = det->Id; DetNum = det->Id;
} }
else if(det->Type == 5) { else if(det->IsIFIN()) {
type = CanvasTypes::kFIPPS_ACB; type = CanvasTypes::kIFIN;
DetNum = det->Id/3; DetNum = det->Id;
} }
else if(det->Type == 6) { else if(det->IsTAG()) {
type = CanvasTypes::kFIPPS_ACF; type = CanvasTypes::kTAG;
DetNum = det->Id/3; DetNum = det->Id;
} }
else if(det->Type == 7) { else if(det->IsAC()) {
type = CanvasTypes::kFIPPS_ACS; if(det->Type == 3) {
DetNum = det->Id/3; type = CanvasTypes::kIFIN_AC;
DetNum = det->Id;
}
else if(det->Type == 5) {
type = CanvasTypes::kFIPPS_ACB;
DetNum = det->Id/3;
}
else if(det->Type == 6) {
type = CanvasTypes::kFIPPS_ACF;
DetNum = det->Id/3;
}
else if(det->Type == 7) {
type = CanvasTypes::kFIPPS_ACS;
DetNum = det->Id/3;
}
} }
} TString HistName = Form("Hist_%s_%d",fNames[type].Data(),DetNum);
TString HistName = Form("Hist_%s_%d",fNames[type].Data(),DetNum); if(fListOfSpectra.count(id)==0) fListOfSpectra[id] = new TH1I(HistName,HistName,NBins,0,NBins);
if(!fListOfSpectra[id]) fListOfSpectra[id] = new TH1I(HistName,HistName,NBins,0,NBins);
memcpy(((TH1I*)fListOfSpectra[id])->fArray,Array,sizeof(Array)); memcpy(((TH1I*)fListOfSpectra[id])->fArray,Array,sizeof(Array));
fListOfSpectra[id]->SetEntries(fListOfSpectra[id]->Integral()); fListOfSpectra[id]->SetEntries(fListOfSpectra[id]->Integral());
NHistRead++;
}
if(NHistRead == fDetectors.size()) ok = true;
else {
test++;
WARN_MESS<<"Unable to read the full file, retry "<<test<<endl;
}
file.close();
} }
file.close();
fLastRun = Run; fLastRun = Run;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment