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

#include <G4P2ToolsManager.hh>

Inheritance diagram for G4P2ToolsManager:
G4VP2Manager G4THnManager< tools::histo::p2d >

Public Member Functions

G4int AddP2 (const G4String &name, tools::histo::p2d *p2d)
 
void AddP2Vector (const std::vector< tools::histo::p2d * > &p2Vector)
 
void AddTVector (const std::vector< tools::histo::p2d * > &tVector)
 
std::vector< tools::histo::p2d * >::const_iterator BeginConstP2 () const
 
std::vector< tools::histo::p2d * >::iterator BeginP2 ()
 
void ClearData ()
 
std::vector< tools::histo::p2d * >::const_iterator EndConstP2 () const
 
std::vector< tools::histo::p2d * >::iterator EndP2 ()
 
 G4P2ToolsManager ()=delete
 
 G4P2ToolsManager (const G4AnalysisManagerState &state)
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
tools::histo::p2d * GetP2 (G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
 
const std::vector< tools::histo::p2d * > & GetP2Vector () const
 
tools::histo::p2d * GetT (G4int id) const
 
G4bool IsEmpty () const
 
void Merge (G4Mutex &mergeMutex, G4THnManager< tools::histo::p2d > *masterInstance)
 
G4int RegisterT (tools::histo::p2d *t, const G4String &name)
 
G4bool Reset ()
 
virtual ~G4P2ToolsManager ()=default
 

Protected Member Functions

std::vector< tools::histo::p2d * >::const_iterator BeginConstT () const
 
std::vector< tools::histo::p2d * >::iterator BeginT ()
 
virtual G4int CreateP2 (const G4String &name, const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, 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") final
 
virtual 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 &xbinScheme="linear", const G4String &ybinScheme="linear") final
 
std::vector< tools::histo::p2d * >::const_iterator EndConstT () const
 
std::vector< tools::histo::p2d * >::iterator EndT ()
 
virtual G4bool FillP2 (G4int id, G4double xvalue, G4double yvalue, G4double zvalue, G4double weight=1.0) final
 
virtual std::shared_ptr< G4HnManagerGetHnManager () final
 
virtual G4int GetP2Id (const G4String &name, G4bool warn=true) const final
 
virtual G4int GetP2Nxbins (G4int id) const final
 
virtual G4int GetP2Nybins (G4int id) const final
 
virtual G4String GetP2Title (G4int id) const final
 
virtual G4String GetP2XAxisTitle (G4int id) const final
 
virtual G4double GetP2Xmax (G4int id) const final
 
virtual G4double GetP2Xmin (G4int id) const final
 
virtual G4double GetP2XWidth (G4int id) const final
 
virtual G4String GetP2YAxisTitle (G4int id) const final
 
virtual G4double GetP2Ymax (G4int id) const final
 
virtual G4double GetP2Ymin (G4int id) const final
 
virtual G4double GetP2YWidth (G4int id) const final
 
virtual G4String GetP2ZAxisTitle (G4int id) const final
 
virtual G4double GetP2Zmax (G4int id) const final
 
virtual G4double GetP2Zmin (G4int id) const final
 
G4int GetTId (const G4String &name, G4bool warn=true) const
 
tools::histo::p2d * 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 ScaleP2 (G4int id, G4double factor) final
 
virtual G4bool SetP2 (G4int id, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, 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") final
 
virtual 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 &xbinScheme="linear", const G4String &ybinScheme="linear") final
 
virtual G4bool SetP2Title (G4int id, const G4String &title) final
 
virtual G4bool SetP2XAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetP2YAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetP2ZAxisTitle (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::p2d * > fTVector
 

Private Member Functions

void AddP2Information (const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme) const
 

Static Private Attributes

static constexpr std::string_view fkClass { "G4P2ToolsManager" }
 
static constexpr G4int fkDimension = 3
 

Detailed Description

Definition at line 52 of file G4P2ToolsManager.hh.

Constructor & Destructor Documentation

◆ G4P2ToolsManager() [1/2]

G4P2ToolsManager::G4P2ToolsManager ( const G4AnalysisManagerState state)
explicit

Definition at line 42 of file G4P2ToolsManager.cc.

◆ G4P2ToolsManager() [2/2]

G4P2ToolsManager::G4P2ToolsManager ( )
delete

◆ ~G4P2ToolsManager()

virtual G4P2ToolsManager::~G4P2ToolsManager ( )
virtualdefault

Member Function Documentation

◆ AddP2()

G4int G4P2ToolsManager::AddP2 ( const G4String name,
tools::histo::p2d *  p2d 
)

Definition at line 721 of file G4P2ToolsManager.cc.

722{
723 Message(kVL4, "add", "P2", name);
724
725 // Add annotation
726 AddP2Annotation(p2d, "none", "none", "none", "none", "none", "none");
727 // Add information
728 AddP2Information(name, "none", "none", "none", "none", "none", "none",
730
731 // Register profile
732 G4int id = RegisterT(p2d, name);
733
734 Message(kVL2, "add", "P2", name);
735
736 return id;
737}
int G4int
Definition: G4Types.hh:85
void AddP2Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme) const
G4int RegisterT(tools::histo::p2d *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 AddP2Annotation(tools::histo::p2d *p2d, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)

References anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation(), AddP2Information(), kLinear, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p2d >::RegisterT().

◆ AddP2Information()

void G4P2ToolsManager::AddP2Information ( const G4String name,
const G4String xunitName,
const G4String yunitName,
const G4String zunitName,
const G4String xfcnName,
const G4String yfcnName,
const G4String zfcnName,
G4BinScheme  xbinScheme,
G4BinScheme  ybinScheme 
) const
private

Definition at line 285 of file G4P2ToolsManager.cc.

294{
295 auto hnInformation = fHnManager->AddHnInformation(name, fkDimension);
296 hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
297 hnInformation->AddDimension(yunitName, yfcnName, ybinScheme);
298 hnInformation->AddDimension(zunitName, zfcnName, G4BinScheme::kLinear);
299}
static constexpr G4int fkDimension
std::shared_ptr< G4HnManager > fHnManager

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

Referenced by AddP2(), and CreateP2().

◆ AddP2Vector()

void G4P2ToolsManager::AddP2Vector ( const std::vector< tools::histo::p2d * > &  p2Vector)

Definition at line 740 of file G4P2ToolsManager.cc.

742{
743 AddTVector(p2Vector);
744}
void AddTVector(const std::vector< tools::histo::p2d * > &tVector)

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

◆ AddTVector()

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

◆ BeginConstP2()

std::vector< tools::histo::p2d * >::const_iterator G4P2ToolsManager::BeginConstP2 ( ) const
inline

Definition at line 203 of file G4P2ToolsManager.hh.

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

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

◆ BeginConstT()

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

◆ BeginP2()

std::vector< tools::histo::p2d * >::iterator G4P2ToolsManager::BeginP2 ( )
inline

Definition at line 196 of file G4P2ToolsManager.hh.

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

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

◆ BeginT()

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

◆ ClearData()

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

◆ CreateP2() [1/2]

G4int G4P2ToolsManager::CreateP2 ( const G4String name,
const G4String title,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
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" 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 347 of file G4P2ToolsManager.cc.

356{
357 Message(kVL4, "create", "P2", name);
358
359 tools::histo::p2d* p2d
360 = CreateToolsP2(title, xedges, yedges, zmin, zmax,
361 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
362
363 // Add annotation
365 p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
366
367 // Save P2 information
369 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
371
372 // Register profile
373 G4int id = RegisterT(p2d, name);
374
375 Message(kVL2, "create", "P2", name);
376
377 return id;
378}
tools::histo::p2d * CreateToolsP2(const G4String &title, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)

References anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation(), AddP2Information(), anonymous_namespace{G4P2ToolsManager.cc}::CreateToolsP2(), kUser, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p2d >::RegisterT().

◆ CreateP2() [2/2]

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

Implements G4VP2Manager.

Definition at line 306 of file G4P2ToolsManager.cc.

317{
318 Message(kVL4, "create", "P2", name);
319
320 tools::histo::p2d* p2d
321 = CreateToolsP2(title,
322 nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
323 xunitName, yunitName, zunitName,
324 xfcnName, yfcnName, zfcnName,
325 xbinSchemeName, ybinSchemeName, fkClass);
326
327 // Add annotation
328 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
329 xfcnName, yfcnName, zfcnName);
330
331 // Save P2 information
332 auto xbinScheme = GetBinScheme(xbinSchemeName);
333 auto ybinScheme = GetBinScheme(ybinSchemeName);
335 name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
336 xbinScheme, ybinScheme);
337
338 // Register profile
339 G4int id = RegisterT(p2d, name);
340
341 Message(kVL2, "create", "P2", name);
342
343 return id;
344}
static constexpr std::string_view fkClass
G4BinScheme GetBinScheme(const G4String &binSchemeName)
Definition: G4BinScheme.cc:36

References anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation(), AddP2Information(), anonymous_namespace{G4P2ToolsManager.cc}::CreateToolsP2(), fkClass, G4Analysis::GetBinScheme(), G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p2d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p2d >::RegisterT().

◆ EndConstP2()

std::vector< tools::histo::p2d * >::const_iterator G4P2ToolsManager::EndConstP2 ( ) const
inline

Definition at line 207 of file G4P2ToolsManager.hh.

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

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

◆ EndConstT()

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

◆ EndP2()

std::vector< tools::histo::p2d * >::iterator G4P2ToolsManager::EndP2 ( )
inline

Definition at line 199 of file G4P2ToolsManager.hh.

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

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

◆ EndT()

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

◆ FillP2()

G4bool G4P2ToolsManager::FillP2 ( G4int  id,
G4double  xvalue,
G4double  yvalue,
G4double  zvalue,
G4double  weight = 1.0 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 468 of file G4P2ToolsManager.cc.

471{
472 auto p2d = GetTInFunction(id, "FillP2", true, false);
473 if ( ! p2d ) return false;
474
475 if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
476 return false;
477 }
478
479 auto xInfo
480 = fHnManager->GetHnDimensionInformation(id, kX, "FillP2");
481 auto yInfo
482 = fHnManager->GetHnDimensionInformation(id, kY, "FillP2");
483 auto zInfo
484 = fHnManager->GetHnDimensionInformation(id, kZ, "FillP2");
485
486 p2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
487 yInfo->fFcn(yvalue/yInfo->fUnit),
488 zInfo->fFcn(zvalue/zInfo->fUnit), weight);
489
490 if ( IsVerbose(kVL4) ) {
491 Message(kVL4, "fill", "P2",
492 " id " + to_string(id) +
493 " xvalue " + to_string(xvalue) +
494 " xfcn(xvalue/xunit) " + to_string(xInfo->fFcn(xvalue/xInfo->fUnit)) +
495 " yvalue " + to_string(yvalue) +
496 " yfcn(yvalue/yunit) " + to_string(yInfo->fFcn(yvalue/yInfo->fUnit)) +
497 " zvalue " + to_string(zvalue) +
498 " zfcn(zvalue/zunit) " + to_string(zInfo->fFcn(zvalue/zInfo->fUnit)) +
499 " weight " + to_string(weight));
500 }
501
502 return true;
503}
tools::histo::p2d * 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 kZ
constexpr G4int kY

References G4THnManager< tools::histo::p2d >::fHnManager, G4THnManager< tools::histo::p2d >::fState, G4AnalysisManagerState::GetIsActivation(), G4THnManager< tools::histo::p2d >::GetTInFunction(), G4THnManager< tools::histo::p2d >::IsVerbose(), G4Analysis::kVL4, G4Analysis::kX, G4Analysis::kY, G4Analysis::kZ, and G4THnManager< tools::histo::p2d >::Message().

◆ GetHnManager()

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

Implements G4VP2Manager.

Definition at line 216 of file G4P2ToolsManager.hh.

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

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

◆ GetHnVector()

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

◆ GetP2()

tools::histo::p2d * G4P2ToolsManager::GetP2 ( G4int  id,
G4bool  warn = true,
G4bool  onlyIfActive = true 
) const

Definition at line 747 of file G4P2ToolsManager.cc.

749{
750 return GetTInFunction(id, "GetP2", warn, onlyIfActive);
751}

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

◆ GetP2Id()

G4int G4P2ToolsManager::GetP2Id ( const G4String name,
G4bool  warn = true 
) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 506 of file G4P2ToolsManager.cc.

507{
508 return GetTId(name, warn);
509}
G4int GetTId(const G4String &name, G4bool warn=true) const

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

◆ GetP2Nxbins()

G4int G4P2ToolsManager::GetP2Nxbins ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 512 of file G4P2ToolsManager.cc.

513{
514 auto p2d = GetTInFunction(id, "GetP2NXbins");
515 if ( ! p2d ) return 0;
516
517 return GetNbins(*p2d, kX);
518}
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetP2Nybins()

G4int G4P2ToolsManager::GetP2Nybins ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 550 of file G4P2ToolsManager.cc.

551{
552 auto p2d = GetTInFunction(id, "GetP2NYbins");
553 if ( ! p2d ) return 0;
554
555 return GetNbins(*p2d, kY);
556}

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

◆ GetP2Title()

G4String G4P2ToolsManager::GetP2Title ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 644 of file G4P2ToolsManager.cc.

645{
646 auto p2d = GetTInFunction(id, "GetP2Title");
647 if ( ! p2d ) return "";
648
649 return GetTitle(*p2d);
650}
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)

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

◆ GetP2Vector()

const std::vector< tools::histo::p2d * > & G4P2ToolsManager::GetP2Vector ( ) const
inline

Definition at line 210 of file G4P2ToolsManager.hh.

211{ return fTVector; }
std::vector< tools::histo::p2d * > fTVector

References G4THnManager< tools::histo::p2d >::fTVector.

Referenced by G4ToolsAnalysisManager::MergeImpl(), and G4ToolsAnalysisManager::WriteImpl().

◆ GetP2XAxisTitle()

G4String G4P2ToolsManager::GetP2XAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 653 of file G4P2ToolsManager.cc.

654{
655 auto p2d = GetTInFunction(id, "GetP2XAxisTitle");
656 if ( ! p2d ) return "";
657
658 return GetAxisTitle(*p2d, kX, fHnManager->GetHnType());
659}
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

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

◆ GetP2Xmax()

G4double G4P2ToolsManager::GetP2Xmax ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 532 of file G4P2ToolsManager.cc.

533{
534 auto p2d = GetTInFunction(id, "GetP2Xmax");
535 if ( ! p2d ) return 0.;
536
537 return GetMax(*p2d, kX);
538}
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetP2Xmin()

G4double G4P2ToolsManager::GetP2Xmin ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 521 of file G4P2ToolsManager.cc.

522{
523// Returns xmin value with applied unit and profile function
524
525 auto p2d = GetTInFunction(id, "GetP2Xmin");
526 if ( ! p2d ) return 0.;
527
528 return GetMin(*p2d, kX);
529}
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetP2XWidth()

G4double G4P2ToolsManager::GetP2XWidth ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 541 of file G4P2ToolsManager.cc.

542{
543 auto p2d = GetTInFunction(id, "GetP2XWidth", true, false);
544 if ( ! p2d ) return 0.;
545
546 return GetWidth(*p2d, kX, fHnManager->GetHnType());
547}
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

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

◆ GetP2YAxisTitle()

G4String G4P2ToolsManager::GetP2YAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 662 of file G4P2ToolsManager.cc.

663{
664 auto p2d = GetTInFunction(id, "GetP2YAxisTitle");
665 if ( ! p2d ) return "";
666
667 return GetAxisTitle(*p2d, kY, fHnManager->GetHnType());
668}

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

◆ GetP2Ymax()

G4double G4P2ToolsManager::GetP2Ymax ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 570 of file G4P2ToolsManager.cc.

571{
572 auto p2d = GetTInFunction(id, "GetP2Ymax");
573 if ( ! p2d ) return 0.;
574
575 return GetMax(*p2d, kY);
576}

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

◆ GetP2Ymin()

G4double G4P2ToolsManager::GetP2Ymin ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 559 of file G4P2ToolsManager.cc.

560{
561// Returns xmin value with applied unit and profile function
562
563 auto p2d = GetTInFunction(id, "GetP2Ymin");
564 if ( ! p2d ) return 0.;
565
566 return GetMin(*p2d, kY);
567}

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

◆ GetP2YWidth()

G4double G4P2ToolsManager::GetP2YWidth ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 579 of file G4P2ToolsManager.cc.

580{
581 auto p2d = GetTInFunction(id, "GetP2YWidth", true, false);
582 if ( ! p2d ) return 0.;
583
584 return GetWidth(*p2d, kY, fHnManager->GetHnType());
585}

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

◆ GetP2ZAxisTitle()

G4String G4P2ToolsManager::GetP2ZAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 671 of file G4P2ToolsManager.cc.

672{
673 auto p2d = GetTInFunction(id, "GetP2ZAxisTitle");
674 if ( ! p2d ) return "";
675
676 return GetAxisTitle(*p2d, kZ, fHnManager->GetHnType());
677}

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

◆ GetP2Zmax()

G4double G4P2ToolsManager::GetP2Zmax ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 599 of file G4P2ToolsManager.cc.

600{
601 auto p2d = GetTInFunction(id, "GetP2Zmax");
602 if ( ! p2d ) return 0.;
603
604 return GetMax(*p2d, kZ);
605}

References G4Analysis::GetMax(), G4THnManager< tools::histo::p2d >::GetTInFunction(), and G4Analysis::kZ.

◆ GetP2Zmin()

G4double G4P2ToolsManager::GetP2Zmin ( G4int  id) const
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 588 of file G4P2ToolsManager.cc.

589{
590// Returns xmin value with applied unit and profile function
591
592 auto p2d = GetTInFunction(id, "GetP2Zmin");
593 if ( ! p2d ) return 0.;
594
595 return GetMin(*p2d, kZ);
596}

References G4Analysis::GetMin(), G4THnManager< tools::histo::p2d >::GetTInFunction(), and G4Analysis::kZ.

◆ GetT()

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

◆ GetTId()

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

◆ GetTInFunction()

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

◆ IsEmpty()

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

◆ IsVerbose()

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

◆ Merge()

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

◆ Message()

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

◆ RegisterT()

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

◆ Reset()

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

◆ ScaleP2()

G4bool G4P2ToolsManager::ScaleP2 ( G4int  id,
G4double  factor 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 459 of file G4P2ToolsManager.cc.

460{
461 auto p2d = GetTInFunction(id, "ScaleP2", false, false);
462 if ( ! p2d ) return false;
463
464 return p2d->scale(factor);
465}

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

◆ SetP2() [1/2]

G4bool G4P2ToolsManager::SetP2 ( G4int  id,
const std::vector< G4double > &  xedges,
const std::vector< G4double > &  yedges,
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" 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 423 of file G4P2ToolsManager.cc.

431{
432 auto p2d = GetTInFunction(id, "SetP2", false, false);
433 if ( ! p2d ) return false;
434
435 auto info = fHnManager->GetHnInformation(id, "SetP2");
436
437 Message(kVL4, "configure", "P2", info->GetName());
438
439 // Configure tools p2
440 ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax,
441 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
442
443 // Add annotation
444 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
445 xfcnName, yfcnName, zfcnName);
446
447 // Update information
449 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
451
452 // Set activation
453 fHnManager->SetActivation(id, true);
454
455 return true;
456}
void UpdateP2Information(G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme)
void ConfigureToolsP2(tools::histo::p2d *p2d, const std::vector< G4double > &xedges, const std::vector< G4double > &yedges, G4double zmin, G4double zmax, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName)

References anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation(), anonymous_namespace{G4P2ToolsManager.cc}::ConfigureToolsP2(), G4THnManager< tools::histo::p2d >::fHnManager, G4THnManager< tools::histo::p2d >::GetTInFunction(), kUser, G4Analysis::kVL4, G4THnManager< tools::histo::p2d >::Message(), and anonymous_namespace{G4P2ToolsManager.cc}::UpdateP2Information().

◆ SetP2() [2/2]

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

Implements G4VP2Manager.

Definition at line 381 of file G4P2ToolsManager.cc.

391{
392 auto p2d = GetTInFunction(id, "SetP2", false, false);
393 if ( ! p2d ) return false;
394
395 auto info = fHnManager->GetHnInformation(id, "SetP2");
396
397 Message(kVL4, "configure", "P2", info->GetName());
398
399 // Configure tools p2
401 p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
402 xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
403 xbinSchemeName, ybinSchemeName, fkClass);
404
405 // Add annotation
406 AddP2Annotation(p2d, xunitName, yunitName, zunitName,
407 xfcnName, yfcnName, zfcnName);
408
409 // Update information
410 auto xbinScheme = GetBinScheme(xbinSchemeName);
411 auto ybinScheme = GetBinScheme(ybinSchemeName);
413 info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
414 xbinScheme, ybinScheme);
415
416 // Set activation
417 fHnManager->SetActivation(id, true);
418
419 return true;
420}

