Millepede-II V04-17-04
Functions/Subroutines
millepede1.f90 File Reference

Millepede(-I) subroutines. More...

Go to the source code of this file.

Functions/Subroutines

subroutine testmp (iarg)
 Test of millepede. More...
 
subroutine gener (y, a, b, x, sigma, bias, heff)
 Generate Y values. More...
 
function zrand ()
 Return random number U(0,1). More...
 
function znorm ()
 Return random number N(0,1). More...
 
subroutine initgl (nagbar, nalcar, nstd, iprlim)
 Initialization of package. More...
 
subroutine parglo (par)
 Initialize global parameters. More...
 
subroutine parsig (INDEX, sigma)
 Define sigma for single parameter (optional). More...
 
subroutine nonlin (INDEX)
 Set nonlinear flag for single parameter (optional). More...
 
subroutine initun (lun, cutfac)
 Define unit for iterations (optional). More...
 
subroutine constf (dercs, rhs)
 Add constraint (optional). More...
 
subroutine equloc (dergb, derlc, rrmeas, sigma)
 Add single equation with its derivatives. More...
 
subroutine zerloc (dergb, derlc)
 Reset derivatives. More...
 
subroutine fitloc
 Fit after end of local block. More...
 
subroutine fitglo (par)
 Final global fit. More...
 
function errpar (i)
 Return error for parameter I. More...
 
function corpar (i, j)
 Return correlation between parameters I and J. More...
 
subroutine prtglo (lun)
 Print result on file. More...
 
subroutine spminv (v, b, n, nrank, diag, flag)
 Obtain solution of a system of linear equations with symmetric matrix and the inverse. More...
 
subroutine spavat (v, a, w, n, m)
 Similarity operation A*V*A^t. More...
 
subroutine spax (a, x, y, m, n)
 Multiply general M-by-N matrix A and N-vector X. More...
 
subroutine pxhist (inc, n, xa, xb)
 Print X histogram. More...
 
subroutine chfmt (x, n, xchar, echar)
 Prepare printout of array of real numbers as character strings. More...
 
function chindl (n, nd)
 Return limit in chi^2/ND for N sigmas (N=1, 2 or 3). More...
 
subroutine fitmut (nvec, vec)
 Get matrix information out. More...
 

Detailed Description

Millepede(-I) subroutines.

Author
Volker Blobel, University Hamburg, 2000 (original Fortran77 code)
Claus Kleinwort, DESY, 2024 (reformatting)
                Millepede - Linear Least Squares
                ================================
    A Least Squares Method for Detector Alignment - Fortran code

     TESTMP      short test program for detector aligment
                 with GENER (generator) + ZRAND, ZNORM (random gen.)

     The execution of the test program needs a MAIN program:
                 CALL TESTMP(0)
                 CALL TESTMP(1)
                 END

     INITGL      initialization
     PARGLO       optional: initialize parameters with nonzero values
     PARSIG       optional: define sigma for single parameter
     INITUN       optional: unit for iterations
     CONSTF       optional: constraints
     EQULOC      equations for local fit
     ZERLOC
     FITLOC      local parameter fit (+entry KILLOC)
     FITGLO      final global parameter fit
     ERRPAR      parameter errors
     CORPAR      parameter correlations
     PRTGLO      print result on file

     Special matrix subprograms (all in Double Precision):
        SPMINV   matrix inversion + solution
        SPAVAT   special double matrix product
        SPAX     product matrix times vector

     PXHIST      histogram printing
     CHFMT       formatting of real numbers
     CHINDL      limit of chi**2/nd
     FITMUT/FITMIN vector input/ouput for parallel processing

Definition in file millepede1.f90.

Function/Subroutine Documentation

◆ chfmt()

subroutine chfmt ( real, dimension(*)  x,
  n,
character (len=8), dimension(n)  xchar,
character (len=4)  echar 
)

Prepare printout of array of real numbers as character strings.

             - -
  CALL CHFMT(X,N,XCHAR,ECHAR)
                 ----- -----
