| [339] | 1 | // Cette classe est maintenant obsolete: generaldata <==> ntuple pour le dessin | 
|---|
|  | 2 |  | 
|---|
| [165] | 3 | #include <stdio.h> | 
|---|
|  | 4 | #include "pigfd1.h" | 
|---|
|  | 5 |  | 
|---|
|  | 6 |  | 
|---|
|  | 7 | /* --Methode-- */ | 
|---|
|  | 8 | PIGenFitDat::PIGenFitDat(GeneralFitData* gfd, bool ad) | 
|---|
|  | 9 | : PIDrawer(), mGFD(gfd), mAdDO(ad), VarX(0), ErrX(false), ErrY(false) | 
|---|
|  | 10 | { | 
|---|
|  | 11 | SelectX(0); | 
|---|
|  | 12 | SelectErrBar(false,false); | 
|---|
|  | 13 | } | 
|---|
|  | 14 |  | 
|---|
|  | 15 | PIGenFitDat::~PIGenFitDat() | 
|---|
|  | 16 | { | 
|---|
|  | 17 | if(mAdDO && mGFD)  delete mGFD; | 
|---|
|  | 18 | } | 
|---|
|  | 19 |  | 
|---|
|  | 20 | /* --Methode-- */ | 
|---|
|  | 21 | void  PIGenFitDat::SelectX(int varx) | 
|---|
|  | 22 | { | 
|---|
|  | 23 | VarX = -1; | 
|---|
|  | 24 | if(mGFD == NULL) return; | 
|---|
|  | 25 | if(varx<0 || varx>=mGFD->NVar()) return; | 
|---|
|  | 26 | VarX = varx; | 
|---|
|  | 27 | } | 
|---|
|  | 28 |  | 
|---|
|  | 29 | /* --Methode-- */ | 
|---|
|  | 30 | void  PIGenFitDat::SelectErrBar(bool erbx,bool erby) | 
|---|
|  | 31 | { | 
|---|
|  | 32 | ErrX = erbx; ErrY = erby; | 
|---|
|  | 33 | if(mGFD == NULL) {ErrX = ErrY = false; return;} | 
|---|
|  | 34 | if(!mGFD->HasXErrors()) ErrX = false; | 
|---|
|  | 35 | } | 
|---|
|  | 36 |  | 
|---|
|  | 37 | /* --Methode-- */ | 
|---|
|  | 38 | void PIGenFitDat::UpdateLimits() | 
|---|
|  | 39 | { | 
|---|
|  | 40 | if(!mGFD) return; | 
|---|
|  | 41 | if(mGFD->NData()<=0) return; | 
|---|
|  | 42 | if(VarX<0) return; | 
|---|
|  | 43 | double dx, dy; | 
|---|
|  | 44 | double xmin=9.e19, xmax=-9.e19, ymin=9.e19, ymax=-9.e19; | 
|---|
| [339] | 45 | mGFD->GetMnMx(10*VarX+2,xmin,xmax); | 
|---|
|  | 46 | mGFD->GetMnMx(0,ymin, ymax); | 
|---|
| [165] | 47 | if(xmax<=xmin) xmax = xmin+1.; | 
|---|
|  | 48 | if(ymax<=ymin) ymax = ymin+1.; | 
|---|
|  | 49 | dx = 0.02*(xmax-xmin); | 
|---|
|  | 50 | dy = 0.02*(ymax-ymin); | 
|---|
| [205] | 51 | SetLimits((double)xmin-dx,(double)xmax+dx,(double)ymin-dy,(double)ymax+dy); | 
|---|
| [165] | 52 | SetAxesFlags(kBoxAxes | kExtTicks | kLabels); | 
|---|
|  | 53 | } | 
|---|
|  | 54 |  | 
|---|
|  | 55 | /* --Methode-- */ | 
|---|
| [205] | 56 | void PIGenFitDat::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax) | 
|---|
| [165] | 57 | { | 
|---|
|  | 58 | if (!mGFD) return; | 
|---|
|  | 59 | if(mGFD->NData()<=0) return; | 
|---|
|  | 60 | if(VarX<0) return; | 
|---|
|  | 61 | // On plotte les barre d'erreurs ligne demandee explicitement | 
|---|
|  | 62 | if(mLAtt!=PI_NotDefLineAtt) SelectErrBar(true,true); | 
|---|
| [205] | 63 | double xp,yp,er; | 
|---|
| [165] | 64 | for (int i=0; i<mGFD->NData(); i++) { | 
|---|
|  | 65 | xp = mGFD->Absc(VarX,i); | 
|---|
|  | 66 | yp = mGFD->Val(i); | 
|---|
|  | 67 | if(xp<xmin || xp>xmax || yp<ymin || yp>ymax)  continue; | 
|---|
|  | 68 | if(ErrX) { | 
|---|
|  | 69 | er = mGFD->EAbsc(VarX,i); | 
|---|
|  | 70 | if(er>0.) g->DrawLine(xp-er,yp,xp+er,yp); | 
|---|
|  | 71 | } | 
|---|
|  | 72 | if(ErrY) { | 
|---|
|  | 73 | er = mGFD->EVal(i); | 
|---|
|  | 74 | if(er>0.) g->DrawLine(xp,yp-er,xp,yp+er); | 
|---|
|  | 75 | } | 
|---|
|  | 76 | g->DrawMarker(xp, yp); | 
|---|
|  | 77 | } | 
|---|
|  | 78 | return; | 
|---|
|  | 79 | } | 
|---|