SND@LHC Software
Loading...
Searching...
No Matches
mille.f90 File Reference

Write Millepede-II F-binary record. More...

Go to the source code of this file.

Functions/Subroutines

subroutine mille (nlc, derlc, ngl, dergl, label, rmeas, sigma)
 Add data block to record. Called from user code.
 

Detailed Description

Write Millepede-II F-binary record.

Author
Volker Blobel, University Hamburg, 2005-2009 (initial Fortran77 version)
Claus Kleinwort, DESY (maintenance and developement)

Definition in file mille.f90.

Function/Subroutine Documentation

◆ mille()

subroutine mille ( integer(mpi), intent(in)  nlc,
real(mps), dimension(nlc), intent(in)  derlc,
integer(mpi), intent(in)  ngl,
real(mps), dimension(ngl), intent(in)  dergl,
integer(mpi), dimension(ngl), intent(in)  label,
real(mps), intent(in)  rmeas,
real(mps), intent(in)  sigma 
)

Add data block to record. Called from user code.

    CALL MILLE(...)       ! measured value, derivatives (one set)
    CALL ENDLE            ! complete, write record (many sets)
(or CALL KILLE            ! stop record)

The data transmitted by MILLE calls are collected in two arrays, a real array and an integer array, of same length. The collected data are written at the ENDLE call. The content of the arrays:

    real array              integer array
1   0.0                     error count (this record)
2   RMEAS, measured value   0                            JA
3   local derivative        index of local derivative
4   local derivative        index of local derivative
5    ...
6   SIGMA, error (>0)       0                            JB
    global derivative       label of global derivative
    global derivative       label of global derivative   IST
    RMEAS, measured value   0
    local derivative        index of local derivative
    local derivative        index of local derivative
    ...
    SIGMA, error            0
    global derivative       label of global derivative
    global derivative       label of global derivative
    ...
NR  global derivative       label of global derivative

The 0's in the integer array allow to recognize the start of a new set, the measured value and the error. The local and the global derivatives are inbetween, with a positive value in the integer array, the index of the local derivative or the label of the global derivative.

If more than one output unit is needed: duplicate this subroutine change the entry names to e.g. AMILLE, AENDLE, AKILLE and change the value of LUN and evtl. the dimension parameter in the parameter statements.

Parameters
[in]NLCnumber of local derivatives
[in]DERLClocal derivatives
[in]NGLnumber of global derivatives
[in]DERGLglobal derivatives
[in]LABELlabels for global derivatives
[in]RMEASmeasurement
[in]SIGMAerror of measurement

Definition at line 75 of file mille.f90.

76 USE mpdef
77
78 IMPLICIT NONE
79 INTEGER(mpi) :: i
80 INTEGER(mpi) :: icount
81 INTEGER(mpi) :: isp
82 INTEGER(mpi) :: nr
83 INTEGER(mpi) :: nsp
84 ! -----------------------------------------------------------------
85
86 INTEGER(mpi), INTENT(IN) :: nlc
87 REAL(mps), INTENT(IN) :: derlc(nlc)
88 INTEGER(mpi), INTENT(IN) :: ngl
89 REAL(mps), INTENT(IN) :: dergl(ngl)
90 INTEGER(mpi), INTENT(IN) :: label(ngl)
91 REAL(mps), INTENT(IN) :: rmeas
92 REAL(mps), INTENT(IN) :: sigma
93 INTEGER(mpi), PARAMETER :: lun=51
94 INTEGER(mpi), PARAMETER :: ndim=10000
95 REAL(mps) :: glder(ndim) ! real data record array
96 INTEGER(mpi) :: inder(ndim) ! integer data record array
97 ! -----------------------------------------------------------------
98
99 SAVE
100 DATA nr/0/ ! initial record length
101 DATA icount/0/
102 ! ...
103 IF(sigma <= 0.0) RETURN ! error zero - no measurement
104 IF(nr == 0) THEN
105 nr=1
106 glder(1)=0.0
107 inder(1)=0 ! error counter
108 isp=0
109 END IF
110 IF(nr+nlc+ngl+2 > ndim) THEN
111 icount=icount+1
112 IF(icount <= 10) THEN
113 WRITE(*,*) 'Mille warning: data can not be stored'
114 IF(icount == 10) THEN
115 WRITE(*,*) 'Mille warning: no further printout'
116 END IF
117 END IF
118 inder(1)=inder(1)+1 ! count errors
119 RETURN ! record dimension too small
120 END IF
121 nr=nr+1
122 glder(nr)=rmeas ! measured value
123 inder(nr)=0
124 DO i=1,nlc ! local derivatives
125 IF(derlc(i) /= 0.0) THEN
126 nr=nr+1
127 glder(nr)=derlc(i) ! derivative of local parameter
128 inder(nr)=i ! index of local parameter
129 END IF
130 END DO
131
132 nr=nr+1
133 glder(nr)=sigma ! error of measured value
134 inder(nr)=0
135 DO i=1,ngl ! global derivatives
136 IF(dergl(i) /= 0.0.AND.label(i) > 0) THEN
137 nr=nr+1
138 glder(nr)=dergl(i) ! derivative of global parameter
139 inder(nr)=label(i) ! index of global parameter
140 END IF
141 END DO
142 RETURN
143
144 entry millsp(nsp,dergl,label)
145 ! add NSP special words (floating-point and integer)
146
147 ! 0.0 0
148 ! -float(NSP) 0 ! indicates special data
149 ! following NSP floating and NSP integer data
150
151 IF(nsp <= 0.OR.isp /= 0) RETURN
152 isp=nr
153 IF(nr == 0) THEN
154 nr=1
155 glder(1)=0.0
156 inder(1)=0 ! error counter
157 END IF
158 IF(nr+nsp+2 > ndim) THEN
159 inder(1)=inder(1)+1 ! count errors
160 RETURN ! record dimension too small
161 END IF
162 nr=nr+1 ! zero pair
163 glder(nr)=0.0
164 inder(nr)=0
165 nr=nr+1 ! nsp and zero
166 glder(nr)=-real(nsp,mps)
167 inder(nr)=0
168 DO i=1,nsp
169 nr=nr+1
170 glder(nr)=dergl(i) ! floating-point
171 inder(nr)=label(i) ! integer
172 END DO
173 RETURN
174
175 entry kille ! stop record
176 nr=0 ! reset
177 RETURN
178
179 entry endle ! end-of-record
180 IF(nr > 1) THEN
181 WRITE(lun) nr+nr,(glder(i),i=1,nr),(inder(i),i=1,nr)
182 END IF
183 nr=0 ! reset
184 RETURN
Definition of constants.
Definition mpdef.f90:24
integer, parameter mps
Definition mpdef.f90:37