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

#include <G4H1ToolsManager.hh>

Inheritance diagram for G4H1ToolsManager:
G4VH1Manager G4THnManager< tools::histo::h1d >

Public Member Functions

G4int AddH1 (const G4String &name, tools::histo::h1d *h1d)
 
void AddH1Vector (const std::vector< tools::histo::h1d * > &h1Vector)
 
void AddTVector (const std::vector< tools::histo::h1d * > &tVector)
 
std::vector< tools::histo::h1d * >::const_iterator BeginConstH1 () const
 
std::vector< tools::histo::h1d * >::iterator BeginH1 ()
 
void ClearData ()
 
std::vector< tools::histo::h1d * >::const_iterator EndConstH1 () const
 
std::vector< tools::histo::h1d * >::iterator EndH1 ()
 
 G4H1ToolsManager ()=delete
 
 G4H1ToolsManager (const G4AnalysisManagerState &state)
 
tools::histo::h1d * GetH1 (G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
 
const std::vector< tools::histo::h1d * > & GetH1Vector () const
 
const std::vector< G4HnInformation * > & GetHnVector () const
 
tools::histo::h1d * GetT (G4int id) const
 
G4bool IsEmpty () const
 
void Merge (G4Mutex &mergeMutex, G4THnManager< tools::histo::h1d > *masterInstance)
 
G4int RegisterT (tools::histo::h1d *t, const G4String &name)
 
G4bool Reset ()
 
virtual ~G4H1ToolsManager ()=default
 

Protected Member Functions

std::vector< tools::histo::h1d * >::const_iterator BeginConstT () const
 
std::vector< tools::histo::h1d * >::iterator BeginT ()
 
virtual G4int CreateH1 (const G4String &name, const G4String &title, const std::vector< G4double > &edges, const G4String &unitName="none", const G4String &fcnName="none") final
 
virtual G4int CreateH1 (const G4String &name, const G4String &title, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binScheme="linear") final
 
std::vector< tools::histo::h1d * >::const_iterator EndConstT () const
 
std::vector< tools::histo::h1d * >::iterator EndT ()
 
virtual G4bool FillH1 (G4int id, G4double value, G4double weight=1.0) final
 
virtual G4int GetH1Id (const G4String &name, G4bool warn=true) const final
 
virtual G4int GetH1Nbins (G4int id) const final
 
virtual G4String GetH1Title (G4int id) const final
 
virtual G4double GetH1Width (G4int id) const final
 
virtual G4String GetH1XAxisTitle (G4int id) const final
 
virtual G4double GetH1Xmax (G4int id) const final
 
virtual G4double GetH1Xmin (G4int id) const final
 
virtual G4String GetH1YAxisTitle (G4int id) const final
 
virtual std::shared_ptr< G4HnManagerGetHnManager () final
 
G4int GetTId (const G4String &name, G4bool warn=true) const
 
tools::histo::h1d * 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 ScaleH1 (G4int id, G4double factor) final
 
virtual G4bool SetH1 (G4int id, const std::vector< G4double > &edges, const G4String &unitName="none", const G4String &fcnName="none") final
 
virtual G4bool SetH1 (G4int id, G4int nbins, G4double xmin, G4double xmax, const G4String &unitName="none", const G4String &fcnName="none", const G4String &binSchemeName="linear") final
 
virtual G4bool SetH1Title (G4int id, const G4String &title) final
 
virtual G4bool SetH1XAxisTitle (G4int id, const G4String &title) final
 
virtual G4bool SetH1YAxisTitle (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::h1d * > fTVector
 

Private Member Functions

void AddH1Information (const G4String &name, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme) const
 

Static Private Attributes

static constexpr std::string_view fkClass { "G4H1ToolsManager" }
 
static constexpr G4int fkDimension = 1
 

Detailed Description

Definition at line 52 of file G4H1ToolsManager.hh.

Constructor & Destructor Documentation

◆ G4H1ToolsManager() [1/2]

G4H1ToolsManager::G4H1ToolsManager ( const G4AnalysisManagerState state)
explicit

Definition at line 46 of file G4H1ToolsManager.cc.

◆ G4H1ToolsManager() [2/2]

G4H1ToolsManager::G4H1ToolsManager ( )
delete

◆ ~G4H1ToolsManager()

virtual G4H1ToolsManager::~G4H1ToolsManager ( )
virtualdefault

Member Function Documentation

◆ AddH1()

G4int G4H1ToolsManager::AddH1 ( const G4String name,
tools::histo::h1d *  h1d 
)

Definition at line 471 of file G4H1ToolsManager.cc.

472{
473 Message(kVL4, "add", "H1", name);
474
475 // Add annotation
476 AddH1Annotation(h1d, "none", "none");
477 // Add information
479
480 // Register histogram
481 auto id = RegisterT(h1d, name);
482
483 Message(kVL2, "add", "H1", name);
484
485 return id;
486}
void AddH1Information(const G4String &name, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme) const
G4int RegisterT(tools::histo::h1d *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 AddH1Annotation(tools::histo::h1d *h1d, const G4String &unitName, const G4String &fcnName)

References anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation(), AddH1Information(), kLinear, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h1d >::RegisterT().

◆ AddH1Information()

void G4H1ToolsManager::AddH1Information ( const G4String name,
const G4String unitName,
const G4String fcnName,
G4BinScheme  binScheme 
) const
private

Definition at line 176 of file G4H1ToolsManager.cc.

180{
181 auto hnInformation = fHnManager->AddHnInformation(name, fkDimension);
182 hnInformation->AddDimension(unitName, fcnName, binScheme);
183}
static constexpr G4int fkDimension
std::shared_ptr< G4HnManager > fHnManager

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

Referenced by AddH1(), and CreateH1().

◆ AddH1Vector()

void G4H1ToolsManager::AddH1Vector ( const std::vector< tools::histo::h1d * > &  h1Vector)

Definition at line 490 of file G4H1ToolsManager.cc.

492{
493 AddTVector(h1Vector);
494}
void AddTVector(const std::vector< tools::histo::h1d * > &tVector)

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

◆ AddTVector()

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

◆ BeginConstH1()

std::vector< tools::histo::h1d * >::const_iterator G4H1ToolsManager::BeginConstH1 ( ) const
inline

Definition at line 162 of file G4H1ToolsManager.hh.

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

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

◆ BeginConstT()

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

◆ BeginH1()

std::vector< tools::histo::h1d * >::iterator G4H1ToolsManager::BeginH1 ( )
inline

Definition at line 155 of file G4H1ToolsManager.hh.

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

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

◆ BeginT()

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

◆ ClearData()

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

◆ CreateH1() [1/2]

G4int G4H1ToolsManager::CreateH1 ( const G4String name,
const G4String title,
const std::vector< G4double > &  edges,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 218 of file G4H1ToolsManager.cc.

221{
222 Message(kVL4, "create", "H1", name);
223
224 auto h1d
225 = CreateToolsH1(title, edges, unitName, fcnName);
226
227 // Add annotation
228 AddH1Annotation(h1d, unitName, fcnName);
229
230 // Save H1 information
231 AddH1Information(name, unitName, fcnName, G4BinScheme::kUser);
232
233 // Register histogram
234 auto id = RegisterT(h1d, name);
235
236 Message(kVL2, "create", "H1", name);
237
238 return id;
239}
tools::histo::h1d * CreateToolsH1(const G4String &title, const std::vector< G4double > &edges, const G4String &unitName, const G4String &fcnName)

References anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation(), AddH1Information(), anonymous_namespace{G4H1ToolsManager.cc}::CreateToolsH1(), kUser, G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h1d >::RegisterT().

◆ CreateH1() [2/2]

G4int G4H1ToolsManager::CreateH1 ( const G4String name,
const G4String title,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none",
const G4String binScheme = "linear" 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 190 of file G4H1ToolsManager.cc.

194{
195 Message(kVL4, "create", "H1", name);
196
197 // Create H1
198 auto h1d
199 = CreateToolsH1(title, nbins, xmin, xmax, unitName, fcnName, binSchemeName,
200 fkClass);
201
202 // Add annotation
203 AddH1Annotation(h1d, unitName, fcnName);
204
205 // Save H1 information
206 auto binScheme = GetBinScheme(binSchemeName);
207 AddH1Information(name, unitName, fcnName, binScheme);
208
209 // Register histogram
210 auto id = RegisterT(h1d, name);
211
212 Message(kVL2, "create", "H1", name);
213
214 return id;
215}
static constexpr std::string_view fkClass
G4BinScheme GetBinScheme(const G4String &binSchemeName)
Definition: G4BinScheme.cc:36

References anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation(), AddH1Information(), anonymous_namespace{G4H1ToolsManager.cc}::CreateToolsH1(), fkClass, G4Analysis::GetBinScheme(), G4Analysis::kVL2, G4Analysis::kVL4, G4THnManager< tools::histo::h1d >::Message(), G4InuclParticleNames::name(), and G4THnManager< tools::histo::h1d >::RegisterT().

◆ EndConstH1()

std::vector< tools::histo::h1d * >::const_iterator G4H1ToolsManager::EndConstH1 ( ) const
inline

Definition at line 166 of file G4H1ToolsManager.hh.

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

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

◆ EndConstT()

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

◆ EndH1()

std::vector< tools::histo::h1d * >::iterator G4H1ToolsManager::EndH1 ( )
inline

Definition at line 158 of file G4H1ToolsManager.hh.

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

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

◆ EndT()

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

◆ FillH1()

G4bool G4H1ToolsManager::FillH1 ( G4int  id,
G4double  value,
G4double  weight = 1.0 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 310 of file G4H1ToolsManager.cc.

311{
312 auto h1d = GetTInFunction(id, "FillH1", true, false);
313 if ( ! h1d ) return false;
314
315 if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
316 //G4cout << "Skipping FillH1 for " << id << G4endl;
317 return false;
318 }
319
320 auto info
321 = fHnManager->GetHnDimensionInformation(id, kX, "FillH1");
322 h1d->fill(info->fFcn(value/info->fUnit), weight);
323
324 if ( IsVerbose(kVL4) ) {
325 Message(kVL4, "fill", "H1",
326 " id " + to_string(id) + " value " + to_string(value) +
327 " fcn(value/unit) " + to_string(info->fFcn(value/info->fUnit)) +
328 " weight " + to_string(weight));
329 }
330
331 return true;
332}
tools::histo::h1d * 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

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

◆ GetH1()

tools::histo::h1d * G4H1ToolsManager::GetH1 ( G4int  id,
G4bool  warn = true,
G4bool  onlyIfActive = true 
) const

Definition at line 497 of file G4H1ToolsManager.cc.

499{
500 return GetTInFunction(id, "GetH1", warn, onlyIfActive);
501}

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

◆ GetH1Id()

G4int G4H1ToolsManager::GetH1Id ( const G4String name,
G4bool  warn = true 
) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 335 of file G4H1ToolsManager.cc.

336{
337 return GetTId(name, warn);
338}
G4int GetTId(const G4String &name, G4bool warn=true) const

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

◆ GetH1Nbins()

G4int G4H1ToolsManager::GetH1Nbins ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 341 of file G4H1ToolsManager.cc.

342{
343 auto h1d = GetTInFunction(id, "GetH1Nbins");
344 if ( ! h1d ) return 0;
345
346 return GetNbins(*h1d, kX);
347}
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetH1Title()

G4String G4H1ToolsManager::GetH1Title ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 406 of file G4H1ToolsManager.cc.

407{
408 auto h1d = GetTInFunction(id, "GetH1Title");
409 if ( ! h1d ) return "";
410
411 return GetTitle(*h1d);
412}
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)

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

◆ GetH1Vector()

const std::vector< tools::histo::h1d * > & G4H1ToolsManager::GetH1Vector ( ) const
inline

◆ GetH1Width()

G4double G4H1ToolsManager::GetH1Width ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 370 of file G4H1ToolsManager.cc.

371{
372 auto h1d = GetTInFunction(id, "GetH1XWidth", true, false);
373 if ( ! h1d ) return 0.;
374
375 return GetWidth(*h1d, kX, fHnManager->GetHnType());
376}
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

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

◆ GetH1XAxisTitle()

G4String G4H1ToolsManager::GetH1XAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 416 of file G4H1ToolsManager.cc.

417{
418 auto h1d = GetTInFunction(id, "GetH1XAxisTitle");
419 if ( ! h1d ) return "";
420
421 return GetAxisTitle(*h1d, kX, fHnManager->GetHnType());
422}
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)

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

◆ GetH1Xmax()

G4double G4H1ToolsManager::GetH1Xmax ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 361 of file G4H1ToolsManager.cc.

362{
363 auto h1d = GetTInFunction(id, "GetH1Xmax");
364 if ( ! h1d ) return 0.;
365
366 return GetMax(*h1d, kX);
367}
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetH1Xmin()

G4double G4H1ToolsManager::GetH1Xmin ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 350 of file G4H1ToolsManager.cc.

351{
352// Returns xmin value with applied unit and histogram function
353
354 auto h1d = GetTInFunction(id, "GetH1Xmin");
355 if ( ! h1d ) return 0.;
356
357 return GetMin(*h1d, kX);
358}
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)

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

◆ GetH1YAxisTitle()

G4String G4H1ToolsManager::GetH1YAxisTitle ( G4int  id) const
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 425 of file G4H1ToolsManager.cc.

426{
427 auto h1d = GetTInFunction(id, "GetH1YAxisTitle");
428 if ( ! h1d ) return "";
429
430 return GetAxisTitle(*h1d, kY, fHnManager->GetHnType());
431}
constexpr G4int kY

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

◆ GetHnManager()

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

Implements G4VH1Manager.

Definition at line 175 of file G4H1ToolsManager.hh.

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

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

◆ GetHnVector()

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

◆ GetT()

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

◆ GetTId()

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

◆ GetTInFunction()

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

◆ IsEmpty()

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

◆ IsVerbose()

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

◆ Merge()

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

◆ Message()

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

◆ RegisterT()

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

◆ Reset()

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

◆ ScaleH1()

G4bool G4H1ToolsManager::ScaleH1 ( G4int  id,
G4double  factor 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 301 of file G4H1ToolsManager.cc.

302{
303 auto h1d = GetTInFunction(id, "ScaleH1", false, false);
304 if ( ! h1d ) return false;
305
306 return h1d->scale(factor);
307}

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

◆ SetH1() [1/2]

G4bool G4H1ToolsManager::SetH1 ( G4int  id,
const std::vector< G4double > &  edges,
const G4String unitName = "none",
const G4String fcnName = "none" 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 272 of file G4H1ToolsManager.cc.

276{
277 auto h1d = GetTInFunction(id, "SetH1", false, false);
278 if ( ! h1d ) return false;
279
280 auto info = fHnManager->GetHnInformation(id,"SetH1");
281
282 Message(kVL4, "configure", "H1", info->GetName());
283
284 // Configure tools h1
285 ConfigureToolsH1(h1d, edges, unitName, fcnName);
286
287 // Add annotation
288 AddH1Annotation(h1d, unitName, fcnName);
289
290 // Update information
291 UpdateH1Information(info, unitName, fcnName, G4BinScheme::kUser);
292
293 // Set activation
294 fHnManager->SetActivation(id, true);
295
296 return true;
297}
void UpdateH1Information(G4HnInformation *hnInformation, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
void ConfigureToolsH1(tools::histo::h1d *h1d, const std::vector< G4double > &edges, const G4String &unitName, const G4String &fcnName)

References anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation(), anonymous_namespace{G4H1ToolsManager.cc}::ConfigureToolsH1(), G4THnManager< tools::histo::h1d >::fHnManager, G4THnManager< tools::histo::h1d >::GetTInFunction(), kUser, G4Analysis::kVL4, G4THnManager< tools::histo::h1d >::Message(), and anonymous_namespace{G4H1ToolsManager.cc}::UpdateH1Information().

◆ SetH1() [2/2]

G4bool G4H1ToolsManager::SetH1 ( G4int  id,
G4int  nbins,
G4double  xmin,
G4double  xmax,
const G4String unitName = "none",
const G4String fcnName = "none",
const G4String binSchemeName = "linear" 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 242 of file G4H1ToolsManager.cc.

246{
247 auto h1d = GetTInFunction(id, "SetH1", false, false);
248 if ( ! h1d ) return false;
249
250 auto info = fHnManager->GetHnInformation(id,"SetH1");
251
252 Message(kVL4, "configure", "H1", info->GetName());
253
254 // Configure tools h1
255 ConfigureToolsH1(h1d, nbins, xmin, xmax, unitName, fcnName, binSchemeName,
256 fkClass);
257
258 // Add annotation
259 AddH1Annotation(h1d, unitName, fcnName);
260
261 // Update information
262 auto binScheme = GetBinScheme(binSchemeName);
263 UpdateH1Information(info, unitName, fcnName, binScheme);
264
265 // Set activation
266 fHnManager->SetActivation(id, true);
267
268 return true;
269}

References anonymous_namespace{G4H1ToolsManager.cc}::AddH1Annotation(), anonymous_namespace{G4H1ToolsManager.cc}::ConfigureToolsH1(), G4THnManager< tools::histo::h1d >::fHnManager, fkClass, G4Analysis::GetBinScheme(), G4THnManager< tools::histo::h1d >::GetTInFunction(), G4Analysis::kVL4, G4THnManager< tools::histo::h1d >::Message(), and anonymous_namespace{G4H1ToolsManager.cc}::UpdateH1Information().

◆ SetH1Title()

G4bool G4H1ToolsManager::SetH1Title ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 379 of file G4H1ToolsManager.cc.

380{
381 auto h1d = GetTInFunction(id, "SetH1Title");
382 if ( ! h1d ) return false;
383
384 return SetTitle(*h1d, title);
385}
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)

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

◆ SetH1XAxisTitle()

G4bool G4H1ToolsManager::SetH1XAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 388 of file G4H1ToolsManager.cc.

389{
390 auto h1d = GetTInFunction(id, "SetH1XAxisTitle");
391 if ( ! h1d ) return false;
392
393 return SetAxisTitle(*h1d, kX, title);
394}
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)

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

◆ SetH1YAxisTitle()

G4bool G4H1ToolsManager::SetH1YAxisTitle ( G4int  id,
const G4String title 
)
finalprotectedvirtual

Implements G4VH1Manager.

Definition at line 397 of file G4H1ToolsManager.cc.

398{
399 auto h1d = GetTInFunction(id, "SetH1YAxisTitle");
400 if ( ! h1d ) return false;
401
402 return SetAxisTitle(*h1d, kY, title);
403}

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

◆ WriteOnAscii()

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

Implements G4VH1Manager.

Definition at line 434 of file G4H1ToolsManager.cc.

435{
436// Write selected objects on ASCII file
437// According to the implementation by Michel Maire, originally in
438// extended examples.
439
440 // Do nothing if no histograms are selected
441 if ( ! fHnManager->IsAscii() ) return true;
442
443 // Write h1 histograms
444 for ( G4int i=0; i<G4int(fTVector.size()); ++i ) {
445 auto id = i + fHnManager->GetFirstId();
446 auto info = fHnManager->GetHnInformation(id,"WriteOnAscii");
447 // skip writing if activation is enabled and H1 is inactivated
448 if ( ! info->GetAscii() ) continue;
449 auto h1 = fTVector[i];
450
451 Message(kVL3, "write on ascii", "h1d", info->GetName());
452
453 output << "\n 1D histogram " << id << ": " << h1->title()
454 << "\n \n \t X \t\t Bin Height" << G4endl;
455
456 for (G4int j=0; j< G4int(h1->axis().bins()); ++j) {
457 output << " " << j << "\t"
458 << h1->axis().bin_center(j) << "\t"
459 << h1->bin_height(j) << G4endl;
460 }
461 }
462
463 return output.good();
464}
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
constexpr G4int kVL3

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

Field Documentation

◆ fHnManager

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

Definition at line 105 of file G4THnManager.hh.

◆ fkClass

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

Definition at line 149 of file G4H1ToolsManager.hh.

Referenced by CreateH1(), and SetH1().

◆ fkDimension

constexpr G4int G4H1ToolsManager::fkDimension = 1
staticconstexprprivate

Definition at line 150 of file G4H1ToolsManager.hh.

Referenced by AddH1Information().

◆ fNameIdMap

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

Definition at line 104 of file G4THnManager.hh.

◆ fState

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

Definition at line 102 of file G4THnManager.hh.

◆ fTVector

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

Definition at line 103 of file G4THnManager.hh.


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