pixie16 / pixie_scan

Software to scan Pixie16 Data from LDFs into DAMM histograms
https://pixie16.github.io/pixie_scan
GNU General Public License v3.0
7 stars 9 forks source link

Repetition of wrapper methods #19

Open spaulaus opened 8 years ago

spaulaus commented 8 years ago

Trace, EventProcessor and DetectorDriver all have wrapper methods for the plotting commands. In all cases the code is identical.

virtual void plot(int dammId, double val1, double val2 = -1,
                  double val3 = -1, const char* name="h") const {
    histo.Plot(dammId, val1, val2, val3, name);
}
virtual void DeclareHistogram1D(int dammId, int xSize, const char* title) {
    histo.DeclareHistogram1D(dammId, xSize, title);
}
virtual void DeclareHistogram2D(int dammId, int xSize, int ySize,
                                const char* title) {
    histo.DeclareHistogram2D(dammId, xSize, ySize, title);
}

I propose we clean this up by making the Plots class a singleton, which prevents us from making 3 copies of this class with exactly the same name. I have not yet figured out how to define the wrapper functions in a clean way. We could possibly define it in the Globals header in a "plotting" namespace?