Crombie Tools
HistWriter.h
Go to the documentation of this file.
1 /**
2  @file HistWriter.h
3  Header file for the HistWriter class.
4  @author Daniel Abercrombie <dabercro@mit.edu>
5 */
6 
7 #ifndef CROMBIETOOLS_SKIMMINGTOOLS_HISTWRITER_H
8 #define CROMBIETOOLS_SKIMMINGTOOLS_HISTWRITER_H
9 
10 #include <vector>
11 #include "TString.h"
12 
13 /**
14  @ingroup skimminggroup
15  @class HistWriter
16  @brief Can be created using the CrombieTools.SkimmingTools.HistWriter module.
17 
18  Class used to write a histogram into a .root file from a .txt file.
19 */
20 
22 {
23  public:
24  /// Default constructor
25  HistWriter( TString fileName = "output.root", TString histName = "corrections" );
26  virtual ~HistWriter();
27 
28  /// Writes a 2D histogram based on a configuration file. Needs the dimensions to simplify logic...
29  void Make2DHist ( TString configName, unsigned numX, unsigned numY );
30 
31  /// Writes a histogram based on a configuration file.
32  void MakeHist ( TString configName );
33 
34  /// Sets the output names and reads the configuration file at the same time.
35  void MakeHist ( TString fileName, TString histName, TString configName )
36  { SetFileName(fileName); SetHistName(histName); MakeHist(configName); }
37 
38  /// Sets the output .root file name.
39  void SetFileName ( TString fileName ) { fFileName = fileName; }
40  /// Sets the output histogram name.
41  void SetHistName ( TString histName ) { fHistName = histName; }
42 
43  private:
44  TString fFileName; ///< Output .root file name
45  TString fHistName; ///< Output histogram name
46 
47  ClassDef(HistWriter,1)
48 };
49 
50 #endif