Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PlotParameters.cc
Go to the documentation of this file.
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 // $Id$
27 
28 // Author: Ivana Hrivnacova, 21/10/2015 (ivana@ipno.in2p3.fr)
29 
30 #include "G4PlotParameters.hh"
31 #include "G4PlotMessenger.hh"
32 #include "G4AnalysisUtilities.hh"
33 #include "globals.hh"
34 
35 //_____________________________________________________________________________
37  : fMessenger(nullptr),
38  fDefaultColumns(1),
39  fDefaultRows (2),
40 #if defined(TOOLS_USE_FREETYPE)
41  //Have vertical A4 :
42  fDefaultWidth(2000),
43  fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
44  fDefaultStyle("ROOT_default"),
45  fDefaultScale(0.9f),
46  fMaxColumns(3),
47  fMaxRows (5),
48  fAvailableStyles("ROOT_default hippodrow inlib_default"),
49 #else
50  fDefaultWidth (700),
51  fDefaultHeight((G4int)(29.7f/21.0f*fDefaultWidth)),
52  fDefaultStyle("inlib_default"),
53  fDefaultScale(0.9f),
54  fMaxColumns(2),
55  fMaxRows (3),
56  fAvailableStyles("inlib_default"),
57 #endif
58  fColumns(fDefaultColumns),
59  fRows(fDefaultRows),
60  fWidth(fDefaultWidth),
61  fHeight(fDefaultHeight),
62  fScale(fDefaultScale),
63  fStyle(fDefaultStyle)
64 {
65  fMessenger = G4Analysis::make_unique<G4PlotMessenger>(this);
66 }
67 
68 //
69 // private methods
70 //
71 
72 //_____________________________________________________________________________
74 {
75  if ( columns > rows ||
76  columns < 1 || columns > fMaxColumns ||
77  rows < 1 || rows > fMaxRows ) {
78  G4ExceptionDescription description;
79  description
80  << "Layout: " << columns << " x " << rows << " was ignored." << G4endl
81  << "Suported layouts: " << G4endl
82  << " columns <= rows" << G4endl
83  << " columns = 1 .. " << fMaxColumns << G4endl
84  << " rows = 1 .. " << fMaxRows << G4endl;
85  G4Exception("G4PlotParameters::SetLayout",
86  "Analysis_W013", JustWarning, description);
87  return;
88  }
89  fColumns = columns;
90  fRows = rows;
91 }
92 
93 //_____________________________________________________________________________
95 {
96  fWidth = width;
97  fHeight = height;
98 }
99 
100 //_____________________________________________________________________________
102 {
103 // Set style and update scale according to the style selected
104 
105  if ( fAvailableStyles.find(style) == std::string::npos ) {
106  G4ExceptionDescription description;
107  description
108  << "Style: " << style << " was ignored." << G4endl
109  << "Supported styles: " << fAvailableStyles << G4endl;
110  G4Exception("G4PlotParameters::SetLayout",
111  "Analysis_W013", JustWarning, description);
112  return;
113  }
114 
115  fStyle = style;
116 
117  if ( fStyle == "ROOT_default" ) {
118  fScale = fDefaultScale;
119  } else {
120  fScale = 1.f;
121  }
122 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
if(nIso!=0)
#define width
int G4int
Definition: G4Types.hh:78
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void SetLayout(G4int columns, G4int rows)
void SetDimensions(G4int width, G4int height)
#define G4endl
Definition: G4ios.hh:61
void SetStyle(const G4String &style)