HistManModule Class Reference
[DataUtil]

A module to write out any histograms held in the HistMan hierarchy. More...

#include <HistManModule.h>

Inheritance diagram for HistManModule:
JobCModule

List of all members.

Public Member Functions

 HistManModule ()
 ~HistManModule ()
virtual void EndFile ()
virtual void EndJob ()
virtual const RegistryDefaultConfig () const
virtual JobCResult Put (const MomNavigator *)

Static Public Member Functions

static HistMan GetHistMan (JobCModule &mod, const char *subdir=0)

Detailed Description

A module to write out any histograms held in the HistMan hierarchy.

Configuration parameters:

"OutputFilename" sets the name of the end-of-job file to write out. Set to 0 or "" to not write out end-of-job

"FileExtension" sets the end-of-file extension to use when writing out end-of-file histograms. This is mutually exclusive with and if set, supersedes "OutputFilename". This causes one HistMan file to be written out for each input file. The output filename will be formed by using the input filename up to the first "." with the "FileExtension" added (should include an initial "." if one is desired).

There is a static method, HistMan::GetHistMan(), to get a uniquely rooted HistMan based on the UniqueName of the given JobCModule and an optional subdirectory.

One should place "HistMan::Put" in the path to get the histograms written out.

Author:
(last to touch it)
Author
bv
Version:
Revision
1.3
Date:
Date
2005/11/28 21:22:37

Contact: bv@bnl.gov

Created on: Fri Apr 15 10:40:34 2005

Id
HistManModule.h,v 1.3 2005/11/28 21:22:37 bv Exp

Definition at line 51 of file HistManModule.h.


Constructor & Destructor Documentation

HistManModule::HistManModule (  ) 

Definition at line 13 of file HistManModule.cxx.

00014 {
00015 }

HistManModule::~HistManModule (  ) 

Definition at line 17 of file HistManModule.cxx.

00018 {
00019 }


Member Function Documentation

const Registry & HistManModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 52 of file HistManModule.cxx.

References Registry::Set(), and Registry::Size().

00053 {
00054     static Registry r;
00055     if (!r.Size()) {
00056         r.Set("OutputFilename","histman.root");
00057         r.Set("FileExtension","");
00058     }
00059     return r;
00060 }

void HistManModule::EndFile (  )  [virtual]

Implement for notification of end of file. See GetLastFile().

Reimplemented from JobCModule.

Definition at line 28 of file HistManModule.cxx.

References Registry::Get(), JobCModule::GetConfig(), JobCModule::GetLastFile(), make_name(), and HistMan::WriteOut().

00029 {
00030     const char* fileext = "";
00031     this->GetConfig().Get("FileExtension",fileext);
00032     if (! (fileext && fileext[0])) return;
00033 
00034     string filename = make_name(this->GetLastFile(),fileext);
00035 
00036     HistMan hm("");
00037     hm.WriteOut(filename.c_str());
00038 }

void HistManModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 40 of file HistManModule.cxx.

References Registry::Get(), JobCModule::GetConfig(), and HistMan::WriteOut().

00041 {
00042     const char* fileext = "";
00043     this->GetConfig().Get("FileExtension",fileext);
00044     if (fileext && fileext[0]) return;
00045 
00046     const char* filename = "histman.root";
00047     this->GetConfig().Get("OutputFilename",filename);
00048     HistMan hm("");
00049     hm.WriteOut(filename);
00050 }

HistMan HistManModule::GetHistMan ( JobCModule mod,
const char *  subdir = 0 
) [static]

Definition at line 69 of file HistManModule.cxx.

References Form(), and JobCModule::GetUniqueName().

Referenced by UserAnalysis::BeginJob().

00070 {
00071     if (subdir) 
00072         return HistMan(Form("%s/%s",mod.GetUniqueName(),subdir));
00073     return HistMan(mod.GetUniqueName());
00074 }

JobCResult HistManModule::Put ( const MomNavigator mom  )  [virtual]

Implement if your module needs to write data to some external sink.

Reimplemented from JobCModule.

Definition at line 62 of file HistManModule.cxx.

References JobCResult::kAOK.

00063 {
00064     // dummy so we can get our EndJob done.
00065     return JobCResult::kAOK;
00066 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1