Changeset 1089 in Sophya for trunk/SophyaLib/HiStats/hisprof.cc


Ignore:
Timestamp:
Jul 25, 2000, 12:20:43 PM (25 years ago)
Author:
ansari
Message:

updatehisto formalisation cmv 25/7/00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/hisprof.cc

    r1058 r1089  
    5757    memcpy(SumW,  H.SumW,  bins*sizeof(double));
    5858  }
     59  UpdateHisto();
    5960  END_CONSTRUCTOR
    6061}
     
    127128  et dispersion/erreur sur la moyenne).
    128129*/
    129 void HProf::UpdateHisto() const
     130void HProf::updatehisto() const
    130131{
    131132float m,e2;
    132 if(bins<=0) return;
    133 for(int i=0;i<bins;i++) {
     133if(bins>0) for(int i=0;i<bins;i++) {
    134134  if(SumW[i]<=0.) {
    135135    m = e2 = 0.;
     
    142142  err2[i] = e2;
    143143}
    144 // Attention, a cause de "WriteSelf const" UpdateHisto doit etre "const".
     144Ok = true;
     145// Attention, a cause de "WriteSelf const" updatehisto doit etre "const".
    145146// Comme on veut modifier Ok, on est oblige de faire cette entourloupe:
    146147HProf *buff = (HProf *) this;
     
    224225Histo *hthis = (Histo *) this;
    225226*hthis += (Histo) a;
    226 for(int i=0;i<bins;i++) {
     227if(bins>0) for(int i=0;i<bins;i++) {
    227228  SumY[i]  += a.SumY[i];
    228229  SumY2[i] += a.SumY2[i];
    229230  SumW[i]  += a.SumW[i];
    230231}
    231 Ok = false;
     232updatehisto();
    232233
    233234return *this;
     
    283284  }
    284285  // On synchronise les tableaux Sum?? et l'Histogramme
    285   UpdateHisto();
     286  updatehisto();
    286287}
    287288
     
    303304is.GetLine(strg,255);
    304305
    305 // Ecriture des valeurs
     306// Lecture des valeurs
    306307is.Get(dobj->bins);
    307308is.Get(dobj->YMin);
     
    310311dobj->Ok = true;
    311312
    312 // Ecriture des donnees propres a l'histogramme de profil.
     313// Lecture des donnees propres a l'histogramme de profil.
    313314is.GetLine(strg,255);
    314315dobj->SumY  = new double[dobj->bins];
     
    319320is.Get(dobj->SumW,  dobj->bins);
    320321
    321 // Ecriture de l'histogramme
     322// Lecture de l'histogramme
    322323is >> (Histo&)(*dobj);
    323324return;
     
    329330char strg[256];
    330331
    331 if(!(dobj->IsOk())) dobj->UpdateHisto();
     332dobj->UpdateHisto();
    332333
    333334// Ecriture entete pour identifier facilement
Note: See TracChangeset for help on using the changeset viewer.