where X( )     = array of n real values
      XCHAR( ) = array of n character*8 variables
      ECHAR    = character*4 variable

CHFMT converts an array of  n  real  values  into n character*  8
variables (containing the values as text) and  a  common  exponent
for printing. unneccessary zeros are suppressed.


example: x(1)=1200.0, x(2)=1700.0 with n=2 are converted to
          xchar(1)='  1.2   ', xchar(2)='  1.7   ', echar='e 03'

Definition at line 1472 of file millepede1.f90.

Referenced by pxhist().

◆ chindl()

function chindl (   n,
  nd 
)

Return limit in chi^2/ND for N sigmas (N=1, 2 or 3).

Definition at line 1571 of file millepede1.f90.

References chindl().

◆ constf()

subroutine constf ( real, dimension(*)  dercs,
  rhs 
)

Add constraint (optional).

Definition at line 397 of file millepede1.f90.

Referenced by testmp().

◆ corpar()

function corpar (   i,
  j 
)

Return correlation between parameters I and J.

Definition at line 1083 of file millepede1.f90.

References corpar().

Referenced by corpar().

◆ equloc()

subroutine equloc ( real, dimension(*)  dergb,
real, dimension(*)  derlc,
  rrmeas,
  sigma 
)

Add single equation with its derivatives.

DERGB(1) ... DERGB(NAGB) = derivatives w.r.t. global parameters
DERLC(1) ... DERLC(NALC) = derivatives w.r.t. local parameters
RMEAS       = measured value
SIGMA       = standard deviation
(WGHT       = weight = 1/SIGMA**2)

Definition at line 436 of file millepede1.f90.

Referenced by testmp().

◆ errpar()

function errpar (   i)

Return error for parameter I.

Definition at line 1053 of file millepede1.f90.

References errpar().

Referenced by errpar().

◆ fitglo()

subroutine fitglo ( real, dimension(*)  par)

Final global fit.

Definition at line 840 of file millepede1.f90.

References fitloc(), prtglo(), pxhist(), and spminv().

Referenced by testmp().

◆ fitloc()

subroutine fitloc

Fit after end of local block.

Definition at line 554 of file millepede1.f90.

References chindl(), spavat(), spax(), and spminv().

Referenced by fitglo(), and testmp().

◆ fitmut()

subroutine fitmut (   nvec,
real, dimension(*)  vec 
)

Get matrix information out.

Definition at line 1601 of file millepede1.f90.

◆ gener()

subroutine gener ( real, dimension(*), intent(out)  y,
real, intent(out)  a,
real, intent(out)  b,
real, dimension(nplan), intent(in)  x,
real, dimension(nplan), intent(in)  sigma,
real, dimension(nplan), intent(in)  bias,
real, dimension(nplan), intent(in)  heff 
)

Generate Y values.

Definition at line 117 of file millepede1.f90.

References znorm(), and zrand().

Referenced by testmp().

◆ initgl()

subroutine initgl (   nagbar,
  nalcar,
  nstd,
  iprlim 
)

Initialization of package.

NAGB = number of global parameters
DERGB(1) ... DERGB(NAGB) = derivatives w.r.t. global parameters
NALC = number of local parameters (maximum)
DERLC(1) ... DERLC(NALC) = derivatives w.r.t. local parameters

Definition at line 170 of file millepede1.f90.

References chindl().

Referenced by testmp().

◆ initun()

subroutine initun (   lun,
  cutfac 
)

Define unit for iterations (optional).

Definition at line 354 of file millepede1.f90.

Referenced by testmp().

◆ nonlin()

subroutine nonlin (   INDEX)

Set nonlinear flag for single parameter (optional).

Definition at line 327 of file millepede1.f90.

◆ parglo()

subroutine parglo ( real, dimension(*)  par)

Initialize global parameters.

optional: initialize parameters with nonzero values

Definition at line 270 of file millepede1.f90.

◆ parsig()

