FlyoDoc_2011 Pisa 2011 by GmP --- 011

flyopunta/src/src_uti/fase3max.cpp

00001 /***************************************************************************
00002  *   Copyright (C) 2009 by giuseppe Pierazzini                                      *
00003  *   giuseppe@pierazzini.it                                                               *
00004  *                                                                         *
00005  *                                                                         *
00006  *   This program is distributed in the hope that it will be useful,       *
00007  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00008  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                  *
00009  *                                                                         *
00010  *  Dipartimento di Fisica  E.Fermi / INFN Pisa Italy                      *
00011  ***************************************************************************/
00012 #define FASE
00013 #include "parm.h"
00014 #include "fase3max.h"
00015 #include "evento.h"
00016 #include "part_db.h"
00017  static Fase3Max *last_fasemx = 0;
00018   static int tot_fasemx= 0;
00019 
00020 Fase3Max::Fase3Max ( int *p,double wfx )
00021 {
00022 
00023 //linking
00024   tot_fasemx++;
00025   id=tot_fasemx;
00026 
00027   if ( last_fasemx == 0 ) Fasemx=this;
00028   else  last_fasemx ->next = this;   // linking
00029   up=last_fasemx;
00030   last_fasemx  = this;
00031   this->next = 0;   // end linking
00032   p0=p[0];
00033   p1=p[1];
00034   p2=p[2];
00035   p3=p[3];
00036   p4=p[4];
00037   p5=p[5];
00038   Wmax=wfx;
00039 
00040 
00041 }
00042 //======
00043 double Fase3Max::Get_Wmax ( int *p )
00044 {
00045   //iteratore
00046   Fase3Max *prf=Fasemx;
00047   while ( prf!=0 )
00048   {
00049     if ( p[0]==prf->p0 && p[1]==prf->p1 &&
00050             p[2]==prf->p2 && p[3]==prf->p3 &&
00051             p[4]==prf->p4&& p[5]==prf->p5 )
00052     {
00053       return Wmax;
00054     }
00055     prf=prf->next;
00056   }
00057   return -1.;
00058 }
00059 //========
00060 void  Fase3Max::Set_Wmax ( int *p,double wfx )
00061 {
00062   //iteratore
00063   Fase3Max *prf=Fasemx;
00064   while ( prf!=0 )
00065   {
00066     if ( p[0]==prf->p0 && p[1]==prf->p1 &&
00067             p[2]==prf->p2 && p[3]==prf->p3 &&
00068             p[4]==prf->p4&& p[5]==prf->p5 )
00069     {
00070       Wmax=wfx;return;
00071     }
00072     prf=prf->next;
00073   }
00074 }
00075 //======
00076 void Fase3Max::Info()
00077 {
00078   if ( this==Fasemx ) Gout<<"\n\n Fase Max data  List ";
00079   Gout<<"\n  "
00080   <<std::setw ( 4 ) <<id<<std::setw ( 6 ) <<Matter->Idm_Nome ( p0 )
00081   <<"  ==> [ "<<std::setw ( 6 ) <<Matter->Idm_Nome ( p1 )
00082   <<" "<<std::setw ( 6 ) <<Matter->Idm_Nome ( p2 )
00083   <<" "<<std::setw ( 6 ) <<Matter->Idm_Nome ( p3 );
00084   if ( p4!=0 ) Gout<<" "<<std::setw ( 6 ) <<Matter->Idm_Nome ( p4 );
00085   if ( p5!=0 ) Gout<<" "<<std::setw ( 6 ) <<Matter->Idm_Nome ( p5 );
00086   Gout<<" ] PesoMax"<<std::setw ( 6 ) << Wmax;
00087   if ( next!=0 ) next->Info();
00088 }
00089 
 All Classes Namespaces Files Functions Variables