--- DarthVader/TrackerLevel2/src/F77/readB.f 2006/10/26 16:22:37 1.4 +++ DarthVader/TrackerLevel2/src/F77/readB.f 2007/08/20 16:07:16 1.8 @@ -13,46 +13,86 @@ * ************************************************************************* - subroutine readB(cpath) +c$$$ subroutine readB(cpath) +c$$$ include 'common_c2f.f' +c$$$ +c$$$ LOGICAL DEBUG +c$$$ LOGICAL VERBOSE +c$$$ LOGICAL WARNING +c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING +c$$$ SAVE/DBG/ +c$$$ +c$$$ character*256 cpath +c$$$ character*256 ppath +c$$$ +c$$$ +c$$$ b_error=0 +c$$$ ppath='' +c$$$ +c$$$ la=256 +c$$$ do i=1,256 +c$$$ if(cpath(i:i).eq.'/')la=i +c$$$ enddo +c$$$ ppath=cpath(1:la) +c$$$ +c$$$ b_path = ppath +c$$$ b_pathlen = la +c$$$ +c$$$ if(DEBUG)print*,'Field loaded: ',b_loaded +c$$$ if(b_loaded.eq.0)then +c$$$ +c$$$c call the subroutine which reads the maps of the measurements taken +c$$$c inside the magnetic cavity +c$$$ call readBinner(ppath) +c$$$ if(b_error.eq.1)return +c$$$ +c$$$c call the subroutine which reads the maps of the measurements taken +c$$$c outside the magnetic cavity +c$$$ call readBouter(ppath) +c$$$ if(b_error.eq.1)return +c$$$ +c$$$ b_loaded = 1 +c$$$ endif +c$$$ +c$$$ return +c$$$ end + subroutine readB include 'common_c2f.f' - LOGICAL DEBUG - LOGICAL VERBOSE - LOGICAL WARNING - COMMON/DBG/DEBUG,VERBOSE,WARNING - SAVE/DBG/ +c$$$ LOGICAL DEBUG +c$$$ LOGICAL VERBOSE +c$$$ LOGICAL WARNING +c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING +c$$$ SAVE/DBG/ + INTEGER DEBUG + INTEGER VERBOSE + INTEGER WARNING + COMMON/dbg/DEBUG,VERBOSE,WARNING + SAVE/dbg/ - character*256 cpath + + +c$$$ character*256 cpath character*256 ppath - b_error=0 - ppath='' + c2f_error=0 - la=256 - do i=1,256 - if(cpath(i:i).eq.'/')la=i - enddo - ppath=cpath(1:la) + ppath=c2f_path(1:c2f_pathlen) - b_path = ppath - b_pathlen = la - if(DEBUG)print*,'Field loaded: ',b_loaded - if(b_loaded.eq.0)then +c VERBOSE=.true. c call the subroutine which reads the maps of the measurements taken c inside the magnetic cavity - call readBinner(ppath) - if(b_error.eq.1)return - + call readBinner(ppath) + if(c2f_error.eq.1)return + c call the subroutine which reads the maps of the measurements taken c outside the magnetic cavity - call readBouter(ppath) - if(b_error.eq.1)return + call readBouter(ppath) + if(c2f_error.eq.1)return - b_loaded = 1 - endif return end @@ -86,13 +126,18 @@ include 'common_B.f' include 'common_c2f.f' - LOGICAL DEBUG - LOGICAL VERBOSE - LOGICAL WARNING - COMMON/DBG/DEBUG,VERBOSE,WARNING - SAVE/DBG/ +c$$$ LOGICAL DEBUG +c$$$ LOGICAL VERBOSE +c$$$ LOGICAL WARNING +c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING +c$$$ SAVE/DBG/ + INTEGER DEBUG + INTEGER VERBOSE + INTEGER WARNING + COMMON/dbg/DEBUG,VERBOSE,WARNING + SAVE/dbg/ - character*80 path + character*256 path C REAL hmemor(10000000) @@ -151,7 +196,7 @@ c opens magnetic field map first file c if(b_debug.eq.1)print * - if(VERBOSE)print * + if(VERBOSE.EQ.1)print * $ ,path(1:LNBLNK(path))//Bmap_file call HROPEN $ (lun_Bmap_file,'Bmap' @@ -276,7 +321,7 @@ Bmap_file='measure_n4_110402_corrected.rz' c opens magnetic field map first file c if(b_debug.eq.1)print * !,'Opening file: ' - if(VERBOSE)print * !,'Opening file: ' + if(VERBOSE.EQ.1)print * !,'Opening file: ' $ ,path(1:LNBLNK(path))//Bmap_file call HROPEN $ (lun_Bmap_file,'Bmap' @@ -395,9 +440,9 @@ 21 continue - b_error = 1 + c2f_error = 1 c if(b_debug.eq.1) - if(DEBUG) + if(DEBUG.EQ.1) $ print* $ ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: ' $ ,Bmap_file @@ -413,9 +458,9 @@ 22 continue - b_error = 1 -c if(b_debug.eq.1) - if(DEBUG) + c2f_error = 1 +c if(b_debug.eq.1.eq.1) + if(DEBUG.EQ.1) $ print*,'read_B_inner: ERROR WHILE READING NTUPLE, at entry $ : ',iev @@ -458,13 +503,18 @@ include 'common_B.f' include 'common_c2f.f' C - LOGICAL DEBUG - LOGICAL VERBOSE - LOGICAL WARNING - COMMON/DBG/DEBUG,VERBOSE,WARNING - SAVE/DBG/ +c$$$ LOGICAL DEBUG +c$$$ LOGICAL VERBOSE +c$$$ LOGICAL WARNING +c$$$ COMMON/DBG/DEBUG,VERBOSE,WARNING +c$$$ SAVE/DBG/ + INTEGER DEBUG + INTEGER VERBOSE + INTEGER WARNING + COMMON/dbg/DEBUG,VERBOSE,WARNING + SAVE/dbg/ - character*80 path + character*256 path REAL hmemor(10000000) integer Iquest(100) @@ -524,7 +574,7 @@ c opens magnetic field map first file c if(b_debug.eq.1)print * - if(VERBOSE)print * + if(VERBOSE.EQ.1)print * $ ,path(1:LNBLNK(path))//Bmap_file call HROPEN $ (lun_Bmap_file,'Bmap' @@ -644,9 +694,9 @@ 21 continue - b_error = 1 + c2f_error = 1 c if(b_debug.eq.1) - if(DEBUG) + if(DEBUG.EQ.1) $ print* $ ,'read_B_inner: ERROR OPENING MAGNETIC FIELD MAP FILE: ' $ ,Bmap_file @@ -656,15 +706,15 @@ c------------------------------------------------------------------------ c -c ntuple event reading error +c ntuple evevent reading error c c------------------------------------------------------------------------ 22 continue - b_error = 1 + c2f_error = 1 c if(b_debug.eq.1) - if(DEBUG) + if(DEBUG.EQ.1) $ print* $ ,'read_B_inner: ERROR WHILE READING NTUPLE, at event $ : ',iev