41 fFirstNtupleColumnId(0),
43 fHistoDirectoryName(
""),
44 fNtupleDirectoryName(
""),
45 fLockFirstHistoId(false),
46 fLockFirstNtupleColumnId(false),
48 fLockHistoDirectoryName(false),
49 fLockNtupleDirectoryName(false),
84 fH1Informations.push_back(
86 unit, unit, fcn, fcn));
99 fH2Informations.push_back(
101 xunit, yunit, xfcn, yfcn));
110 if ( name.find(
".") != std::string::npos ) {
111 name.erase(name.find(
"."), name.length());
120 std::ofstream output(name, std::ios::out);
124 <<
"Cannot open file. File name is not defined.";
129 output.setf( std::ios::scientific, std::ios::floatfield );
146 if ( ! info )
return "";
156 if ( ! info )
return 1.0;
166 if ( ! info )
return 1.0;
176 if ( ! info )
return true;
186 if ( ! info )
return false;
195 if ( unit !=
"none" ) {
197 if ( value == 0. ) value = 1.;
206 if ( fcnName !=
"none" ) {
207 if ( fcnName ==
"log" ) fcn = std::log;
208 else if ( fcnName ==
"log10") fcn = std::log10;
209 else if ( fcnName ==
"exp" ) fcn = std::exp;
213 <<
" \"" << fcnName <<
"\" function is not supported." <<
G4endl
214 <<
" " <<
"No function will be applied to h1 values.";
229 if ( verboseLevel ==
fVerboseLevel || verboseLevel < 0 )
return;
233 if ( verboseLevel == 0 ) {
239 else if ( verboseLevel == 1 ) {
245 else if ( verboseLevel == 2 ) {
251 else if ( verboseLevel == 3 ) {
271 <<
"Cannot open file. File name is not defined.";
286 <<
"Cannot set File name as its value was already used.";
302 <<
"Cannot set Histo directory name as its value was already used.";
303 G4Exception(
"G4VAnalysisManager::SetHistoDirectoryName()",
318 <<
"Cannot set Ntuple directory name as its value was already used.";
319 G4Exception(
"G4VAnalysisManager::SetNtupleDirectoryName()",
332 if ( name.find(
".") == std::string::npos ) {
346 <<
"Cannot set FirstHistoId as its value was already used.";
347 G4Exception(
"G4VAnalysisManager::SetFirstHistoId()",
362 <<
"Cannot set FirstNtupleColumnId as its value was already used.";
363 G4Exception(
"G4VAnalysisManager::SetFirstHistoId()",
377 return ( fNofActiveObjects > 0 );
383 return ( fNofAsciiObjects > 0 );
390 if ( index < 0 || index >=
GetNofH1s() ) {
392 description <<
" " <<
"histo " <<
id <<
" does not exist.";
393 G4Exception(
"G4VAnalysisManager::GetH1Information()",
397 return fH1Informations[index];
404 if ( index < 0 || index >=
GetNofH2s() ) {
406 description <<
" " <<
"histo " <<
id <<
" does not exist.";
407 G4Exception(
"G4VAnalysisManager::GetH2Information()",
411 return fH2Informations[index];
434 description <<
"Wrong object type.";
435 G4Exception(
"G4VAnalysisManager::SetFirstHistoId()",
448 if ( ! info )
return;
466 std::vector<G4HnInformation*>* informations;
468 informations = &fH1Informations;
469 else if ( type ==
kH2 )
470 informations = &fH2Informations;
476 description <<
"Wrong object type.";
482 std::vector<G4HnInformation*>::iterator it;
483 for ( it = informations->begin(); it != informations->end(); it++ ) {
503 if ( ! info )
return;
506 if ( info->
fAscii == ascii )
return;
G4double G4FcnIdentity(G4double value)
G4double(* G4Fcn)(G4double)
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true)
G4String & append(const G4String &)
static G4double GetValueOf(const G4String &)
virtual G4int GetNofH1s() const
G4double GetUnitValue(const G4String &unit) const
G4bool GetActivation() const
virtual ~G4VAnalysisManager()
void AddH1Information(const G4String &name, const G4String &unitName, const G4String &fcnName, G4double unit, G4Fcn fx)
G4int fFirstNtupleColumnId
G4AnalysisVerbose * fpVerboseL4
void AddH2Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4double xunit, G4double yunit, G4Fcn fx, G4Fcn fy)
void SetAscii(ObjectType type, G4int id, G4bool ascii)
G4AnalysisVerbose fVerboseL2
G4bool fLockFirstNtupleColumnId
G4bool fLockNtupleDirectoryName
G4AnalysisVerbose * fpVerboseL2
G4HnInformation * GetH2Information(G4int id) const
G4double GetYUnit(ObjectType type, G4int id) const
G4String fHistoDirectoryName
G4HnInformation * GetInformation(ObjectType type, G4int id) const
G4AnalysisVerbose fVerboseL3
G4AnalysisVerbose * fpVerboseL3
void SetActivation(G4bool activation)
virtual G4bool SetFirstNtupleColumnId(G4int firstId)
G4AnalysisVerbose fVerboseL4
G4HnInformation * GetH1Information(G4int id) const
virtual G4bool SetHistoDirectoryName(const G4String &dirName)
G4bool fLockHistoDirectoryName
G4String fNtupleDirectoryName
virtual G4bool OpenFile()
G4AnalysisVerbose * fpVerboseL1
virtual void SetVerboseLevel(G4int verboseLevel)
G4bool GetAscii(ObjectType type, G4int id) const
virtual G4bool WriteOnAscii(std::ofstream &output)=0
G4String GetName(ObjectType type, G4int id) const
G4double GetXUnit(ObjectType type, G4int id) const
G4String GetFileType() const
virtual G4bool SetFileName(const G4String &fileName)
virtual G4bool SetFirstHistoId(G4int firstId)
virtual G4bool SetNtupleDirectoryName(const G4String &dirName)
G4VAnalysisManager(const G4String &type="")
virtual G4String GetFullFileName() const
G4AnalysisVerbose fVerboseL1
G4Fcn GetFunction(const G4String &fcnName) const
virtual G4int GetNofH2s() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription