35 #include "HistoManager.hh" 
   36 #include "HistoMessenger.hh" 
   43   fileName[0]  = 
"nrccBenchmark";
 
   64   delete fHistoMessenger;
 
   72   if (fNbHist == 0) 
return;
 
   78   analysisManager->SetVerboseLevel(1);
 
   79   G4String extension = analysisManager->GetFileType();
 
   80   fileName[1] = fileName[0] + 
"." + extension;
 
   84   G4bool fileOpen = analysisManager->OpenFile(fileName[0]);
 
   86     G4cout << 
"\n---> HistoManager::book(): cannot open " << fileName[1] 
 
   93   analysisManager->SetFirstHistoId(1);
 
   97       fHistId[k] = analysisManager->CreateH1( fLabel[k], fTitle[k],
 
   98                                               fNbins[k], fVmin[k], fVmax[k]);
 
   99       fHistPt[k] = analysisManager->GetH1(fHistId[k]);
 
  105     G4cout << 
"\n----> Histogram file is opened in " << fileName[1] << 
G4endl;
 
  114     analysisManager->Write();
 
  115     analysisManager->CloseFile();
 
  117     G4cout << 
"\n----> Histograms are saved in " << fileName[1] << 
G4endl;
 
  119     delete G4AnalysisManager::Instance();
 
  129     G4cout << 
"---> warning from HistoManager::FillHisto() : histo " << ih
 
  130            << 
"does not fExist; e= " << e << 
" w= " << weight << 
G4endl;
 
  134   if (fHistPt[ih]) fHistPt[ih]->fill(e/fUnit[ih], weight);
 
  143     G4cout << 
"---> warning from HistoManager::SetHisto() : histo " << ih
 
  144            << 
"does not fExist" << 
G4endl;
 
  148   const G4String id[] = { 
"0", 
"1", 
"2", 
"3", 
"4" };
 
  152            "projected angle at exit",                    
 
  153            "dN/dS = f(r) at exit",                       
 
  154            "d(N/cost)/dS = f(r) at exit",                
 
  155            "normalized d(N/cost)/dS = f(r) at exit"       
  161   if (unit != 
"none") {
 
  162     titl = title[ih] + 
" (" + unit + 
")";
 
  172   fWidth[ih] = fUnit[ih]*(vmax-vmin)/nbins;
 
  176   G4cout << 
"----> SetHisto " << ih << 
": " << titl << 
";  " 
  177          << nbins << 
" bins from " 
  178          << vmin << 
" " << unit << 
" to " << vmax << 
" " << unit << 
G4endl;
 
  186   if (ih >= MaxHisto) {
 
  187     G4cout << 
"---> warning from HistoManager::Normalize() : histo " << ih
 
  188            << 
"  fac= " << fac << 
G4endl;
 
  192   if (fHistPt[ih]) fHistPt[ih]->scale(fac);
 
  199  if (ih < MaxHisto) { fAscii[ih] = 
true; fAscii[0] = 
true; }
 
  201     G4cout << 
"---> warning from HistoManager::PrintHisto() : histo " << ih
 
  202            << 
"does not exist" << 
G4endl;
 
  209 void HistoManager::saveAscii()
 
  211  if (!fAscii[0]) 
return;
 
  214  std::ofstream File(name, std::ios::out);
 
  217        << 
"\n---> HistoManager::saveAscii(): cannot open " << name << 
G4endl;
 
  221  File.setf( std::ios::scientific, std::ios::floatfield );
 
  225     if (fHistPt[ih] && fAscii[ih]) {
 
  227       File << 
"\n  1D histogram " << ih << 
": " << fTitle[ih] 
 
  228            << 
"\n \n \t     X \t\t     Y" << 
G4endl;
 
  230       for (
G4int iBin=0; iBin<fNbins[ih]; iBin++) {
 
  231          File << 
"  " << iBin << 
"\t"  
  232               << fHistPt[ih]->axis().bin_center(iBin) << 
"\t" 
  233               << fHistPt[ih]->bin_height(iBin)