45 const G4int ExG4HbookH2Manager::fgkDefaultH2HbookIdOffset = 101;
    51    fBaseToolsManager(
"H2"),
    61 ExG4HbookH2Manager::~ExG4HbookH2Manager()
    67   std::vector<h2_booking*>::iterator it2;
    68   for ( it2 = fH2BookingVector.begin(); it2 != fH2BookingVector.end(); it2++ ) {
    78 void ExG4HbookH2Manager::SetH2HbookIdOffset()
    82   if ( fH2HbookIdOffset == -1 ) {
    83     if ( fHnManager->GetFirstId() > 0 ) 
    84       fH2HbookIdOffset = fgkDefaultH2HbookIdOffset - 1;
    86       fH2HbookIdOffset = fgkDefaultH2HbookIdOffset;
    96 void ExG4HbookH2Manager::CreateH2sFromBooking()
   102   if ( fH2Vector.size() || ( fH2BookingVector.size() == 0 ) ) 
return;       
   105   if ( fFileManager->GetHistoDirectoryName() != 
"" ) {
   106     G4String histoPath = 
"//PAWC/LUN1/";
   107     histoPath.
append(fFileManager->GetHistoDirectoryName().data());
   108     tools::hbook::CHCDIR(histoPath.
data(),
" ");
   113   std::vector<h2_booking*>::const_iterator it;
   114   for ( it = fH2BookingVector.begin(); it != fH2BookingVector.end(); ++it) {
   116     G4int id = index + fHnManager->GetFirstId();    
   117     G4HnInformation* info = fHnManager->GetHnInformation(
id, 
"CreateH2FromBooking");
   119     G4int hbookIndex = fH2HbookIdOffset + index + fHnManager->GetFirstId();
   123     if ( fState.GetVerboseL3() ) 
   124       fState.GetVerboseL3()->Message(
"create from booking", 
"h2", info->
GetName());
   130                              (*it)->fNxbins, (*it)->fXmin, (*it)->fXmax,
   131                              (*it)->fNybins, (*it)->fYmin, (*it)->fYmax);
   132     fH2Vector.push_back(h2);
   140     if ( fState.GetVerboseL3() ) { 
   142       description << 
" name : " << info->
GetName() << 
" hbook index : " << hbookIndex; 
   143       fState.GetVerboseL3()->Message(
"create from booking", 
"h2", description);
   148   if ( fFileManager->GetHistoDirectoryName() != 
"" ) {
   150     tools::hbook::CHCDIR(
"//PAWC/LUN1",
" ");
   160   std::vector<tools::hbook::h2*>::iterator it2;
   161   for (it2 = fH2Vector.begin(); it2 != fH2Vector.end(); it2++ ) {
   170 h2_booking*  ExG4HbookH2Manager::GetH2Booking(
G4int id, 
G4bool warn)
 const    172   G4int index = 
id - fHnManager->GetFirstId();
   173   if ( index < 0 || index >= 
G4int(fH2BookingVector.size()) ) {
   176       description << 
"      " << 
"histo " << 
id << 
" does not exist.";
   183   return fH2BookingVector[
index];
   191 G4bool ExG4HbookH2Manager::WriteOnAscii(std::ofstream& )
   204                                       G4bool onlyIfActive)
 const   206   G4int index = 
id - fHnManager->GetFirstId();
   207   if ( index < 0 || index >= 
G4int(fH2Vector.size()) ) {
   209       G4String inFunction = 
"ExG4HbookH2Manager::";
   210       inFunction += functionName;
   212       description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   219   if ( fState.GetIsActivation()  && onlyIfActive && ( ! fHnManager->GetActivation(
id) ) ) {
   223   return fH2Vector[
index];
   241   if ( xbinSchemeName != 
"linear" || ybinSchemeName != 
"linear" ) {
   245       << 
"Logarithimc binning is not supported for H2.";
   251   if ( fState.GetVerboseL4() ) 
   252     fState.GetVerboseL4()->Message(
"create", 
"H2", name);
   256   G4int index = fH2BookingVector.size();  
   261   h2_booking* h2Booking 
   262     = 
new h2_booking(nxbins, xfcn(xmin/xunit), xfcn(xmax/yunit), 
   263                      nybins, yfcn(ymin/yunit), yfcn(ymax/yunit)); 
   268   h2Booking->fTitle = newTitle;
   269   fH2BookingVector.push_back(h2Booking);
   271   auto hnInformation = fHnManager->AddHnInformation(name, 2);
   276   SetH2HbookIdOffset();
   279   G4int hbookIndex = fH2HbookIdOffset + index + fHnManager->GetFirstId();
   282   if ( fFileManager->IsFile() ) {
   284     G4String histoPath = 
"//PAWC/LUN1/";
   285     if ( fFileManager->GetHistoDirectoryName() != 
"" ) {
   286       histoPath.
append(fFileManager->GetHistoDirectoryName().data());
   288     tools::hbook::CHCDIR(histoPath.
data(),
" ");
   293                              nxbins, xfcn(xmin), xfcn(xmax), 
   294                              nybins, yfcn(ymin), yfcn(ymax));
   296     fH2Vector.push_back(h2);
   299     if ( fFileManager->GetHistoDirectoryName() != 
"" ) {
   300       tools::hbook::CHCDIR(
"//PAWC/LUN1",
" ");
   305     if ( fState.GetVerboseL2() ) {
   307       description << 
" name : " << name << 
" hbook index : " << hbookIndex; 
   308       fState.GetVerboseL2()->Message(
"create", 
"H2", description);
   312   fH2NameIdMap[
name] = index + fHnManager->GetFirstId();
   313   return index + fHnManager->GetFirstId();
   318                           const std::vector<G4double>& ,
   319                           const std::vector<G4double>& ,
   327     << 
"User defined binning is not supported for H2.";
   342   if ( xbinScheme != 
"linear" || ybinScheme != 
"linear" ) {
   346       << 
"Logarithimc binning is not supported for H2.";
   351   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   354     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   362   if ( fState.GetVerboseL4() ) 
   363     fState.GetVerboseL4()->Message(
"configure", 
"H2", hnInfo->
GetName());
   372   h2Booking->fNxbins = nxbins;
   373   h2Booking->fXmin = xfcn(xmin/xunit);
   374   h2Booking->fXmax = xfcn(xmax/xunit);
   375   h2Booking->fNybins = nybins;
   376   h2Booking->fYmin = yfcn(ymin/yunit);
   377   h2Booking->fYmax = yfcn(ymax/yunit);
   384   xInfo->
fUnit = xunit;
   391   yInfo->
fUnit = yunit;
   393   fHnManager->SetActivation(
id, 
true); 
   395   G4String newTitle(h2Booking->fTitle);
   398   h2Booking->fTitle = newTitle;  
   401   if ( fH2Vector.size() ) {
   403     h2->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit), 
   404                   nybins, yfcn(ymin/yunit), yfcn(ymax/yunit));
   412                             const std::vector<G4double>& ,
   413                             const std::vector<G4double>& ,
   421     << 
"User defined binning is not supported for H2.";
   432   if ( ! h2 ) 
return false;
   434   return h2->scale(factor);
   443   if ( ! h2 ) 
return false;
   445   if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(
id) ) ) 
return false; 
   448     = fHnManager->GetHnDimensionInformation(
id, 
kX, 
"FillH2");
   450     = fHnManager->GetHnDimensionInformation(
id, 
kY, 
"FillH2");
   451   h2->fill(xInfo->
fFcn(xvalue/xInfo->
fUnit), 
   454   if ( fState.GetVerboseL4() ) {
   456     description << 
" id " << 
id    457                 << 
" xvalue " << xvalue 
   458                 << 
" xfcn(xvalue/xunit) " <<  xInfo->
fFcn(xvalue/xInfo->
fUnit) 
   459                 << 
" yvalue " << yvalue
   460                 << 
" yfcn(yvalue/yunit) " <<  yInfo->
fFcn(yvalue/yInfo->
fUnit) 
   462     fState.GetVerboseL4()->Message(
"fill", 
"H2", description);
   470                                                    G4bool onlyIfActive)
 const    472   return GetH2InFunction(
id, 
"GetH2", warn, onlyIfActive);
   478   std::map<G4String, G4int>::const_iterator it = fH2NameIdMap.find(name);
   479   if ( it ==  fH2NameIdMap.end() ) {  
   481       G4String inFunction = 
"ExG4HbookH2Manager::GetH2Id";
   483       description << 
"      " << 
"histogram " << name << 
" does not exist.";
   492 G4int ExG4HbookH2Manager::GetH2Nxbins(
G4int id)
 const   495   if ( ! h2 ) 
return 0;
   497   return fBaseToolsManager.GetNbins(h2->axis_x());
   506   if ( ! h2 ) 
return 0;
   508   return fBaseToolsManager.GetMin(h2->axis_x());
   515   if ( ! h2 ) 
return 0;
   517   return fBaseToolsManager.GetMin(h2->axis_x());
   524   if ( ! h2 ) 
return 0;
   526   return fBaseToolsManager.GetWidth(h2->axis_x());
   530 G4int ExG4HbookH2Manager::GetH2Nybins(
G4int id)
 const   533   if ( ! h2 ) 
return 0;
   535   return fBaseToolsManager.GetNbins(h2->axis_y());
   544   if ( ! h2 ) 
return 0;
   546   return fBaseToolsManager.GetMin(h2->axis_y());
   553   if ( ! h2 ) 
return 0;
   555   return fBaseToolsManager.GetMax(h2->axis_y());
   562   if ( ! h2 ) 
return 0;
   564   return fBaseToolsManager.GetWidth(h2->axis_y());
   570   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   573     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   579   h2Booking->fTitle = 
title;
   586   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   589     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   596   h2Booking->fXAxisTitle = 
title;
   599   tools::hbook::h2* h2 = GetH2InFunction(
id, 
"SetH2XAxisTitle", 
false, 
false);
   600   if ( ! h2 )  
return true;
   608   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   611     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   618   h2Booking->fYAxisTitle = 
title;
   621   tools::hbook::h2* h2 = GetH2InFunction(
id, 
"SetH2YAxisTitle", 
false, 
false);
   622   if ( ! h2 )  
return true;
   630   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   633     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   640   h2Booking->fZAxisTitle = 
title;
   643   tools::hbook::h2* h2 = GetH2InFunction(
id, 
"SetH2ZAxisTitle", 
false, 
false);
   644   if ( ! h2 )  
return true;
   652   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   655     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   661   return h2Booking->fTitle;
   668   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   671     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   677   return h2Booking->fXAxisTitle;
   683   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   686     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   692   return h2Booking->fYAxisTitle;
   698   h2_booking* h2Booking = GetH2Booking(
id, 
false);
   701     description << 
"      " << 
"histogram " << 
id << 
" does not exist.";
   707   return h2Booking->fZAxisTitle;
   711 G4bool ExG4HbookH2Manager::SetH2HbookIdOffset(
G4int offset) 
   713   if ( fH2Vector.size() ) {
   716       << 
"Cannot set H2HbookIdOffset as some H2 histogramms already exist.";
   717     G4Exception(
"G4HbookH2Manager::SetH2HbookIdOffset()",
   722   if ( fHnManager->GetFirstId() + offset < 1 ) {
   724     description << 
"The first histogram HBOOK id must be >= 1.";
   725     G4Exception(
"G4HbookH2Manager::SetH2HbookIdOffset()",
   730   fH2HbookIdOffset = offset;
 G4double(*)(G4double) G4Fcn
 
const char * data() const
 
std::ostringstream G4ExceptionDescription
 
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
 
G4double GetUnitValue(const G4String &unit)
 
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
 
ntupleExperimental Reset()
 
static const G4double factor
 
G4Fcn GetFunction(const G4String &fcnName)
 
G4String & append(const G4String &)
 
Definition of the ExG4HbookH2Manager class. 
 
Definition of the ExG4HbookFileManager class.