src/Level2/TrnsTable1D.cc
/* These functions set up specific aspects of a transitions table.  Since       
   they make assumptions about the order in which the table is set up, the
   functions MUST be private, their misuse may make an inconsistent table.

   Parameter Name(s)    Optional            Function and Priority
 =====================  ========  ============================================
          TrN             No      The number of transitions in the table
   TrOmega, Trgfact       Yes     The conversion factor for PPM or Gauss input
  TrLW,TrT2,TrR,TrPP      No      The transition decay rate
          TrI             No      The transition intensity
          TrPh            Yes     The transition phase
 TrHz, TrW, TrPPM, TrB    No      The transition frequency

   Note that specification of the conversion factor, either TrOmega or Trgfact,
   will limit the valid frequency parameter names. If TrOmega has been set then
   we can take PPM values for input frequencies. If Trgfact has been specified
   then we can take Gauss values for input frequencies.  If neither of these
   has been set then we can ONLY take frequencies in Hz or 1/sec (TrHz, TrW)
   This is because we always store values in 1/sec and must be able to convert.

   0. 1/SEC ===> W : no conversion needed                 
   1. Hz ======> W : cycles/sec *     1      * PIx2 radians/cycle
   2. PPM =====> W : ppm        * Om Hz/ppm  * PIx2 radians/cycle
   3. GAUSS ===> W : Gauss      * GAUSS2HZ   * PIx2 radians/cycle

   So it is only for PPM and GAUSS frequency input that we must know some
   conversion factor. For the former this will be a spectrometer frequency in
   MHz (e.g 500 MHz), and that must of course be based upon the nuclear spin
   type whose transitions we are representing.  For the latter we need to know
   how to convert from GAUSS to Hz.  The formula for this is g*beta*H/hbar = w,
   so one needs an appropriate g-factor since H is specified and both beta and 
   hbar are constants.

   Function   Parameters                     What It Does
 ------------ ---------- ------------------------------------------------------
   SetNTrans    TrN      Sets the number of transitions. Must be present.
    SetConv    TrOmega   Sets conversion factor, FRQCONV, for PPM/Gauss input.
               Trgfact   This will also set the frequency type flag, FRQTYPE.
   GetLWR2T   TrLW, TrT2 Set transition decay rate. May be rate R, the lwhh,
              TrR, TrPP  the relaxation time T2, or peak-2-peak width, lwpp
   GetPhase     TrPh     Sets the transition phase (default is zero)
 GetIntensity   TrI      Sets the transition intensity, this must be present.
 GetFrequency TrHz, TrW  Sets the transition frequency, this must be present.
              TrPPM, TrB Can be set in Hz, 1/sec, PPM or Gauss.
   SetTrans     ---      Sets all of the transitions, one by one, using above

	   Input		TTab1D	: A transitions table (this)
                                pset	: A parameter set
				warn    : Warning level flag
                                                0 = no warning
                                                1 = warning, non-fatal
                                               >1 = fatal
           Output               TF	: Boolean whether we worked or not   */
These functions set up specific aspects of a transitions table.  Since
they make assumptions about the order in which the table is set up, the
functions MUST be private, their misuse may make an inconsistent table.

Parameter Name(s)    Optional            Function and Priority

TrN             No      The number of transitions in the table
TrOmega, Trgfact       Yes     The conversion factor for PPM or Gauss input
TrLW,TrT2,TrR,TrPP      No      The transition decay rate
TrI             No      The transition intensity
TrPh            Yes     The transition phase
TrHz, TrW, TrPPM, TrB    No      The transition frequency

Note that specification of the conversion factor, either TrOmega or Trgfact,
will limit the valid frequency parameter names. If TrOmega has been set then
we can take PPM values for input frequencies. If Trgfact has been specified
then we can take Gauss values for input frequencies.  If neither of these
has been set then we can ONLY take frequencies in Hz or 1/sec (TrHz, TrW)
This is because we always store values in 1/sec and must be able to convert.

0. 1/SEC ===> W : no conversion needed
1. Hz > W : cycles/sec *     1      * PIx2 radians/cycle
2. PPM > W : ppm        * Om Hz/ppm  * PIx2 radians/cycle
3. GAUSS ===> W : Gauss      * GAUSS2HZ   * PIx2 radians/cycle

So it is only for PPM and GAUSS frequency input that we must know some
conversion factor. For the former this will be a spectrometer frequency in
MHz , and that must of course be based upon the nuclear spin
type whose transitions we are representing.  For the latter we need to know
how to convert from GAUSS to Hz.  The formula for this is g*beta*H/hbar = w,
so one needs an appropriate g-factor since H is specified and both beta and
hbar are constants.

Function   Parameters                     What It Does

SetNTrans    TrN      Sets the number of transitions. Must be present.
SetConv    TrOmega   Sets conversion factor, FRQCONV, for PPM/Gauss input.
Trgfact   This will also set the frequency type flag, FRQTYPE.

Input                TTab1D  : A transitions table (this)
pset    : A parameter set
warn    : Warning level flag
0 = no warning
1 = warning, non-fatal
>1 = fatal
Output               TF      : Boolean whether we worked or not
These functions set up specific aspects of a transitions table . Since they make assumptions about the order in which the table is set up the functions MUST be private their misuse may make an inconsistent table . Parameter Name ( s ) Optional Function and Priority TrN No The number of transitions in the table TrOmega Trgfact Yes The conversion factor for PPM or Gauss input TrLW TrT2 TrR TrPP No The transition decay rate TrI No The transition intensity TrPh Yes The transition phase TrHz TrW TrPPM TrB No The transition frequency Note that specification of the conversion factor either TrOmega or Trgfact will limit the valid frequency parameter names . If TrOmega has been set then we can take PPM values for input frequencies . If Trgfact has been specified then we can take Gauss values for input frequencies . If neither of these has been set then we can ONLY take frequencies in Hz or 1 / sec ( TrHz TrW ) This is because we always store values in 1 / sec and must be able to convert . 0 . 1 / SEC === > W : no conversion needed 1 . Hz > W : cycles / sec * 1 * PIx2 radians / cycle 2 . PPM > W : ppm * Om Hz / ppm * PIx2 radians / cycle 3 . GAUSS === > W : Gauss * GAUSS2HZ * PIx2 radians / cycle So it is only for PPM and GAUSS frequency input that we must know some conversion factor . For the former this will be a spectrometer frequency in MHz and that must of course be based upon the nuclear spin type whose transitions we are representing . For the latter we need to know how to convert from GAUSS to Hz . The formula for this is g * beta * H / hbar = w so one needs an appropriate g - factor since H is specified and both beta and hbar are constants . Function Parameters What It Does SetNTrans TrN Sets the number of transitions . Must be present . SetConv TrOmega Sets conversion factor FRQCONV for PPM / Gauss input . Trgfact This will also set the frequency type flag FRQTYPE . Input TTab1D : A transitions table ( this ) pset : A parameter set warn : Warning level flag 0 = no warning 1 = warning non - fatal > 1 = fatal Output TF : Boolean whether we worked or not
int TTable1D::SetNTrans(const ParameterSet& pset, int warn)
  {
  string pstate;
  int npts;
  ParameterSet::const_iterator item;		
  string pname = string("TrN");			
  item = pset.seek(pname);                      
  if(item != pset.end())                        
    { 						
    (*item).parse(pname,npts,pstate);		
    matrix mx(npts, 2, complex0);
    *this = TTable1D(mx);
    return 1;
    }
  if(warn)					
    {
    TTaberror(60, 1);				
    TTaberror(61, 1);				
    if(warn > 1) TTabfatality(9);		
    else         TTaberror(9);  		
    }
  return 0;
  }
int TTable1D :: SetNTrans ( const ParameterSet & pset , int warn ) { string pstate ; int npts ; ParameterSet :: const_iterator item ; string pname = string ( " " ) ; item = pset . seek ( pname ) ; if ( item != pset . end ( ) ) { ( * item ) . parse ( pname , npts , pstate ) ; matrix mx ( npts , 2 , complex0 ) ; * this = TTable1D ( mx ) ; return 1 ; } if ( warn ) { TTaberror ( 60 , 1 ) ; TTaberror ( 61 , 1 ) ; if ( warn > 1 ) TTabfatality ( 9 ) ; else TTaberror ( 9 ) ; } return 0 ; }
These functions set up specific aspects of a transitions table.
These functions set up specific aspects of a transitions table .
// Pix in parameter list // # transitions par name // Try & find TrN par // Retrieve the number of // transitions and set the // table size for this // Cant read TrN // Can't read # transitions // Set Trn in parameter set // Problems during construction