File indexing completed on 2025-01-18 09:59:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #ifndef G4VAnalysisManager_h
0038 #define G4VAnalysisManager_h 1
0039
0040 #include "G4AnalysisManagerState.hh"
0041 #include "G4AnalysisUtilities.hh"
0042 #include "globals.hh"
0043
0044 #include <vector>
0045 #include <fstream>
0046 #include <memory>
0047 #include <string_view>
0048
0049 #include "G4VTBaseHnManager.hh" // make forward declaration if possible
0050
0051 class G4AnalysisMessenger;
0052 class G4NtupleBookingManager;
0053 class G4HnManager;
0054 class G4VNtupleManager;
0055 class G4VNtupleFileManager;
0056 class G4VFileManager;
0057
0058 namespace tools {
0059 namespace histo{
0060 class hmpi;
0061 }
0062 }
0063
0064 using G4Analysis::kDim1;
0065 using G4Analysis::kDim2;
0066 using G4Analysis::kDim3;
0067
0068 class G4VAnalysisManager
0069 {
0070 friend class G4AnalysisMessenger;
0071
0072 public:
0073 G4VAnalysisManager() = delete;
0074
0075
0076 G4bool OpenFile(const G4String& fileName = "");
0077 G4bool Write();
0078 G4bool CloseFile(G4bool reset = true);
0079 G4bool Reset();
0080 void Clear();
0081 G4bool Merge(tools::histo::hmpi* hmpi);
0082 G4bool Plot();
0083 G4bool IsOpenFile() const;
0084
0085
0086 void SetDefaultFileType(const G4String& value);
0087 G4String GetDefaultFileType() const;
0088
0089
0090 G4bool SetFileName(const G4String& fileName);
0091 G4bool SetHistoDirectoryName(const G4String& dirName);
0092 G4bool SetNtupleDirectoryName(const G4String& dirName);
0093 void SetCompressionLevel(G4int level);
0094
0095 G4String GetFileName() const;
0096 G4String GetHistoDirectoryName() const;
0097 G4String GetNtupleDirectoryName() const;
0098 G4int GetCompressionLevel() const;
0099
0100
0101
0102 G4int CreateH1(const G4String& name, const G4String& title,
0103 G4int nbins, G4double xmin, G4double xmax,
0104 const G4String& unitName = "none",
0105 const G4String& fcnName = "none",
0106 const G4String& binSchemeName = "linear");
0107
0108 G4int CreateH1(const G4String& name, const G4String& title,
0109 const std::vector<G4double>& edges,
0110 const G4String& unitName = "none",
0111 const G4String& fcnName = "none");
0112
0113 G4int CreateH2(const G4String& name, const G4String& title,
0114 G4int nxbins, G4double xmin, G4double xmax,
0115 G4int nybins, G4double ymin, G4double ymax,
0116 const G4String& xunitName = "none",
0117 const G4String& yunitName = "none",
0118 const G4String& xfcnName = "none",
0119 const G4String& yfcnName = "none",
0120 const G4String& xbinSchemeName = "linear",
0121 const G4String& ybinSchemeName = "linear");
0122
0123 G4int CreateH2(const G4String& name, const G4String& title,
0124 const std::vector<G4double>& xedges,
0125 const std::vector<G4double>& yedges,
0126 const G4String& xunitName = "none",
0127 const G4String& yunitName = "none",
0128 const G4String& xfcnName = "none",
0129 const G4String& yfcnName = "none");
0130
0131 G4int CreateH3(const G4String& name, const G4String& title,
0132 G4int nxbins, G4double xmin, G4double xmax,
0133 G4int nybins, G4double ymin, G4double ymax,
0134 G4int nzbins, G4double zmin, G4double zmax,
0135 const G4String& xunitName = "none",
0136 const G4String& yunitName = "none",
0137 const G4String& zunitName = "none",
0138 const G4String& xfcnName = "none",
0139 const G4String& yfcnName = "none",
0140 const G4String& zfcnName = "none",
0141 const G4String& xbinSchemeName = "linear",
0142 const G4String& ybinSchemeName = "linear",
0143 const G4String& zbinSchemeName = "linear");
0144
0145 G4int CreateH3(const G4String& name, const G4String& title,
0146 const std::vector<G4double>& xedges,
0147 const std::vector<G4double>& yedges,
0148 const std::vector<G4double>& zedges,
0149 const G4String& xunitName = "none",
0150 const G4String& yunitName = "none",
0151 const G4String& zunitName = "none",
0152 const G4String& xfcnName = "none",
0153 const G4String& yfcnName = "none",
0154 const G4String& zfcnName = "none");
0155
0156 G4bool SetH1(G4int id,
0157 G4int nbins, G4double xmin, G4double xmax,
0158 const G4String& unitName = "none",
0159 const G4String& fcnName = "none",
0160 const G4String& binSchemeName = "linear");
0161
0162 G4bool SetH1(G4int id,
0163 const std::vector<G4double>& edges,
0164 const G4String& unitName = "none",
0165 const G4String& fcnName = "none");
0166
0167 G4bool SetH2(G4int id,
0168 G4int nxbins, G4double xmin, G4double xmax,
0169 G4int nybins, G4double ymin, G4double ymax,
0170 const G4String& xunitName = "none",
0171 const G4String& yunitName = "none",
0172 const G4String& xfcnName = "none",
0173 const G4String& yfcnName = "none",
0174 const G4String& xbinSchemeName = "linear",
0175 const G4String& ybinSchemeName = "linear");
0176
0177 G4bool SetH2(G4int id,
0178 const std::vector<G4double>& xedges,
0179 const std::vector<G4double>& yedges,
0180 const G4String& xunitName = "none",
0181 const G4String& yunitName = "none",
0182 const G4String& xfcnName = "none",
0183 const G4String& yfcnName = "none");
0184
0185 G4bool SetH3(G4int id,
0186 G4int nxbins, G4double xmin, G4double xmax,
0187 G4int nzbins, G4double zmin, G4double zmax,
0188 G4int nybins, G4double ymin, G4double ymax,
0189 const G4String& xunitName = "none",
0190 const G4String& yunitName = "none",
0191 const G4String& zunitName = "none",
0192 const G4String& xfcnName = "none",
0193 const G4String& yfcnName = "none",
0194 const G4String& zfcnName = "none",
0195 const G4String& xbinSchemeName = "linear",
0196 const G4String& ybinSchemeName = "linear",
0197 const G4String& zbinSchemeName = "linear");
0198
0199 G4bool SetH3(G4int id,
0200 const std::vector<G4double>& xedges,
0201 const std::vector<G4double>& yedges,
0202 const std::vector<G4double>& zedges,
0203 const G4String& xunitName = "none",
0204 const G4String& yunitName = "none",
0205 const G4String& zunitName = "none",
0206 const G4String& xfcnName = "none",
0207 const G4String& yfcnName = "none",
0208 const G4String& zfcnName = "none");
0209
0210 G4bool ScaleH1(G4int id, G4double factor);
0211 G4bool ScaleH2(G4int id, G4double factor);
0212 G4bool ScaleH3(G4int id, G4double factor);
0213
0214
0215
0216 G4int CreateP1(const G4String& name, const G4String& title,
0217 G4int nbins, G4double xmin, G4double xmax,
0218 G4double ymin = 0, G4double ymax = 0,
0219 const G4String& xunitName = "none",
0220 const G4String& yunitName = "none",
0221 const G4String& xfcnName = "none",
0222 const G4String& yfcnName = "none",
0223 const G4String& xbinSchemeName = "linear");
0224 G4int CreateP1(const G4String& name, const G4String& title,
0225 const std::vector<G4double>& edges,
0226 G4double ymin = 0, G4double ymax = 0,
0227 const G4String& xunitName = "none",
0228 const G4String& yunitName = "none",
0229 const G4String& xfcnName = "none",
0230 const G4String& yfcnName = "none");
0231
0232 G4int CreateP2(const G4String& name, const G4String& title,
0233 G4int nxbins, G4double xmin, G4double xmax,
0234 G4int nybins, G4double ymin, G4double ymax,
0235 G4double zmin = 0, G4double zmax = 0,
0236 const G4String& xunitName = "none",
0237 const G4String& yunitName = "none",
0238 const G4String& zunitName = "none",
0239 const G4String& xfcnName = "none",
0240 const G4String& yfcnName = "none",
0241 const G4String& zfcnName = "none",
0242 const G4String& xbinSchemeName = "linear",
0243 const G4String& ybinSchemeName = "linear");
0244 G4int CreateP2(const G4String& name, const G4String& title,
0245 const std::vector<G4double>& xedges,
0246 const std::vector<G4double>& yedges,
0247 G4double zmin = 0, G4double zmax = 0,
0248 const G4String& xunitName = "none",
0249 const G4String& yunitName = "none",
0250 const G4String& zunitName = "none",
0251 const G4String& xfcnName = "none",
0252 const G4String& yfcnName = "none",
0253 const G4String& zfcnName = "none");
0254
0255 G4bool SetP1(G4int id,
0256 G4int nbins, G4double xmin, G4double xmax,
0257 G4double ymin = 0, G4double ymax = 0,
0258 const G4String& xunitName = "none",
0259 const G4String& yunitName = "none",
0260 const G4String& xfcnName = "none",
0261 const G4String& yfcnName = "none",
0262 const G4String& xbinSchemeName = "linear");
0263 G4bool SetP1(G4int id,
0264 const std::vector<G4double>& edges,
0265 G4double ymin = 0, G4double ymax = 0,
0266 const G4String& xunitName = "none",
0267 const G4String& yunitName = "none",
0268 const G4String& xfcnName = "none",
0269 const G4String& yfcnName = "none");
0270
0271 G4bool SetP2(G4int id,
0272 G4int nxbins, G4double xmin, G4double xmax,
0273 G4int nybins, G4double ymin, G4double ymax,
0274 G4double zmin = 0, G4double zmax = 0,
0275 const G4String& xunitName = "none",
0276 const G4String& yunitName = "none",
0277 const G4String& zunitName = "none",
0278 const G4String& xfcnName = "none",
0279 const G4String& yfcnName = "none",
0280 const G4String& zfcnName = "none",
0281 const G4String& xbinSchemeName = "linear",
0282 const G4String& ybinSchemeName = "linear");
0283 G4bool SetP2(G4int id,
0284 const std::vector<G4double>& xedges,
0285 const std::vector<G4double>& yedges,
0286 G4double zmin = 0, G4double zmax = 0,
0287 const G4String& xunitName = "none",
0288 const G4String& yunitName = "none",
0289 const G4String& zunitName = "none",
0290 const G4String& xfcnName = "none",
0291 const G4String& yfcnName = "none",
0292 const G4String& zfcnName = "none");
0293
0294 G4bool ScaleP1(G4int id, G4double factor);
0295 G4bool ScaleP2(G4int id, G4double factor);
0296
0297
0298
0299 G4int CreateNtuple(const G4String& name, const G4String& title);
0300
0301
0302 G4int CreateNtupleIColumn(const G4String& name);
0303 G4int CreateNtupleFColumn(const G4String& name);
0304 G4int CreateNtupleDColumn(const G4String& name);
0305 G4int CreateNtupleSColumn(const G4String& name);
0306
0307
0308 G4int CreateNtupleIColumn(
0309 const G4String& name, std::vector<int>& vector);
0310 G4int CreateNtupleFColumn(
0311 const G4String& name, std::vector<float>& vector);
0312 G4int CreateNtupleDColumn(
0313 const G4String& name, std::vector<double>& vector);
0314 G4int CreateNtupleSColumn(
0315 const G4String& name, std::vector<std::string>& vector);
0316 void FinishNtuple();
0317
0318
0319 G4int CreateNtupleIColumn(G4int ntupleId, const G4String& name);
0320 G4int CreateNtupleFColumn(G4int ntupleId, const G4String& name);
0321 G4int CreateNtupleDColumn(G4int ntupleId, const G4String& name);
0322 G4int CreateNtupleSColumn(G4int ntupleId, const G4String& name);
0323
0324
0325 G4int CreateNtupleIColumn(G4int ntupleId,
0326 const G4String& name, std::vector<int>& vector);
0327 G4int CreateNtupleFColumn(G4int ntupleId,
0328 const G4String& name, std::vector<float>& vector);
0329 G4int CreateNtupleDColumn(G4int ntupleId,
0330 const G4String& name, std::vector<double>& vector);
0331 G4int CreateNtupleSColumn(G4int ntupleId,
0332 const G4String& name, std::vector<std::string>& vector);
0333
0334 void FinishNtuple(G4int ntupleId);
0335
0336
0337 virtual void SetNtupleMerging(G4bool mergeNtuples,
0338 G4int nofReducedNtupleFiles = 0);
0339 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true);
0340 virtual void SetBasketSize(unsigned int basketSize);
0341 virtual void SetBasketEntries(unsigned int basketEntries);
0342
0343
0344
0345
0346 G4bool SetFirstHistoId(G4int firstId);
0347 G4bool SetFirstH1Id(G4int firstId);
0348 G4bool SetFirstH2Id(G4int firstId);
0349 G4bool SetFirstH3Id(G4int firstId);
0350 G4bool SetFirstProfileId(G4int firstId);
0351 G4bool SetFirstP1Id(G4int firstId);
0352 G4bool SetFirstP2Id(G4int firstId);
0353 G4bool SetFirstNtupleId(G4int firstId);
0354 G4bool SetFirstNtupleColumnId(G4int firstId);
0355
0356
0357 G4bool FillH1(G4int id, G4double value, G4double weight = 1.0);
0358 G4bool FillH2(G4int id, G4double xvalue, G4double yvalue,
0359 G4double weight = 1.0);
0360 G4bool FillH3(G4int id,
0361 G4double xvalue, G4double yvalue, G4double zvalue,
0362 G4double weight = 1.0);
0363
0364 G4bool FillP1(G4int id, G4double xvalue, G4double yvalue,
0365 G4double weight = 1.0);
0366 G4bool FillP2(G4int id,
0367 G4double xvalue, G4double yvalue, G4double zvalue,
0368 G4double weight = 1.0);
0369
0370
0371
0372 G4bool FillNtupleIColumn(G4int id, G4int value);
0373 G4bool FillNtupleFColumn(G4int id, G4float value);
0374 G4bool FillNtupleDColumn(G4int id, G4double value);
0375 G4bool FillNtupleSColumn(G4int id, const G4String& value);
0376 G4bool AddNtupleRow();
0377
0378 G4bool FillNtupleIColumn(G4int ntupleId, G4int columnId, G4int value);
0379 G4bool FillNtupleFColumn(G4int ntupleId, G4int columnId, G4float value);
0380 G4bool FillNtupleDColumn(G4int ntupleId, G4int columnId, G4double value);
0381 G4bool FillNtupleSColumn(G4int ntupleId, G4int id, const G4String& value);
0382 G4bool AddNtupleRow(G4int ntupleId);
0383
0384
0385
0386
0387
0388
0389 void SetActivation(G4bool activation);
0390 G4bool GetActivation() const;
0391
0392
0393
0394 G4bool IsActive() const;
0395
0396
0397
0398
0399
0400 G4bool IsAscii() const;
0401
0402
0403
0404
0405
0406 G4bool IsPlotting() const;
0407
0408
0409 G4int GetFirstH1Id() const;
0410 G4int GetFirstH2Id() const;
0411 G4int GetFirstH3Id() const;
0412 G4int GetFirstP1Id() const;
0413 G4int GetFirstP2Id() const;
0414 G4int GetFirstNtupleId() const;
0415 G4int GetFirstNtupleColumnId() const;
0416
0417 G4int GetNofH1s(G4bool onlyIfExist = false) const;
0418 G4int GetNofH2s(G4bool onlyIfExist = false) const;
0419 G4int GetNofH3s(G4bool onlyIfExist = false) const;
0420 G4int GetNofP1s(G4bool onlyIfExist = false) const;
0421 G4int GetNofP2s(G4bool onlyIfExist = false) const;
0422 G4int GetNofNtuples(G4bool onlyIfExist = false) const;
0423
0424
0425 G4int GetH1Id(const G4String& name, G4bool warn = true) const;
0426 G4int GetH2Id(const G4String& name, G4bool warn = true) const;
0427 G4int GetH3Id(const G4String& name, G4bool warn = true) const;
0428 G4int GetP1Id(const G4String& name, G4bool warn = true) const;
0429 G4int GetP2Id(const G4String& name, G4bool warn = true) const;
0430
0431
0432 G4bool ListH1(G4bool onlyIfActive = true) const;
0433 G4bool ListH2(G4bool onlyIfActive = true) const;
0434 G4bool ListH3(G4bool onlyIfActive = true) const;
0435 G4bool ListP1(G4bool onlyIfActive = true) const;
0436 G4bool ListP2(G4bool onlyIfActive = true) const;
0437 G4bool ListNtuple(G4bool onlyIfActive = true) const;
0438 G4bool List(G4bool onlyIfActive = true) const;
0439
0440
0441
0442 void SetH1Activation(G4bool activation);
0443 void SetH1Activation(G4int id, G4bool activation);
0444 void SetH1Ascii(G4int id, G4bool ascii);
0445 void SetH1Plotting(G4int id, G4bool plotting);
0446 void SetH1FileName(G4int id, const G4String& fileName);
0447
0448 void SetH2Activation(G4bool activation);
0449 void SetH2Activation(G4int id, G4bool activation);
0450 void SetH2Ascii(G4int id, G4bool ascii);
0451 void SetH2Plotting(G4int id, G4bool plotting);
0452 void SetH2FileName(G4int id, const G4String& fileName);
0453
0454 void SetH3Activation(G4bool activation);
0455 void SetH3Activation(G4int id, G4bool activation);
0456 void SetH3Ascii(G4int id, G4bool ascii);
0457 void SetH3Plotting(G4int id, G4bool plotting);
0458 void SetH3FileName(G4int id, const G4String& fileName);
0459
0460 void SetP1Activation(G4bool activation);
0461 void SetP1Activation(G4int id, G4bool activation);
0462 void SetP1Ascii(G4int id, G4bool ascii);
0463 void SetP1Plotting(G4int id, G4bool plotting);
0464 void SetP1FileName(G4int id, const G4String& fileName);
0465
0466 void SetP2Activation(G4bool activation);
0467 void SetP2Activation(G4int id, G4bool activation);
0468 void SetP2Ascii(G4int id, G4bool ascii);
0469 void SetP2Plotting(G4int id, G4bool plotting);
0470 void SetP2FileName(G4int id, const G4String& fileName);
0471
0472 void SetNtupleActivation(G4bool activation);
0473 void SetNtupleActivation(G4int id, G4bool activation);
0474 void SetNtupleFileName(const G4String& fileName);
0475 void SetNtupleFileName(G4int id, const G4String& fileName);
0476
0477
0478
0479
0480 G4int GetH1Nbins(G4int id) const;
0481 G4double GetH1Xmin(G4int id) const;
0482 G4double GetH1Xmax(G4int id) const;
0483 G4double GetH1Width(G4int id) const;
0484
0485 G4int GetH2Nxbins(G4int id) const;
0486 G4double GetH2Xmin(G4int id) const;
0487 G4double GetH2Xmax(G4int id) const;
0488 G4double GetH2XWidth(G4int id) const;
0489 G4int GetH2Nybins(G4int id) const;
0490 G4double GetH2Ymin(G4int id) const;
0491 G4double GetH2Ymax(G4int id) const;
0492 G4double GetH2YWidth(G4int id) const;
0493
0494 G4int GetH3Nxbins(G4int id) const;
0495 G4double GetH3Xmin(G4int id) const;
0496 G4double GetH3Xmax(G4int id) const;
0497 G4double GetH3XWidth(G4int id) const;
0498 G4int GetH3Nybins(G4int id) const;
0499 G4double GetH3Ymin(G4int id) const;
0500 G4double GetH3Ymax(G4int id) const;
0501 G4double GetH3YWidth(G4int id) const;
0502 G4int GetH3Nzbins(G4int id) const;
0503 G4double GetH3Zmin(G4int id) const;
0504 G4double GetH3Zmax(G4int id) const;
0505 G4double GetH3ZWidth(G4int id) const;
0506
0507 G4int GetP1Nbins(G4int id) const;
0508 G4double GetP1Xmin(G4int id) const;
0509 G4double GetP1Xmax(G4int id) const;
0510 G4double GetP1XWidth(G4int id) const;
0511 G4double GetP1Ymin(G4int id) const;
0512 G4double GetP1Ymax(G4int id) const;
0513
0514 G4int GetP2Nxbins(G4int id) const;
0515 G4double GetP2Xmin(G4int id) const;
0516 G4double GetP2Xmax(G4int id) const;
0517 G4double GetP2XWidth(G4int id) const;
0518 G4int GetP2Nybins(G4int id) const;
0519 G4double GetP2Ymin(G4int id) const;
0520 G4double GetP2Ymax(G4int id) const;
0521 G4double GetP2YWidth(G4int id) const;
0522 G4double GetP2Zmin(G4int id) const;
0523 G4double GetP2Zmax(G4int id) const;
0524
0525
0526
0527 G4String GetH1Name(G4int id) const;
0528 G4double GetH1Unit(G4int id) const;
0529 G4bool GetH1Activation(G4int id) const;
0530 G4bool GetH1Ascii(G4int id) const;
0531 G4bool GetH1Plotting(G4int id) const;
0532 G4String GetH1FileName(G4int id) const;
0533
0534 G4String GetH2Name(G4int id) const;
0535 G4double GetH2XUnit(G4int id) const;
0536 G4double GetH2YUnit(G4int id) const;
0537 G4bool GetH2Activation(G4int id) const;
0538 G4bool GetH2Ascii(G4int id) const;
0539 G4bool GetH2Plotting(G4int id) const;
0540
0541 G4String GetH3Name(G4int id) const;
0542 G4double GetH3XUnit(G4int id) const;
0543 G4double GetH3YUnit(G4int id) const;
0544 G4double GetH3ZUnit(G4int id) const;
0545 G4bool GetH3Activation(G4int id) const;
0546 G4bool GetH3Ascii(G4int id) const;
0547 G4bool GetH3Plotting(G4int id) const;
0548
0549 G4String GetP1Name(G4int id) const;
0550 G4double GetP1XUnit(G4int id) const;
0551 G4double GetP1YUnit(G4int id) const;
0552 G4bool GetP1Activation(G4int id) const;
0553 G4bool GetP1Ascii(G4int id) const;
0554 G4bool GetP1Plotting(G4int id) const;
0555
0556 G4String GetP2Name(G4int id) const;
0557 G4double GetP2XUnit(G4int id) const;
0558 G4double GetP2YUnit(G4int id) const;
0559 G4double GetP2ZUnit(G4int id) const;
0560 G4bool GetP2Activation(G4int id) const;
0561 G4bool GetP2Ascii(G4int id) const;
0562 G4bool GetP2Plotting(G4int id) const;
0563
0564 G4bool GetNtupleActivation(G4int id) const;
0565 G4String GetNtupleFileName(G4int id) const;
0566
0567
0568
0569 G4bool SetH1Title(G4int id, const G4String& title);
0570 G4bool SetH1XAxisTitle(G4int id, const G4String& title);
0571 G4bool SetH1YAxisTitle(G4int id, const G4String& title);
0572 G4bool SetH1XAxisIsLog(G4int id, G4bool isLog);
0573 G4bool SetH1YAxisIsLog(G4int id, G4bool isLog);
0574
0575 G4bool SetH2Title(G4int id, const G4String& title);
0576 G4bool SetH2XAxisTitle(G4int id, const G4String& title);
0577 G4bool SetH2YAxisTitle(G4int id, const G4String& title);
0578 G4bool SetH2ZAxisTitle(G4int id, const G4String& title);
0579 G4bool SetH2XAxisIsLog(G4int id, G4bool isLog);
0580 G4bool SetH2YAxisIsLog(G4int id, G4bool isLog);
0581 G4bool SetH2ZAxisIsLog(G4int id, G4bool isLog);
0582
0583 G4bool SetH3Title(G4int id, const G4String& title);
0584 G4bool SetH3XAxisTitle(G4int id, const G4String& title);
0585 G4bool SetH3YAxisTitle(G4int id, const G4String& title);
0586 G4bool SetH3ZAxisTitle(G4int id, const G4String& title);
0587 G4bool SetH3XAxisIsLog(G4int id, G4bool isLog);
0588 G4bool SetH3YAxisIsLog(G4int id, G4bool isLog);
0589 G4bool SetH3ZAxisIsLog(G4int id, G4bool isLog);
0590
0591 G4bool SetP1Title(G4int id, const G4String& title);
0592 G4bool SetP1XAxisTitle(G4int id, const G4String& title);
0593 G4bool SetP1YAxisTitle(G4int id, const G4String& title);
0594 G4bool SetP1XAxisIsLog(G4int id, G4bool isLog);
0595 G4bool SetP1YAxisIsLog(G4int id, G4bool isLog);
0596
0597 G4bool SetP2Title(G4int id, const G4String& title);
0598 G4bool SetP2XAxisTitle(G4int id, const G4String& title);
0599 G4bool SetP2YAxisTitle(G4int id, const G4String& title);
0600 G4bool SetP2ZAxisTitle(G4int id, const G4String& title);
0601 G4bool SetP2XAxisIsLog(G4int id, G4bool isLog);
0602 G4bool SetP2YAxisIsLog(G4int id, G4bool isLog);
0603 G4bool SetP2ZAxisIsLog(G4int id, G4bool isLog);
0604
0605
0606
0607 G4String GetH1Title(G4int id) const;
0608 G4String GetH1XAxisTitle(G4int id) const;
0609 G4String GetH1YAxisTitle(G4int id) const;
0610 G4bool GetH1XAxisIsLog(G4int id) const;
0611 G4bool GetH1YAxisIsLog(G4int id) const;
0612
0613 G4String GetH2Title(G4int id) const;
0614 G4String GetH2XAxisTitle(G4int id) const;
0615 G4String GetH2YAxisTitle(G4int id) const;
0616 G4String GetH2ZAxisTitle(G4int id) const;
0617 G4bool GetH2XAxisIsLog(G4int id) const;
0618 G4bool GetH2YAxisIsLog(G4int id) const;
0619 G4bool GetH2ZAxisIsLog(G4int id) const;
0620
0621 G4String GetH3Title(G4int id) const;
0622 G4String GetH3XAxisTitle(G4int id) const;
0623 G4String GetH3YAxisTitle(G4int id) const;
0624 G4String GetH3ZAxisTitle(G4int id) const;
0625 G4bool GetH3XAxisIsLog(G4int id) const;
0626 G4bool GetH3YAxisIsLog(G4int id) const;
0627 G4bool GetH3ZAxisIsLog(G4int id) const;
0628
0629 G4String GetP1Title(G4int id) const;
0630 G4String GetP1XAxisTitle(G4int id) const;
0631 G4String GetP1YAxisTitle(G4int id) const;
0632 G4bool GetP1XAxisIsLog(G4int id) const;
0633 G4bool GetP1YAxisIsLog(G4int id) const;
0634
0635 G4String GetP2Title(G4int id) const;
0636 G4String GetP2XAxisTitle(G4int id) const;
0637 G4String GetP2YAxisTitle(G4int id) const;
0638 G4String GetP2ZAxisTitle(G4int id) const;
0639 G4bool GetP2XAxisIsLog(G4int id) const;
0640 G4bool GetP2YAxisIsLog(G4int id) const;
0641 G4bool GetP2ZAxisIsLog(G4int id) const;
0642
0643
0644
0645 G4bool DeleteH1(G4int id, G4bool keepSetting = false);
0646 G4bool DeleteH2(G4int id, G4bool keepSetting = false);
0647 G4bool DeleteH3(G4int id, G4bool keepSetting = false);
0648 G4bool DeleteP1(G4int id, G4bool keepSetting = false);
0649 G4bool DeleteP2(G4int id, G4bool keepSetting = false);
0650 G4bool DeleteNtuple(G4int id, G4bool clear = false);
0651
0652
0653 void SetVerboseLevel(G4int verboseLevel);
0654 G4int GetVerboseLevel() const;
0655
0656
0657 G4String GetType() const;
0658
0659 G4String GetFileType() const;
0660
0661 protected:
0662 G4VAnalysisManager(const G4String& type);
0663 virtual ~G4VAnalysisManager();
0664
0665
0666 virtual G4bool OpenFileImpl(const G4String& fileName) = 0;
0667 virtual G4bool WriteImpl() = 0;
0668 virtual G4bool CloseFileImpl(G4bool reset) = 0;
0669 virtual G4bool ResetImpl() = 0;
0670 virtual void ClearImpl() = 0;
0671 virtual G4bool PlotImpl() = 0;
0672 virtual G4bool MergeImpl(tools::histo::hmpi* hmpi) = 0;
0673 virtual G4bool IsOpenFileImpl() const = 0;
0674
0675
0676 virtual void SetDefaultFileTypeImpl(const G4String& value);
0677 virtual G4String GetDefaultFileTypeImpl() const;
0678
0679
0680 void Message(G4int level,
0681 const G4String& action,
0682 const G4String& objectType,
0683 const G4String& objectName = "",
0684 G4bool success = true) const;
0685
0686
0687 void SetH1Manager(G4VTBaseHnManager<kDim1>* h1Manager);
0688 void SetH2Manager(G4VTBaseHnManager<kDim2>* h2Manager);
0689 void SetH3Manager(G4VTBaseHnManager<kDim3>* h3Manager);
0690 void SetP1Manager(G4VTBaseHnManager<kDim2>* p1Manager);
0691 void SetP2Manager(G4VTBaseHnManager<kDim3>* p2Manager);
0692 void SetNtupleManager(std::shared_ptr<G4VNtupleManager> ntupleManager);
0693 void SetNtupleFileManager(std::shared_ptr<G4VNtupleFileManager> ntupleFileManager);
0694 void SetFileManager(std::shared_ptr<G4VFileManager> fileManager);
0695
0696
0697 G4bool WriteAscii(const G4String& fileName);
0698
0699
0700 virtual std::shared_ptr<G4VFileManager> GetFileManager(const G4String& fileName);
0701
0702
0703 G4AnalysisManagerState fState;
0704 std::shared_ptr<G4VFileManager> fVFileManager { nullptr };
0705 std::shared_ptr<G4NtupleBookingManager> fNtupleBookingManager { nullptr };
0706 std::shared_ptr<G4VNtupleManager> fVNtupleManager { nullptr };
0707 std::shared_ptr<G4VNtupleFileManager> fVNtupleFileManager { nullptr };
0708
0709 private:
0710
0711 G4bool WriteFromUI();
0712 G4bool CloseFileFromUI(G4bool reset = true);
0713 G4bool ResetFromUI();
0714
0715
0716 static constexpr std::string_view fkClass { "G4VAnalysisManager" };
0717
0718
0719 inline static G4VAnalysisManager* fgMasterInstance { nullptr };
0720
0721
0722
0723 std::unique_ptr<G4AnalysisMessenger> fMessenger;
0724 std::shared_ptr<G4HnManager> fH1HnManager { nullptr };
0725 std::shared_ptr<G4HnManager> fH2HnManager { nullptr };
0726 std::shared_ptr<G4HnManager> fH3HnManager { nullptr };
0727 std::shared_ptr<G4HnManager> fP1HnManager { nullptr };
0728 std::shared_ptr<G4HnManager> fP2HnManager { nullptr };
0729 std::unique_ptr<G4VTBaseHnManager<kDim1>> fVH1Manager;
0730 std::unique_ptr<G4VTBaseHnManager<kDim2>> fVH2Manager;
0731 std::unique_ptr<G4VTBaseHnManager<kDim3>> fVH3Manager;
0732 std::unique_ptr<G4VTBaseHnManager<kDim2>> fVP1Manager;
0733 std::unique_ptr<G4VTBaseHnManager<kDim3>> fVP2Manager;
0734
0735 std::vector<G4VAnalysisManager*> fWorkerManagers;
0736
0737 };
0738
0739
0740
0741 #include "G4VAnalysisManager.icc"
0742
0743 #endif