References anonymous_namespace{G4P2ToolsManager.cc}::AddP2Annotation(), anonymous_namespace{G4P2ToolsManager.cc}::ConfigureToolsP2(), G4THnManager< tools::histo::p2d >::fHnManager, fkClass, G4Analysis::GetBinScheme(), G4THnManager< tools::histo::p2d >::GetTInFunction(), G4Analysis::kVL4, G4THnManager< tools::histo::p2d >::Message(), and anonymous_namespace{G4P2ToolsManager.cc}::UpdateP2Information().

◆ SetP2Title()

G4bool G4P2ToolsManager::SetP2Title ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 608 of file G4P2ToolsManager.cc.

609{
610 auto p2d = GetTInFunction(id, "SetP2Title");
611 if ( ! p2d ) return false;
612
613 return SetTitle(*p2d, title);
614}
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)

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

◆ SetP2XAxisTitle()

G4bool G4P2ToolsManager::SetP2XAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 617 of file G4P2ToolsManager.cc.

618{
619 auto p2d = GetTInFunction(id, "SetP2XAxisTitle");
620 if ( ! p2d ) return false;
621
622 return SetAxisTitle(*p2d, kX, title);
623}
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)

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

◆ SetP2YAxisTitle()

G4bool G4P2ToolsManager::SetP2YAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 626 of file G4P2ToolsManager.cc.

