Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Attributes
G4H2ToolsManager Class Reference

#include <G4H2ToolsManager.hh>

Inheritance diagram for G4H2ToolsManager:
G4VH2Manager G4THnManager< tools::histo::h2d >

Public Member Functions

G4int AddH2 (const G4String &name, tools::histo::h2d *h2d)
 
void AddH2Vector (const std::vector< tools::histo::h2d * > &h2Vector)
 
void AddTVector (const std::vector< tools::histo::h2d * > &tVector)
 
std::vector< tools::histo::h2d * >::const_iterator BeginConstH2 () const
 
std::vector< tools::histo::h2d * >::iterator BeginH2 ()
 
void ClearData ()
 
std::vector< tools::histo::h2d * >::const_iterator EndConstH2 () const
 
std::vector< tools::histo::h2d * >::iterator EndH2 ()
 
 G4H2ToolsManager (const G4AnalysisManagerState &state)
 
tools::histo::h2d * GetH2 (G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
 
const std::vector< tools::histo::h2d * > & GetH2Vector () const
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
tools::histo::h2d * GetT (G4int id) const
 
G4bool IsEmpty () const
 
void Merge (G4Mutex &mergeMutex, G4THnManager< tools::histo::h2d > *masterInstance)
 
G4int RegisterT (tools::histo::h2d *t, const G4String &name)
 
G4bool Reset ()
 
virtual ~G4H2ToolsManager ()=default
 

Protected Member Functions

std::vector< tools::histo::h2d * >::const_iterator BeginConstT () const
 
std::vector< tools::histo::h2d * >::iterator BeginT ()
 
virtual G4int CreateH2 (const G4String &name, const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none") final
 
virtual 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 &xbinScheme="linear", const G4String &ybinScheme="linear") final
 
std::vector< tools::histo::h2d * >::const_iterator EndConstT () const
 
std::vector< tools::histo::h2d * >::iterator EndT ()
 
virtual G4bool FillH2 (G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0) final
 
virtual G4int GetH2Id (const G4String &name, G4bool warn=true) const final
 
virtual G4int GetH2Nxbins (G4int id) const final
 
virtual G4int GetH2Nybins (G4int id) const final
 
virtual G4String GetH2Title (G4int id) const final
 
virtual G4String GetH2XAxisTitle (G4int id) const final
 
virtual G4double GetH2Xmax (G4int id) const final
 
virtual G4double GetH2Xmin (G4int id) const final
 
virtual G4double GetH2XWidth (G4int id) const final
 
virtual G4String GetH2YAxisTitle (G4int id) const final
 
virtual G4double GetH2Ymax (G4int id) const final
 
virtual G4double GetH2Ymin (G4int id) const final
 
virtual G4double GetH2YWidth (G4int id) const final
 
virtual G4String GetH2ZAxisTitle (G4int id) const final
 
virtual std::shared_ptr< G4HnManagerGetHnManager () final
 
G4int GetTId (const G4String &name, G4bool warn=true) const
 
tools::histo::h2d * GetTInFunction (G4int id, std::string_view functionName, G4bool warn=true, G4bool onlyIfActive=true) const
 
G4bool IsVerbose (G4int verboseLevel) const
 
void Message (G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
 
virtual G4bool ScaleH2 (G4int id, G4double factor) final
 
virtual G4bool SetH2 (G4int id, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none") final
 
virtual 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 &xbinScheme="linear", const G4String &ybinScheme="linear") final
 
virtual G4bool SetH2Title (G4int id, const G4String &title) final
 
virtual G4bool SetH2XAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetH2YAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetH2ZAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool WriteOnAscii (std::ofstream &output) final
 

Protected Attributes

std::shared_ptr< G4HnManagerfHnManager
 
std::map< G4String, G4intfNameIdMap
 
const G4AnalysisManagerStatefState
 
std::vector< tools::histo::h2d * > fTVector
 

Private Member Functions

void AddH2Information (const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme) const
 

Static Private Attributes

static constexpr std::string_view fkClass { "G4H2ToolsManager" }
 
static constexpr G4int fkDimension = 2
 

Detailed Description

Definition at line 52 of file G4H2ToolsManager.hh.

Constructor & Destructor Documentation

◆ G4H2ToolsManager()

G4H2ToolsManager::G4H2ToolsManager ( const G4AnalysisManagerState state)
explicit

Definition at line 42 of file G4H2ToolsManager.cc.

◆ ~G4H2ToolsManager()

virtual G4H2ToolsManager::~G4H2ToolsManager ( )
virtualdefault

Member Function Documentation

◆ AddH2()

G4int G4H2ToolsManager::AddH2 ( const G4String name,
tools::histo::h2d *  h2d 
)

Definition at line 604 of file G4H2ToolsManager.cc.

605{
606 Message(kVL4, "add", "H2", name);
607
608 // Add annotation
609 AddH2Annotation(h2d, "none", "none", "none", "none");
610 // Add information
611 AddH2Information(name, "none", "none", "none", "none",
613
614 // Register histogram
615 G4int id = RegisterT(h2d, name);
616
617 Message(kVL2, "add", "H2", name);
618
619 return id;
620}
int G4int
Definition: G4Types.hh:85
void AddH2Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme) const
G4int RegisterT(tools::histo::h2d *t, const G4String &name)
void Message(G4int level, const G4String &action, const G4String &objectType, const G4String &objectName="", G4bool success=true) const
constexpr G4int kVL2
constexpr G4int kVL4
const char * name(G4int ptype)
void AddH2Annotation(tools::histo::h2d *h2d, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)

References anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation(), AddH2Information(), kLinear, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h2d >::RegisterT().

◆ AddH2Information()

void G4H2ToolsManager::AddH2Information ( const G4String name,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
G4BinScheme  xbinScheme,
G4BinScheme  ybinScheme 
) const
private

Definition at line 222 of file G4H2ToolsManager.cc.

229{
230 auto hnInformation = fHnManager->AddHnInformation(name, fkDimension);
231 hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
232 hnInformation->AddDimension(yunitName, yfcnName, ybinScheme);
233}
static constexpr G4int fkDimension
std::shared_ptr< G4HnManager > fHnManager

References G4THnManager< tools::histo::h2d >::fHnManager, fkDimension, and G4InuclParticleNames::name().

Referenced by AddH2(), and CreateH2().

◆ AddH2Vector()

void G4H2ToolsManager::AddH2Vector ( const std::vector< tools::histo::h2d * > &  h2Vector)

Definition at line 623 of file G4H2ToolsManager.cc.

625{
626 AddTVector(h2Vector);
627}
void AddTVector(const std::vector< tools::histo::h2d * > &tVector)

References G4THnManager< tools::histo::h2d >::AddTVector().

◆ AddTVector()

void G4THnManager< tools::histo::h2d >::AddTVector ( const std::vector< tools::histo::h2d * > &  tVector)
inherited

◆ BeginConstH2()

std::vector< tools::histo::h2d * >::const_iterator G4H2ToolsManager::BeginConstH2 ( ) const
inline

Definition at line 184 of file G4H2ToolsManager.hh.

185{ return BeginConstT(); }
std::vector< tools::histo::h2d * >::const_iterator BeginConstT() const

References G4THnManager< tools::histo::h2d >::BeginConstT().

◆ BeginConstT()

std::vector< tools::histo::h2d * >::const_iterator G4THnManager< tools::histo::h2d >::BeginConstT ( ) const
protectedinherited

◆ BeginH2()

std::vector< tools::histo::h2d * >::iterator G4H2ToolsManager::BeginH2 ( )
inline

Definition at line 177 of file G4H2ToolsManager.hh.

178{ return BeginT(); }
std::vector< tools::histo::h2d * >::iterator BeginT()

References G4THnManager< tools::histo::h2d >::BeginT().

◆ BeginT()

std::vector< tools::histo::h2d * >::iterator G4THnManager< tools::histo::h2d >::BeginT ( )
protectedinherited

◆ ClearData()

void G4THnManager< tools::histo::h2d >::ClearData ( )
inherited

◆ CreateH2() [1/2]

G4int G4H2ToolsManager::CreateH2 ( const G4String name,
const G4String title,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 274 of file G4H2ToolsManager.cc.

280{
281 Message(kVL4, "create", "H2", name);
282
283 tools::histo::h2d* h2d
284 = CreateToolsH2(title, xedges, yedges,
285 xunitName, yunitName, xfcnName, yfcnName);
286
287 // Add annotation
288 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
289
290 // Save H2 information
292 name, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser, G4BinScheme::kUser);
293
294 // Register histogram
295 G4int id = RegisterT(h2d, name);
296
297 Message(kVL2, "create", "H2", name);
298
299 return id;
300}
tools::histo::h2d * CreateToolsH2(const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)

References anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation(), AddH2Information(), anonymous_namespace{G4H2ToolsManager.cc}::CreateToolsH2(), kUser, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h2d >::RegisterT().

◆ CreateH2() [2/2]

G4int G4H2ToolsManager::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 xbinScheme = "linear",
const G4String ybinScheme = "linear" 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 240 of file G4H2ToolsManager.cc.

248{
249 Message(kVL4, "create", "H2", name);
250
251 tools::histo::h2d* h2d
252 = CreateToolsH2(title, nxbins, xmin, xmax, nybins, ymin, ymax,
253 xunitName, yunitName, xfcnName, yfcnName,
254 xbinSchemeName, ybinSchemeName, fkClass);
255
256 // Add annotation
257 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
258
259 // Save H2 information
260 auto xbinScheme = GetBinScheme(xbinSchemeName);
261 auto ybinScheme = GetBinScheme(ybinSchemeName);
263 name, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
264
265 // Register histogram
266 G4int id = RegisterT(h2d, name);
267
268 Message(kVL2, "create", "H2", name);
269
270 return id;
271}
static constexpr std::string_view fkClass
G4BinScheme GetBinScheme(const G4String &binSchemeName)
Definition: G4BinScheme.cc:36

References anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation(), AddH2Information(), anonymous_namespace{G4H2ToolsManager.cc}::CreateToolsH2(), fkClass, G4Analysis::GetBinScheme(), G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h2d >::RegisterT().

◆ EndConstH2()

std::vector< tools::histo::h2d * >::const_iterator G4H2ToolsManager::EndConstH2 ( ) const
inline

Definition at line 188 of file G4H2ToolsManager.hh.

189{ return EndConstT(); }
std::vector< tools::histo::h2d * >::const_iterator EndConstT() const

References G4THnManager< tools::histo::h2d >::EndConstT().

◆ EndConstT()

std::vector< tools::histo::h2d * >::const_iterator G4THnManager< tools::histo::h2d >::EndConstT ( ) const
protectedinherited

◆ EndH2()

std::vector< tools::histo::h2d * >::iterator G4H2ToolsManager::EndH2 ( )
inline

Definition at line 180 of file G4H2ToolsManager.hh.

181{ return EndT(); }
std::vector< tools::histo::h2d * >::iterator EndT()

References G4THnManager< tools::histo::h2d >::EndT().

◆ EndT()

std::vector< tools::histo::h2d * >::iterator G4THnManager< tools::histo::h2d >::EndT ( )
protectedinherited

◆ FillH2()

G4bool G4H2ToolsManager::FillH2 ( G4int  id,
G4double  xvalue,
G4double  yvalue,
G4double  weight = 1.0 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 379 of file G4H2ToolsManager.cc.

382{
383 auto h2d = GetTInFunction(id, "FillH2", true, false);
384 if ( ! h2d ) return false;
385
386 if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
387 return false;
388 }
389
391 = fHnManager->GetHnDimensionInformation(id, kX, "FillH2");
393 = fHnManager->GetHnDimensionInformation(id, kY, "FillH2");
394
395 h2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
396 yInfo->fFcn(yvalue/yInfo->fUnit), weight);
397
398 if ( IsVerbose(kVL4) ) {
399 Message(kVL4, "fill", "H2",
400 " id " + to_string(id) +
401 " xvalue " + to_string(xvalue) +
402 " xfcn(xvalue/xunit) " + to_string(xInfo->fFcn(xvalue/xInfo->fUnit)) +
403 " yvalue " + to_string(yvalue) +
404 " yfcn(yvalue/yunit) " + to_string(yInfo->fFcn(yvalue/yInfo->fUnit)) +
405 " weight " + to_string(weight));
406 }
407
408 return true;
409}
tools::histo::h2d * GetTInFunction(G4int id, std::string_view functionName, G4bool warn=true, G4bool onlyIfActive=true) const
const G4AnalysisManagerState & fState
G4bool IsVerbose(G4int verboseLevel) const
constexpr G4int kX
constexpr G4int kY

References G4HnDimensionInformation::fFcn, G4THnManager< tools::histo::h2d >::fHnManager, G4THnManager< tools::histo::h2d >::fState, G4HnDimensionInformation::fUnit, G4AnalysisManagerState::GetIsActivation(), G4THnManager< tools::histo::h2d >::GetTInFunction(), G4THnManager< tools::histo::h2d >::IsVerbose(), G4Analysis::kVL4, G4Analysis::kX, G4Analysis::kY, and G4THnManager< tools::histo::h2d >::Message().

◆ GetH2()

tools::histo::h2d * G4H2ToolsManager::GetH2 ( G4int  id,
G4bool  warn = true,
G4bool  onlyIfActive = true 
) const

Definition at line 629 of file G4H2ToolsManager.cc.

631{
632 return GetTInFunction(id, "GetH2", warn, onlyIfActive);
633}

References G4THnManager< tools::histo::h2d >::GetTInFunction().

◆ GetH2Id()

G4int G4H2ToolsManager::GetH2Id ( const G4String name,
G4bool  warn = true 
) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 412 of file G4H2ToolsManager.cc.

413{
414 return GetTId(name, warn);
415}
G4int GetTId(const G4String &name, G4bool warn=true) const

References G4THnManager< tools::histo::h2d >::GetTId(), and G4InuclParticleNames::name().

◆ GetH2Nxbins()

G4int G4H2ToolsManager::GetH2Nxbins ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 418 of file G4H2ToolsManager.cc.

419{
420 auto h2d = GetTInFunction(id, "GetH2NXbins");
421 if ( ! h2d ) return 0;
422
423 return GetNbins(*h2d, kX);
424}
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)

