Commit 6992c373 authored by Jérémie Dudouet's avatar Jérémie Dudouet
Browse files

corr a bug when histos are not filled

parent d57577fa
Pipeline #36650 passed with stage
in 4 minutes and 7 seconds
...@@ -69,7 +69,8 @@ void FSGlobalCanvas::PlotCanvas() ...@@ -69,7 +69,8 @@ void FSGlobalCanvas::PlotCanvas()
FSPad* pad = dynamic_cast<FSPad*>(fMain->GetTabPage()->GetPad(fMain->GetTabPage()->GetCurrent(),i+1)); FSPad* pad = dynamic_cast<FSPad*>(fMain->GetTabPage()->GetPad(fMain->GetTabPage()->GetCurrent(),i+1));
pad->cd(); pad->cd();
fListOfHists->At(i)->Draw("hist"); if(fListOfHists->At(i)->InheritsFrom(TH1::Class()) && ((TH1*)fListOfHists->At(i))->GetEntries()>0)
fListOfHists->At(i)->Draw("hist");
} }
gROOT->SetSelectedPad(c->cd(1)); gROOT->SetSelectedPad(c->cd(1));
......
...@@ -210,13 +210,13 @@ void FSMainWindow::NewTab(TString name, Int_t npx, Int_t npy) ...@@ -210,13 +210,13 @@ void FSMainWindow::NewTab(TString name, Int_t npx, Int_t npy)
void FSMainWindow::CloseWindow() void FSMainWindow::CloseWindow()
{ {
UnmapWindow(); UnmapWindow();
DeleteWindow();// launch a delete but after a short time like a thread. DeleteWindow();// launch a delete but after a short time like a thread.
cout << " Bye Bye FIPPSSpy!" <<endl; cout << " Bye Bye FIPPSSpy!" <<endl;
gApplication->SetReturnFromRun(false); gApplication->SetReturnFromRun(false);
gApplication->Terminate(false); gApplication->Terminate(false);
} }
TPad* FSMainWindow::GetSelectedPad() TPad* FSMainWindow::GetSelectedPad()
...@@ -434,9 +434,10 @@ void FSMainWindow::ReadCal() ...@@ -434,9 +434,10 @@ void FSMainWindow::ReadCal()
Int_t id = ((TString)Buffer = loa->At(0)->GetName()).Atoi(); Int_t id = ((TString)Buffer = loa->At(0)->GetName()).Atoi();
for(int i=1 ; i<loa->GetEntries() ; i++){ for(int i=1 ; i<loa->GetEntries() ; i++)
fListOfCal[id][i-1] = ((TString)loa->At(i)->GetName()).Atof(); fListOfCal[id][i-1] = ((TString)loa->At(i)->GetName()).Atof();
}
if(fListOfCal[id][1] == 0.) fListOfCal[id][1] = 0.00001;
delete loa; delete loa;
} }
...@@ -501,23 +502,26 @@ void FSMainWindow::GetLastShiftTrack() ...@@ -501,23 +502,26 @@ void FSMainWindow::GetLastShiftTrack()
if(Buffer.BeginsWith("#") || Buffer.Length()==0 ) continue; if(Buffer.BeginsWith("#") || Buffer.Length()==0 ) continue;
TObjArray *loa=Buffer.ReplaceAll("\t"," ").Tokenize(" "); TObjArray *loa=Buffer.ReplaceAll("\t"," ").Tokenize(" ");
if(loa->GetEntries() == 2) { if(loa->GetEntries() == 2) {
fListOfShiftTrack[linenb-1][0] = ((TString)loa->At(0)->GetName()).Atof(); fListOfShiftTrack[linenb-1][0] = ((TString)loa->At(0)->GetName()).Atof();
fListOfShiftTrack[linenb-1][1] = ((TString)loa->At(1)->GetName()).Atof(); fListOfShiftTrack[linenb-1][1] = ((TString)loa->At(1)->GetName()).Atof();
}
else if(loa->GetEntries() == 3) { if(fListOfShiftTrack[linenb-1][1] == 0.) fListOfShiftTrack[linenb-1][1] = 0.00001;
fListOfShiftTrack[linenb-1][0] = ((TString)loa->At(1)->GetName()).Atof(); }
fListOfShiftTrack[linenb-1][1] = ((TString)loa->At(2)->GetName()).Atof(); else if(loa->GetEntries() == 3) {
} Int_t Id = ((TString)loa->At(0)->GetName()).Atoi();
fListOfShiftTrack[Id][0] = ((TString)loa->At(1)->GetName()).Atof();
fListOfShiftTrack[Id][1] = ((TString)loa->At(2)->GetName()).Atof();
if(fListOfShiftTrack[Id][1] == 0.) fListOfShiftTrack[Id][1] = 0.00001;
}
else { else {
WARN_MESS<<"Error in "<< FileName << " at line "<<linenb<<" ; bad number of parameters ==> file ignored"<<ENDL; WARN_MESS<<"Error in "<< FileName << " at line "<<linenb<<" ; bad number of parameters ==> file ignored"<<ENDL;
FileConf.close(); FileConf.close();
return; return;
} }
// cout<<linenb-1<<" "<<fListOfShiftTrack[linenb-1][0]<<" "<<fListOfShiftTrack[linenb-1][1]<<endl;
delete loa; delete loa;
} }
...@@ -771,7 +775,7 @@ void FSMainWindow::ReadHistograms() ...@@ -771,7 +775,7 @@ void FSMainWindow::ReadHistograms()
else { else {
test++; test++;
WARN_MESS<<"Unable to read the full file: read "<<NHistRead<<" histograms, wainting:"<<fDetectors.size()<<", retry num"<<test<<ENDL; WARN_MESS<<"Unable to read the full file: read "<<NHistRead<<" histograms, wainting:"<<fDetectors.size()<<", retry num"<<test<<ENDL;
// sleep(1); // sleep(1);
} }
file.close(); file.close();
} }
...@@ -802,7 +806,6 @@ void FSMainWindow::DoCalMode(Bool_t on) ...@@ -802,7 +806,6 @@ void FSMainWindow::DoCalMode(Bool_t on)
if(on == false) Bins[i] = i*h->GetBinWidth(1); if(on == false) Bins[i] = i*h->GetBinWidth(1);
else { else {
Double_t ERaw = fListOfShiftTrack[itr->first][0] + fListOfShiftTrack[itr->first][1]*((Double_t)i*h->GetBinWidth(1)); Double_t ERaw = fListOfShiftTrack[itr->first][0] + fListOfShiftTrack[itr->first][1]*((Double_t)i*h->GetBinWidth(1));
if(fListOfShiftTrack[itr->first][1]<0.1) ERaw = fListOfShiftTrack[itr->first][0] + 0.0001*((Double_t)i*h->GetBinWidth(1));
Double_t ECal = 0; Double_t ECal = 0;
for(int j=0 ; j<fCalOrder ; j++) for(int j=0 ; j<fCalOrder ; j++)
ECal += fListOfCal[itr->first][j]*TMath::Power(ERaw,j); ECal += fListOfCal[itr->first][j]*TMath::Power(ERaw,j);
......
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