Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VariableLengthPartition.hh
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 //
28 //
29 #ifndef VariableLengthPartition_h
30 #define VariableLengthPartition_h 1
31 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32 //
33 // MODULE: VariableLengthParition.hh
34 //
35 // Version: 1.0
36 // Date: 09/03/00
37 // Author: P R Truscott
38 // Organisation: DERA UK
39 // Customer: ESA/ESTEC, NOORDWIJK
40 // Contract: 12115/96/NL/JG Work Order No. 3
41 //
42 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43 //
44 // DESCRIPTION
45 // -----------
46 //
47 // This class is used to emulate the VariableLengthPartition class in LHC++
48 // Histoograms. It is used to contain an arbitrary binnng scheme. Member
49 // functions provide information on the locations of the bin-edges, and the
50 // bin within which a user-provided G4double falls.
51 //
52 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 //
54 // PUBLIC MEMBER FUNCTIONS
55 // -----------------------
56 //
57 // VariableLengthPartition (double *ep_list, size_t ep_list_len,
58 // side *ep_conv, size_t ep_conv_len)
59 // Constructor defining:
60 // 1. ep_list is a pointer to a double array defining the bin edges;
61 // 2. ep_list_len is the number of values in ep_list;
62 // 3. ep_conv the convention of data-points exactly on a bin-edge (if the
63 // datapoint is associated with the bin to the left of the bin-edge
64 // then ep_conv[i]==LEFT, otherwise ep_conv[i]==RIGHT);
65 // 4. ep_conv_len is the number of values in ep_conv_len.
66 //
67 // VariableLengthPartition ()
68 // Default constructor.
69 //
70 // ~VariableLengthPartition ()
71 // Destructor.
72 //
73 // const long get_elem_bin (double *data_point)
74 // Returns the bin number within which the value *data_point falls. If
75 // *data_point falls below the lower edge of the lowest bin, then
76 // BIN_UNDERFLOW is returned; if *data_point exceeds the upper edge of the
77 // highest bin then BIN_OVERFLOW is returned (see Histograms).
78 //
79 // double get_bin_position (size_t bin_id)
80 // Returns the lower-edge of the bin bin_id. If bin_id is equal to the
81 // number of bins, then the upper edge of the last bin is returned.
82 //
83 // size_t total_bins ()
84 // Returns the number of bins in the binning scheme.
85 //
86 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 //
88 // CHANGE HISTORY
89 // --------------
90 //
91 // 30 June 1999, P R Truscott, DERA UK
92 // Version number update 0.b.2 -> 0.b.3, but no functional change.
93 //
94 // 28 August 1999, F Lei, DERA UK
95 // Version number update 0.b.3 -> 0.b.4, but no functional change.
96 //
97 // 17 September 1999, F Lei & P R Truscott, DERA UK
98 // Version 0.b.5
99 // Now uses STL rather than RW vectors.
100 //
101 // 09 March 2000, P R Truscott, DERA UK
102 // Update 0.b.3 -> 1.0, for compliance with ISO ANSI C++.
103 //
104 // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 //
107 #include "side.hh"
108 #include "Histograms.hh"
109 #include "globals.hh"
110 #include <vector>
111 //
113 {
114  public:
116  (double *ep_list, size_t ep_list_len,
117  side *ep_conv, size_t ep_conv_len);
120  long get_elem_bin (double *data_point);
121  double get_bin_position (size_t bin_id);
122  size_t total_bins () {return nbin;}
123 
124  private:
125  size_t nbin;
126  side conv;
127  long location;
128 
129  std::vector<double> bin;
130 }
131 ;
133 #endif