GENIEGenerator
Loading...
Searching...
No Matches
genie::NtpMCJobEnv Class Reference

Stores a snapshot of your environment in ROOT TFolder along with the output event tree. More...

#include <NtpMCJobEnv.h>

Public Member Functions

 NtpMCJobEnv ()
virtual ~NtpMCJobEnv ()
TFolder * TakeSnapshot (void)
TFolder * GetFolder (void)

Private Attributes

TFolder * fEnv

Detailed Description

Stores a snapshot of your environment in ROOT TFolder along with the output event tree.

Author
Costas Andreopoulos <c.andreopoulos \at cern.ch> University of Liverpool
Created:\n September 10, 2006
License:\n Copyright (c) 2003-2025, The GENIE Collaboration
For the full text of the license visit http://copyright.genie-mc.org

Definition at line 26 of file NtpMCJobEnv.h.

Constructor & Destructor Documentation

◆ NtpMCJobEnv()

NtpMCJobEnv::NtpMCJobEnv ( )

Definition at line 31 of file NtpMCJobEnv.cxx.

32{
33 fEnv = 0;
34}

References fEnv.

◆ ~NtpMCJobEnv()

NtpMCJobEnv::~NtpMCJobEnv ( )
virtual

Definition at line 36 of file NtpMCJobEnv.cxx.

37{
38
39}

Member Function Documentation

◆ GetFolder()

TFolder * genie::NtpMCJobEnv::GetFolder ( void )
inline

Definition at line 34 of file NtpMCJobEnv.h.

34{ return fEnv; }

References fEnv.

◆ TakeSnapshot()

TFolder * NtpMCJobEnv::TakeSnapshot ( void )

Definition at line 41 of file NtpMCJobEnv.cxx.

42{
43 if (fEnv) delete fEnv;
44 fEnv = 0;
45
46 LOG("Ntp", pNOTICE)
47 << "Taking environment snapshot and saving it in a TFolder";
48
49 fEnv = gROOT->GetRootFolder()->AddFolder("genv","GENIE user environment");
50 gROOT->GetListOfBrowsables()->Add(fEnv,"genv");
51
52 fEnv->SetOwner(true);
53
54 vector<string> envvars;
55
56 unsigned int ivar=0;
57 while(kMCEnv[ivar]) {
58 envvars.push_back(string(kMCEnv[ivar]));
59 ivar++;
60 }
61
62 LOG("Ntp", pINFO) << "** MC Job Environment:";
63 vector<string>::iterator variter;
64 for(variter = envvars.begin(); variter != envvars.end(); ++variter) {
65
66 ostringstream entry;
67 string var = *variter;
68 string value = (gSystem->Getenv(var.c_str()) ?
69 gSystem->Getenv(var.c_str()) : "UNDEFINED");
70
71 LOG("Ntp", pINFO) << "$" << var << " ---> " << value;
72
73 entry << "envv:" << var << ";value:" << value;
74 fEnv->Add(new TObjString(entry.str().c_str()));
75 }
76 return fEnv;
77}
#define pNOTICE
Definition Messenger.h:61
#define pINFO
Definition Messenger.h:62
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
static const char * kMCEnv[]
Definition EnvSnapshot.h:24

References fEnv, genie::controls::kMCEnv, LOG, pINFO, and pNOTICE.

Referenced by genie::NtpWriter::Initialize().

Member Data Documentation

◆ fEnv

TFolder* genie::NtpMCJobEnv::fEnv
private

Definition at line 38 of file NtpMCJobEnv.h.

Referenced by GetFolder(), NtpMCJobEnv(), and TakeSnapshot().


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