References G4Analysis::GetNbins(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kX.

◆ GetH2Nybins()

G4int G4H2ToolsManager::GetH2Nybins ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 456 of file G4H2ToolsManager.cc.

457{
458 auto h2d = GetTInFunction(id, "GetH2NYbins");
459 if ( ! h2d ) return 0;
460
461 return GetNbins(*h2d, kY);
462}

References G4Analysis::GetNbins(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kY.

◆ GetH2Title()

G4String G4H2ToolsManager::GetH2Title ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 530 of file G4H2ToolsManager.cc.

531{
532 auto h2d = GetTInFunction(id, "GetH2Title");
533 if ( ! h2d ) return "";
534
535 return GetTitle(*h2d);
536}
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)

References G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::GetTitle().

◆ GetH2Vector()

const std::vector< tools::histo::h2d * > & G4H2ToolsManager::GetH2Vector ( ) const
inline

◆ GetH2XAxisTitle()

G4String G4H2ToolsManager::GetH2XAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 539 of file G4H2ToolsManager.cc.

540{
541 auto h2d = GetTInFunction(id, "GetH2XAxisTitle");
542 if ( ! h2d ) return "";
543
544 return GetAxisTitle(*h2d, kX, fHnManager->GetHnType());
545}
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

References G4THnManager< tools::histo::h2d >::fHnManager, G4Analysis::GetAxisTitle(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kX.

◆ GetH2Xmax()

G4double G4H2ToolsManager::GetH2Xmax ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 438 of file G4H2ToolsManager.cc.

439{
440 auto h2d = GetTInFunction(id, "GetH2Xmax");
441 if ( ! h2d ) return 0.;
442
443 return GetMax(*h2d, kX);
444}
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)

References G4Analysis::GetMax(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kX.

◆ GetH2Xmin()

G4double G4H2ToolsManager::GetH2Xmin ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 427 of file G4H2ToolsManager.cc.

428{
429// Returns xmin value with applied unit and histogram function
430
431 auto h2d = GetTInFunction(id, "GetH2Xmin");
432 if ( ! h2d ) return 0.;
433
434 return GetMin(*h2d, kX);
435}
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)

References G4Analysis::GetMin(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kX.

◆ GetH2XWidth()

G4double G4H2ToolsManager::GetH2XWidth ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 447 of file G4H2ToolsManager.cc.

448{
449 auto h2d = GetTInFunction(id, "GetH2XWidth", true, false);
450 if ( ! h2d ) return 0.;
451
452 return GetWidth(*h2d, kX, fHnManager->GetHnType());
453}
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

References G4THnManager< tools::histo::h2d >::fHnManager, G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::GetWidth(), and G4Analysis::kX.

◆ GetH2YAxisTitle()

G4String G4H2ToolsManager::GetH2YAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 548 of file G4H2ToolsManager.cc.

549{
550 auto h2d = GetTInFunction(id, "GetH2YAxisTitle");
551 if ( ! h2d ) return "";
552
553 return GetAxisTitle(*h2d, kY, fHnManager->GetHnType());
554}

References G4THnManager< tools::histo::h2d >::fHnManager, G4Analysis::GetAxisTitle(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kY.

◆ GetH2Ymax()

G4double G4H2ToolsManager::GetH2Ymax ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 476 of file G4H2ToolsManager.cc.

477{
478 auto h2d = GetTInFunction(id, "GetH2Ymax");
479 if ( ! h2d ) return 0.;
480
481 return GetMax(*h2d, kY);
482}

References G4Analysis::GetMax(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kY.

◆ GetH2Ymin()

G4double G4H2ToolsManager::GetH2Ymin ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 465 of file G4H2ToolsManager.cc.

466{
467// Returns xmin value with applied unit and histogram function
468
469 auto h2d = GetTInFunction(id, "GetH2Ymin");
470 if ( ! h2d ) return 0.;
471
472 return GetMin(*h2d, kY);
473}

References G4Analysis::GetMin(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kY.

◆ GetH2YWidth()

G4double G4H2ToolsManager::GetH2YWidth ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 485 of file G4H2ToolsManager.cc.

486{
487 auto h2d = GetTInFunction(id, "GetH2YWidth", true, false);
488 if ( ! h2d ) return 0.;
489
490 return GetWidth(*h2d, kY, fHnManager->GetHnType());
491}

References G4THnManager< tools::histo::h2d >::fHnManager, G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::GetWidth(), and G4Analysis::kY.

◆ GetH2ZAxisTitle()

G4String G4H2ToolsManager::GetH2ZAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 557 of file G4H2ToolsManager.cc.

558{
559 auto h2d = GetTInFunction(id, "GetH2ZAxisTitle");
560 if ( ! h2d ) return "";
561
562 return GetAxisTitle(*h2d, kZ, fHnManager->GetHnType());
563}
constexpr G4int kZ

References G4THnManager< tools::histo::h2d >::fHnManager, G4Analysis::GetAxisTitle(), G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::kZ.

◆ GetHnManager()

std::shared_ptr< G4HnManager > G4H2ToolsManager::GetHnManager ( )
inlinefinalprotectedvirtual

Implements G4VH2Manager.

Definition at line 197 of file G4H2ToolsManager.hh.

198{ return std::shared_ptr<G4HnManager>(fHnManager); }

References G4THnManager< tools::histo::h2d >::fHnManager.

◆ GetHnVector()

const std::vector< G4HnInformation * > & G4H2ToolsManager::GetHnVector ( ) const
inline

◆ GetT()

tools::histo::h2d * G4THnManager< tools::histo::h2d >::GetT ( G4int  id) const
inherited

◆ GetTId()

G4int G4THnManager< tools::histo::h2d >::GetTId ( const G4String name,
G4bool  warn = true 
) const
protectedinherited

◆ GetTInFunction()

tools::histo::h2d * G4THnManager< tools::histo::h2d >::GetTInFunction ( G4int  id,
std::string_view  functionName,
G4bool  warn = true,
G4bool  onlyIfActive = true 
) const
protectedinherited

◆ IsEmpty()

G4bool G4THnManager< tools::histo::h2d >::IsEmpty ( ) const
inherited

◆ IsVerbose()

G4bool G4THnManager< tools::histo::h2d >::IsVerbose ( G4int  verboseLevel) const
protectedinherited

◆ Merge()

void G4THnManager< tools::histo::h2d >::Merge ( G4Mutex mergeMutex,
G4THnManager< tools::histo::h2d > *  masterInstance 
)
inherited

◆ Message()

void G4THnManager< tools::histo::h2d >::Message ( G4int  level,
const G4String action,
const G4String objectType,
const G4String objectName = "",
G4bool  success = true 
) const
protectedinherited

◆ RegisterT()

G4int G4THnManager< tools::histo::h2d >::RegisterT ( tools::histo::h2d *  t,
const G4String name 
)
inherited

◆ Reset()

G4bool G4THnManager< tools::histo::h2d >::Reset ( )
inherited

◆ ScaleH2()

G4bool G4H2ToolsManager::ScaleH2 ( G4int  id,
G4double  factor 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 370 of file G4H2ToolsManager.cc.

371{
372 auto h2d = GetTInFunction(id, "ScaleH2", false, false);
373 if ( ! h2d ) return false;
374
375 return h2d->scale(factor);
376}

References G4THnManager< tools::histo::h2d >::GetTInFunction().

◆ SetH2() [1/2]

G4bool G4H2ToolsManager::SetH2 ( G4int  id,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 340 of file G4H2ToolsManager.cc.

345{
346 auto h2d = GetTInFunction(id, "SetH2", false, false);
347 if ( ! h2d ) return false;
348
349 auto info = fHnManager->GetHnInformation(id, "SetH2");
350
351 Message(kVL4, "configure", "H2", info->GetName());
352
353 // Configure tools h2
354 ConfigureToolsH2(h2d, xedges, yedges, xunitName, yunitName, xfcnName, yfcnName);
355
356 // Add annotation
357 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
358
359 // Update information
361 info, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser, G4BinScheme::kUser);
362
363 // Set activation
364 fHnManager->SetActivation(id, true);
365
366 return true;
367}
void ConfigureToolsH2(tools::histo::h2d *h2d, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)
void UpdateH2Information(G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme)

References anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation(), anonymous_namespace{G4H2ToolsManager.cc}::ConfigureToolsH2(), G4THnManager< tools::histo::h2d >::fHnManager, G4THnManager< tools::histo::h2d >::GetTInFunction(), kUser, G4Analysis::kVL4, G4THnManager< tools::histo::h2d >::Message(), and anonymous_namespace{G4H2ToolsManager.cc}::UpdateH2Information().

◆ SetH2() [2/2]

G4bool G4H2ToolsManager::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 xbinScheme = "linear",
const G4String ybinScheme = "linear" 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 303 of file G4H2ToolsManager.cc.

310{
311 auto h2d = GetTInFunction(id, "SetH2", false, false);
312 if ( ! h2d ) return false;
313
314 auto info = fHnManager->GetHnInformation(id, "SetH2");
315
316 Message(kVL4, "configure", "H2", info->GetName());
317
318 // Configure tools h2
320 h2d, nxbins, xmin, xmax, nybins, ymin, ymax,
321 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName, ybinSchemeName,
322 fkClass);
323
324 // Add annotation
325 AddH2Annotation(h2d, xunitName, yunitName, xfcnName, yfcnName);
326
327 // Update information
328 auto xbinScheme = GetBinScheme(xbinSchemeName);
329 auto ybinScheme = GetBinScheme(ybinSchemeName);
331 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme, ybinScheme);
332
333 // Set activation
334 fHnManager->SetActivation(id, true);
335
336 return true;
337}

References anonymous_namespace{G4H2ToolsManager.cc}::AddH2Annotation(), anonymous_namespace{G4H2ToolsManager.cc}::ConfigureToolsH2(), G4THnManager< tools::histo::h2d >::fHnManager, fkClass, G4Analysis::GetBinScheme(), G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::kVL4, G4THnManager< tools::histo::h2d >::Message(), and anonymous_namespace{G4H2ToolsManager.cc}::UpdateH2Information().

◆ SetH2Title()

G4bool G4H2ToolsManager::SetH2Title ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 494 of file G4H2ToolsManager.cc.

495{
496 auto h2d = GetTInFunction(id, "SetH2Title");
497 if ( ! h2d ) return false;
498
499 return SetTitle(*h2d, title);
500}
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)

References G4THnManager< tools::histo::h2d >::GetTInFunction(), and G4Analysis::SetTitle().

◆ SetH2XAxisTitle()

G4bool G4H2ToolsManager::SetH2XAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 503 of file G4H2ToolsManager.cc.

504{
505 auto h2d = GetTInFunction(id, "SetH2XAxisTitle");
506 if ( ! h2d ) return false;
507
508 return SetAxisTitle(*h2d, kX, title);
509}
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)

References G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::kX, and G4Analysis::SetAxisTitle().

◆ SetH2YAxisTitle()

G4bool G4H2ToolsManager::SetH2YAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 512 of file G4H2ToolsManager.cc.

513{
514 auto h2d = GetTInFunction(id, "SetH2YAxisTitle");
515 if ( ! h2d ) return false;
516
517 return SetAxisTitle(*h2d, kY, title);
518}

References G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::kY, and G4Analysis::SetAxisTitle().

◆ SetH2ZAxisTitle()

G4bool G4H2ToolsManager::SetH2ZAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 521 of file G4H2ToolsManager.cc.

522{
523 auto h2d = GetTInFunction(id, "SetH2ZAxisTitle");
524 if ( ! h2d ) return false;
525
526 return SetAxisTitle(*h2d, kZ, title);
527}

References G4THnManager< tools::histo::h2d >::GetTInFunction(), G4Analysis::kZ, and G4Analysis::SetAxisTitle().

◆ WriteOnAscii()

G4bool G4H2ToolsManager::WriteOnAscii ( std::ofstream &  output)
finalprotectedvirtual

Implements G4VH2Manager.

Definition at line 566 of file G4H2ToolsManager.cc.

567{
568// Write selected objects on ASCII file
569
570 // Do nothing if no histograms are selected
571 if ( ! fHnManager->IsAscii() ) return true;
572
573 // Write h2 histograms
574 for ( G4int i=0; i<G4int(fTVector.size()); ++i ) {
575 auto id = i + fHnManager->GetFirstId();
576 auto info = fHnManager->GetHnInformation(id,"WriteOnAscii");
577 // skip writing if activation is enabled and H1 is inactivated
578 if ( ! info->GetAscii() ) continue;
579 auto h2 = fTVector[i];
580
581 Message(kVL3, "write on ascii", "h2d", info->GetName());
582
583 output << "\n 2D histogram " << id << ": " << h2->title()
584 << "\n \n \t \t X \t\t Y \t\t Bin Height" << G4endl;
585
586 for (G4int j=0; j< G4int(h2->axis_x().bins()); ++j) {
587 for (G4int k=0; k< G4int(h2->axis_y().bins()); ++k) {
588 output << " " << j << "\t" << k << "\t"
589 << h2->axis_x().bin_center(j) << "\t"
590 << h2->axis_y().bin_center(k) << "\t"
591 << h2->bin_height(j, k) << G4endl;
592 }
593 }
594 }
595
596 return output.good();
597}
#define G4endl
Definition: G4ios.hh:57
constexpr G4int kVL3

References G4THnManager< tools::histo::h2d >::fHnManager, G4THnManager< tools::histo::h2d >::fTVector, G4endl, G4Analysis::kVL3, and G4THnManager< tools::histo::h2d >::Message().

Field Documentation

◆ fHnManager

std::shared_ptr<G4HnManager> G4THnManager< tools::histo::h2d >::fHnManager
protectedinherited

Definition at line 105 of file G4THnManager.hh.

◆ fkClass

constexpr std::string_view G4H2ToolsManager::fkClass { "G4H2ToolsManager" }
staticconstexprprivate

Definition at line 172 of file G4H2ToolsManager.hh.

Referenced by CreateH2(), and SetH2().

◆ fkDimension

constexpr G4int G4H2ToolsManager::fkDimension = 2
staticconstexprprivate

Definition at line 173 of file G4H2ToolsManager.hh.

Referenced by AddH2Information().

◆ fNameIdMap

std::map<G4String, G4int> G4THnManager< tools::histo::h2d >::fNameIdMap
protectedinherited

Definition at line 104 of file G4THnManager.hh.

◆ fState

const G4AnalysisManagerState& G4THnManager< tools::histo::h2d >::fState
protectedinherited

Definition at line 102 of file G4THnManager.hh.

◆ fTVector

std::vector<tools::histo::h2d *> G4THnManager< tools::histo::h2d >::fTVector
protectedinherited

Definition at line 103 of file G4THnManager.hh.


The documentation for this class was generated from the following files: