Logo ROOT  
Reference Guide
TF1Data_v5.cxx
Go to the documentation of this file.
1// @(#)root/hist:$Id$
2// Author: Rene Brun 18/08/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "v5/TF1Data.h"
13
14#include "TBuffer.h"
15#include "TH1.h"
16
18
19namespace ROOT {
20
21 namespace v5 {
22
23////////////////////////////////////////////////////////////////////////////////
24/// F1 default constructor.
25
27{
28 fXmin = 0;
29 fXmax = 0;
30 fNpx = 100;
31 fType = 0;
32 fNpfits = 0;
33 fNDF = 0;
34 fNsave = 0;
35 fChisquare = 0;
36 fParErrors = 0;
37 fParMin = 0;
38 fParMax = 0;
39 fSave = 0;
40 fMinimum = -1111;
41 fMaximum = -1111;
42 SetFillStyle(0);
43}
44
45////////////////////////////////////////////////////////////////////////////////
46/// TF1 default destructor.
47
49{
50 if (fParMin) delete [] fParMin;
51 if (fParMax) delete [] fParMax;
52 if (fParErrors) delete [] fParErrors;
53 if (fSave) delete [] fSave;
54}
55
56////////////////////////////////////////////////////////////////////////////////
57/// Stream a class object.
58
60{
61 if (b.IsReading()) {
62 UInt_t R__s, R__c;
63 Version_t v = b.ReadVersion(&R__s, &R__c);
64 Streamer(b, v, R__s, R__c, nullptr);
65
66 } else {
67 // this will be needed if we want to write in old format
68 //Int_t saved = 0;
69 // if (fType > 0 && fNsave <= 0) { saved = 1; Save(fXmin,fXmax,0,0,0,0);}
70
71 b.WriteClassBuffer(TF1Data::Class(),this);
72
73 //if (saved) {delete [] fSave; fSave = 0; fNsave = 0;}
74 }
75
76}
77
78////////////////////////////////////////////////////////////////////////////////
79/// specialized streamer function being able to read old TF1 versions as TF1Data in memory
80
81void TF1Data::Streamer(TBuffer &b, Int_t v, UInt_t R__s, UInt_t R__c, const TClass *onfile_class)
82{
83 //printf("reading TF1Data ..- version %d..\n",v);
84 if (v > 4) {
85 b.ReadClassBuffer(ROOT::v5::TF1Data::Class(), this, v, R__s, R__c, onfile_class);
86 if (v == 5 && fNsave > 0) {
87 //correct badly saved fSave in 3.00/06
88 Int_t np = fNsave - 3;
89 fSave[np] = fSave[np-1];
90 fSave[np+1] = fXmin;
91 fSave[np+2] = fXmax;
92 }
93 return;
94 }
95 //====process old versions before automatic schema evolution
97 TAttLine::Streamer(b);
98 TAttFill::Streamer(b);
99 TAttMarker::Streamer(b);
100 if (v < 4) {
102 b >> xmin; fXmin = xmin;
103 b >> xmax; fXmax = xmax;
104 } else {
105 b >> fXmin;
106 b >> fXmax;
107 }
108 b >> fNpx;
109 b >> fType;
110 b >> fChisquare;
111 b.ReadArray(fParErrors);
112 if (v > 1) {
113 b.ReadArray(fParMin);
114 b.ReadArray(fParMax);
115 } else {
116 fParMin = new Double_t[fNpar+1];
117 fParMax = new Double_t[fNpar+1];
118 }
119 b >> fNpfits;
120 if (v == 1) {
121 TH1 * histogram;
122 b >> histogram;
123 delete histogram; //fHistogram = 0;
124 }
125 if (v > 1) {
126 if (v < 4) {
127 Float_t minimum,maximum;
128 b >> minimum; fMinimum =minimum;
129 b >> maximum; fMaximum =maximum;
130 } else {
131 b >> fMinimum;
132 b >> fMaximum;
133 }
134 }
135 if (v > 2) {
136 b >> fNsave;
137 if (fNsave > 0) {
138 fSave = new Double_t[fNsave+10];
139 b.ReadArray(fSave);
140 //correct fSave limits to match new version
141 fSave[fNsave] = fSave[fNsave-1];
142 fSave[fNsave+1] = fSave[fNsave+2];
143 fSave[fNsave+2] = fSave[fNsave+3];
144 fNsave += 3;
145 } else fSave = 0;
146 }
147 b.CheckByteCount(R__s, R__c, TF1Data::IsA());
148 //====end of old versions
149}
150
151 } // end namespace v5
152} // end namespace ROOT
153
void Class()
Definition: Class.C:29
#define b(i)
Definition: RSha256.hxx:100
int Int_t
Definition: RtypesCore.h:43
short Version_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
#define ClassImp(name)
Definition: Rtypes.h:361
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
The FORMULA class (ROOT version 5)
Definition: TFormula.h:65
void Streamer(TBuffer &b, const TClass *onfile_class)
Stream a class object.
Fill Area Attributes class.
Definition: TAttFill.h:19
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
Definition: TAttFill.h:39
Line Attributes class.
Definition: TAttLine.h:18
Marker Attributes class.
Definition: TAttMarker.h:19
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition: TClass.h:80
The TH1 histogram class.
Definition: TH1.h:56
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21
virtual ~TF1Data()
TF1 default destructor.
Definition: TF1Data_v5.cxx:48
Double_t * fParMin
Definition: TF1Data.h:48
void Streamer(TBuffer &b, Int_t version, UInt_t start, UInt_t count, const TClass *onfile_class=0)
Stream a class object.
Definition: TF1Data_v5.cxx:59
TF1Data()
F1 default constructor.
Definition: TF1Data_v5.cxx:26
Double_t * fSave
Definition: TF1Data.h:50
Double_t fXmin
Definition: TF1Data.h:39
Double_t * fParMax
Definition: TF1Data.h:49
Double_t fMaximum
Definition: TF1Data.h:51
Double_t fChisquare
Definition: TF1Data.h:46
Double_t fMinimum
Definition: TF1Data.h:52
Double_t * fParErrors
Definition: TF1Data.h:47
Double_t fXmax
Definition: TF1Data.h:40