Crombie Tools
YieldDump.h
Go to the documentation of this file.
1 /**
2  @file YieldDump.h
3 
4  Header file for the YieldDump class.
5 
6  @author Daniel Abercrombie <dabercro@mit.edu>
7 */
8 
9 #ifndef CROMBIETOOLS_ANALYSISTOOLS_YIELDDUMP_H
10 #define CROMBIETOOLS_ANALYSISTOOLS_YIELDDUMP_H
11 
12 #include <sqlite3.h>
13 
14 #include "TCut.h"
15 
16 #include "FileConfigReader.h"
17 
18 /**
19  @class YieldDump
20  Dumps yields for analysis in R.
21 */
22 
24 {
25  public:
26  YieldDump() {}
27  virtual ~YieldDump() {}
28 
29  /// Add a region and selection cut to the list of regions to plot
30  void AddRegion (const char* region, const char* cut, const char* data_weight = "", const char* mc_weight = "")
31  { fRegionCuts.push_back(TCut(region, cut));
32  fDataWeights.push_back(TCut(data_weight));
33  fMCWeights.push_back(TCut(mc_weight)); }
34 
35  /// Clear out the regions stored
36  void ResetRegions () { fRegionCuts.clear(); fDataWeights.clear(); fMCWeights.clear(); }
37 
38  /// Dump the yields into csv files in an output directory
39  void DumpYieldFiles (const char* out_file, Int_t NumXBins, Double_t *XBins);
40 
41  /// Dump the yields into csv files in an output directory
42  void DumpYieldFiles (const char* out_file, Int_t NumXBins, Double_t MinX, Double_t MaxX);
43 
44  private:
45  std::vector<TCut> fRegionCuts; ///< A separate vector of cuts for different regions
46  std::vector<TCut> fDataWeights; ///< The data weights for each region
47  std::vector<TCut> fMCWeights; ///< The MC weights for each region
48 
49  void SimpleExecute (sqlite3* conn, const char* query); ///< Wrapper that makes and executes statement
50 
51  ClassDef(YieldDump,1)
52 };
53 
54 #endif