Geant4  10.02
G4P2ToolsManager.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, 24/07/2014 (ivana@ipno.in2p3.fr)
29 
30 #include "G4P2ToolsManager.hh"
32 #include "G4BaseHistoUtilities.hh"
33 #include "G4AnalysisUtilities.hh"
34 
35 #include "tools/histo/p2d"
36 
37 #include <fstream>
38 
39 using namespace G4Analysis;
40 
41 // static definitions
43 
44 //_____________________________________________________________________________
46  : G4VP2Manager(),
47  G4THnManager<tools::histo::p2d>(state, "P2")
48 {}
49 
50 //_____________________________________________________________________________
52 {}
53 
54 //
55 // Utility functions
56 //
57 
58 namespace {
59 
60 //_____________________________________________________________________________
61 void UpdateP2Information(G4HnInformation* hnInformation,
62  const G4String& xunitName,
63  const G4String& yunitName,
64  const G4String& zunitName,
65  const G4String& xfcnName,
66  const G4String& yfcnName,
67  const G4String& zfcnName,
68  G4BinScheme xbinScheme,
69  G4BinScheme ybinScheme)
70 {
71  hnInformation->SetDimension(kX, xunitName, xfcnName, xbinScheme);
72  hnInformation->SetDimension(kY, yunitName, yfcnName, ybinScheme);
73  hnInformation->SetDimension(kZ, zunitName, zfcnName, G4BinScheme::kLinear);
74 }
75 
76 //_____________________________________________________________________________
77 void AddP2Annotation(tools::histo::p2d* p2d,
78  const G4String& xunitName,
79  const G4String& yunitName,
80  const G4String& zunitName,
81  const G4String& xfcnName,
82  const G4String& yfcnName,
83  const G4String& zfcnName)
84 {
85  G4String xaxisTitle;
86  G4String yaxisTitle;
87  G4String zaxisTitle;
88  UpdateTitle(xaxisTitle, xunitName, xfcnName);
89  UpdateTitle(yaxisTitle, yunitName, yfcnName);
90  UpdateTitle(zaxisTitle, zunitName, zfcnName);
91  p2d->add_annotation(tools::histo::key_axis_x_title(), xaxisTitle);
92  p2d->add_annotation(tools::histo::key_axis_y_title(), yaxisTitle);
93  p2d->add_annotation(tools::histo::key_axis_z_title(), zaxisTitle);
94 }
95 
96 //_____________________________________________________________________________
97 tools::histo::p2d* CreateToolsP2(
98  const G4String& title,
99  G4int nxbins, G4double xmin, G4double xmax,
100  G4int nybins, G4double ymin, G4double ymax,
101  G4double zmin, G4double zmax,
102  const G4String& xunitName,
103  const G4String& yunitName,
104  const G4String& zunitName,
105  const G4String& xfcnName,
106  const G4String& zfcnName,
107  const G4String& yfcnName,
108  const G4String& xbinSchemeName,
109  const G4String& ybinSchemeName)
110 {
111  auto xunit = GetUnitValue(xunitName);
112  auto yunit = GetUnitValue(yunitName);
113  auto zunit = GetUnitValue(zunitName);
114  auto xfcn = GetFunction(xfcnName);
115  auto yfcn = GetFunction(yfcnName);
116  auto zfcn = GetFunction(zfcnName);
117  auto xbinScheme = GetBinScheme(xbinSchemeName);
118  auto ybinScheme = GetBinScheme(ybinSchemeName);
119 
120  if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
121  if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser ) {
122  // This should never happen, but let's make sure about it
123  // by issuing a warning
124  G4ExceptionDescription description;
125  description
126  << " User binning scheme setting was ignored." << G4endl
127  << " Linear binning will be applied with given (nbins, xmin, xmax) values";
128  G4Exception("G4P2ToolsManager::CreateP2",
129  "Analysis_W013", JustWarning, description);
130  }
131  return new tools::histo::p2d(title,
132  nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
133  nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
134  zfcn(zmin/zunit), zfcn(zmax/zunit));
135  // p2 objects are deleted in destructor and reset when
136  // closing a file.
137  }
138  else {
139  // Compute edges
140  std::vector<G4double> xedges;
141  ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
142  std::vector<G4double> yedges;
143  ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
144  return new tools::histo::p2d(title, xedges, yedges,
145  zfcn(zmin/zunit), zfcn(zmax/zunit));
146  }
147 }
148 
149 //_____________________________________________________________________________
150 tools::histo::p2d* CreateToolsP2(
151  const G4String& title,
152  const std::vector<G4double>& xedges,
153  const std::vector<G4double>& yedges,
154  G4double zmin, G4double zmax,
155  const G4String& xunitName,
156  const G4String& yunitName,
157  const G4String& zunitName,
158  const G4String& xfcnName,
159  const G4String& yfcnName,
160  const G4String& zfcnName)
161 {
162  auto xunit = GetUnitValue(xunitName);
163  auto yunit = GetUnitValue(yunitName);
164  auto zunit = GetUnitValue(zunitName);
165  auto xfcn = GetFunction(xfcnName);
166  auto yfcn = GetFunction(yfcnName);
167  auto zfcn = GetFunction(zfcnName);
168 
169  // Apply function
170  std::vector<G4double> xnewEdges;
171  ComputeEdges(xedges, xunit, xfcn, xnewEdges);
172  std::vector<G4double> ynewEdges;
173  ComputeEdges(yedges, yunit, yfcn, ynewEdges);
174 
175  return new tools::histo::p2d(title, xnewEdges, ynewEdges,
176  zfcn(zmin/zunit), zfcn(zmax/zunit));
177  // p2 objects are deleted in destructor and reset when
178  // closing a file.
179 }
180 
181 //_____________________________________________________________________________
182 void ConfigureToolsP2(tools::histo::p2d* p2d,
183  G4int nxbins, G4double xmin, G4double xmax,
184  G4int nybins, G4double ymin, G4double ymax,
185  G4double zmin, G4double zmax,
186  const G4String& xunitName,
187  const G4String& yunitName,
188  const G4String& zunitName,
189  const G4String& xfcnName,
190  const G4String& yfcnName,
191  const G4String& zfcnName,
192  const G4String& xbinSchemeName,
193  const G4String& ybinSchemeName)
194 {
195  auto xunit = GetUnitValue(xunitName);
196  auto yunit = GetUnitValue(yunitName);
197  auto zunit = GetUnitValue(zunitName);
198  auto xfcn = GetFunction(xfcnName);
199  auto yfcn = GetFunction(yfcnName);
200  auto zfcn = GetFunction(zfcnName);
201  auto xbinScheme = GetBinScheme(xbinSchemeName);
202  auto ybinScheme = GetBinScheme(ybinSchemeName);
203 
204  if ( xbinScheme != G4BinScheme::kLog && ybinScheme != G4BinScheme::kLog) {
205  if ( xbinScheme == G4BinScheme::kUser || ybinScheme == G4BinScheme::kUser) {
206  // This should never happen, but let's make sure about it
207  // by issuing a warning
208  G4ExceptionDescription description;
209  description
210  << " User binning scheme setting was ignored." << G4endl
211  << " Linear binning will be applied with given (nbins, xmin, xmax) values";
212  G4Exception("G4P2ToolsManager::CreateP2",
213  "Analysis_W013", JustWarning, description);
214  }
215  p2d->configure(nxbins, xfcn(xmin/xunit), xfcn(xmax/xunit),
216  nybins, yfcn(ymin/yunit), yfcn(ymax/yunit),
217  zfcn(zmin/zunit), zfcn(zmax/zunit));
218  }
219  else {
220  // Compute bins
221  std::vector<G4double> xedges;
222  ComputeEdges(nxbins, xmin, xmax, xunit, xfcn, xbinScheme, xedges);
223  std::vector<G4double> yedges;
224  ComputeEdges(nybins, ymin, ymax, yunit, yfcn, ybinScheme, yedges);
225  p2d->configure(xedges, yedges, zfcn(zmin/zunit), zfcn(zmax/zunit));
226  }
227 }
228 
229 //_____________________________________________________________________________
230 void ConfigureToolsP2(tools::histo::p2d* p2d,
231  const std::vector<G4double>& xedges,
232  const std::vector<G4double>& yedges,
233  G4double zmin, G4double zmax,
234  const G4String& xunitName,
235  const G4String& yunitName,
236  const G4String& zunitName,
237  const G4String& xfcnName,
238  const G4String& yfcnName,
239  const G4String& zfcnName)
240 {
241  // Apply function to edges
242  auto xunit = GetUnitValue(xunitName);
243  auto xfcn = GetFunction(xfcnName);
244  std::vector<G4double> xnewEdges;
245  ComputeEdges(xedges, xunit, xfcn, xnewEdges);
246 
247  auto yunit = GetUnitValue(yunitName);
248  auto yfcn = GetFunction(yfcnName);
249  std::vector<G4double> ynewEdges;
250  ComputeEdges(yedges, yunit, yfcn, ynewEdges);
251 
252  auto zunit = GetUnitValue(zunitName);
253  auto zfcn = GetFunction(zfcnName);
254  p2d->configure(xnewEdges, ynewEdges, zfcn(zmin/zunit), zfcn(zmax/zunit));
255 }
256 
257 }
258 
259 
260 //
261 // private methods
262 //
263 
264 //_____________________________________________________________________________
266  const G4String& xunitName,
267  const G4String& yunitName,
268  const G4String& zunitName,
269  const G4String& xfcnName,
270  const G4String& yfcnName,
271  const G4String& zfcnName,
272  G4BinScheme xbinScheme,
273  G4BinScheme ybinScheme) const
274 {
275  auto hnInformation = fHnManager->AddHnInformation(name, 3);
276  hnInformation->AddDimension(xunitName, xfcnName, xbinScheme);
277  hnInformation->AddDimension(yunitName, yfcnName, ybinScheme);
278  hnInformation->AddDimension(zunitName, zfcnName, G4BinScheme::kLinear);
279 }
280 
281 //
282 // protected methods
283 //
284 
285 //_____________________________________________________________________________
287  G4int nxbins, G4double xmin, G4double xmax,
288  G4int nybins, G4double ymin, G4double ymax,
289  G4double zmin, G4double zmax,
290  const G4String& xunitName, const G4String& yunitName,
291  const G4String& zunitName,
292  const G4String& xfcnName, const G4String& yfcnName,
293  const G4String& zfcnName,
294  const G4String& xbinSchemeName,
295  const G4String& ybinSchemeName)
296 
297 {
298 #ifdef G4VERBOSE
299  if ( fState.GetVerboseL4() )
300  fState.GetVerboseL4()->Message("create", "P2", name);
301 #endif
302  tools::histo::p2d* p2d
303  = CreateToolsP2(title,
304  nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
305  xunitName, yunitName, zunitName,
306  xfcnName, yfcnName, zfcnName,
307  xbinSchemeName, ybinSchemeName);
308 
309  // Add annotation
310  AddP2Annotation(p2d, xunitName, yunitName, zunitName,
311  xfcnName, yfcnName, zfcnName);
312 
313  // Save P2 information
314  auto xbinScheme = GetBinScheme(xbinSchemeName);
315  auto ybinScheme = GetBinScheme(ybinSchemeName);
317  name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
318  xbinScheme, ybinScheme);
319 
320  // Register profile
321  G4int id = RegisterT(p2d, name);
322 
323 #ifdef G4VERBOSE
324  if ( fState.GetVerboseL2() )
325  fState.GetVerboseL2()->Message("create", "P2", name);
326 #endif
327 
328  return id;
329 }
330 
331 //_____________________________________________________________________________
333  const std::vector<G4double>& xedges,
334  const std::vector<G4double>& yedges,
335  G4double zmin, G4double zmax,
336  const G4String& xunitName, const G4String& yunitName,
337  const G4String& zunitName,
338  const G4String& xfcnName, const G4String& yfcnName,
339  const G4String& zfcnName)
340 
341 {
342 #ifdef G4VERBOSE
343  if ( fState.GetVerboseL4() )
344  fState.GetVerboseL4()->Message("create", "P2", name);
345 #endif
346  tools::histo::p2d* p2d
347  = CreateToolsP2(title, xedges, yedges, zmin, zmax,
348  xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
349 
350  // Add annotation
351  AddP2Annotation(
352  p2d, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
353 
354  // Save P2 information
356  name, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
358 
359  // Register profile
360  G4int id = RegisterT(p2d, name);
361 
362 #ifdef G4VERBOSE
363  if ( fState.GetVerboseL2() )
364  fState.GetVerboseL2()->Message("create", "P2", name);
365 #endif
366 
367  return id;
368 }
369 
370 //_____________________________________________________________________________
372  G4int nxbins, G4double xmin, G4double xmax,
373  G4int nybins, G4double ymin, G4double ymax,
374  G4double zmin, G4double zmax,
375  const G4String& xunitName, const G4String& yunitName,
376  const G4String& zunitName,
377  const G4String& xfcnName, const G4String& yfcnName,
378  const G4String& zfcnName,
379  const G4String& xbinSchemeName,
380  const G4String& ybinSchemeName)
381 {
382  auto p2d = GetTInFunction(id, "SetP2", false, false);
383  if ( ! p2d ) return false;
384 
385  auto info = fHnManager->GetHnInformation(id, "SetP2");
386 #ifdef G4VERBOSE
387  if ( fState.GetVerboseL4() )
388  fState.GetVerboseL4()->Message("configure", "P2", info->GetName());
389 #endif
390 
391  // Configure tools p2
392  ConfigureToolsP2(
393  p2d, nxbins, xmin, xmax, nybins, ymin, ymax, zmin, zmax,
394  xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
395  xbinSchemeName, ybinSchemeName);
396 
397  // Add annotation
398  AddP2Annotation(p2d, xunitName, yunitName, zunitName,
399  xfcnName, yfcnName, zfcnName);
400 
401  // Update information
402  auto xbinScheme = GetBinScheme(xbinSchemeName);
403  auto ybinScheme = GetBinScheme(ybinSchemeName);
404  UpdateP2Information(
405  info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
406  xbinScheme, ybinScheme);
407 
408  // Set activation
409  fHnManager->SetActivation(id, true);
410 
411  return true;
412 }
413 
414 //_____________________________________________________________________________
416  const std::vector<G4double>& xedges,
417  const std::vector<G4double>& yedges,
418  G4double zmin, G4double zmax,
419  const G4String& xunitName, const G4String& yunitName,
420  const G4String& zunitName,
421  const G4String& xfcnName, const G4String& yfcnName,
422  const G4String& zfcnName)
423 {
424  auto p2d = GetTInFunction(id, "SetP2", false, false);
425  if ( ! p2d ) return false;
426 
427  auto info = fHnManager->GetHnInformation(id, "SetP2");
428 #ifdef G4VERBOSE
429  if ( fState.GetVerboseL4() )
430  fState.GetVerboseL4()->Message("configure", "P2", info->GetName());
431 #endif
432 
433  // Configure tools p2
434  ConfigureToolsP2(p2d, xedges, yedges, zmin, zmax,
435  xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName);
436 
437  // Add annotation
438  AddP2Annotation(p2d, xunitName, yunitName, zunitName,
439  xfcnName, yfcnName, zfcnName);
440 
441  // Update information
442  UpdateP2Information(
443  info, xunitName, yunitName, zunitName, xfcnName, yfcnName, zfcnName,
445 
446  // Set activation
447  fHnManager->SetActivation(id, true);
448 
449  return true;
450 }
451 
452 //_____________________________________________________________________________
454 {
455  auto p2d = GetTInFunction(id, "ScaleP2", false, false);
456  if ( ! p2d ) return false;
457 
458  return p2d->scale(factor);
459 }
460 
461 //_____________________________________________________________________________
463  G4double xvalue, G4double yvalue, G4double zvalue,
464  G4double weight)
465 {
466  auto p2d = GetTInFunction(id, "FillP2", true, false);
467  if ( ! p2d ) return false;
468 
469  if ( fState.GetIsActivation() && ( ! fHnManager->GetActivation(id) ) ) {
470  return false;
471  }
472 
473  auto xInfo
474  = fHnManager->GetHnDimensionInformation(id, kX, "FillP2");
475  auto yInfo
476  = fHnManager->GetHnDimensionInformation(id, kY, "FillP2");
477  auto zInfo
478  = fHnManager->GetHnDimensionInformation(id, kZ, "FillP2");
479 
480  p2d->fill(xInfo->fFcn(xvalue/xInfo->fUnit),
481  yInfo->fFcn(yvalue/yInfo->fUnit),
482  zInfo->fFcn(zvalue/zInfo->fUnit), weight);
483 #ifdef G4VERBOSE
484  if ( fState.GetVerboseL4() ) {
485  G4ExceptionDescription description;
486  //description << " id " << id
487  // << " xvalue " << xvalue << " yvalue " << yvalue << " zvalue " << zvalue;
488  description << " id " << id
489  << " xvalue " << xvalue
490  << " xfcn(xvalue/xunit) " << xInfo->fFcn(xvalue/xInfo->fUnit)
491  << " yvalue " << yvalue
492  << " yfcn(yvalue/yunit) " << yInfo->fFcn(yvalue/yInfo->fUnit)
493  << " zvalue " << zvalue
494  << " zfcn(zvalue/zunit) " << zInfo->fFcn(zvalue/zInfo->fUnit)
495  << " weight " << weight;
496  fState.GetVerboseL4()->Message("fill", "P2", description);
497  }
498 #endif
499  return true;
500 }
501 
502 //_____________________________________________________________________________
504 {
505  return GetTId(name, warn);
506 }
507 
508 //_____________________________________________________________________________
510 {
511  auto p2d = GetTInFunction(id, "GetP2NXbins");
512  if ( ! p2d ) return 0;
513 
514  return GetNbins(*p2d, kX);
515 }
516 
517 //_____________________________________________________________________________
519 {
520 // Returns xmin value with applied unit and profile function
521 
522  auto p2d = GetTInFunction(id, "GetP2Xmin");
523  if ( ! p2d ) return 0;
524 
525  return GetMin(*p2d, kX);
526 }
527 
528 //_____________________________________________________________________________
530 {
531  auto p2d = GetTInFunction(id, "GetP2Xmax");
532  if ( ! p2d ) return 0;
533 
534  return GetMax(*p2d, kX);
535 }
536 
537 //_____________________________________________________________________________
539 {
540  auto p2d = GetTInFunction(id, "GetP2XWidth", true, false);
541  if ( ! p2d ) return 0;
542 
543  return GetWidth(*p2d, kX, fHnManager->GetHnType());
544 }
545 
546 //_____________________________________________________________________________
548 {
549  auto p2d = GetTInFunction(id, "GetP2NYbins");
550  if ( ! p2d ) return 0;
551 
552  return GetNbins(*p2d, kY);
553 }
554 
555 //_____________________________________________________________________________
557 {
558 // Returns xmin value with applied unit and profile function
559 
560  auto p2d = GetTInFunction(id, "GetP2Ymin");
561  if ( ! p2d ) return 0;
562 
563  return GetMin(*p2d, kY);
564 }
565 
566 //_____________________________________________________________________________
568 {
569  auto p2d = GetTInFunction(id, "GetP2Ymax");
570  if ( ! p2d ) return 0;
571 
572  return GetMax(*p2d, kY);
573 }
574 
575 //_____________________________________________________________________________
577 {
578  auto p2d = GetTInFunction(id, "GetP2YWidth", true, false);
579  if ( ! p2d ) return 0;
580 
581  return GetWidth(*p2d, kY, fHnManager->GetHnType());
582 }
583 
584 //_____________________________________________________________________________
586 {
587 // Returns xmin value with applied unit and profile function
588 
589  auto p2d = GetTInFunction(id, "GetP2Zmin");
590  if ( ! p2d ) return 0;
591 
592  return GetMin(*p2d, kZ);
593 }
594 
595 //_____________________________________________________________________________
597 {
598  auto p2d = GetTInFunction(id, "GetP2Zmax");
599  if ( ! p2d ) return 0;
600 
601  return GetMax(*p2d, kZ);
602 }
603 
604 //_____________________________________________________________________________
606 {
607  auto p2d = GetTInFunction(id, "SetP2Title");
608  if ( ! p2d ) return false;
609 
610  return SetTitle(*p2d, title);
611 }
612 
613 //_____________________________________________________________________________
615 {
616  auto p2d = GetTInFunction(id, "SetP2XAxisTitle");
617  if ( ! p2d ) return false;
618 
619  return SetAxisTitle(*p2d, kX, title);
620 }
621 
622 //_____________________________________________________________________________
624 {
625  auto p2d = GetTInFunction(id, "SetP2YAxisTitle");
626  if ( ! p2d ) return false;
627 
628  return SetAxisTitle(*p2d, kY, title);
629 }
630 
631 //_____________________________________________________________________________
633 {
634  auto p2d = GetTInFunction(id, "SetP2ZAxisTitle");
635  if ( ! p2d ) return false;
636 
637  return SetAxisTitle(*p2d, kZ, title);
638 }
639 
640 //_____________________________________________________________________________
642 {
643  auto p2d = GetTInFunction(id, "GetP2Title");
644  if ( ! p2d ) return "";
645 
646  return GetTitle(*p2d);
647 }
648 
649 //_____________________________________________________________________________
651 {
652  auto p2d = GetTInFunction(id, "GetP2XAxisTitle");
653  if ( ! p2d ) return "";
654 
655  return GetAxisTitle(*p2d, kX, fHnManager->GetHnType());
656 }
657 
658 //_____________________________________________________________________________
660 {
661  auto p2d = GetTInFunction(id, "GetP2YAxisTitle");
662  if ( ! p2d ) return "";
663 
664  return GetAxisTitle(*p2d, kY, fHnManager->GetHnType());
665 }
666 
667 //_____________________________________________________________________________
669 {
670  auto p2d = GetTInFunction(id, "GetP2ZAxisTitle");
671  if ( ! p2d ) return "";
672 
673  return GetAxisTitle(*p2d, kZ, fHnManager->GetHnType());
674 }
675 
676 //_____________________________________________________________________________
677 G4bool G4P2ToolsManager::WriteOnAscii(std::ofstream& /*output*/)
678 {
679 // Write selected objects on ASCII file
680 // According to the implementation by Michel Maire, originally in
681 // extended examples.
682 // Not yet available for P2
683 
684  return ! fHnManager->IsAscii();
685 }
686 
687 //
688 // public methods
689 //
690 
691 //_____________________________________________________________________________
692 G4int G4P2ToolsManager::AddP2(const G4String& name, tools::histo::p2d* p2d)
693 {
694 #ifdef G4VERBOSE
695  if ( fState.GetVerboseL4() )
696  fState.GetVerboseL4()->Message("add", "P2", name);
697 #endif
698 
699  // Add annotation
700  AddP2Annotation(p2d, "none", "none", "none", "none", "none", "none");
701  // Add information
702  AddP2Information(name, "none", "none", "none", "none", "none", "none",
704 
705  // Register profile
706  G4int id = RegisterT(p2d, name);
707 
708 #ifdef G4VERBOSE
709  if ( fState.GetVerboseL2() )
710  fState.GetVerboseL2()->Message("add", "P2", name);
711 #endif
712  return id;
713 }
714 
715 //_____________________________________________________________________________
717  const std::vector<tools::histo::p2d*>& p2Vector)
718 {
719  AddTVector(p2Vector);
720 }
721 
722 //_____________________________________________________________________________
723 tools::histo::p2d* G4P2ToolsManager::GetP2(G4int id, G4bool warn,
724  G4bool onlyIfActive) const
725 {
726  return GetTInFunction(id, "GetP2", warn, onlyIfActive);
727 }
728 
G4double GetWidth(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
virtual G4bool ScaleP2(G4int id, G4double factor) final
virtual G4bool SetP2YAxisTitle(G4int id, const G4String &title) final
void Message(const G4String &action, const G4String &object, const G4String &objectName, G4bool success=true) const
virtual G4String GetP2YAxisTitle(G4int id) const final
virtual G4double GetP2Ymax(G4int id) const final
G4String GetTitle(const G4ToolsBaseHisto &baseHisto)
const G4int kZ
virtual G4double GetP2Ymin(G4int id) const final
G4String GetAxisTitle(const G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &hnType)
G4double GetMin(const G4ToolsBaseHisto &baseHisto, G4int dimension)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void ComputeEdges(G4int nbins, G4double xmin, G4double xmax, G4double unit, G4Fcn fcn, G4BinScheme, std::vector< G4double > &edges)
Definition: G4BinScheme.cc:56
virtual G4double GetP2Xmin(G4int id) const final
virtual G4bool SetP2(G4int id, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinScheme="linear", const G4String &ybinScheme="linear") final
G4String name
Definition: TRTMaterials.hh:40
virtual G4bool WriteOnAscii(std::ofstream &output) final
virtual G4int GetP2Nxbins(G4int id) const final
G4bool SetAxisTitle(G4ToolsBaseHisto &baseHisto, G4int dimension, const G4String &title)
virtual G4bool SetP2XAxisTitle(G4int id, const G4String &title) final
int G4int
Definition: G4Types.hh:78
std::shared_ptr< G4HnManager > fHnManager
Definition: G4THnManager.hh:83
G4int AddP2(const G4String &name, tools::histo::p2d *p2d)
G4int RegisterT(tools::histo::p2d *t, const G4String &name)
const G4AnalysisVerbose * GetVerboseL2() const
virtual G4int GetP2Nybins(G4int id) const final
void UpdateTitle(G4String &title, const G4String &unitName, const G4String &fcnName)
void AddP2Vector(const std::vector< tools::histo::p2d * > &p2Vector)
const G4AnalysisManagerState & fState
Definition: G4THnManager.hh:80
virtual G4double GetP2Zmin(G4int id) const final
static const G4int kDimension
virtual G4double GetP2XWidth(G4int id) const final
G4int GetTId(const G4String &name, G4bool warn=true) const
tools::histo::p2d * GetP2(G4int id, G4bool warn=true, G4bool onlyIfActive=true) const
virtual G4double GetP2Zmax(G4int id) const final
const G4AnalysisVerbose * GetVerboseL4() const
virtual G4bool SetP2Title(G4int id, const G4String &title) final
bool G4bool
Definition: G4Types.hh:79
const G4int kX
virtual G4double GetP2YWidth(G4int id) const final
virtual ~G4P2ToolsManager()
tools::histo::p2d * GetTInFunction(G4int id, G4String functionName, G4bool warn=true, G4bool onlyIfActive=true) const
void AddP2Information(const G4String &name, const G4String &xunitName, const G4String &yunitName, const G4String &zunitName, const G4String &xfcnName, const G4String &yfcnName, const G4String &zfcnName, G4BinScheme xbinScheme, G4BinScheme ybinScheme) const
G4double GetUnitValue(const G4String &unit)
G4bool SetTitle(G4ToolsBaseHisto &baseHisto, const G4String &title)
G4P2ToolsManager(const G4AnalysisManagerState &state)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
virtual G4String GetP2ZAxisTitle(G4int id) const final
static const G4double factor
virtual G4String GetP2Title(G4int id) const final
G4Fcn GetFunction(const G4String &fcnName)
Definition: G4Fcn.cc:36
void AddTVector(const std::vector< tools::histo::p2d * > &tVector)
virtual G4double GetP2Xmax(G4int id) const final
G4BinScheme GetBinScheme(const G4String &binSchemeName)
Definition: G4BinScheme.cc:36
virtual G4int CreateP2(const G4String &name, const G4String &title, G4int nxbins, G4double xmin, G4double xmax, G4int nybins, G4double ymin, G4double ymax, G4double zmin=0, G4double zmax=0, const G4String &xunitName="none", const G4String &yunitName="none", const G4String &zunitName="none", const G4String &xfcnName="none", const G4String &yfcnName="none", const G4String &zfcnName="none", const G4String &xbinScheme="linear", const G4String &ybinScheme="linear") final
#define G4endl
Definition: G4ios.hh:61
G4double GetMax(const G4ToolsBaseHisto &baseHisto, G4int dimension)
G4BinScheme
Definition: G4BinScheme.hh:40
virtual G4String GetP2XAxisTitle(G4int id) const final
virtual G4bool SetP2ZAxisTitle(G4int id, const G4String &title) final
virtual G4int GetP2Id(const G4String &name, G4bool warn=true) const final
G4int GetNbins(const G4ToolsBaseHisto &baseHisto, G4int dimension)
double G4double
Definition: G4Types.hh:76
void AddDimension(const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)
const G4int kY
virtual G4bool FillP2(G4int id, G4double xvalue, G4double yvalue, G4double zvalue, G4double weight=1.0) final
void SetDimension(G4int dimension, const G4String &unitName, const G4String &fcnName, G4BinScheme binScheme)