subroutine parsig (   INDEX,
  sigma 
)

Define sigma for single parameter (optional).

Definition at line 299 of file millepede1.f90.

Referenced by testmp().

◆ prtglo()

subroutine prtglo (   lun)

Print result on file.

Definition at line 1118 of file millepede1.f90.

◆ pxhist()

subroutine pxhist ( integer, dimension(n)  inc,
  n,
  xa,
  xb 
)

Print X histogram.

Definition at line 1343 of file millepede1.f90.

References chfmt().

Referenced by fitglo().

◆ spavat()

subroutine spavat ( double precision, dimension(*)  v,
double precision, dimension(*)  a,
double precision, dimension(*)  w,
  n,
  m 
)

Similarity operation A*V*A^t.

multiply symmetric N-by-N matrix from the left with general M-by-N
matrix and from the right with the transposed of the same  general
matrix  to  form  symmetric  M-by-M   matrix   (used   for   error
propagation).

               - -   - -                                   T
   CALL SPAVAT(V,A,W,N,M)         W   =   A   *   V   *   A
                   -             M*M     M*N     N*N     N*M

   where V = symmetric N-by-N matrix
         A = general N-by-M matrix
         W = symmetric M-by-M matrix

Definition at line 1282 of file millepede1.f90.

Referenced by fitloc().

◆ spax()

subroutine spax ( double precision, dimension(*)  a,
double precision, dimension(*)  x,
double precision, dimension(*)  y,
  m,
  n 
)

Multiply general M-by-N matrix A and N-vector X.

              - -   - -
   CALL  SPAX(A,X,Y,M,N)          Y   :=   A   *    X
                  -               M       M*N       N

   where A = general M-by-N matrix (A11 A12 ... A1N  A21 A22 ...)
         X = N vector
         Y = M vector

Definition at line 1328 of file millepede1.f90.

Referenced by fitloc().

◆ spminv()

subroutine spminv ( double precision, dimension(*)  v,
double precision, dimension(n)  b,
  n,
  nrank,
double precision, dimension(n)  diag,
logical, dimension(*)  flag 
)

Obtain solution of a system of linear equations with symmetric matrix and the inverse.

               - - -
   CALL SPMINV(V,B,N,NRANK,...,...)      solve  V * X = B
               - -   -----

      V = symmetric N-by-N matrix in symmetric storage mode
          V(1) = V11, V(2) = V12, V(3) = V22, V(4) = V13, . . .
          replaced by inverse matrix
      B = N-vector, replaced by solution vector

DIAG(N) =  double precision scratch array
FLAG(N) =  logical scratch array

Method of solution is by elimination selecting the  pivot  on  the
diagonal each stage. The rank of the matrix is returned in  NRANK.
For NRANK ne N, all remaining  rows  and  cols  of  the  resulting
matrix V and the corresponding elements of  B  are  set  to  zero.

Definition at line 1188 of file millepede1.f90.

Referenced by fitglo(), and fitloc().

◆ testmp()

subroutine testmp ( integer, intent(in)  iarg)

Test of millepede.

IARG = 0   test with constraint
IARG = 1   test without constraint

Definition at line 68 of file millepede1.f90.

References constf(), equloc(), fitglo(), fitloc(), gener(), initgl(), initun(), parsig(), and zerloc().

◆ zerloc()

subroutine zerloc ( real, dimension(*)  dergb,
real, dimension(*)  derlc 
)

Reset derivatives.

DERGB(1) ... DERGB(NAGB) = derivatives w.r.t. global parameters
DERLC(1) ... DERLC(NALC) = derivatives w.r.t. local parameters

Definition at line 522 of file millepede1.f90.

Referenced by testmp().

◆ znorm()

function znorm

Return random number N(0,1).

Definition at line 153 of file millepede1.f90.

References znorm().

Referenced by gener(), and znorm().

◆ zrand()

function zrand

Return random number U(0,1).

Definition at line 143 of file millepede1.f90.

References zrand().

Referenced by gener(), and zrand().