Message: G4H2Messenger and associated classes - problems with 2D histograms in UI-mode Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question G4H2Messenger and associated classes - problems with 2D histograms in UI-mode 

Forum: Analysis
Date: 21 Jul, 2014
From: Liz <Liz>

Hi,

I'm having some problems talking to my 2D histograms via UI commands (e.g. at PreInit) and now I'm also having some trouble getting to grips with the underlying code using release 10.1.beta. I would greatly appreciate some input on whether this works smoothly for others or not.

In short, I'd like to know what the right UI command sequnce [...] is for the parameters of /analysis/h2/set [...]. See closer description below. 1D histograms work fine and can be talked to from the UI commands, and my base code after changing to 2D histograms also appears fine and compiles and runs fine and produces nice 2D histograms until I try to change the 2D histogram parameters interactively.

Thanks! Cheers, Liz.

-------------------------------------------------------------------------------

My original problem was that I couldn't find the right sequence of UI commands to set the properties of a 2D histo. Based on G4H2Messenger::SetNewValue(G4UIcommand* command, G4String newValues), I would guess the right sequence to be the one described in:

  else if ( command == fSetH2Cmd ) {
    G4int counter = 0;
    G4int id = G4UIcommand::ConvertToInt(parameters[counter++]);
    G4int xnbins = G4UIcommand::ConvertToInt(parameters[counter++]); 
    G4int ynbins = G4UIcommand::ConvertToInt(parameters[counter++]); 
    G4double xvmin = G4UIcommand::ConvertToDouble(parameters[counter++]); 
    G4double xvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ; 
    G4double yvmin = G4UIcommand::ConvertToDouble(parameters[counter++]); 
    G4double yvmax = G4UIcommand::ConvertToDouble(parameters[counter++]); ; 
    G4String xsunit = parameters[counter++];
    G4String ysunit = parameters[counter++];
    G4String xsfcn = parameters[counter++];
    G4String ysfcn = parameters[counter++];
    fManager->SetH2(id, 
                    xnbins, xvmin, xvmax, ynbins, yvmin, yvmax, 
                    ysunit, ysfcn, ysunit, ysfcn);     
  }

There appears to be a mistake in that ysunit and ysfcn is set twice whereas xsunit and xsfcn are never passed to fManager->SetH2()? Apart from this, I would expect the right UI command to be something like

/analysis/h2/set [id] [xnbins] [ynbins] [xvmin] [xvmax] [yvmin] [yvmax] [xsunit] [ysunit] [xsfcn] [ysfcn]

This does not work, and more specifically produces a complaint from G4UIterminal::ExecuteCommand(const G4String& aCommand) that 'Parameter is out of candidate list' and that the expected values for parameter (5) [yvmin] is 'log log10 exp none' (which are the candidates for [xfnc] and [yfnc]). So I try what's in the user manual, which recommends

/analysis/h2/set [id] [nxbin] [xmin] [xmax] [xunit] [xfcn] [xbinScheme] [nybin] [ymin] [ymax] [yunit] [yfcn] [yBinScheme]

This fails with a complaint, again from G4UIterminal::ExecuteCommand(const G4String& aCommand), that parameter (6) [xbinScheme] should be an integer. In the first fail there is a check on a fParameterOutOfCandidates enum and in the second a fParameterUnreadable enum, both being set I think by G4UIparameter::CheckNewValue(const char* newValue). I also tried:

/analysis/h2/set [id] [nxbin] [xmin] [xmax] [xunit] [xfcn] [nybin] [ymin] [ymax] [yunit] [yfcn]

This fails with a complaint from G4VAnalysisManager who runs a G4AnalysisUtilities::CheckMinMax(G4double xmin, G4double xmax, const G4String& binSchemeName), but with xmin and xmax both having the value of [xmax] from the UI command line above. How this happens I don't understand at all...

Any help is greatly appreciated!

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: G4H2Messenger and associated classes - problems with 2D histograms in UI-mode   (Ivana Hrivnacova - 21 Jul, 2014)
(_ None: Re: G4H2Messenger and associated classes - problems with 2D histograms in UI-mode   (Ivana Hrivnacova - 21 Jul, 2014)
(_ Note: Re: G4H2Messenger and associated classes - problems with 2D histograms in UI-mode   (Liz - 21 Jul, 2014)
(_ None: Re: G4H2Messenger and associated classes - problems with 2D histograms in UI-mode   (Ivana Hrivnacova - 21 Jul, 2014)
 Add Message Add Message
to: "G4H2Messenger and associated classes - problems with 2D histograms in UI-mode"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]