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

#include <G4P1ToolsManager.hh>

Inheritance diagram for G4P1ToolsManager:
G4VP1Manager G4THnManager< tools::histo::p1d >

Public Member Functions

G4int AddP1 (const G4String &name, tools::histo::p1d *p1d)
 
void AddP1Vector (const std::vector< tools::histo::p1d * > &p1Vector)
 
void AddTVector (const std::vector< tools::histo::p1d * > &tVector)
 
std::vector< tools::histo::p1d * >::const_iterator BeginConstP1 () const
 
std::vector< tools::histo::p1d * >::iterator BeginP1 ()
 
void ClearData ()
 
std::vector< tools::histo::p1d * >::const_iterator EndConstP1 () const
 
std::vector< tools::histo::p1d * >::iterator EndP1 ()
 
 G4P1ToolsManager ()=delete
 
 G4P1ToolsManager (const G4AnalysisManagerState &state)
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
tools::histo::p1d * GetP1 (G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
 
const std::vector< tools::histo::p1d * > & GetP1Vector () const
 
tools::histo::p1d * GetT (G4int id) const
 
G4bool IsEmpty () const
 
void Merge (G4Mutex &mergeMutex, G4THnManager< tools::histo::p1d > *masterInstance)
 
G4int RegisterT (tools::histo::p1d *t, const G4String &name)
 
G4bool Reset ()
 
virtual ~G4P1ToolsManager ()=default
 

Protected Member Functions

std::vector< tools::histo::p1d * >::const_iterator BeginConstT () const
 
std::vector< tools::histo::p1d * >::iterator BeginT ()
 
virtual G4int CreateP1 (const G4String &name, const G4String &title, const std::vector< G4double > &edges, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none") final
 
virtual G4int CreateP1 (const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinScheme="linear") final
 
std::vector< tools::histo::p1d * >::const_iterator EndConstT () const
 
std::vector< tools::histo::p1d * >::iterator EndT ()
 
virtual G4bool FillP1 (G4int id, G4double xvalue, G4double yvalue, G4double weight=1.0) final
 
virtual std::shared_ptr< G4HnManagerGetHnManager () final
 
virtual G4int GetP1Id (const G4String &name, G4bool warn=true) const final
 
virtual G4int GetP1Nbins (G4int id) const final
 
virtual G4String GetP1Title (G4int id) const final
 
virtual G4String GetP1XAxisTitle (G4int id) const final
 
virtual G4double GetP1Xmax (G4int id) const final
 
virtual G4double GetP1Xmin (G4int id) const final
 
virtual G4double GetP1XWidth (G4int id) const final
 
virtual G4String GetP1YAxisTitle (G4int id) const final
 
virtual G4double GetP1Ymax (G4int id) const final
 
virtual G4double GetP1Ymin (G4int id) const final
 
G4int GetTId (const G4String &name, G4bool warn=true) const
 
tools::histo::p1d * 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 ScaleP1 (G4int id, G4double factor) final
 
virtual G4bool SetP1 (G4int id, const std::vector< G4double > &edges, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none") final
 
virtual G4bool SetP1 (G4int id, G4int nbins, G4double xmin, G4double xmax, G4double ymin=0, G4double ymax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &xbinScheme="linear") final
 
virtual G4bool SetP1Title (G4int id, const G4String &title) final
 
virtual G4bool SetP1XAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetP1YAxisTitle (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::p1d * > fTVector
 

Private Member Functions

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

Static Private Attributes

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

Detailed Description

Definition at line 53 of file G4P1ToolsManager.hh.

Constructor & Destructor Documentation

◆ G4P1ToolsManager() [1/2]

G4P1ToolsManager::G4P1ToolsManager ( const G4AnalysisManagerState state)
explicit

Definition at line 46 of file G4P1ToolsManager.cc.

◆ G4P1ToolsManager() [2/2]

G4P1ToolsManager::G4P1ToolsManager ( )
delete

◆ ~G4P1ToolsManager()

virtual G4P1ToolsManager::~G4P1ToolsManager ( )
virtualdefault

Member Function Documentation

◆ AddP1()

G4int G4P1ToolsManager::AddP1 ( const G4String name,
tools::histo::p1d *  p1d 
)

Definition at line 567 of file G4P1ToolsManager.cc.

568{
569 Message(kVL4, "add", "P1", name);
570
571 // Add annotation
572 AddP1Annotation(p1d, "none", "none", "none", "none");
573 // Add information
574 AddP1Information(name, "none", "none", "none", "none", G4BinScheme::kLinear);
575
576 // Register profile
577 auto id = RegisterT(p1d, name);
578
579 Message(kVL2, "add", "P1", name);
580
581 return id;
582}
void AddP1Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme) const
G4int RegisterT(tools::histo::p1d *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 AddP1Annotation(tools::histo::p1d *p1d, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)

References anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation(), AddP1Information(), kLinear, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p1d >::RegisterT().

◆ AddP1Information()

void G4P1ToolsManager::AddP1Information ( const G4String name,
const G4String xunitName,
const G4String yunitName,
const G4String xfcnName,
const G4String yfcnName,
G4BinScheme  xbinScheme 
) const
private

Definition at line 226 of file G4P1ToolsManager.cc.

232{
233 auto hnInformation = fHnManager->AddHnInformation(name, fkDimension);
234 hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
235 hnInformation->AddDimension(yunitName, yfcnName, G4BinScheme::kLinear);
236}
static constexpr G4int fkDimension
std::shared_ptr< G4HnManager > fHnManager

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

Referenced by AddP1(), and CreateP1().

◆ AddP1Vector()

void G4P1ToolsManager::AddP1Vector ( const std::vector< tools::histo::p1d * > &  p1Vector)

Definition at line 585 of file G4P1ToolsManager.cc.

587{
588 AddTVector(p1Vector);
589}
void AddTVector(const std::vector< tools::histo::p1d * > &tVector)

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

◆ AddTVector()

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

◆ BeginConstP1()

std::vector< tools::histo::p1d * >::const_iterator G4P1ToolsManager::BeginConstP1 ( ) const
inline

Definition at line 180 of file G4P1ToolsManager.hh.

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

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

◆ BeginConstT()

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

◆ BeginP1()

std::vector< tools::histo::p1d * >::iterator G4P1ToolsManager::BeginP1 ( )
inline

Definition at line 173 of file G4P1ToolsManager.hh.

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

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

◆ BeginT()

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

◆ ClearData()

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

◆ CreateP1() [1/2]

G4int G4P1ToolsManager::CreateP1 ( const G4String name,
const G4String title,
const std::vector< G4double > &  edges,
G4double  ymin = 0,
G4double  ymax = 0,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 274 of file G4P1ToolsManager.cc.

279{
280 Message(kVL4, "create", "P1", name);
281
282 tools::histo::p1d* p1d
283 = CreateToolsP1(title, edges, ymin, ymax,
284 xunitName, yunitName, xfcnName, yfcnName);
285
286 // Add annotation
287 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
288
289 // Save P1 information
291 name, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser);
292
293 // Register profile
294 G4int id = RegisterT(p1d, name);
295
296 Message(kVL2, "create", "P1", name);
297
298 return id;
299}
int G4int
Definition: G4Types.hh:85
tools::histo::p1d * CreateToolsP1(const G4String &title, const std::vector< G4double > &edges, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)

References anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation(), AddP1Information(), anonymous_namespace{G4P1ToolsManager.cc}::CreateToolsP1(), kUser, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p1d >::RegisterT().

◆ CreateP1() [2/2]

G4int G4P1ToolsManager::CreateP1 ( const G4String name,
const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
G4double  ymin = 0,
G4double  ymax = 0,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none",
const G4String xbinScheme = "linear" 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 243 of file G4P1ToolsManager.cc.

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

References anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation(), AddP1Information(), anonymous_namespace{G4P1ToolsManager.cc}::CreateToolsP1(), fkClass, G4Analysis::GetBinScheme(), G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::p1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::p1d >::RegisterT().

◆ EndConstP1()

std::vector< tools::histo::p1d * >::const_iterator G4P1ToolsManager::EndConstP1 ( ) const
inline

Definition at line 184 of file G4P1ToolsManager.hh.

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

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

◆ EndConstT()

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

◆ EndP1()

std::vector< tools::histo::p1d * >::iterator G4P1ToolsManager::EndP1 ( )
inline

Definition at line 176 of file G4P1ToolsManager.hh.

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

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

◆ EndT()

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

◆ FillP1()

G4bool G4P1ToolsManager::FillP1 ( G4int  id,
G4double  xvalue,
G4double  yvalue,
G4double  weight = 1.0 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 377 of file G4P1ToolsManager.cc.

379{
380 auto p1d = GetTInFunction(id, "FillP1", true, false);
381 if ( ! p1d ) return false;
382
383 if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
384 //G4cout << "Skipping FillP1 for " << id << G4endl;
385 return false;
386 }
387
388 auto xInfo
389 = fHnManager->GetHnDimensionInformation(id, kX, "FillP1");
390 auto yInfo
391 = fHnManager->GetHnDimensionInformation(id, kY, "FillP1");
392
393 p1d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
394 yInfo->fFcn(yvalue/yInfo->fUnit), weight);
395
396 if ( IsVerbose(kVL4) ) {
397 Message(kVL4, "fill", "P1",
398 " id " + to_string(id) +
399 " xvalue " + to_string(xvalue) +
400 " xfcn(xvalue/xunit) " + to_string(xInfo->fFcn(xvalue/xInfo->fUnit)) +
401 " yvalue " + to_string(yvalue) +
402 " yfcn(yvalue/yunit) " + to_string(yInfo->fFcn(yvalue/yInfo->fUnit)) +
403 " weight " + to_string(weight));
404 }
405
406 return true;
407}
tools::histo::p1d * 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 G4THnManager< tools::histo::p1d >::fHnManager, G4THnManager< tools::histo::p1d >::fState, G4AnalysisManagerState::GetIsActivation(), G4THnManager< tools::histo::p1d >::GetTInFunction(), G4THnManager< tools::histo::p1d >::IsVerbose(), G4Analysis::kVL4, G4Analysis::kX, G4Analysis::kY, and G4THnManager< tools::histo::p1d >::Message().

◆ GetHnManager()

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

Implements G4VP1Manager.

Definition at line 193 of file G4P1ToolsManager.hh.

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

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

◆ GetHnVector()

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

◆ GetP1()

tools::histo::p1d * G4P1ToolsManager::GetP1 ( G4int  id,
G4bool  warn = true,
G4bool  onlyIfActive = true 
) const

Definition at line 592 of file G4P1ToolsManager.cc.

594{
595 return GetTInFunction(id, "GetP1", warn, onlyIfActive);
596}

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

◆ GetP1Id()

G4int G4P1ToolsManager::GetP1Id ( const G4String name,
G4bool  warn = true 
) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 410 of file G4P1ToolsManager.cc.

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

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

◆ GetP1Nbins()

G4int G4P1ToolsManager::GetP1Nbins ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 416 of file G4P1ToolsManager.cc.

417{
418 auto p1d = GetTInFunction(id, "GetP1Nbins");
419 if ( ! p1d ) return 0;
420
421 return GetNbins(*p1d, kX);
422}
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetP1Title()

G4String G4P1ToolsManager::GetP1Title ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 501 of file G4P1ToolsManager.cc.

502{
503 auto p1d = GetTInFunction(id, "GetP1Title");
504 if ( ! p1d ) return "";
505
506 return GetTitle(*p1d);
507}
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)

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

◆ GetP1Vector()

const std::vector< tools::histo::p1d * > & G4P1ToolsManager::GetP1Vector ( ) const
inline

◆ GetP1XAxisTitle()

G4String G4P1ToolsManager::GetP1XAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 511 of file G4P1ToolsManager.cc.

512{
513 auto p1d = GetTInFunction(id, "GetP1XAxisTitle");
514 if ( ! p1d ) return "";
515
516 return GetAxisTitle(*p1d, kX, fHnManager->GetHnType());
517}
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

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

◆ GetP1Xmax()

G4double G4P1ToolsManager::GetP1Xmax ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 436 of file G4P1ToolsManager.cc.

437{
438 auto p1d = GetTInFunction(id, "GetP1Xmax");
439 if ( ! p1d ) return 0.;
440
441 return GetMax(*p1d, kX);
442}
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetP1Xmin()

G4double G4P1ToolsManager::GetP1Xmin ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 425 of file G4P1ToolsManager.cc.

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

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

◆ GetP1XWidth()

G4double G4P1ToolsManager::GetP1XWidth ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 445 of file G4P1ToolsManager.cc.

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

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

◆ GetP1YAxisTitle()

G4String G4P1ToolsManager::GetP1YAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 520 of file G4P1ToolsManager.cc.

521{
522 auto p1d = GetTInFunction(id, "GetP1YAxisTitle");
523 if ( ! p1d ) return "";
524
525 return GetAxisTitle(*p1d, kY, fHnManager->GetHnType());
526}

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

◆ GetP1Ymax()

G4double G4P1ToolsManager::GetP1Ymax ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 465 of file G4P1ToolsManager.cc.

466{
467 auto p1d = GetTInFunction(id, "GetP1Ymax");
468 if ( ! p1d ) return 0.;
469
470 return p1d->max_v();
471}

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

◆ GetP1Ymin()

G4double G4P1ToolsManager::GetP1Ymin ( G4int  id) const
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 454 of file G4P1ToolsManager.cc.

455{
456// Returns xmin value with applied unit and profile function
457
458 auto p1d = GetTInFunction(id, "GetP1Ymin");
459 if ( ! p1d ) return 0.;
460
461 return p1d->min_v();
462}

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

◆ GetT()

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

◆ GetTId()

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

◆ GetTInFunction()

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

◆ IsEmpty()

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

◆ IsVerbose()

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

◆ Merge()

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

◆ Message()

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

◆ RegisterT()

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

◆ Reset()

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

◆ ScaleP1()

G4bool G4P1ToolsManager::ScaleP1 ( G4int  id,
G4double  factor 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 368 of file G4P1ToolsManager.cc.

369{
370 auto p1d = GetTInFunction(id, "ScaleP1", false, false);
371 if ( ! p1d ) return false;
372
373 return p1d->scale(factor);
374}

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

◆ SetP1() [1/2]

G4bool G4P1ToolsManager::SetP1 ( G4int  id,
const std::vector< G4double > &  edges,
G4double  ymin = 0,
G4double  ymax = 0,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none" 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 336 of file G4P1ToolsManager.cc.

341{
342 auto p1d = GetTInFunction(id, "SetP1", false, false);
343 if ( ! p1d ) return false;
344
345 auto info = fHnManager->GetHnInformation(id,"SetP1");
346
347 Message(kVL4, "configure", "P1", info->GetName());
348
349 // Configure tools p1
350 ConfigureToolsP1(p1d, edges, ymin, ymax,
351 xunitName, yunitName, xfcnName, yfcnName);
352
353 // Add annotation
354 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
355
356 // Update information
358 info, xunitName, yunitName, xfcnName, yfcnName, G4BinScheme::kUser);
359
360 // Set activation
361 fHnManager->SetActivation(id, true);
362
363 return true;
364}
void UpdateP1Information(G4HnInformation *hnInformation, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName, G4BinScheme xbinScheme)
void ConfigureToolsP1(tools::histo::p1d *p1d, const std::vector< G4double > &edges, G4double ymin, G4double ymax, const G4String &xunitName, const G4String &yunitName, const G4String &xfcnName, const G4String &yfcnName)

References anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation(), anonymous_namespace{G4P1ToolsManager.cc}::ConfigureToolsP1(), G4THnManager< tools::histo::p1d >::fHnManager, G4THnManager< tools::histo::p1d >::GetTInFunction(), kUser, G4Analysis::kVL4, G4THnManager< tools::histo::p1d >::Message(), and anonymous_namespace{G4P1ToolsManager.cc}::UpdateP1Information().

◆ SetP1() [2/2]

G4bool G4P1ToolsManager::SetP1 ( G4int  id,
G4int  nbins,
G4double  xmin,
G4double  xmax,
G4double  ymin = 0,
G4double  ymax = 0,
const G4String xunitName = "none",
const G4String yunitName = "none",
const G4String xfcnName = "none",
const G4String yfcnName = "none",
const G4String xbinScheme = "linear" 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 302 of file G4P1ToolsManager.cc.

308{
309 auto p1d = GetTInFunction(id, "SetP1", false, false);
310 if ( ! p1d ) return false;
311
312 auto info = fHnManager->GetHnInformation(id,"SetP1");
313
314 Message(kVL4, "configure", "P1", info->GetName());
315
316 // Configure tools p1
318 p1d, nbins, xmin, xmax, ymin, ymax,
319 xunitName, yunitName, xfcnName, yfcnName, xbinSchemeName, fkClass);
320
321 // Add annotation
322 AddP1Annotation(p1d, xunitName, yunitName, xfcnName, yfcnName);
323
324 // Update information
325 auto xbinScheme = GetBinScheme(xbinSchemeName);
327 info, xunitName, yunitName, xfcnName, yfcnName, xbinScheme);
328
329 // Set activation
330 fHnManager->SetActivation(id, true);
331
332 return true;
333}

References anonymous_namespace{G4P1ToolsManager.cc}::AddP1Annotation(), anonymous_namespace{G4P1ToolsManager.cc}::ConfigureToolsP1(), G4THnManager< tools::histo::p1d >::fHnManager, fkClass, G4Analysis::GetBinScheme(), G4THnManager< tools::histo::p1d >::GetTInFunction(), G4Analysis::kVL4, G4THnManager< tools::histo::p1d >::Message(), and anonymous_namespace{G4P1ToolsManager.cc}::UpdateP1Information().

◆ SetP1Title()

G4bool G4P1ToolsManager::SetP1Title ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 474 of file G4P1ToolsManager.cc.

475{
476 auto p1d = GetTInFunction(id, "SetP1Title");
477 if ( ! p1d ) return false;
478
479 return SetTitle(*p1d, title);
480}
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)

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

◆ SetP1XAxisTitle()

G4bool G4P1ToolsManager::SetP1XAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 483 of file G4P1ToolsManager.cc.

484{
485 auto p1d = GetTInFunction(id, "SetP1XAxisTitle");
486 if ( ! p1d ) return false;
487
488 return SetAxisTitle(*p1d, kX, title);
489}
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)

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

◆ SetP1YAxisTitle()

G4bool G4P1ToolsManager::SetP1YAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VP1Manager.

Definition at line 492 of file G4P1ToolsManager.cc.

493{
494 auto p1d = GetTInFunction(id, "SetP1YAxisTitle");
495 if ( ! p1d ) return false;
496
497 return SetAxisTitle(*p1d, kY, title);
498}

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

◆ WriteOnAscii()

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

Implements G4VP1Manager.

Definition at line 529 of file G4P1ToolsManager.cc.

530{
531// Write selected objects on ASCII file
532
533 // Do nothing if no histograms are selected
534 if ( ! fHnManager->IsAscii() ) return true;
535
536 // Write p1 histograms
537 for ( G4int i=0; i<G4int(fTVector.size()); ++i ) {
538 auto id = i + fHnManager->GetFirstId();
539 auto info = fHnManager->GetHnInformation(id,"WriteOnAscii");
540 // skip writing if activation is enabled and H1 is inactivated
541 if ( ! info->GetAscii() ) continue;
542 auto p1 = fTVector[i];
543
544 Message(kVL3, "write on ascii", "p1d", info->GetName());
545
546 output << "\n 1D profile " << id << ": " << p1->title()
547 << "\n \n \t X \t\t MeanY" << G4endl;
548
549 for (G4int j=0; j< G4int(p1->axis().bins()); ++j) {
550 auto sw = p1->bin_Sw(j);
551 auto svw = p1->bin_Svw(j);
552 auto mean = ( sw != 0. ) ? (svw / sw) : 0.;
553 output << " " << j << "\t"
554 << p1->axis().bin_center(j) << "\t"
555 << mean << G4endl;
556 }
557 }
558
559 return output.good();
560}
#define G4endl
Definition: G4ios.hh:57
constexpr G4int kVL3

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

Field Documentation

◆ fHnManager

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

Definition at line 105 of file G4THnManager.hh.

◆ fkClass

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

Definition at line 167 of file G4P1ToolsManager.hh.

Referenced by CreateP1(), and SetP1().

◆ fkDimension

constexpr G4int G4P1ToolsManager::fkDimension = 2
staticconstexprprivate

Definition at line 168 of file G4P1ToolsManager.hh.

Referenced by AddP1Information().

◆ fNameIdMap

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

Definition at line 104 of file G4THnManager.hh.

◆ fState

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

Definition at line 102 of file G4THnManager.hh.

◆ fTVector

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

Definition at line 103 of file G4THnManager.hh.


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