627{
628 auto p2d = GetTInFunction(id, "SetP2YAxisTitle");
629 if ( ! p2d ) return false;
630
631 return SetAxisTitle(*p2d, kY, title);
632}

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

◆ SetP2ZAxisTitle()

G4bool G4P2ToolsManager::SetP2ZAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP2Manager.

Definition at line 635 of file G4P2ToolsManager.cc.

636{
637 auto p2d = GetTInFunction(id, "SetP2ZAxisTitle");
638 if ( ! p2d ) return false;
639
640 return SetAxisTitle(*p2d, kZ, title);
641}

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

◆ WriteOnAscii()

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

Implements G4VP2Manager.

Definition at line 680 of file G4P2ToolsManager.cc.

681{
682// Write selected objects on ASCII file
683
684 // Do nothing if no histograms are selected
685 if ( ! fHnManager->IsAscii() ) return true;
686
687 // Write p2 histograms
688 for ( G4int i=0; i<G4int(fTVector.size()); ++i ) {
689 auto id = i + fHnManager->GetFirstId();
690 auto info = fHnManager->GetHnInformation(id,"WriteOnAscii");
691 // skip writing if activation is enabled and H1 is inactivated
692 if ( ! info->GetAscii() ) continue;
693 auto p2 = fTVector[i];
694
695 Message(kVL3, "write on ascii", "p2d", info->GetName());
696
697 output << "\n 2D profile " << id << ": " << p2->title()
698 << "\n \n \t \t X \t\t Y \t\t MeanZ" << G4endl;
699
700 for (G4int j=0; j< G4int(p2->axis_x().bins()); ++j) {
701 for (G4int k=0; k< G4int(p2->axis_y().bins()); ++k) {
702 auto sw = p2->bin_Sw(j, k);
703 auto svw = p2->bin_Svw(j, k);
704 auto mean = ( sw != 0. ) ? (svw / sw) : 0.;
705 output << " " << j << "\t" << k << "\t"
706 << p2->axis_x().bin_center(j) << "\t"
707 << p2->axis_y().bin_center(k) << "\t"
708 << mean << G4endl;
709 }
710 }
711 }
712
713 return output.good();
714}
#define G4endl
Definition: G4ios.hh:57
constexpr G4int kVL3

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

Field Documentation

◆ fHnManager

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

Definition at line 105 of file G4THnManager.hh.

◆ fkClass

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

Definition at line 190 of file G4P2ToolsManager.hh.

Referenced by CreateP2(), and SetP2().

◆ fkDimension

constexpr G4int G4P2ToolsManager::fkDimension = 3
staticconstexprprivate

Definition at line 191 of file G4P2ToolsManager.hh.

Referenced by AddP2Information().

◆ fNameIdMap

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

Definition at line 104 of file G4THnManager.hh.

◆ fState

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

Definition at line 102 of file G4THnManager.hh.

◆ fTVector

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

Definition at line 103 of file G4THnManager.hh.


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