Skip to content
Snippets Groups Projects
Commit a0115dec authored by adrien-matta's avatar adrien-matta
Browse files

* Adding more clearer error message in GetHisto method of Various

* TDetectorSpectra classes:
- instead of sending the out_of_range exception the code no deliver an
  error message and display the incriminated Histo family and name
- exit on error code 1
parent 2013ea4b
No related branches found
No related tags found
No related merge requests found
......@@ -330,8 +330,18 @@ TH1* TCATSSpectra::GetHisto(TString family, TString name){
vector<TString> index;
index.push_back(family);
index.push_back(name);
TH1* histo ;
try{
histo = fMapHisto.at(index);
}
catch(const std::out_of_range& oor){
cout << "ERROR : the folowing Histo has been requested by TCATSSpectra and does not exist: family:" << family << " name: " << name << endl ;
exit(1);
}
return fMapHisto.at(index);
return histo;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -577,11 +577,21 @@ TH1* TCharissaSpectra::AddHisto2D(TString name, TString title, Int_t nbinsx, Dou
////////////////////////////////////////////////////////////////////////////////
TH1* TCharissaSpectra::GetHisto(TString family, TString name){
vector<TString> index ;
vector<TString> index;
index.push_back(family);
index.push_back(name);
// fill map
return fMapHisto.at(index);
TH1* histo ;
try{
histo = fMapHisto.at(index);
}
catch(const std::out_of_range& oor){
cout << "ERROR : the folowing Histo has been requested by TCharissaSpectra and does not exist: family:" << family << " name: " << name << endl ;
exit(1);
}
return histo;
}
......
......@@ -641,12 +641,21 @@ TH1* TMust2Spectra::AddHisto2D(TString name, TString title, Int_t nbinsx, Double
////////////////////////////////////////////////////////////////////////////////
TH1* TMust2Spectra::GetHisto(TString family, TString name){
vector<TString> index ;
vector<TString> index;
index.push_back(family);
index.push_back(name);
TH1* histo ;
try{
histo = fMapHisto.at(index);
}
// fill map
return fMapHisto.at(index);
catch(const std::out_of_range& oor){
cout << "ERROR : the folowing Histo has been requested by TMust2Spectra and does not exist: family:" << family << " name: " << name << endl ;
exit(1);
}
return histo;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -318,11 +318,21 @@ TH1* TTiaraBarrelSpectra::AddHisto2D(TString name, TString title, Int_t nbinsx,
////////////////////////////////////////////////////////////////////////////////
TH1* TTiaraBarrelSpectra::GetHisto(TString family, TString name){
vector<TString> index ;
vector<TString> index;
index.push_back(family);
index.push_back(name);
// fill map
return fMapHisto.at(index);
TH1* histo ;
try{
histo = fMapHisto.at(index);
}
catch(const std::out_of_range& oor){
cout << "ERROR : the folowing Histo has been requested by TTiaraBarrelSpectra and does not exist: family:" << family << " name: " << name << endl ;
exit(1);
}
return histo;
}
////////////////////////////////////////////////////////////////////////////////
......
......@@ -179,7 +179,7 @@ void TTiaraHyballSpectra::FillRawSpectra(TTiaraHyballData* RawData){
for (unsigned int i = 0; i < RawData->GetSectorEMult(); i++) {
unsigned short channel = (RawData->GetSectorEDetectorNbr(i)-1) * fSectorsNumber + RawData->GetSectorEStripNbr(i);
GetHisto(family, name) -> Fill(channel, RawData->GetSectorEEnergy(i));
}
}
// RING_RAW_MULT
int myMULT[fWedgesNumber];
......@@ -287,6 +287,7 @@ void TTiaraHyballSpectra::FillPhysicsSpectra(TTiaraHyballPhysics* Physics){
name = Form("MM%d_XY_COR", Physics->TelescopeNumber[i]);
GetHisto(family,name)-> Fill(Physics->Si_EX[i],Physics->Si_EY[i]);
}*/
}
......@@ -330,11 +331,19 @@ TH1* TTiaraHyballSpectra::GetHisto(TString family, TString name){
vector<TString> index;
index.push_back(family);
index.push_back(name);
return fMapHisto.at(index);
}
TH1* histo ;
try{
histo = fMapHisto.at(index);
}
catch(const std::out_of_range& oor){
cout << "ERROR : the folowing Histo has been requested by THyballSpectra and does not exist: family:" << family << " name: " << name << endl ;
exit(1);
}
return histo;
}
////////////////////////////////////////////////////////////////////////////////
void TTiaraHyballSpectra::WriteHisto(TString filename){
TFile* f = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment