49void NtupleMergingWarning(
const G4String& functionName,
54 <<
" " <<
"Ntuple merging is not available with "
55 << outputType <<
" output." <<
G4endl
56 <<
" " <<
"Setting is ignored.";
64 : fState(type, isMaster),
65 fVFileManager(nullptr),
66 fPlotManager(nullptr),
67 fNtupleBookingManager(nullptr),
68 fVNtupleManager(nullptr),
70 fH1HnManager(nullptr),
71 fH2HnManager(nullptr),
72 fH3HnManager(nullptr),
73 fP1HnManager(nullptr),
74 fP2HnManager(nullptr),
97 fVH1Manager.reset(h1Manager);
99 fMessenger->SetH1HnManager(*fH1HnManager);
106 fVH2Manager.reset(h2Manager);
108 fMessenger->SetH2HnManager(*fH2HnManager);
115 fVH3Manager.reset(h3Manager);
117 fMessenger->SetH3HnManager(*fH3HnManager);
124 fVP1Manager.reset(p1Manager);
126 fMessenger->SetP1HnManager(*fP1HnManager);
133 fVP2Manager.reset(p2Manager);
135 fMessenger->SetP2HnManager(*fP2HnManager);
152 if ( fH1HnManager !=
nullptr ) fH1HnManager->SetFileManager(fileManager);
153 if ( fH2HnManager !=
nullptr ) fH2HnManager->SetFileManager(fileManager);
154 if ( fH3HnManager !=
nullptr ) fH3HnManager->SetFileManager(fileManager);
155 if ( fP1HnManager !=
nullptr ) fP1HnManager->SetFileManager(fileManager);
156 if ( fP2HnManager !=
nullptr ) fP2HnManager->SetFileManager(fileManager);
168 G4bool finalResult =
true;
172 if ( name.find(
".") != std::string::npos ) {
173 name.erase(name.find(
"."), name.length());
175 name.append(
".ascii");
182 std::ofstream output(name, std::ios::out);
186 <<
"Cannot open file. File name is not defined.";
191 output.setf( std::ios::scientific, std::ios::floatfield );
193 G4bool result = fVH1Manager->WriteOnAscii(output);
194 finalResult = finalResult && result;
196 result = fVH2Manager->WriteOnAscii(output);
197 finalResult = finalResult && result;
199 result = fVH3Manager->WriteOnAscii(output);
200 finalResult = finalResult && result;
223 if ( fileName !=
"" ) {
230 <<
"Cannot open file. File name is not defined.";
242 G4bool finalResult =
true;
245 finalResult = finalResult && result;
249 finalResult = finalResult && result;
300 fState.SetCompressionLevel(level);
337 return fVH1Manager->CreateH1(name, title, nbins, xmin, xmax,
338 unitName, fcnName, binSchemeName);
343 const std::vector<G4double>& edges,
349 return fVH1Manager->CreateH1(name, title, edges, unitName, fcnName);
370 return fVH2Manager->CreateH2(name, title,
371 nxbins, xmin, xmax, nybins, ymin, ymax,
372 xunitName, yunitName, xfcnName, yfcnName,
373 xbinSchemeName, ybinSchemeName);
378 const std::vector<G4double>& xedges,
379 const std::vector<G4double>& yedges,
389 return fVH2Manager->CreateH2(name, title,
391 xunitName, yunitName, xfcnName, yfcnName);
419 return fVH3Manager->CreateH3(name, title,
420 nxbins, xmin, xmax, nybins, ymin, ymax,
422 xunitName, yunitName, zunitName,
423 xfcnName, yfcnName, zfcnName,
424 xbinSchemeName, ybinSchemeName, zbinSchemeName);
429 const std::vector<G4double>& xedges,
430 const std::vector<G4double>& yedges,
431 const std::vector<G4double>& zedges,
444 return fVH3Manager->CreateH3(name, title,
445 xedges, yedges, zedges,
446 xunitName, yunitName, zunitName,
447 xfcnName, yfcnName, zfcnName);
459 return fVH1Manager->SetH1(
id, nbins, xmin, xmax, unitName, fcnName, binSchemeName);
464 const std::vector<G4double>& edges,
469 return fVH1Manager->SetH1(
id, edges, unitName, fcnName);
487 return fVH2Manager->SetH2(
id, nxbins, xmin, xmax, nybins, ymin, ymax,
488 xunitName, yunitName, xfcnName, yfcnName,
489 xbinSchemeName, ybinSchemeName);
494 const std::vector<G4double>& xedges,
495 const std::vector<G4double>& yedges,
502 return fVH2Manager->SetH2(
id, xedges, yedges,
503 xunitName, yunitName, xfcnName, yfcnName);
528 return fVH3Manager->SetH3(
id,
529 nxbins, xmin, xmax, nybins, ymin, ymax,
531 xunitName, yunitName, zunitName,
532 xfcnName, yfcnName, zfcnName,
533 xbinSchemeName, ybinSchemeName, zbinSchemeName);
538 const std::vector<G4double>& xedges,
539 const std::vector<G4double>& yedges,
540 const std::vector<G4double>& zedges,
550 return fVH3Manager->SetH3(
id, xedges, yedges, zedges,
551 xunitName, yunitName, zunitName,
552 xfcnName, yfcnName, zfcnName);
558 return fVH1Manager->ScaleH1(
id, factor);
564 return fVH2Manager->ScaleH2(
id, factor);
570 return fVH3Manager->ScaleH3(
id, factor);
584 if ( ymin != 0. || ymax != 0. ) {
589 return fVP1Manager->CreateP1(name, title, nbins, xmin, xmax, ymin, ymax,
590 xunitName, yunitName, xfcnName, yfcnName,
596 const std::vector<G4double>& edges,
603 if ( ymin != 0. || ymax != 0. ) {
608 return fVP1Manager->CreateP1(name, title, edges, ymin, ymax,
609 xunitName, yunitName, xfcnName, yfcnName);
628 if ( zmin != 0. || zmax != 0. ) {
633 return fVP2Manager->CreateP2(name, title,
634 nxbins, xmin, xmax, nybins, ymin, ymax,
636 xunitName, yunitName, zunitName,
637 xfcnName, yfcnName, zfcnName,
638 xbinSchemeName, ybinSchemeName);
643 const std::vector<G4double>& xedges,
644 const std::vector<G4double>& yedges,
654 if ( zmin != 0. || zmax != 0. ) {
659 return fVP2Manager->CreateP2(name, title, xedges, yedges, zmin, zmax,
660 xunitName, yunitName, zunitName,
661 xfcnName, yfcnName, zfcnName);
674 if ( ymin != 0. || ymax != 0. ) {
679 return fVP1Manager->SetP1(
id, nbins, xmin, xmax, ymin, ymax,
680 xunitName, yunitName, xfcnName, yfcnName,
686 const std::vector<G4double>& edges,
692 if ( ymin != 0. || ymax != 0. ) {
697 return fVP1Manager->SetP1(
id, edges, ymin, ymax,
698 xunitName, yunitName, xfcnName, yfcnName);
717 if ( zmin != 0. || zmax != 0. ) {
722 return fVP2Manager->SetP2(
id, nxbins, xmin, xmax, nybins, ymin, ymax,
724 xunitName, yunitName, zunitName,
725 xfcnName, yfcnName, zfcnName,
726 xbinSchemeName, ybinSchemeName);
731 const std::vector<G4double>& xedges,
732 const std::vector<G4double>& yedges,
743 if ( zmin != 0. || zmax != 0. ) {
748 return fVP2Manager->SetP2(
id, xedges, yedges, zmin, zmax,
749 xunitName, yunitName, zunitName,
750 xfcnName, yfcnName, zfcnName);
756 return fVP1Manager->ScaleP1(
id, factor);
762 return fVP2Manager->ScaleP2(
id, factor);
808 std::vector<int>& vector)
817 std::vector<float>& vector)
826 std::vector<double>& vector)
850 NtupleMergingWarning(
"G4VAnalysisManager::SetNtupleMerging",
GetType());
860 NtupleMergingWarning(
"G4VAnalysisManager::SetNtupleRowWise",
GetType());
869 NtupleMergingWarning(
"G4VAnalysisManager::SetBasketSize",
GetType());
878 NtupleMergingWarning(
"G4VAnalysisManager::SetBasketEntries",
GetType());
921 std::vector<int>& vector)
931 std::vector<float>& vector)
941 std::vector<double>& vector)
961 G4bool finalResult =
true;
964 finalResult = finalResult && result;
967 finalResult = finalResult && result;
970 finalResult = finalResult && result;
978 return fH1HnManager->SetFirstId(firstId);
984 return fH2HnManager->SetFirstId(firstId);
990 return fH3HnManager->SetFirstId(firstId);
996 G4bool finalResult =
true;
999 finalResult = finalResult && result;
1002 finalResult = finalResult && result;
1010 return fP1HnManager->SetFirstId(firstId);
1016 return fP2HnManager->SetFirstId(firstId);
1022 auto finalResult =
true;
1025 finalResult = finalResult && result;
1029 finalResult = finalResult && result;
1038 auto finalResult =
true;
1041 finalResult = finalResult && result;
1045 finalResult = finalResult && result;
1056 fState.SetIsActivation(activation);
1068 ( fH1HnManager->IsActive() ||
1069 fH2HnManager->IsActive() ||
1070 fH3HnManager->IsActive() ||
1071 fP1HnManager->IsActive() ||
1072 fP2HnManager->IsActive() );
1080 return ( fH1HnManager->IsAscii() ||
1081 fH2HnManager->IsAscii() ||
1082 fH3HnManager->IsAscii() ||
1083 fP1HnManager->IsAscii() ||
1084 fP2HnManager->IsAscii() );
1092 return ( fH1HnManager->IsPlotting() ||
1093 fH2HnManager->IsPlotting() ||
1094 fH3HnManager->IsPlotting() ||
1095 fP1HnManager->IsPlotting() ||
1096 fP2HnManager->IsPlotting() );
1104 return fH1HnManager->GetFirstId();
1112 return fH2HnManager->GetFirstId();
1120 return fH3HnManager->GetFirstId();
1128 return fP1HnManager->GetFirstId();
1136 return fP2HnManager->GetFirstId();
1158 return fH1HnManager->GetNofHns();
1164 return fH2HnManager->GetNofHns();
1170 return fH3HnManager->GetNofHns();
1176 return fP1HnManager->GetNofHns();
1182 return fP2HnManager->GetNofHns();
1198 fH1HnManager->SetActivation(
id, activation);
1206 fH1HnManager->SetActivation(activation);
1212 fH1HnManager->SetAscii(
id, ascii);
1218 fH1HnManager->SetPlotting(
id, plotting);
1224 fH1HnManager->SetFileName(
id, fileName);
1232 fH2HnManager->SetActivation(
id, activation);
1240 fH2HnManager->SetActivation(activation);
1246 fH2HnManager->SetAscii(
id, ascii);
1252 fH2HnManager->SetPlotting(
id, plotting);
1258 fH2HnManager->SetFileName(
id, fileName);
1266 fH3HnManager->SetActivation(
id, activation);
1274 fH3HnManager->SetActivation(activation);
1280 fH3HnManager->SetAscii(
id, ascii);
1286 fH3HnManager->SetPlotting(
id, plotting);
1292 fH3HnManager->SetFileName(
id, fileName);
1300 fP1HnManager->SetActivation(
id, activation);
1308 fP1HnManager->SetActivation(activation);
1314 fP1HnManager->SetAscii(
id, ascii);
1320 fP1HnManager->SetPlotting(
id, plotting);
1326 fP1HnManager->SetFileName(
id, fileName);
1334 fP2HnManager->SetActivation(
id, activation);
1342 fP2HnManager->SetActivation(activation);
1348 fP2HnManager->SetAscii(
id, ascii);
1354 fP2HnManager->SetPlotting(
id, plotting);
1360 fP2HnManager->SetFileName(
id, fileName);
1406 fState.SetVerboseLevel(verboseLevel);
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
const G4AnalysisVerbose * GetVerboseL3() const
G4int GetCompressionLevel() const
const G4AnalysisVerbose * GetVerboseL1() const
G4bool GetIsActivation() const
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
G4int CreateP1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
virtual G4bool MergeImpl(tools::histo::hmpi *hmpi)=0
G4int GetFirstP2Id() const
std::shared_ptr< G4PlotManager > fPlotManager
void SetH1Ascii(G4int id, G4bool ascii)
G4int GetFirstNtupleId() const
virtual G4bool IsOpenFileImpl() const =0
G4int CreateP2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
G4int GetFirstH2Id() const
void SetH2FileName(G4int id, const G4String &fileName)
void SetH1Activation(G4bool activation)
virtual ~G4VAnalysisManager()
void SetH1Plotting(G4int id, G4bool plotting)
void SetH3Ascii(G4int id, G4bool ascii)
void SetH1Manager(G4VH1Manager *h1Manager)
G4int GetNofNtuples() const
void SetH3Activation(G4bool activation)
G4int GetFirstP1Id() const
G4int CreateH1(const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
void SetH2Manager(G4VH2Manager *h2Manager)
G4int CreateNtupleIColumn(const G4String &name)
virtual G4bool WriteImpl()=0
G4String GetHistoDirectoryName() const
G4int CreateNtupleDColumn(const G4String &name)
void SetH3Plotting(G4int id, G4bool plotting)
void SetP2FileName(G4int id, const G4String &fileName)
void SetNtupleFileName(const G4String &fileName)
G4int CreateNtupleFColumn(const G4String &name)
G4bool SetH3(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nzbins, G4double zmin, G4double zmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4int GetFirstH1Id() const
void SetP2Plotting(G4int id, G4bool plotting)
G4bool SetP1(G4int id, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear")
G4bool SetFirstP1Id(G4int firstId)
G4bool SetP2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
virtual G4bool OpenFileImpl(const G4String &fileName)=0
G4VAnalysisManager(const G4String &type, G4bool isMaster)
void SetActivation(G4bool activation)
G4bool SetFirstNtupleColumnId(G4int firstId)
G4String GetFileName() const
G4bool CloseFile(G4bool reset=true)
G4bool OpenFile(const G4String &fileName="")
void SetH3FileName(G4int id, const G4String &fileName)
std::shared_ptr< G4NtupleBookingManager > fNtupleBookingManager
G4bool ScaleP1(G4int id, G4double factor)
void SetPlotManager(std::shared_ptr< G4PlotManager > plotManager)
G4bool ScaleH3(G4int id, G4double factor)
void SetH2Ascii(G4int id, G4bool ascii)
G4int CreateNtupleSColumn(const G4String &name)
virtual G4bool PlotImpl()=0
G4bool IsPlotting() const
void SetP1Ascii(G4int id, G4bool ascii)
G4int CreateH3(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4int nzbins, G4double zmin, G4double zmax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear", const G4String &zbinSchemeName="linear")
G4bool SetFirstH3Id(G4int firstId)
G4bool SetHistoDirectoryName(const G4String &dirName)
G4AnalysisManagerState fState
void SetP2Activation(G4bool activation)
void SetH1FileName(G4int id, const G4String &fileName)
virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode=true)
void SetP1Plotting(G4int id, G4bool plotting)
virtual void SetBasketSize(unsigned int basketSize)
void SetFileManager(std::shared_ptr< G4VFileManager > fileManager)
void SetP1FileName(G4int id, const G4String &fileName)
G4bool WriteAscii(const G4String &fileName)
virtual void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0)
void SetP2Manager(G4VP2Manager *p2Manager)
void SetP1Activation(G4bool activation)
virtual void SetBasketEntries(unsigned int basketEntries)
G4int GetFirstNtupleColumnId() const
void SetVerboseLevel(G4int verboseLevel)
G4bool SetH1(G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear")
void SetH2Activation(G4bool activation)
G4int CreateNtuple(const G4String &name, const G4String &title)
std::shared_ptr< G4VNtupleManager > fVNtupleManager
void SetNtupleManager(std::shared_ptr< G4VNtupleManager > ntupleManager)
G4bool SetFirstH2Id(G4int firstId)
void SetP1Manager(G4VP1Manager *p1Manager)
void SetH3Manager(G4VH3Manager *h3Manager)
G4bool SetFirstP2Id(G4int firstId)
G4bool SetH2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
std::shared_ptr< G4VFileManager > fVFileManager
G4bool SetFileName(const G4String &fileName)
void SetCompressionLevel(G4int level)
G4int CreateH2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinSchemeName="linear", const G4String &ybinSchemeName="linear")
void SetNtupleActivation(G4bool activation)
G4int GetCompressionLevel() const
G4bool SetFirstH1Id(G4int firstId)
G4bool ScaleH1(G4int id, G4double factor)
G4String GetNtupleDirectoryName() const
G4bool SetFirstNtupleId(G4int firstId)
G4bool IsOpenFile() const
G4bool SetFirstHistoId(G4int firstId)
G4bool SetFirstProfileId(G4int firstId)
G4bool SetNtupleDirectoryName(const G4String &dirName)
G4int GetFirstH3Id() const
G4bool ScaleP2(G4int id, G4double factor)
virtual G4bool CloseFileImpl(G4bool reset)=0
G4bool ScaleH2(G4int id, G4double factor)
G4bool Merge(tools::histo::hmpi *hmpi)
void SetP2Ascii(G4int id, G4bool ascii)
void SetH2Plotting(G4int id, G4bool plotting)
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
virtual std::shared_ptr< G4HnManager > GetHnManager()=0
std::unique_ptr< T > make_unique(Args &&... args)
G4bool CheckMinMax(G4double xmin, G4double xmax, const G4String &fcnName="none", const G4String &binSchemeName="linear")
G4bool CheckNbins(G4int nbins)
G4bool CheckEdges(const std::vector< G4double > &edges)
G4bool CheckName(const G4String &name, const G4String &objectType)