Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GenericAnalysisManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26
27// The main manager for Root analysis.
28// It delegates most of functions to the object specific managers.
29
30// Author: Ivana Hrivnacova, 18/06/2013 ([email protected])
31
32#ifndef G4GenericAnalysisManager_h
33#define G4GenericAnalysisManager_h 1
34
36#include "G4THnManager.hh"
37#include "G4Threading.hh"
38#include "globals.hh"
39
40#include <memory>
41
43class G4HnInformation;
45
47{
49
50 public:
51 explicit G4GenericAnalysisManager(G4bool isMaster = true);
53
54 // static methods
56 static G4bool IsInstance();
57
58 // MT/MPI
59 virtual void SetNtupleMerging(G4bool mergeNtuples,
60 G4int nofReducedNtupleFiles = 0) override;
61 virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode = true) override;
62 virtual void SetBasketSize(unsigned int basketSize) override;
63 virtual void SetBasketEntries(unsigned int basketEntries) override;
64
65 // new functions
66 G4bool Merge();
67
68 // write in an extra file
69 G4bool WriteH1(G4int id, const G4String& fileName);
70 G4bool WriteH2(G4int id, const G4String& fileName);
71 G4bool WriteH3(G4int id, const G4String& fileName);
72 G4bool WriteP1(G4int id, const G4String& fileName);
73 G4bool WriteP2(G4int id, const G4String& fileName);
74
75 // set default output type (backward compatibility)
76 // this type will be used for file names without extension
77 void SetDefaultFileType(const G4String& value);
79
80 protected:
81 // virtual methods from base class
82 virtual G4bool OpenFileImpl(const G4String& fileName) override;
83 virtual G4bool WriteImpl() final;
84 virtual G4bool CloseFileImpl(G4bool reset = true) override;
85 virtual G4bool IsOpenFileImpl() const final;
86 virtual G4bool Reset() final;
87
88 private:
89 // methods
90 void CreateNtupleFileManager(const G4String& fileName);
91
92 // static data members
93 static G4GenericAnalysisManager* fgMasterInstance;
94 static G4ThreadLocal G4GenericAnalysisManager* fgInstance;
95
96 // data members
97 std::shared_ptr<G4GenericFileManager> fFileManager;
98 // add G4GenericNtupleManager
99 // this class will be analogic to file managers but with ntuples
100 std::shared_ptr<G4VNtupleFileManager> fNtupleFileManager;
101
102 // data members
103 G4bool fIsNtupleMergingSet = false;
104 G4int fNofNtupleFiles = 0;
105 G4bool fMergeNtuples = false;
106 G4bool fNtupleRowWise = false;
107 G4bool fNtupleRowMode = true;
108 unsigned int fBasketSize = fgkDefaultBasketSize;
109 unsigned int fBasketEntries = fgkDefaultBasketEntries;
110};
111
112#include "G4GenericAnalysisManager.icc"
113
114#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4bool WriteP2(G4int id, const G4String &fileName)
G4bool WriteH2(G4int id, const G4String &fileName)
G4String GetDefaultFileType() const
virtual G4bool CloseFileImpl(G4bool reset=true) override
virtual void SetBasketSize(unsigned int basketSize) override
G4bool WriteH3(G4int id, const G4String &fileName)
G4bool WriteH1(G4int id, const G4String &fileName)
virtual G4bool WriteImpl() final
virtual void SetNtupleMerging(G4bool mergeNtuples, G4int nofReducedNtupleFiles=0) override
G4bool WriteP1(G4int id, const G4String &fileName)
static G4GenericAnalysisManager * Instance()
virtual G4bool OpenFileImpl(const G4String &fileName) override
void SetDefaultFileType(const G4String &value)
virtual void SetNtupleRowWise(G4bool rowWise, G4bool rowMode=true) override
virtual void SetBasketEntries(unsigned int basketEntries) override
virtual G4bool IsOpenFileImpl() const final
static constexpr unsigned int fgkDefaultBasketSize
static constexpr unsigned int fgkDefaultBasketEntries
#define G4ThreadLocal
Definition: tls.hh:77