/[PAMELA software]/DarthVader/TrackerLevel2/src/F77/readB.f
ViewVC logotype

Annotation of /DarthVader/TrackerLevel2/src/F77/readB.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Mon Aug 20 16:07:16 2007 UTC (17 years, 3 months ago) by pam-fi
Branch: MAIN
CVS Tags: v5r00, v4r00, v10RED, v9r00, v9r01, v10REDr01, v6r01, v6r00, HEAD
Changes since 1.7: +41 -24 lines
missing-image bug fixed + other changes

1 mocchiut 1.1 *************************************************************************
2     *
3     * Subroutine read_B.f
4     *
5     * it calls the subroutines which read the magnetic field maps for
6     * the PAMELA spectrometer
7     *
8     * needs:
9     * - ./read_B_inner.f inner map reading subroutine
10     * - ./read_B_outer.f outer map reading subroutine
11     *
12     * to be called before ./inter_B.f (interpolation subroutine)
13     *
14     *************************************************************************
15    
16 pam-fi 1.6 c$$$ subroutine readB(cpath)
17     c$$$ include 'common_c2f.f'
18     c$$$
19     c$$$ LOGICAL DEBUG
20     c$$$ LOGICAL VERBOSE
21     c$$$ LOGICAL WARNING
22     c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING
23     c$$$ SAVE/DBG/
24     c$$$
25     c$$$ character*256 cpath
26     c$$$ character*256 ppath
27     c$$$
28     c$$$
29     c$$$ b_error=0
30     c$$$ ppath=''
31     c$$$
32     c$$$ la=256
33     c$$$ do i=1,256
34     c$$$ if(cpath(i:i).eq.'/')la=i
35     c$$$ enddo
36     c$$$ ppath=cpath(1:la)
37     c$$$
38     c$$$ b_path = ppath
39     c$$$ b_pathlen = la
40     c$$$
41     c$$$ if(DEBUG)print*,'Field loaded: ',b_loaded
42     c$$$ if(b_loaded.eq.0)then
43     c$$$
44     c$$$c call the subroutine which reads the maps of the measurements taken
45     c$$$c inside the magnetic cavity
46     c$$$ call readBinner(ppath)
47     c$$$ if(b_error.eq.1)return
48     c$$$
49     c$$$c call the subroutine which reads the maps of the measurements taken
50     c$$$c outside the magnetic cavity
51     c$$$ call readBouter(ppath)
52     c$$$ if(b_error.eq.1)return
53     c$$$
54     c$$$ b_loaded = 1
55     c$$$ endif
56     c$$$
57     c$$$ return
58     c$$$ end
59     subroutine readB
60 mocchiut 1.1 include 'common_c2f.f'
61 pam-fi 1.2
62 pam-fi 1.8 c$$$ LOGICAL DEBUG
63     c$$$ LOGICAL VERBOSE
64     c$$$ LOGICAL WARNING
65     c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING
66     c$$$ SAVE/DBG/
67     INTEGER DEBUG
68     INTEGER VERBOSE
69     INTEGER WARNING
70     COMMON/dbg/DEBUG,VERBOSE,WARNING
71     SAVE/dbg/
72    
73    
74 pam-fi 1.2
75 pam-fi 1.6 c$$$ character*256 cpath
76 pam-fi 1.4 character*256 ppath
77 mocchiut 1.1
78    
79 pam-fi 1.6 c2f_error=0
80 mocchiut 1.1
81 pam-fi 1.6 ppath=c2f_path(1:c2f_pathlen)
82 mocchiut 1.1
83    
84 pam-fi 1.7 c VERBOSE=.true.
85 mocchiut 1.1
86     c call the subroutine which reads the maps of the measurements taken
87     c inside the magnetic cavity
88 pam-fi 1.6 call readBinner(ppath)
89     if(c2f_error.eq.1)return
90    
91 mocchiut 1.1 c call the subroutine which reads the maps of the measurements taken
92     c outside the magnetic cavity
93 pam-fi 1.6 call readBouter(ppath)
94     if(c2f_error.eq.1)return
95 mocchiut 1.1
96    
97     return
98     end
99    
100     ************************************************************
101    
102    
103     *************************************************************************
104     *
105     * Subroutine readBinner
106     *
107     * it reads from rz files the two magnetic field maps taken inside the
108     * spectrometer cavity and fills the variables in common_B_inner.f
109     *
110     * needs:
111     * - common_B.f common file for the inner magnetic field map
112     * - .rz map files in ./ containing coordinates of measured points, Bx, By
113     * and Bz components + errors
114     *
115     * output variables: (see common_B_inner.f)
116     * - px#(nx,3) with #=1,2 for the 2 maps
117     * - py#(ny,3)
118     * - pz#(nz,3)
119     * - b#(nx,ny,nz,3)
120     *
121     *************************************************************************
122    
123     subroutine readBinner(path)
124    
125     c implicit double precision (a-h,o-z)
126     include 'common_B.f'
127     include 'common_c2f.f'
128 pam-fi 1.2
129 pam-fi 1.8 c$$$ LOGICAL DEBUG
130     c$$$ LOGICAL VERBOSE
131     c$$$ LOGICAL WARNING
132     c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING
133     c$$$ SAVE/DBG/
134     INTEGER DEBUG
135     INTEGER VERBOSE
136     INTEGER WARNING
137     COMMON/dbg/DEBUG,VERBOSE,WARNING
138     SAVE/dbg/
139 pam-fi 1.2
140 pam-fi 1.5 character*256 path
141 mocchiut 1.1
142     C
143     REAL hmemor(10000000)
144     integer Iquest(100)
145     COMMON /pawc/hmemor
146     save /pawc/
147     C
148     Common /QUEST/ Iquest
149     save /quest/
150    
151    
152     c------------------------------------------------------------------------
153     c
154     c local variables
155     c
156     c------------------------------------------------------------------------
157    
158     character*64 Bmap_file !magnetic field file name
159     parameter (lun_Bmap_file=66) !magnetic field map file id number
160    
161     parameter (ntpl_Bmap=20) !ntuple identifier
162    
163     REAL PFX(3),FX,DFX, !Bx field component coordinates in m, value and error in T
164     $ PFY(3),FY,DFY
165     $ ,PFZ(3),FZ,DFZ
166     INTEGER INDEX(3) !point index
167    
168     COMMON /PAWCR4/ INDEX,PFX,FX,DFX,PFY,FY,DFY,PFZ,FZ,DFZ
169    
170    
171     CALL HLIMIT(10000000)
172     C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
173     C largest RZ file: IQUEST(10) records x LREC words x 4 byte
174     C with the following settings: 65000 x 4096 x 4 = 1G
175     C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
176    
177     c permette di ottenere ntuple funzionanti nonostante
178     c il messaggio dei 64K di RZOUT
179     Iquest(10) = 512000
180     c------------------------------------------------------------------------
181     c
182     c *** FIRST MAP ***
183     c
184     c------------------------------------------------------------------------
185    
186     c------------------------------------------------------------------------
187     c
188     c initialization and map file opening
189     c
190     c------------------------------------------------------------------------
191    
192     c print*,' '
193     c print*,' '
194    
195     Bmap_file='measure_n3_290302.rz'
196    
197     c opens magnetic field map first file
198 pam-fi 1.2 c if(b_debug.eq.1)print *
199 pam-fi 1.8 if(VERBOSE.EQ.1)print *
200 mocchiut 1.1 $ ,path(1:LNBLNK(path))//Bmap_file
201     call HROPEN
202     $ (lun_Bmap_file,'Bmap'
203     $ ,path(1:LNBLNK(path))//Bmap_file
204     $ ,'P',1024,istat)
205     if(istat.ne.0) goto 21
206    
207    
208     call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory
209    
210     c call HPRNTU(ntpl_Bmap)
211     call HBNAME(ntpl_Bmap,' ',0,'$CLEAR')
212     call HBNAME(ntpl_Bmap,'INDEX',index,'$SET')
213     call HBNAME(ntpl_Bmap,'BX',pfx,'$SET')
214     call HBNAME(ntpl_Bmap,'BY',pfy,'$SET')
215     call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET')
216    
217    
218     c------------------------------------------------------------------------
219     c
220     c reads events and fills variables
221     c
222     c------------------------------------------------------------------------
223    
224     call HNOENT(ntpl_Bmap,iemax) !number of events
225    
226     c initializes measurement grid edges
227     do ic=1,3
228     px1max(ic)=0.
229     px1min(ic)=0.
230     py1max(ic)=0.
231     py1min(ic)=0.
232     pz1max(ic)=0.
233     pz1min(ic)=0.
234     enddo
235    
236    
237     do iev=1,iemax !event loop
238    
239     call HGNT(ntpl_Bmap,iev,ierr) !reads event
240     if(ierr.ne.0) goto 22
241    
242     c the output consists of matrices for coordinates, B components values
243     c and errors:
244     c e.g. px1(4,2) = X coordinate of the point with index = 4 along X,
245     c in which By (=2) component has been measured
246     c e.g. b1(3,23,4,1) = Bx (=1) component value, measured in the point with
247     c indexes = 3,23,4 along X, Y and Z
248    
249     c Bx component
250     px1(index(1),1) = pfx(1)
251     if(px1(index(1),1).lt.px1min(1)) px1min(1)=px1(index(1),1)
252     if(px1(index(1),1).gt.px1max(1)) px1max(1)=px1(index(1),1)
253     py1(index(2),1) = pfx(2)
254     if(py1(index(2),1).lt.py1min(1)) py1min(1)=py1(index(2),1)
255     if(py1(index(2),1).gt.py1max(1)) py1max(1)=py1(index(2),1)
256     pz1(index(3),1) = pfx(3)
257     if(pz1(index(3),1).lt.pz1min(1)) pz1min(1)=pz1(index(3),1)
258     if(pz1(index(3),1).gt.pz1max(1)) pz1max(1)=pz1(index(3),1)
259    
260     b1(index(1),index(2),index(3),1) = fx
261    
262    
263     c By component
264     px1(index(1),2) = pfy(1)
265     if(px1(index(1),2).lt.px1min(2)) px1min(2)=px1(index(1),2)
266     if(px1(index(1),2).gt.px1max(2)) px1max(2)=px1(index(1),2)
267     py1(index(2),2) = pfy(2)
268     if(py1(index(2),2).lt.py1min(2)) py1min(2)=py1(index(2),2)
269     if(py1(index(2),2).gt.py1max(2)) py1max(2)=py1(index(2),2)
270     pz1(index(3),2) = pfy(3)
271     if(pz1(index(3),2).lt.pz1min(2)) pz1min(2)=pz1(index(3),2)
272     if(pz1(index(3),2).gt.pz1max(2)) pz1max(2)=pz1(index(3),2)
273    
274     b1(index(1),index(2),index(3),2) = fy
275    
276    
277     c Bz component
278     px1(index(1),3) = pfz(1)
279     if(px1(index(1),3).lt.px1min(3)) px1min(3)=px1(index(1),3)
280     if(px1(index(1),3).gt.px1max(3)) px1max(3)=px1(index(1),3)
281     py1(index(2),3) = pfz(2)
282     if(py1(index(2),3).lt.py1min(3)) py1min(3)=py1(index(2),3)
283     if(py1(index(2),3).gt.py1max(3)) py1max(3)=py1(index(2),3)
284     pz1(index(3),3) = pfz(3)
285     if(pz1(index(3),3).lt.pz1min(3)) pz1min(3)=pz1(index(3),3)
286     if(pz1(index(3),3).gt.pz1max(3)) pz1max(3)=pz1(index(3),3)
287    
288     b1(index(1),index(2),index(3),3) = fz
289    
290     enddo
291    
292     c------------------------------------------------------------------------
293     c
294     c closes files
295     c
296     c------------------------------------------------------------------------
297    
298     call HREND('Bmap')
299     close(lun_Bmap_file)
300     c$$$ cmd2='rm -f '
301     c$$$ $ //Bmap_file(1:LNBLNK(Bmap_file))
302     c$$$ call system(cmd2)
303     c$$$
304    
305    
306     c------------------------------------------------------------------------
307     c
308     c *** SECOND MAP ***
309     c
310     c------------------------------------------------------------------------
311    
312     c------------------------------------------------------------------------
313     c
314     c initialization and map file opening
315     c
316     c------------------------------------------------------------------------
317    
318     c print*,' '
319     c print*,' '
320    
321     Bmap_file='measure_n4_110402_corrected.rz'
322     c opens magnetic field map first file
323 pam-fi 1.2 c if(b_debug.eq.1)print * !,'Opening file: '
324 pam-fi 1.8 if(VERBOSE.EQ.1)print * !,'Opening file: '
325 mocchiut 1.1 $ ,path(1:LNBLNK(path))//Bmap_file
326     call HROPEN
327     $ (lun_Bmap_file,'Bmap'
328     $ ,path(1:LNBLNK(path))//Bmap_file
329     $ ,'P',1024,istat)
330     if(istat.ne.0) goto 21
331    
332    
333     call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory
334    
335     c call HPRNTU(ntpl_Bmap)
336     call HBNAME(ntpl_Bmap,' ',0,'$CLEAR')
337     call HBNAME(ntpl_Bmap,'INDEX',index,'$SET')
338     call HBNAME(ntpl_Bmap,'BX',pfx,'$SET')
339     call HBNAME(ntpl_Bmap,'BY',pfy,'$SET')
340     call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET')
341    
342    
343     c------------------------------------------------------------------------
344     c
345     c reads events and fills variables
346     c
347     c------------------------------------------------------------------------
348    
349     call HNOENT(ntpl_Bmap,iemax) !number of events
350    
351     c print*,'iemax ',iemax
352    
353     do ic=1,3 !grid edges
354     px2max(ic)=0.
355     px2min(ic)=0.
356     py2max(ic)=0.
357     py2min(ic)=0.
358     pz2max(ic)=0.
359     pz2min(ic)=0.
360     enddo
361    
362    
363     do iev=1,iemax !event loop
364    
365     call HGNT(ntpl_Bmap,iev,ierr) !reads event
366     if(ierr.ne.0) goto 22
367    
368     c the output consists of matrices for coordinates, B components values
369     c and errors:
370     c e.g. px(4,2) = X coordinate of the point with index = 4 along X,
371     c in which By (=2) component has been measured
372     c e.g. b(3,23,4,1) = Bx (=1) component value, measured in the point with
373     c indexes = 3,23,4 along X, Y and Z
374    
375     c Bx component
376     px2(index(1),1) = pfx(1)
377     if(px2(index(1),1).lt.px2min(1)) px2min(1)=px2(index(1),1)
378     if(px2(index(1),1).gt.px2max(1)) px2max(1)=px2(index(1),1)
379     py2(index(2),1) = pfx(2)
380     if(py2(index(2),1).lt.py2min(1)) py2min(1)=py2(index(2),1)
381     if(py2(index(2),1).gt.py2max(1)) py2max(1)=py2(index(2),1)
382     pz2(index(3),1) = pfx(3)
383     if(pz2(index(3),1).lt.pz2min(1)) pz2min(1)=pz2(index(3),1)
384     if(pz2(index(3),1).gt.pz2max(1)) pz2max(1)=pz2(index(3),1)
385    
386     b2(index(1),index(2),index(3),1) = fx
387    
388    
389     c By component
390     px2(index(1),2) = pfy(1)
391     if(px2(index(1),2).lt.px2min(2)) px2min(2)=px2(index(1),2)
392     if(px2(index(1),2).gt.px2max(2)) px2max(2)=px2(index(1),2)
393     py2(index(2),2) = pfy(2)
394     if(py2(index(2),2).lt.py2min(2)) py2min(2)=py2(index(2),2)
395     if(py2(index(2),2).gt.py2max(2)) py2max(2)=py2(index(2),2)
396     pz2(index(3),2) = pfy(3)
397     if(pz2(index(3),2).lt.pz2min(2)) pz2min(2)=pz2(index(3),2)
398     if(pz2(index(3),2).gt.pz2max(2)) pz2max(2)=pz2(index(3),2)
399    
400     b2(index(1),index(2),index(3),2) = fy
401    
402    
403     c Bz component
404     px2(index(1),3) = pfz(1)
405     if(px2(index(1),3).lt.px2min(3)) px2min(3)=px2(index(1),3)
406     if(px2(index(1),3).gt.px2max(3)) px2max(3)=px2(index(1),3)
407     py2(index(2),3) = pfz(2)
408     if(py2(index(2),3).lt.py2min(3)) py2min(3)=py2(index(2),3)
409     if(py2(index(2),3).gt.py2max(3)) py2max(3)=py2(index(2),3)
410     pz2(index(3),3) = pfz(3)
411     if(pz2(index(3),3).lt.pz2min(3)) pz2min(3)=pz2(index(3),3)
412     if(pz2(index(3),3).gt.pz2max(3)) pz2max(3)=pz2(index(3),3)
413    
414     b2(index(1),index(2),index(3),3) = fz
415    
416     enddo
417    
418     c------------------------------------------------------------------------
419     c
420     c closes files
421     c
422     c------------------------------------------------------------------------
423    
424     call HREND('Bmap')
425     close(lun_Bmap_file)
426    
427     c------------------------------------------------------------------------
428     c
429     c no error exit
430     c
431     c------------------------------------------------------------------------
432    
433     goto 9000 !happy ending
434    
435     c------------------------------------------------------------------------
436     c
437     c magnetic field map file opening error
438     c
439     c------------------------------------------------------------------------
440    
441     21 continue
442    
443 pam-fi 1.6 c2f_error = 1
444 pam-fi 1.2 c if(b_debug.eq.1)
445 pam-fi 1.8 if(DEBUG.EQ.1)
446 mocchiut 1.1 $ print*
447     $ ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: '
448     $ ,Bmap_file
449    
450     goto 9000 !the end
451    
452    
453     c------------------------------------------------------------------------
454     c
455     c ntuple event reading error
456     c
457     c------------------------------------------------------------------------
458    
459     22 continue
460    
461 pam-fi 1.6 c2f_error = 1
462 pam-fi 1.8 c if(b_debug.eq.1.eq.1)
463     if(DEBUG.EQ.1)
464 mocchiut 1.1 $ print*,'read_B_inner: ERROR WHILE READING NTUPLE, at entry
465     $ : ',iev
466    
467     goto 9000 !the end
468    
469    
470     c------------------------------------------------------------------------
471     c
472     c exit
473     c
474     c------------------------------------------------------------------------
475    
476     9000 continue
477    
478     return
479     end
480     *************************************************************************
481     *
482     * Subroutine readBouter
483     *
484     * it reads from rz files the two magnetic field maps taken inside the
485     * spectrometer cavity and fills the variables in common_B_inner.f
486     *
487     * needs:
488     * - common_B_outer.f common file for the outer magnetic field map
489     * - .rz map files in ./ containing coordinates of measured points, Bx, By
490     * and Bz components + errors
491     *
492     * output variables: (see common_B_outer.f)
493     * - pxo(nx,3)
494     * - pyo(ny,3)
495     * - pzo(nz,3)
496     * - bo(nx,ny,nz,3)
497     *
498     *************************************************************************
499    
500     subroutine readBouter(path)
501    
502     c implicit double precision (a-h,o-z)
503     include 'common_B.f'
504     include 'common_c2f.f'
505     C
506 pam-fi 1.8 c$$$ LOGICAL DEBUG
507     c$$$ LOGICAL VERBOSE
508     c$$$ LOGICAL WARNING
509     c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING
510     c$$$ SAVE/DBG/
511     INTEGER DEBUG
512     INTEGER VERBOSE
513     INTEGER WARNING
514     COMMON/dbg/DEBUG,VERBOSE,WARNING
515     SAVE/dbg/
516 pam-fi 1.2
517 pam-fi 1.5 character*256 path
518 mocchiut 1.1
519     REAL hmemor(10000000)
520     integer Iquest(100)
521     COMMON /pawc/hmemor
522     save /pawc/
523     C
524     Common /QUEST/ Iquest
525     save /quest/
526    
527    
528    
529     c------------------------------------------------------------------------
530     c
531     c local variables
532     c
533     c------------------------------------------------------------------------
534    
535     character*64 Bmap_file !magnetic field file name
536     parameter (lun_Bmap_file=66) !magnetic field map file id number
537    
538     parameter (ntpl_Bmap=20) !ntuple identifier
539    
540     REAL PFX(3),FX,DFX, !Bx field component coordinates in m, value and error in T
541     $ PFY(3),FY,DFY
542     $ ,PFZ(3),FZ,DFZ
543     INTEGER INDEX(3) !point index
544    
545     COMMON /PAWCR4/ INDEX,PFX,FX,DFX,PFY,FY,DFY,PFZ,FZ,DFZ
546    
547    
548     c print*,'Calling HLIMIT'
549     CALL HLIMIT(10000000)
550     C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
551     C largest RZ file: IQUEST(10) records x LREC words x 4 byte
552     C with the following settings: 65000 x 4096 x 4 = 1G
553     C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
554    
555     c permette di ottenere ntuple funzionanti nonostante
556     c il messaggio dei 64K di RZOUT
557     Iquest(10) = 512000
558     c------------------------------------------------------------------------
559     c
560     c *** FIRST MAP ***
561     c
562     c------------------------------------------------------------------------
563    
564     c------------------------------------------------------------------------
565     c
566     c initialization and map file opening
567     c
568     c------------------------------------------------------------------------
569    
570     c print*,' '
571     c print*,' '
572    
573     Bmap_file='External_top_map_n4_150402.rz'
574    
575     c opens magnetic field map first file
576 pam-fi 1.2 c if(b_debug.eq.1)print *
577 pam-fi 1.8 if(VERBOSE.EQ.1)print *
578 mocchiut 1.1 $ ,path(1:LNBLNK(path))//Bmap_file
579     call HROPEN
580     $ (lun_Bmap_file,'Bmap'
581     $ ,path(1:LNBLNK(path))//Bmap_file
582     $ ,'P',1024,istat)
583     if(istat.ne.0) goto 21
584    
585    
586     call HRIN(ntpl_Bmap,9999,0) !puts B map ntuple in memory
587    
588     c call HPRNTU(ntpl_Bmap)
589     call HBNAME(ntpl_Bmap,' ',0,'$CLEAR')
590     call HBNAME(ntpl_Bmap,'INDEX',index,'$SET')
591     call HBNAME(ntpl_Bmap,'BX',pfx,'$SET')
592     call HBNAME(ntpl_Bmap,'BY',pfy,'$SET')
593     call HBNAME(ntpl_Bmap,'BZ',pfz,'$SET')
594    
595    
596     c------------------------------------------------------------------------
597     c
598     c reads events and fills variables
599     c
600     c------------------------------------------------------------------------
601    
602     call HNOENT(ntpl_Bmap,iemax) !number of events
603    
604     c initializes measurement grid edges
605     do ic=1,3
606     poxmax(ic)=0.
607     poxmin(ic)=0.
608     poymax(ic)=0.
609     poymin(ic)=0.
610     pozmax(ic)=0.
611     pozmin(ic)=0.
612     enddo
613    
614    
615     do iev=1,iemax !event loop
616    
617     call HGNT(ntpl_Bmap,iev,ierr) !reads event
618     if(ierr.ne.0) goto 22
619    
620     c the output consists of matrices for coordinates, B components values
621     c and errors:
622     c e.g. px1(4,2) = X coordinate of the point with index = 4 along X,
623     c in which By (=2) component has been measured
624     c e.g. b1(3,23,4,1) = Bx (=1) component value, measured in the point with
625     c indexes = 3,23,4 along X, Y and Z
626    
627     c Bx component
628     pox(index(1),1) = pfx(1)
629     if(pox(index(1),1).lt.poxmin(1)) poxmin(1)=pox(index(1),1)
630     if(pox(index(1),1).gt.poxmax(1)) poxmax(1)=pox(index(1),1)
631     poy(index(2),1) = pfx(2)
632     if(poy(index(2),1).lt.poymin(1)) poymin(1)=poy(index(2),1)
633     if(poy(index(2),1).gt.poymax(1)) poymax(1)=poy(index(2),1)
634     poz(index(3),1) = pfx(3)
635     if(poz(index(3),1).lt.pozmin(1)) pozmin(1)=poz(index(3),1)
636     if(poz(index(3),1).gt.pozmax(1)) pozmax(1)=poz(index(3),1)
637    
638     bo(index(1),index(2),index(3),1) = fx
639    
640    
641     c By component
642     pox(index(1),2) = pfy(1)
643     if(pox(index(1),2).lt.poxmin(2)) poxmin(2)=pox(index(1),2)
644     if(pox(index(1),2).gt.poxmax(2)) poxmax(2)=pox(index(1),2)
645     poy(index(2),2) = pfy(2)
646     if(poy(index(2),2).lt.poymin(2)) poymin(2)=poy(index(2),2)
647     if(poy(index(2),2).gt.poymax(2)) poymax(2)=poy(index(2),2)
648     poz(index(3),2) = pfy(3)
649     if(poz(index(3),2).lt.pozmin(2)) pozmin(2)=poz(index(3),2)
650     if(poz(index(3),2).gt.pozmax(2)) pozmax(2)=poz(index(3),2)
651    
652     bo(index(1),index(2),index(3),2) = fy
653    
654    
655     c Bz component
656     pox(index(1),3) = pfz(1)
657     if(pox(index(1),3).lt.poxmin(3)) poxmin(3)=pox(index(1),3)
658     if(pox(index(1),3).gt.poxmax(3)) poxmax(3)=pox(index(1),3)
659     poy(index(2),3) = pfz(2)
660     if(poy(index(2),3).lt.poymin(3)) poymin(3)=poy(index(2),3)
661     if(poy(index(2),3).gt.poymax(3)) poymax(3)=poy(index(2),3)
662     poz(index(3),3) = pfz(3)
663     if(poz(index(3),3).lt.pozmin(3)) pozmin(3)=poz(index(3),3)
664     if(poz(index(3),3).gt.pozmax(3)) pozmax(3)=poz(index(3),3)
665    
666     bo(index(1),index(2),index(3),3) = fz
667    
668     enddo
669    
670    
671     c------------------------------------------------------------------------
672     c
673     c closes files
674     c
675     c------------------------------------------------------------------------
676    
677     call HREND('Bmap')
678     close(lun_Bmap_file)
679    
680    
681     c------------------------------------------------------------------------
682     c
683     c no error exit
684     c
685     c------------------------------------------------------------------------
686    
687     goto 9000 !happy ending
688    
689     c------------------------------------------------------------------------
690     c
691     c magnetic field map file opening error
692     c
693     c------------------------------------------------------------------------
694    
695     21 continue
696    
697 pam-fi 1.6 c2f_error = 1
698 pam-fi 1.2 c if(b_debug.eq.1)
699 pam-fi 1.8 if(DEBUG.EQ.1)
700 mocchiut 1.1 $ print*
701     $ ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: '
702     $ ,Bmap_file
703    
704     goto 9000 !the end
705    
706    
707     c------------------------------------------------------------------------
708     c
709 pam-fi 1.8 c ntuple evevent reading error
710 mocchiut 1.1 c
711     c------------------------------------------------------------------------
712    
713     22 continue
714    
715 pam-fi 1.6 c2f_error = 1
716 pam-fi 1.2 c if(b_debug.eq.1)
717 pam-fi 1.8 if(DEBUG.EQ.1)
718 mocchiut 1.1 $ print*
719     $ ,'read_B_inner: ERROR WHILE READING NTUPLE, at event
720     $ : ',iev
721    
722     goto 9000 !the end
723    
724    
725     c------------------------------------------------------------------------
726     c
727     c exit
728     c
729     c------------------------------------------------------------------------
730    
731     9000 continue
732    
733     return
734     end
735    

  ViewVC Help
Powered by ViewVC 1.1.23