Visualizer.h 1.79 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
/** @file Visualizer.h
 *  @brief Class to have a simple visualization of plots through JZCaPA. If you want to plot something, just define here a child method and use it recursively, w/o filling the code with canvases et al. 
 *
 *  @author Riccardo Longo
 *  @bug No known bugs.
 */

#ifndef VISUALIZER_H
#define VISUALIZER_H

#include "TH1.h"
#include "TStyle.h"
13
14
#include "TVector.h"
#include "TGraph.h"
15
16
17
18
19
20
21

#include <iostream>
#include <vector>

class Visualizer {

    public :
Chad Lantz's avatar
Chad Lantz committed
22
    Visualizer();
23
24
    Visualizer( std::string _style );

25
    //Styles (so far only ATLAS)
26
    TStyle* AtlasStyle();
Riccardo Longo's avatar
Riccardo Longo committed
27
    //Methods to set a given style
28
29
    void SetAtlasStyle();

Riccardo Longo's avatar
Riccardo Longo committed
30
31
32
    /** @brief allow the user to define the extension of the plots once they're printed. ".pdf" by default */
    void SetPlotExtension( std::string _extension ) { m_extension = _extension; }

33
    /** @brief make the argument true to activate the debug mode. False to deactivate it*/
Riccardo Longo's avatar
Riccardo Longo committed
34
    void   SetDebugMode   ( bool _isDebugon ) { m_debug = _isDebugon; }
35
36

    //Special plot treatments
37
38
    void   OverlayHistos  ( TH1 *h1, TH1 *h2 , TVirtualPad* pad, double _line = 0);
    void   ScatterPlot    ( std::vector< double > _v1, std::vector< double > _v2, TVirtualPad* pad);
39
40

    //Main visualization methods
Riccardo Longo's avatar
Riccardo Longo committed
41
    void   ManyPadsPlot   ( std::vector< TH1* > _first_form, std::vector< TH1* > _second_form, int _ncol, int _nrow, std::string _out_name, std::string _treatment );
42
    void   SinglePlot     ( std::vector< double > _v1, std::vector< double > _v2, std::string _out_name, std::string _treatment, double _line = 0);
43
44
45
46
47
48

    private :
    /** String identifying the style to be applied */
    std::string m_style;
    /** Debug flag */
    bool m_debug = false;
Riccardo Longo's avatar
Riccardo Longo committed
49
50
    /** String defining the extension used to print the plots */
    std::string m_extension = ".pdf";
51
52
53
};

#endif