Changeset 1058 in Sophya for trunk/SophyaLib/HiStats
- Timestamp:
- Jul 7, 2000, 11:44:16 AM (25 years ago)
- Location:
- trunk/SophyaLib/HiStats
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/hisprof.cc
r1056 r1058 234 234 } 235 235 236 /********* Methode *********/ 237 /*! 238 Pour rebinner l'histogramme de profile sur nbinew bins 239 */ 240 void HProf::HRebin(int nbinew) 241 { 242 if( bins <= 0 ) return; // createur par default 243 if( nbinew <= 0 ) return; 244 245 // memorisation de l'HProf original 246 HProf H(*this); 247 248 // Rebin de la partie Histo 249 int binold = bins; 250 Histo::HRebin(nbinew); 251 252 // Le nombre de bins est il plus grand ?? 253 if( bins > binold ) { 254 delete [] SumY; SumY = new double[nbinew]; memset(SumY, 0,bins*sizeof(double)); 255 delete [] SumY2; SumY2 = new double[nbinew]; memset(SumY2,0,bins*sizeof(double)); 256 delete [] SumW; SumW = new double[nbinew]; memset(SumW, 0,bins*sizeof(double)); 257 } 258 259 // Remplissage des parties propres au HPprof 260 for(int i=0;i<bins;i++) { 261 float xmi = BinLowEdge(i); 262 float xma = BinHighEdge(i); 263 int imi = H.FindBin(xmi); 264 if( imi < 0 ) imi = 0; 265 int ima = H.FindBin(xma); 266 if( ima >= H.bins ) ima = H.bins-1; 267 double wY = 0., wY2 = 0., wW = 0.; 268 if( ima == imi ) { 269 wY = H.SumY[imi] * binWidth/H.binWidth; 270 wY2 = H.SumY2[imi] * binWidth/H.binWidth; 271 wW = H.SumW[imi] * binWidth/H.binWidth; 272 } else { 273 wY += H.SumY[imi] * (H.BinHighEdge(imi)-xmi)/H.binWidth; 274 wY += H.SumY[ima] * (xma -H.BinLowEdge(ima))/H.binWidth; 275 wY2 += H.SumY2[imi] * (H.BinHighEdge(imi)-xmi)/H.binWidth; 276 wY2 += H.SumY2[ima] * (xma -H.BinLowEdge(ima))/H.binWidth; 277 wW += H.SumW[imi] * (H.BinHighEdge(imi)-xmi)/H.binWidth; 278 wW += H.SumW[ima] * (xma -H.BinLowEdge(ima))/H.binWidth; 279 if(ima>imi+1) for(int ii=imi+1;ii<ima;ii++) 280 {wY += H.SumY[ii]; wY2 += H.SumY2[ii]; wW += H.SumW[ii];} 281 } 282 SumY[i] += wY; SumY2[i] += wY2; SumW[i] += wW; 283 } 284 // On synchronise les tableaux Sum?? et l'Histogramme 285 UpdateHisto(); 286 } 287 236 288 /////////////////////////////////////////////////////////// 237 289 // -------------------------------------------------------- -
trunk/SophyaLib/HiStats/hisprof.h
r1056 r1058 57 57 HProf& operator = (const HProf& h); 58 58 HProf& operator += (const HProf& a); 59 60 // Info, statistique et calculs sur les histogrammes 61 virtual void HRebin(int nbinew); 59 62 60 63 // Fit -
trunk/SophyaLib/HiStats/histos.cc
r1056 r1058 1 1 // 2 // $Id: histos.cc,v 1. 7 2000-07-07 08:41:11ansari Exp $2 // $Id: histos.cc,v 1.8 2000-07-07 09:44:15 ansari Exp $ 3 3 // 4 4 … … 783 783 void Histo::HInteg(float norm) 784 784 { 785 if( bins <= 0 ) return; // createur par default 785 786 if(bins>1) 786 787 for(int i=1; i<bins; i++) { … … 802 803 void Histo::HDeriv() 803 804 { 805 if( bins <= 0 ) return; // createur par default 804 806 if( bins <= 1 ) return; 805 807 float *temp = new float[bins]; … … 819 821 void Histo::HRebin(int nbinew) 820 822 { 823 if( bins <= 0 ) return; // createur par default 821 824 if( nbinew <= 0 ) return; 822 825 -
trunk/SophyaLib/HiStats/histos.h
r1056 r1058 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: histos.h,v 1. 8 2000-07-07 08:41:11ansari Exp $3 // $Id: histos.h,v 1.9 2000-07-07 09:44:16 ansari Exp $ 4 4 // 5 5 … … 42 42 void SetErr2(int numBin, double e2); 43 43 void SetErr(float x, float e); 44 void 44 void SetErr(int numBin, float e); 45 45 46 46 // Operators … … 132 132 void HInteg(float norm = 0.); 133 133 void HDeriv(); 134 v oidHRebin(int nbinew);134 virtual void HRebin(int nbinew); 135 135 136 136 int MaxiLocal(float& maxi,int& imax,float& maxn,int& imaxn);
Note:
See TracChangeset
for help on using the changeset viewer.