GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
DataHandling.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef ADF_DataHandling
24 #include "DataHandling.h"
25 #endif
26 #include <time.h>
27 #include <math.h>
28 
29 const char *ADF::NamedItemTypeOf(Bool_t)
30  { return kBool_t; }
31 const char *ADF::NamedItemTypeOf(UShort_t)
32  { return kUShort_t; }
33 const char *ADF::NamedItemTypeOf(Short_t)
34  { return kShort_t; }
35 const char *ADF::NamedItemTypeOf(UInt_t)
36  { return kUInt_t; }
37 const char *ADF::NamedItemTypeOf(Int_t)
38  { return kInt_t; }
39 const char *ADF::NamedItemTypeOf(ULong64_t)
40  { return kULong64_t; }
41 const char *ADF::NamedItemTypeOf(Long64_t)
42  { return kLong64_t; }
43 const char *ADF::NamedItemTypeOf(Double_t)
44  { return kDouble_t; }
45 const char *ADF::NamedItemTypeOf(Float_t)
46  { return kFloat_t; }
47 const char *ADF::NamedItemTypeOf(std::string)
48  { return kString_t; }
49 
50 using namespace ADF;
51 
52 Digitizer::Digitizer(Double_t xmin, Double_t xmax, UInt_t bins)
53 {
54  Digitizer::Init(xmin,xmax,bins); ::srand((unsigned int)time(NULL));
55 }
56 
57 void Digitizer::Init(Double_t xmin, Double_t xmax, UInt_t bins)
58 {
59  fXmin = xmin; fXmax = xmax;
60 
61  if ( xmin > xmax )
62  { fXmax = xmin; fXmin = xmax; } // just in case
63 
64  fDeltaX = fXmax - fXmin;
65 
66  if ( bins > ADF::kMaxUShort_t )
67  fNBins2 = ADF::kMaxUShort_t;
68  else
69  fNBins2 = UShort_t(bins);
70 
71  fNBins4 = bins ;
72 }
73 
74 
75 
76 
77 
78 
79 
80 
81 
const char kShort_t[]
Definition: ADFConfig.h:106
const char kLong64_t[]
Definition: ADFConfig.h:110
const char kDouble_t[]
Definition: ADFConfig.h:112
const char kULong64_t[]
Definition: ADFConfig.h:109
const UInt_t kMaxUShort_t
Definition: ADFConfig.h:96
virtual void Init(Double_t xmin=0., Double_t xmax=1., UInt_t bins=1u)
const char kFloat_t[]
Definition: ADFConfig.h:111
const char kBool_t[]
Definition: ADFConfig.h:104
const char kInt_t[]
Definition: ADFConfig.h:108
const char kUShort_t[]
Definition: ADFConfig.h:105
const char kUInt_t[]
Definition: ADFConfig.h:107
header file for DataHandling.cpp
const char * NamedItemTypeOf(Bool_t)
Digitizer(Double_t xmin=0., Double_t xmax=1., UInt_t bins=1u)