Changeset 3125 in Sophya for trunk/SophyaPI
- Timestamp:
- Jan 11, 2007, 7:02:52 PM (19 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/nomherradapter.cc
r3123 r3125 8 8 #include "nomherradapter.h" 9 9 #include "servnobjm.h" 10 /* A_FAIRE_REZA #include "pihisterr.h" */ 11 /* A_FAIRE_REZA #include "pihist2err.h" */ 10 11 #include "pihisto.h" /* Wrapper pour HistoErr */ 12 #include "sohiswrap.h" /* Wrapper pour HistoErr */ 13 12 14 13 15 #include "objfitter.h" … … 100 102 PIDrawer* NOMAdapter_HistoErr::GetDrawer(string & dopt) 101 103 { 102 /* A_FAIRE_REZA -> + des options pour choisir val / err2 / nb 103 if (typeid(*mHerr) == typeid(HProf)) dopt = "fcirclemarker5 " + dopt; 104 else dopt = "thinline " + dopt; 105 PIHistoErr * pih = new PIHistoErr(mHerr, false); 104 /* A_FAIRE_CMV -> + des options pour choisir val / err2 / nb 105 pour les options, il faut rajouter des arguments ou methodes a 106 la classe HistoErrWrapper() et modifier la methode operator()(int_4 i) Error() 107 108 Si besoin, modifier dopt apres... dopt = "fcirclemarker5 " + dopt; 109 */ 110 HistoErrWrapper* hw = new HistoErrWrapper(mHerr, false); // false: le Wrapper ne delete pas l'objet mHerr 111 PIHisto * pih = new PIHisto(hw, true); // true: PIHisto delete l'objet HistoErrWrapper hw 106 112 return( pih ); 107 */108 return NULL;109 113 } 110 114 -
trunk/SophyaPI/PIext/nomherradapter.h
r3123 r3125 1 1 // This may look like C code, but it is really -*- C++ -*- 2 // Adaptateur d objets (pour NamedObjMgr) pour Histo s/NTuple3 // Reza 05/994 // LAL-IN2P3/CNRS CEA-DAPNIA2 // Adaptateur d objets (pour NamedObjMgr) pour HistoErr 3 // C. Magneville 2007 4 // (C) LAL-IN2P3/CNRS CEA-DAPNIA 5 5 6 6 #ifndef NOMHERRADAPTER_H_SEEN -
trunk/SophyaPI/PIext/nomhistadapter.cc
r3123 r3125 8 8 #include "nomhistadapter.h" 9 9 #include "pihisto.h" 10 #include "sohiswrap.h" 11 10 12 #include "pihisto2d.h" 11 13 #include "pipodrw.h" … … 153 155 if (typeid(*mHis) == typeid(HProf)) dopt = "fcirclemarker5 " + dopt; 154 156 else dopt = "thinline " + dopt; 155 PIHisto * pih = new PIHisto(mHis, false); 157 HistoWrapper* hw = new HistoWrapper(mHis, false); // false: le Wrapper ne delete pas l'objet Histo mHis 158 PIHisto * pih = new PIHisto(hw, true); // true: PIHisto delete l'objet HistoWrapper hw 156 159 return( pih ); 157 160 } -
trunk/SophyaPI/PIext/pawexecut.cc
r3123 r3125 475 475 PIHisto* pih = NULL; 476 476 if( (pih = dynamic_cast<PIHisto *>(pidwr))==NULL ) continue; 477 Histo* h = pih->Histogram();477 P1DHistoWrapper* h = pih->HistoWrapper(); 478 478 if(h==NULL) continue; 479 479 if(h->NBins()<1) continue; -
trunk/SophyaPI/PIext/piaversion.h
r3024 r3125 2 2 #define PIAPPVERSION_H_SEEN 3 3 4 #define PIAPP_VERSIONNUMBER 4. 04 #define PIAPP_VERSIONNUMBER 4.1 5 5 6 6 #endif -
trunk/SophyaPI/PIext/pihisto.cc
r3055 r3125 1 1 // Classe traceur d histogramme 96-99 2 // CEA-DAPNIA LAL-IN2P3/CNRS 2 // C. Magneville , R. Ansari 2000-2007 3 // (C) CEA-DAPNIA LAL-IN2P3/CNRS 3 4 4 5 #include <stdio.h> … … 8 9 #include <typeinfo> 9 10 10 #include "sopnamsp.h"11 //RZDEL #include "sopnamsp.h" 11 12 #include "pihisto.h" 12 #include "hisprof.h"13 13 14 14 //++ … … 17 17 // include pihisto.h 18 18 // 19 // Classe traceur d'objet histogramme (classe * Histo*)19 // Classe traceur d'objet histogramme (classe *P1DHistoWrapper*) 20 20 //-- 21 21 //++ … … 27 27 //-- 28 28 //++ 29 // PIHisto( Histo* histo, bool ad=false)29 // PIHisto(P1DHistoWrapper* histo, bool ad=false) 30 30 // Constructeur. Si "ad == true", l'objet "histo" est détruit par 31 31 // le destructeur de l'objet "PIHisto" … … 37 37 38 38 39 PIHisto::PIHisto( Histo* histo, bool ad)39 PIHisto::PIHisto(P1DHistoWrapper* histo, bool ad) 40 40 : PIDrawer(), mHisto(histo) 41 41 { … … 57 57 { 58 58 if (!mHisto) return; 59 float hmin = mHisto->VMin(); 60 float hmax = mHisto->VMax()+0.2*(mHisto->VMax()-mHisto->VMin()); 61 // si HBProf min,max calcules en tenant compte des erreurs 62 if( typeid(*mHisto) == typeid(HProf) ) { 63 float v1,v2; 64 for (int i=1; i<mHisto->NBins(); i++) { 65 v1 = (*mHisto)(i) - mHisto->Error(i); 66 v2 = (*mHisto)(i) + mHisto->Error(i); 67 if(v1<hmin) hmin = v1; 68 if(v2>hmax) hmax = v2; 69 } 70 v1 = 0.1*(hmax-hmin); 71 hmin -= v1; hmax += v1; 72 } 59 double v1,v2,hmin,hmax; 60 hmin = 9.e39; 61 hmax = -9.e39; 62 for (int i=1; i<mHisto->NBins(); i++) { 63 v1 = (*mHisto)(i); //DEL - mHisto->Error(i); 64 v2 = (*mHisto)(i); //DEL + mHisto->Error(i); 65 if(v1<hmin) hmin = v1; 66 if(v2>hmax) hmax = v2; 67 } 68 // REZA$CHECK : Modifier pour tenir compte si axe (Y) en log 69 v1 = 0.1*(hmax-hmin); 70 hmin -= v1; hmax += v1; 71 73 72 if(hmax<=hmin) hmax = hmin+1.; 74 73 SetLimits(mHisto->XMin(), mHisto->XMax(), hmin, hmax); … … 83 82 if (mHisto->NBins()<=0) return; 84 83 85 if( typeid(*mHisto)==typeid(HProf) ) mHisto->UpdateHisto();84 mHisto->Update(); 86 85 87 86 bool oktrace=false; … … 91 90 // Tracer des marqueurs si demande ou si HProf 92 91 bool drawmarker=false; 93 if ( (GetGraphicAtt().GetMarker() != PI_NotDefMarker) ||94 92 if (GetGraphicAtt().GetMarker() != PI_NotDefMarker) drawmarker = true; 93 //RZDEL || (typeid(*mHisto) == typeid(HProf)) ) drawmarker = true; 95 94 // Tracer des erreurs ? 96 95 bool drawerr=false; 97 96 if(error==0) { // Gestion automatique des erreurs 98 // Tracer les erreurs si HProf99 if( typeid(*mHisto)==typeid(HProf) ) drawerr=true;97 //RZDEL Tracer les erreurs si HProf 98 //RZDEL if( typeid(*mHisto)==typeid(HProf) ) drawerr=true; 100 99 // Trace les erreurs si marqueurs demandes 101 100 if(drawmarker) drawerr=true; … … 263 262 PIGrCoord a, d; 264 263 double cH = (double)g->GetFontHeight(a,d); 265 double cellHeight = 3.6 * cH; 266 267 // Les labels et leurs longueurs -> largeur de la cellule 268 char *label, label1[64], label2[64], label3[64]; 269 sprintf(label1, "N= %-g",mHisto->NData()); 270 sprintf(label2, "m= %-g",mHisto->Mean()); 271 sprintf(label3, "s= %-g",mHisto->Sigma()); 272 label = label1; 273 if(strlen(label)<strlen(label2)) label = label2; 274 if(strlen(label)<strlen(label3)) label = label3; 275 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 264 vector<string> lines; 265 int nlig = mHisto->GetStatInfoAsText(lines); 266 if (nlig < 1) return; 267 268 double cellHeight = (nlig+0.6) * cH; 269 270 int idxll = 0; 271 272 int kl; 273 // on recherche la ligne la plus longue 274 for(kl=1; kl<nlig; kl++) 275 if ( lines[kl].length() > lines[idxll].length() ) idxll = kl; 276 277 double cellWidth = 1.1 * (double)g->CalcStringWidth(lines[idxll].c_str()); 276 278 277 279 double ofpx = spoX*(XMax()-XMin()); … … 294 296 yu = g->DeltaUCY(YMax(),cw); 295 297 xu += ofpx; yu += ofpy; 296 g->DrawString(xu, yu,label1); 297 cw += -1.15*cH; 298 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 299 g->DrawString(xu, yu,label2); 300 cw += -1.15*cH; 301 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 302 g->DrawString(xu, yu,label3); 298 299 for(kl=0; kl<nlig; kl++) { 300 g->DrawString(xu, yu, lines[kl].c_str() ); 301 cw += -1.15*cH; 302 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 303 } 303 304 304 305 } -
trunk/SophyaPI/PIext/pihisto.h
r2523 r3125 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // Classe traceur d histogramme 96-99 3 // C. Magneville / R. Ansari 2000-2007 3 4 // CEA-DAPNIA LAL-IN2P3/CNRS 5 4 6 #ifndef PIHISTO_H 5 7 #define PIHISTO_H 6 8 7 #include "histos.h"8 9 #include "pidrawer.h" 10 #include "phistwrapper.h" 11 9 12 10 13 class PIHisto : public PIDrawer { 11 14 public: 12 PIHisto( Histo* histo, bool ad=false);15 PIHisto(P1DHistoWrapper* histo, bool ad=true); 13 16 virtual ~PIHisto(); 14 17 virtual void Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax); … … 21 24 inline void SetError(short fg=0) {error=fg;} 22 25 inline void SetFilled(bool fg=false) {filled=fg;} 23 inline Histo* Histogram() {return(mHisto);}26 inline P1DHistoWrapper* HistoWrapper() {return(mHisto);} 24 27 25 28 // Methode de decodage des options … … 33 36 protected: 34 37 virtual void DrawStats(PIGraphicUC* g); 35 Histo*mHisto;38 P1DHistoWrapper* mHisto; 36 39 bool mAdDO; 37 40 bool stats,filled;
Note:
See TracChangeset
for help on using the changeset viewer.