GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Attributes | List of all members
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 cern.ch> University of Liverpool
Created:
September 10, 2006
License:
Copyright (c) 2003-2024, 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 ( )

Definition at line 31 of file NtpMCJobEnv.cxx.

32 {
33  fEnv = 0;
34 }
NtpMCJobEnv::~NtpMCJobEnv ( )
virtual

Definition at line 36 of file NtpMCJobEnv.cxx.

37 {
38 
39 }

Member Function Documentation

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

Definition at line 34 of file NtpMCJobEnv.h.

References fEnv.

34 { return fEnv; }
TFolder * NtpMCJobEnv::TakeSnapshot ( void  )

Definition at line 41 of file NtpMCJobEnv.cxx.

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

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

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 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
#define pINFO
Definition: Messenger.h:62
#define pNOTICE
Definition: Messenger.h:61

Member Data Documentation

TFolder* genie::NtpMCJobEnv::fEnv
private

Definition at line 38 of file NtpMCJobEnv.h.

Referenced by GetFolder().


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