ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/Style/src/HistStyles.cc
Revision: 1.2
Committed: Sun Oct 3 03:51:15 2010 UTC (14 years, 7 months ago) by paus
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
State: FILE REMOVED
Log Message:
Error in cvs use.

File Contents

# User Rev Content
1 paus 1.2 // $Id: HistStyles.cc,v 1.1 2010/10/03 03:40:01 paus Exp $
2 paus 1.1
3     #include "MitAna/DataUtil/interface/Debug.h"
4     #include "MitPlots/Style/interface/HistStyles.h"
5    
6     ClassImp(mithep::HistStyles)
7    
8     using namespace std;
9     using namespace mithep;
10    
11     //--------------------------------------------------------------------------------------------------
12     HistStyles::HistStyles() :
13     fNStyles (0),
14     fDataStyle(0)
15     {
16     // Constructor
17    
18     HistStyle *s;
19     // add the default Monte Carlo styles
20     s = AddStyle();
21     s->SetColor (kBlack);
22     s->SetFillStyle (0);
23     s = AddStyle();
24     s->SetColor (kBlue);
25     s->SetFillStyle (3001);
26     s = AddStyle();
27     s->SetColor (kRed);
28     s->SetFillStyle (3004);
29     s = AddStyle();
30     s->SetColor (kGreen);
31     s->SetFillStyle (3007);
32     s = AddStyle();
33     s->SetColor (kCyan);
34     s->SetFillStyle (3010);
35     // add the default data style
36     s = SetDataStyle();
37     s->SetColor (kBlack);
38     s->SetFillStyle (0);
39     s->SetMarkerType(20);
40     s->SetMarkerSize(0.4);
41     }
42    
43     //--------------------------------------------------------------------------------------------------
44     void HistStyles::Show() const
45     {
46     // Show present list of defined samples
47    
48     printf("\n ==== Histogram Styles overview ====\n\n");
49     printf(" Dataset name Legend Histogram file");
50     printf(" Cross Section [pb]\n");
51     printf(" -------------------------------------------------------------------");
52     printf("--------------------------------------------------------------------\n");
53     fDataStyle->Show();
54     printf(" -------------------------------------------------------------------");
55     printf("--------------------------------------------------------------------\n");
56     for (UInt_t i=0; i<fStyles.size(); i++)
57     fStyles[i].Show();
58    
59     return;
60     }
61    
62     //--------------------------------------------------------------------------------------------------
63     const HistStyle *HistStyles::GetStyle(UInt_t iStyle) const
64     {
65     // Get sample corresponding to given sample number. Return NULL pointer if index out of range.
66    
67     if (iStyle >= fNStyles)
68     return 0;
69    
70     return &fStyles[iStyle];
71     }
72    
73     //--------------------------------------------------------------------------------------------------
74     const HistStyle *HistStyles::GetDataStyle() const
75     {
76     // Get data sample. Return NULL pointer if not available.
77    
78     return fDataStyle;
79     }
80    
81     //--------------------------------------------------------------------------------------------------
82     HistStyle *HistStyles::AddStyle()
83     {
84     // Adding another sample (vector takes care of memory management)
85    
86     HistStyle* tmpStyle = new HistStyle();
87     fStyles.push_back(*tmpStyle);
88     fNStyles++;
89     // cleanup after yourself
90     delete tmpStyle;
91    
92     return &fStyles[fStyles.size()-1];
93     }
94    
95     //--------------------------------------------------------------------------------------------------
96     HistStyle *HistStyles::SetDataStyle()
97     {
98     // Setting the data sample (existing definition is overwritten)
99    
100     if (fDataStyle != 0)
101     delete fDataStyle;
102    
103     fDataStyle = new HistStyle();
104    
105     return fDataStyle;
106     }