ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/HbbAnalysis/interface/YieldStats.hh
Revision: 1.2
Committed: Thu Oct 27 09:27:10 2011 UTC (13 years, 6 months ago) by agilbert
Content type: text/plain
Branch: MAIN
CVS Tags: v01-00-00
Changes since 1.1: +30 -20 lines
Log Message:
Update YieldStats class and add TTreeStorage helper functions

File Contents

# User Rev Content
1 agilbert 1.1 #ifndef HbbAnalysis_YieldStats_hh
2     #define HbbAnalysis_YieldStats_hh
3    
4     #include <stdarg.h>
5     #include <vector>
6     #include <string>
7     #include <map>
8    
9     namespace HbbAnalysis {//namespace
10    
11    
12     class YieldStats {
13     public:
14 agilbert 1.2 YieldStats(std::string sampleName, std::string yieldName);
15 agilbert 1.1 ~YieldStats(){;}
16     YieldStats(){;}
17    
18 agilbert 1.2 //Setters
19     void SetSampleName(std::string const& sampleName);
20     void SetYieldName(std::string const& yieldName);
21     void SetStepNames(std::vector<std::string> const& stepNames);
22     void SetBinNames(std::vector<std::string> const& binNames);
23    
24     //Getters
25     std::vector<std::string> GetStepNames() const;
26     std::vector<std::string> GetBinNames() const;
27     std::string GetSampleName() const { return sampleName_; }
28     std::string GetYieldName() const { return yieldName_; }
29    
30     void IncrementCount(unsigned run, unsigned binIndex, unsigned stepIndex, double value);
31     void IncrementCount(unsigned run, std::string binName, std::string stepName, double value);
32    
33     double CalculateYield(std::string stepName) const;
34     double CalculateYield(std::string stepName, unsigned minRun, unsigned maxRun) const;
35     double CalculateYield(std::string stepName, std::vector<std::string> binNames) const;
36     double CalculateYield(std::string stepName, unsigned minRun, unsigned maxRun, std::vector<std::string> binNames) const;
37    
38     //Access Methods
39     double & at(unsigned runIndex, unsigned binIndex, unsigned stepIndex);
40     double at(unsigned runIndex, unsigned binIndex, unsigned stepIndex) const;
41    
42     void Print() const;
43 agilbert 1.1
44     private:
45 agilbert 1.2 std::string sampleName_;
46 agilbert 1.1 std::string yieldName_;
47 agilbert 1.2 std::vector<double> yieldVector_;
48 agilbert 1.1 std::vector<std::string> stepNames_;
49 agilbert 1.2 std::vector<std::string> binNames_;
50 agilbert 1.1 std::map<std::string,unsigned> stepIndexMap_;
51 agilbert 1.2 std::map<std::string,unsigned> binIndexMap_;
52 agilbert 1.1 std::map<unsigned, unsigned> runIndexMap_;
53     };
54    
55     }//namespace
56    
57     #endif //HbbAnalysis_YieldStats_hh