Logo ROOT   6.16/01
Reference Guide
UnBinData.cxx
Go to the documentation of this file.
1// @(#)root/mathcore:$Id$
2// Author: L. Moneta Wed Aug 30 11:10:03 2006
3
4/**********************************************************************
5 * *
6 * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7 * *
8 * *
9 **********************************************************************/
10
11// Implementation file for class UnBinData
12
13#include "Fit/UnBinData.h"
14#include "Math/Error.h"
15
16#include <cassert>
17#include <cmath>
18
19namespace ROOT {
20
21 namespace Fit {
22
23/*
24void UnBinData::Initialize(unsigned int maxpoints, unsigned int dim, bool isWeighted ) {
25 // preallocate a data set given size and dimension
26 unsigned int pointSize = (isWeighted) ? dim+1 : dim;
27 if ( (dim != fDim || pointSize != fPointSize) && fDataVector) {
28// MATH_INFO_MSGVAL("BinData::Initialize"," Reset amd re-initialize with a new fit point size of ",
29// dim);
30 delete fDataVector;
31 fDataVector = 0;
32 }
33 fDim = dim;
34 fPointSize = pointSize;
35 unsigned int n = fPointSize*maxpoints;
36 if ( n > MaxSize() ) {
37 MATH_ERROR_MSGVAL("UnBinData::Initialize","Invalid data size", n );
38 return;
39 }
40 if (fDataVector)
41 (fDataVector->Data()).resize( fDataVector->Size() + n );
42 else
43 fDataVector = new DataVector( n);
44}
45
46void UnBinData::Resize(unsigned int npoints) {
47 // resize vector to new points
48 if (fDim == 0) return;
49 if ( npoints > MaxSize() ) {
50 MATH_ERROR_MSGVAL("BinData::Resize"," Invalid data size ", npoints );
51 return;
52 }
53 if (fDataVector != 0) {
54 int nextraPoints = npoints - fDataVector->Size()/fPointSize;
55 if (nextraPoints < 0) {
56 // delete extra points
57 (fDataVector->Data()).resize( npoints * fPointSize);
58 }
59 else if (nextraPoints > 0) {
60 // add extra points
61 Initialize(nextraPoints, fDim, IsWeighted() );
62 }
63 else // nextraPoints == 0
64 return;
65 }
66 else // no DataVector create it
67 fDataVector = new DataVector( npoints*fPointSize);
68}
69*/
70
71
72 } // end namespace Fit
73
74} // end namespace ROOT
75
TFitResultPtr Fit(FitObject *h1, TF1 *f1, Foption_t &option, const ROOT::Math::MinimizerOptions &moption, const char *goption, ROOT::Fit::DataRange &range)
Definition: HFitImpl.cxx:134
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21