ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PlotParameters.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PlotParameters.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 
27 // Author: Ivana Hrivnacova, 21/10/2015 (ivana@ipno.in2p3.fr)
28 
29 #include "G4PlotParameters.hh"
30 #include "G4PlotMessenger.hh"
31 #include "G4AnalysisUtilities.hh"
32 #include "globals.hh"
33 
34 //_____________________________________________________________________________
36  : fMessenger(nullptr),
37  fDefaultColumns(1),
38  fDefaultRows (2),
39 #if defined(TOOLS_USE_FREETYPE)
40  //Have vertical A4 :
41  fDefaultWidth(2000),
42  fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
43  fDefaultStyle("ROOT_default"),
44  fDefaultScale(0.9f),
45  fMaxColumns(3),
46  fMaxRows (5),
47  fAvailableStyles("ROOT_default hippodrow inlib_default"),
48 #else
49  fDefaultWidth (700),
50  fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
51  fDefaultStyle("inlib_default"),
52  fDefaultScale(0.9f),
53  fMaxColumns(2),
54  fMaxRows (3),
55  fAvailableStyles("inlib_default"),
56 #endif
57  fColumns(fDefaultColumns),
58  fRows(fDefaultRows),
59  fWidth(fDefaultWidth),
60  fHeight(fDefaultHeight),
61  fScale(fDefaultScale),
62  fStyle(fDefaultStyle)
63 {
64  fMessenger = G4Analysis::make_unique<G4PlotMessenger>(this);
65 }
66 
67 //
68 // private methods
69 //
70 
71 //_____________________________________________________________________________
73 {
74  if ( columns > rows ||
75  columns < 1 || columns > fMaxColumns ||
76  rows < 1 || rows > fMaxRows ) {
77  G4ExceptionDescription description;
78  description
79  << "Layout: " << columns << " x " << rows << " was ignored." << G4endl
80  << "Supported layouts: " << G4endl
81  << " columns <= rows" << G4endl
82  << " columns = 1 .. " << fMaxColumns << G4endl
83  << " rows = 1 .. " << fMaxRows << G4endl;
84  G4Exception("G4PlotParameters::SetLayout",
85  "Analysis_W013", JustWarning, description);
86  return;
87  }
88  fColumns = columns;
89  fRows = rows;
90 }
91 
92 //_____________________________________________________________________________
94 {
95  fWidth = width;
96  fHeight = height;
97 }
98 
99 //_____________________________________________________________________________
101 {
102 // Set style and update scale according to the style selected
103 
104  if ( fAvailableStyles.find(style) == std::string::npos ) {
105  G4ExceptionDescription description;
106  description
107  << "Style: " << style << " was ignored." << G4endl
108  << "Supported styles: " << fAvailableStyles << G4endl;
109  G4Exception("G4PlotParameters::SetLayout",
110  "Analysis_W013", JustWarning, description);
111  return;
112  }
113 
114  fStyle = style;
115 
116  if ( fStyle == "ROOT_default" ) {
118  } else {
119  fScale = 1.f;
120  }
121 }