+TITLE. PHOSIM 2.03/01 04/08/97 17.05.01 +PATCH,COM. *CMZ : 1.01/00 18/04/94 16.12.57 by Phobos (R. Verdier) +DECK,CRESIMCMZ ,T=DATA. *CMZ : 1.00/00 17/12/93 07.30.41 by Phobos *-- Author : $! CRESIMCMZ.COM: Create a CMZ library for the Phobos SIM system $! Use: @cresimcmz [version] $! Example: @cresimcmz scratch: p $! Options: $! CRESIMCMZ creates the CMZ library PHOSIM.CMZ and $! inserts Phobos SIM source code, include files, data files, $! command files, documents, GEANT include SEQ's, correction files $! for the Phobos changes to the interactive GEANT package GXINT, $! and the modified programs GXCONT and GXFZ into PHOSIM.CMZ. $! = test or prod, for the SIM section from which the files $! are to be taken. $! To run this procedure as extracted from th CMZ library, you must $! first copy it and delete the \\ preceding + throughout. $! 15-Dec-93 R. V. Refer to ZTEST for command procs; precede +PATCH $! and +DECK below with \\ to keep YTOC from $! interpreting them, a CMZ weakness $! 8-Dec-93 R. V. Directory structure changed to xxx_for, etc. $! 30-Nov-93 R. Verdier Creation $! $ if f$mode() .eqs. "BATCH" then assign dummy sys$print $ say == "write sys$output" $! The following is now supposed to be a system-wide logical at MIT: $! cmz :== $HANS$DKA100:[CERN.CMZ.PRO.EXE]CMZ $! $! Don't run this procedure until it's been edited: $ if "\\+" .nes. "+" $ then $ say - "You must first copy this procedure, then use an editor to change" $ say "\","\+ to + everywhere in the copy before executing it." $ exit $ endif $! Define library subdirectory: $ def/nolog cm 'f$environment("DEFAULT")' $ if p1 .nes. "" then def/nolog cm 'p1' $! Define temporary workspace subdirectory: $ def/nolog cf cm $ vers :== test $ zvers :== ztest ! for command procedures $ if p2 .eqs. "P" .or. p2 .eqs. "PROD" then vers :== prod $! Define directories for various files $ def/nolog fc phobos_root:[sim.'vers'.cmd] ! for FORTOCAR.COM $ def/nolog gc niels$dua0:[verdier.cern] ! for GEANT315.CAR $ def/nolog gx phobos_root:[sim.'vers'.src] ! for GEANX315.CAR $ def/nolog pc phobos_root:[sim.'zvers'.cmd] $ def/nolog pd phobos_root:[sim.'vers'.data] $ def/nolog pdo phobos_root:[sim.doc] $ def/nolog pi phobos_root:[sim.'vers'.inc] $ def/nolog piz phobos_root:[include.prod.src.zebra.banks] $! The first form of the following definition does not work for $! copy/excl, whereas the logically equivalent second form works: $! def/nolog ps phobos_root:[sim.'vers'.src] $ def/nolog ps disk$csc:[phobos.sim.'vers'.src] $! $! Abort the job if the PHOSIM CMZ library exists, as the startup $! corrections cannot be applied twice. $ if f$search("cm:PHOSIM.CMZ") .eqs. "" then goto SCONT $ say f$search("cm:PHOSIM.CMZ"), " already exists; please delete or " $ say "rename it and retry." $ goto EXIT $! $ SCONT: $! Otherwise create the file and include GEANT Common DEScriptor sequences. $! Create a source library by letting CMZ extract subroutines as $! decks from a file containing all the source code. $! This operation requires a special-purpose DCL procedure, $! FORTOCAR.COM, which uses the EDT editor in batch mode. $! $ say "Creating source library ''f$logical("cf")'[:]PHOSIM_TEMP.CAR " $ say "from source files ''f$logical("ps")'*.FOR:" $ copy ps:*.FOR/excl=(GEANX315,GPH,GXCONT,PTEMPLATE) cf:PHOSIM_TEMP.FOR $ @fc:FORTOCAR cf: PHOSIM_TEMP .FOR cf:PHOSIM_TEMP.CAR $ del cf:PHOSIM_TEMP.FOR; $! $! Create a CMZ correction file with startup modifications to Phobos $! user code. $! These corrections are required by our changeover to the GEANT version $! of the GCFLAG sequence, which now includes common GCFLAX and makes $! the GCFLAX include obsolete. The correction decks were created using $! YCORR in CMZ, and should need no future revision. $! $ say "Creating corrections deck for Phobos user code" $ say " in ", f$logical("cm"), "PHOSIM_TEMP.CORR:" $! ************************************************************ $! Begin startup corrections $! ************************************************************ $ create cf:PHOSIM_TEMP.CORR \\+PATCH,$CORR. \\+DECK,CORR_GEPHOB. +REP,SRC_FOR,GEPHOB,0-1. &DECK,GEPHOB. *CMZ : 21/11/93 18.14.01 by R. Verdier * Removed obsolete GCFLAX include +ADD,SRC_FOR,GEPHOB,33. * 21-Nov-93 RV Removed obsolete GCFLAX include +DEL,SRC_FOR,GEPHOB,75-80. \\+DECK,CORR_GUSTEP. +REP,SRC_FOR,GUSTEP,0-1. &DECK,GUSTEP. *CMZ : 21/11/93 18.16.34 by R. Verdier * Removed obsolete GCFLAX include +ADD,SRC_FOR,GUSTEP,28. C 21-Nov-93 RV Remove obsolete GCFLAX include +DEL,SRC_FOR,GUSTEP,35. \\+DECK,CORR_SETBATCH. +REP,SRC_FOR,SETBATCH,0-1. &DECK,SETBATCH. *CMZ : 21/11/93 18.19.23 by R. Verdier * Changed GCFLAX to GCFLAG (now contains old GCFLAX) +REP,SRC_FOR,SETBATCH,34. C 21-Nov-93 R. V. Changed GCFLAX to GCFLAG (now contains old GCFLAX) +REP,SRC_FOR,SETBATCH,42. &SEQ, GCFLAG. \\+DECK,CORR_ZZZ_DECK. +REP,SRC_FOR,ZZZ_DECK,0-3. &DECK,FINTERR. *CMZ : 22/11/93 15.48.57 by R. Verdier * Renamed to FINTERR as CMZ does not understand INTEGER*4 FUNCTION *-- Author : C======================================== \\+DECK,CORR_UGCIN. +REP,SRC_FOR,UGCIN,0. &DECK,UGCIN. *CMZ : 22/11/93 23.59.59 by R. Verdier * -maxargs -> mmaxargs, idebug -> ldebug for non-VMX Fortrans +ADD,SRC_FOR,UGCIN,37. * 22-Nov-93 R. V. -maxargs -> mmaxargs, idebug -> ldebug for * non-VMS Fortrans +REP,SRC_FOR,UGCIN,53. integer ldebug /1/ +REP,SRC_FOR,UGCIN,57-58. integer maxargs, mmaxargs, nkeys, nsubkeys parameter (nkeys = 2, nsubkeys = 3, maxargs = 20, mmaxargs = -20) +REP,SRC_FOR,UGCIN,79. data nargs / mmaxargs, mmaxargs / +REP,SRC_FOR,UGCIN,122. if (ldebug .ge. 2) write (lurep, '(a,i3/1x,a)'), +REP,SRC_FOR,UGCIN,142. if (ldebug .ge. 4) write (lurep, '(3(a,i3),2a)'), +REP,SRC_FOR,UGCIN,179. if (ikey .gt. 0 .and. ldebug .ge. 3) +REP,SRC_FOR,UGCIN,194. if (ldebug .ge. 3) +REP,SRC_FOR,UGCIN,217. if (ldebug .gt. 0) write (lurep, '(3(a,i3),a)'), +REP,SRC_FOR,UGCIN,236. if (ldebug .gt. 0) write (lurep, '(a,i4,2a)'), \\+DECK,CORR_UGEOM. +REP,SRC_FOR,UGEOM,0-1. &DECK,UGEOM. *CMZ : 22/11/93 15.42.22 by R. Verdier +REP,SRC_FOR,UGEOM,8-11. * Optionally define user geometry for Phobos. * NB: This file is a no-op version, without the subroutines that * defined individual parts of Phobos in the original version. +REP,SRC_FOR,UGEOM,21. * none +ADD,SRC_FOR,UGEOM,28. * 22-Nov_93 R. V. No-op version +REP,SRC_FOR,UGEOM,44-68. integer ugmode +REP,SRC_FOR,UGEOM,77-195. print *, 'UGEOM error: this version does not create the ', + 'geometry; it was ' print *, 'probably called because the UGCDATA file was ', + 'unreadable.' $! ************************************************************ $! End startup corrections $! ************************************************************ $ say "Creating includes library from ", f$logical("pi"), "*.cmn,*.blk:" $! $ @fc:FORTOCAR pi: BANGC .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: CARDS .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: CYFLDC .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: FLAG .CMN cf:PHOSIM_TEMP.INC $! Ignore GCFLAX, now included in GCFLAG $ @fc:FORTOCAR pi: HST .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: IO .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: MUPEP .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: MUPEPD .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: NTU .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: NTUEX .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: NTUEXD .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: RHSIL .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: RHSYS .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: UHITS .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR pi: UJKBUF .CMN cf:PHOSIM_TEMP.INC $ @fc:FORTOCAR piz: ZBBFLD .BLK cf:PHOSIM_TEMP.INC $! $! Create a CMZ correction file with Phobos modifications to GEANX, the $! interactive GEANT package. These corrections were created using YCORR $! and must be checked if either GXCONT or GXFZ changes in the future. $! Note that the PATCH containing the code is GXINT, and CMZ makes this $! the subdirectory name, although GEANX_FOR would be consistent with $! the Phobos directory structure. $ say "Creating corrections deck for the interactive GEANT package, GEANX," $ say "in ", f$logical("cm"), "GEANX_TEMP.CORR:" $ create cf:GEANX_TEMP.CORR \\+PATCH,$CORR_GEANX. \\+DECK,CORR_GXCONT. +REP,GXINT,GXCONT,1. *CMZ : 15/11/93 23.24.09 by R. Verdier, M.I.T. * TRIG handling changed to allow external loop control for * multi-pass event processing *CMZ : 3.15/06 06/04/92 18.09.57 by S.Giani +REP,GXINT,GXCONT,51. c Following changed from original DO 20 1,N for Phobos, 16-May-93: c In batch mode, use the number of events set in UGINIT IF (.NOT.BATCH) NEVENT = N IEVENT = 0 DO 20 WHILE (IEVENT .LT. NEVENT) \\+DECK,CORR_GXFZ. +ADD,GXINT,GXFZ,0. *CMZ : 15/11/93 23.18.38 by R. Verdier, M.I.T. * Added status to opens to avoid error warnings +REP,GXINT,GXFZ,36-38. c Declare status to avoid error warning: OPEN(UNIT=LUN,FILE=CHPATH(1:NCHPAT),FORM='FORMATTED', 1 STATUS='UNKNOWN') ELSE OPEN(UNIT=LUN,FILE=CHPATH(1:NCHPAT),FORM='UNFORMATTED', 1 STATUS='UNKNOWN') $! $ say "Creating Phobos SIM library ''f$logical("cm")'PHOSIM.CMZ:" $ cmz author Phobos make cm:PHOSIM.CMZ * Get GEANT includes from the GEANT card-image file. * Using the -t option on the ytoc command to preserve the original * times causes ALL patches to be read in, a CMZ bug. ytoc gc:GEANT315.CAR GCDES mess GEANT sequences from GEANT315.CAR have been copied into //PHOSIM/GCDES/. * Copy source files from PHOSIM_TEMP.CAR into //PHOSIM/SRC_FOR/. * Note the warning about ZZZ_DECK created from integer*4 finterr. mess The following Fortran error warning should be ignored: mdir SRC_FOR cdir SRC_FOR ftoc cf:PHOSIM_TEMP.CAR mess Fortran source files have been copied into //PHOSIM/SRC_FOR/. * Apply startup corrections use_corr cf:PHOSIM_TEMP.CORR * Correct the files and mark the obsolete ones. * The following should work with $USE; but $USE fails at LNS: update GEPHOB GUSTEP SETBATCH UGCIN UGEOM ZZZ_DECK delete -o BMVC BMTB COIL CRYB CRYS FILL OUTS SPEC ZZZ_DECK * Reorder alphabetically alpha_order dir mess Startup corrections have been applied to files in //PHOSIM/SRC_FOR/. * Save include files as KEEP decks cdir .. mdir SRC_INC cdir SRC_INC ytoc cf:PHOSIM_TEMP.INC mess Fortran include files have been copied into //PHOSIM/SRC_INC/. * Save modifications to GEANX interactive GEANT subroutines. cdir .. ytoc cf:GEANX_TEMP.CORR mess Phobos-specific modifications for GEANX have been copied into mess CORR_GXCONT and CORR_GXFZ in //PHOSIM/$CORR_GEANX/. * Save modified GXCONT and GXFZ. NB-- this is dangerous, as the * modifications cannot be applied twice; but we do it here to make * the CMZ library complete. * The patch containing the actual Fortran code is called GXINT. ytoc gc:GEANX315.CAR GXINT/GXCONT GXINT/GXFZ use_corr cf:GEANX_TEMP.CORR cdir GXINT update GXCONT GXFZ purge dir mess Phobos-modified Fortran files GXCONT and GXFZ have been saved mess in //PHOSIM/GXINT/. mess Note that the corrections in ...$CORR_Gxxx must not be reapplied. * Insert command procedure files cdir .. mdir CMD_COM cdir CMD_COM ttoc pc:CRESIMCMZ.COM ttoc pc:DEMO.COM ttoc pc:RMC.COM ttoc pc:RMCDEFS.COM ttoc pc:SMC.COM ttoc pc:LINKMC.COM ttoc pc:LMCDEFS.COM dir mess Command procedure .COM files have been inserted into //PHOSIM/CMD_COM/. * Insert KUIP macro files cdir .. mdir CMD_KUMAC cdir CMD_KUMAC ttoc pc:DRAWPHOB.KUMAC ttoc pc:INSTALL.KUMAC ttoc pc:TOPVIEW.KUMAC dir mess KUIP macro .KUMAC files have been inserted into //PHOSIM/CMD_KUMAC/. * Insert data files cdir .. mdir DATA_TXT cdir DATA_TXT ttoc pd:CONTDEMO.TXT ttoc pd:GEOCON.TXT ttoc pd:MAP_2T.TXT ttoc pd:UGCDATA.TXT ttoc pd:UGC_93_10.TXT dir mess Data .TXT files have been inserted into //PHOSIM/DATA_TXT/. * Insert document .DOC files cdir .. mdir DOC_DOC cdir DOC_DOC ttoc pdo:PMCUSER.DOC ttoc pd:STATUS.DOC dir mess Document files have been inserted into //PHOSIM/DOC_DOC/. * Assign initial version number 1.00 to everything: mess Please enter a description of this creation job in the $VERSION mess patch on the last empty comment line, for example: mess * Created by CRESIMCMZ.COM from Phobos_root:[sim.test...]: mess and then exit normally from the editor (ctrl-Z/ exit): version -s 1.00/0 * dir -L mess Creation of cm:PHOSIM.CMZ is now complete. exit $ del cf:PHOSIM_TEMP.CAR; $ del cf:PHOSIM_TEMP.INC; $ del cf:PHOSIM_TEMP.CORR; $ del cf:GEANX_TEMP.CORR; $! $ EXIT: $ if f$search("lastcmz.kumac") .nes. "" then purge lastcmz.kumac $ exit +DECK,DEMO ,T=DATA. *CMZU: 2.01/02 14/03/97 16.06.53 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.10.36 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.49.55 by Phobos (R. Verdier) *CMZU: 2.00/00 26/02/96 17.55.24 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.42 by Phobos *-- Author : $! DEMO.COM: A demonstration of the Phobos Monte Carlo for new users $ Vers = "PRO" ! NEW | PRO $! Usage: type $! $ define pc phobos_root:[sim.{new|pro}.cmd] $! $ @pc:demo $! and follow the instructions. $ say := write sys$output $ disp = p1 $ if disp .eqs. "X" .or. disp .eqs. "G" then goto HaveDisp $ say "Welcome to the Phobos Monte Carlo demonstration." $ say "" $ say "If you are running with a Phobos subdirectory as your default" $ say "directory, any created files will be left in that subdirectory;" $ say "if that is the case, please quit by entering at the next" $ say "prompt, and re-run the demo from your own directory." $ say "" $ AskDisp: $ say "What kind of display are you using? Please enter" $ say " x, for X-windows (VAXstation or X-emulator), or" $ inquire disp - " g, for GKS (Tektronix emulator: Macintosh or VAX Tek window)" $ HaveDisp: $ if disp .eqs. "G" $ then $ ExeName = "MCGD" $ else $ if disp .eqs. "X" $ then $ ExeName = "MCXD" $ else $ say "I don't know display type ''disp'." $ goto AskDisp $ endif $ endif $ if p1 .nes. "" then goto Run $ if disp .eqs. "X" $ then $ say "You must execute the VMS command" $ say " $ set display/create/user/transport=tcpip/node=" $ resp = "Y" $ inquire/nopunct resp - "If you have not already done that, shall I do it now (y/n) [y]? " $ if resp .nes. "N" $ then $ inquire/nopunct nodename "What is your node name? " $ set display/create/user/transport=tcpip/node='nodename' $ endif $ say "" $ say "When asked for your workstation type, enter 1." $ say "You can enter 0 for a display without graphics." $ say "You can enter 7878 for a Falco Tektronix 4014 emulation." $ endif $ if disp .eqs. "G" $ then $ say "" $ say "When asked for your workstation type, if you are in a Textronix" $ say "emulator enter 82 for color [4105] or 72 for mono [4014];" $ say "if you are in a VAXstation DECterm window, enter 211." $ say "You can enter for a display without graphics." $ endif $ say "If you enter ?, the program will list available types." $ say "" $ say "The program will now display some statistics and a GEANT > prompt. " $ say "Enter" $ say " exe pc:topview" $ say "to draw the Phobos detector; at the next prompt, enter" $ say " trig 1" $ say "to display the tracks from one event. The first event takes a" $ say "long time, because all the initializing is done at this point." $ say "" $ say "You can enter" $ say " next" $ say "to clear the screen, then repeat the draw / trig sequence." $ say "" $ say "At the end, type ""exit"" to exit the MC, or ""quit"" to abort it." $ say "Ntuples named DEMOTEMP.NTU and DEMOMCTEMP.NTU will exist in your area;" $ say "if you typed ""exit"" to stop, you can use PAW to scan them and plot" $ say "the data. If you typed ""quit"", the ntuples will be unusable." $ say "" $ say "You can also type any time to abort the demo (you may have" $ say "to do it twice). This will also leave the ntuples unusable." $ say "" $ say "In future, you can bypass the preceding dialogue by entering the" $ say "display type letter, x or g, following ""@pc:demo ""." $ inquire dummy "Now please press when you are ready to run the demo" $ Run: $ def/nolog/user pd phobos_root:[sim.'Vers'.dat], - phobos_root:[geo.test.data] $ def/nolog/user pe phobos_root:[sim.'Vers'.exe] $ def/nolog/user fldasc pd:MAP_2T.TXT $ def/nolog/user fldzbr pmc_dat:FIELD.ZBR ! Should not be necessary $ def/nolog/user gcdefs pd:UGCDATA.TXT $ def/nolog/user genevs - irene$dka300:[TEMPORARY.WOZNIAK]AUAU_HIJET_CENTR_100.ADAT $ def/nolog/user mcntu DEMOMCTEMP.NTU $ def/nolog/user rhasc nl: $ def/nolog/user rhdata pd:CONTDEMO.TXT $ def/nolog/user rhhst nl: $ def/nolog/user rhntu DEMOTEMP.NTU $ def/nolog/user rhzeb nl:DEMOTEMP.fz $ def/nolog/user sys$input sys$command $ run/nodebug pe:'ExeName' +DECK,RMC ,T=DATA. *CMZU: 2.03/00 23/07/97 11.07.04 by Phobos (R. Verdier) *-- Author : $! RMC: Run the Phobos MC at MIT $! Use: $! $ @rmc [outfiles] [logdefs] [debugopt] $! Example: $ @rmc hijet mcgd $! where $! Output files will be named "scratch:.xxx"; the default $! is "scratch:TEMP.xxx". $! Logdefs is the name of a command procedure, or a logical name $! assigned to a command procedure, that defines logical names $! required for RMC. This procedure must define the logical name $! scratch, and may also define the symbol Exename and any other $! logical names affecting the operation of RMC. $! Logdefs defaults to RMCDEFS. $! Exename is the name of the executable program. The standard form $! is pmc_exe:MC, where w is x for X-windows (DECwindows, on $! VAXstations) or g for GKS (Tektronix emulation), and d is d for $! a debug version or blank for non-debug. $! Exename defaults to pmc_exe:MCX. $! Debugopt non-blank will run under control of the VMS debugger; $! the default is to run without debugger control. $! $! After executing the rmc procedure, you can do additional $! interactive runs simply by entering $! $ 'rmc $! (note the apostrophe); this will use the same parameters as the $! original rmc call. $! 12-Mar-97 R. V. Updated default gcdefs, pmc_exe -> [...EXEVMS] $! 08-Nov-96 R. V. Updated map and geom filenames, removed test dat $! 13-Aug-96 R. V. Removed fldzbr, added batkumac $! 30-Jul-96 R. V. Added ASCII output file $! 16-Dec-93 R. V. Created from old RUNMC with changed arguments $! $ if f$mode() .eqs. "BATCH" then assign dummy sys$print $ Vers == "NEW" ! Define default version $ MagVers == "NEW" ! Default version for magnetic field map $ def/nolog pmc_dat phobos_root:[SIM.'Vers'.DAT] $ def/nolog pmc_exe phobos_root:[SIM.'Vers'.EXEVMS] $ outfile := temp $ if p1 .nes. "" then outfile := 'p1' $ Debugopt = "nodebug" $ if p3 .nes. "" then Debugopt = "debug" $! Define standard data files: $! Logical "genevs" defines the generated track file, if the $! rhdata file sets GEN to 0: $ def/nolog genevs - HANS$DKA200:[WOZNIAK.TEMPORARY]AUAU_HIJET_CENTR_100.ADAT $! Other files are also available, such as: $! phobos_root:[geant.fritiof]SIM_3E_AU_AU_200GEV_0P0_0P5.DAT $! Logical "rhdata" defines the simulation control options file: $ def/nolog rhdata pmc_dat:CONTROL.TXT $! Logical "gcdefs" defines the geometry text file: $ def/nolog gcdefs pmc_dat:UGCDATA_V37.TXT $! Logical "cards$def", if defined, allows the control options $! filename to be specified interactively; it is not defined here: $! def/nolog cards$def pmc_dat:CONTROL.TXT $! Logical "fldzbr" defines the Zebra bank specifying the magnetic $! field map when the geometry file sets MAGT to 0: this is obsolete $! def/nolog fldzbr pmc_dat:FIELD.ZBR $! Logical "batkumac" defines a file of kuip commands for use during $! batch operation; normally it should be undefined $! def/nolog batkumac ... $! Logical "fldasc" defines the ASCII file specifying the $! cylindrically symmetric ASCII magnetic field map when MAGT is 3: $ def/nolog fldasc phobos_root:[SIM.'MagVers'.DAT]PHOMAGV108.TXT $! Logical "rhhst" defines the output histogram file: $ def/nolog rhhst scratch:'outfile'.hst $! Logical "rhaou" defines the ASCII hits output file: $ def/nolog rhaou scratch:'outfile'aou.txt $! Logical "rhasc" defines the console output file, turned off here ***: $ def/nolog rhasc nl: ! scratch:'outfile'.asc ! to turn on $! Logical "rhntu" defines the ntuple output file for tracks with hits: $ def/nolog rhntu scratch:'outfile'.ntu $! Logical "mcntu" defines the ntuple output file for all tracks: $ def/nolog mcntu scratch:'outfile'mc.ntu $! Logical "rhzeb" defines the RZ-format Zebra bank output file: $ def/nolog rhzeb scratch:'outfile'.fz $! End of default file specifications $! $ Exename == "pmc_exe:MCX" $! Get user definitions $ if p2 .eqs. "" then p2 = "RMCDEFS" $ @'P2' $ Rmc == "run ''Exename'/''Debugopt'" $ if f$mode() .nes. "BATCH" then define/nolog sys$input sys$command $ 'Rmc' $ exit +DECK,RMCDEFS ,T=DATA. *CMZU: 2.03/00 23/07/97 11.07.05 by Phobos (R. Verdier) *-- Author : $! RMCDEFS.COM: Run definitions procedure file for Phobos MC $! This file is a template for a command procedure to be $! executed by RMC.COM that can redefine the default logicals $! used in running the Monte Carlo. $! To make your own version of this file, first copy it to a $! subdirectory in your own area, then uncomment (by removing $! "!") and modify any commands relevant to your application. $! Note that you must also remove the leading $! for continuation $! lines. $! In particular, you should check that Exename is correct for $! your workstation, and change *** to the area in which you want $! to create output files such as ntuples. $! The standard definitions below are taken from RMC.COM. $! 12-Mar-97 R.V. Updated data filenames $! 08-Nov-96 R.V. Updated map and geometry filenames $! 13-Aug-96: R. V. Removed fldzbr, added batkumac $! 30-Jul-96: R. V. Added ASCII output file $! 16-Dec-93: R. V. Sample version created from PHODEFS $! $! Definitions required by RMC: $! $ Exename == "pmc_exe:MCX.EXE" ! Version: X-windows, nodebug $ def/nolog scratch *** $! $! where $! Exename is the name of the executable program. The standard form $! is pmc_exe:MC, where w is x for X-windows (DECwindows, on $! VAXstations) or g for GKS (Tektronix emulation), and d is d for $! a debug version or blank for non-debug. $! Scratch is the directory in which you wish output files, such $! as ntuples, to be created. $! Normally, *** is disk$scratch:[]. $! $! To redefine the simulation options control file to be used: $! $! def/nolog rhdata []CONTROL.TXT $! $! where [] identifies a private directory. $! $! To use all data files taken from your private area, if they exist $! there, in preference to the standard versions: $! Note that when uncommenting this you must change $! to $ in $! the first two lines and remove $! from the third. $! Vers == "NEW" ! Define CMZ version as default $! def/nolog pmc_dat [], - $! phobos_root:[sim.'Vers'.dat] $! $! Optional definitions for special applications: $! $! To run a private test version of the MC linked in your scratch $! area: $! def/nolog pmc_exe scratch $! $! In addition to redefining directories, you can also redefine $! standard data filenames (as illustrated with rhdata above). $! These are the names and defaults: $! $! Logical "genevs" defines the generated track file, if the $! control options rhdata file sets GEN to 0: $! def/nolog genevs - $! irene$dka300:[TEMPORARY.WOZNIAK]AUAU_HIJET_CENTR_100.ADAT $! Other track files are also available, such as: $! phobos_root:[geant.fritiof]SIM_3E_AU_AU_200GEV_0P0_0P5.DAT $! $! Logical "rhdata" defines the simulation control options file: $! def/nolog rhdata pmc_dat:CONTROL.TXT $! $! Logical "gcdefs" defines the geometry text file: $! def/nolog gcdefs pmc_dat:UGCDATA_V37.TXT $! $! Logical "cards$def", if defined, allows the control options $! filename to be specified interactively; it is not defined here: $! def/nolog cards$def pmc_dat:CONTROL.TXT $! $! Logical "batkumac" defines a file of kuip commands for use during $! batch operation; normally it should be undefined: $! def/nolog batkumac ... $! $! Logical "fldasc" defines the ASCII file specifying the 3-d ASCII $! magnetic field map when MAGT is >= 2: $! def/nolog fldasc pmc_dat:PHOMAGV108.TXT $! $! Logical "rhhst" defines the output histogram file: $! def/nolog rhhst scratch:'outfile'.hst $! $! Logical "rhaou" defines the standard ASCII hits output file: $! def/nolog rhaou scratch:'outfile'aou.txt $! $! Logical "rhasc" defines the console output file, turned off here ***: $! def/nolog rhasc nl: ! scratch:'outfile'.asc ! to turn on $! $! Logical "rhntu" defines the ntuple output file for tracks with hits: $! def/nolog rhntu scratch:'outfile'.ntu $! $! Logical "mcntu" defines the ntuple output file for all tracks: $! def/nolog mcntu scratch:'outfile'mc.ntu $! $! Logical "rhzeb" defines the RZ-format Zebra bank output file: $! def/nolog rhzeb scratch:'outfile'.fz $! $! End of run definitions procedure file +DECK,SMC ,T=DATA. *CMZU: 2.02/01 01/05/97 14.33.56 by Phobos (R. Verdier) *CMZU: 2.01/02 14/03/97 16.07.50 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.13.13 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.52.27 by Phobos (R. Verdier) *CMZU: 2.00/00 26/02/96 17.53.04 by Phobos (R. Verdier) *CMZU: 2.00/00 08/10/95 09.05.31 by Phobos (R. Verdier) *-- Author : $! SMC.COM: submit the Phobos mc for batch execution $! Use: $ @smc [outfiles] [logdefs] [queue] $! Example: $ @smc hijet rmcx.com pierre$long $! will run the phobos MC by submitting RMC.COM as a long job, $! using control files defined by rmcx.com and with output files $! named HIJET.xxx. $! is the base name of the created ntuples and histogram $! files; it defaults to TEMP, creating TEMP.NTU and TEMPMC.NTU. $! is the name of the logical definitions command file; $! it defaults to RMCDEFS.COM. $! is the name of the desired batch queue. $! RMC.COM lists the required logical file definitions, and $! discusses logdefs and the output filenames. $! 22-May-96 R.V. Change default command area to PRO $! $! Set default command area: $ Vers = "NEW" $ def/nolog pmc_cmd phobos_root:[sim.'Vers'.cmd] $ if p1 .eqs. "" then p1 = "temp" $ if p2 .eqs. "" then p2 = "RMCDEFS.COM" $! Get the complete filename of logdefs for RMC: $ logdefs = f$search(p2) $ if logdefs .eqs. "" then logdefs = f$search("''p2'.COM") $ if logdefs .eqs. "" $ then $ write sys$output "SMC error: unable to find logdefs file ''p2'." $ else $! Execute logdefs in case it defines pmc_cmd and scratch: $ @'logdefs' $ Q := medium $ if p3 .nes. "" then Q := 'p3' $ submit/noprint/notify pmc_cmd:RMC/que='Q' - /log=scratch:'p1'/par=('p1','logdefs') $ endif +DECK,LINKMC ,T=DATA. *CMZU: 2.02/01 29/04/97 09.52.38 by Phobos (R. Verdier) *-- Author : $! LINKMC: Link the Phobos Monte Carlo executable image $! Use: $ @linkmc [Graphics] [Debug] [LinkDefs] [MakeExe] $! Example: $ @linkmc g n [user.test]ulink.com $! where $! Graphics = x or blank for X-windows (DECwindows, on VAXstations) $! = g for GKS or Tektronix emulation $! Debug = d for debug version, anything else for normal version $! LinkDefs = the name or logical name of a command procedure that $! can redefine the logical names and symbols that affect $! the link operation, and can also compile test versions $! of program modules for inclusion in the link. $! MakeExe = y to force the creation of a new executable $! = n to check revision dates but not create a new excutable $! = anything else to create a new excutable only if the $! existing one was revised earlier than the PMC library $! LINKMC creates the executable file pmc_exe:MC<|d>.EXE. $! The logical name pmc_exe, if unspecified, defaults to the user's $! current directory. This area will also be used for created .OBJ $! files. $! LINKMC executes the LinkDefs command procedure, whose default file $! name is LMCDEFS.COM. This procedure can define pmc_exe, and can $! also redefine other logicals assigned below, such as pmc_lib, $! pmc_src, and pmc_inc, to facilitate the testing of private versions $! of programs under development, by containing statements like $! $ def pmc_src [user.test],phobos_root:[sim.test.src] $! The template version phobos_root:[sim.test.cmd]LMCDEFS.COM contains $! working examples. $! MakeExe should be specified as y when linking user modifications. $! 25-Apr-97 R. V. Add symbol "main" to create postscript output version $! 12-Mar-97 R. V. Updated default pmc_exe -> [...EXEVMS] $! 31-May-96 R. V. Add UserLib to accommodate server files $! 01-Apr-95 R. V. Reflect changed library names and locations $! 08-Aug-94 R. V. Add Platform to eliminate isd_max for Alpha, $! MapOpt -> LinkOpt to include /nonative switch $! 18-Apr-94 R. V. Vers -> NEW; get GEANX315 from [cern.pro.lib]; $! remove local definition of phobos_root $! 16-Dec-93 R. V. Update locations of old CERN libs; eliminate pre- $! defined logicals; prompt for missing arguments; $! move compile procedure to LinkDefs. $! 10-Nov-93 R. V. New CERN libraries, GEANX315, LMCDEFS $! 06-Oct-93: R. V. Update location of cern libraries $! 03-Jun-93: R. V. Add and GEANX315; remove STREAMLIB. $! Note there are no undefineds in either old $! or 93c version. $! 05-May-93: R. V.: Use Cern 93c libraries; put isd_max inline $! 01-Dec-92: R. Verdier, M.I.T. $! $ if f$mode() .eqs. "BATCH" then assign dummy sys$print $ say = "write sys$output" $ ask = "inquire/nopunct" $! Use VMS system call to identify VAX or Alpha $ Platform = f$getsyi("arch_name") ! ("VAX" | "Alpha") $! Select source and library version as TEST, NEW, or PRO $ Vers = "NEW" $ if p1 .eqs. "" $ then $ ask p1 - "Please specify graphics mode as g for GKS or x for X11 (CR=x): " $ if p1 .nes. "G" then p1 = "X" $ endif $ if p2 .eqs. "" $ then $ ask p2 - "Please specify d for debug mode or n for normal mode (CR=d): " $ if p2 .nes. "N" then p2 = "D" $ endif $ Debug = 1 ! 1/0 for debug/nodebug $ if p2 .nes. "D" then Debug = 0 $ if p2 .nes. "D" then p2 = "" $! Define debug suffixes for various CERN libraries $ dbg = "" $ if Debug .ne. 0 then dbg = "_DBG" $ dbg1 = "_DEBUG" $ dbg2 = "" $ if p3 .eqs. "" $ then $ ask p3 - "Please enter the name of your LinkDefs file (CR=LMCDEFS.COM): " $ if p3 .eqs. "" then p3 = "LMCDEFS.COM" $ endif $ LinkOpt = "/nomap" ! "/map=pmc_exe:" ! for a link map $ if Platform .eqs. "Alpha" then LinkOpt = "''LinkOpt'/nonative" $! cern is defined system-wide at LNS as IRENE$DKA300:[APPLICATION.CERN.] $ def/nolog cernlib cern:[PRO.LIB] $ def/nolog geantlib cernlib:GEANT321'dbg2'.OLB $ def/nolog grafdgks cernlib:GRAFDGKS'dbg2'.OLB $ def/nolog graflib cernlib:GRAFLIB'dbg2'.OLB $ def/nolog grafx11 cernlib:GRAFX11'dbg2'.OLB $ def/nolog kernlib cernlib:KERNLIB'dbg2'.OLB $ def/nolog mathlib cernlib:MATHLIB'dbg2'.OLB $ def/nolog packlib cernlib:PACKLIB'dbg2'.OLB $ def/nolog pawlib cernlib:PAWLIB'dbg2'.OLB $! $! phobos_root is defined system_wide at LNS as _ARNOLD$DKA200:[PHOBOS.] $ def/nolog pmc_exe 'f$environment("DEFAULT")' $ ExeName = "pmc_exe:MC" + p1 + p2 + ".EXE" $ def/nolog pmc_cmd phobos_root:[SIM.'Vers'.CMD] $ def/nolog pmc_lib phobos_root:[SIM.'Vers'.LIBVMS] $ def/nolog pmclib pmc_lib:PMC'dbg'.OLB $! Server library area: $ def/nolog srv_lib phobos_root:[MCSERV.PRO.LIB] $! $! Set defaults for global symbols that can be reset by LinkDefs: $! Main program: $ main == "pmclib/inc=(GEPHOB)" $! Substitute the following to allow graphics metafile output: $! main == "cern$library:GXINT321.OBJ,pmclib/inc=(UGINIT,UGLAST)" $ SaveObj == 1 ! non-0 to save object modules $! List of user version object modules, must end with a comma if non-blank: $ UserObj == "" $ UserObjDel == "" $! Modules to be explicitly loaded from the Phobos library, $! rather than the dummy versions in the Geant library: $ Incs == "/inc=(GRUN,GUFLD,GUKINE,GUOUT,GUSTEP,GUTREV)" $! User libraries to be searched after Incs are loaded, must end with a $! comma if non-blank: $ UserLib == " " ! srv_lib:SERVER/LIB/INCL=(BLKDAT_SERV,UGSERV)," $! Get user override definitions. Try LinkDefs as a filename... $ LinkDefs := 'f$search(p3)' $! or a logical name... $ if LinkDefs .eqs. "" then LinkDefs := 'f$trnlnm("p3")' $! or a filename without .COM... $ if LinkDefs .eqs. "" $ then $ tmptmp := "''p3'.COM" $ LinkDefs := 'f$search(tmptmp)' $ endif $ if LinkDefs .nes. "" $ then $ say "LINKMC: executing user definitions file ", LinkDefs, "." $ @'LinkDefs' $ else $ ask reply - "User definitions file ''p3' not found. Continue without it (CR=no|yes)? " $ if reply .nes. "YES" then goto END $ endif $! Check that the library exists: $ LibFile := 'f$search("pmclib")' $ if LibFile .eqs. "" $ then $ say "LINKMC exiting: can't locate library ''f$trnlnm("pmclib")'." $ goto END $ endif $! Check whether the existing executable needs to be re-made: $ ExeFile := 'f$search(ExeName)' $ if ExeFile .nes. "" $ then $ LibRevTime := 'f$file_attributes("pmclib","RDT")' $ ExeRevTime := 'f$file_attributes(ExeName,"RDT")' $ say "Library ", LibFile, ":" $ say "Library was last revised on ", LibRevTime $ say "Executable ", ExeFile, ":" $ say "Executable was last revised on ", ExeRevTime $ if LibRevTime .lts. ExeRevTime $ then $ if f$extract(0,1,p4) .eqs. "Y" $ then $ say "Executable ", ExeFile, " is up-to-date, but a new " $ say "version will be created because the command line ", - "specified MakeExe = Y." $ else $ say "Executable ", ExeFile, " is up-to-date." $ goto END $ endif $ else $ if f$extract(0,1,p4) .eqs. "N" $ then $ say "Executable ", ExeFile, " is out-of-date, but a new ", - "version will" $ say "not be created because the command line specified MakeExe = N." $ goto END $ else $ say "Executable ", ExeFile, " is out-of-date." $ endif $ endif $ else $ if f$extract(0,1,p4) .eqs. "N" $ then $ say "Executable ", ExeName, " does not exist, but a new ", - "version will" $ say "not be created because the command line specified MakeExe = N." $ goto END $ endif $ endif $! **************************************************************** $! link $! **************************************************************** $ if Debug .ne. 0 then LINK := LINK/DEBUG $ goptfile := pmc_exe:TEMPGRAF.OPT $ open/write gopt 'goptfile' $! Choose X-windows or GKS graphics support: $ if p1 .nes. "G" $ then $ def/nolog glib grafx11 $ write gopt - "sys$share:DECW$XLIBSHR.EXE/share,DECW$DWTLIBSHR.EXE/SHARE" $! write gopt "cernlib:GETHOSTNAME" $ else $ def/nolog glib grafdgks $ if Platform .nes. "Alpha" $ then $ write gopt "sys$library:GKSFORBND/lib" ! in sys$share before 4/1/95 $! sys$library:VAXCRTL/lib is automatically linked in VMS 6.1 on $ else $ write gopt "sys$share:GKSFORBND_IEEE/lib" $ write gopt "sys$library:GKS3D$RTLIB_IEEE/share" $ endif $ endif $! As of CERN 94b, all versions need (but may not use) multinet refs: $ write gopt "multinet:MULTINET_SOCKET_LIBRARY.EXE/share" $ if Platform .nes. "Alpha" then write gopt "isd_max=250" $ close gopt $ define/nolog gopt 'goptfile' $! Note the link order determines whether Geant, Phobos, or private $! versions of modules are used. $ say "LINKMC: linking ", ExeName, " (pmc_exe is ", f$trnlnm("pmc_exe"), ")" $ LINK'LinkOpt'/exe='Exename' - 'main', - 'UserObj' - pmclib/lib'Incs', - 'UserLib' - geantlib/lib/inc=(GINTRI), - pawlib/lib, - graflib/lib, - packlib/lib/inclu=RZKEYD, - glib/lib, - kernlib/lib, - mathlib/lib, - gopt/opt, - pmclib/inc=(UNSATREFS) $ del 'goptfile'; $ if SaveObj .eq. 0 .and. UserObjDel .nes. "" $ then $ del "''UserObjDel'" $ endif $ write sys$output "LINKMC: created ", f$search(Exename), "." $ END: exit +DECK,LMCDEFS ,T=DATA. *CMZU: 2.02/01 29/04/97 09.52.48 by Phobos (R. Verdier) *-- Author : $! LMCDEFS.COM: User definitions procedure file for Phobos MC Link $! This file is a template for a command procedure to be $! executed by LINKMC.COM that can redefine the default logicals $! used in building the Monte Carlo executable and can also $! compile user versions of Phobos modules. $! To make your own version of this file, first copy it to a $! subdirectory in your own area, then uncomment (by removing $! "!") and modify any commands relevant to your application. $! Note that a working version of LMCDEFS for most applications $! may consist of only a few lines; for example $! $ def cernlib pequod$dkb100:[cern.lns_old.cern1.cern0.cernlib] $! $ def pmc_exe disk$scratch:[YourUserName] $! to link in your scratch area an executable image using an old $! version of the cern libraries. $! 25-Apr-97 R.V. Add symbol "main" to create postscript output version $! 12-Mar-97; R.V. Updated default pmc_exe -> [...EXEVMS] $! 08-Nov-96: R.V. Added SRV_LIB $! 22-Sep-95: R. Verdier Corrected UserObj documentation $! 18-Apr-94: R. Verdier Created from MMSDEFS for SIM.NEW $! $! Define PMC_EXE, the directory that will contain the created $! executable image. The default is your login directory. For $! example, change *** to disk$scratch:[YourUserName] and remove $! the "!" from the following line: $! def/nolog pmc_exe *** $! $! Define PMC_LIB, the location of the Phobos libraries: $! Vers = "NEW" $! def/nolog pmc_lib phobos_root:[SIM.'Vers'.LIBVMS] $! $! Define SRV_LIB, the Server library area: $! def/nolog srv_lib phobos_root:[MCSERV.PRO.LIB] $! $! Main program: $! main == "pmclib/inc=(GEPHOB)" $! Substitute the following to allow graphics metafile output: $! main == "cern$library:GXINT321.OBJ,pmclib/inc=(UGINIT,UGLAST)" $! $! **************************************************************** $! To compile test versions of programs, change "FALSE" to $! anything else, and change the filenames below to refer to $! your modified program(s). $! This version will recompile only missing object modules. $! Therefore, to change one or more of your modified subroutines, $! you must first delete their .OBJ module(s). $! You must also list the module names in UserObj, to include them $! in the link, and UserObjDel, if you want them deleted after use. $! The example here compiles and links test versions of GUKINE $! and PH_OUT. $! Since GUFLD, GUKINE, GUOUT, GUSTEP, GUTREV, GXCONT,and GXFZ $! are by default taken specifically from the Phobos library $! rather than from the Geant library, GUKINE is also removed $! from that list. $! **************************************************************** $! $ Compile = "FALSE" $ if Compile .eqs. "FALSE" then goto RET $! $! Define PMC_SRC, the area containing your modified source code: $ def/nolog pmc_src *** $! $! Define PMC_OBJ, the work area to contain created object modules: $ def/nolog pmc_obj pmc_exe $! $! Define the compile procedure appropriate for the value of the $! Debug variable set by LINKMC: $ debugopt = "" $ if Debug .ne. 0 then debugopt = "/debug/noopt" $! $! Compile subroutines whose object modules are missing. $! This could also be done by testing revision dates, as in $! LINKMC itself. $ say = "write sys$output" $ if f$search("pmc_obj:GUKINE.OBJ") .eqs. "" $ then $ fort'debugopt'/nolist/obj=pmc_obj: pmc_src:GUKINE $ say "LMCDEFS: compiled GUKINE with debug option = ", debugopt $ endif $ if f$search("pmc_obj:PH_OUT.OBJ") .eqs. "" $ then $ fort'debugopt'/nolist/obj=pmc_obj: pmc_src:PH_OUT $ say "LMCDEFS: compiled PH_OUT with debug option = ", debugopt $ endif $! $! Set symbol values for use by LINKMC. NOTE THAT THE DOUBLE $! EQUAL SIGN == IS NECESSARY TO PASS THE VALUE UP TO LINKMC. $! $! Set the object module save switch: $ SaveObj == 1 ! non-0 to save object modules $! $! Define UserObj, the list of user version object modules. If non- $! blank, the list must end with a comma. The list can extend over $! several lines, in which case each line except the last must end $! with a minus sign: $! UserObj == " " $! or $! UserObj == "pmc_obj:AA,BB," $! or $! UserObj == "pmc_obj:AA,BB," - $! + "WW,XX,YY," - $! + "ZZ," $ UserObj == "pmc_obj:GUKINE,PH_OUT," $! $! Define UserObjDel, the list of user version object modules to be $! deleted in case SaveObj is 0 (this can be continued on subsequent $! lines as with UserObj): $! UserObjDel == "" $ UserObjDel == "pmc_obj:GUKINE;,PH_OUT;" $! $! Define modules to be loaded explicitly from the Phobos $! library; here GUKINE has been removed from the list. $! Incs == "/inc=(GRUN,GUFLD,GUKINE,GUOUT,GUSTEP,GUTREV,GXCONT,GXFZ)" $ Incs == "/inc=(GRUN,GUFLD,GUOUT,GUSTEP,GUTREV,GXCONT,GXFZ)" $! $! Define UserLib, the library or libraries of user object modules. If $! non blank, the formatting rules are the same as for UserObj. $! UserLib == " " $! $! Define the location of the main program: this must be changed only $! if a modified version is to be used. $! PMCMain == "pmclib/inc=GEPHOB" $! $! In case the user modules have been separately created and $! stored in a private object module library, as will likely be $! the case in the CMZ code management environment, UserObj $! should specify the name of the library, say USERLIB, plus the $! modules to be included, in the form $! UserObj == "USERLIB/lib/incl=(GUKINE,PH_OUT)" $! In this case USERLIB can also be updated by LMCDEFS, if the $! compilation statements above are replaced by CMZ commands. $! For example, if the user subroutines are in a private library $! called USERLIB.CMZ, which has the standard Phobos CMZ directory $! structure, the following statements in LMCDEFS will update the $! private library USERLIB.OLB to include the latest versions of the $! user subroutines: $! $ CMZ $! file userlib $! set * -f $! set userlib -l $! sel type $! seq GCDES SRC_INC $! mkall $! exit $! $ RET: $! end of LMCDEFS +DECK,NEWSIM ,T=DATA. *CMZ : 1.01/14 10/08/94 14.56.56 by Phobos (R. Verdier) *-- Author : $! NEWSIM.COM: Make a NEW version of the Phobos SIM system $! Use: @newsim [operation] [confirm] [NewBase] [user] [password] $! Ex: @newsim create y disk$scratch:[user.phobos] username $! Operation = create | delete $! Confirm = y | noconfirm to confirm or not each operation $! NewBase = The parent directory for the created system $! User = Username for DECnet access to source files, if necessary $! Password = User password $! NEWSIM prompts for missing arguments; password will not echo. $! $! The modified parts of the CERN libraries handled here are: $! (1) GEANT common sequences extracted from GEANT315.CAR are stored $! in phobos_root:[CERN.PRO.INC]GCDES.CMZ, in GCDES//GCDES/blankdek. $! This is done to save time, but there is no automatic way to check $! whether CERN has changed them. $! (2) Modified subroutines from GEANX315.CAR are stored in //PHOSIM/MODCERN: $! GXINT allows TRIG to control the event loop. $! GXFZ eliminates a compiler warning on an OPEN statement. $! (3) The unmodified GEANX315 package is compiled in debug and non-debug $! VMS object libraries in phobos_root:[CERN.PRO.LIB], with source $! required by the debugger, in [CERN.PRO.SRC], to allow linking $! with the modified subroutines. $! (4) Eventually a version of GRUN that handles no-limit VMS batch $! queues will be put in phobos_root:[CERN.PRO.SRC] and [.LIB]. $! 08-Aug RV Change cz to [...cern.pro.cmz]; $! Change clib $use to update xxxx / clib * as $use * seems $! to be required on alpha. $! Put original GEANX programs in //PHOSIM/GXINT/, original $! GEANT programs in //PHOSIM/GBASE/, all modified versions $! in //PHOSIM/MODCERN/ $! Redefine oc, cg, and Access for local access. $! 22-May RV remove CMZ author line, should be done by CMZLOGIN or parameter $! 04-May RV generalize for Ralph1 $! 21-Mar RV generalize for VAX / Alpha / Test. Blank access control $! doesn't work yet. $! 03-Mar RV NEWCMZ -> CMZ for PPCAL $! 21-Feb-94: R. Verdier $! $! Definitions for the created files: $! NewBase = "dkb100:[PHOBOS]" ! PPCAL $! NewBase = "dkb100:[**USER**.PHOBOS]" ! PPCAL $! NewBase = "disk$csc:[PHOBOS]" ! PIERRE $ NewBase = "disk$scratch:[**USER**.PHOBOS]" ! TEST $! NewBase = "niels$dua0:[**USER**.PHOBOS]" ! TEST $! NewBase = "_ralph1$dkb200:[SCRATCH.**USER**.PHOBOS]" ! RALPH1 $! $! Definitions for the source files: $ CMZCAR = "CAR" ! "CMZ" ! Source for CMZ library $ RemDisk = "disk$csc" ! "dkb100" ! Disk containing SIM source files $ RemNode = "PIERRE" ! "PPCAL" ! Node for DECNet access to cluster disks $! $! Miscellaneous definitions: $ CMZC = "CMZ" ! Command that runs CMZ $ Ssy = "SIM" ! Subsystem $ Vers = "NEW" ! Version $! $! Access string defaults $ access = "LOCAL" ! Default if sources are available without an access string $ user = "" $ psw = "" $! $! Derived source file logicals: $! Source file logicals oz, oc, and cg are defined below after the $! access string, "access", is specified. $! $! Derived created file logicals: $! New_root is the equivalent of Phobos_root for the new system, $! definition deferred until NewBase is specified $! def/nolog New_root dkb100:[PHOBOS.] ! PPCAL $! def/nolog New_root phobos_root: ! PIERRE $ def/nolog New_root disk$scratch:[**USER**.PHOBOS.] ! TEST $! def/nolog New_root niels$dua0:[**USER**.PHOBOS.] ! TEST $! def/nolog New_Root ralph1$dkb200:[SCRATCH.**USER**.PHOBOS.] ! RALPH1 $! $ say = "write sys$output" $! $ ASK: $ if p1 .eqs. "" $ then $ say "Please enter the word $ say " create to create a complete new version of the ''SsyVer' system, or" $ inquire/nopunc p1 - " delete to delete all the files in the ''SsyVer' sytem: " $ endif $ if p3 .eqs. "" $ then $ say "Name of the new base directory:" $ inquire/nopunc p3 "[''NewBase']: " $ endif $ if p3 .nes. "" then NewBase = p3 $! Create created file logicals $ NewRootSym = NewBase-"]"+".]" $ def/nolog New_root 'NewRootSym' $ say "Files will be created in ", f$trnlnm("New_root") $ def/nolog ci New_root:[CERN.PRO.INC] $ def/nolog cl New_root:[CERN.PRO.LIB] $ def/nolog cs New_root:[CERN.PRO.SRC] $ def/nolog cz New_root:[CERN.PRO.CMZ] $ SsyVer = "''Ssy'.''Vers'" $ def/nolog nc New_root:['SsyVer'.CMD] $ def/nolog ncar New_root:['SsyVer'.CMZ] $ def/nolog nd New_root:['SsyVer'.DAT] $ def/nolog ne New_root:['SsyVer'.EXE] $ def/nolog ni New_root:['SsyVer'.INC] $ def/nolog nl New_root:['SsyVer'.LIB] $ def/nolog no New_root:['SsyVer'.DOC] $ def/nolog nr New_root:['SsyVer'.CRA] $ def/nolog ns New_root:['SsyVer'.SRC] $ def/nolog nz New_root:['SsyVer'.CMZ] $ if p2 .eqs. "" $ then $ say "Do you want to confirm operations for files or sections " $ inquire/nopunc p2 "individually (y|n) [y]? " $ if p2 .eqs. "N" then p2 = "NOCONFIRM" $ endif $ conf = p2 .nes. "NOCONFIRM" $ if p1 .eqs. "CREATE" then goto CREATE $ if p1 .eqs. "DELETE" then goto CLEAR $ p1 = "" $ goto ASK $! $ CREATE: $ if .not. conf $ then $ inquire/nopunc rep - "Use PHOSIM.CAR or PHOSIM.CMZ as the source (car|cmz) [cmz]? " $ if rep .eqs. "CAR" then CMZCAR = "CAR" $ say "Operation will now proceed without requiring any confirmation." $ rep = "Y" $ endif $ if conf $ then $ type sys$input: The following sections create the VMS directory structure. Directories that already exist will not be deleted and recreated. $ inquire/nopunc rep - "Do you want to create the new ''SsyVer' VMS directories (y|n) [n]? " $ endif $ if rep .nes. "Y" then goto MAKEPHOCERN $ type sys$input: DO NOT USE CTRL/Y TO ABORT THIS PROCESS WHILE CREATING DIRECTORIES! IT MAY LEAVE THE DIRECTORY STRUCTURE INVALID AND REQUIRE SYSTEM PRIVILEGES TO CORRECT IT. INSTEAD, WAIT UNTIL IT COMPLETES, AND THEN USE THIS PROCEDURE'S "DELETE" OPTION TO DELETE THE DIRECTORIES. $ if f$search("''NewBase'*.*") .eqs. "" then create/dir 'NewBase' $ if f$search("New_root:[000000]''Ssy'.DIR") .eqs. "" then - create/dir New_root:['Ssy'] $ if f$search("New_root:[''Ssy']''Vers'.DIR") .eqs. "" then - create/dir New_root:['SsyVer'] $ if f$search("New_root:[''SsyVer']CMD.DIR") .eqs. "" then - create/dir nc $ if f$search("New_root:[''SsyVer']CMZ.DIR") .eqs. "" then - create/dir nz $ if f$search("New_root:[''SsyVer']CRA.DIR") .eqs. "" then - create/dir nr $ if f$search("New_root:[''SsyVer']DAT.DIR") .eqs. "" then - create/dir nd $ if f$search("New_root:[''SsyVer']DOC.DIR") .eqs. "" then - create/dir no $ if f$search("New_root:[''SsyVer']EXE.DIR") .eqs. "" then - create/dir ne $ if f$search("New_root:[''SsyVer']INC.DIR") .eqs. "" then - create/dir ni $ if f$search("New_root:[''SsyVer']LIB.DIR") .eqs. "" then - create/dir nl $ if f$search("New_root:[''SsyVer']SRC.DIR") .eqs. "" then - create/dir ns $ say "VMS directories ",f$logical("New_root"),":[''SsyVer'...] created." $! $ MAKEPHOCERN: $! $ Csy = "CERN" $ CVer = "PRO" $ if conf then inquire/nopunc rep - "Do you want to create the new [''Csy'.''CVer' subdirectories (y|n) [n]? " $ if rep .nes. "Y" then goto MAKECMZ $ type sys$input: DO NOT USE CTRL/Y TO ABORT THIS PROCESS WHILE CREATING DIRECTORIES! IT MAY LEAVE THE DIRECTORY STRUCTURE INVALID AND REQUIRE SYSTEM PRIVILEGES TO CORRECT IT. INSTEAD, WAIT UNTIL IT COMPLETES, AND THEN USE THIS PROCEDURE'S "DELETE" OPTION TO DELETE THE DIRECTORIES. $ if f$search("New_root:[000000]''Csy'.DIR") .eqs. "" then - create/dir New_root:['Csy'] $ if f$search("New_root:[''Csy']''CVer'.DIR") .eqs. "" then - create/dir New_root:['Csy'.'CVer'] $ if f$search("New_root:[''Csy'.''CVer']INC.DIR") .eqs. "" then - create/dir New_root:['Csy'.'CVer'.INC] $ if f$search("New_root:[''Csy'.''CVer']LIB.DIR") .eqs. "" then - create/dir New_root:['Csy'.'CVer'.LIB] $ if f$search("New_root:[''Csy'.''CVer']SRC.DIR") .eqs. "" then - create/dir New_root:['Csy'.'CVer'.SRC] $ say "VMS directories ",f$trnlnm("New_root"),":[''Csy'.''CVer'...] created." $! $ MAKECMZ: $! $ if conf $ then $ type sys$input: The following sections create, but do not fill, the CMZ libraries. Libraries that already exist will not be deleted and recreated. $ inquire/nopunc rep - "Do you want to create the new SIM CMZ library (y|n) [n]? " $ endif $ if rep .nes. "Y" then goto MAKEGC $ say "Creating ''f$trnlnm("nz")'PHOSIM.CMZ and its subdirectories:" $ 'cmzc' * The Phobos SIM CMZ library: make nz:PHOSIM mdir COM mdir DOC mdir FOR mdir INC mdir KUMAC mdir MODCERN mdir TXT mdir $MOD_GEANX mdir $VERSION exit $! $ MAKEGC: $! $ if conf then inquire/nopunc rep - "Do you want to create the new GEANT GCDES CMZ library (y|n) [n]? " $ if rep .nes. "Y" then goto MAKEGX $ say "Creating ''f$trnlnm("ci")'GCDES.CMZ and subdirectory GCDES." $ 'cmzc' * The GEANT Common Descriptor CMZ library: make ci:GCDES mdir GCDES exit $ MAKEGX: if conf then inquire/nopunc rep - "Do you want to create the new GEANT interactive CMZ library (y|n) [n]? " $ if rep .nes. "Y" then goto COPY $ say "Creating ''f$trnlnm("cz")'GEANX315.CMZ." $ 'cmzc' * The GEANX interactive GEANT CMZ library: make cz:GEANX315.CMZ exit $! $ COPY: $ if conf $ then $ type sys$input: The following sections fill the created CMZ libraries. $ inquire/nopunc rep - "Do you want to fill the newly created CMZ libraries (y|n) [n]? " $ endif $ if rep .nes. "Y" then goto EXTRACT $ user = p4 $ psw = p5 $ cconsw = "/PROT=W:RE" $ if conf then cconsw = "/PROT=W:RE/CONF" $ if Access .nes. "LOCAL" $ then $ if user .eqs. "" $ then $ inquire/nopunc user "Please enter an access username if necessary: " $ endif $ if psw .eqs. "" $ then $ set term/noecho $ inquire/nopunc psw "Please enter password; it will not echo: " $ set term/echo $ endif $ if user .nes. "" then access = "''user' ''psw'" $ endif $! Define the remote source logicals oc: for SIM and cg: for CERN CAR files $ if access .eqs. "LOCAL" $ then $ def/nolog oc New_root:[SIM.NEW.CMZ] $ def/nolog cg cern:[PRO.SRC.CAR] $ else $ if access .nes. "" $ then $ def/nolog oc 'RemNode'"""''access'"""::'RemDisk':[PHOBOS.SIM.NEW.CMZ] $ def/nolog cg 'RemNode'"""''access'"""::hans$dka100:[CERN.PRO.SRC.CAR] $ else $ def/nolog oc 'RemNode'::'RemDisk':[PHOBOS.SIM.NEW.CMZ] $ def/nolog cg 'RemNode'::hans$dka100:[CERN.PRO.SRC.CAR] $ endif $ endif $! $ GETCAR: $ if .not. conf .and. cmzcar .eqs. "CMZ" then goto GETCMZ $ if conf then inquire/nopunc rep - "Do you want to copy the PHOSIM CAR file into the new directory (y|n) [n]? " $ if rep .eqs. "Y" $ then $ say "Copying PHOSIM.CAR to ''f$trnlnm("ncar"):" $ copy'cconsw' oc:PHOSIM.CAR ncar: $ dir/da/siz ncar:*.CAR $ endif $ if conf then inquire/nopunc rep - "Do you want to fill the PHOSIM.CMZ library from PHOSIM CAR (y|n) [n]? " $ if rep .nes. "Y" then goto GETCMZ $ say "Filling library PHOSIM.CMZ from PHOSIM.CAR" $ 'cmzc' file nz:PHOSIM * Use the T option to preserve the date and time arc ncar:PHOSIM.CAR exit $ goto GETGCZ $! $ GETCMZ: $ if conf then inquire/nopunc rep - "Do you want to copy the contents of PHOSIM.CMZ from the source (y|n) [n]? " $ if rep .nes. "Y" then goto GETGCZ $ say "Copying CMZ libraries to ''f$trnlnm("nz")'.CMZ." $ if access .nes. "" $ then $ def/nolog oz 'RemNode'"""''access'"""::'RemDisk':[PHOBOS.SIM.NEW.CMZ] $ else $ def/nolog oz 'RemNode'::'RemDisk':[PHOBOS.SIM.NEW.CMZ] $ endif $! Copy here could be a single CMZ statement; this allows selection. $ 'cmzc' file nz:PHOSIM file oz:PHOSIM -r mess Master library oz:PHOSIM attached as PHOSIM_1. mess Copying command procedures to //PHOSIM/COM. copy //PHOSIM_1/COM/* //PHOSIM/COM mess Copying documentation decks to //PHOSIM/DOC. copy //PHOSIM_1/DOC/* //PHOSIM/DOC mess Copying source decks to //PHOSIM/FOR. copy //PHOSIM_1/FOR/* //PHOSIM/FOR mess Copying include decks to //PHOSIM/INC. copy //PHOSIM_1/INC/* //PHOSIM/INC mess Copying KUIP macros to //PHOSIM/KUMAC. copy //PHOSIM_1/KUMAC/* //PHOSIM/KUMAC mess Copying unmodified GEANT interactive decks to //PHOSIM/GXINT. copy //PHOSIM_1/GXINT/* //PHOSIM/GXINT mess Copying unmodified GEANT decks to //PHOSIM/GBASE. copy //PHOSIM_1/GBASE/* //PHOSIM/GBASE mess Copying modified GEANT decks to //PHOSIM/MODCERN. copy //PHOSIM_1/MODCERN/* //PHOSIM/MODCERN mess Copying text data decks to //PHOSIM/TXT. copy //PHOSIM_1/TXT/* //PHOSIM/TXT mess Copying correction decks for GEANX to PHOSIM/$MOD_GEANX. copy //PHOSIM_1/$MOD_GEANX/* //PHOSIM/$MOD_GEANX/ mess Copying correction decks for GEANT to PHOSIM/$MOD_GEANT. copy //PHOSIM_1/$MOD_GEANT/* //PHOSIM/$MOD_GEANT/ exit $! $ GETGCZ: if conf then inquire/nopunc rep - "Do you want to copy the GEANT common sequences to GCDES.CMZ (y|n) [n]? " $ if rep .nes. "Y" then goto EXTRACT $ say "Copying GEANT common sequences to ''f$trnlnm("nz")'.CMZ." $ 'cmzc' file ci:GCDES mess Copying GEANT common sequences to //GCDES/GCDES/blankdek. sel type arc cg:GEANT315.CAR GCDES * The GEANX315 interactive GEANT code is brought in below, in COMP4 ff, * as when needed. It could be brought in here, as part of lib creation. exit $! $ EXTRACT: $ if conf $ then $ type sys$input: The following sections extract ASCII files from the CMZ libraries, overwriting any existing versions. $ inquire/nopunc rep - "Do you want to make ASCII versions of the command procedures (y|n) [n]? " $ endif $ if rep .nes. "Y" then goto EXT2 $ say "Extracting command procedures into ''f$trnlnm("nc")'*.COM." $ 'cmzc' file nz:PHOSIM -r cdir //PHOSIM/COM set nc:*.COM -f text ctot * $ EXT2: if conf then inquire/nopunc rep - "Do you want to make ASCII versions of the document decks (y|n) [n]? " $ if rep .nes. "Y" then goto EXT3 $ say "Extracting document decks into ''f$trnlnm("no")'*.DOC." $ 'cmzc' file nz:PHOSIM -r cdir //PHOSIM/DOC set no:*.DOC -f text ctot * $ EXT3: $ if conf then inquire/nopunc rep - "Do you want to make ASCII versions of the INCLUDE files (y|n) [n]? " $ if rep .nes. "Y" then goto EXT4 $ say "Extracting include files into ''f$trnlnm("ni")'*.INC." $ 'cmzc' file nz:PHOSIM -r cdir //PHOSIM/INC set ni:*.INC -f text ctot * $ EXT4: $ if conf then inquire/nopunc rep - "Do you want to make ASCII versions of the KUIP macros (y|n) [n]? " $ if rep .nes. "Y" then goto EXT5 $ say "Extracting KUIP macros into ''f$trnlnm("nc")'*.KUMAC." $ 'cmzc' file nz:PHOSIM -r cdir //PHOSIM/KUMAC set nc:*.KUMAC -f text ctot * $ EXT5: $ if conf then inquire/nopunc rep - "Do you want to make ASCII versions of the text data files (y|n) [n]? " $ if rep .nes. "Y" then goto EXT6 $ say "Extracting text data files into ''f$trnlnm("nd")'*.TXT." $ 'cmzc' file nz:PHOSIM -r cdir //PHOSIM/TXT set nd:*.TXT -f text ctot * $ EXT6: $! $ COMPILE: $ if conf $ then $ type sys$input: The following sections compile the SIM source code, overwriting any existing versions. $ say - "Do you want to compile source decks into a non-debug version" $ inquire/nopunc rep "object library (y|n) [n]? " $ endif $ if rep .nes. "Y" then goto COMP1 $ say "Creating compilable source decks in ''f$trnlnm("ns")'*.FOR" $ say "Compiling source decks into non-debug version object library" $ say "in ''f$trnlnm("ns")'PMC.OLB" $ 'cmzc' file nz:PHOSIM -r file ci:GCDES -r sel type seq //PHOSIM/INC seq //GCDES/GCDES cdir //PHOSIM/FOR set ns:*.FOR -F set nl:PMC -L set '$ for/obj=$COMPFILE.OBJ $COMPFILE' -C cdir //PHOSIM/FOR clib * exit $! $ COMP1: $ if conf then say - "Do you want to compile source decks into a debug-version" $ if conf then inquire/nopunc rep "object library (y|n) [n]? " $ if rep .nes. "Y" then goto COMP2 $ say "Creating compilable source decks in ''f$trnlnm("ns")'*.FOR" $ say "Compiling source decks into debug-version object library" $ say "in ''f$trnlnm("nl")'PMC_DBG.OLB" $ 'cmzc' file nz:PHOSIM -r file ci:GCDES -r sel type seq //PHOSIM/INC //GCDES/GCDES cdir //PHOSIM/FOR set ns:*.FOR -F set nl:PMC_DBG -L set '$ for/debug/noopt/obj=$COMPFILE.OBJ $COMPFILE' -C cdir //PHOSIM/FOR clib * exit $! $ COMP2: $ if conf then say - "Do you want to compile modified GEANT decks into a non-debug version" $ if conf then inquire/nopunc rep "object library (y|n) [n]? " $ if rep .nes. "Y" then goto COMP3 $ say "Creating compilable source decks in ''f$trnlnm("ns")'*.FOR" $ say "Compiling modified interactive GEANT source decks into non-debug" $ say "version object library ''f$trnlnm("nl")'PMC.OLB" $ 'cmzc' file nz:PHOSIM file ci:GCDES -r sel type seq //GCDES/GCDES set ns:*.FOR -F set nl:PMC -L set '$ for/obj=$COMPFILE.OBJ $COMPFILE' -C * Save original GRUN in //PHOSIM/GBASE/, and modified in //PHOSIM/MODCERN/ * The patch containing GRUN is GBASE. cdir //PHOSIM arc cg:GEANT315.CAR GBASE/GRUN use_corr -p /$MOD_GEANT cdir GBASE update GRUN copy -B ../MODCERN/ del GRUN mess Modified GRUN saved in //PHOSIM/MODCERN/. * Save original GXCONT and GXFZ in //PHOSIM/GXINT/, modified in * //PHOSIM/MODCERN/. The patch containing them is GXINT. use . buf . cdir //PHOSIM arc cg:GEANX315.CAR GXINT/GXCONT GXINT/GXFZ use_corr -p /$MOD_GEANX cdir GXINT update GXCONT GXFZ copy -B ../MODCERN/ del GXCONT GXFZ mess Modified interactive GEANT decks saved in //PHOSIM/MODCERN/. clib ../MODCERN/* mess Modified GEANT decks compiled. exit $! $ COMP3: $ if conf then say - "Do you want to compile modified GEANX decks into a debug-version" $ if conf then inquire/nopunc rep "object library (y|n) [n]? " $ if rep .nes. "Y" then goto COMP4 $ say "Creating compilable source decks in ''f$trnlnm("ns")'*.FOR" $ say "Compiling modified interactive GEANT source decks into debug-" $ say "version object library ''f$trnlnm("nl")'PMC_DBG.OLB" $! Note: this should not recopy the decks, only recompile as part $! of the previous set-- change to query both and save flag. $ 'cmzc' file nz:PHOSIM file ci:GCDES -r sel type seq //GCDES/GCDES set ns:*.FOR -F set nl:PMC_DBG -L set '$ for/debug/noopt/obj=$COMPFILE.OBJ $COMPFILE' -C cdir //PHOSIM use_corr -p /$MOD_GEANT arc cg:GEANT315.CAR GBASE/GRUN cdir GBASE update $use copy -B ../MODCERN/ del GRUN mess Modified GRUN saved in //PHOSIM/MODCERN/. use . buf . cdir //PHOSIM use_corr -p /$MOD_GEANX arc cg:GEANX315.CAR GXINT/GXCONT GXINT/GXFZ cdir GXINT update $use copy -B ../MODCERN/ del GXCONT GXINT mess Modified interactive GEANT decks saved in //PHOSIM/MODCERN/. clib ../MODCERN/* mess Modified GEANT decks compiled. exit $! $ COMP4: $ if conf then say - "Do you want to compile unmodified GEANX decks into a non-debug version" $ if conf then inquire/nopunc rep "object library (y|n) [n]? " $ if rep .nes. "Y" then goto COMP5 $ say "Creating compilable versions of unmodified interactive GEANT decks" $ say "in ''f$trnlnm("ns")'GX*.FOR" $ say "Compiling unmodified interactive GEANT source decks into non-debug" $ say "version object library in ''f$trnlnm("cl")'GEANX315.OLB" $ 'cmzc' file ci:GCDES -r file cz:GEANX315.CMZ * Patch GXINT contains the Fortran code. arc cg:GEANX315.CAR GXINT seq //GCDES/GCDES set cs:*.FOR -F set cl:GEANX315 -L set '$ for/obj=$COMPFILE.OBJ $COMPFILE' -C clib * exit $ say "The above Fortran informational messages about GXFZ may be ignored." $! $ COMP5: $ if conf then say - "Do you want to compile unmodified GEANX decks into a debug-version" $ if conf then inquire/nopunc rep "object library (y|n) [n]? " $ if rep .nes. "Y" then goto COMP6 $ say "Creating compilable versions of unmodified interactive GEANT decks" $ say "in ''f$trnlnm("ns")'GX*.FOR" $ say "Compiling unmodified interactive GEANT source decks into debug-" $ say "version object library in ''f$trnlnm("cl")'GEANX315_DBG.OLB" $ 'cmzc' file ci:GCDES -r file cz:GEANX315.CMZ * Patch GXINT contains the Fortran code. arc cg:GEANX315.CAR GXINT seq //GCDES/GCDES set cs:*.FOR -F set cl:GEANX315_DBG -L set '$ for/debug/noopt/obj=$COMPFILE.OBJ $COMPFILE' -C clib * exit $ say "The above Fortran informational messages about GXFZ may be ignored." $! $ COMP6: $ DEASSIGN: if f$logical("oc") .nes. "" then deassign oc $ if f$logical("cg") .nes. "" then deassign cg $ goto EXIT $! $ CLEAR: $ if .not. conf then rep = "Y" $ consw = "" $! Delete ['SsyVer'.CMD] directory and its contents $ if f$search("New_root:[''SsyVer']CMD.DIR") .nes. "" $ then $ if f$search("nc:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then say - "Do you want to delete all the files in ''f$trnlnm("nc")'" $ if conf then inquire/nopunc rep - "without individual confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' nc:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']CMD.DIR $ del'consw' New_root:['SsyVer']CMD.DIR; $ endif $! $! Delete ['SsyVer'.CMZ] directory and its contents $ if f$search("New_root:[''SsyVer']CMZ.DIR") .nes. "" $ then $ if f$search("nz:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("nz")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' nz:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']CMZ.DIR $ del'consw' New_root:['SsyVer']CMZ.DIR; $ endif $! $! Delete ['SsyVer'.CRA] directory and its contents $ if f$search("New_root:[''SsyVer']CRA.DIR") .nes. "" $ then $ if f$search("nr:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("nr")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ if conf then inquire/nopunc rep - $ del'consw' nr*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']CRA.DIR $ del'consw' New_root:['SsyVer']CRA.DIR; $ endif $! $! Delete ['SsyVer'.DAT] directory and its contents $ if f$search("New_root:[''SsyVer']DAT.DIR") .nes. "" $ then $ if f$search("nd:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("nd")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' nd:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']DAT.DIR $ del'consw' New_root:['SsyVer']DAT.DIR; $ endif $! $! Delete ['SsyVer'.DOC] directory and its contents $ if f$search("New_root:[''SsyVer']DOC.DIR") .nes. "" $ then $ if f$search("no:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("no")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' no:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']DOC.DIR $ del'consw' New_root:['SsyVer']DOC.DIR; $ endif $! $! Delete ['SsyVer'.EXE] directory and its contents $ if f$search("New_root:[''SsyVer']EXE.DIR") .nes. "" $ then $ if f$search("ne:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("ne")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' ne:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']EXE.DIR $ del'consw' New_root:['SsyVer']EXE.DIR; $ endif $! $! Delete ['SsyVer'.INC] directory and its contents $ if f$search("New_root:[''SsyVer']INC.DIR") .nes. "" $ then $ if f$search("ni:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("ni")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' ni:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']INC.DIR $ del'consw' New_root:['SsyVer']INC.DIR; $ endif $! $! Delete ['SsyVer'.LIB] directory and its contents $ if f$search("New_root:[''SsyVer']LIB.DIR") .nes. "" $ then $ if f$search("nl:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("nl")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' nl:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']LIB.DIR $ del'consw' New_root:['SsyVer']LIB.DIR; $ endif $! $! Delete ['SsyVer'.SRC] directory and its contents $ if f$search("New_root:[''SsyVer']SRC.DIR") .nes. "" $ then $ if f$search("ns:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("ns")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' ns:*.*;* $ endif $ set prot=(o:RWED) New_root:['SsyVer']SRC.DIR $ del'consw' New_root:['SsyVer']SRC.DIR; $ endif $! $! Delete ['SsyVer'] directory $ consw = "" $ if conf then consw = "/conf" $ if f$search("New_root:[''Ssy']NEW.DIR") .nes. "" $ then $ set prot=(o:RWED) New_root:['Ssy']NEW.DIR $ del'consw' New_root:['Ssy']NEW.DIR; $ endif $! Delete ['Ssy'] directory $ if f$search("New_root:[000000]''Ssy'.DIR") .nes. "" $ then $ set prot=(o:RWED) New_root:[000000]'Ssy'.DIR $ del'consw' New_root:[000000]'Ssy'.DIR; $ endif $! $! Delete [CERN.PRO.INC] directory and its contents $ consw = "" $ if conf then consw = "/conf" $ if f$search("New_root:[CERN.PRO]INC.DIR") .nes. "" $ then $ if f$search("ci:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("ci")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' ci:*.*;* $ endif $ set prot=(o:RWED) New_root:[CERN.PRO]INC.DIR $ del'consw' New_root:[CERN.PRO]INC.DIR; $ endif $! $! Delete [CERN.PRO.LIB] directory and its contents $ consw = "" $ if conf then consw = "/conf" if f$search("New_root:[CERN.PRO]LIB.DIR") .nes. "" $ then $ if f$search("cl:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("cl")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' cl:*.*;* $ endif $ set prot=(o:RWED) New_root:[CERN.PRO]LIB.DIR $ del'consw' New_root:[CERN.PRO]LIB.DIR; $ endif $! $! Delete [CERN.PRO.SRC] directory and its contents $ consw = "" $ if conf then consw = "/conf" $ if f$search("New_root:[CERN.PRO]SRC.DIR") .nes. "" $ then $ if f$search("cs:*.*") .nes. "" $ then $ consw = "/conf" $ if conf then inquire/nopunc rep - "Delete files in ''f$trnlnm("cs")' without confirmation (y|n) [n]? " $ if rep .eqs. "Y" then consw = "" $ del'consw' cs:*.*;* $ endif $ set prot=(o:RWED) New_root:[CERN.PRO]SRC.DIR $ del'consw' New_root:[CERN.PRO]SRC.DIR; $ endif $! Delete [CERN.PRO] directory $ consw = "" $ if conf then consw = "/conf" $ if f$search("New_root:[CERN]PRO.DIR") .nes. "" $ then $ set prot=(o:RWED) New_root:[CERN]PRO.DIR $ del'consw' New_root:[CERN]PRO.DIR; $ endif $! Delete [CERN] directory $ if f$search("New_root:[000000]CERN.DIR") .nes. "" $ then $ if conf then inquire/nopunc rep - "Do you want to delete the [CERN] directory? (y|n) [n]? " $ if rep .eqs. "Y" $ then $ set prot=(o:RWED) New_root:[000000]CERN.DIR $ del New_root:[000000]CERN.DIR; $ endif $ endif $ dir New_root:[000000] $ say "If you wish to delete the root directory, you must now reset its" $ say " protection and delete it by hand." $ EXIT: $ if f$search("lastcmz.kumac") .nes. "" then purge lastcmz.kumac $ exit +DECK,MCX ,T=DATA. *CMZU: 2.02/01 29/04/97 13.33.44 by Phobos (R. Verdier) *CMZU: 2.01/02 14/03/97 16.12.49 by Phobos (R. Verdier) *CMZU: 2.01/01 12/03/97 11.50.07 by Phobos (R. Verdier) *CMZU: 2.00/12 08/11/96 13.00.13 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.14.43 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.56.03 by Phobos (R. Verdier) *CMZ : 2.00/01 06/03/96 15.37.43 by Phobos (R. Verdier) *CMZU: 2.00/00 08/10/95 09.04.41 by Phobos (R. Verdier) *-- Author : $! MCX.COM: Run definitions procedure file template for the Phobos MC $ Exename == "pmc_exe:MCX.EXE" ! Version: X-windows, nodebug $ Vers = "NEW" $ def/nolog scratch disk$scratch:[USER] $ def/nolog pmc_exe phobos_root:[SIM.'Vers'.EXEVMS] $ def/nolog pmc_dat phobos_root:[SIM.'Vers'.DAT] $ def/nolog rhdata scratch:CONTROL.TXT $! End of run definitions procedure file +DECK,CMZTOTXT ,T=DATA. *CMZU: 2.00/07 22/07/96 10.16.37 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 10.04.56 by Phobos (R. Verdier) *CMZU: 1.00/17 21/04/95 13.28.27 by Phobos (R. Verdier) *-- Author : $! CMZTOTXT.COM: Extract files from the Phobos PHOSIM.CMZ lib into ASCII $! Use: $ @cmztotxt $! Ex.: $ @cmztotxt for "gukine ugc?*" scratch:*.for $! 14-Apr-95: CMZTOTXT created by modifying FORTOCAR (R. Verdier) $! 7-Nov-93: FORTOCAR created by modifying FORTOMOR (R. Verdier) $ if f$mode().eqs."BATCH" then set noverify $! Define the SIM version subdirectory: NEW | PRO $ Vers = "NEW" $ SaveTempFiles = "NO" $ say = "write sys$output" $ FileType = p1 $ if p1 .eqs. "" $ then $ copy sys$input sys$output Use: $ @cmztotxt Ex: $ @cmztotxt for "gukine ugc?*" scratch:*.for where specifies the kind of file to extract: COM, DOC, FOR, GCDES, INC, KUMAC, or TXT. Except for gcdes, these must be PHOSIM.CMZ subdirectory names. For FOR, the SEQ's will be changed to equivalent INCLUDEs. The list of SEQ's is specific to the Phobos MC. The includes refer to the VMS logical "pmc_inc" For GCDES, the required syntax is @cmztotxt gcdes * *.inc and the Geant Common Descriptors will be extracted from the library phobos_root:[CERN.PRO.INC]GCDES.CMZ, which CMZTOT assumes already exists. If not, or if it is obsolete, it can be created by using the Phobos MAKEGCDES.COM procedure/. is the name of a SIM file or set of files. A list of specifications should be enclosed in quotes, as "a b c" Wildcards are allowed, but CMZ required x?* instead of x*. Don't include extensions in the names. Includes, type=inc, must be prefixed with a dollar sign $, e.g., $ntuex or $n?* defaults to * which reproduces source names. $ FileType = "FOR" $ inquire/nopunct p1 "Please enter type [''FileType']: " $ if p1 .nes. "" then FileType = p1 $ endif $ SourceFileName = "*" $ if p2 .eqs. "" then inquire/nopunct p2 - "Please enter source file name(s) [''SourceFileName']: " $ if p2 .nes. "" then SourceFileName = p2 $ OutputFileName = "*.''FileType'" $ if p3 .eqs. "" then inquire/nopunct p3 - "Please enter output file names [''OutputFileName']: " $ if p3 .nes. "" then OutputFileName = p3 $ OutExt = "_SEQ" $ if FileType .eqs. "FOR" then OutputFileName = OutputFileName + "''OutExt'" $! The strange loop structure used here evolved because DCL $! subroutine calls don't return information, and GOTOs can't see $! return labels inside a conditional. $! $! Extract specified source files from the CMZ library $ goto EXTRACT $ EXTRACTRET: $ Found = 0 $ OutFile = "" $ LOOP: $ Filename = "" $! Convert +SEQ... to INCLUDE in fortran files $ if FileType .eqs. "FOR" then goto GETFILENAME $ GETFILENAMERET: $ if FileName .nes. "" $ then $ OutFile = FileName - "''OutExt'" $! say " Converting ", FileName, " to ", OutFile $! say " with SEQ -> INCLUDE:" $! Edit extracted files individually $ goto SEQTOINC $ endif $ SEQTOINCRET: $ if FileName .nes. "" then del 'FileName' $ if Found .gt. 0 then goto LOOP $ goto EXIT $! $ EXTRACT: ! SUBROUTINE to extract specified source files $! from the Phobos SIM CMZ library $! $ open/write ku CMZTOTXT_TMP.KUMAC $ wk = "write ku" $ if FileType .eqs. "GCDES" $ then $ wk "file phobos_root:[CERN.PRO.INC]GCDES.CMZ -r" $ wk "sel TYPE" $ wk "seq /''FileType'" $ wk "seq -f ''OutputFileName'" $ say "This will take some time..." $ else $ wk "file phobos_root:[SIM.''Vers'.CMZ]PHOSIM -r" $ wk "cd ''FileType'" $ wk "set ''OutputFileName' -f text" $ wk "ctot ''SourceFileName'" $ endif $ wk "return" $ close ku $ cmz exe CMZTOTXT_TMP exit $ if SaveTempFiles .eqs. "NO" then del CMZTOTXT_TMP.KUMAC; $ del LASTCMZ.KUMAC;,CMZSAVE.DAT; $ goto EXTRACTRET $! $ GETFILENAME: ! SUBROUTINE to return all filenames in a directory $! specification $! $ if Found .gt. 0 then goto NEXTFILE $! Create a directory file listing all the specified files: $! Add since=today for a little protection-- probably unnecessary $ InFile = "''OutputFileName'/since=today" $ DirFile = "GETCMZDIR_TMP.LIS" $ dir/out='DirFile' 'InFile' $ open/read din 'DirFile' $ DirLine = "" $ Found = 0 $ NEXTFILE: $ if DirLine .eqs. "" $ then $ read din DirLine / end = FEOF $ DirLine = F$EDIT(DirLine, "TRIM,COMPRESS") $ goto NEXTFILE $ FEOF: if Found .eq. 0 then - say "No files found that matched the specification ''p1'." $ Found = -1 $ close din $ if SaveTempFiles .eqs. "NO" then del 'DirFile'; $ goto GETFILEEND $ endif $ if F$EXTRACT(0,10,DirLine) .eqs. "Directory " $ then $ DirName = F$EXTRACT(10, F$LENGTH(DirLine), DirLine) $! say "Directory name is ", DirName $ DirLine = "" $ goto NEXTFILE $ endif $ if F$LOCATE(";", DirLine) .ge. F$LENGTH(DirLine) $ then $ DirLine = "" $ goto NEXTFILE $ endif $! Extract the next file name and remove it from the line $ lbl = F$LOCATE(" ", DirLine) $ FileName = "''DirName'" + F$EXTRACT(0, lbl, DirLine) $! say "FileName is ", FileName $ DirLine = F$EXTRACT(lbl+1, F$LENGTH(DirLine), DirLine) $ Found = Found + 1 $ ls = F$LOCATE(";", FileName) $ GETFILEEND: goto GETFILENAMERET $! $ SEQTOINC: ! SUBROUTINE to convert +SEQ to INCLUDE for the Phobos $! SIM system $! $ edit/edt/out='OutFile' 'FileName' s/+SEQ,BANGC./ include 'pmc_inc:BANGC.INC'/w/not s/+SEQ, BANGC./ include 'pmc_inc:BANGC.INC'/w/not s/+SEQ, CARDS./ include 'pmc_inc:CARDS.INC'/w/not s/+SEQ, CYFLDC./ include 'pmc_inc:CYFLDC.INC'/w/not s/+SEQ,FLAG./ include 'pmc_inc:FLAG.INC'/w/not s/+SEQ, FLAG./ include 'pmc_inc:FLAG.INC'/w/not s/+SEQ,GCBANK./ include 'pmc_inc:GCBANK.INC'/w/not s/+SEQ, GCBANK/ include 'pmc_inc:GCBANK.INC'/w/not s/+SEQ, GCBANK./ include 'pmc_inc:GCBANK.INC'/w/not s/+SEQ, GCCUTS./ include 'pmc_inc:GCCUTS.INC'/w/not s/+SEQ, GCDRAW./ include 'pmc_inc:GCDRAW.INC'/w/not s/+SEQ,GCFLAG./ include 'pmc_inc:GCFLAG.INC'/w/not s/+SEQ, GCFLAG./ include 'pmc_inc:GCFLAG.INC'/w/not s/+SEQ, GCFLAX./ include 'pmc_inc:GCFLAX.INC'/w/not s/+SEQ,GCKINE./ include 'pmc_inc:GCKINE.INC'/w/not s/+SEQ, GCKINE./ include 'pmc_inc:GCKINE.INC'/w/not s/+SEQ,GCKING./ include 'pmc_inc:GCKING.INC'/w/not s/+SEQ, GCKING./ include 'pmc_inc:GCKING.INC'/w/not s/+SEQ,GCLIST./ include 'pmc_inc:GCLIST.INC'/w/not s/+SEQ, GCLIST./ include 'pmc_inc:GCLIST.INC'/w/not s/+SEQ, GCMATE./ include 'pmc_inc:GCMATE.INC'/w/not s/+SEQ,GCNUM./ include 'pmc_inc:GCNUM.INC'/w/not s/+SEQ, GCNUM./ include 'pmc_inc:GCNUM.INC'/w/not s/+SEQ, GCONST./ include 'pmc_inc:GCONST.INC'/w/not s/+SEQ, GCPHYS./ include 'pmc_inc:GCPHYS.INC'/w/not s/+SEQ,GCSETS./ include 'pmc_inc:GCSETS.INC'/w/not s/+SEQ, GCSETS./ include 'pmc_inc:GCSETS.INC'/w/not s/+SEQ,GCSTAK./ include 'pmc_inc:GCSTAK.INC'/w/not s/+SEQ, GCTMED./ include 'pmc_inc:GCTMED.INC'/w/not s/+SEQ,GCTRAK./ include 'pmc_inc:GCTRAK.INC'/w/not s/+SEQ, GCTRAK./ include 'pmc_inc:GCTRAK.INC'/w/not s/+SEQ, GCUNIT./ include 'pmc_inc:GCUNIT.INC'/w/not s/+SEQ,GCVOLU./ include 'pmc_inc:GCVOLU.INC'/w/not s/+SEQ, GCVOLU/ include 'pmc_inc:GCVOLU.INC'/w/not s/+SEQ, GCVOLU./ include 'pmc_inc:GCVOLU.INC'/w/not s/+SEQ, GCVOL2./ include 'pmc_inc:GCVOL2.INC'/w/not s/+SEQ,HST./ include 'pmc_inc:HST.INC'/w/not s/+SEQ, HST./ include 'pmc_inc:HST.INC'/w/not s/+SEQ,IO./ include 'pmc_inc:IO.INC'/w/not s/+SEQ, IO./ include 'pmc_inc:IO.INC'/w/not s/+SEQ,MUPEP./ include 'pmc_inc:MUPEP.INC'/w/not s/+SEQ, MUPEP./ include 'pmc_inc:MUPEP.INC'/w/not s/+SEQ, MUPEPD./ include 'pmc_inc:MUPEPD.INC'/w/not s/+SEQ,NTU./ include 'pmc_inc:NTU.INC'/w/not s/+SEQ, NTU./ include 'pmc_inc:NTU.INC'/w/not s/+SEQ, NTUD./ include 'pmc_inc:NTUD.INC'/w/not s/+SEQ, NTUEX./ include 'pmc_inc:NTUEX.INC'/w/not s/+SEQ, NTUEXD./ include 'pmc_inc:NTUEXD.INC'/w/not s/+SEQ, RHSIL./ include 'pmc_inc:RHSIL.INC'/w/not s/+SEQ,RHSIL./ include 'pmc_inc:RHSIL.INC'/w/not s/+SEQ, RHSILD./ include 'pmc_inc:RHSILD.INC'/w/not s/+SEQ, RHSYS./ include 'pmc_inc:RHSYS.INC'/w/not s/+SEQ,UHITS./ include 'pmc_inc:UHITS.INC'/w/not s/+SEQ, UHITS./ include 'pmc_inc:UHITS.INC'/w/not s/+SEQ,UJKBUF./ include 'pmc_inc:UJKBUF.INC'/w/not s/+SEQ, UJKBUF./ include 'pmc_inc:UJKBUF.INC'/w/not s/+SEQ, ZBBFLD./ include 'pmc_inc:ZBBFLD.INC'/w/not ! s/+SEQ, XX./ include 'pmc_inc:XX.CMN'/w/not ! template ! s/+SEQ, XX./ include 'pmc_inc:XX.CMN'/w/not ! template with tab ! d' integer function';d' IMPLICIT NONE' ! s/ 1/ /w/not exit $ goto SEQTOINCRET ! ENDSUBROUTINE $ EXIT: exit +DECK,MCG ,T=DATA. *CMZU: 2.01/01 12/03/97 11.50.56 by Phobos (R. Verdier) *CMZU: 2.00/12 08/11/96 13.00.31 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.15.28 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.57.06 by Phobos (R. Verdier) *CMZ : 2.00/01 06/03/96 15.38.14 by Phobos (R. Verdier) *CMZU: 2.00/00 08/10/95 09.04.40 by Phobos (R. Verdier) *-- Author : $! MCG.COM: Run definitions procedure file template for the Phobos MC $ Exename == "pmc_exe:MCG.EXE" ! Version: GKS, nodebug $ Vers = "NEW" $ def/nolog scratch disk$scratch:[USER] $ def/nolog pmc_exe phobos_root:[SIM.'Vers'.EXEVMS] $ def/nolog pmc_dat phobos_root:[SIM.'Vers'.DAT] $ def/nolog rhdata scratch:CONTROL.TXT $! End of run definitions procedure file +DECK,MCGD ,T=DATA. *CMZU: 2.02/01 29/04/97 13.34.22 by Phobos (R. Verdier) *CMZU: 2.01/02 14/03/97 16.13.47 by Phobos (R. Verdier) *CMZU: 2.01/01 12/03/97 11.51.24 by Phobos (R. Verdier) *CMZU: 2.00/12 08/11/96 13.01.06 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.15.50 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.57.18 by Phobos (R. Verdier) *CMZ : 2.00/01 06/03/96 15.38.31 by Phobos (R. Verdier) *CMZU: 2.00/00 08/10/95 09.04.41 by Phobos (R. Verdier) *-- Author : $! MCGD.COM: Run definitions procedure file template for the Phobos MC $ Exename == "pmc_exe:MCGD.EXE" ! Version: GKS, debug $ Vers = "NEW" $ def/nolog scratch disk$scratch:[USER] $ def/nolog pmc_exe phobos_root:[SIM.'Vers'.EXEVMS] $ def/nolog pmc_dat phobos_root:[SIM.'Vers'.DAT] $ def/nolog rhdata scratch:CONTROL.TXT $! End of run definitions procedure file +DECK,MCXD ,T=DATA. *CMZU: 2.02/01 29/04/97 13.34.03 by Phobos (R. Verdier) *CMZU: 2.01/02 14/03/97 16.13.18 by Phobos (R. Verdier) *CMZU: 2.01/01 12/03/97 11.50.31 by Phobos (R. Verdier) *CMZU: 2.00/12 08/11/96 13.01.30 by Phobos (R. Verdier) *CMZU: 2.00/07 22/07/96 10.15.07 by Phobos (R. Verdier) *CMZU: 2.00/02 22/05/96 09.57.46 by Phobos (R. Verdier) *CMZ : 2.00/01 06/03/96 15.38.00 by Phobos (R. Verdier) *CMZU: 2.00/00 08/10/95 09.04.41 by Phobos (R. Verdier) *-- Author : $! MCXD.COM: Run definitions procedure file template for the Phobos MC $ Exename == "pmc_exe:MCXD.EXE" ! Version: X-windows, debug $ Vers = "NEW" $ def/nolog scratch disk$scratch:[USER] $ def/nolog pmc_exe phobos_root:[SIM.'Vers'.EXEVMS] $ def/nolog pmc_dat phobos_root:[SIM.'Vers'.DAT] $ def/nolog rhdata scratch:CONTROL.TXT $! End of run definitions procedure file +DECK,MAKECDES ,T=DATA. *CMZ : 2.00/00 02/03/96 23.47.29 by Phobos (R. Verdier) *-- Author : $! MAKECDES.COM: Create KUIP macro files to extract a CERN common $! descriptor CMZ library from a CERN CAR file $! Use: @makecdes [cerncar] [patch] [targetlib] [kumac] $! Ex: @makecdes cern:[pro.src.car]geant321.car scratch:gcdes.cmz $! Cerncar = CERN CAR file $! Patch = Patch or range of patches range to extract from the CAR file $! TargetLib = created CDES CMZ library $! Kumac = name of created .KUMAC file $! MAKECDES prompts for missing arguments. $! Note that there is no automatic way to check when CERN changes the $! standard version. $! 02-Mar-96 Generalized to handle ZEBRA as well as GEANT libraries (RV) $! 30-Mar-95 Extracted from NEWSIM.COM for stand-alone use in updating $! Phobos libraries to new CERN releases. Several CMZ commands $! in NEWSIM no longer work and replacements are undocumented. $! (R. Verdier) $! $! Default filenames $ gcar = "cern:[PRO.SRC.CAR]GEANT.CAR" $ gcd = "phobos_root:[CERN.PRO.INC]GCDES.CMZ" $ gkumac = "MAKEGCDES.KUMAC" $ gpatch = "GCDES" $ zcar = "cern:[PRO.SRC.CAR]ZEBRA.CAR" $ zcd = "phobos_root:[CERN.PRO.INC]ZCDES.CMZ" $ zkumac = "MAKEZCDES.KUMAC" $ zpatch = "QCDE" $! $ say = "write sys$output" $! $ NEXT: $ if p1 .eqs. "" $ then $ say - "Source CAR file containing common sequences:" $ inquire/nopunc p1 "( g=''gcar' | z=''zcar' | CR=exit )? " $ endif $ if p1 .eqs. "" then goto END $ if p1 .eqs. "G" $ then $ car = gcar $ kumac = gkumac $ newcd = gcd $ patch = gpatch $ else $ if p1 .eqs. "Z" $ then $ car = zcar $ kumac = zkumac $ newcd = zcd $ patch = zpatch $ endif $ endif $ if p2 .eqs. "" then inquire/nopunc p2 - "Patch name (or ""names"") to extract from car file [''patch']? " $ if p2 .nes. "" then patch = p2 $ if p3 .eqs. "" then inquire/nopunc p3 - "Created CMZ common descriptor library [''newcd']? " $ if p3 .nes. "" then newcd = p3 $ newcdfile = f$search("''newcd'") $ if newcdfile .nes. "" then say - "Note that the existing ''newcdfile' will be overwritten." $ if p4 .eqs. "" then inquire/nopunc p4 "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $! $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by MAKECDES.COM" $ wk "mess Create library ''newcd' containing" $ wk "mess subdirectory ''patch' of ''car'." $ wk "release *" $ wk "sel ." $ wk "create ''newcd'" $ wk "mdir ''patch'" $ wk "sel type" $ wk "arc ''car' ''patch'" $ wk "return" $ close ku $ say "You may now run CMZ and execute ''f$search(kumac)'" $ say "to create library ''newcd' containing" $ say "subdirectory ''patch' of ''car'." $ p1 = "" $ p2 = "" $ p3 = "" $ p4 = "" $ goto NEXT $ END: exit +DECK,MODCERN ,T=DATA. *CMZ : 2.00/00 02/03/96 23.47.30 by Phobos (R. Verdier) *-- Author : $! MODCERN.COM: Create KUIP macros to modify GEANT subroutine GRUN $! or GXCONT or ZEBRA subroutine ZABEND or ZEND for Phobos $! Use: @modcern [subr] [carfile] [cmzlib] [kumac] $! Ex: @modcern grun cern:[pro.src.car]geant.car pz:phosim.cmz modgrun.kumac $! In CMZ, the statement exe modgrun will create a modified version of $! GRUN in //PHOSIM/MODCERN in pz:PHOSIM.CMZ $! Operations and arguments (MODCERN prompts for missing arguments): $! Create a modified GRUN from patch GBASE of GEANT: $! $ @modcern grun [carfile] [cmzlib] [kumac] $! Create a modified GXCONT from patch GXINT of GEANX: $! $ @modcern gxcont [carfile] [cmzlib] [kumac] $! Create a modified ZABEND: $! $ @modcern zabend [carfile] [cmzlib] [kumac] $! Create a modified ZEND: $! $ @modcern zend [carfile] [cmzlib] [kumac] $! $! subr = name of subroutine to be modified $! carfile = name of unmodified CERN ASCII Readable text file $! cmzlib = Phobos CMZ library filename $! kumac = created KUMAC filename $! 2-Mar-96 Created following UPCMZ (R. Verdier) $! $! Defaults: $ BaseDir = "phobos_root:[SIM.TEST." $ geantcar = "cern:[PRO.SRC.CAR]GEANT.CAR" $ geanxcar = "cern:[PRO.SRC.CAR]GEANX.CAR" $ geanzcar = "cern:[PRO.SRC.CAR]ZEBRA.CAR" $ cmzlib = "''BaseDir'CMZ]PHOSIM.CMZ" $! $ say = "write sys$output" $ NEXT: $ if p1 .eqs. "" then inquire/nopunc p1 - "Subroutine to be modified ( grun | gxcont | zabend | zend | CR=exit )? " $ if p1 .eqs. "" then goto END $ subr = p1 $! $ GRUN: if f$extract(0,2,"''subr'") .eqs. "GR" $ then $! $ carfile = geantcar $ patch = "GBASE" $ deck = "GRUN" $ kumac = "MOD''deck'.KUMAC" $ job1 = "Modify subroutine ''deck' from CMZ ASCII Readable file" $ job2 = "and insert it in CMZ library" $ say job1 $ say job2 $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ ASCII Readable file [''carfile']? " $ if p2 .nes. "" then carfile = p2 $ if f$search("''carfile'") .eqs. "" $ then say "''carfile' not found; note that the operation may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job1 = job1 + " ''carfile'" $ if p3 .eqs. "" then inquire/nopunc p3 "CMZ library [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ job2 = job2 + " ''cmzlib'" $ if p4 .eqs. "" then inquire/nopunc p4 "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ create MOD'deck'_TMP.CRA +ADD,GBASE,GRUN,0. *CMZ : 28/02/96 12.41.37 by Phobos (R. Verdier) * 07-Aug-94 R. Verdier Disable timeout if 0 cpu limit (="infinite") +ADD,GBASE,GRUN,17. * Additions for disabling timeout: COMMON /SLATE/ SYSTIME integer SYSTIME, TIMEOUT /0/ * End of timeout additions +ADD,GBASE,GRUN,27. * Set flag to disable timeout: c VMS batch queues with INFINITE CMZ limit return 0 in SYS$GETJPI. c TIMEL sets this to 9999, which is insufficient. c The awkward solution here is to bypass the timeout if the sum of c time used and time left is 9999. if (abs(SYSTIME * 0.01 + TIMINT - 9999.0) .lt. 0.01) & TIMEOUT = 1 * End of timeout additions +REP,GBASE,GRUN,53-55. c Bypass timeout if flag is set: if (TIMEOUT .eq. 0) then WRITE(CHMAIL,10000)TIMEND CALL GMAIL(0,2) IEORUN = 1 else c Write once-only timeout bypass notice if (TIMEOUT .gt. 0) then TIMEOUT = -TIMEOUT write (CHMAIL,10001) SYSTIME * 0.01 CALL GMAIL(0,1) endif go to 10 endif +ADD,GBASE,GRUN,60. 10001 format (' GRUN: Bypassing normal job timeout at', f8.1, & ' CPU seconds remaining.') $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by MODCERN.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "create MOD''deck'_TMP.CMZ" $ wk "arc ''carfile' ''patch'/''deck'" $ wk "use MOD''deck'_TMP.CRA" $ wk "update $use" $ wk "mess Please check the following differences to make sure that the CERN" $ wk "mess version of ''patch'/''deck' has not been changed since 1-Mar-96" $ wk "dif ''patch'/''deck'" $ wk "copy = yes" $ wk "mess Copy the modified ''deck' to /MODCERN in ''cmzlib'? " $ wk "read copy" $ wk "if $upper($substring([copy],1,1)) = Y then" $ wk " file ''cmzlib'" $ wk " copy //MOD''deck'_TMP/''patch'/''deck' MODCERN/" $ wk "endif" $ wk "mess You can delete MOD''deck'_TMP.CMZ, MOD''deck'_TMP.CRA, and " $ wk "mess MOD''deck'.KUMAC after exiting CMZ." $ wk "return" $ endif $! $ GXCONT: if f$extract(0,2,"''subr'") .eqs. "GX" $ then $! $ carfile = geanxcar $ patch = "GXINT" $ deck = "GXCONT" $ kumac = "MOD''deck'.KUMAC" $ job1 = "Modify subroutine ''deck' from CMZ ASCII Readable file" $ job2 = "and insert it in CMZ library" $ say job1 $ say job2 $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ ASCII Readable file [''carfile']? " $ if p2 .nes. "" then carfile = p2 $ if f$search("''carfile'") .eqs. "" $ then say "''carfile' not found; note that the operation may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job1 = job1 + " ''carfile'" $ if p3 .eqs. "" then inquire/nopunc p3 "CMZ library [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ job2 = job2 + " ''cmzlib'" $ if p4 .eqs. "" then inquire/nopunc p4 "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ create MOD'deck'_TMP.CRA +ADD,GXINT,GXCONT,0. *CMZ : 28/02/96 12.41.37 by Phobos (R. Verdier) * 1-Mar-96 Change TRIG handling to allow external batch loop control (RV) +REP,GXINT,GXCONT,73. c Following changed from original NEVENT = N for Phobos, 1-Mar-96, c to use the number of events set in UGINIT in batch mode: IF (.NOT.BATCH) NEVENT = N $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by MODCERN.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "create MOD''deck'_TMP.CMZ" $ wk "arc ''carfile' ''patch'/''deck'" $ wk "use MOD''deck'_TMP.CRA" $ wk "update $use" $ wk "mess Please check the following differences to make sure that the CERN" $ wk "mess version of ''patch'/''deck' has not been changed since 1-Mar-96" $ wk "dif ''patch'/''deck'" $ wk "copy = yes" $ wk "mess Copy the modified ''deck' to /MODCERN in ''cmzlib'? " $ wk "read copy" $ wk "if $upper($substring([copy],1,1)) = Y then" $ wk " file ''cmzlib'" $ wk " copy //MOD''deck'_TMP/''patch'/''deck' MODCERN/" $ wk "endif" $ wk "mess You can delete MOD''deck'_TMP.CMZ, MOD''deck'_TMP.CRA, and " $ wk "mess MOD''deck'.KUMAC after exiting CMZ." $ wk "return" $ endif $! $ ZABEND: if f$extract(0,2,"''subr'") .eqs. "ZA" $ then $! $ carfile = geanzcar $ patch = "QEND" $ deck = "ZABEND" $ kumac = "MOD''deck'.KUMAC" $ job1 = "Modify subroutine ''deck' from CMZ ASCII Readable file" $ job2 = "and insert it in CMZ library" $ say job1 $ say job2 $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ ASCII Readable file [''carfile']? " $ if p2 .nes. "" then carfile = p2 $ if f$search("''carfile'") .eqs. "" $ then say "''carfile' not found; note that the operation may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job1 = job1 + " ''carfile'" $ if p3 .eqs. "" then inquire/nopunc p3 "CMZ library [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ job2 = job2 + " ''cmzlib'" $ if p4 .eqs. "" then inquire/nopunc p4 "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ create MOD'deck'_TMP.CRA +ADD,QEND,ZABEND,0. *CMZ : 28/02/96 12.41.37 by Phobos (R. Verdier) * 1-Mar-96 R.V. Modified from ZEBRA.CAR to avoid dump at abend +ADD,QEND,ZABEND,8. +CDE, GCBANK. +REP,QEND,ZABEND,10. c* *CALL ZPOSTM ('TCWM.') call DZSTOR (' GCBANK', IXSTOR) $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by MODCERN.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "create MOD''deck'_TMP.CMZ" $ wk "arc ''carfile' ''patch'/''deck'" $ wk "use MOD''deck'_TMP.CRA" $ wk "update $use" $ wk "mess Please check the following differences to make sure that the CERN" $ wk "mess version of ''patch'/''deck' has not been changed since 1-Mar-96" $ wk "dif ''patch'/''deck'" $ wk "copy = yes" $ wk "mess Copy the modified ''deck' to /MODCERN in ''cmzlib'? " $ wk "read copy" $ wk "if $upper($substring([copy],1,1)) = Y then" $ wk " file ''cmzlib'" $ wk " copy //MOD''deck'_TMP/''patch'/''deck' MODCERN/" $ wk "endif" $ wk "mess You can delete MOD''deck'_TMP.CMZ, MOD''deck'_TMP.CRA, and " $ wk "mess MOD''deck'.KUMAC after exiting CMZ." $ wk "return" $ endif $! $ ZEND: if f$extract(0,2,"''subr'") .eqs. "ZE" $ then $! $ carfile = geanzcar $ patch = "QEND" $ deck = "ZEND" $ kumac = "MOD''deck'.KUMAC" $ job1 = "Modify subroutine ''deck' from CMZ ASCII Readable file" $ job2 = "and insert it in CMZ library" $ say job1 $ say job2 $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ ASCII Readable file [''carfile']? " $ if p2 .nes. "" then carfile = p2 $ if f$search("''carfile'") .eqs. "" $ then say "''carfile' not found; note that the operation may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job1 = job1 + " ''carfile'" $ if p3 .eqs. "" then inquire/nopunc p3 "CMZ library [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ job2 = job2 + " ''cmzlib'" $ if p4 .eqs. "" then inquire/nopunc p4 "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ create MOD'deck'_TMP.CRA +ADD,QEND,ZEND,0. *CMZ : 28/02/96 12.41.37 by Phobos (R. Verdier) * 1-Mar-96 Changed from ZEBRA.CAR to force abend on NOERR > 0 (RV) +REP,QEND,ZEND,15-17. c* +SELF, QTOABEND. CALL ABEND c* +SELF. $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by MODCERN.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "create MOD''deck'_TMP.CMZ" $ wk "arc ''carfile' ''patch'/''deck'" $ wk "use MOD''deck'_TMP.CRA" $ wk "update $use" $ wk "mess Please check the following differences to make sure that the CERN" $ wk "mess version of ''patch'/''deck' has not been changed since 1-Mar-96" $ wk "dif ''patch'/''deck'" $ wk "copy = yes" $ wk "mess Copy the modified ''deck' to /MODCERN in ''cmzlib'? " $ wk "read copy" $ wk "if $upper($substring([copy],1,1)) = Y then" $ wk " file ''cmzlib'" $ wk " copy //MOD''deck'_TMP/''patch'/''deck' MODCERN/" $ wk "endif" $ wk "mess You can delete MOD''deck'_TMP.CMZ, MOD''deck'_TMP.CRA, and " $ wk "mess MOD''deck'.KUMAC after exiting CMZ." $ wk "return" $ endif $! $ say "Created f$search(""MOD''deck'_TMP.CRA"")." $ close ku $ say "You may now run CMZ and execute ''f$search(kumac)'" $ say "to ''job1'" $ say "''job2'." $ p1 = "" $ p2 = "" $ p3 = "" $ p4 = "" $ goto NEXT $ END: exit +DECK,UPCMZ ,T=DATA. *CMZU: 2.01/02 14/03/97 16.16.15 by Phobos (R. Verdier) *CMZU: 2.00/13 19/11/96 12.10.31 by Phobos (R. Verdier) *-- Author : $! UPCMZ.COM: Create KUIP macro files for maintaining a CMZ library $! Use: @upcmz [op] [file1] [file2] ... [kumac] $! Ex: @upcmz update pz:phosim d010116ban.cra pz:gcdes *.for mods mods_dbg d16 $! In CMZ, the statement exe d16.kumac will update the library. $! Operations and arguments (UPCMZ prompts for missing arguments): $! Create a new .CMZ library from a .CAR file: $! $ @upcmz cartocmz [carfile] [cmzlib] [kumac] $! Create a new ASCII .CAR file from a .CMZ library: $! $ @upcmz cmztocar [cmzlib] [carfile] [kumac] $! Compile Fortran source decks into object library and extract source files: $! $ @upcmz compile [cmzlib] [gcdes] [zcdes] [srcs] [olb] [debolb] [kumac] $! Compile server source decks into object library and extract source files: $! $ @upcmz cserver [scmzlib] [pcmzlib] [gcdes] [srcs] [olb] [debolb] [kumac] $! Extract .COM, .DAT, .DOC, .INC, and/or .KUMAC data files from CMZ library: $! $ @upcmz extract [cmzlib] [coms] [dats] [docs] [incs] [kumacs] [kumac] $! Update a CMZ library from a delta corrections (.CAR) file: $! $ @upcmz update [cmzlib] [corrs] [kumac] $! $! carfile = name of CMZ ASCII Readable text file equivalent to cmzlib $! cmzlib = Phobos CMZ library filename $! coms = extracted .COM filenames $! corrs = Delta corrections filename $! dats = extracted text data filenames $! debolb = created debug-version object library filename $! docs = extracted text document filenames $! gcdes = Geant common descriptor CMZ library filename $! incs = extracted INCLUDE filenames $! kumac = created KUMAC filename $! kumacs = extracted .KUMAC filenames $! olb = created production object library filename $! pcmzlib = Phobos CMZ library filename $! scmzlib = Server CMZ library filename $! sel1..3 = default CMZ select options. These should be selectable from $! the command line but compile already has 8 parameters. $! sdebolb = created server debug-version object library filename $! solb = created server production object library filename $! srcs = created FORTRAN source filenames $! zcdes = ZEBRA common descriptor CMZ library filename $! 05-Nov-96 Added CMZ selections and server compile (RV) $! 02-Mar-96 Restructured and extended to perform a set of operations (RV) $! 01-Apr-95 Extracted from NEWSIM.COM for updating Phobos libraries $! to new CERN releases (R. Verdier) $! $! Defaults: $ Vers = "PRO" $ BaseDir = "phobos_root:[SIM" $ SBaseDir= "phobos_root:[MCSERV" $ op = "" $ carfile = "''BaseDir'.''Vers'.CMZ]PHOSIM.CAR" $ cmzlib = "''BaseDir'.''Vers'.CMZ]PHOSIM.CMZ" $ coms = "''BaseDir'.''Vers'.CMD]*.COM" $ corrs = "''BaseDir'.''Vers'.CMZ]D010121RMC.CRA" $ dats = "''BaseDir'.''Vers'.DAT]*.TXT" $ debolb = "''BaseDir'.''Vers'.LIB]PMC_DBG.OLB" $ docs = "''BaseDir'.''Vers'.DOC]*.DOC" $ gcdes = "''BaseDir'.''Vers'.CMZ]GCDES.CMZ" $ incs = "''BaseDir'.''Vers'.INC]*.INC" $ kumac = "''op'.KUMAC" $ kumacs = "''BaseDir'.''Vers'.CMD]*.KUMAC" $ olb = "''BaseDir'.''Vers'.LIB]PMC.OLB" $ pcmzlib = "''cmzlib'" $ scmzlib = "''SBaseDir'.PRO.CMZ]SERVER.CMZ" $ sel1 = "type" $ sel2 = "vms" $ sel3 = "noserv" $ solb = "''BaseDir'.''Vers'.LIB]SERVER.OLB" $ sdebolb = "''BaseDir'.''Vers'.LIB]SERVER_DBG.OLB" $ srcs = "''BaseDir'.''Vers'.SRC]*.FOR" $ zcdes = "''BaseDir'.''Vers'.CMZ]ZCDES.CMZ" $! $ say = "write sys$output" $ NEXT: $ if p1 .eqs. "" $ then $ say "Operation (cartocmz | cmztocar | compile | extract | scomp |" $ inquire/nopunc p1 " update | CR=exit )? " $ endif $ if p1 .eqs. "" then goto END $ op = p1 $! $ CARTOCMZ: if f$extract(0,2,"''op'") .eqs. "CA" $ then $! $ job1 = "Create CMZ library" $ job2 = "from CMZ ASCII Readable file" $ kumac = "CARTOCMZ.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ ASCII Readable file [''carfile']? " $ if p2 .nes. "" then carfile = p2 $ if f$search("''carfile'") .eqs. "" $ then say "''carfile' not found; note that the operation may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job2 = job2 + " ''carfile'" $ if p3 .eqs. "" then inquire/nopunc p3 - "CMZ library to be created [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ job1 = job1 + " ''cmzlib'" $ if p4 .eqs. "" then inquire/nopunc p4 - "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "create ''cmzlib'" $ wk "arc ''carfile'" $ wk "return" $ endif $! $ CMZTOCAR: if f$extract(0,2,"''op'") .eqs. "CM" $ then $! $ job1 = "Create CMZ ASCII Readable file" $ job2 = "from CMZ library" $ kumac = "CMZTOCAR.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" then inquire/nopunc p2 - "CMZ library [''cmzlib']? " $ if p2 .nes. "" then cmzlib = p2 $ job2 = job2 + " ''cmzlib'" $ if f$search("''cmzlib'") .eqs. "" $ then say "''cmzlib' not found; note that the operation may fail" say "unless you correct the problem before executing the KUMAC." $ endif $ if p3 .eqs. "" then inquire/nopunc p3 - "CMZ ASCII Readable file to be created [''carfile']? " $ if p3 .nes. "" then carfile = p3 $ job1 = job1 + " ''carfile'" $ if p4 .eqs. "" then inquire/nopunc p4 - "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "file ''cmzlib'" $ wk "car ''carfile'" $ wk "return" $ endif $! $ COMPILE: if f$extract(0,2,"''op'") .eqs. "CO" $ then $! $ job1 = "Compile FORTRAN source decks from CMZ library" $ job2 = "and update object libraries" $ kumac = "COMPILE.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" then inquire/nopunc p2 - "Library [''cmzlib']? " $ if p2 .nes. "" then cmzlib = p2 $ job1 = job1 + " ''cmzlib'" $ if p3 .eqs. "" then inquire/nopunc p3 - "CMZ GEANT common descriptor library [''gcdes']? " $ if p3 .nes. "" then gcdes = p3 $ if p4 .eqs. "" then inquire/nopunc p4 - "CMZ ZEBRA common descriptor library [''zcdes']? " $ if p4 .nes. "" then zcdes = p4 $ if p5 .eqs. "" then inquire/nopunc p5 - "Created source files [''srcs']? " $ if p5 .nes. "" then srcs = p5 $ if p6 .eqs. "" then inquire/nopunc p6 - "Created object library [''olb']? " $ if p6 .nes. "" then olb = p6 $ if p7 .eqs. "" then inquire/nopunc p7 - "Created debug object library [''debolb']? " $ if p7 .nes. "" then debolb = p7 $ job2 = job2 + " ''olb' and ''debolb'" $ if p8 .eqs. "" then inquire/nopunc p8 - "Created KUMAC file [''kumac']? " $ if p8 .nes. "" then kumac = p8 $ if f$search("''srcs'") .nes. "" then - say "Note that CMZ will overwrite existing ''srcs' files." $ if f$search("''olb'") .nes. "" then - say "Note that CMZ will replace entries in ''olb' and ''debolb'." $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "sel1 = ''sel1'" $ wk "sel2 = ''sel2'" $ wk "sel3 = ''sel3'" $ wk "sel [sel1]" $ wk "sel [sel2]" $ wk "sel [sel3]" $ wk "mess Note the CMZ compile options [sel1] [sel2] [sel3] are selected" $! CMZ cannot delete sequences or use selected sequences, and cannot $! be prevented from writing a warning about QTRACE* $ wk "mess Please ignore the following CMZ QTRACEx override messages:" $ wk "file ''zcdes' -r" $ wk "seq /QCDE" $ wk "file ''gcdes' -r" $ wk "seq -O /GCDES" $ wk "file ''cmzlib' -r" $ if f$search("''srcs'") .nes. "" then - wk "mess Note that CMZ will overwrite existing ''srcs' files." $ if f$search("''olb'") .nes. "" then - wk "mess Note that CMZ will replace entries in ''olb' and ''debolb'." $ wk "seq /INC" $ wk "set ''srcs' -F" $ if olb .nes. "" .and. olb .nes. "n" $ then $ wk "set ''olb' -L" $ wk "set '$ for/obj=$COMPFILE.OBJ $COMPFILE' -C" $! The CMZ cmake command ignores corrections; here we do a full compile. $ wk "clib FOR/*" $ wk "clib MODCERN/*" $ endif $ if debolb .nes. "" .and. debolb .nes. "n" $ then $ wk "set ''debolb' -L" $ wk "set '$ for/debug/noopt/obj=$COMPFILE.OBJ $COMPFILE' -C" $ wk "clib FOR/*" $ wk "clib MODCERN/*" $ endif $ wk "return" $ endif $! $ SCOMPILE: if f$extract(0,2,"''op'") .eqs. "SC" $ then $! $ job1 = "Compile SERVER source decks from CMZ library" $ job2 = "and update object libraries" $ kumac = "COMPSER.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" then inquire/nopunc p2 - "Library [''scmzlib']? " $ if p2 .nes. "" then scmzlib = p2 $ job1 = job1 + " ''scmzlib'" $ if p3 .eqs. "" then inquire/nopunc p2 - "PMC Library (for includes) [''cmzlib']? " $ if p3 .nes. "" then cmzlib = p3 $ if p4 .eqs. "" then inquire/nopunc p4 - "CMZ GEANT common descriptor library [''gcdes']? " $ if p4 .nes. "" then gcdes = p4 $ if p5 .eqs. "" then inquire/nopunc p5 - "Created source files [''srcs']? " $ if p5 .nes. "" then srcs = p5 $ if p6 .eqs. "" then inquire/nopunc p6 - "Created object library [''solb']? " $ if p6 .nes. "" then solb = p6 $ if p7 .eqs. "" then inquire/nopunc p7 - "Created debug object library [''sdebolb']? " $ if p7 .nes. "" then sdebolb = p7 $ job2 = job2 + " ''solb' and ''sdebolb'" $ if p8 .eqs. "" then inquire/nopunc p8 - "Created KUMAC file [''kumac']? " $ if p8 .nes. "" then kumac = p8 $ if f$search("''srcs'") .nes. "" then - say "Note that CMZ will overwrite existing ''srcs' files." $ if f$search("''solb'") .nes. "" then - say "Note that CMZ will replace entries in ''solb' and ''sdebolb'." $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "sel1 = ''sel1'" $ wk "sel2 = ''sel2'" $ wk "sel [sel1]" $ wk "sel [sel2]" $ wk "mess Note the CMZ compile options [sel1] [sel2] are selected" $ wk "file ''gcdes' -r" $ wk "seq -O /GCDES" $ wk "file ''cmzlib' -r" $ if f$search("''srcs'") .nes. "" then - wk "mess Note that CMZ will overwrite existing ''srcs' files." $ if f$search("''solb'") .nes. "" then - wk "mess Note that CMZ will replace entries in ''solb' and ''sdebolb'." $ wk "seq /INC" $ wk "file ''scmzlib' -r" $ wk "set ''srcs' -F" $ if solb .nes. "" .and. solb .nes. "n" $ then $ wk "set ''solb' -L" $ wk "set '$ for/obj=$COMPFILE.OBJ $COMPFILE' -C" $! The CMZ cmake command ignores corrections; here we do a full compile. $ wk "clib FOR/*" $ endif $ if sdebolb .nes. "" .and. sdebolb .nes. "n" $ then $ wk "set ''sdebolb' -L" $ wk "set '$ for/debug/noopt/obj=$COMPFILE.OBJ $COMPFILE' -C" $ wk "clib FOR/*" $ endif $ wk "return" $ endif $! $ EXTRACT: if f$extract(0,2,"''op'") .eqs. "EX" $ then $! $ job1 = "Extract selected groups of text files" $ job2 = "from CMZ library" $ kumac = "EXTRACT.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" $ then $ say "CMZ library?" $ inquire/nopunc p2 " [''cmzlib'] " $ endif $ if p2 .nes. "" then cmzlib = p2 $ job2 = job2 + " ''cmzlib'" $ if p3 .eqs. "" $ then $ say "Created .COM command procedure files (n for none)?" $ inquire/nopunc p3 " [''coms'] " $ endif $ if p3 .nes. "" then coms = p3 $ if p4 .eqs. "" $ then $ say "Created .TXT data files (n for none)?" $ inquire/nopunc p4 " [''dats'] " $ endif $ if p4 .nes. "" then dats = p4 $ if p5 .eqs. "" $ then $ say "Created .DOC document files (n for none)?" $ inquire/nopunc p5 " [''docs'] " $ endif $ if p5 .nes. "" then docs = p5 $ if p6 .eqs. "" $ then $ say "Created .INC include files (n for none)?" $ inquire/nopunc p6 " [''incs'] " $ endif $ if p6 .nes. "" then incs = p6 $ if p7 .eqs. "" $ then $ say "Created .KUMAC macro files (n for none)?" $ inquire/nopunc p7 " [''kumacs'] " $ endif $ if p7 .nes. "" then kumacs = p7 $ if p8 .eqs. "" $ then $ say "Name of .KUMAC file created to do extraction?" $ inquire/nopunc p8 " [''kumac'] " $ endif $ if p8 .nes. "" then kumac = p8 $! $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "file ''cmzlib' -r" $ if coms .nes. "N" $ then $ wk "set ''coms' -F text" $ wk "ctot /COM" $ endif $ if dats .nes. "N" $ then $ wk "set ''dats' -F text" $ wk "ctot /DAT" $ endif $ if docs .nes. "N" $ then $ wk "set ''docs' -F text" $ wk "ctot /DOC" $ endif $ if incs .nes. "N" $ then $ wk "set ''incs' -F text" $ wk "ctot /INC" $ endif $ if kumacs .nes. "N" $ then $ wk "set ''kumacs' -F text" $ wk "ctot /KUMAC" $ endif $ wk "return" $ endif $! $ UPDATE: if f$extract(0,2,"''op'") .eqs. "UP" $ then $! $ job1 = "Update CMZ library" $ job2 = "from delta corrections file" $ kumac = "UPDATE.KUMAC" $ say "''job1' ''job2'" $ if p2 .eqs. "" then inquire/nopunc p2 "Library [''cmzlib']? " $ if p2 .nes. "" then cmzlib = p2 $ if p3 .eqs. "" then inquire/nopunc p3 "Corrections [''corrs']? " $ if p3 .nes. "" then corrs = p3 $ if f$search("''corrs'") .eqs. "" $ then say "''corrs' not found; note that the update may fail unless" say "you correct the problem before executing the KUMAC." $ endif $ job1 = job1 + " ''cmzlib'" $ job2 = job2 + " ''corrs'" $ if p4 .eqs. "" then inquire/nopunc p4 - "Created KUMAC file [''kumac']? " $ if p4 .nes. "" then kumac = p4 $ wk = "write ku" $ open/write ku 'kumac' $ wk "* This kumac was created by UPCMZ.COM" $ wk "mess ''job1'" $ wk "mess ''job2'" $ wk "release *" $ wk "seq ." $ wk "file ''cmzlib'" $ wk "use ''corrs'" $ wk "seq /INC" $ wk "update $use" $ wk "return" $ endif $! $ close ku $ say "You may now run CMZ and execute ''f$search(kumac)'" $ say "to ''job1'" $ say "''job2'." $ p1 = "" $ p2 = "" $ p3 = "" $ p4 = "" $ p5 = "" $ p6 = "" $ p7 = "" $ p8 = "" $ goto NEXT $ END: exit +DECK,COMPILE ,T=DATA. *CMZU: 2.01/02 14/03/97 16.15.56 by Phobos (R. Verdier) *CMZU: 2.00/13 17/11/96 18.24.53 by Phobos (R. Verdier) *-- Author : $! COMPILE.COM: Compile Phobos MC source programs into OpenVMS libraries $! Use: compho [SrcFiles] [Mode] [Work] [ObjLib] [DebLib] [Report] $! ex: @pc:compho 1 ? 1 1 0 $! SrcFiles is a set of source files with includes expanded, and may $! include defined logicals and wild cards. Shorthand values: $! 1 gives the standard PMC source files phobos_root:[SIM.NEW.SRC]*.FOR; $! 2 gives the files from phobos_root:[MCSERV.PRO.SRC]*.FOR. $! Mode selects actions to be performed on source files: $! m to compile files modified since library insertion [default]; $! * to compile all; $! ? to confirm files individually. $! Work is the scratch area. Shorthand: $! 0 uses the current default directory; $! 1 uses the default disk$scratch:[USERNAME]. $! ObjLib is the object library; it will be created if necessary. Shorthand: $! 0 omits the compilation, for testing; $! 1 puts the object files in library disk$scratch:[USERNAME]PMC.OLB; $! 2 puts the object files in library disk$scratch:[USERNAME]SERVER.OLB; $! 3 leaves the object files in the Work area. $! DebLib is the debug-version object library, created if necessary. Shorthand: $! 0 omits the debug compilation; $! 1 puts the object files in library disk$scratch:[USERNAME]PMC_DBG.OLB; $! 2 puts the object files in library disk$scratch:[USERNAME]SERVER_DBG.OLB; $! 3 leaves the object files in the work area. $! Report = 0 for none, 1 for filenames, 1 for more info [no prompt]. $! Ignore the informational message %SEARCH-I-NOMATCHES, no strings matched, $! which is issued whenever a new module is entered into an object library. $! 16-Nov-96: R. Verdier Based on unix script compho, completely revised. $! Work in progress: $! (1) Eliminate Search info message for each module not in the library $! (2) Search also gives an error when the filename is not = the module name $! (3) Better shorthands? Tokens like /n and /v have to be quoted, "/n", $! if used as arguments. $! $ Say = "write sys$output" $! Define the default work area as disk$scratch:[USERNAME] $ Work = f$trnlnm("sys$login") $ Work = "disk$scratch:''f$extract(f$locate("[",Work),f$length(Work),Work)'" $ Report = 1 $ if p6 .nes. "" then Report = p6 $! $! Default standard source file set: $ Vers = "PRO" $ StdSrcs = "phobos_root:[SIM.''Vers'.SRC]*.FOR" $! Default server source file set: $ SrvSrcs = "phobos_root:[MCSERV.PRO.SRC]*.FOR" $! $! Default libraries for normal use: $ StdLib = "''Work'PMC.OLB" $ StdDebLib = "''Work'PMC_DBG.OLB" $ SrvLib = "''Work'SERVER.OLB" $ SrvDebLib = "''Work'SERV_DBG.OLB" $! The following public versions should NOT be created in place; instead, $! code managers should create and test scratch versions and then copy $! them to the public areas, with proper ACL settings: $! StdLib = "phobos_root:[SIM.''Vers'.LIB]PMC.OLB" $! StdDebLib = "phobos_root:[SIM.''Vers'.LIB]PMC_DBG.OLB" $! SrvLib = "phobos_root:[MCSERV.PRO.LIB]SERVER.OLB" $! SrvDebLib = "phobos_root:[MCSERV.PRO.LIB]SERV_DBG.OLB" $! $ StdLibList = "''Work'tmplib.lis" $ DebLibList = "''Work'tmpdeblib.lis" $! $! Delete old copies of the source and library directories, in case a $! previous job crashed $ if f$search("''Work'srcdir.lis") .nes. "" then del 'Work'srcdir.lis;* $ if f$search(StdLibList) .nes. "" then del 'StdLibList';* $ if f$search(DebLibList) .nes. "" then del 'DebLibList';* $! $! Ask for source files set if unspecified: $ SrcFiles = StdSrcs $ if p1 .eqs. "" $ then $ Say "Enter source filename set (wildcards & logicals OK), or" $ Say " 1 = ''StdSrcs'," $ Say " 2 = ''SrvSrcs'," $ inquire/nopunct p1 " CR = ''SrcFiles': " $ endif $ if p1 .nes. "" then SrcFiles = p1 $ if SrcFiles .eqs. "1" then SrcFiles = StdSrcs $ if SrcFiles .eqs. "2" then SrcFiles = SrvSrcs $! Separate the directory and filename parts, allowing logicals: $ ldir = f$locate("]",SrcFiles) + 1 $ lco = f$locate(":",SrcFiles) + 1 $ len = f$length(SrcFiles) $ if ldir .gt. len then ldir = lco $ if ldir .gt. len then ldir = 0 $ SrcDir = f$extract(0,ldir,SrcFiles) $ if Report .ge. 2 then Say "SrcFiles=", SrcFiles, ", SrcDir=", SrcDir $! $! Ask for action mode if unspecified: $ Mode == "m" $ if p2 .eqs. "" then inquire/nopunct p2 - "Compile all | selected | modified files (a | s | m) [''Mode']? " $ if p2 .nes. "" then Mode == f$edit(p2,"LOWERCASE") $! $! Ask for work area if unspecified: $ if p3 .eqs. "" $ then $ Say "Enter work directory name for created files, or" $ Say " 0 = current default directory," $ inquire/nopunct p3 " 1 or CR = ''Work': " $ endif $ if (p3 .nes. "") .and. (p3 .nes. "1") then Work = p3 $ if Work .eqs. "0" then Work = "" $! $! Ask for object library if unspecified: $ ObjLib = StdLib $ if SrcFiles .eqs. SrvSrcs then ObjLib = SrvLib $ if p4 .eqs. "" $ then $ Say "Enter object library name, or" $ Say " 0 not to compile," $ Say " 1 = ''StdLib'," $ Say " 2 = ''SrvLib'," $ Say " 3 to leave object modules in the work directory," $ inquire/nopunct p4 " CR = ''ObjLib': " $ endif $ if p4 .nes. "" then ObjLib = p4 $ if ObjLib .eqs. "1" then ObjLib = StdLib $ if ObjLib .eqs. "2" then ObjLib = SrvLib $! $! Ask for debug object library if unspecified: $ DebObjLib = StdDebLib $ if ObjLib .eqs. SrvLib then DebObjLib = SrvDebLib $ if p5 .eqs. "" $ then $ Say "Enter debug object library name, or" $ Say " 0 not to compile," $ Say " 1 = ''StdDebLib'," $ Say " 2 = ''SrvDebLib'," $ Say " 3 to leave object modules in the work directory," $ inquire/nopunct p5 " CR = ''DebObjLib': " $ endif $ if p5 .nes. "" then DebObjLib = p5 $ if DebObjLib .eqs. "1" then DebObjLib = StdDebLib $ if DebObjLib .eqs. "2" then DebObjLib = SrvDebLib $! $ if Report .ge. 1 $ then $ Say "You can safely ignore any informational messages of the form" $ Say """%SEARCH-I-NOMATCHES, no strings matched""" $ endif $! $! Get a directory of requested source files with revision dates $ dir/date=mod/out='Work'srcdir.lis 'SrcFiles' $! $! Loop over lines in the listing getting file names and dates $ open/read srcdir 'Work'srcdir.lis $ Act == "y" $ on CONTROL_Y then goto END $ READDIR: read/end_of_file=ENDRD srcdir line $! Does the line contain a file name, identified by ";"? $ lsc = f$locate(";", line) $ len = f$length(line) $ if lsc .lt. len $ then $! Yes, extract the file name and the revision date, without .01 sec $ if Report .ge. 2 then Say "Line= ", line, "*" $ FileName = f$extract(0,lsc,line) $ FullName = SrcDir + FileName $ BaseName := 'f$extract(0,f$locate(".",FileName),FileName)' $! RevTime = f$edit(f$extract(lsc+3,len-lsc-6,line),"TRIM") $ RevTime = f$extract(len-23,20,line) $ if f$extract(0,1,RevTime) .eqs. " " then - RevTime = "0" + f$extract(1,19,RevTime) $ if Report .ge. 2 then Say FullName, " modified ", RevTime, "." $! $! Compile the file $ Cflags = "" $ Label = "" $ LibList = StdLibList $ if ObjLib .nes. "0" then call CC "''ObjLib'" "''work'" $ if DebObjLib .nes. "0" $ then $! Compile the source with debug $ Cflags = "/debug/noopt" $ Label = "debug version of " $ LibList = DebLibList $ call CC "''DebObjLib'" "''work'" $ endif $ endif $ if Act .nes. "q" then goto READDIR $ ENDRD: close srcdir $ END: $ if f$search("''Work'srcdir.lis") .nes. "" then del 'Work'srcdir.lis;* $ if f$search(StdLibList) .nes. "" then del 'StdLibList';* $ if f$search(DebLibList) .nes. "" then del 'DebLibList';* $ exit $! $ CC: SUBROUTINE $! Subroutine for conditional compilation into library $! Use: cc olb work $ on CONTROL_Y then Act == "q" $ if (Act .eqs. "q") then exit $! $! Create library, if non-existent $! Note: this should be deferred until we know we need it *** $ if (f$search(p1) .eqs. "") .and. (p1 .nes. "3") $ then $ lib/create 'p1' $ Say "Created ''p1'." $ endif $! Get module insertion date $ InsDate = "" $ if (p1 .nes. "0") .and. (p1 .nes. "3") $ then $ if f$search("LibList") .eqs. "" then lib/list='LibList'/full 'p1' $ sear/out='Work'tmpmod.lis 'LibList' 'BaseName' $ open/read insline 'Work'tmpmod.lis $ read/end_of_file=EOF insline InsDate $ EOF: close insline $ del 'Work'tmpmod.lis; $ endif $ InsTime = f$extract(f$location("Inserted ", InsDate) + 9, 20, InsDate) $ if Report .ge. 2 then Say BaseName, - " inserted into library on ..", InsTime, "." $ if (Mode .eqs. "s") $ then $ inquire/nopunct reply - "Compile ''Label'''BaseName' ( y | n | a(ll) | q(uit)) [''Act']? " $ if reply .nes. "" then - Act == f$edit(f$extract(0,1,reply),"LOWERCASE") $ if (Act .eqs. "a") then Mode == "a" $ if (Act .eqs. "q") then Mode == "0" $ endif $ if (Mode .eqs. "a") - .or. ((Mode .eqs. "m") .and. (RevTime .gts. InsTime)) - .or. ((Mode .eqs. "s") .and. (Act .eqs. "y")) $ then $ ObjName = "''p2'" + BaseName + ".OBJ" $ if Report .ge. 1 then Say "Compiling ", Label, BaseName $ for'Cflags' /obj='ObjName' 'FullName' $ if p1 .nes. "3" $ then $ lib /replace 'p1' 'ObjName' $ del 'ObjName'; $ endif $ endif $ exit $ ENDSUBROUTINE +PATCH,DOC. *CMZ : 1.01/00 18/04/94 16.12.57 by Phobos (R. Verdier) +DECK,PMCUSER ,T=DATA. *CMZ : 2.00/01 04/03/96 11.12.05 by Phobos (R. Verdier) *-- Author : PMCUSER.DOC Users' Guide to the Monte Carlo for the Phobos Detector at RHIC Robin Verdier, MIT/LNS [verdier@mitlns.mit.edu] V1.3: 15 March, 1995 V1.2: 09 December, 1992 1. Overview 2. Demo Program 3. Phobos Directory Structure and Access at MIT 4. Input Geometry and Control File Specifications 5. Input Geometry and Control Variables 6. Output File Specifications 7. Running Interactively 8. Running in Batch Mode 9. Differences Between Workstations 10. Present Status, Known Problems, and Future Plans 11. Linking a Standard Executable Module 12. Linking a Private Executable Module Without MMS 13. Copying the MC System to Another Site 14. History 15. Changes To the Standard Version for the Background Studies Appendix A: A Geometry Definition File Appendix B: A Control File Appendix C: The User Geometry and Control (UGC) System Appendix D: Directory of Phobos MC Files 1. Overview The Phobos Monte Carlo (PMC) is a developing package whose goal is to make full simulations of track production and propagation through a detailed model of the Phobos Detector at RHIC. Two event sources are provided at present: o A diagnostic generator, BANG, creates up to 100 particles of a specified type with a specified momentum distribution. o A track reader, in subroutine GUKINE, reads lists of particle types, production vertices, and momenta from an ASCII format text file. This provides the interface for reading events created by the HIJet, Fritiof, Venus, and other ion-ion generators. Secondary particles, produced through interactions of particles with the detector materials (beam pipe, vertex detectors, silicon planes, and cryostat) are also propagated and tracked. A design goal of the PMC package is that all important geometrical information about the detector is specified in ASCII text files. In addition to providing easy access to the geometry information, this allows us to study alternative detector configurations without recompiling and relinking the (ultimately very large) program. We also intend that the ease of comparing specification files will help to ensure that studies carried out at different sites yield identical results. Outputs include o DST output, written to a PAW ntuple file, which can be used for subsequent interactive analysis and graphical output. o Histogram output, which can be produced during the run through HBOOK calls and saved via ZEBRA. o Zebra bank structures, saved on disk for use as input to separate reconstruction programs such as those for track finding and fitting. 2. Demo Program To see the Phobos Monte Carlo in action, type $ def pc phobos_root:[sim.new.cmd] $ @pc:demo and follow the instructions. CAUTION: please do not set your default directory to the pc subdirectory; this will leave any output that you create, such as ntuples, in the phobos area. If unexpected results occur, it may be because you have existing logical name definitions, such as cards$def, that conflict with those used in the demo; see the last paragraph of Section 7 for more information. 3. Phobos Directory Structure and Access at MIT The Phobos files are contained in a tree structure whose root is PHOBOS_ROOT, defined system-wide at MIT/LNS by the DCL command $ def PHOBOS_ROOT _ARNOLD$DKA200:[PHOBOS.] The Monte Carlo files are contained in the [SIM] part of the structure: Phobos_root:[SIM] [DOC] Documentation [PRO] [CMD] Command procedures, usually *.COM [CMZ] CERN code management files, usually *.CMZ [CRA] CMZ correction cradles [DAT] Data files, usually *.TXT or *.DAT [DOC] Documentation files, usually *.DOC [EXE] Executable files, usually *.EXE [INC] Include files, usually *.CMN [LIB] Libraries, usually *.OLB [SRC] Source code, usually *.FOR [NEW] [Same substructure as for PRO] For example, the geometry initialization subroutine in use now is phobos_root:[sim.new.src]UGINIT.FOR. Most references to Phobos files are expected to be made by logical definitions; for example, to run the X-windows version of the executable module, MCXD.EXE, you could execute $ def pmc_exe phobos_root:[sim.new.exe] $ run pmc_exe:mcxd As we shall see in the following sections, this would not be sufficient unless other names defining the geometry, magnetic field map, control options, and output files were also defined; normally they would also use logical definitions. Procedures for defining the standard logical names exist and are described in Sections 5 and 6. We have exercised some care in drawing the distinction between the DEVELOPMENT, NEW, and PRO versions: DEVELOPMENT is the designation of new code that is being written in the developer's private user area. Using it is a matter of private agreement between developer and user. NEW is the area into which DEVELOPMENT code migrates once it has reached the 'no known bugs' stage. It provides a holding area where new or corrected code can be further tested by general users. Proposed code changes in the NEW area normally require a written notice in the appropriate VAXNotes conference (underway but not yet operating) at least one week prior to the change. PRO is the current standard working version of the system, into which NEW code migrates at irregular intervals. Proposed code movement into the PRO area normally requires a written notice in the appropriate VAXNotes conference at least two weeks prior to the change. The implementation details of this version structure may change slightly when we enable the VMS code management system, CMS. Access to Phobos files is via an Access Control List. All files have read and execute privileges for all users; write and delete privileges are limited to those on the Access Control List. As this access carries a significant burden, namely the implied responsibility to ensure that files are not inadvertently deleted, and because deleting public code should be necessary only at well-publicized times, the Access Control List is intended normally to include only persons charged with maintaining (as opposed to creating) code, including subsystem code managers. 4. Input Geometry and Control File Specifications All files are opened by Fortran statements specifying logical names. If the logical name has not been assigned to a file, VMS will attempt to open a file named .dat. Input files are opened in subroutine UFILES, using parameterized logical unit numbers. This system will be replaced by a file server, which will assign units dynamically and also concentrate the code most likely to change in porting to other operating systems. Five input files are required, each specifying a different kind of information about the detector. The geometry and control files can be combined for convenience into a single file; they may in future be further split. The purpose of splitting them is to reduce the possiblity of changing the detector description by mistake. Sample standard input files are provided in the area pmc_dat, defined as phobos_root:[sim.new.data], and are also reproduced in the Appendices to this document. a. The input geometry file, identified by logical name GCDEFS, is a text file that completely specifies the geometry, materials, and tracking media of Phobos, including the number, locations, orientations and granularities of the silicon detector planes. This file is in a free format specifed by the User Geometry and Control (UGC) system, which was developed for the Phobos analysis. Appendix D describes the UGC format in some detail, and Appendix A lists examples of inputs. The steering routine for UGC is UGCIN. A few examples will serve to illustrate the concept: the line GS MATE 4 SILICON$ 28.09 14.0 2.33 9.36 45.5 0 0 defines silicon as the fourth material known to Geant, with A, Z, density, ... listed. The form is exactly that of the arguments to the Geant subroutine GSMATE, and in fact the UGC system simply parses the input line and passes the specified values to GSMATE. Similarly, ! # Name Mat Bmax MSmx DEmx Eps StMn GS TMED 2 BERYLLIUM$ 2 0 0 0. 5.0 0.5 0.20 .001 0.40 0 0 defines beryllium as tracking medium # 2; GS ROTM 32 90. 0. 0. 0. 90. 270. defines rotation matrix # 32, and GS VOLU SPEC TRD1 3 0. 1.7 19.05 3.5 16.15 ! Virtual vol defines a trapezoid named SPEC, with the listed half-dimensions. The volume shape parameters can be given as a vector; see the Appendix for details. GS SET NBITSH 24 24 24 24 24 16 16 16 16 ! Bit packing defines detector plane packing properties, and ! Silicon plane parameters (dimensions may be redundant at present): ! Pl# Hdim Hpix Vdim Vpix Thk D2IP Hoff Angl GS SET SLP 1 7.5 0.15 3.4 0.15 0.030 11.0 0. 0. defines the resolution properties of detector plane #1, for use by the Phobos hit encoding routines. The important point is that the Phobos geometry is defined entirely by the contents of this file, so that new structures can be added with no additional coding. b. The input control file, identified by logical name RHDATA, is a text file specifying the variables that control the operation of the program. This file is read and parsed by subroutine UGINIT, and then re-read by Geant subroutine GFFGO, from logical unit USRIN, parameterized as 4 in the include file IO.CMN. This file may contain both standard CERN free-format input, for example XOFF 20.0 and silicon plane definitions, such as SILD 1 7.5 0.15 3.4 0.15 0.03 SILP 1 11.0 0.0 0.0 pmc_dat:GEOCON.TXT is an example of an input control file; a copy appears in Appendix B. c. Another control text file, identified by logical name CARDS$DEF, allows the user to specify control variables interactively. This file is equivalent to the input control file in b. It is read by subroutine GFFGO, which is called by subroutine EUCARD, on logical unit 15 (this number is hard-coded in EUCARD). Because this facility is rarely used, it is called only if CARDS$DEF is connected to an actual file. Note that the geometrical and detector plane information can be supplied through either GCDEFS or RHDATA, to preserve backwards compatibility. Each facility can read all cards, but will process only the information prefixed by keywords that it recognizes. Thus, a single file that contains both geometry and control input can be used; both RHDATA and GCDEFS should be defined as the combined file. This approach has the advantage that all the input data is listed in the log file at the end of the job. d. The optional input event data file, identified by logical name GENEVS, is a text file listing tracks to be propagated. This file is read by subroutine GUKINE only if the control file specifies GEN=5. An file containing 100 200 Gev/u HIJET Gold-Gold events is irene$dka300:[TEMPORARY.WOZNIAK]AUAU_HIJET_CENTR_100.ADAT e. The magnetic field map, identified by logical name FLDMAP, is a text file specifying values of the field at an arbitrary set of spatial points. It is read in, sorted once, and used to provide values at requested points, by subroutine GUFLD. GUFLD contains a description of the data format and restrictions. The standard Phobos field map is in pmc_dat:FLDMAP.DAT. In the future, GUFLD may be replaced by GCFLD, which will read the field map in from a Zebra bank. 5. Input Geometry and Control Variables There is considerable self-documentation in both the geometry and control files, as the examples in the Appendices show. Some additional notes follow: GEANT units are cm, kGauss (not Tesla), GeV/c, and degrees. In the master coordinate system, Z is along the beam directed so that the projection of the coil center is at positive Z; Y is vertical, directed up; and X completes a right-handed coordinate system. The Sxxx variables control output; in particular, SHDO = 1/0 turns histograms in the log output on/off SNTU = 1/0 turns ntuple output on/off Three "geometry type" variables are specifiable: FANG, the angle of the spectrometer arm in degrees BFLD, the maximum magnetic field in kG XOFF, the lateral distance of the coil center from the beamline. These variables are used by GUFLD and by the diagnostic generator, BANG. Three additional variables control special forms of the field: TMAG is 0/1. for normal / perfect dipole field [default 0]. RFLD is the radius of the dipole field, if TMAG = 1 [20.] ZOFF is the distance of the center of the dipole field from the i.p. along the beam direction. The field map has the following format: each line contains ASCII values for Bx, By, Bz, x, y, z. GEN specifies the type of event generated; see BANG and UGINIT for details, but note that GEN is BANG's MODE + 1: GEN=1 is for a fixed track; 2 is for tracks distributed in momentum and position, pointing approximately at the detector planes regardless of production z; 3 is like 2 but not adjusted for production z, so many tracks will miss the detector; 4 gives a flat rapidity distribution and exponentially falling pt distribution. 5 reads events from a text file; it is used to study events produced by the Fritiof generator. Owing to a mix-up in calling sequences, GEN = 4 actually gives sequentially stepping momenta and/or angles; this will be incorporated into type 1, and GEN=4 reinstated as described here. Variables PLOW, PHIGH, and RMAG are parameters of the distributions for GEN = 2 and 3. 6. Output File Specifications Three output files are optionally created, in addition to the log file if running in batch mode: 6.1. The Zebra-format histogram file, identified by logical name RHHST. This file is created if the input control variable SHBO is nonzero. 6.2. An ASCII text output file, identified by logical name RHASC. This file contains requested diagnostic output, such as hits and ntuple contents. It also contains printed histograms if control variable SHDO is non-0. The diagnostic output is controlled by variables DEBUG and SWITCH; see GEOCON.DAT for examples. 6.3. An RZ-format ntuple output file, identified by logical name RHNTU. This file is created if control variable ANAL = 1.0. Any of the output files can also be suppressed by defining it as the null device, nl:; for example, $ def RHASC nl: Eventually, the full set of Zebra banks describing the entire event will optionally be written out for use as input to the pattern recognition programs. 7. Running Interactively A standard procedure called RMC.COM, in phobos_root:[sim.new.cmd], can be used to run the Phobos Monte Carlo interactively. Running the MC is unavoidably complicated by the large number of files and operating conditions that must be specified: o X-windows graphics support, VAXstations or X-emulators, vs. GKS, for Tektronix emulators or workstation windows, including VersaTerm PRO on the Macintosh and DECterm on a VAXstation; o Source debuging (with debug code linked in although not necessarily used) vs. non-debug code (potentially faster); o Test version code vs. production version. In addition, we must specify the geometry and control data files, the field map, the track input file (if used), and the names of output files discussed in the previous section. The system we have implemented for dealing with these choices specifies them by using logical names. The standard procedures expect these names to be defined in a user definition command procedure, or UDCP, whose filename is specified as an argument to the procedures. If you are a minimalist, and are using all standard data files, your UDCP need only specify "scratch", the area which is to receive any created files. $! RMCDEFS.COM: Phobos definitions $ def/nolog scratch disk$scratch:[username] In order to use this file, you must first copy it to your top-level directory, then change "username" to your username. Please DO NOT edit the sample file in place; if you do so, and if you are on the access control list, your version will become the public version. If you use your own data files, then you will want to include lines giving your versions precedence over the standard versions: $ def/nolog pmc_dat disk$csc:[username], - ! Use private data files phobos_root:[sim.new.data] The search list defining pmc_dat looks first in the user area and then in the standard area for any data files whose names are prefixed by pmc_dat. The same technique can be used for logical definitions of files of any type. Finally, if you are developing code, you may want an extended set of definitions such as the following: $! PHODEFS.COM: Phobos definitions $! Standard definitions: $ def/nolog pmc_cmd phobos_root:[sim.new.cmd] $ def/nolog pmc_exe phobos_root:[sim.new.exe] $ def/nolog pmc_inc phobos_root:[sim.new.inc] $ def/nolog pmc_lib phobos_root:[sim.new.lib] $ def/nolog pmc_mms phobos_root:[sim.new.cmd] $ def/nolog pmc_src phobos_root:[sim.new.src] $ def/nolog pmc_dat phobos_root:[sim.new.data] $! $! Definitions used only for linking new executables: $ def/nolog cern_root _$1$DUA8:[phobos.cern.new.] $ def/nolog cernlib cern_root:[lib] $! $! User definitions and overrides: $ def/nolog scratch disk$scratch:[username] ! Required to execute RMC $ def/nolog pmc_src disk$csc:[username], - ! Use modified source files phobos_root:[sim.new.src] $ def/nolog pmc_inc disk$csc:[username], - ! Use modified include files phobos_root:[sim.new.inc] $ def/nolog pmc_dat disk$csc:[username], - ! Use modified data files phobos_root:[sim.new.data] $! End of phodefs file RMC requires only that scratch be defined. It also uses pmc_exe and pmc_dat but defaults them, if they are not defined in PHODEFS, to phobos_root:[sim.new.exe] and phobos_root:[sim.new.data]. If you do source debugging, pmc_src and pmc_inc should also be defined to allow the debugger to locate the source code. RMC defaults them to phobos_root:[sim.new.src] and phobos_root:[sim.new.inc]. Assume that the standard link procedures described in section 9 have already been carried out, so that executable modules with the standard names exist. These have the form MC{X|G}{D| }.EXE where the first alternative is X for the X-windows version (for running on a VAXstation) or G for running the GKS version (Tektronix emulators, or VersaTerm PRO on a Macintosh). The second alternative is D for a version with debugging code linked in (it does not have to be activated in running), or blank for a non-debug version. The non- debug versions do not exist at present, so the alternatives are MCGD and MCXD. For simplicity, first define a mnemonic for the command area, for example, $ def pc phobos_root:[sim.new.cmd] You can now run the MC by typing $ @pc:rmc example: $ @pc:rmc mcxd Fritiof3 where , in area pmc_exe, is the name of the executable program; the example will run pmc_exe:MCXD.EXE is the name given to the created files, in area scratch:; in the example, these would be SCRATCH:FRITIOF3.ASC, FRITIOF3.NTU, FRITIOF3.LOG, ... , if non-blank, causes the MC to run under control of the VMS debugger. The RMC procedure also defines the symbol RMC as a string that will rexecute RMC with the previously specified parameters. Thus once you have executed it interactively, you can run again simply by entering the command $ 'rmc Note the apostrophe, which is necessary to cause DCL to translate the string. We have used this technique rather than defining rmc as a foreign command because the foreign command processor always runs the image in debug mode. If the program was linked with the debugger and the run command does not contain the qualifier /nodebug, the debugger will receive control and will prompt for input with DBG>. Online help for debugging is available here by typing h or help. To start the run, type go or g at this point. The program will now display some GEANT output, and then ask what type of workstation you are using. There are several possibilities here: If you are running the X-windows version of the Monte Carlo on a VAXstation in a DecTerm window, choose 1 for the workstation type. In this case you must previously have given the DCL command $ set display/create/user/node= possibly with the addition of the qualifier /trans={decnet | tcpip}, and you must also have used the session manager ... security menu to authorize yourself to write to the VAXstation. Incidentally, once you have done this, you can write on the VAXstation screen from any VAX session, and so can any other authorized user, which could be confusing. If you are running the GKS version of the Monte Carlo in a DecTerm window on a VAXstation, choose 211 for the workstation type. If you are running the GKS version of the Monte Carlo on a Macintosh using VersaTerm PRO, choose 82 for Tektronix 4107 color emulation, 72 for Tektronix 4010 monochrome emulation, or 14 for a VT200 ASCII terminal. After you have chosen the workstation type, the next prompt will come from GEANT; the reply trig n will cause the program to run for n events. An interactive display of the entire Phobos detector can be created by typing draw outs 80. 90. 90. 10. 10. 0.12 0.12 The first three arguments are viewing angles in degrees; the next two specify the center of the picture, and the last two its x- and y- scale factors. Once this is done, subsequent tracks will be displayed as they propagate through the detector. A more elaborate drawing of the detector, with different segments in color, may be created by executing the KUIP macro DRAWPHOB.KUMAC: exe pc:drawphob If this is done before generating an event, the display will show the hits as the tracks propagate through the detector. Type next at the Geant > prompt to clear the display. You can get Geant help by typing ? as the response to its prompt. At the end of the job, type exit to finish. Quit will abort the job immediately, but it will leave the output ntuple unusable, as will aborting the job at any point by typing (sometimes you must do this twice to get the job to stop). A word of caution is in order, about the persistence of logical name definitions when used interactively. If you execute RMC, and PHODEFS defines pmc_dat, for example, as a special subdirectory, this definition will carry over into all subsequent work, until you log out. Conversely, if logicals used by RMC, such as pmc_dat, pmc_exe, RHDATA, GCDEFS, CARDS$DEF, FOR037, FLDASC or FLDZBR are already defined, and are not redefined in your PHODEFS.COM, the previous definitions will override the defaults in RMC. This allows users to make special definitions without having to edit command files, which can be useful; but if the user is unaware of the previous definitions, for example those made in a login or setup procedure, it can lead to very confusing results. This may eventually lead us to deassign the logical names at the end of the procedure. See pmc_cmd:RMC.COM for the complete list of logicals that it uses. 8. Running in Batch Mode The standard command procedure SMC.COM, in pmc_cmd, submits RMC to run the Phobos MC as a batch job. SMC requires the same logicals as RMC. It also uses pmc_cmd, but defaults it to phobos_root:[sim.new.cmd]. $ @pc:smc example: $ @pc:smc mcxd Fritiof3 long where and have the same significance as for rmc, and queuename defaults to "medium". In particular, the log file will be found in scratch:.log. The SMC procedure also requires files to start the debugger and to specify the number of events; these are called PMCDEBUG.TXT and PMCBATCH.TXT, respectively, and are looked for in the pmc_dat area. For example, if the files PMCDEBUG.TXT and PMCBATCH.TXT contain ! PMCDEBUG.TXT: debug commands for running the Phobos MC in batch mode GO QUIT and * PMCBATCH.TXT: command file to run Phobos MC in batch mode TRIG 100 EXIT the MC will run for 100 events. The version of PMCBATCH in the standard data area is set for 10 events; to change this you can define pmc_dat by a search list, as in Section 5, to allow your own version to take precedence over the system version. There is also a COMIS-based procedure, called SETBATCH, that can be invoked to set batch mode without using a batch command file. 9. Differences Between Workstations The VAXstations using DECwindows require the set display command already noted above: $ set display/create/user/node= in order that the graphics information will be sent to your workstation. There are still some mysterious occurences under DECwindows; this situation may improve soon, when the graphical interface Motif is introduced. A Macintosh running the GKS version under VersaTerm PRO works reasonably, displaying the graphics in a second window. You must click on the text window to type normally into it; if you try to type blind, you must use shift-space instead of space. If you try to display an event with more than about one hundred tracks, VersaTerm beeps and loses tracks, and the display is corrupted. This is probably a result of saving tracks for re-drawing; we do not know of a remedy. The Next runs the GKS display with no known problems. We are investigating the X-windows version on the Next. We have not run the PMC on any other platforms yet. 10. Present Status, Known Problems, and Future Plans An existing problem in some of the code is its use of VAX extensions to ANSI Fortran. We may pay heavily for these powerful conveniences when we try to port to other operating systems. The use of commons with the same file name (COMMON.NTU, COMMON.HST) and with the same file name as a subroutine (BANG.CMN, BANG.FOR) is apparently unacceptable for the text libraries required for the code management system; these names will be changed. The angle of the spectrometer arms, FANG, is not as easy for surveyors to use as the Z-position of the cryostat center, ZC, which is calculated in the programs; ZC will replace FANG as the primary definition. The standard field map contained 8 bad values = -4E10; there is a hand-corrected version in pmc_dat:FLDMAP.DAT. The GUFLD reading of text values will shortly be replaced by the Zebra bank version, read by GCFLD. The output stage should be changed so that both geometry and control datasets can be written into the output. Two Ntuples should be written, one containing only truth information and updated for every track, the other containing also hits information and updated only for tracks with hits. GUSTEP.FOR, and others including GCKING.CMN, require the compiler /ext switch, because GCKING has a line longer than 72 characters; this line should be split. 11. Linking a Standard Executable Module Standard link and build procedures are available in the pmc_cmd area, primarily for use by code writers and maintainers. o MAKEMC.COM: updates the MC library and links an executable image o LINKMC.COM: links private modules with the Phobos system o PMC.MMS: Phobos MMS description file invoked by MAKEMC. MAKEMC creates the executable image by using the DEC MMS, or Module Management System, using the MMS description file PMC.MMS. MAKEMC requires pmc_mms, pmc_exe, and pmc_lib, plus the requirements of PMC.MMS, namely pmc_src, pmc_inc, pmc_cmd, cern_root, and cernlib. It defaults them to the standard definitions in the extended example of PHODEFS.COM given in Section 7. LINKMC requires pmc_src, pmc_inc, pmc_exe, pmc_lib, cern_root, and cernlib. It defaults pmc_src and pmc_inc to the standard definitions of the example. The standard links in PMC.MMS and LINKMC.COM have no undefined references. MAKEMC can also be used to test new code within the Phobos MC. To check whether the system is up-to-date, i.e., that program sources or include files called in by them have been changed since the programs were last compiled, and whether any object files have changed since the executable image was made, or to update the library or make a new executable: $ @pc:makemc [exe] [lib] [test] example: $ @pc:makemc x d where w is x for the x-windows version or g for the GKS version d is d for the debug version exe is non-blank to check the executable, or "MAKEEXE" to remake the executable image lib is non-blank to check the library, or "MAKELIB" to remake the object library test is the full name of linker options file that can contain linker instructions to include user development object modules, followed by /opt example: $ @pc:makemc x d makeexe "" disk$csc:[user]TEST.OPT/opt where TEST.OPT might contain the linker directives pmc_lib:pmc_dbg.olb/include=(gephob,gufld,guout,gustep,gutrev) disk$csc:[user]gukine,guinit and you have already compiled your test versions using for example $ for/debug/noopt gukine Warning: anybody on the Phobos access control list can execute the MAKEMC procedure using the default logical definitions phobos_root:[sim.new.lib] for pmc_lib and phobos_root:[sim.new.exe] for pmc_exe, and inadvertently incorporate their private code into the public library and/or add a new executable image. Therefore, please exercise EXTREME CAUTION in using the MAKEMC procedure. If you do use it to create a private executable image and/or a private library on scratch disk, make sure that pmc_exe and pmc_lib are defined as disk$scratch:[your_username] in your PHODEFS.COM file. Alternatively, as long as you do not use the passwords "makeexe" and "makelib", the procedure is perfectly safe. If unsure how to use MAKEMC, you can use LINKMC, as described in the next section. 12. Linking a Private Executable Module Without MMS A simpler procedure, called LINKMC, allows users to create test versions of the Monte Carlo without the complexities of MMS. To link a test version of the system, make a copy of pc:LINKMC.COM in your area, change the module name (BANG, in the example) as desired, add lines for other new subroutines to be tested, and then execute $ @pc:linkmc {x|g} where x will create pmc_exe:MCXD.EXE, and g will create pmc_exe:MCGD.EXE. The actual link used by LINKMC is the functional equivalent of that in PMC.MMS, with slight differences in the logical and macro syntax; the string 'dbg' is either blank or "_DBG" depending on the version required, p1 is X or G, and 'Vers' is "NEW" or "PROD": $ def/nolog cern_root _$1$DUA8:[PHOBOS.CERN.NEW.] $ def/nolog cernlib _$1$DUA8:[PHOBOS.CERN.NEW.LIB] $ def/nolog phobos_root _$1$DUA8:[PHOBOS.] $ def/nolog geantlib cernlib:GEANT315'dbg'.OLB $ def/nolog grafdgks cernlib:GRAFDGKS'dbg'.OLB $ def/nolog graflib cernlib:GRAFLIB'dbg'.OLB $ def/nolog grafx11 cernlib:GRAFX11'dbg'.OLB $ def/nolog pmclib phobos_root:[SIM.'Vers'.LIB]PMC'dbg'.OLB $ def/nolog pmc_cmd phobos_root:[SIM.'Vers'.CMD] $ def/nolog packlib cernlib:PACKLIB'dbg'.OLB $ def/nolog kernlib cernlib:KERNLIB'dbg'.OLB $ def/nolog pawlib cernlib:PAWLIB'dbg'.OLB $ def/nolog streamlib cern_root:[LOCAL.lib]stream'dbg'.OLB $! Choose X-windows or GKS graphics support: $ def/nolog glib grafx11 $ gsharelib = "pmc_cmd:X11/opt" $ if p1 .eqs. "G" $ then $ def/nolog glib grafdgks $ gsharelib = "sys$share:GKSFORBND/lib" $ endif $! Note the link order determines whether Geant, Phobos, or private $! versions of modules are used. $! Force Phobos modules rather than Geant dummies to be taken: $ Incs = "/inc=(GUFLD,GUKINE,GUOUT,GUSTEP,GUTREV)" $ LINK'MapOpt'/exe='Exename' - pmclib/inc=(GEPHOB), - pmc_obj:BANG, - pmclib/lib'Incs', - geantlib/lib, - pawlib/lib, - graflib/lib, - packlib/lib/inclu=RZKEYD, - glib/lib, - kernlib/lib, - streamlib/lib, - 'gsharelib', - pmc_cmd:GEPHOB/opt The easiest way to use this procedure is to define your scratch disk as pmc_exe. Add to your LMCDEFS.COM file the definitions $ def pmc_exe disk$scratch:[your username] $ def pmc_src [your area for new source files] $ def pmc_inc [your area for new .CMN files, if any], - phobos_root:[sim.new.inc] and execute your modified copy of LINKMC; for example, $ @linkmc g to link the GKS (Tektronix) version; with the g replaced by x, or omitted altogether, this will link the X-windows version. You should then be able to run the MC by executing $ @pmc_cmd:rmc [outfilename] [rmcdefs] or $ @pmc_cmd:smc [outfilename] [rmcdefs] [queue] as previously discussed. 13. Copying the MC System to Another Site You can always run the MC from a remote workstation used solely as a graphics display device, as discussed in section 7, Running Interactively. If communications between MIT and the other site are too slow or noisy to be usable, you can also copy the essential parts of the Phobos software system to the other site. As the total Phobos disk usage is presently about 280 k blocks (140 MB) and 1800 files, much of which is for packages such as Isajet and Garfield that are not used by the Phobos MC, copying should be selective, and we will describe three packages which one might want to copy. Soon, we will back up the whole Phobos system on 8 mm. tape, which can also be used for transporting the system. In this section we will use the following standard logical names for brevity, with = "new" or "prod" as desired: phobos_root = _$1$dua8:[PHOBOS.] cern_root = phobos_root:[cern.new.] cernlib = cern_root:[lib] pmc_cmd = phobos_root:[sim..cmd] pmc_dat = phobos_root:[sim..data] pmc_exe = phobos_root:[sim..exe] pmc_inc = phobos_root:[sim..inc] pmc_lib = phobos_root:[sim..lib] pmc_src = phobos_root:[sim..src] 13.1. A Minimal Package In case you want to run the standard procedures, modifying the control and possibly the geometry and event input files, but not changing the programs, you should copy the following: Command procedures in pmc_cmd: DEMO.COM, DRAWPHOB.COM, PHODEFS.COM, RMC.COM, SMC.COM Control files in pmc_data: GEOCON.TXT, GEOCODEMO.TXT, UGCDATA.TXT An optional sample data file of tracks from 200 Gev/u Gold-Gold peripheral collisions, generated by CGP using the Fritiof event generator, in phobos_root:[GEANT.FRITIOF]: SIM_10E_AU_AU_200GEV_7P5_8P5.DAT Executable image(s) in pmc_exe: MCGD.EXE, for GKS graphics support (Macintosh with VersaTerm PRO) MCXD.EXE, for X-windows graphics support (VAXstation DECterm window) To use the standard procedures, you must copy PHODEFS.COM into your highest-level directory and change it to define the logical "scratch" to point to the directory in which you want your output files to be created. If you have not replicated the Phobos directory structure described in Section 3, your PHODEFS.COM must also define pmc_cmd, pmc_dat, and pmc_exe in accordance with your directory structure. If you do not use the standard procedures, you must define the logical names listed in Sections 4 and 5 to specify the necessary input and output files. There are two limitations to this approach. First, the executable images are larger than 6 MB, and the transfer may be difficult if the lines are noisy or erratic. Second, the VAX debugger cannot display source code unless the source code is available. 13.2. A Development Package If you want to do source code debugging or to create private development versions of programs, you will need to copy, in addition to the standard command and control files listed in the previous subsection, but not including the executable images, the following standard files, where 'dbg' is _DBG or blank as described in Section 12: Command procedures in pmc_cmd: LINKMC.COM, MAKEMC.COM Control files in pmc_data: PMC.MMS Source code in pmc_src, for source debugging or development: *.FOR Include files in pmc_inc, for source debugging or development: *.CMN, COMMON.* CERN libraries in cernlib: GEANT315'dbg'.OLB, GRAFDGKS'dbg'.OLB, GRAFLIB'dbg'.OLB, GRAFX11'dbg'.OLB, KERNLIB'dbg'.OLB, PACKLIB'dbg'.OLB, PAWLIB'dbg'.OLB CERN library in cern_root:[LOCAL.lib]: STREAM'dbg'.OLB VAX Fortran bindings for GKS (not needed for the X-windows version): sys$share:GKSFORBND.OLB Shareable image for GKS support, satisfying nine unused undefined weak references FREE, LSEEK, MALLOC, OPEN, PERROR, QNEXT, READ, USLAST, and WRITE, to eliminate linker error condition (not needed for the X-windows version): sys$library:VAXCRTL.OLB Shareable image for X-window support, brought in by X11.OPT (not needed for the GKS version): sys$share:DECW$XLIBSHR.EXE Linker option files (X11 is not needed for the GKS version): pmc_cmd:X11.OPT, pmc_cmd:GEPHOB.OPT You can now use the MAKEMC and/or LINKMC procedures described previously, to link standard and private versions of the MC. While the source code is presently less than 200 kB, the object libraries are relatively large: GEANT315.OLB is 2.1 MB, PAW.OLB 1.2 MB, and PACKLIB 2.5 MB. The debug versions (GEANT315_DBG.OLB, etc., are 40 to 80% larger than the non-debug versions. A useful alternative, therefore, is to copy the source code and procedures from MIT but to use a set of CERN libraries that already exists at the remote site. 13.3. A Complete Package Sometimes the only way to find out what Geant is actually doing is to consult the source code. Since these instances are rare, and since the source code is kept in Patchy .CAR format, it should normally be consulted by logging into the MIT VAX cluster, or any other institution that keeps copies of the source code. If you are nevertheless determined to maintain copies of the sources, they can be found in directory cern_root:[src.car] as GEANT315.CAR, KERNFOR.CAR, PAW.CAR, ZEBRA.CAR, ... These are not in a form to be compiled direcly; one has to use Patchy for that. They range from .5-3 kblocks (.2-1.5 MB) in length. 14. History The Geant - Phobos package was created by Don McLeod at UIC in 1991 and 1992. He released the first fully functional version, containing one arm of Phobos with simplified detector planes and a beam tube, in April 1992, when it was brought to MIT. This document has its genesis in Don McLeod's original notes from that period. In May, 1992, Chuck Parsons restructured the description, adding user hooks and the ability to read data generated by other generators such as the Fritiof ion-ion generator. He also brought the newest CERN libraries, GEANT, and PAW to MIT, produced pictures of Fritiof events, and set up the DEC CMS code management system, with MMS, for future use in maintaining code. Subsequently, Jing Shea added the cryostats and second arm, and made macros for drawing the detector, Krzysztof Wozniak produced code for the test magnetic field and detector noise and efficiency, and Henryk Dabrowski ran studies of secondary production with the Venus generator for O-O collisions. Chuck Parsons and Robin Verdier added facilities to handle secondary hadronic production and add secondary tracks to the output ntuples, and changed the geometry to agree more closely with the LOI. Parsons also introduced segmented final planes, and produced hit distribution pictures. This system was used to do the calculations for the Phobos Proposal. Following the decision taken at the collaboration software meeting of October 25, Verdier added the UGC text geometry and control input system, McLeod improved the BANG diagnostic generator distributions, and Dave Woodruff corrected the undefined weak reference problem in the GKS link. 15. Changes To the Standard Version for the Background Studies GUOUT.FOR: CSAVE, IZEB, USRZEB, and IER were defined. INCLUDEs for IO.CMN and FLAG.CMN were added to define USRZEB and IZEB, with local definitions of CSAVE and IER, and set IZEB to 0; this may need a more permanant correction. GUKINE, BANG, and PH_OUT were modified to agree with the original GPH; new common UJKBUF.CMN was added for the user words in JKINE; COMMON.HST was copied from the standard area. Appendix A: A Geometry Definition File The following is a copy of the standard version of pmc_dat:UGCDATA.TXT: ! Geometry and material definitions for Phobos ! VER 1.1, 20-Nov-92 ! ! Material definitions: ! A Z Dens Lrad Labs U Nu GS MATE 1 VACUUM$ 1.e-16 1.e-16 1.e-16 1.e+16 1.e+16 0 0 GS MATE 2 BERYLL$ 9.01 4.00 1.848 35.3 36.7 0 0 GS MATE 3 HELIUM$ 4.00 2.00 1.91e-4 4.94e5 3.41e5 0 0 GS MATE 4 SILICON$ 28.09 14.0 2.33 9.36 45.5 0 0 GS MATE 5 IRON$ 55.85 26.0 7.87 1.76 17.1 0 0 GS MATE 6 ALUMINUM$ 26.98 13.0 2.7 6.0 70.0 0 0 ! Mixture: A(1) A(2) Z(1) Z(2) Dens # W(1) W(2) GS MIXT 7 NbTi$ 92.9 47.9 41.0 22.0 6.55 2 0.5 0.5 ! ! Tracking medium definitions (all media initially taken equal): ! # Name Mat Is If Bmax Tmax MSmx DEmx Eps StMn U Nu GS TMED 1 VACUUM$ 1 0 0 0. 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 2 BERYLLIUM$ 2 0 0 0. 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 3 HELIUM$ 3 0 1 45.0 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 4 SILICON$ 4 1 1 45.0 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 5 IRON$ 5 0 1 45.0 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 6 ALUMINUM$ 6 0 1 45.0 5.0 0.5 0.20 .001 0.40 0 0 GS TMED 7 COIL$ 7 0 1 45.0 5.0 0.5 0.20 .001 0.40 0 0 ! ! Geometry definitions: ! The dimension parameters for the master volume are defined as follows: ! xmins = swid(1)/2 = 3.75; zmins = srad(1) = 11.0; ! xmaxs = swid(11)/2 = 19.05; zmaxs = srad(11) = 43.3; ymaxs = 3.5 ! cryostat: half height YCRH = 20.0, half vertical separation YGAP = 6.0, ! wall thickness THCR = 0.25 ! spectrometer arm polar angle w.r.t. beam axis FANGL = 40.0 degrees ! distance of coil center from beamline XOFF = 20.0 ! ! Used by the BANG generator and by GUFLD: GS SET FANG 40.0 ! Spectrometer arm polar axis, degrees GS SET XOFF 20.0 ! Distance from beamline to coil center, cm. ! Used by GUFLD: GS SET BFLD 45.0 ! Scale factor multiplying the field map values ! ! xmmax = zmaxs * sin(fangl) + xmaxs * cos(fangl) + 0.1 = 42.5258449 ! zmmax = xmaxs * sin(fangl) + zmaxs * cos(fangl) + 0.1 = 45.5148317 ! ymmax = ygap + 2 * ycrh + 0.1 = 46.1 ! To facilitate benchmarking previous results, we temporarily specify the ! dimensions with non-sensible accuracy and use 57.2958 deg/radian. ! ! Half-width Half-height Half-length GS SET SPARS {xmmax=}42.53 {ymmax=}46.1 {zmmax=}45.51 GS SET SPARS 42.5258449 46.1 45.5148317 GS VOLU OUTS 'BOX ' 3 SPARS 3 ! Phobos master volume ! ! Name Shape Med Hctr Hrad HL #p ! GS VOLU BMVC TUBE 1 0. 4.00 45.51 3 ! Beam tube vacuum GS SET SPARS 0. 4.0 45.5148317 GS VOLU BMVC TUBE 1 SPARS 3 ! Beam tube vacuum ! Name Cpy Mother x y z Irot Srch GS POS BMVC 1 OUTS 0. 0. 0. 0 ONLY ! ! GS VOLU BMTB TUBE 2 4.00 4.07 45.5 3 ! Beam tube GS SET SPARS 4.0 4.07 45.5148317 GS VOLU BMTB TUBE 2 SPARS 3 GS POS BMTB 1 OUTS 0. 0. 0. 0 ONLY ! ! par(1) = xmins, (2) = xmaxs, (3) = ymaxs, (4) = (zmaxs-zmins)/2 = 16.15 GS VOLU SPEC TRD1 3 3.75 19.05 3.5 16.15 4 ! Virt vol for Si planes GS ROTM 30 130. 0. 90. 90. 40. 0. GS ROTM 40 50. 0. 90. 90. 40. 180. ! x, z = 0.5*(zmins+zmaxs) * (sin, cos)(fangl) = 17.45168, 20.79811 ! GS POS SPEC 1 OUTS 17.45 0. 20.80 30 ONLY ! GS POS SPEC 2 OUTS -17.45 0. 20.80 40 ONLY GS POS SPEC 1 OUTS 17.4516784 0. 20.7981110 30 ONLY GS POS SPEC 2 OUTS -17.4516784 0. 20.7981110 40 ONLY ! ! Nr Theta1 Phi1 Theta2 Phi2 Theta3 Phi3 in DEGREES GS ROTM 31 90. 0. 180. 0. 90. 90. GS ROTM 32 90. 0. 0. 0. 90. 270. ! ! p(1) = 0., (2) = xoff - thcr, (3) = thcr/2 GS VOLU CRYB TUBE 5 0. 19.75 0.125 3 ! Cryostat bottom ! p(1) = xoff, (2) = ygap + thcr/2, (3) = xoff / tan(fangl) = 23.8350839 ! GS POS CRYB 1 OUTS 20.0 6.125 23.84 31 ONLY ! GS POS CRYB 2 OUTS 20.0 -6.125 23.84 32 ONLY ! GS POS CRYB 3 OUTS -20.0 6.125 23.84 31 ONLY ! GS POS CRYB 4 OUTS -20.0 -6.125 23.84 32 ONLY GS POS CRYB 1 OUTS 20.0 6.125 23.8350839 31 ONLY GS POS CRYB 2 OUTS 20.0 -6.125 23.8350839 32 ONLY GS POS CRYB 3 OUTS -20.0 6.125 23.8350839 31 ONLY GS POS CRYB 4 OUTS -20.0 -6.125 23.8350839 32 ONLY ! ! p(1) = xoff - thcr, (2) = xoff, (3) = ycrh GS VOLU CRYS TUBE 5 19.75 20.0 20.0 3 ! Cryostat sides ! p(1) = +-xoff, (2) = +-(ycrh + ygap), (3) = xoff / tan(fangl) ! GS POS CRYS 1 OUTS 20.0 26. 23.84 31 ONLY ! GS POS CRYS 2 OUTS 20.0 -26. 23.84 32 ONLY ! GS POS CRYS 3 OUTS -20.0 26. 23.84 31 ONLY ! GS POS CRYS 4 OUTS -20.0 -26. 23.84 32 ONLY GS POS CRYS 1 OUTS 20.0 26. 23.8350839 31 ONLY GS POS CRYS 2 OUTS 20.0 -26. 23.8350839 32 ONLY GS POS CRYS 3 OUTS -20.0 26. 23.8350839 31 ONLY GS POS CRYS 4 OUTS -20.0 -26. 23.8350839 32 ONLY ! GS VOLU COIL TUBE 7 0. 15.0 7.50 3 ! Coil ! GS POS COIL 1 OUTS 20.0 18.5 23.84 31 ONLY ! GS POS COIL 2 OUTS 20.0 -18.5 23.84 32 ONLY ! GS POS COIL 3 OUTS -20.0 18.5 23.84 31 ONLY ! GS POS COIL 4 OUTS -20.0 -18.5 23.84 32 ONLY GS POS COIL 1 OUTS 20.0 18.5 23.8350839 31 ONLY GS POS COIL 2 OUTS 20.0 -18.5 23.8350839 32 ONLY GS POS COIL 3 OUTS -20.0 18.5 23.8350839 31 ONLY GS POS COIL 4 OUTS -20.0 -18.5 23.8350839 32 ONLY ! ! Define the Silicon planes: ! GS SET NPLANES 11 GS SET IUDET 'SP01SP02SP03SP04SP05SP06SP07SP08SP09SP10SP11' ! Names GS SET NBITSH 24 24 24 24 24 16 16 16 16 ! Bit packing GS SET FACT 1.e3 1.e3 1.e3 1.e3 1.e3 1.e7 5.e3 1.e4 1.e0 ! Scales GS SET ORIG 50. 50. 50. 50. 50. 0. -1. 0. 0. ! Positions GS SET NAMESH 'X Y Z XP YP DE CT E TRAK' ! Hit pnames ! GS VOLU SP01 'BOX ' 4 3.75 1.7 .015 3 ! Plane ! The following spec is necessary only if the plane angle is non-0: ! GS ROTM 1 90.{+sang} 0. 90. 90. 0.{=sang} 0. GS POS SP01 1 SPEC 0. 0. -16.15 0 ONLY ! p(3) for GSPOS = srad(i) - (zmins+zmaxs)/2 = srad(i) - 27.15 ! where srad is the distance from the IP to the projection of the plane ! center on the spectrometer symmetry axis. GS DET SDET SP01 1 SILD 16 1 12000 1000 ISET 1 IDET 1 ! The vector indices after ISET and IDET specify the elements into which ! the values returned by GSDET are to be stored; a future syntax may ! reference the vector elements directly GS DETH SDET SP01 9 NAMESH NBITSH ORIG FACT ! ! Silicon plane parameters (dimensions may be redundant at present): ! Pl# Hdim Hpix Vdim Vpix Thk D2IP Hoff Angl GS SET SLP 1 7.5 0.15 3.4 0.15 0.030 11.0 0. 0. GS SET SLP 2 10.0 0.20 4.1 0.20 0.030 13.6 0. 0. GS SET SLP 3 13.0 0.20 4.9 0.20 0.030 16.2 0. 0. GS SET SLP 4 15.0 0.20 5.5 0.20 0.030 18.0 0. 0. GS SET SLP 5 16.5 0.20 5.9 0.20 0.030 19.3 0. 0. GS SET SLP 6 18.0 0.20 6.3 0.20 0.030 20.6 0. 0. GS SET SLP 7 19.5 0.20 6.7 0.20 0.030 21.9 0. 0. GS SET SLP 8 21.0 0.025 7.0 2.50 0.030 23.2 0. 0. GS SET SLP 9 26.4 0.025 7.0 2.50 0.030 31.3 0. 0. GS SET SLP 10 38.1 0.025 7.0 2.50 0.030 42.8 0. 0. GS SET SLP 11 38.1 0.30 7.0 0.30 0.030 43.3 0. 0. ! GS VOLU SP02 'BOX ' 4 5.00 2.05 .015 3 GS POS SP02 1 SPEC 0. 0. -13.55 0 ONLY GS DET SDET SP02 1 SILD 16 2 12000 1000 ISET 2 IDET 2 GS DETH SDET SP02 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP03 'BOX ' 4 6.50 2.45 .015 3 GS POS SP03 1 SPEC 0. 0. -10.95 0 ONLY GS DET SDET SP03 1 SILD 16 3 12000 1000 ISET 3 IDET 3 GS DETH SDET SP03 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP04 'BOX ' 4 7.50 2.75 .015 3 GS POS SP04 1 SPEC 0. 0. -9.15 0 ONLY GS DET SDET SP04 1 SILD 16 4 12000 1000 ISET 4 IDET 4 GS DETH SDET SP04 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP05 'BOX ' 4 8.25 2.95 .015 3 GS POS SP05 1 SPEC 0. 0. -7.85 0 ONLY GS DET SDET SP05 1 SILD 16 5 12000 1000 ISET 5 IDET 5 GS DETH SDET SP05 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP06 'BOX ' 4 9.00 3.15 .015 3 GS POS SP06 1 SPEC 0. 0. -6.55 0 ONLY GS DET SDET SP06 1 SILD 16 6 12000 1000 ISET 6 IDET 6 GS DETH SDET SP06 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP07 'BOX ' 4 9.75 3.35 .015 3 GS POS SP07 1 SPEC 0. 0. -5.25 0 ONLY GS DET SDET SP07 1 SILD 16 7 12000 1000 ISET 7 IDET 7 GS DETH SDET SP07 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP08 'BOX ' 4 10.50 3.50 .015 3 GS POS SP08 1 SPEC 0. 0. -3.95 0 ONLY GS DET SDET SP08 1 SILD 16 8 12000 1000 ISET 8 IDET 8 GS DETH SDET SP08 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP09 'BOX ' 4 13.20 3.50 .015 3 GS POS SP09 1 SPEC 0. 0. 4.15 0 ONLY GS DET SDET SP09 1 SILD 16 9 12000 1000 ISET 9 IDET 9 GS DETH SDET SP09 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP10 'BOX ' 4 19.05 3.50 .015 3 GS POS SP10 1 SPEC 0. 0. 15.65 0 ONLY GS DET SDET SP10 1 SILD 16 10 12000 1000 ISET 10 IDET 10 GS DETH SDET SP10 9 NAMESH NBITSH ORIG FACT ! GS VOLU SP11 'BOX ' 4 19.05 3.50 .015 3 GS POS SP11 1 SPEC 0. 0. 16.15 0 ONLY GS DET SDET SP11 1 SILD 16 11 12000 1000 ISET 11 IDET 11 GS DETH SDET SP11 9 NAMESH NBITSH ORIG FACT ! GS CLOS ! Close geometry banks ! End of UGC dataset Appendix B: A Control File * GEOCON.TXT: standard combined geometry and control option input * file for Phobos simulation studies * 17-Nov-92: New standard version = modified GEPHOB.DAT, with * geometry specifications disabled, to allow them to * be provided by the UGC text input system (RV) * 06-Aug-92: new plane sizes and locations to agree with LOI; * beam pipe .7 mm thick (RV) * 00-May-92: creation date (DM) * * ----------------GEANT standard data cards:-------------------- * TRIG 201 * number of events to run (cutoff only if reading events) * This value is ignored in the interactive versions; for batch * running, TRIG must be specified in the MCBATCH.TXT file. SAVE 'KINE' 'JXYZ' 'VERT' 'HITS' * Banks to be saved. For large events in batch, remove JXYZ. RUNG 13 * run number (used in printout, histogram labels etc.) MULS 1 * multiple scattering type: 0 = none, * 1 = Gaussian (default), 2 = Moliere DCAY 1 * decay in flight: 0 =none, 1 = make secondaries, * 2 = ignore secondaries. (1 = default) LOSS 2 * 1 = no fluctuations, 2 = Landau dist'n, 0 = no energy loss HADR 1 * 0 = no hadronic interactions RNDM 12144 232 * seeds for random number generator DEBUG 1 10 1 * Debug flag; DEBUG NFIRST NLAST DN prints debug information for * events NFIRST, NFIRST+DN, ..., NLAST SWITCH 0 1 0 1 * Governs what's printed during debug; 0 disable, 1 enable... * 1st = kine bank print * 2nd = Ntuple print * 3rd = bank prints * 4th = gustep diagnostics * * ----------------------GPH control cards:--------------------------- PIXL 1 * 0 = exact coord. on track, 1 = set to center of nearest pad ANAL 1 * 1 = generate Ntuples, 2 = calculate errors SHBO 0 * 1 = .HST binary plot output (for PAW), 0 = suppressed SHDO 1 * 1 = HISTDO is called to output plots in GPH.OUT, 0 = suppressed SNTU 1 1 = Ntuples are output to (filename).NTU RZ file STRA 1 1 = secondary particles from interactions are tracked ***DRAW 1 * 1 = draw apparatus, 2 = draw hits also, 0 or missing = no draw DISP 0 * 1 = book and fill "event display" scatterplots * * ------------Configuration of PHOBOS system:--------------------------- * >>NOTE: Units in GEANT are cm., kilogauss, Gev/c, degrees * BMTB 4.00 * beam tube inside radius in centimeters * BERT 0.070 * beryllium wall thickness FANG 40.0 * angle of detector system relative to beam BFLD 45.0 * full magnetic field magnitude XOFF 20.0 * x offset for the center of the cryostat * YGAP 6.0 * half the gap between the upper and lower cryostats * YCRH 20.0 * half of the height of the cryostat * THCR 0.25 * thickness of the stainless (iron) shell for the cryostat * *-------------Silicon plane parameters:-------------------------- * These specifications have been commented out to allow values from * the UGC system to be effective. * Format is two cards per plane: * SILD SNUM SWID SHOR SHGT SVER STHK then * SILP SNUM SRAD SOFF SANG * SNUM is plane #, of dimensions SWID x SHGT, with pixels SHOR x SVER * & STHK thick, SRAD from the beam, SOFF displaced from the spectrometer * axis and at an angle SANG to this axis (SANG = 0 for all but outer planes) * SILD 1 7.5 0.15 3.4 0.15 0.03 * SILP 1 11.0 0.0 0.0 * SILD 2 10.0 0.2 4.1 0.2 0.03 * SILP 2 13.6 0.0 0.0 * SILD 3 13.0 0.2 4.9 0.2 0.03 * SILP 3 16.2 0.0 0.0 * SILD 4 15.0 0.2 5.5 0.2 0.03 * SILP 4 18.0 0.0 0.0 * SILD 5 16.5 0.2 5.9 0.2 0.03 * SILP 5 19.3 0.0 0.0 * SILD 6 18.0 0.2 6.3 0.2 0.03 * SILP 6 20.6 0.0 0.0 * SILD 7 19.5 0.2 6.7 0.2 0.03 * SILP 7 21.9 0.0 0.0 * SILD 8 21.0 0.025 7.0 2.5 0.03 * SILP 8 23.2 0.0 0.0 * SILD 9 26.4 0.025 7.0 2.5 0.03 * SILP 9 31.3 0.0 0.0 * SILD 10 38.1 0.025 7.0 2.5 0.03 * SILP 10 42.8 0.0 0.0 * SILD 11 38.1 0.3 7.0 0.3 0.03 * SILP 11 43.3 0.0 0.0 * * ---------- event generator control cards ---------------------------- GEN 2 * 1 = fixed track, 2 = BANG aimed at det., 3 = random BANG, * 4 = momentum, pos'n or angle incremented, 5 = Text input RMOM 0.05 1.5 * For GEN = 1 there is only one entry i.e. the momentum; GEN = 2,3 (BANG): * Range of flat momentum distribution; if PLOW is within 0.001 Gev/c * of PHIGH, fixed momentum. If PLOW > PHIGH, "spikes" at PLOW, PLOW-PHIGH, * PLOW - 2*PHIGH, ..... provided > 0. RMUL 40 * Multiplicity of each event (irrelevant if not BANG generator) RANG 40.0 * Polar angle wrt beam (GEN = 1,4) or angle range both sides of FANG, * (symmetric) if GEN = 2. The particles are distributed flat in cos(theta). RPHI 0.0 * Azimuth (GEN = 1,4) or range of azimuth (GEN = 2) RBXX 0.0 RBYY 0.0 RBZZ 40.0 * These are the particle origin relative to beam center (GEN = 1) * For BANG (GEN = 2,3) RBZZ is the length of the intersection diamond in cm. * For text event data (GEN = 5), RBZZ is the default vertex z position RBXY 0.0450 * Projected width of intersection region. The events are Gaussian * distributed about x, y = 0 (only relevant for BANG) RMAG 15.0 * nominal radius of field, for GEN = 3 RPAR 8 * Particle ID. This is fixed i.e. all particles in an event. ID = Geant code. DANG 0.1 * increment for stepping polar angle (if GEN = 4) DXX 0.4 * likewise for position DMOM 0.02 * likewise for momentum * * -----------HBOOK control cards---------------------------- * HIST ID TAGNAME (short form.. default bins and interval) * TAGNAME can be Ntuple tag name or e.g. #35 for 35th entry * HIST ID TAGNAME NCHANNELS XMIN XMAX is the long form. * HIST ID TAGX NX XMI XMA TAGY NY YMI YMA scatterplot, args as HBOOK2 * (The number of arguments distinguishes these three formats.) * The following three histograms are intended for standard benchmarking: HIST 14 NHITSL HIST 15 TP HIST 17 TTHETA * The following four are omitted in standard runs: * HIST 11 XPROD * HIST 12 YPROD * HIST 13 IDPART * HIST 16 TPHI * * End of geometry and control file Appendix C: The User Geometry and Control (UGC) System The Phobos geometry and control text input system Nov. 6, 1992 Robin Verdier Summary: A first version of the Phobos text input system is now available. Description: The Phobos collaboration meeting of October 24 - 25 took a decision to implement a system that had been proposed nearly a year earlier. This decision required that the Phobos geometry and materials be specified entirely by information contained in one or more text input files. The advantages of this procedure are several: C.1. It helps to ensure that all computations done for Phobos use identical descriptions of the detector regardless of the site where or computer system on which they are carried out. C.2. It provides a numerical database of materials and dimensions that can readily be transmitted to groups involved in detector construction. C.3. It will avoid the time expense of re-linking the entire package to accomodate changes in the geometry, and the danger that errors in the necessary code changes will cause major failures of the system. The importance of this aspect will increase as the full simulation system develops. It also has disadvantages that impose additional requirements: C.4. Since it is easy to change the geometry, then it must be made possible to verify that the same description has been used for separate computations. C.5. In the long term, user programs should access the geometry information from the Zebra data structures, rather than from the input text file, since the Zebra banks will be carried as the canonical computer-independent record of the actual geometry used. C.6. To implement the previous point, we need subroutines that will extract the information from the Zebra banks, and, possible, are able to reconstruct a text file functionally equivalent to the original. It became clear early in the development that the ability to define symbols whose values would then be passed to the geometry routines would be a considerable aid to preparing and checking the input files. A limited algebraic facility, for example, set zmmax (zmax + ymax) / 2, might also be useful; but it has the disadvantage that it is not directly comparable with engineering and survey data. As a compromise, the first version of the system contains no symbolic substitution; the second will include only symbol substitution, and we do not plan to implement algebraic substitution unless subsequent developments strongly warrant it. As a first application, we required a system that could be used to reproduce the Letter-Of-Intent detector specifications, and to change them as required for use in the optimization studies. That system is now available and is briefly described below. Architecture: The modules of this system have names that begin with UGC, for User Geometry and Control. Subroutine UGCIN, the control program for the system, reads data from a text file with the logical name GCDEFS, using a Fortran logical unit number specified in common IO as 19 and assigned in subroutine UFILES. It calls subroutines UGCGET, UGCVAL, UGCDEF and UGCSET. Subroutine UGCGET extracts tokens from the line, recognizing inline and end-of-line comments, and, in version 2, symbolic names. Subroutine UGCVAL evaluates the tokens from context rules. Subroutine UGCDEF dispatches calls to the specified Geant subroutines. Subroutine UGCSET is a user hook that allows local Phobos variables to be set from the input values. Ultimately, all Phobos-specific data should be confined to UGCSET. Syntax: An input line directed to UGC should begin, optionally after an arbitrary amount of white-space consisting of spaces and tabs, with a UGC identifier. Two identifiers are presently recognized; they are "GS" and "GC" (without the quotes), as mnemonics for Geometry Specification and General Control, respectively. At present UGC makes no distinction between these. Lines beginning with unrecognized tokens are ignored by UGC. The second token on an input line should be a recognized identifier from one of the two following lists. The first list includes "CLOS", "DET", "DETH", "MATE", "MIXT", "POS", "ROTM", "TMED", and "VOLU", and upon recognizing one of them UGC will call the Geant subroutine whose name is the identifier preceded by "GS" (except for CLOS, when GGCLOS is called) with the arguments specified in the remainder of the line, separated by white space. Two forms of VOLU are allowed; one specifies the dimension parameters through a vector set by using SET, below, and the other form specifies them in line. We will add additional calls for functions such as volume division as the need arises. Here are some examples of valid geometry definitions: GS VOLU OUTS 'BOX ' 3 44. 4.5 44. 3 ! Phobos master volume GS MATE 2 'BERYLL$ ' 9.01 4.0 1.848 35.3 36.7 0 0 ! Beampipe GS POS SPEC 39 OUTS 0. 0. 35.2 40{=rot mat #} ONLY ! Plane envelope The second list includes "DEF", "SET", and "END". DEF and SET must be followed by a third identifier giving the name of a variable. SET provides a means for specifying values for variables or vectors required in Phobos in implementing the geometry specifications; the values following the keyword SET are stored in successive locations starting with the address of the named variable. Only names specified in a list coded into UGCSET will be processed. DEF is reserved for future use, to set local variables for subsequent symbolic reference by UGC. END is followed by an integer argument, and causes UGC to stop reading the input file and return the value of the argument in its result flag. This provides a way to control program flow, which is presently used as follows: if the UGC dataset begins with GS END 1, UGINIT will call UGEOM to set up the geometry in the way it was done for the LOI, to test backwards compatibility. NB: in this mode, the SILP and SILD cards and the variables XOFF, BFLD, and FANG must be present in RHDATA. Here are examples of valid control definitions: GS SET FANG 39.2 GS END 1 The types of the variables, and the values resulting from the conversion, are determined by context: a variable is initially assumed to be an integer; it is promoted to floating point if it contains an e, an E, or a decimal point, and to a string if it contains anything other than numerals, e, E, decimal point, or if it is surrounded by apostrophes ('). Variables are separated by white space. The parsing has intentionally been kept simple. There are no checks on the rationality of the values given, although such a facility is feasible. All strings are case-sensitive. Note that GEANT names are all four characters long; shorter names, as in the case of 'BOX ', below, require enclosing apostrophes (this may be loosened in a later version), and shape names must be in UPPER CASE. Two kinds of comments are allowed. The first is an exclamation point (!); it is ignored, along with the remainder of the line. The second is an inline comment, contained within curly brackets ({}). The use of * at the start of a line to indicate that the line is a comment is allowed, since one or more asterisks constitute an unrecognized identifier. Multi-line specifications are not yet allowed, nor can blocks of specification lines be bypassed by the use of curly brackets. These facilities will be added, along with symbolic evaluation and the ability to redefine the identifier keys and turn on a UGC VERIFY mode, in the next major release. Strings containing embedded apostrophes are not handled correctly. Suggestions for UGC development or modification are welcome, provided that they are couched in polite terms. Appendix A contains a full UGC data file specifying the LOI version of Phobos. Reference should be made to the Geant manual for more detailed information about the subroutine calls. Appendix D: Directory of Phobos MC Files Program Module Dictionary for the Phobos Monte Carlo 18-Nov-1992 * identifies modules no longer used Filename Date Function BANG.FOR 28-JUN-1992 Throw diagnostic primary tracks. Calls: GSKINE, RAN, and trig functions. Called by: GUKINE. BANG.CMN Define common BANG: generator controls. CARDS.CMN 1-JUL-1992 Define common CARDS: global geometric values. COMMON.HST Define common RHHST: histogram controls. COMMON.NTU Define common RHTUP: ntuple controls and tags. CWK.CMN Define common CWK. EUCARD.FOR 11-JUN-1992 Read GEANT commands from terminal or a file. Calls FFSET, GFFGO, VAX-specific lib$ functions. Called by: GUINIT. * EVLABEL.FOR 27-APR-1992 * EZYLINK In GEPHOB, to link Phobos versions of subs FINTE.FOR [1] ?? Protect GUFLD from FINT error crashes Called by: GUFLD. FINTERR.FOR [1] ?? Protect GUFLD from FINT error crashes. Called by: GUFLD. FLAG.CMN Define common FLAGS. GCBANK.CMN Define common GCBANK. GCCOMIS.CMN ??? Define common GCCOMIS. GCCUTS.CMN Define common GCCUTS. GCDRAW.CMN Define common GCDRAW. GCFLAG.CMN Define common GCFLAG. GCFLAX.CMN Define common GCFLAX: extensions to GCFLAG. GCKINE.CMN Define common GCKINE. GCKING.CMN Define common GCKING. GCLIST.CMN Define common GCLIST. GCMATE.CMN Define common GCMATE. GCNUM.CMN Define common GCNUM. GCONST.CMN Define common GCONST. GCPHYS.CMN Define common GCPHYS. GCSETS.CMN Define common GCSETS. GCTIME.CMN Define common GCTIME. GCTMED.CMN Define common GCTMED. GCTRAK.CMN Define common GCTRAK. GCUNIT.CMN Define common GCUNIT. GCVOL2.CMN Define common GCVOL2. GCVOLU.CMN Define common GCVOLU. GCXLUN.CMN Define common GCXLUN. * GEANT_USER.FOR 26-OCT-1992 * GEASUBS.FOR 5-JUN-1992 GEPHOB.FOR 3-AUG-1992 Main program. Calls: GDINIT, GEAMON, GINTRI, GZEBRA, HERMES, HLIMIT, HPLINT, IGINIT, IGSA, IGWKTY, KUARGS, KUEXEC (batch), KUEXIT, KUINIT, KUTERM, KUWHAG (inter), LNBLNK, TIMEL, TIMEST, UGINIT, VZERO. * GE_ALL_THE_REST.FOR [2] 23-JUL-1992 Do general user functions. * GPH.FOR 22-JUN-1992 Don McLeod's original Phobos MC package * GRUN.FOR 30-APR-1992 GUFLD.FOR 7-JUL-1992 Calculate the magnetic field at any point. Calls: SORTR. Called by: GEANT. GUKINE.FOR 29-JUN-1992 Steer primary track generation. Calls: BANG, GPKINE, GPRINT, GPVERT, GSKINE, GSVERT, KUINQF, RANNOR Called by: GTRIG. GUOUT.FOR 25-JUN-1992 Do user end-of-event output procedures Calls: GPRINT, GSAVE, UHTOC, USOUT. Called by: GEANT. GUSTEP.FOR 3-JUL-1992 Do user end-of-step procedures. Calls: GDCXYZ, GSXYZ, USSTEP. Called by: GEANT. GUTREV.FOR ?? User tracking control, takes no action. Calls: GTREVE. Called by: GEANT. IO.CMN 15-NOV-1992 Define common IO: user input/output units. PAWC.CMN Define common PAWC: storage for PAW banks. PHCOMIS.FOR 29-JUN-1992 Define Phobos subroutines and commons to COMIS. Calls: CSCOM, CSEXT, USCOMIS. Called by: UGINIT. PH_HIT.FOR 21-JUL-1992 Do user hit processing. Calls: GSAHIT, GDTOM, GMTOD. Called by: USSTEP. PH_INIT.FOR 3-AUG-1992 Define histograms. Calls: DATE, HBOOK1/2/N, HRFILE, TIME. Called by: USINIT. PH_LAST.FOR 29-JUN-1992 Output histograms and Ntuples at end of run. Calls: HCDIR, HISTDO, HRPUT, HROUT, HREND. Called by: USLAST. PH_OUT.FOR 21-JUL-1992 Process hits and update ntuple at end of step. Calls: GFHITS, GFKINE, HFN, HFILL, PRNTUP, USANAL, VZERO. Called by: USOUT. PH_USER.FOR [3] 29-JUN-1992 Defines size of commons GCBANK and PAWC. Calls: PH_HIT. Called by: ?. PRNTUP.FOR ?? Print Ntuple in useful format. Calls: none. Called by: PH_OUT. PSKING.FOR 24-JUL-1992 Version of GSKING that adds user buffers to KINE and VERT structures. Calls: GSKINE, GSSTAK, GSVERT. Called by: GUSTEP. PTEMPLATE.FOR 27-OCT-1992 Template for Phobos code documentation. RHBNG.CMN ?? Define common RHBNG for PHCOMIS. RHFLG.CMN ?? Define common RHFLG for PHCOMIS. RHSIL.CMN 8-JUL-1992 Define common RHSIL: silicon plane dimensions, pixels, offsets, ... RHSYS.CMN 7-JUL-1992 Define common RHSYS: general geometry parameters. SETBATCH.FOR 29-JUN-1992 Signal batch mode via COMIS & KUIP. Called by: KUIP, if defined via PHCOMIS. STEND.FOR 26-OCT-1992 Find end of string; called by STPARS. STLEN.FOR 26-OCT-1992 Find length of string; called by STPARS. STPARS.FOR 26-OCT-1992 Parse a string (Melanson / Ryan system). Calls: STEND, STLEN, STRSTR, STTOIN, STTORL. Called by: GUFLD, UGINIT. STRSTR.FOR 26-OCT-1992 Find start of string; called by STPARS. STTOIN.FOR 26-OCT-1992 Convert string to integer; called by STPARS. STTORL.FOR 26-OCT-1992 Convert string to real; called by STPARS. UFILES.FOR 15-NOV-1992 Open user input and output files. Calls: none. Called by: UGINIT. UGCDEF.FOR 12-NOV-1992 Dispatch GEANT calls; called by UGCIN. UGCGET.FOR 8-NOV-1992 Get next token; called by UGCIN. UGCIN.FOR 17-NOV-1992 Steer UGC geometry and control input. Calls: UGCDEF, UGCGET, UGCSET, UGCVAL. Called by: UGINIT. UGCSET.FOR 16-NOV-1992 Set Phobos variables; called by UGCIN. UGCVAL.FOR 7-NOV-1992 Evaluate token by context; called by UGCIN. UGEOM.FOR [4] 7-AUG-1992 Define materials and volumes for GEANT. Calls: none external. Called by: UGINIT. UGINIT.FOR 16-NOV-1992 Control GEANT initialization and data input. Calls: DATE, EUCARD, FFKEY, FFSET, GFFGO, GINIT, GOPEN, GPART, GPHYSI, GZINIT, STxxx, TIME, UFILES, UGCIN, UGEOM, USINIT, VZERO. Called by: GEPHOB. UGLAST.FOR 23-OCT-1992 Do end-of-run procedures. Calls: GCLOSE [Zebra], GLAST, USLAST. Called by: GEANT. UHINIT.FOR [5] 26-OCT-1992 Define user histos; obsolete, replaced by USINIT UJKBUF.CMN 3-JUL-1992 Define common UJKB: user buffer for JKINE banks. USANAL ?? User interface, null at present. Calls: none. Called by: PH_OUT. USINIT.FOR 27-OCT-1992 User histo initialization interface. Calls: PH_INIT. Called by: UGINIT. USLAST.FOR 27-OCT-1992 User end-of-run processing interface. Calls: PH_LAST. Called by: UGLAST. USOUT.FOR 27-OCT-1992 User end-of-event processing interface. Calls: PH_OUT. Called by: GUOUT. USSTEP.FOR [6] 27-OCT-1992 User end-of-step processing interface. Calls: GPKINE, PH_HIT, PSKING. Called by: GUSTEP. Notes: [1] These are in GE_ALL_THE_REST. [2] Contained parts of original GPH.FOR not yet separated into subroutines [3] This file declares subroutines USSTEP, USINIT, USOUT, USLAST, USCOMIS, that call the PH_xxx routines; this needs to be split apart to follow the one-subroutine-per-file rule. [4] UGEOM also contains geometry-definition subroutines BMTB, BMVC, COIL, CRYB, CRYS, FILL, OUTS, and SPEC, superceded by the UGC definitions [5] Only UHINIT0 is presently available. [6] USSTEP also declares the GCBANK and PAWC sizes, as does PH_USER; this is a conflict that must be fixed. +DECK,STATUS ,T=DATA. *CMZ : 2.00/01 04/03/96 15.01.52 by Phobos (R. Verdier) *-- Author : Status of files in phobos_root:[sim...] 5-Mar-96: (Robin Verdier) A new version of the Phobos MC has been created on the LNS VAX cluster, in directories phobos_root:[SIM.NEW...]. In a few weeks, if no problems arise, it will replace the [SIM.PRO] version. This version, now called CMZ version # 2.00/00, is equivalent to the version in [SIM.TEST...] with all recent changes including Adam Trzupek's February 1996 geometry description in files UGCDATA.TXT and UGCDENL.TXT, the latter having enlarged spectrometer planes for occupancy studies. The linkmc command procedure links to version 3.21 of Geant and version 95A of the Cern libraries. It contains both X-windows and GKS versions, although the GKS version issues many annoying color index error messages at initialization. The CMZ library, PHOSIM.CMZ, has been slightly reorganized. The subdirectories /$MOD_GEANT and /$MOD_GEANX, which contained correction cradles that modified GEANT subroutines GRUN and GXCONT for Phobos use, and /GBASE and /GXINT, which contained the unmodified versions, have been eliminated. New procedures MODCERN.COM and MAKECDES.COM now create CMZ .KUMACs that modify the CERN originals and store them, along with modified versions of ZABEND and ZEND, in patch /MODCERN. A modified version of GXFZ is no longer necessary. New procedure UPCMZ.COM creates CMZ .KUMACs to carry out essential code management tasks such as updating, compiling, and extracting files; these tasks will be necessary for GEANT and ZEBRA until CERN finally drops CMZ support. DRAWSPEC.KUMAC is a PAW macro that displays scale drawings of the Phobos spectrometer planes for new and old configurations. It calls SPECGEO.KUMAC, which has geometry data copied from UGCDATA and which is also used by the acceptance study application. The new PMC is run in the same way as previous versions. You can first define symbols for the new command and data directory areas, say $ def pc phobos_root:[sim.new.cmd] $ def pd phobos_root:[sim.new.dat] and then define your scratch area and set default there: $ def scratch disk$scratch:[] $ sd scratch Copy the control file, $ copy pd:control.txt * and edit it to specify the options you want, typically the number of events (TRIG), the treatment of secondaries (SECT), and the event source (GEN). Copy the user definitions procedure to you area: $ copy pc:mcx.com * and change the definitions therein to $ def scratch disk$scratch:[] $ def rhdata scratch:control.txt To run interactively using the X-version, launch MacX if you're running from a Mac, and $ set display/create/user/transport=tcpip/node= If you are running a GKS version, you must do $ def gks$conid tt: Now type $ @pc:rmc mcx where for example might be hij20x12kzp10 for 20 events (TRIG 20) from the standard HIJet event file (GEN 0), with vertex set to +10 cm (RBZZ 10.). Respond [CR] to the workstation type for the X-version, or 82 (Tektronix 4107 color emulation) or 72 (Tektronix 4010 monochrome emulation) if you are running GKS. You can make a simplified picture of the detector by typing exe pc:topview and then trig 1 to see tracks. For a full picture with all elements drawn, replace exe topview by draw outs 90 90 0 10 10 0.1 0.1 This version cannot use the usual PAW commands to save the picture in a postscript metafile. The reasons are being studied. A run takes 50 cpu minutes on Hans if tracking secondaries (SECT 1), 9 cpu minutes otherwise (SECT 0). The ntuple for SECT 0 uses 350 to 700 blocks per event (it is largest for the vertex at z = +10 cm). It turns out useful to try a short run first, say TRIG 1 with 2000 tracks (NTPE 2000), to see that everything is working. To submit a PMC run as a batch job, $ @pc:smc mcx where aage$long and hans$long are names of queues available for long runs. 17-May-95: (Robin Verdier) Version 1.01/18 is now in phobos_root:[SIM.ZTEST...]. It uses CERN V94b libraries and Geant 3.21, and has all changes through today. The temporary working files for the most recent modifications are in phobos_root:[SIM.CURR]. The document BENCHMARKS.DOC in that area describes the benchmarks that will be applied to validate future modifications. 10-Nov-93: (Adam Trzupek) A new version of the geometry text file UGCDATA.TXT is now available in phobos_root:[sim.test.data]. See STATUS.DOC in that area for more information. +DECK,INSTALL ,T=DATA. *CMZ : 2.03/00 04/08/97 17.01.54 by Phobos (R. Verdier) *-- Author : Instructions for installing the Phobos MC Robin Verdier, 25-Jul-1997 The procedures described in this note are fully operational under DEC OSF and HP and IBM Unix. Because CMZ is platform independent, the extraction procedure, expho.kumac, runs also on SGI and Sun platforms, and under VMS. The unix compile and link scripts, compho, linkmc, and lmcdefs, which will be replaced by makefiles in the future, and the run scripts rmc and rmcdefs, are believed to run on all of these platforms. For VMS, the PMC should be installed by using expho.kumac to extract the files and COMPILE.COM, LINKMC.COM, LMCDEFS.COM, RMC.COM, and RMCDEFS.COM to compile, link, and run it. The following discussion focuses on Unix installation; an older document, LRSUSER.DOC, deals primarily with VMS. Eventually these documents will be merged into the basic guide, PMCUSER.DOC. To use these procedures, you must have accounts at MIT or BNL and at the target site, and you may need access to a text editor. At BNL, you should log in to ribm01.rhic.bnl.gov (not ribm00), the preferred BNL platform for running the MC. The public BNL version is in pr = /phobos/u/phobos/sim/pro... New versions are usually installed in /phobos/u/phobos/sim/new... At MIT, you should log in to pierre.mit.edu. The public version is in /scratchp/phobos/sim/pro... On the MIT Unix farm, the standard but not yet public version is in /phobos/sim/pro... 1. Define a base path for the new files using set; for example setenv pr /scr01/rhphobos/$USER/test (Unix will replace $USER with your actual username). 2. Create subdirectories: mkdir $pr cd $pr mkdir awk cmd cmz dat doc exeaix inc libaix scr srcgen srcaix unix srcaix is necessary only if you are running on ibm; it is required because IBM's fortran 77 uses action = read instead of readonly. For DEC, create exeosf1 and libosf1 instead of exeaix and libaix. For HP, create exehp-ux and libhp-ux. Also create srcsrv if you plan to build the server instead of the normal version. In Sun Unix, it may be necessary to define $PR instead of $pr. 3. Import the cmz .car files and extract macro from MIT: cd $pr/cmz ftp irene.mit.edu user [your username] [enter your password] ascii cd phobos_root:[sim.new.cmz] mget *.car Respond y to the prompts for gcdes.car, phosim.car, and zcdes.car. Then do cd phobos_root:[sim.new.cmd] get expho.kumac ..cmd/expho.kumac and respond y to the prompt. Finally, only if you plan to build the server version, which is no longer part of the standard package, do cd phobos_root:[mcserv.pro.cmz] mget *.car and again reply y to the prompt. Finally, leave ftp by typing quit At BNL, the standard .car files are in $pr/cmz/ and expho.kumac is in $pr/cmd, where pr is defined as in Section 1. 4. Extract the source and data files by running the expho macro in cmz: cd ~ /cern/new/bin/cmz exe $pr/cmd/expho Follow the prompting instructions. If you defined the environment variable pr as above, you should be able to use $pr in answer to the optional pathname question. You should extract the VMS command files only if you're on a VMS platform. Don't assume that environment variables in filenames will be correctly translated; full pathnames always work. When the macro has completed, type exit to leave cmz, or again type exe $pr/cmd/expho if you need to correct the previous run. On final completion, there should be 4 created .cmz files in $pr/cmz, and 136 files created from phosim.cmz. 5. Compile the archive libraries $pr/libxxx/libpmc.a and optionally the debug library libpmc_dbg.a and the server library libsrv.a, where xxx is aix, axp, hp-ux, osf1, vms, ..., by typing $pr/unix/compho and following the prompting instructions. The f77 compiler does not translate environment variables, so you must enter the file pathnames in full, for example, when compiling the general files, you must type /phobos/u/phobos/sim/new/srcgen for the source directory, /phobos/u/phobos/sim/new/scr for the scratch directory, and /phobos/u/phobos/sim/new/libaix for the executable directory. You will have to execute compho once for the general files, once for the os-specific files, and, optionally, once for the server and files if you elect to build the server version. At present, for the HP version, it is also necessary to use compho to create ezylink.o in the libhp-ux area. If you get the warning compho: Permission denied. type chmod +x $pr/unix/* to make the Unix scripts executable. 6. Link the MC from the archive libraries by copying $pr/unix/lmcdefs to your area and change the definitions of exedir, pmcdir, and srvdir as required by removing the initial # from the relevant lines and editing them; for example, to build your own executable, change the line in lmcdefs that defines exedir to set exedir = /scr01/rhphobos//test Execute the link by typing $pr/unix/linkmc and responding to the prompts; the defaults should be correct for an ibm link. The normal and server versions are functionally equivalent, but the server version writes messages whenever it opens or closes files. Different platforms produce different link error warnings; I am gradually correcting these. 7. You must either get a track file or use the standard one. It is not part of the MC distribution, but a copy can be found at BNL in /u3/phobos/sim/pro/dat/au_au_hijet_centr_100.adat. This is the default in the rmc script described below. 8. Copy $pr/unix/rmcdefs to your work area and edit it to override the definitions of your scratch area and of the executable as necessary. The rmcdefs script contains examples of the scratch areas for different platforms. For example, you might change the lines # set pr = /u3/phobos/sim/pro # BNL standard version and # set scr = /scr01/rhphobos/$USER to set pr = /scr01/rhphobos/$USER/test set scr = /scr01/rhphobos/$USER/output assuming that you have created a version in that directory. Having redefined the variable pr, you must also redefine every subsequent definition involving $pr. For example, you must uncomment # set exe = $pr/exe$os/mcx.exe # set pmc_dat = $pr/dat and any further statements referring to $exe, $pr, $pmc_dat. In general, if you redefine pr, you will need to uncomment most of the subsequent definitions. This is unnecessary in the VMS equival- ent, where logical definitions are recursive. For standard running you should check that the relevant line for geometry definitions refers to the latest geometry file. For example, at present, setenv GCDEFS $pmc_dat/ugccdata_v37.txt or, if you wish to run using symbolic links (see below) ln -f -s $pmc_dat/ugcdata_v37.txt GCDEFS$slex and similarly for the magnetic field map: setenv FLDASC $pmc_dat/phomagv108.txt Normally, you will use your own version of the control.txt file; copy it from $pr/dat/control.txt, edit your copy, and change the line # setenv RHDATA $pmc_dat/control.txt in rmcdefs to, say, setenv RHDATA control.txt You must remove the comment indicator # from the start of each line that you want to activate. If you want X-windows graphics, you must also define your display by typing setenv DISPLAY :0 Run the MC by typing rmc [label] [rmcdefs] [env] [vers] where label is the base label for created files, and defaults to "temp". rmc will prompt for label and rmcdefs if you do not specify them. rmcdefs is the name of your user definitions file, and defaults to "rmcdefs". env is e to use environment variables to specify file names; this is the default. Any other value will use symbolic links, which are functionally equivalent but less convenient, and which do not allow you to run multiple background jobs from a single default directory in case you find a reason for doing that. vers is n to run the normal version, or s for the server; it defaults to "n". Reply to Geant's workstation? prompt by entering 1 for an X-display, 7878 for a bad Falco Tektronix emulation, or 0 for no graphics. To display a top view of the detector, type exe phobos/u/phobos/sim/pro/cmd/topview in response to the Geant prompt; then type trig n to process n events. You will have plenty of time for coffee now. Type exit at the prompt after processing is completed. The ntuple[s] should be usable in paw; execute it after executing the setenv DISPLAY by typing /cern/new/bin/pawX11 If the MC gives continual read or write error messages, it is likely that some input files do not exist, or output files already exist. Sometimes typing control-C will stop the run, but usually not; typing control-Z will put the run in the background, where you can use the kill command to kill it. Otherwise, you'll have to disconnect and log in again. The existing output file problem often arises when when you kill a run and then re-execute it for the same filenames. The cleanup script, executed by typing $pr/unix/cleanrmc s will delete all the soft links, which are deleted automatically at normal exit from the rmc script, from your current working directory. You must also delete whatever actual files have been created, before re-running with the same filenames. If you get a "wrong architecture" message, you have probably defined the executable, variable exe in rmcdefs, for a platform different from the one on which you're running, for example, $pr/exehp-ux/mcx.exe when you're running on an ibm platform. The rmc script defines the variable $os to help ensure that $pr/exe$os will be correct. 9. To run the standard version on ribm01 at BNL, follow the above running instructions without redefining the executable; for example, if your current working directory contains your version of rmcdefs, called mcx, which defines the executable by the line set exe = /phobos/u/phobos/sim/new/exeaix/mcx.exe you can run the mc by typing set pc = /u3/phobos/sim/new/unix $pc/rmc hijet2 mcx 10. The most common failure of a PMC run has to do with file locations and status. The open statements in ufile.f for an output file referenced by a symbolic link must specify the status as unknown on osf1 and hp-ux, new on vms and aix. If the wrong version of ufile was used, you can hand-edit the version you extracted to change the status setting, which is internally documented. You must have write permission for the output directories. It's sometimes useful in checking a new link to isolate file access problems by turning off input reading by setting control file variables GEN to 1 and MAGT to 0, and output writing by setting SAOU, SNTU, and SZEB to 0, then turning them on one at a time. 11. To run in the background, end the rmc command line with &. To make this work, you may need to create a file called, say, batch.txt containing the three lines 0 trig 10 exit and give the command $pc/rmc hijet2 rmcdefs e n < batch.txt & We are continuing to study Unix batch facilities under Unix. +PATCH,FOR. *CMZ : 2.00/04 16/07/96 11.36.20 by K.Wozniak +DECK,ACCCHK. *CMZ : 1.00/00 17/12/93 07.30.05 by Phobos *-- Author : REAL FUNCTION ACCCHK( TP, IDPART, PLANES, NAMES, NHITSL, LSTPLN) ************************************************************************ * * * FUNCTION ACCCHK - ACCEPTANCE CHECK * * * * 9-AUG-93 MDB Change the definition for e+/e- acceptance. * * 28-JUN-93 MDB Initial Version * * * * A particle is accepted if it satisfies the following: * * * * p < 200 MeV : 6/6 SPA-SPF or 6/6 SNA-SNF * * 200 MeV < p < 1 GeV : 10/10 SPA-SPJ or 10/10 SNA-SNJ * * p > 1 GeV : 11/11 SPA-SPK or 11/11 SNA-SNK * * * * SxH = SxH1 .OR. SxH2 * * SxI = SxI1 .OR. SxI2 .OR. SxI3 .OR. SxI4 * * SxJ = SxJ1 .OR. SxJ2 .OR. SxJ3 .OR. SxJ4 * * SxK = SxK1 .OR. SxK2 .OR. SxK3 .OR. SxK4 * * * * Exception: e+/e- must satisfy the following: * * * * p < 200 MeV : 7/7 SPC-SPI or 7/7 SNC-SNI * * 200 MeV < p < 1 GeV : 8/8 SPC-SPJ or 8/8 SNC-SNJ * * p > 1 GeV : 9/9 SPC-SPK or 9/9 SNC-SNK * * * * Input: * * TP = momentum of particle (in GeV). * * IDPART = GEANT Particle ID (Integer) * * PLANES(i) = .TRUE. iff Plane i was hit. * * NAMES(i) = Name of plane i. * * NHITSL = # of silicon planes hit. * * LSTPLN = Last plane hit. * * * * Output: * * ACCCHK = 0.0 if the particle is NOT accepted at all. * * = 1.0 if the particle is accepted in the POSITIVE wing. * * = -1.0 if the particle is accepted in the NEGATIVE wing. * * = 2.0 if the particle is accepted in the BOTH wings. * * * ************************************************************************ IMPLICIT NONE C Arguments CHARACTER*4 NAMES(*) REAL TP, NHITSL LOGICAL PLANES(*) INTEGER LSTPLN, IDPART C Local variables INTEGER NLAYER, NHITS PARAMETER (NLAYER=11) INTEGER I, ILAYER LOGICAL POSIT(NLAYER), NEGAT(NLAYER) LOGICAL POS6, POS10, POS11, NEG6, NEG10, NEG11 LOGICAL POS7E, POS8E, POS9E, NEG7E, NEG8E, NEG9E LOGICAL ACCPOS, ACCNEG, HITSOK, NRMMOD CHARACTER*1 SIDE, LAYER C First make sure that there are enough hits ACCCHK = 0.0 NHITS = NINT( NHITSL ) ACCPOS = .FALSE. ACCNEG = .FALSE. HITSOK = .FALSE. IF ( IDPART.GE.5 ) THEN C Normal Mode NRMMOD = .TRUE. HITSOK = ( (NHITS.GE.11) > .OR. (NHITS.GE.10 .AND. TP.LE.1.0) > .OR. (NHITS.GE.6 .AND. TP.LE.0.2) ) ELSEIF ( IDPART.EQ.2 .OR. IDPART.EQ.3 ) THEN C Positron/Electron Mode NRMMOD = .FALSE. HITSOK = ( (NHITS.GE.9) > .OR. (NHITS.GE.8 .AND. TP.LE.1.0) > .OR. (NHITS.GE.7 .AND. TP.LE.0.2) ) ENDIF IF (HITSOK) THEN DO 100, I = 1, NLAYER POSIT(I) = .FALSE. NEGAT(I) = .FALSE. 100 CONTINUE DO 200 I = 1, LSTPLN IF (PLANES(I)) THEN IF (NAMES(I)(1:1) .EQ. 'S') THEN SIDE = NAMES(I)(2:2) LAYER = NAMES(I)(3:3) ILAYER = ICHAR(LAYER)-64 IF (1.LE.ILAYER .AND. ILAYER.LE.NLAYER) THEN IF (SIDE.EQ.'P') THEN POSIT(ILAYER)=.TRUE. ELSEIF (SIDE.EQ.'N') THEN NEGAT(ILAYER)=.TRUE. ENDIF ENDIF ENDIF ENDIF 200 CONTINUE IF (NRMMOD) THEN POS6 = ( POSIT(1) .AND. POSIT(2) .AND. POSIT(3) .AND. > POSIT(4) .AND. POSIT(5) .AND. POSIT(6) ) POS10 = ( POS6 .AND. POSIT(7) .AND. POSIT(8) > .AND. POSIT(9) .AND. POSIT(10) ) POS11 = ( POS10 .AND. POSIT(11) ) NEG6 = ( NEGAT(1) .AND. NEGAT(2) .AND. NEGAT(3) .AND. > NEGAT(4) .AND. NEGAT(5) .AND. NEGAT(6) ) NEG10 = ( NEG6 .AND. NEGAT(7) .AND. NEGAT(8) > .AND. NEGAT(9) .AND. NEGAT(10) ) NEG11 = ( NEG10 .AND. NEGAT(11) ) ACCPOS = ( POS11 > .OR. (POS10 .AND. TP.LE.1.0) > .OR. (POS6 .AND. TP.LE.0.2) ) ACCNEG = ( NEG11 > .OR. (NEG10 .AND. TP.LE.1.0) > .OR. (NEG6 .AND. TP.LE.0.2) ) ELSE POS7E = ( .NOT.POSIT(1) .AND. .NOT.POSIT(2) .AND. POSIT(3) > .AND. POSIT(4) .AND. POSIT(5) .AND. POSIT(6) > .AND. POSIT(7) .AND. POSIT(8) .AND. POSIT(9) ) POS8E = ( POS7E .AND. POSIT(10) ) POS9E = ( POS8E .AND. POSIT(11) ) NEG7E = ( .NOT.NEGAT(1) .AND. .NOT.NEGAT(2) .AND. NEGAT(3) > .AND. NEGAT(4) .AND. NEGAT(5) .AND. NEGAT(6) > .AND. NEGAT(7) .AND. NEGAT(8) .AND. NEGAT(9) ) NEG8E = ( NEG7E .AND. NEGAT(10) ) NEG9E = ( NEG8E .AND. NEGAT(11) ) ACCPOS = ( POS9E > .OR. (POS8E .AND. TP.LE.1.0) > .OR. (POS7E .AND. TP.LE.0.2) ) ACCNEG = ( NEG9E > .OR. (NEG8E .AND. TP.LE.1.0) > .OR. (NEG7E .AND. TP.LE.0.2) ) ENDIF IF (ACCPOS) THEN ACCCHK = 1.0 IF (ACCNEG) THEN ACCCHK = 2.0 ENDIF ELSEIF (ACCNEG) THEN ACCCHK = -1.0 ELSE ACCCHK = 0.0 ENDIF ENDIF RETURN END +DECK,BANG. *CMZU: 2.02/00 17/03/97 12.20.44 by K. Wozniak *CMZU: 2.00/10 19/09/96 13.54.35 by Unknown *CMZU: 2.00/04 16/07/96 11.36.20 by Phobos (K. Wozniak) *CMZU: 2.00/02 04/04/96 15.24.19 by Phobos (R. Verdier) *CMZU: 1.01/21 11/07/95 12.50.39 by K.Wozniak *CMZU: 1.01/17 13/04/95 08.05.02 by K.Wozniak *-- Author : K.Wozniak 09/03/95 SUBROUTINE BANG(MODE) *Documentation_Block ***************************************************************************** * * DESCRIPTION: * Generates events with random particles, they may have different * momenta, eta or cos(theta), phi, id, vertex position. * MODE = 1: The parameters describing particles are generated from flat * distributions (eta, P, phi) * MODE = 2: The emmision angle of the particles is selected to fit to * the spectrometer, other distributions are flat or fixed * MODE = 3: "Physical" distribution of particle momentum is used: * the distribution of tracks falls off exponentially * in transverse momentum as exp(-PT/REXP); * eta distribution has a trapezoidal shape. * MODE = 4,5: temporarily undefined (for backward compatibility) * MODE = 6: flat distributions of: theta, 1/p, phi * MODE = 7: flat distributions of: eta, pt, phi * MODE = 8: flat distributions of: eta, 1/pt, phi * MODE = 9: not defined yet * MODE = 10: not defined yet * In modes 1 and 2, the momentum may be fixed, distributed flat over * an interval, or in a series of spikes according to the choice of PLOW * and PHIGH (see details below). * The angle range in mode 2 is determined by RSPX,RSPZ and RSPR * the position and the radius of the circle describing spectrometer * The particle id can be constant or change randomly(see details below) * * ARGUMENTS: MODE, see above. * * CALLED BY: GUKINE, depending on flags set for various event generators * * CALLS: GSVERT, GSKINE * * Implicit inputs, outputs: Parameters come through common blocks: * Parameters for the event generator are passed in /RHBNG/ & /RHSYS/ * as shown in include blocks BANGC.CMN and RHSYS.CMN * Mnemonic: Variable in /RHBNG/: Meaning: * RMOM RMOM(3) Range of flat momentum distribution; if PLOW * (PLOW, PHIGH, PSTEP) is within 0.001 Gev/c of PHIGH, fixed momentum. * If PSTEP < 0.0001 GeV/c flat distribution between * PLOW and PHIGH is used * If PSTEP > 0.0001 GeV/c the momentum is distributed * in spikes at PLOW, PLOW+PSTEP, PLOW+2*PSTEP,.... * PSTEP is ignored in mode 3; REXP governs it instead. * PSTEP is ignored in modes 6,7,8 * RMUL IRMUL Multiplicity of each BANG event event. * RARM IRARM If IRARM = 2 the particles will be send in both * spectrometer arms * RANG RANG(3) Angle range - for mode = 6 * the particles are generated with theta between * RANG(1) and RANG(2) * RPHI RPHI(2) Azimuth angle range * the flat distribution between RPHI(1) and RPHI(2) * and (in case IRARM=2 only) between RPHI(1)+180.0 and * RPHI(2)+180.0 is used * RROT RROT phi rotation (not used here) * RBXX RBXX Central position of the intersection of beams * RBYY RBYY * RBZZ RBZZ * RBXY RBXY Projected width of intersection region in x-y plane * events are Gaussian distributed arround x=RBXX, * y=RBYY in projection, and azimuthally symmetric. * If RBXY > 0 then RBDZ defines triangular distribution * of z arround RBZZ * RBDX RBDX Range of the vertex positions arround * RBDY RBDY RBXX, RBYY, RBZZ for flat distributions * RBDZ RBDZ (only in case RBXY=0) * RPID IRPID(2) Particle ID (Geant code) generation: * - fixed (IRPID(1)=IRPID(2)) * - generated flat between IRPID(1) and IRPID(2) * - follow "physical" distribution * for IRPID(1)=IRPID(2)=0 : * 20:20:1:1:1:1 (pi+ : pi- : K+ : K- : P : anpi p) * REXP REXP Mean transv. momentum, mode 3 * definition of spectrometer position (in MODE = 2 only) * RSPX RSPX Center of the spectrometer X - position * RSPZ RSPZ Center of the spectrometer Z - position * RSPR RSPR Radius of the circle covering the spectrometer * * Output is event setup initiated through GSVERT, GSKINE * * History: * DATE NAME DESCRIPTION * 17-Mar-97 K.W. Forced STOP changed into a call to STOPER * 20-SEP-96 K.W. In MODE=2 new parameters independent of the magnetic * field used: RSPX,RSPZ and RSPR (in place of MAGX,MAGZ) * 16-Jul-96 K.W. XOFF changed to MAGX * 04-Apr-96 DMcL RAN->RANF for OS independence * 10-Jul-95 K.W. New modes added * 10-Apr-95 K.W. Corrected error in the eta-theta transformation * 10-Mar-95 K.W. Changes in the modes of generation of the particles * general changes in the code * 1-Nov-93 R.V. BANG.CMN -> BANGC.CMN to avoid MMS confusion * 22-Nov-92 R.V. Add pmc_inc: to includes; add UJKBUF.CMN; add space * in GSKINE call for user buffer UBUF in JKINE * 20-Nov-92 DMcL Clean up, release * ~03/92 DMcL Creation **************************************************************************** *End_Documentation_Block IMPLICIT NONE +SEQ,BANGC. +SEQ,FLAG. +SEQ,RHSYS. +SEQ,UJKBUF. C Local: REAL VERT(3),PLAB(3),V,V1,V2,PP,PS,PHI REAL PLOW,PHIGH,PSTEP, CZ1,CZ2,Z, ETA, THETA REAL APLOW,APHIGH INTEGER ID,I,IR,NVERT,NT,NSPK,MODE LOGICAL MOMFLG,SPKFLG SAVE IR !random number seed DATA IR/12347/ REAL RANF EXTERNAL RANF *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ PLOW = RMOM(1) PHIGH = RMOM(2) PSTEP = RMOM(3) IF(MODE .EQ. 6) THEN APLOW = PLOW ! APLOW,APHIGH - for 1/p generation IF(APLOW .LT. 0.01) APLOW = 0.01 APLOW = 1.0/APLOW APHIGH = PHIGH IF(APHIGH .LT. 0.01) APHIGH = 0.01 APHIGH = 1.0/APHIGH ENDIF IF(MODE .EQ. 8) THEN APLOW = 0.01 ! APLOW,APHIGH - for 1/pt generation APLOW = APLOW APHIGH = PHIGH IF(APHIGH .LT. 0.01) APHIGH = 0.01 APHIGH = ALOG(PHIGH) ENDIF ************************************************************************ * Generate beam intersection production point and tell GEANT about it * ************************************************************************ IF(RBXY .LT. 0.0001) THEN ! flat distribution of vertex position IF(RBDX .GT. 0.0001) THEN VERT(1) = RBXX + RBDX * (2.0*RANF(IR)-1.0) ELSE VERT(1) = RBXX ENDIF IF(RBDY .GT. 0.0001) THEN VERT(2) = RBYY + RBDY * (2.0*RANF(IR)-1.0) ELSE VERT(2) = RBYY ENDIF IF(RBDZ .GT. 0.0001) THEN VERT(3) = RBZZ + RBDZ * (2.0*RANF(IR)-1.0) ELSE VERT(3) = RBZZ ENDIF ELSE ! double Gaussian (x-y) and trianglular (z) distributions 2 V1 = 2.0*RANF(IR) -1.0 !generate double Gaussian.. V2 = 2.0*RANF(IR) -1.0 !see particle data booklet V = V1*V1 + V2*V2 IF(V.GT.1.0) GOTO 2 VERT(1) = RBXX + RBXY*V1*SQRT(-2.0*LOG(V)/V) VERT(2) = RBYY + RBXY*V2*SQRT(-2.0*LOG(V)/V) C Generate a triangular probability distribution for intersection z V1 = RANF(IR) V2 = RANF(IR) IF(V1.GT.V2) THEN VERT(3) = RBZZ + 0.5*RBDZ*(V1-1.0) ELSE VERT(3) = RBZZ + 0.5*RBDZ*V1 ENDIF ENDIF ! if(RBXY .GT. ... CALL GSVERT(VERT,0,0,0,0,NVERT) ************************************************************ * Set up for various momentum distributions: ************************************************************ MOMFLG = (ABS(PHIGH -PLOW).LT.0.001) SPKFLG = (PSTEP .GE. 0.0001) IF(MODE.EQ.3) THEN MOMFLG = .FALSE. SPKFLG = .FALSE. ENDIF IF(SPKFLG) NSPK = INT( (PHIGH-PLOW)/PSTEP ) + 1 *************************************************************** * Set range (in cos theta) of track polar angles (MODE=2) *************************************************************** IF(MODE.EQ.2) THEN Z = VERT(3) ZC = RSPR RS = SQRT((ZC-Z)**2 + RSPX**2) CZ = (ZC-Z)*SQRT(RS**2-RSPR**2)/RS**2 CZ2 = RSPX * RSPR/RS**2 CZ1 = CZ + CZ2 IF(CZ1.GE.0.9999) CZ1 = 0.9999 CZ2 = CZ - CZ2 ENDIF ************************************************************************ * START LOOP OVER MULTIPLICITY * ************************************************************************ DO I = 1,IRMUL ******************************************** * Total momentum - MODE = 1, 2 * ******************************************** IF(MOMFLG) THEN PS = PLOW ELSE IF(SPKFLG) THEN PS = PLOW + PSTEP*FLOAT( INT(FLOAT(NSPK)*RANF(IR)) ) IF(PS.LT.0.010) PS = 0.010 ELSE PS = PLOW + RANF(IR)*(PHIGH-PLOW) ENDIF ********************************************************* * Get random PLAB components: * * PS = total momentum * * PLAB(3) = longitudinal component * * PLAB(1), PLAB(2) are calculated when phi is known * ********************************************************* IF(MODE.EQ.1) THEN ETA = RETA(1) + RANF(IR)*(RETA(2)-RETA(1)) PLAB(3) = PS*TANH(ETA) !random pseudorapidity ELSE IF(MODE .EQ. 2) THEN PLAB(3) = PS*(RANF(IR)*(CZ2-CZ1)+CZ1) !random cosine theta ELSE IF(MODE .EQ. 3) THEN IF(RETA(2)-RETA(1) .LT. 0.01) THEN ! fixed eta ETA = RETA(1) ELSE ETA = RETA(1) - 100.0 DO WHILE (ETA .LT. RETA(1) .OR. ETA .GT.RETA(2)) IF(RANF(IR) .GE. 0.5) THEN ! flat central region ETA = 4.0 * RANF(IR) - 2.0 ELSE ! triangular parts -6,-2 and 2,6 V1 = RANF(IR) V2 = RANF(IR) IF(V1 .GT. V2) THEN ! negative eta ETA = -6.0 + 4.0 * V1 ELSE ! positive eta ETA = 2.0 + 4.0 * V1 ENDIF ENDIF ENDDO ENDIF IF(PHIGH-PLOW .LT. 0.010) THEN ! fixed momentum PS = PLOW ELSE C Adding two values to make PP is supposed to distribute it as C PP*EXP(-PP/REXP) i.e. exponential falloff x phase space PS = PLOW - 1.0 DO WHILE (PS .LT. PLOW .OR. PS .GT. PHIGH) PP = -LOG(RANF(IR))*REXP PP = PP -LOG(RANF(IR))*REXP PP = PP / 2.0 PS = PP / SQRT(1.0-TANH(ETA)**2) PLAB(3) = PS*TANH(ETA) !random pseudorapidity ENDDO ENDIF C--------------------- END MODE = 3 ELSE IF(MODE .EQ. 4 .OR. MODE .EQ. 5) THEN PRINT *, 'BANG: GEN = 4 and GEN = 5 have changed to', + ' 11 and 0 respectively' CALL STOPER('BANG', 'ILLEGAL GEN MODE', 1) ELSE IF(MODE .EQ. 6) THEN PS = 1.0 / ( APLOW + (APHIGH-APLOW)*RANF(IR) ) THETA = RANG(1) + RANF(IR)*(RANG(2)-RANG(1)) PLAB(3) = PS*COS(THETA/57.295779513) C--------------------- END MODE = 6 ELSE IF(MODE .EQ. 7) THEN ETA = RETA(1) + RANF(IR)*(RETA(2)-RETA(1)) PS = PLOW - 1.0 DO WHILE (PS .LT. PLOW .OR. PS .GT. PHIGH) PP = RANF(IR) * PHIGH ! flat Pt from 0.0 to PHIGH PS = PP / SQRT(1.0-TANH(ETA)**2) PLAB(3) = PS*TANH(ETA) !random pseudorapidity ENDDO C--------------------- END MODE = 7 ELSE IF(MODE .EQ. 8) THEN ETA = RETA(1) + RANF(IR)*(RETA(2)-RETA(1)) PS = PLOW - 1.0 DO WHILE (PS .LT. PLOW .OR. PS .GT. PHIGH) PP = 1.0 / ( APLOW + RANF(IR)*(APHIGH-APLOW) ) C ! 1/Pt from 0.01 to PHIGH PS = PP / SQRT(1.0-TANH(ETA)**2) PLAB(3) = PS*TANH(ETA) !random pseudorapidity ENDDO C--------------------- END MODE = 8 ELSE PRINT *, 'BANG: undefined GEN: ', MODE CALL STOPER('BANG', 'UNDEFINED GEN MODE', 2) ENDIF ! all MODE values C Generate the value of phi angle IF(RPHI(2)-RPHI(1) .LT. 0.01) THEN ! fixed phi PHI = RPHI(1) / 57.295779513 ELSE PHI = RPHI(1) + (RPHI(2)-RPHI(1)) * RANF(IR) PHI = PHI / 57.295779513 ENDIF IF(IRARM .GT. 1) THEN ! possible change of the arm IF(RANF(IR) .GT. 0.5) THEN PHI = PHI + 3.14159265359 IF(PHI .GT. 3.14159265359) PHI = PHI - 6.28318530718 ENDIF ENDIF PP = SQRT(PS*PS-PLAB(3)*PLAB(3)) PLAB(1) = PP*COS(PHI) PLAB(2) = PP*SIN(PHI) ***************************************** * Generate the particle id * ***************************************** IF(IRPID(1) .EQ. IRPID(2)) THEN ID = IRPID(1) IF(ID .EQ. 0) THEN ! select pi, K, p with ratios 20:1:1 V = RANF(IR) IF(V .GE. 0.55) ID = 8 IF(V .GE. 0.1 .AND. V .LT. 0.55 ) ID = 9 IF(V .GE. 0.075 .AND. V .LT. 0.10 ) ID = 11 IF(V .GE. 0.05 .AND. V .LT. 0.075) ID = 12 IF(V .GE. 0.025 .AND. V .LT. 0.05 ) ID = 14 IF(V .LT. 0.025) ID = 15 ENDIF ELSE ID = IRPID(1) + + INT(FLOAT(IRPID(2)-IRPID(1)+1)*RANF(IR)*0.99999) ENDIF CALL VZERO(UBUF(1), NWUBMAX) CALL GSKINE(PLAB,ID,NVERT,UBUF,NWUBMAX,NT) ENDDO NTRK = IRMUL RETURN END +DECK,BLOCKDATA. *CMZU: 2.00/08 25/07/96 13.58.49 by Phobos (R. Verdier) *-- Author : Phobos (R. Verdier) 25/07/96 BLOCK DATA PMCBDAT *Documentation_Block ************************************************************************ * * Description: * Block data for the Phobos MC. Not executable. * * Arguments: * none * * Referenced by: * UGINIT, to force loading * * Calls: * none * * Implicit inputs, outputs, side effects: * ANSI-compliant method for setting default values of common variables * * Filename: PMC_SRC:BLOCKDATA.FOR * * History: * Date Name Description * ---- ---- ----------- * 25-Jul-96 R. Verdier Creation ************************************************************************ *End_Documentation_Block +SEQ,MUPEP. +SEQ,MUPEPD. +SEQ,NTU. +SEQ,NTUD. +SEQ,NTUEX. +SEQ,NTUEXD. +SEQ,RHSIL. +SEQ,RHSILD. end +DECK,CYFLD. *CMZ : 1.00/00 17/12/93 07.30.06 by Phobos *-- Author : SUBROUTINE CYFLD(R, V, BR, BV) *Documentation_Block ************************************************************************ * * Description: * Calculate the magnetic field from the two dimensional * cylindrical field map. * The map is stored in common block defined in CYFLDC.CMN * and read by GUFLD prior tothe first call to CYFLD * * It is possible to use the magnetic field map calculated for the magnet * with smaller radius for other with the radius increased * by REXT (local parameter). In this case the field values for R < REXT are * identical with those for R=0 for the same value V (in the original map) * This option should however be used only temporarily - * the magnetic field created this way is only aproximate * * Arguments: * *R - radius of the requested point (cylindrical coordinate 1) * *V - vertical position of the point (cylindrical coordinate 2) * BR* - radial component of the field * BV* - vertical component of the field * * Called by: * GUFLD * * Calls: * FINT * * Implicit inputs, outputs, side effects: * NONE * * Filename: CYFLD.FOR * * History: * Date Name Description * ---- ---- ----------- * 2-Dec-93 K.W. Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ, CYFLDC. REAL R, V, BR, BV, X(2), P, REXT PARAMETER (REXT=0.0) INTEGER NN(2) REAL FINT EXTERNAL FINT EQUIVALENCE (NN(1), NNR) X(1) = R - REXT IF(X(1) .LE. 0.0) X(1) = 0.0 X(2) = ABS(V) IF(R .LT. 0.0) THEN WRITE(*,*) ' GUFLD: NEGATIVE R VALUE' GO TO 995 ENDIF IF(X(1) .GT. 2.0*XTAB(NNR)) GO TO 995 IF(X(2) .GT. 2.0*XTAB(NNR+NNV)) GO TO 995 IF(X(1) .GT. XTAB(NNR)) X(1) = XTAB(NNR) IF(X(2) .GT. XTAB(NNR+NNV)) X(2) = XTAB(NNR+NNV) BR = FINT(2, X, NN, XTAB, BRTAB) BV = FINT(2, X, NN, XTAB, BVTAB) P = 1.0 IF(R-REXT .GT. XTAB(NNR)) P = (2.0*XTAB(NNR)-R+REXT) / XTAB(NNR) IF(ABS(V) .GT. XTAB(NNR+NNV)) P = P * + (2.0*XTAB(NNR+NNV) - ABS(V)) / XTAB(NNR+NNV) BR = BR * P BV = BV * P IF(V .LT. 0.0) BR = - BR GO TO 999 995 CONTINUE BR = 0.0 BV = 0.0 999 CONTINUE RETURN END +DECK,EUCARD,IF=EUCARD. *CMZU: 2.00/02 18/07/96 10.43.10 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.06 by Phobos *-- Author : C C ============================================================ SUBROUTINE EUCARD C ============================================================ C C Description:- C ============= C This is a utility routine for reading in GEANT control cards C during an interactive GEANT session. (It is therefore C written in VAX-specific code.) C C The user is asked if card input is being supplied by a file. C YES ===> Give file name, or use default file C NO ===> Supply cards interactively C C Arguments:- C =========== C None C C Implicit inputs, outputs, side effects:- C ======================================== C See above. C C Author:- C ======== C WAZ C C Creation Date: 11-Oct-1987 C =========================== C C Revisions:- C =========== C Date Name Description C ---- ---- ---------------------------------------- c 18-Jul-96 RV Made conditional on CMZ select EUCARD C 08-Jul-96 R. V. Use lib$sys_trnlog if sel VMS, else KUQUINF C 29-May-1992 CGP Modified for PHOBOS C C Global Specifications:- C ======================= IMPLICIT NONE +SEQ, GCLIST. +SEQ, GCFLAG. +SEQ, GCUNIT. C C Local Specifications:- C ====================== C CHARACTER*1 reply ! User input (Y/N) CHARACTER*63 GFFGO_file, ! File for reading cards & GFFGO_in ! User-supplied file name C INTEGER LIN_save ! For saving value of LIN C C Executable statements:- C ======================== C C--> Ask where cards are to come from: C WRITE ( LOUT, '(a,$)' ) & ' >>> Read cards from file?? (Y/N, Default=Y): <<<' READ ( 5, '(a1) ' ) reply If ( (reply .ne. 'N') .and. (reply .ne. 'n') ) Then C C--> Save old value of LUN for input: LIN_save = LIN LIN = 15 CALL FFSET( 'LINP', 15 ) C C--> Get file name: C +SELF,IF=VMS. Call lib$sys_trnlog('CARDS$DEF',,GFFGO_file,,,) +SELF,IF=-VMS. c Use the KUIP file inquiry utility to get the actual file name c This function fails, and actually sets LIN to 0 c* call KUINQF (GFFGO_file, LIN) GFFGO_file = 'CARDS$DEF' +SELF. C WRITE ( LOUT, '(a,/,a,a)' ) & ' >>> Type in file for data cards: <<<', & ' = ', GFFGO_file READ ( 5, '(a)' ) GFFGO_in If ( GFFGO_in .ne. ' ' ) GFFGO_file = GFFGO_in C OPEN ( unit=15, file=GFFGO_file, status='OLD',READONLY) CALL GFFGO CLOSE( unit=15) CALL FFSET( 'LINP', LIN_save) Else WRITE( LOUT,15 ) CALL GFFGO End If C C 15 FORMAT( & ' >>> ENTER (UPPER-CASE !) DATA CARDS; ', & 'LAST ONE MUST BE "STOP" <<<' ) C C C RETURN END +DECK,EZYLINK. *CMZU: 2.02/00 26/03/97 11.45.11 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.06 by Phobos *-- Author : *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Subroutine EZYLINK c This file creates references to some modules so that the linker c will load them from the Phobos library rather than GEANTxxx.OLB. c It is unnecessary under VMS and most Unix systems. It should c never be called. c 26-Mar-97: Unnecessary entries removed (R.V.) CALL GUSTEP CALL GUKINE CALL GUFLD CALL UGINIT CALL GUOUT End +DECK,fill. *CMZ : 1.00/00 17/12/93 07.30.21 by Phobos *-- Obsolete *CMZ : 17/12/93 07.30.09 by Phobos *-- Author : +DECK,FINTE. *CMZ : 2.00/02 23/07/96 13.38.01 by Phobos (R. Verdier) *-- Obsolete *CMZ : 1.00/00 17/12/93 07.30.06 by Phobos *-- Author : +DECK,FINTERR. *CMZ : 2.00/02 23/07/96 13.38.01 by Phobos (R. Verdier) *-- Obsolete *CMZU: 1.00/00 22/11/93 15.48.57 by R. Verdier * Renamed to FINTERR as CMZ does not understand INTEGER*4 FUNCTION *-- Author : +DECK,GEPHOB. *CMZU: 2.01/01 28/02/97 14.49.42 by Phobos (R. Verdier) *CMZU: 2.00/10 23/09/96 10.40.07 by Unknown *CMZU: 2.00/02 18/07/96 10.36.32 by Phobos (R. Verdier) *CMZU: 1.00/00 21/11/93 18.14.01 by R. Verdier * Removed obsolete GCFLAX include *-- Author : PROGRAM GEPHOB *Documentation_Block ************************************************************************ * * Description: * This is the main program for the interactive version of the Phobos * Monte Carlo. It is copied from the GEANT interactive example program * with slight modifications. Phobos-specific code is in the GUXXX * routines. * File: pmc_src:GEPHOB.FOR * * Arguments: none * * Called by: system (main program) * * Calls: * GEANT/KUIP/HIGZ initialization routines KUARGS, GZEBRA, VZERO, * KUINIT, KUEXIT, KUTERM, GINTRI, IGINIT, IGWKTY, GEAMON, HPLINT, * HERMES, IGSA, UGINIT, GDINIT, TIMEST, TIMEL, KUEXEC, LNBLNK, +SELF,IF=-NOSERV. * SERVER initialization and (UNIX) interrupts for "batch" (in UGSERV); +SELF. * and UGCONS, and then passes control to KUWHAG or UGCONB. * * Implicit inputs, outputs, side effects: * Geometry definition file with logical name UGCDATA, read by UGCIN * Control file with logical name RHDATA, read by UGINIT +SELF,IF=EUCARD. * Alternate control file with logical name CARDS$DEF, read by EUCARD +SELF. * See phobos_root:[sim.doc]pmcuser.doc for specifications. +SELF,IF=-NOSERV. * Added 10/95: Logical names as above may still be used, (environment * variables in UNIX), but they may be specified instead by a SERVER input * file pointed to by SHELLCONTROL, i.e. a logical file name (VMS), or an * environment variable containing the file pathname (UNIX). Such files * (usually named progname.ser) override "standard" logical names. All * this is handled by UGSERV, called by GEPHOB. * See the SERVER documentation for more details on server files. +SELF. * No conditions returned. * * History: * Date Name Description * ---- ---- ----------- * 28-Feb-97 R.V. Changed NWGEAN, 3.0->3.2M and NWPAW, .5->.4 M * 23-Sep-96 K.W. SIMVER initialization moved to UGINIT * 14-Oct-95 DMcL Added setup of SERVER data file, reading of * other environment variables, UNIX signal * monitor etc. with preprocessor switches on code, * in routine UGSERV called below * 21-Nov-93 RV Removed obsolete GCFLAX include * 02-Jun-93 RV Added UGCONS and UGCONB calls to select batch * or interactive mode if ModeSel = 0 * 01-Jan-93 RV Increase GCBANK to 2.5M * 02-Dec-92 RV Changed GCFLAG and GCFLAX to includes; put in * standard template with documentation block * 03-Aug-92 R. Verdier Increased GCBANK size to 2.3M to run at B = 4.5 T * 29-Jun-92 CGP Added EZYLINK external statements to ease the * link statement. * 06-Jun-92 Chuck Parsons Creation from Geant example, with increased * bank sizes: CHUCK@PIERRE.MIT.EDU ************************************************************************ *End_Documentation_Block C. C. ****************************************************************** C. * * C. * The interactive version of GEANT3 * C. * based on the KUIP command processor * C. * * C. * See KUIP User Guide CERN/I202 * C. * R.Brun, P.Zanarini * C. * * C. * GXINT is currently implemented on * C. * APOLLO * C. * VAX/VMS * C. * IBM/VM * C. * SUN/SPARC station * C. * DEC station 3100 * C. * Silicon Graphics * C. * * C. * =====> IN GEANTDOC GXINT = ZINT001 <===== * C. * Authors: R.Brun ********** * C. * P.Zanarini ********** * C. * * C. ****************************************************************** C. PARAMETER (NWGEAN=3200000,NWPAW=400000,NWKUIP=60000) COMMON/GCBANK/GEANT(NWGEAN) COMMON/PAWC/PAW(NWPAW) +SEQ, FLAG2. +SEQ, GCFLAG. c COMMON/GCTIME/TIMINT,TIMEND,ITIME,IGDATE,IGTIME INTEGER ITIME,IGDATE,IGTIME REAL TIMINT,TIMEND COMMON/GCOMIS/ICOMIS,JUINIT,JUGEOM,JUKINE,JUSTEP,JUOUT,JULAST COMMON/GCXLUN/LUNIT(128) COMMON/CWK/IWK EXTERNAL UGLAST,IGTERM CHARACTER*80 BATCHF, GTLOG, LOGFIL c Define the control mechanism: c If ModeSel = 0, the logical filename CONTROL sets the mode: c if CONTROL = "I", the program runs in interactive mode; the user c enters GEANT-KUIP commands, in particular TRIG n to run for n c events, from the keyboard. c if CONTROL = "B", the program runs in batch mode; the number of c events is taken from the GCDEFS file. c if CONTROL = "anything.KUMAC", the program runs in batch mode, c using GEANT-KUIP commands, including TRIG n, taken from the c text file specified by CONTROL. c If ModeSel = 1, the standard interactive GEANT technique is used, c in which the name of batch file containing GEANT-KUIP commands c is read from the command line in the form MCX/BATCHF=. c This mechanism fails when one attempts to run a program linked c with debug information, when an extra debugger input file is c required. integer ModeSel /0/ C Local variables: INTEGER IERR, NH * *---------------------------------------------------------------------- C executable code: * * Batch or Interactive version ? * BATCHF = ' ' GTLOG = 'glogon.kumac' C Gets command line arguments e.g. MCX/BATCHF=commandfile CALL KUARGS('GEPHOB',GTLOG,BATCHF,LOGFIL,IERR) IF (IERR .NE. 0) GOTO 999 NOLOG=.FALSE. BATCH=.FALSE. IF (BATCHF.NE.' ') BATCH = .TRUE. IF (GTLOG.EQ.' ') NOLOG = .TRUE. c Reset mode indicators if ModeSel = 0. UGCONS calls CERNLIB INTRAC c to see if batch or interactive; UNIX => redirected input implies batch if (ModeSel .eq. 0) call UGCONS (BATCH, BATCHF, NOLOG) +SELF,IF=-NOSERV * * Initialize SERVER, UNIX interrupts etc. * CALL UGSERV +SELF. * * Initialize Memory Manager (ZEBRA) * CALL GZEBRA(NWGEAN) NH=-NWPAW CALL HLIMIT(NH) * CALL VZERO(ICOMIS,7) CALL VZERO(LUNIT,128) LUNIT(5)=6 LUNIT(6)=6 LUNIT(7)=6 LUNIT(10)=8 DO 5 I=11,18 LUNIT(I)=6 5 CONTINUE LUNIT(19)=8 LUNIT(81)=7 LUNIT(82)=7 LUNIT(83)=7 LUNIT(84)=7 LUNIT(89)=7 LUNIT(91)=8 LUNIT(97)=7 * * Initialize Command Processor (KUIP) * CALL KUINIT(NWKUIP) CALL KUEXIT(UGLAST) CALL KUTERM(IGTERM) * * Define Menus and Commands * CALL GINTRI * * * Initialize Graphics (HIGZ with GKS-GRAL and HPLOT) * CALL IGINIT(0) * * * Request workstation type * IF(BATCH)THEN IWK=0 ELSE CALL IGWKTY(IWK) ENDIF * * Initialise monitoring * CALL GEAMON(0,' ') * * * Initialize HPLOT * CALL HPLINT(IWK) CALL HERMES(6) IF(.NOT.BATCH)CALL IGSA(0) * * Define User Geometry * CALL UGINIT * * Initialize GEANT graphics unless already done * CALL GDINIT * * Keep starting time * IEVENT=0 CALL TIMEST(1.E10) CALL TIMEL(TIMINT) CALL KUEXEC('SET/PROMPT ''GEANT >''') * * Execute LOGON macro * IF (.NOT.NOLOG) THEN LG=LNBLNK(GTLOG) CALL KUEXEC('EXEC '//GTLOG(1:LG)) ENDIF * * Reset history * CALL KUEXEC('LAST 0') * IF (BATCH) THEN c Do standard or KUIP-macro batch processing if (BATCHF(1:1) .eq. ' ') then call UGCONB else CALL KUEXEC('EXEC '//BATCHF) endif ELSE CALL KUWHAG ENDIF 999 CONTINUE * * End monitoring * CALL GEAMON(2,'GXINT') * STOP END +DECK,GUFLD. *CMZU: 2.03/00 04/07/97 13.48.23 by K. Wozniak *CMZU: 2.00/10 23/09/96 12.29.47 by Unknown *CMZU: 2.00/06 21/07/96 21.40.50 by Phobos (R. Verdier) *CMZU: 2.00/04 16/07/96 11.28.57 by Phobos (K. Wozniak) *CMZU: 2.00/03 09/07/96 13.58.01 by K.Wozniak *CMZU: 1.01/21 10/07/95 13.49.21 by K.Wozniak *CMZ : 1.00/00 17/12/93 07.30.06 by Phobos *-- Author : SUBROUTINE GUFLD(VECT,B) *DocumentationBlock *********************************************************************** * * * Description: * * The Phobos-specific version of GUFLD which returns the magnetic * * field B at any point VECT. It has 3 modes, controlled by variables* * BFLD, RFLD, MAGT, MAGX, MAGZ and MOFF, in common RHSYS, which * * can be specified on input cards: * * * * BFLD is the field strength in kGauss. * * If you do not want to redefine the magnetic field values (strongly * * recomended for MAGT=3) BFLD=0.0 should be used. * * if it is different than 0.0 all field values will be multiplied by * * a factor equal: * * BFLD / Bcenter * * where Bcenter is the field strength at (MAGX, 0, MAGZ) * * * * The position of the map can be changed by the MOFF parameter * * the point VECT is THEN offset and a point defined as: * * VECTOFF = VECT - MOFF (vector) * * is used as a position in the map. * * THIS IS TRUE for standard PHOBOS map, however it is possible * * for MAGT=2 to define a sub-map positioned absolutely * * * * MAGT = 0: no magnetic field at all * * * * MAGT = 1: Diagnostic mode * * The field is a simple dipole field: Bx = Bz = 0, * * By = BFLD if r < RFLD, By = 0 otherwise, * * where rx = x - MAGX and rz = z - MAGZ. * * * * MAGT = 2: ASCII 3D-field map mode * * At the first call, a map of the magnetic field components is read * * in. First the values of the coordinates at grid points are read * * Then there are the lines with the indexes coresponding to the * * position of the point and the field vector (Bx,By,Bz). * * The field values not exactly at the known point are linearly * * interpolated using FINT for each of components Bx, By, Bz. The * * coordinates are transformed from the GEANT mother system to the * * fieldmap system using information in COMMON.SYS. * * * * MAGT=3 The magnetic field is a superposition of two fields from * * magnets. The field from each magnet is calculated in the case of * * cylindrical symetry. Thus the magnetic field map is two dimensio- * * nal only. The map is read from an ASCII file with a similar format* * as for MAGT=2 (the difference is in the definition of points: * * (x,y,z) for MAGT=2 and (r,v) for MAGT=3 * * The field values from two-dimensional map are interpolated if * * the point lies inside the boundaries. In the case of points * * outside the boundaries the value from the closest point exactly * * at the boundary is taken and multiplied by the factor lineary * * decreasing with the distance from the boundary. It protects from * * dangers of extrapolation of the field and avoids the sharp change * * of the field before it is set to zero * * * Arguments: * *VECT: x = VECT(1)... = point at which B is to be evaluated (input) * B* B(1)...B(3) = field at point VECT (output) * * Called by: * Geant tracking subroutines GHELIX or GRKUTA, called by GUSWIM * * Calls: * Cern routine FINT to do linear interpolation * STOPER - in case of error in the map * * Implicit inputs, outputs, side effects: * The field maps are read on unit Iusrmap, assumed to have been * opened in UGINIT; later, open will be done in GUFLD. * Initialization on local switch * * History: * Date Name Description * ---- ---- ----------- * 2-Jul-97 K.W. Unlimited number of sub-maps in MAGT=2 mode * absolute and movable (by MOFF) sub-maps possible * (PHOIND parameter) * 20-Sep-96 K.W. Reading of the map file: * MAGV, MAGT - always modyfied * MAGX, MAGZ, RFLD - changed only if it was 0.0 * Removed unused FANGL * 21-Jul-96 R. V. Removed unused zc, j, yneg * 12-Jul-96 K.Wozniak magnetic field center (MAGX,MAGZ) separated from * the field offset (MOFF(3)) * 06-Jul-96 K.Wozniak Removed ZEBRA map, added output of magnet * information from the map to Ascii OUput file * general reorganization of the code * 03-Jul-96 A. Trzupek Prepared map for the CDR magnet (MAGT=2) * which comprises two maps precise one for * spectrometer and less precise but larger * in x and z for TOF. Changed gufld to allow for * reading them. * 10-Jul-95 K. Wozniak Redefinition of the MAGT=2 mode * 02-Mar-93 K. Wozniak Added facility for cylindrical field map * 09-Dec-92 C. Conner Added facility for pre-sorted Zebra field map * 17-Jun-92 C. Parsons Extracted from GPH with unspecified changes * 22-Mar-92 Don Mcleod Initial version with Ascii field map, in GPH ************************************************************************ *EndDocumentationBlock *********************************************************************** IMPLICIT NONE +SEQ, FLAG. +SEQ, CYFLDC. +SEQ, RHSYS. +SEQ, IO. C Input variables REAL VECT(*) C Output variables REAL B(3) C Local variables REAL X(3) REAL VECTOFF(3) INTEGER NX,NY,NZ LOGICAL FIRSTC DATA FIRSTC /.TRUE./ SAVE FIRSTC C External Functions C ------------------ REAL FINT EXTERNAL FINT C ---- ASCII MAP DECLARATIONS -------------- INTEGER I,K, IX,IY,IZ, IMAP, IEOF INTEGER NMAPMAX, MAXMAP, MAXGRID ****** maximum value allowed for NX*NY*NZ PARAMETER (MAXMAP=510000) ****** maximum value allowed for NX + NY + NZ PARAMETER (MAXGRID=300) ****** maximum value allowed for the number of maps PARAMETER (NMAPMAX=20) REAL A REAL BX,BY,BZ REAL BMAX2 INTEGER NMAP, IPHOIND, IMPOS, IGPOS, NA COMMON /FLDMAP/ NMAP, IMPOS(NMAPMAX), IGPOS(NMAPMAX), 1 IPHOIND(NMAPMAX), BMAX2(NMAPMAX), 2 BX(MAXMAP),BY(MAXMAP),BZ(MAXMAP), 3 A(MAXGRID), NA(3,NMAPMAX) CHARACTER*80 CBUF C -------- End of ASCII map declarations ------------- REAL B1(3), B2(3), BR, BV, R1, R2, SINA, COSA, BMAX3 INTEGER IR, IV INTEGER NLINES REAL MAGV, MAGNEW *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C IF(.NOT. FIRSTC) GO TO 200 FIRSTC = .FALSE. IF(MAGT .EQ. 0 .OR. MAGT .EQ. 1) THEN IF(ISAOU .GT. 0) WRITE(IUSRAOU, '(A)' ) + ' * Magnetic field set in the control file ' IF(MAGT .EQ. 0) THEN WRITE(*,*) ' GUFLD - NO MAGNETIC FIELD' IF(BFLD .NE. 0.0) WRITE(*,*) ' GUFLD - BFLD = ', BFLD, + ' SET IN THE CONTROL FILE WAS IGNORED' WRITE(*,*) ' GUFLD - BFLD = 0.0' ELSE IF(MAGT .EQ. 1) THEN WRITE(*,*) ' GUFLD - MAGNETIC FIELD CONSTANT IN TWO CYLINDERS' WRITE(*,*) ' GUFLD - BFLD = ', BFLD IF(ABS(BFLD) .LT. 1.0E-10) + WRITE(*,*) ' GUFLD - USE MAGT = 0 TO OBTAIN ZERO FIELD!' ENDIF GO TO 199 ENDIF ******************************************************* * Read field map file in the first call * ******************************************************* IF (MAGT .GE. 2) THEN ! read parameters of the map c ! from the magnetic field map file IF(ISAOU .GT. 0) WRITE(IUSRAOU, '(A)' ) + ' * Magnetic field defined by the magnetic field map file' NX = 0 ! initialization for any kind of map NY = 0 ! zero denotes undefined field NZ = 0 NNR = 0 NNV = 0 NLINES = 0 NMAP = 0 10 READ(IUSRMAP, '(A)', END=941) CBUF NLINES = NLINES + 1 IF(CBUF(1:1) .EQ. '*') GO TO 10 IF(CBUF(1:4) .EQ. 'MAGV') THEN ! magnetic field version number READ(CBUF(6:80), *, ERR=942) MAGV GO TO 10 ENDIF IF(CBUF(1:4) .EQ. 'MAGT') THEN ! redefinition of the field type READ(CBUF(6:80), *, ERR=942) MAGT IF(MAGT .LT. 0 .OR. MAGT .GT. 3) GO TO 946 ! illegal value WRITE(*,*) ' GUFLD - MAP TYPE FOUND IN THE FILE = ', MAGT GO TO 10 ENDIF IF(CBUF(1:4) .EQ. 'MAGX') THEN ! redefinition of magnet center READ(CBUF(6:80), *, ERR=942) MAGNEW IF(MAGX .EQ. 0.0) THEN MAGX = MAGNEW ! MAGX changed only if it was zero WRITE(*,*) ' GUFLD - MAGX = ', MAGX ELSE WRITE(*,*) ' GUFLD - IGNORED MAGX FROM THE FILE:', MAGNEW WRITE(*,*) ' GUFLD - USED MAGX: ', MAGX ENDIF GO TO 10 ENDIF IF(CBUF(1:4) .EQ. 'MAGZ') THEN ! redefinition of magnet center READ(CBUF(6:80), *, ERR=942) MAGNEW IF(MAGZ .EQ. 0.0) THEN MAGZ = MAGNEW ! MAGZ changed only if it was zero WRITE(*,*) ' GUFLD - MAGZ = ', MAGZ ELSE WRITE(*,*) ' GUFLD - IGNORED MAGZ FROM THE FILE:', MAGNEW WRITE(*,*) ' GUFLD - USED MAGZ: ', MAGZ ENDIF GO TO 10 ENDIF IF(CBUF(1:4) .EQ. 'RFLD') THEN ! redefinition of magnet radius READ(CBUF(6:80), *, ERR=942) MAGNEW IF(RFLD .EQ. 0.0) THEN RFLD = MAGNEW ! RFLD changed only if it was zero WRITE(*,*) ' GUFLD - RFLD = ', RFLD ELSE WRITE(*,*) ' GUFLD - IGNORED RFLD FROM THE FILE:', MAGNEW WRITE(*,*) ' GUFLD - USED RFLD: ', RFLD ENDIF GO TO 10 ENDIF IF(CBUF(1:2) .EQ. 'M ') THEN ! information to be copied to AOU file IF(ISAOU .GT. 0) WRITE(IUSRAOU,'('' *'',A80)' ) CBUF(1:80) GO TO 10 ENDIF **************************************************************** * End of general information - check the type of the field * **************************************************************** IF(MAGT .EQ. 0) GO TO 199 IF(MAGT .EQ. 1) GO TO 199 IF(MAGT .EQ. 2) GO TO 20 IF(MAGT .EQ. 3) GO TO 111 GO TO 945 ELSE GO TO 945 ! wrong type of the magnetic field ENDIF ! MAGT .EQ. 2 ******************************************************* * ASCII map method: field values given in a box * ******************************************************* ********************************************************************* * Read the three-dimensional ASCII map (in a box) * * Format: * * - comments (starting with *) - description of the file contents * * - 'XAXIS:' nx - definition of the number of grids in * * x - direction * * - nx values of X from 0.0 to maximum (sorted) - free format * * - comments (if any) * * - 'YAXIS:' ny - definition of the number of grids in * * y - direction * * - ny values of Y from 0.0 to maximum (sorted) - free format * * - comments (if any) * * - 'ZAXIS:' nz - definition of the number of grids in * * z - direction * * - nz values of Z from 0.0 to maximum (sorted) - free format * * - comments (if any) * * - 'PHOMAG:' iphoind - PHOBOS magnet flag: * * iphoind = 0 - map defined only in the area defined by AXIS * * commands * * MOFF not valid for THIS PART OF the field * * ipohind = 1 - definition for x>0 and y>0 extends to all * * signs of x, y * * field modified by MOFF * * - 'FIELD:' bmax - declaration of the begining of field values * * bmax - maximal field for y=0 * * - field values in the nodes of the grid, one node per line: * * ix iy iz Bx By Bz where: * * ix, iy, iz - definition of the node point: (ix),Y(iy),Z(iz) * * Bx, By, Bz - components of the field * * IT IS ASSUMED, THAT THE FIELD IS DEFFINED FOR: * * X >= 0, Y >= 0, Z in desired range * ********************************************************************* 20 CONTINUE NMAP = NMAP + 1 IF(NMAP .GT. NMAPMAX) GO TO 956 IMPOS(NMAP) = 0 IGPOS(NMAP) = 0 IF(NMAP .GT. 1) THEN IMPOS(NMAP) = IMPOS(NMAP-1) + NX*NY*NZ IGPOS(NMAP) = IGPOS(NMAP-1) + NX + NY + NZ ENDIF NX = 0 NY = 0 NZ = 0 IPHOIND(NMAP) = 1 ! standard - field from PHOBOS magnet GO TO 22 21 CONTINUE READ(IUSRMAP, '(A)', END=941) CBUF NLINES = NLINES + 1 22 CONTINUE IF(CBUF(1:1) .EQ. '*') GO TO 21 IF(CBUF(1:6) .EQ. 'XAXIS:') THEN READ(CBUF(7:80), *, ERR=942) NX IF(NX .LT. 2 .OR. NX+NY+NZ+IGPOS(NMAP) .GT. MAXGRID) + GO TO 954 READ(IUSRMAP, *, END=941, ERR=942) + (A(IGPOS(NMAP)+I), I=1,NX) NLINES = NLINES + 1 GO TO 21 ENDIF IF(CBUF(1:6) .EQ. 'YAXIS:') THEN IF(NX .LT. 1) GO TO 951 READ(CBUF(7:80), *, ERR=942) NY IF(NY .LT. 2 .OR. NX+NY+NZ+IGPOS(NMAP) .GT. MAXGRID) + GO TO 954 READ(IUSRMAP, *, END=941, ERR=942) + (A(IGPOS(NMAP)+NX+I), I=1,NY) NLINES = NLINES + 1 GO TO 21 ENDIF IF(CBUF(1:6) .EQ. 'ZAXIS:') THEN IF(NX .LT. 1) GO TO 951 IF(NY .LT. 1) GO TO 952 READ(CBUF(7:80), *, ERR=942) NZ IF(NZ .LT. 2 .OR. NX+NY+NZ+IGPOS(NMAP) .GT. MAXGRID) + GO TO 954 READ(IUSRMAP, *, END=941, ERR=942) + (A(IGPOS(NMAP)+NX+NY+I),I=1,NZ) NLINES = NLINES + 1 GO TO 21 ENDIF IF(CBUF(1:7) .EQ. 'MIRROR:') THEN READ(CBUF(8:80), *, ERR=942) IPHOIND(NMAP) IF(IPHOIND(NMAP) .NE. 0 .AND. + IPHOIND(NMAP) .NE. 1) GO TO 957 GO TO 21 ENDIF IF(CBUF(1:6) .EQ. 'FIELD:') THEN IF(NX .LT. 1 .OR. NY .LT. 1 .OR. NZ .LT. 1) GO TO 953 IF(NX*NY*NZ+IMPOS(NMAP) .GT. MAXMAP) GO TO 954 READ(CBUF(7:80), *, ERR=942) BMAX2(NMAP) ! mominal maximum at y=0 WRITE(*,*) ' GUFLD - MAXIMUM ABS(BY) IN Y=0 PLANE:', + BMAX2(NMAP) IF(BFLD .NE. 0.0 .AND. IPHOIND(NMAP) .NE. 0) THEN WRITE(*,*) ' GUFLD - RESCALED VALUE = ', BFLD ELSE WRITE(*,*) ' GUFLD - NO RESCALING' ENDIF CALL VZERO(BX(IMPOS(NMAP)+1), NX*NY*NZ) CALL VZERO(BY(IMPOS(NMAP)+1), NX*NY*NZ) CALL VZERO(BZ(IMPOS(NMAP)+1), NX*NY*NZ) NA(1,NMAP) = NX NA(2,NMAP) = NY NA(3,NMAP) = NZ 25 CONTINUE READ(IUSRMAP, '(A)', END=35, ERR=942) CBUF NLINES = NLINES + 1 READ(CBUF(1:80), *, ERR=31) IX,IY,IZ, B1(1),B1(2),B1(3) IF(IX .LT. 1 .OR. IY .LT. 1 .OR. IZ .LT. 1 .OR. + IX. GT. NX .OR. IY. GT. NY .OR. IZ. GT. NZ) GO TO 959 K = IMPOS(NMAP) + IX + NX * (IY-1 + NY*(IZ-1)) BX(K) = B1(1) BY(K) = B1(2) BZ(K) = B1(3) IF(IX.EQ.NX.AND.IY.EQ.NY.AND.IZ.EQ.NZ) GO TO 30 GO TO 25 ENDIF GO TO 942 ! ERROR IN THE MAP 30 CONTINUE READ(IUSRMAP, '(A)', END=35) CBUF NLINES = NLINES + 1 31 CONTINUE GO TO 20 35 CONTINUE ccc CALL NEXTFILE(IUSRMAP, IEOF) ccc IF(IEOF .EQ. 0) GO TO 30 99 CONTINUE GO TO 199 ********************************************************************* * Magnetic field is a superposition of two cylinrically symetrical * * fields from two magnets * * 2-dimensional ASCII map (IN cylindrical coordinates). * * Format: * * - comments (starting with *) - description of the file contents * * - 'RADIAL:' nnr - definition of the number of grids in * * radial direction * * - nnr values of R from 0.0 to maximum (sorted) - free format * * - comments (if any) * * - 'VERTICAL:' nnv - definition of the number of grids in * * vertical direction * * - nvv values of V from 0.0 to maximum (sorted) - free format * * - comments (if any) * * - 'FIELD:' - declaration of the begining of field values * * - field values in the nodes of the grid, one node per line: * * ir iv Br Bv where: * * ir, iv - definition of the node point: R(ir), V(iv) * * Br - radial component of the field * * Bv - vertical component of the field * ********************************************************************* 110 READ(IUSRMAP, '(A)', END=941) CBUF NLINES = NLINES + 1 111 IF(CBUF(1:1) .EQ. '*') GO TO 110 IF(CBUF(1:7) .EQ. 'RADIAL:') THEN READ(CBUF(8:80), *, ERR=942) NNR IF(NNR .LT. 2 .OR. NNR .GT. NNRMAX) GO TO 961 READ(IUSRMAP, *, END=941, ERR=942) (XTAB(I), I=1,NNR) NLINES = NLINES + 1 GO TO 110 ENDIF IF(CBUF(1:9) .EQ. 'VERTICAL:') THEN READ(CBUF(10:80), *, ERR=942) NNV IF(NNV .LT. 2 .OR. NNV .GT. NNVMAX) GO TO 962 READ(IUSRMAP, *, END=941, ERR=942) (XTAB(NNR+I), I=1,NNV) NLINES = NLINES + 1 GO TO 110 ENDIF IF(CBUF(1:6) .EQ. 'FIELD:') THEN IF(NNR .LT. 2 .OR. NNV .LT. 2) GO TO 963 CALL VZERO(BRTAB(1), NNR*NNV) CALL VZERO(BVTAB(1), NNR*NNV) 112 CONTINUE READ(IUSRMAP, '(A)', END=120, ERR=942) CBUF NLINES = NLINES + 1 READ(CBUF(1:80), *, ERR=942) IR, IV, BR, BV IF(IR .LT. 1 .OR. IV .LT. 1 .OR. + IR. GT. NNR .OR. IV .GT. NNV) GO TO 969 BRTAB(IR+NNR*(IV-1)) = BR BVTAB(IR+NNR*(IV-1)) = BV GO TO 112 ENDIF GO TO 942 120 CONTINUE ************************************************************************** * Check if the map is completly filled (there should be no nods with * * field equal zero) * ************************************************************************** DO IR=1,NNR DO IV=1,NNV IF(BRTAB(IR+NNR*(IV-1)) .EQ. 0.0 .AND. + BVTAB(IR+NNR*(IV-1)) .EQ. 0.0) THEN WRITE(*,*) ' GUFLD - ZERO FIELD AT:', + XTAB(IR), XTAB(NNR+IV) ENDIF ENDDO ENDDO CALL CYFLD(0.0, 0.0, B1(1), B1(2)) CALL CYFLD(2.0*MAGX, 0.0, BR, BV) B(1) = B1(1) - BR B(2) = B1(2) - BV BMAX3 = SQRT(B(1)**2 + B(2)**2) WRITE(*,*) 'MAGT = 3 BMAX = ', BMAX3 IF(BFLD .NE. 0.0) THEN WRITE(*,*) ' GUFLD - RESCALED VALUE = ', BFLD ELSE WRITE(*,*) ' GUFLD - NO RESCALING' ENDIF *********************************************************** * Output of the field parameters to Ascii OUtput file * *********************************************************** 199 CONTINUE IF(ISAOU .GT. 0) THEN WRITE(IUSRAOU, '('' M MAGV '', F10.4)' ) MAGV WRITE(IUSRAOU, '('' M MAGT '', I10)' ) MAGT WRITE(IUSRAOU, '('' M MAGX '', F10.4)' ) MAGX WRITE(IUSRAOU, '('' M MAGZ '', F10.4)' ) MAGZ WRITE(IUSRAOU, '('' M RFLD '', F10.4)' ) RFLD WRITE(IUSRAOU, '('' M MOFF '', 3F10.4)' ) MOFF WRITE(IUSRAOU, '('' M BFLD '', F10.4)' ) BFLD ENDIF ! ISAOU .GT. 0 *********************************************************** * Calculation of the field values * *********************************************************** 200 CONTINUE IF(MAGT .EQ. 0) GO TO 990 ! zero field everywhere VECTOFF(1) = VECT(1) - MOFF(1) VECTOFF(2) = VECT(2) - MOFF(2) VECTOFF(3) = VECT(3) - MOFF(3) If(MAGT .eq. 1) Then ! perfect dipole X(1) = (VECTOFF(3) - MAGZ) C Bx,Bz always zero B(1)=0 B(3)=0 If(VECTOFF(1) .gt. 0) then !positive side of field X(2) = (VECTOFF(1) - MAGX) if( SQRT(X(1)**2+X(2)**2) .lt. RFLD )Then B(2)=BFLD Else B(2)=0 Endif Else X(2) = (VECTOFF(1) + MAGX) if( SQRT(X(1)**2+X(2)**2) .lt. RFLD )Then B(2)=-BFLD Else B(2)=0 Endif endif Return Endif ! MAGT .EQ. 1 IF (MAGT .EQ. 2) THEN ! field from the 3-D map of any kind c ! of magnet X(1) = ABS(VECTOFF(1)) X(2) = ABS(VECTOFF(2)) X(3) = VECTOFF(3) DO 220 IMAP = 1,NMAP NX = NA(1,IMAP) NY = NA(2,IMAP) NZ = NA(3,IMAP) IF(IPHOIND(IMAP) .EQ. 1) THEN IF(X(1) .GT. A(IGPOS(IMAP)+NX)) GO TO 220 IF(X(2) .GT. A(IGPOS(IMAP)+NX+NY)) GO TO 220 IF(X(3) .LT. A(IGPOS(IMAP)+NX+NY+1) .OR. + X(3) .GT. A(IGPOS(IMAP)+NX+NY+NZ)) GO TO 220 GO TO 221 ELSE ! IPHOIND(IMAP) .EQ. 0 IF(VECT(1) .LT. A(IGPOS(IMAP)+1) .OR. + VECT(1) .GT. A(IGPOS(IMAP)+NX)) GO TO 220 IF(VECT(2) .LT. A(IGPOS(IMAP)+NX+1) .OR. + VECT(2) .GT. A(IGPOS(IMAP)+NX+NY)) GO TO 220 IF(VECT(3) .LT. A(IGPOS(IMAP)+NX+NY+1) .OR. + VECT(3) .GT. A(IGPOS(IMAP)+NX+NY+NZ)) GO TO 220 GO TO 221 ENDIF 220 CONTINUE GO TO 990 221 CONTINUE IF(IPHOIND(IMAP) .EQ. 0) THEN B(1) = FINT(3, VECT, NA(1,IMAP), A(IGPOS(IMAP)+1), + BX(IMPOS(IMAP)+1) ) B(2) = FINT(3, VECT, NA(1,IMAP), A(IGPOS(IMAP)+1), + BY(IMPOS(IMAP)+1) ) B(3) = FINT(3, VECT, NA(1,IMAP), A(IGPOS(IMAP)+1), + BZ(IMPOS(IMAP)+1) ) ELSE ! IPHOIND(IMAP) .EQ. 1 IF(BFLD .NE. 0.0 .AND. BMAX2(IMAP) .NE. 0.0) THEN B(1) = FINT(3, X, NA(1,IMAP), + A(IGPOS(IMAP)+1), BX(IMPOS(IMAP)+1) ) + * BFLD/BMAX2(IMAP) B(2) = FINT(3, X, NA(1,IMAP), + A(IGPOS(IMAP)+1), BY(IMPOS(IMAP)+1) ) + * BFLD/BMAX2(IMAP) B(3) = FINT(3, X, NA(1,IMAP), + A(IGPOS(IMAP)+1), BZ(IMPOS(IMAP)+1) ) + * BFLD/BMAX2(IMAP) ELSE B(1) = FINT(3, X, NA(1,IMAP), A(IGPOS(IMAP)+1), + BX(IMPOS(IMAP)+1) ) B(2) = FINT(3, X, NA(1,IMAP), A(IGPOS(IMAP)+1), + BY(IMPOS(IMAP)+1) ) B(3) = FINT(3, X, NA(1,IMAP), A(IGPOS(IMAP)+1), + BZ(IMPOS(IMAP)+1) ) ENDIF C----- transformations in the case the point is not in y>0, x>0 part IF(VECTOFF(1) .LT. 0.0) THEN B(2) = -B(2) B(3) = -B(3) ENDIF IF(VECTOFF(2) .LT. 0.0) THEN B(1) = -B(1) B(3) = -B(3) ENDIF ENDIF RETURN 230 CONTINUE ! outside box the field is equal 0 go to 990 ENDIF ! MAGT .EQ. 2 IF(MAGT .EQ. 3) THEN ! field from the 2-D map of a cylindrically c ! symetric magnet R1 = SQRT((VECTOFF(1)-MAGX)**2 + (VECTOFF(3)-MAGZ)**2) R2 = SQRT((VECTOFF(1)+MAGX)**2 + (VECTOFF(3)-MAGZ)**2) CALL CYFLD(R1, VECTOFF(2), BR, BV) IF(R1 .GT. 0.1E-20) THEN SINA = (VECTOFF(1)-MAGX) / R1 COSA = (VECTOFF(3)-MAGZ) / R1 ELSE SINA = 0.0 COSA = 0.0 ENDIF B1(1) = SINA * BR B1(2) = BV B1(3) = COSA * BR CALL CYFLD(R2, VECTOFF(2), BR, BV) IF(R2 .GT. 0.1E-20) THEN SINA = (VECTOFF(1)+MAGX) / R2 COSA = (VECTOFF(3)-MAGZ) / R2 ELSE SINA = 0.0 COSA = 0.0 ENDIF B2(1) = - SINA * BR B2(2) = - BV B2(3) = - COSA * BR B(1) = B1(1) + B2(1) B(2) = B1(2) + B2(2) B(3) = B1(3) + B2(3) IF(BFLD .NE. 0.0) THEN B(1) = B(1) * BFLD/BMAX3 B(2) = B(2) * BFLD/BMAX3 B(3) = B(3) * BFLD/BMAX3 ENDIF ENDIF ! MAGT .EQ. 3 RETURN *********************************************************** * General error messages * *********************************************************** 941 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'UNEXPECTED EOF IN THE FIELD MAP FILE' WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 942 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ERROR READING FIELD MAP FILE' WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 945 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'UNDEFINED TYPE OF THE MAGNETIC FIELD:', MAGT GO TO 970 946 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD -', + 'ERROR IN THE MAGNETIC FIELD MAP FILE' WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ILLEGAL TYPE OF THE MAGNETIC FIELD:', MAGT WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ONLY MAGT = 2 OR MAGT = 3 ARE ALLOWED' GO TO 970 *********************************************************** * Error messages for MAGT=2 * *********************************************************** 951 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - X GRID HAS TO BE DEFINED FIRST' WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 952 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - Y GRID HAS TO BE DEFINED ', + 'BEFORE Z GRID' WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 953 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ALL GRIDS HAS TO BE DEFINED BEFORE ', + 'FIELD VALUES DEFINITIONS' WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 954 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'TOO BIG MAP (MAGT=2) NUMBER: ', NMAP WRITE(*,*) ' *** ERROR IN GUFLD - X, Y, Z GRID:', NX, NY, NZ GO TO 970 956 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'TOO MANY MAPS (MAGT=2) IN THE FILE:', NMAP GO TO 970 957 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ILLEGAL PHOMAG PARAMETER VALUE:', IPHOIND(NMAP) WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 959 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ERROR IN INDEX OF THE MAP (MAGT=2) ELEMENT:', + IX, IY, IZ WRITE(*,*) ' *** ERROR IN GUFLD - MAP NUMBER:', NMAP GO TO 970 *********************************************************** * Error messages for MAGT=3 * *********************************************************** 961 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'TOO BIG SIZE OF THE FIELD MAP (MAGT=3)', + ' OR WRONG VALUE OF R-GRID, R,V=', NNR, NNV GO TO 970 962 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'TOO BIG SIZE OF THE FIELD MAP (MAGT=3):', + ' OR WRONG VALUE OF V-GRID, R,V=', NNR, NNV GO TO 970 963 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'R,V GRIDS HAS TO BE DEFINED BEFORE ', + 'FIELD VALUES DEFINITIONS' GO TO 970 969 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ERROR IN INDEX OF THE MAP (MAGT=3) ELEMENT:', + IR, IV GO TO 970 *********************************************************** * Final error message * *********************************************************** 970 CONTINUE WRITE(*,*) ' *** ERROR IN GUFLD - ', + 'ERROR IN THE MAP FILE, ABOUT LINE: ', NLINES WRITE(*,*) ' *** ERROR IN GUFLD - ERROR LINE: ', CBUF CALL STOPER('GUFLD', 'FATAL ERROR', 1) *********************************************************** * Magnetic field equal 0 * *********************************************************** 990 CONTINUE B(1) = 0.0 B(2) = 0.0 B(3) = 0.0 RETURN END +DECK,GUKINE. *CMZU: 2.01/00 07/02/97 13.55.43 by K.Wozniak *CMZU: 2.00/14 21/11/96 14.46.25 by K.Wozniak *CMZU: 2.00/08 25/07/96 12.47.28 by Phobos (R. Verdier) *CMZU: 2.00/06 21/07/96 21.45.56 by Phobos (R. Verdier) *CMZU: 2.00/03 09/07/96 12.29.11 by K.Wozniak *CMZU: 2.00/02 04/04/96 16.01.12 by Phobos (R. Verdier) *CMZ : 2.00/00 08/08/95 01.05.08 by Phobos (R. Verdier) *CMZU: 1.01/21 11/07/95 20.31.31 by K.Wozniak *CMZU: 1.01/17 13/04/95 08.06.16 by K.Wozniak *-- Author : K.Wozniak 09/03/95 Subroutine GUKINE *Documentation_Block ************************************************************************ * * Description: * User version of GUKINE loads the KINE structure with tracks. * * Arguments: * none * * Called by: * GTRIG * * Calls: * BANG, GPKINE, GPVERT, GSKINE, GSVERT, LENOCC, RANNOR, UFILE * * Implicit inputs, outputs, side effects: * Loads KINE structure; uses user KINE buffer. Variables in MUPEP * control # tracks processed concurrently. * * Filename: PMC_SRC:GUKINE.FOR * * History: * Date Name Description * ---- ---- ----------- * 7-Feb-97 K. W. corrected error in phi selection criterion * 21-Nov-96 K. W. corrected infinite loop in the case of non existing * input file * 25-Jul-96 R. V. Remove MUPEPD include for ANSI compliance * 21-Jul-96 R. V. Remove unused plb, ier, pp, pt * 05-Jul-96 K.Wozniak Information from the file copied to Ascii OUtput file * 04-Apr-95 D. McLeod UFILE replaced by SERVER as part of UNIX port * 07-Aug-95 R. Verdier RBZZ sets VERT(3), not VERT(2) * 10-Jul-95 K. Wozniak Changes in the meaning of the GEN parameter: * GEN = 0 - tracks from an input file * GEN = 1-10 - tracks from BANG generator * GEN = 11-20 - previously GEN=4 mode and extentions * New step mode added (step 1/p) * 11-Apr-95 K. Wozniak Corrected calculations in mode=4 - * removed dependence of momentum on emmision angle * 17-Mar-95 K. Wozniak Skipping of events and tracks at the begining * of input data file added * 10-Mar-95 K. Wozniak Changed the meaning of the GEN parameter: * GEN = 1 - random flat distributions of p,eta,phi,vertex * GEN = 2 - tracks covering the spectrometer acceptance * GEN = 3 - random tracks with more "physical" distr. * GEN = 4 - tracks with a parameter changing continously * GEN = 5 - tracks from an input file * The selection of momentum, phi etc. is performed * for each GEN mode * 18-Jul-94 K. Wozniak Initialize NtPrev * 09-Nov-93 R. V. MUPEP.CDA -> MUPEPD.CMN, BANG.CMN -> BANGC.CMN * for code management * 05-Jun-93 R. V. Multipass mods: read or generate only NtConc * tracks per pass, Ntpe tracks per event; * see MUPEP.CMN, MUPEP.CDA for definitions. * Use UFILE for track input on logical GENEVS, * replacing FOR037. * 27-Jun-92 R. V. Add user buffer UJKBUF to JKINE * 27-Mar-92 C. Parsons Separate from GPH; add track read-in * Mar-92 D. Mcleod Creation in GPH package ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ,FLAG. +SEQ,IO. +SEQ,BANGC. +SEQ,GCFLAG. +SEQ,GCPHYS. +SEQ,MUPEP. +SEQ,RHSYS. +SEQ,UJKBUF. C External function returning length of a string integer LENOCC real RANF external RANF C Local: Integer LUN, ! unit to open event file on & ID ! Geant ID from event file INTEGER ios, Nusef, NVTX, NT INTEGER ISTEPA, ISTEPP, ISTEPV, IR C Added for long format call of SERVER: INTEGER IRUN1,IRUN2 REAL VERT(3), PLAB(3) REAL PS, PX, PY, PZ, DPP, V1, V2, V CHARACTER*80 FILE_NAME CHARACTER*80 LINESTR real pmag,theta,phi,phi180,eta ! particle parameters real phid,phid180 c Limits on accepted theta to avoid infinite pseudorapidity: real ThetaMin / 1.0e-7 /, ThetaMax / 3.1415926 / data Nusef /0/ save ID, LUN, VERT SAVE ISTEPA, ISTEPP, ISTEPV, IR DATA ISTEPA, ISTEPP, ISTEPV / 0, 0, 0 / DATA IR /12347/ c End of declarations C C Error message should be handled more generally C integer lout lout=6 C IF(IGEN.EQ.0) THEN c ********************************************************* c Text file event input c Input is read on logical unit GENEVS. c All lines start with a single KEY letter: C letter "C" Comment line, ignored C letter "I" Information line - copied to Ascii OUtput file C letter "V" Vertex (x,y,z) where particles start C letter "P" Particle ID, P, THETA, PHI of particle C letter "E" End of event c anything else stops the job with an error message, as c does a read or format conversion error. c Processing is controlled by variables Ntconc and Ntpe in common c MUPEP. A maximum of Ntconc tracks are processed in one pass. c Tracks are processed until Ntpe primary tracks have been processed, c or an "E" line is read. If no "E" line is present, the file is c rewound and reread with a phi-rotation added. C C Sample event input file C C C Define an event with three particles , pi+, pi-, p C C C V 0.0 0.0 0.0 C P 8 1.0 0.5 0.0 C P 9 2.0 0.5 0.1 C P 14 3.0 0.75 0.0 C E c ********************************************************* ************************************************************ * Opening of the input file ************************************************************ if (Epstate .eq. 0) then +SELF,IF=NOSERV. call UFILE (0, 'GENEVS', Lun, File_Name) if (Lun .le. 0) then write (lout, '(a)') ' GUKINE: unable to open track file:' // + File_Name Epstate = 3 else WRITE (lout,'(2a)') ' GUKINE: reading tracks from ', 1 File_name( 1:LENOCC(File_name) ) Nusef = 0 +SELF,IF=-NOSERV. C Replace by SERVER which calls STOPER rather than returning neg. Lun: CALL SERVER('GENEVS',IDRUN,Lun,File_Name,0,0,0,IRUN1,IRUN2) WRITE (lout,'(2a)') ' GUKINE: reading tracks from ', 1 File_name( 1:LENOCC(File_name) ) Nusef = 0 +SELF. if(ISAOU .gt. 0) then write(iusraou, '('' *'')' ) write(iusraou, '('' * Input file information'')' ) write(iusraou, '('' I NESK '', i10)' ) neskip write(iusraou, '('' I NTSK '', i10)' ) ntskip endif ************************************************************ * Skipping of NeSkip events and then NtSkip tracks * at the beginning of input text file ************************************************************ do while (NeSkip .gt. 0 .or. NtSkip .gt. 0) Read (LUN, '(a)', iostat=ios) linestr if (ios .eq. -1) then c On end of file, rewind and reread file with increased phi rotation if(abs(RROT) .gt. 0.001) then rewind (LUN) Nusef = Nusef + 1 write(lout, '(a,i5,a)') + ' GUKINE: Input file rewound ', + nusef, ' time' else ! file is not rewound if no rotation requested Epstate = 3 NtSkip = 0 NeSkip = 0 ! abort run write(lout, '(a)') + ' GUKINE: Input file can not be rewound ' endif elseif (ios .gt. 0) then c On read error, abort run write (lout, '(2a/1x,a)') + ' GUKINE: Quit while skipping', 1 ' input read error, line:', linestr Epstate = 3 NeSkip = 0 NtSkip = 0 else If (NeSkip .gt. 0) then If (linestr(1:1).eq.'E' .or. + linestr(1:1).eq.'e') Then c On "E" line: count down the number of events to skip NeSkip = NeSkip - 1 Epstate = 2 endif else ! only NtSkip is greater than 0 If (linestr(1:1).eq.'E' .or. + linestr(1:1).eq.'e') Then c On "E" line: More tracks to skip than in the event - it is an error write (lout, '(2a/1x,a)') + ' GUKINE: Quit while skipping, not enough ', 1 ' tracks to skip in the event' NtSkip = 0 Epstate = 3 endif If (linestr(1:1).eq.'P' .or. + linestr(1:1).eq.'p') Then NtSkip = NtSkip - 1 endif endif ! NeSkip .gt. 0 endif ! ios .gt. 0 enddo ! while (NeSkip.GT.0) +SELF,IF=NOSERV. endif ! Lun .le. 0 +SELF. endif ! Epstate .eq. 0 if (Epstate .eq. 0 .or. Epstate .eq. 2) then ************************************************************ * Initialization at the begining of event ************************************************************ Epstate = 1 MPind = 0 NtPrim = 0 NtTot = 0 NvPrev = 0 ********************************************************************** * Define a default vertex position in case not specified in dataset ********************************************************************** IF(RBXY .LT. 0.0001) THEN ! flat distribution of vertex position IF(RBDX .GT. 0.0001) THEN VERT(1) = RBXX + RBDX * (2.0*RANF(IR)-1.0) ELSE VERT(1) = RBXX ENDIF IF(RBDY .GT. 0.0001) THEN VERT(2) = RBYY + RBDY * (2.0*RANF(IR)-1.0) ELSE VERT(2) = RBYY ENDIF IF(RBDZ .GT. 0.0001) THEN VERT(3) = RBZZ + RBDZ * (2.0*RANF(IR)-1.0) ELSE VERT(3) = RBZZ ENDIF ELSE ! double Gaussian (x-y) and trianglular (z) distributions V = 100.0 DO WHILE(V .GT. 1.0) V1 = 2.0*RANF(IR) -1.0 !generate double Gaussian.. V2 = 2.0*RANF(IR) -1.0 !see particle data booklet V = V1*V1 + V2*V2 ENDDO VERT(1) = RBXX + RBXY*V1*SQRT(-2.0*LOG(V)/V) VERT(2) = RBYY + RBXY*V2*SQRT(-2.0*LOG(V)/V) C Generate a triangular probability distribution for intersection z V1 = RANF(IR) V2 = RANF(IR) IF(V1.GT.V2) THEN VERT(3) = RBZZ + 0.5*RBDZ*(V1-1.0) ELSE VERT(3) = RBZZ + 0.5*RBDZ*V1 ENDIF ENDIF ! if(RBXY .GT. ... elseif (Epstate .eq. 1) then ***************************************************************** * In the middle of the event (when splitted into small parts) ***************************************************************** c Save cumulative vertex count in case we eventually write it in Ntuples NvPrev = NVTX endif NtPrev = NtTot c Set flag to force a primary vertex to be defined NVTX = -1 c Set the number of tracks and read the next multi-pass group MPind = MPind + 1 NtMax = min(NtPrim + NtConc, NtpE) if (Epstate .gt. 2) NtMax = 0 ************************************************************ * Loop over tracks in the input text file ************************************************************ do while (NtPrim .lt. NtMax) Read (LUN, '(a)', iostat=ios) linestr if (ios .eq. -1) then c On end of file, rewind and reread file with increased phi rotation if(NtPrim .gt. 0) then ! some tracks before EOF NtMax = NtPrim ! force an end of event (end of loop) Epstate = 2 endif if(abs(RROT) .gt. 0.001) then rewind (LUN) Nusef = Nusef + 1 write(lout, '(a,i5,a)') ' GUKINE: Input file rewound ', + nusef, ' time' else ! file is not rewound if no rotation requested Epstate = 3 NtMax = 0 write(lout, '(a)') + ' GUKINE: Input file can not be rewound ' endif elseif (ios .gt. 0) then c On read error, abort run write (lout, '(2a/1x,a)') ' GUKINE: Quit on track', 1 ' input read error, line:', linestr Epstate = 3 NtMax = 0 else *********************************************************************** * Analysis of the line from the input file *********************************************************************** if ((linestr(1:1).eq.'V').or.(linestr(1:1).eq.'v')) Then c On "V" line: save vertex position read (linestr(2:),*) vert(1), vert(2), vert(3) CALL GSVERT(VERT, 0, 0, 0, 0, NVTX) ElseIf ((linestr(1:1).eq.'P').or.(linestr(1:1).eq.'p')) Then c "P" line: save track kinematics including phi-rotation read (linestr(2:),*,iostat=ios) id, pmag, theta, phi if (ios .eq. 0) then phi = phi + ! rotation of phi + float(Nusef) * RROT / 57.2957795 do while (phi .gt. 3.14159265359) ! normalization of phi phi = phi - 6.28318530718 enddo do while (phi .lt. -3.14159265359) phi = phi + 6.28318530718 enddo phi180 = phi + 3.14159265359 ! if(phi180 .gt. 3.14159265359) + phi180 = phi180 - 6.28318530718 phid = phi * 57.2957795 phid180 = phi180 * 57.2957795 theta = min (max (theta, ThetaMin), ThetaMax) plab(1) = pmag * sin(theta) * cos(phi) plab(2) = pmag * sin(theta) * sin(phi) plab(3) = pmag * cos(theta) eta = -alog( tan(theta/2.0) ) ************************************************************************* * Select only the tracks that are in the requested intervals of momentum, * eta, phi etc. ************************************************************************* if(rmom(1) .le. pmag .and. pmag .le. rmom(2) .and. + reta(1) .le. eta .and. eta .le. reta(2) .and. + irpid(1) .le. id .and. id .le. irpid(2) .and. + ((rphi(1) .le. phid .and. phid .le. rphi(2)) .or. + (irarm .eq. 2 .and. + rphi(1) .le. phid180 .and. phid180 .le. rphi(2))) + ) then C Load default vertex if there has been no vertex card. If (nvtx .lt. 0) CALL GSVERT (VERT, 0, 0, 0, 0, NVTX) CALL UZERO(UBUF, 1, NWUBMAX) CALL GSKINE (PLAB, ID, NVTX, UBUF, NWUBMAX, NT) NtPrim = NtPrim + 1 NtTot = NtTot + 1 c Set end-of-event flag after Ntpe tracks if (NtPrim .ge. Ntpe) Epstate = 2 endif ! selection of tracks else ! ios .ne. 0 c On illegal input, abort write (lout, '(2a/1x,a)') ' GUKINE: Quit on track', 1 ' input conversion error in line:', linestr Epstate = 3 NtMax = 0 endif ************************************************************************* * Other lines ************************************************************************* ElseIf ((linestr(1:1).eq.'E').or.(linestr(1:1).eq.'e')) Then c On "E" line: set end-of-event flag and force end of loop NtMax = NtPrim Epstate = 2 ElseIf ((linestr(1:1).eq.'C').or.(linestr(1:1).eq.'c')) Then c "C" line: ignore comment (should it be listed in log?) ElseIf ((linestr(1:1).eq.'I').or.(linestr(1:1).eq.'i')) Then c "I" line: copied to the Ascii OUtput file if(ISAOU .gt. 0) then write(iusraou, '('' *'',a)' ) linestr endif Else c Unrecognized line: abort; probably wrong file write (lout, '(2a/1x,a)') ' GUKINE: Quit on illegal ', 1 ' track input line:', linestr EpState = 3 NtMax = 0 EndIf endif ! ios end do ! while (Ntprim .lt. NtMax) C ! end of event found or the number of tracks read C ! was equal NtCo C------------------ end of IGEN = 0 section ELSE IF(IGEN.GE.1 .AND. IGEN.LE.10) THEN ********************************************************************** * Multiple random tracks from random beam interactions: from BANG * ********************************************************************** c Set up for the next multi-pass group if (Epstate .eq. 0) then WRITE (lout,'(a)') ' GUKINE: using tracks generated by BANG.' endif if (Epstate .eq. 0 .or. Epstate .eq. 2) then Epstate = 1 MPind = 0 NtPrim = 0 NtTot = 0 NvPrev = 0 elseif (Epstate .eq. 1) then c Save the cumulative vertex count in case we eventually write it c into ntuples NvPrev = NVTX endif c Override the number of tracks per event specified in NtpE by IRMUL NtpE = IRMUL IRMUL = min(IRMUL - NtPrim, NtConc) c Generate the next group, set flag if final group, and restore irmul if (IRMUL .GT. 0) call BANG(IGEN) MPind = MPind + 1 NtPrim = NtPrim + IRMUL NtTot = NtTot + IRMUL if (NtPrim .ge. NtpE) EpState = 2 IRMUL = NtpE C----------- end of BANG mode ELSE IF(IGEN.EQ.11) THEN ***************************************************************** * STEP THE VALUES OF INPUT ANGLE, MOMENTUM OR VERTEX POSITION * ***************************************************************** PX = (RMOM(1)+FLOAT(ISTEPP)*RMOM(3)) * + SIN((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) * + COS(RPHI(1)/57.2957795) PY = (RMOM(1)+FLOAT(ISTEPP)*RMOM(3)) * + SIN((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) * + SIN(RPHI(1)/57.2957795) PZ = (RMOM(1)+FLOAT(ISTEPP)*RMOM(3)) * + COS((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) PLAB(1) = PX PLAB(2) = PY PLAB(3) = PZ VERT(3) = RBZZ + FLOAT(ISTEPV)*RBDZ ISTEPP = ISTEPP + 1 IF(FLOAT(ISTEPP)*RMOM(3) .GT. RMOM(2)-RMOM(1)) THEN ISTEPP = 0 ISTEPA = ISTEPA + 1 IF(FLOAT(ISTEPA)*RANG(3) .GT. RANG(2)-RANG(1)) THEN ISTEPA = 0 ISTEPV = ISTEPV + 1 ENDIF ENDIF Epstate = 2 MPind = 0 NtPrim = 1 NtTot = 1 NvPrev = 0 CALL GSVERT(VERT,0,0,0,0,NVTX) CALL UZERO(UBUF, 1, NWUBMAX) CALL GSKINE(PLAB,IRPID(1),NVTX,UBUF,NWUBMAX,NT) ELSE IF(IGEN .GE. 11 .AND. IGEN .LE. 12) THEN ******************************************************************* * STEP THE VALUES OF MOMENTUM OR 1/MOMENTUM FIRST, * * THEN OF THE INPUT ANGLE AND FINALLY OF THE VERTEX POSITION * ******************************************************************* IF(IGEN.EQ.11) THEN PS = RMOM(1)+FLOAT(ISTEPP)*RMOM(3) ELSE IF (IGEN .EQ. 12) THEN IF(RMOM(1) .LT. 0.001) RMOM(1) = 0.001 IF(RMOM(2) .LT. 0.001) RMOM(2) = 0.001 DPP = 1.0/RMOM(1) - 1.0/(RMOM(1)+RMOM(3)) PS = 1.0/RMOM(1) - FLOAT(ISTEPP)*DPP PS = 1.0/PS ENDIF PX = PS * SIN((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) * + COS(RPHI(1)/57.2957795) PY = PS * SIN((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) * + SIN(RPHI(1)/57.2957795) PZ = PS * COS((RANG(1)+FLOAT(ISTEPA)*RANG(3))/57.2957795) PLAB(1) = PX PLAB(2) = PY PLAB(3) = PZ VERT(3) = RBZZ + FLOAT(ISTEPV)*RBDZ ISTEPP = ISTEPP + 1 IF(IGEN.EQ.11) THEN PS = RMOM(1)+FLOAT(ISTEPP)*RMOM(3) ELSE IF (IGEN .EQ. 12) THEN PS = 1.0/RMOM(1) - FLOAT(ISTEPP)*DPP IF(PS .LT. 0.00001) PS = 0.00001 PS = 1.0/PS ENDIF IF(PS .GT. RMOM(2)) THEN ISTEPP = 0 ISTEPA = ISTEPA + 1 IF(FLOAT(ISTEPA)*RANG(3) .GT. RANG(2)-RANG(1)) THEN ISTEPA = 0 ISTEPV = ISTEPV + 1 ENDIF ENDIF Epstate = 2 MPind = 0 NtPrim = 1 NtTot = 1 NvPrev = 0 CALL GSVERT(VERT,0,0,0,0,NVTX) CALL UZERO(UBUF, 1, NWUBMAX) CALL GSKINE(PLAB,IRPID(1),NVTX,UBUF,NWUBMAX,NT) ELSE ********************************** * Unrecognized GEN type: ********************************** WRITE(lout,'('' GEN= '',I2,'' NOT IMPLEMENTED'')') IGEN ENDIF ************************************************* * Kinematic debug (controlled by ISWIT(1)) ************************************************* IF(IDEBUG.EQ.1.AND.ISWIT(1).EQ.1) THEN CALL GPRINT('VERT',0) CALL GPRINT('KINE',0) ENDIF RETURN END +DECK,GUOUT. *CMZU: 2.00/06 21/07/96 21.47.28 by Phobos (R. Verdier) *CMZU: 1.01/12 18/07/94 12.51.45 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : SUBROUTINE GUOUT *Documentation_Block ************************************************************************ * * Description: * User routine called at the end of each event. This version saves * specified zebra banks in FZ-format. * * Arguments: none * * Called by: * Geant * * Calls: * GSAVE, USOUT * * Implicit inputs, outputs, side effects: * Uses IUSRZEB in IO.CMN for file lun, assumed opened by UGINIT * Writes FZ-format banks * * Filename: GUOUT.FOR * * History: * Date Name Description * ---- ---- ----------- * 21-Jul-96 R. V. Removed unused FileName * 18-Jul-94 K. Wozniak Increase statistics format width * 1-Nov-93 R. V. Move NtTot update to USSTEP in case STRA = 1 * 8-Jul-93 M. Baker Fix output conversion error for large # of events. * 9-Jun-93 R. V. Update NtTot, reset IEVENT in multi-pass * 23-May-93 R. V. Test on IDEVT for multi-pass event processing * 8-Feb-93 R. Verdier Added geometry bank save, std document block * 17-Jun-92 C. Parsons Creation *C DEC/CMS REPLACEMENT HISTORY, Element GUOUT.FOR *C *1 21-JUL-1992 14:32:06 CHUCK "Initial version declaration" ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ, GCFLAG. +SEQ, GCLIST. +SEQ, GCNUM. +SEQ, IO. +SEQ, FLAG. +SEQ, MUPEP. character*4 FBanks(5), FBsave(5), BankName, Bsave(20) integer banktype, irep, ier, lout, mm, Nbsave, Nfbanks, 1 Nfbsave, nn data irep /1/, ! write stats at end of pass if non-zero 1 lout /6/ ! standard output save Bsave, FBsave, Nbsave, Nfbsave c Identify banks to be saved, if requested by SAVE, only on first event: data Nfbanks /5/, 1 FBanks / 'SETS', 'VOLU', 'ROTM', 'MATE', 'TMED' / IF(ISWIT(3).EQ.1.AND.IDEBUG.EQ.1) CALL GPRINT('HITS',0) C C Call the user output routine C CALL USOUT ************************************************************ * Output banks requested by SAVE card in Zebra FZ format * ************************************************************ c Skip if not switched on or if file open failed if (izeb.ne.0 .and. IusrZeb .gt. 0) then c Store names of banks to be saved on first event only in FBsave, c and those to be saved on every event in Bsave if (ievent .eq. 1) then nfbsave = 0 nbsave = 0 do nn = 1, Nsave call UHTOC (LSAVE(nn), 4, BankName, 4) banktype = 1 do mm = 1, Nfbanks if (BankName .eq. FBanks(mm)) banktype = 2 enddo if (banktype .eq. 2) then Nfbsave = Nfbsave + 1 FBsave(Nfbsave) = BankName else Nbsave = Nbsave + 1 Bsave(Nbsave) = BankName endif enddo c Save first-event banks if (Nfbsave .gt. 0 .and. IDEVT .eq. 1) 1 call GSAVE (IusrZeb, FBsave, -Nfbsave, 0, ier) endif c Save all-event banks if (Nbsave .gt. 0) 1 call GSAVE (IusrZeb, Bsave, Nbsave, ievent, ier) endif c Report event processing statistics if (irep .gt. 0) write (lout,'(a,i7,a,i7,a,i5)') ' GUOUT:', 1 NtPrim, ' primary &', NtTot - NtPrim, 2 ' secondary tracks processed so far in event', Ievent c Reset the event number if not the final pass in this event. This is c done here because it is the last point in the event loop under user c control. if (Epstate .eq. 1 .and. IEVENT .ge. 1) IEVENT = IEVENT - 1 return END +DECK,GUSTEP. *CMZU: 2.00/08 25/07/96 13.10.54 by Phobos (R. Verdier) *CMZU: 2.00/02 04/04/96 16.03.22 by Phobos (R. Verdier) *CMZU: 1.00/00 21/11/93 18.16.34 by R. Verdier * Removed obsolete GCFLAX include *-- Author : C ============================================================ SUBROUTINE GUSTEP C ============================================================ C C Description:- C ============= C The Phobos-specific version of GUSTEP for stepping C particles. C C User routine called at the end of each tracking step C Record hits on the detector planes C C C Arguments:- C =========== C none C C Implicit inputs, outputs, side effects:- C ======================================== C C Author:- C ======== C C. Parsons C C Creation Date: 28-Mar-1992 C =========================== C 25-Jul-96 RV equivalence /GCLIST/ LSAVE(1) for ANSI compliance C 21-Nov-93 RV Remove obsolete GCFLAX include C 30-Jun-92 RV Move secondary handling to USSTEP and C HITS diagnostic printout to PH_HIT IMPLICIT NONE +SEQ, GCSETS. +SEQ, GCLIST. +SEQ, GCTRAK. +SEQ, GCVOLU. +SEQ, IO. +SEQ, GCFLAG. +SEQ, GCKINE. +SEQ, GCKING. +SEQ, FLAG. +SEQ, RHSIL. C Local: INTEGER I integer jxyz character*4 jxyzch / 'JXYZ' / equivalence (jxyz, jxyzch) C c Logicals to find out if JXYZ saved LOGICAL FIRSTC,DOJXYZ C DATA FIRSTC/.TRUE./ SAVE FIRSTC C C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C C C--> Determine if we need to call JXYZ C if(firstc)then DOJXYZ = .FALSE. do 117 i=1,nsave if (lsave(i) .eq. JXYZ) DOJXYZ=.TRUE. 117 continue FIRSTC=.FALSE. endif C If(.not.BATCH)Then C C Draw the step on the graphics display C call gdcxyz ENDIF If(DOJXYZ)Then C C Store the path position everytime we enter a new volume C If((INWVOL.EQ.1) .or. (ISTOP.gt.0))then call gsxyz Endif Endif C C Call USSTEP user extension to handle produced secondaries C CALL USSTEP 5 RETURN END +DECK,GUTREV. *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : C====================== SUBROUTINE GUTREV C====================== C C Description:- C ============= C User routine to control tracking of one event C Called by GRUN. Calls GTREVE. No other user actions needed here. C C Arguments:- C =========== C none C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: D. McLeod C ======= C C Creation Date: 28-Mar-1992 C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST CALL GTREVE END +DECK,PHCOMIS. *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : C ===================================================================== C File: PMC_SRC:PHCOMIS.FOR Subroutine PHCOMIS C C Description: Define PHOBOS specific common blocks and routines C ============ to COMIS, so they can be CALLed in GEPHOB C C C C Arguments: None C ========== C C Conditions returned: None C ==================== C C Implicit inputs, outputs, side effects: C ======================================= C C Called by: UGINIT C Calls: CSEXT CSCOM C C Impicit inputs None C C Implicit outputs Comis function database is updated C C C Author: C. Parsons C ======= C C Creation Date: 29-Jun-1992 C ========================== C C Revisions: C ========== C Date Name Description C ------- ---- ------------------------------------------------- * 1-Nov-93 R.V. BANG.CMN -> BANGC.CMN to avoid MMS confusion C C C Global specifictions: C ===================== implicit none C C External specifications: C ======================== EXTERNAL SETBATCH C C Common blocks to be declared. We don't care about real contents C just need a pointer to first word of block C C+SEQ, FLAG. COMMON /FLAG/ IRHFLG Integer IRHFLG C+SEQ, BANGC. COMMON /RHBNG/ IRHBNG Integer IRHBNG C+SEQ, RHSIL. COMMON /RHSIL/ IRHSIL Integer IRHSIL C+SEQ, RHSYS. COMMON /RHSYS/ IRHSYS Integer IRHSYS C+SEQ, IO. COMMON /IO/ IIO Integer IIO C C Local definitions: C ================== integer dmy C C Executable Statements C ===================== C C STRINGS MUST BE UPPER CASE!!! C C PHobos Specific routines Up to ten per call C C First argument is UPPER case string comma deliminted to listing the names C of the routines. String is ended with a #. Following ten arguments are C the associated routines to call. Only first 8 characters are significant. C Be sure and declare the routines to be external. C CALL CSEXT('SETBATCH#',SETBATCH,dmy & ,dmy,dmy,dmy,dmy,dmy,dmy,dmy,dmy,dmy) C C C Phobos common blocks similar syntax but give first variable in common C block C Call CSCOM('RHFLG,RHBNG,RHSIL,RHSYS,IO#', & IRHFLG,IRHBNG,IRHSIL,IRHSYS,IIO,dmy & ,dmy,dmy,dmy,dmy,dmy) Call USCOMIS END +DECK,PH_GEOM. *CMZU: 2.03/00 24/07/97 11.19.37 by K. Wozniak *CMZU: 2.02/01 23/04/97 12.18.18 by K.Wozniak *CMZU: 2.02/00 17/03/97 13.47.57 by K. Wozniak *-- Author : K.Wozniak 17/03/97 SUBROUTINE PH_GEOM ************************************************************************* * Stores in the AOU file information on the geometry of active * detector elements * * History: * 2-Jul-97 K.W. added consistency tests of pixelization parameters * and number of division * 23-Apr-97 K.W. correction to avoid error when no rotation matrices * are defined in the geometry file * 27-Feb-97 K.W. Creation ************************************************************************* IMPLICIT NONE +SEQ,GCBANK. +SEQ,GCNUM. +SEQ,IO. +SEQ,RHSIL. CHARACTER*4 CNAME INTEGER NR,JR,I, N,J,IV,JD,JDV,JDVV,KV INTEGER ISLVOL,ISLSHP,ISLJ,ISLNPAR INTEGER JDMAX PARAMETER (JDMAX=30) INTEGER JDLINK(JDMAX),JDNIN(JDMAX),JDIN(JDMAX), JDROT(JDMAX) REAL TRXJD(JDMAX), TRYJD(JDMAX), TRZJD(JDMAX) INTEGER NPARMAX PARAMETER (NPARMAX=40) REAL SLPAR(NPARMAX), TRX, TRY, TRZ, STEP WRITE(IUSRAOU, '('' G GEOV '', F10.3)' ) GEOV WRITE(IUSRAOU, '('' * '')' ) C Output rotation matrices IF(JROTM .GT. NROTM) THEN ! avoided illegal index for LQ DO NR = 1, NROTM JR = LQ(JROTM-NR) IF(JR .GT. 0) THEN WRITE(IUSRAOU, '('' G ROTM '', I4, 9F10.6)' ) + NR, (Q(JR+I),I=1,9) WRITE(IUSRAOU, '('' G ROTA '', I4, 6F12.6)' ) + NR, (Q(JR+I+10),I=1,6) ENDIF ENDDO ENDIF WRITE(IUSRAOU, '('' * '')' ) C Loop over the active volumes DO 200 N=1,NSLP ISLVOL = 0 DO IV=1,NVOLUM KV = IQ(JVOLUM+IV) CALL UHTOC(KV, 4, CNAME, 4) IF(CNAME .EQ. DETNAME(N)) THEN ISLVOL = IV GO TO 110 ENDIF ENDDO 110 CONTINUE IF(ISLVOL .EQ. 0) THEN WRITE(*,*) ' *** ERROR IN PH_GEOM - DETECTOR: ', + DETNAME(N), ' NOT DEFINED IN THE GEOMETRY' GO TO 200 ENDIF C find parameters of the volume ISLJ = LQ(JVOLUM-ISLVOL) ISLSHP = Q(ISLJ+2) ISLNPAR = Q(ISLJ+5) IF(ISLNPAR .GT. NPARMAX) THEN WRITE(*,*) ' *** WARNING - PH_GEOM - TOO MANY ', + 'SHAPE PARAMETERS ', ISLNPAR, ' IN VOLUME ', + DETNAME(N), ' TRUNCATED TO ', NPARMAX ISLNPAR = NPARMAX ENDIF DO I=1,ISLNPAR SLPAR(I) = Q(ISLJ+6+I) ENDDO C find the position of the volume in the volumes tree C calculate effective translation and C find the numbers of rotation matrices for this volume JD = 1 ! depth of the volume in the tree JDLINK(1) = LQ(JVOLUM-1) JDNIN(1) = Q(JDLINK(1)+3) JDIN(1) = 1 120 CONTINUE JDV = LQ(JDLINK(JD)-JDIN(JD)) ! link to the lower level volume IV = Q(JDV+2) JDROT(JD) = Q(JDV+4) TRXJD(JD) = Q(JDV+5) TRYJD(JD) = Q(JDV+6) TRZJD(JD) = Q(JDV+7) IF(IV .EQ. ISLVOL) GO TO 150 ! volume found JDVV = LQ(JVOLUM-IV) IF(Q(JDVV+3) .GT. 0) THEN ! there are volumes deeper JD = JD + 1 JDLINK(JD) = JDVV JDNIN(JD) = Q(JDVV+3) JDIN(JD) = 1 GO TO 120 ELSE ! try next volume on the same level or upper 125 CONTINUE IF(JDIN(JD) .LT. JDNIN(JD)) THEN JDIN(JD) = JDIN(JD) + 1 ! next volume on this level GO TO 120 ELSE JD = JD -1 ! go one level upper IF(JD .LT. 0) THEN WRITE(*,*) ' *** ERROR IN PH_GEOM - DETECTOR ', + DETNAME(N), ' NOT POSITIONED IN THE TREE' GO TO 200 ENDIF GO TO 125 ENDIF ENDIF 150 CONTINUE ! detector found in the tree TRX = 0.0 TRY = 0.0 TRZ = 0.0 DO J=1,JD TRX = TRX + TRXJD(J) TRY = TRY + TRYJD(J) TRZ = TRZ + TRZJD(J) ENDDO WRITE(IUSRAOU, '('' G DEVO '', A4, I4, 3I3, 3F11.5)' ) + DETNAME(N), N, ISLSHP, ISLNPAR, JD, TRX, TRY, TRZ WRITE(IUSRAOU, '(1X, I3, 4F11.5)' ) IPADFL(N), + PAD1(N), PAD2(N), PAD3(N), PAD4(N) WRITE(IUSRAOU, '(1X, 10F11.5)' ) (SLPAR(I),I=1,ISLNPAR) WRITE(IUSRAOU, '(1X, 20I5)' ) (JDROT(J),J=1,JD) IF(NDIVX(N) .NE. 0) THEN STEP = 2.0 * SLPAR(1) / FLOAT(NDIVX(N)) IF(ABS(STEP-PAD1(N)) .GT. 0.00001) THEN WRITE(*,*) ' *** ERROR IN PH_GEOM - DETECTOR ', + DETNAME(N), ' X PAD SIZE OR X DIVISION WRONG' WRITE(*,*) ' X PAD = ', PAD1(N), + ' NDIVX = ', NDIVX(N), ' 0.5*XSIZE = ', SLPAR(1) ENDIF ENDIF IF(NDIVY(N) .NE. 0) THEN STEP = 2.0 * SLPAR(2) / FLOAT(NDIVY(N)) IF(ABS(STEP-PAD2(N)) .GT. 0.00001) THEN WRITE(*,*) ' *** ERROR IN PH_GEOM - DETECTOR ', + DETNAME(N), ' Y PAD SIZE OR Y DIVISION WRONG' WRITE(*,*) ' Y PAD = ', PAD2(N), + ' NDIVY = ', NDIVY(N), ' 0.5*YSIZE = ', SLPAR(2) ENDIF ENDIF IF(NDIVZ(N) .NE. 0) THEN STEP = 2.0 * SLPAR(3) / FLOAT(NDIVZ(N)) IF(ABS(STEP-PAD3(N)) .GT. 0.00001) THEN WRITE(*,*) ' *** ERROR IN PH_GEOM - DETECTOR ', + DETNAME(N), ' Z PAD SIZE OR Z DIVISION WRONG' WRITE(*,*) ' Z PAD = ', PAD3(N), + ' NDIVZ = ', NDIVZ(N), ' 0.5*ZSIZE = ', SLPAR(3) ENDIF ENDIF 200 CONTINUE RETURN END +DECK,PH_HIT. *CMZU: 2.02/00 17/03/97 12.09.47 by K. Wozniak *CMZU: 2.00/06 21/07/96 21.48.59 by Phobos (R. Verdier) *CMZU: 1.01/17 16/03/95 14.54.03 by K.Wozniak *CMZU: 1.01/12 18/07/94 11.17.36 by Phobos (R. Verdier) *CMZU: 1.01/06 07/05/94 12.52.37 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : SUBROUTINE PH_HIT *Documentation_Block ************************************************************************ * * * Description: * * User routine called at the end of each tracking step to record * * hits on the detector planes for PMC GEANT. The HITS saved: * * Word 1: X \ in the master coordinate system, unpixelled, * * 2: Y = at the average of the entry and exit positions * * 3: Z / for the silicon plane * * 4: DE Energy deposit in the silicon (GeV/c) * * 5: DX X-component of vector from entry to exit point * * 6: DY Y " " " " " " " " * * 7: DZ Z " " " " " " " " * * 8: EFIN track energy at the exit of the plane * * 9: TOF Time of flight to this detector (in seconds) * * 10: ITRK track number for this hit * * 11: VSEQ Combined information: IVOL + 1000 * ISEQ * * IVOL system volume number of the detector <= 999 * * ISEQ sequential (first = 1) hit number on this track * * * * Arguments: none * * * * Called by: * * USSTEP * * * * Calls: * * GDTOM, GMTOD, GSAHIT, UZERO, UHTOC * * * * Implicit inputs, outputs, side effects: * * Commons included below * * * * Filename: PH_HIT.FOR * * * * History: * * Date Name Description * * ---- ---- ----------- * * 4-Mar-97 K.W. Remove pixelization code and UHITSOUT call * * 21-Jul-96 R. V. Remove unused jku, jk * * 24-Mar-95 K.W. Store time in place of IVOL, IVOL combined * * with ISEQ (stored 1000*ISEQ+IVOL) * * 18-Jul-94 R.V. Get sequential hit number from common /UJKB/ * * 22-Jun-94 R.V. Store hit number (temporarily) in 11th word of * * user buffer, replacing NSEQN storage * * 15-Jun-94 R.V. Store mean hit position and exit-entry vector * * instead of entry position and direction cosines* * 07-May-94 R.V. Reordered SEQ's & doc. block, restored IUSROUT * * 30-Apr-94 DMcL Merged with MIT current version this date * * Note Wozniak printout removed; not in MIT vers.* * 22-Jun-93 DMcL Added array bound check on NSEQN * * 27-May-93 DMcL Changed cosx cosy to 3 system dir. cosines * * 12-May-93 DMcL Major revisions.. new HITS structure * * 5-Feb-93 R.V. Added HitsOut + mode arg to UHITSOUT call * * 27-Oct-92 R.V. Added call to UHITSOUT * * 23-Jul-92 R. Verdier Moved diagnostic print from GUSTEP * * ?-May-92 C. Parsons Separated from GUSTEP * * 28-Mar-92 D. Mcleod Creation as part of GUSTEP in GPH * ************************************************************************ *End_Documentation_Block IMPLICIT NONE c For Ipixl: +SEQ,FLAG. c For JKINE: +SEQ,GCBANK. c For Idebug, Iswit: +SEQ,GCFLAG. c For Charge, Ipart, Itra: +SEQ,GCKINE. +SEQ,GCSETS. +SEQ,GCTRAK. c For system volume number: (part of 4/30/94 update) +SEQ,GCVOLU. c For Iusrout: +SEQ,IO. c For detector plane characteristics (updated RHSIL 4/30/94): +SEQ,RHSIL. c Access to control variables HitsOut and draw_hits: +SEQ,UHITS. c Access to number of hits on active track: +SEQ,UJKBUF. C Local: NOTE: NHitPar should be gotten dynamically from the bank c storage for each detector; the following is a stopgap. integer NHitPar, nn parameter (NHitPar = 11) REAL HITS(NHitPar), HITP(3) INTEGER IHIT, I SAVE HITS C C Code: C IF(CHARGE.EQ.0) GOTO 5 !We don't see these IF(IHSET.EQ.0) GOTO 5 !not a detector ****************************************************** * Record GEANT bank HITS at detector planes only * ****************************************************** IF(ISET.GE.1) THEN IF(INWVOL.EQ.1) THEN c At a silicon plane entrance, save position and initialize the rest c of the hits array. do nn = 1, 3 HITS(nn) = VECT(nn) enddo call UZERO(HITS(4), 1, NHitPar - 3) C Track number kept in HITS for external use: HITS(10) = FLOAT(ITRA) C Store the time (units: seconds) HITS(9) = TOFG ELSE IF((INWVOL.EQ.0.OR.INWVOL.EQ.2).AND.STEP.GT.0.0) THEN c Within the silicon or at exit from it, increment the energy c deposition and store the system volume number from /GCVOLU/ HITS(4) = HITS(4) + DESTEP HITS(11) = FLOAT(LVOLUM(NLEVEL)) ENDIF IF(INWVOL.EQ.2.OR.ISTOP.GT.0) THEN c At exit from the silicon or end of track, store the vector from c entry to exit, the mean hit position, the final kinetic entry, c track number, and hit sequence number, for writing out in PH_OUT. c NOTE THIS FAILS IF A SECONDARY IS PRODUCED IN THE SILICON; THIS c MUST BE DEALT WITH LATER. if (HITS(10) .ne. FLOAT(ITRA)) print *, ' PH_HIT: *****', 1 ' track number ', ITRA, ' changed in silicon.' do nn = 1, 3 HITS(nn+4) = VECT(nn) - HITS(nn) HITS(nn) = HITS(NN) + 0.5 * HITS(nn+4) enddo HITS(8) = GEKIN C Save sequential number of hit on this track: hits(11) = 1000*ISEQ + IVOL HITS(11) = 1000.0*NHitsAct + HITS(11) CALL GSAHIT(ISET,IDET,ITRA,NUMBV,HITS,IHIT) draw_hits = .false. c If IDEBUG = 1 and ISWIT(4) >= 1, write diagnostic hits output IF(IDEBUG.EQ.1.AND.ISWIT(4).GE.1) THEN WRITE(IUSROUT,1000)INWVOL,IHSET,IHDET, 1 IDTYPE,(HITS(I),I=1,NHitPar) 1000 FORMAT(' PH_HIT: INWVOL,IHSET,IHDET,IDTYPE = ', 1 I2,'|',A4,'|',A4,'|',I5,/, 2 ' HITS SAVED = ',5(' | ',G10.4),/, 3 6('| ',G10.4)) ENDIF ENDIF ENDIF 5 RETURN END +DECK,PH_INIT. *CMZU: 2.03/01 04/08/97 16.30.00 by Phobos (R. Verdier) *CMZU: 2.00/06 21/07/96 21.51.08 by Phobos (R. Verdier) *CMZU: 2.00/02 04/04/96 16.17.34 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : SUBROUTINE PH_INIT *Documentation_Block ************************************************************************ * * Description: * Subroutine PH_INIT books histograms and nutples for the Phobos MC. * * Arguments: none * * Called by: * USINIT * * Calls: * DATE, HBOOK1, HBOOK2, HBOOKN, HRFILE, TIME * * Implicit inputs, outputs, side effects: * Allocates Zebra storage banks; uses HBOOK id's 1 and 2 * * Filename: PMC_SRC:PH_INIT.FOR * * History: * Date Name Description * ---- ---- ----------- * 04-Aug-97 R. V. Give translated filename to HROPEN if available (RV) * 21-Jul-96 R. V. Removed unused xmx, nz, xmin * 08-Sep 95 DMcL DATE, TIME => Cernlib DATIMH & associated changes * 23-Jun-95 D. McLeod UFILE replaced by SERVER as part of UNIX port * 1-Nov-93 R.V. BANG.CMN -> BANGC.CMN to avoid MMS confusion * 17-Jun-93 R. V. Move ntuple parameters to common NTUEX * 22-Feb-93 R. V. Correct directory handling via HCDIR * 10-Jan-93 R. V. Separate ntuples for hits and mc * 03-Aug-92 R. Verdier Set IQUEST(10) for larger Ntuple file (PAW p. 32) * Apr-92 C. Parsons Separated from GPH * Mar-92 D. Mcleod Creation as UHINIT in GPH.FOR ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ, IO. +SEQ, GCFLAG. +SEQ, NTU. +SEQ, NTUEX. +SEQ, FLAG. +SEQ, HST. +SEQ, RHSYS. +SEQ, BANGC. c temporary for IQUEST(10) COMMON /QUEST/ IQUEST(100) INTEGER IQUEST C Local definitions: C ================== C CHARACTER*60 TITLE INTEGER NDH(2), NTH(2) CHARACTER*8 TAGX,TAGY C C Added for SERVER long form INTEGER IRUN1,IRUN2 C INTEGER ID,NX,NY,I,IOS,J character*60 FileName c Temporary report level until a more general system exists, if ever: integer Ireplev /2/ c End of declarations CALL DATIMH (NDH, NTH) WRITE(TITLE,1000) (NDH(I),I=1,2),(NTH(I),I=1,2),IDRUN ************************************************************** * SET UP HITS NTUPLE IF ISNTU CONTAINS 1, TRUTH NTUPLE IF IT * CONTAINS 2 ************************************************************** IF (IAND(ISNTU,1) .ne. 0) THEN +SELF,IF=NOSERV. call UFILE (1, 'RHNTU', Iusrntu, FileName) +SELF,IF=-NOSERV. C This call with access mode 3 suppresses SERVER's HROPEN call SERVER('RHNTU',IDRUN,Iusrntu,FileName,0,3,1,IRUN1,IRUN2) +SELF. if (Iusrntu .gt. 0) then call HCDIR ('//PAWC',' ') call HMDIR ('RHTUP','S') NWHits = NVTUP Iquest(10) = (NHtrks * NWHits + NWover) / LreclW call HROPEN (Iusrntu, 'RHTUPF', FileName, 'NQ', LreclW, IOS) c Set directory to the ntuple in memory; HROPEN leaves the disk file c directory set to RHTUPF. call HCDIR ('//PAWC/RHTUP',' ') call HBOOKN (1, TITLE, NWHits, '//RHTUPF', NWprim, Tags) call HCDIR ('//PAWC',' ') if (Ireplev .ge. 2) 1 write (*,'(3a,i5,a,i6,a)') ' Hits ntuple file ', FileName, 2 ' opened,', 3 Iquest(10), ' records for', NHtrks, ' tracks.' else if (Ireplev .ge. 1) 1 write (*,*) ' Hits ntuple file open failed.' endif ENDIF if (iand(ISNTU,2) .ne. 0) then +SELF,IF=NOSERV. call UFILE (1, 'MCNTU', Imcntu, FileName) +SELF,IF=-NOSERV. call SERVER('MCNTU',IDRUN,Imcntu,FileName,0,3,1,IRUN1,IRUN2) +SELF. if (Imcntu .gt. 0) then call HCDIR ('//PAWC',' ') call HMDIR ('MCTUP','S') NWMC = Nvmctup Iquest(10) = (NMCtrks * NWMC + NWover) / LreclW call HROPEN (Imcntu, 'MCTUPF', FileName, 'NQ', LreclW, IOS) call HCDIR ('//PAWC/MCTUP',' ') call HBOOKN (2, Title, NWMC, '//MCTUPF', NWprim, Tags) call HCDIR ('//PAWC',' ') if (Ireplev .ge. 2) 1 write (*,'(3a,i5,a,i6,a)') ' MC ntuple file ', FileName, 2 ' opened,', 3 Iquest(10), ' records for', NMCtrks, ' tracks.' else if (Ireplev .ge. 1) 1 write (*,*) ' PH_INIT failed to open MC Ntuple file, ', 2 'logical "MCNTU"' endif endif ****************************************** * BOOK HISTOGRAMS SET BY CONTROL CARDS * ****************************************** IF(NHSTS.GT.0) THEN DO I = 1,NHSTS TAGX = TAGS(NINT(HCONTROL(2,I))) IF(TAGX.EQ.' ') THEN WRITE(TAGX,1300) HCONTROL(2,I) ENDIF ID = NINT(HCONTROL(1,I)) NX = NINT(HCONTROL(3,I)) IF(NINT(HCONTROL(6,I)).EQ.0) THEN WRITE(TITLE,1100)IDRUN, 1 (NDH(J),J=1,2),(NTH(J),J=1,2),TAGX CALL HBOOK1(ID,TITLE,NX,HCONTROL(4,I), 1 HCONTROL(5,I),0.0) ELSE TAGY = TAGS(NINT(HCONTROL(6,I))) IF(TAGY.EQ.' ') THEN WRITE(TAGY,1300) HCONTROL(6,I) ENDIF NY = NINT(HCONTROL(7,I)) WRITE(TITLE,1200)IDRUN, 1 (NDH(J),J=1,2),(NTH(J),J=1,2),TAGY,TAGX CALL HBOOK2(ID,TITLE,NX,HCONTROL(4,I),HCONTROL(5,I), 1 NY,HCONTROL(8,I),HCONTROL(9,I),0.0) ENDIF ENDDO ENDIF RETURN 1000 FORMAT(' Ntuple, on ',2A4,', ',2A4,', Run ',I3) 1100 FORMAT(' Run ',I3,' on ',2A4,', ',2A4,' Tag= ',A8) 1200 FORMAT(' Run ',I3,' on ',2A4,', ',2A4,', ',A8,' vs. ',A8) 1300 FORMAT('Tag',F5.0) END +DECK,PH_LAST. *CMZU: 2.00/06 21/07/96 21.52.54 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : Subroutine PH_LAST *Documentation_Block ************************************************************************ * * Description: * Output module for Ntuples, called at end of Geant run. * * Arguments: none * * Called by: * USLAST * * Calls: * HCDIR, HISTDO, HREND, HROUT, HRPUT * * Implicit inputs, outputs, side effects: * Input from listed commons * Output to Ntuples * * Filename: PMC_SRC:PH_LAST.FOR * * History: * Date Name Description * ---- ---- ----------- * 21-Jul-96 R. V. Removed unused card, ier, ofname * 22-FEB-93 R. V. Correct directory handling via HCDIR * 10-Jan-93 R. Verdier Make separate Hits and MC Ntuples * Mar-92 D. McLeod Creation as part of GPH ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ, GCKINE. +SEQ, IO. +SEQ, FLAG. C C Local definitions: C ================== C LOCAL: INTEGER ICYCLE *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C C Executable Statements C ===================== C Print HBOOK format histograms, if requested by control card IF(ISHDO.NE.0) THEN write(*,*) ' HBOOK PLOTS OUTPUT TO filename.OUT' CALL HISTDO ENDIF C Save histograms, if requested by control card IF(ISHBO.NE.0) THEN write(*,*) ' PLOTS OUTPUT TO filename.HST' CALL HRPUT(0,'RHHST',' ') ENDIF C Output Ntuples, if requested by control card IF (IAND(ISNTU,1) .NE. 0) THEN write(*,*) ' Track Ntuple output to filename.NTU ' ICYCLE = 0 c Set directory to the ntuple in memory CALL HCDIR ('//PAWC/RHTUP',' ') c Set directory to the ntuple disk file CALL HCDIR ('//RHTUPF',' ') CALL HROUT (1,ICYCLE,' ') CALL HREND ('RHTUPF') CLOSE (IUSRNTU) ENDIF IF (IAND(ISNTU,2) .NE. 0) THEN write(*,*) ' MC Ntuple output to filename.NTU ' ICYCLE = 0 CALL HCDIR ('//PAWC/MCTUP',' ') CALL HCDIR ('//MCTUPF',' ') CALL HROUT (2,ICYCLE,' ') CALL HREND ('MCTUPF') CLOSE (IMCNTU) ENDIF return end +DECK,PH_OUT. *CMZU: 2.02/01 29/04/97 13.14.44 by Phobos (K. Wozniak) *CMZU: 2.02/00 17/03/97 12.22.43 by K. Wozniak *CMZU: 2.01/00 25/02/97 08.53.36 by K.Wozniak *CMZU: 2.00/14 21/11/96 15.10.40 by K.Wozniak *CMZU: 2.00/13 14/11/96 10.32.25 by K.Wozniak *CMZU: 2.00/10 24/09/96 04.52.06 by K.Wozniak *CMZU: 2.00/08 25/07/96 14.15.00 by Phobos (R. Verdier) *CMZU: 2.00/06 21/07/96 21.54.54 by Phobos (R. Verdier) *CMZU: 2.00/03 04/07/96 19.29.37 by K.Wozniak *CMZU: 1.01/10 14/06/94 10.53.01 by Phobos (R. Verdier) *CMZU: 1.01/06 13/05/94 12.56.20 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : Subroutine PH_OUT *Documentation_Block ************************************************************************ * * Description: * User routine called at the end of each event. * This version makes histos and prints ntuples. * * Arguments: * none * * Called by: * USOUT * * Calls: * GFHITS, GFKINE, HFN, HFILL, PRNTUP, USANAL, VZERO, STOPER * * Implicit inputs, outputs, side effects: * Fills histograms * * Filename: PMC_SRC:PH_OUT.FOR * * History: * Date Name Description * ---- ---- ----------- * 29-Apr-97 K.W. Expand write fieldwidths, add IOSTAT * 4-Mar-97 K.W. Removed a call to UHITSOUT * Changed AOU file format: * integer detector number in place of name is used * Forced STOP changed into a call to STOPER * 25-Feb-97 K.W. Add End of Header (EOH) line in AOU file * 20-Nov-96 K.W. Corrected origin volume name for secondaries in * SECT=1 mode * 14-Nov-96 K.W. Corrected format in the AOU output * 23-Sep-96 K.W. Added signal link (set to zero) to make * the format of AOU file identical with digitized data * 25-Jul-96 R. V. Define integers for testing /GCLIST/ LSETS * for ANSI compliance * 21-Jul-96 R. V. Removed unused de, nh, tlife * 1-Jul-96 K.W. The particles and their hits are stored in an * ASCII output file * 13-Jun-94 R. V. Allow dynamic specification of detector sets, * controlled by SETS in the control file * 13-May-94 R. V. Use all 11 (new) HITS parameters. * 09-Aug-93 M. Baker Add Geant PID code to ACCCHK call. * 29-Jun-93 M. Baker BUGFIX: Set AMASS for use in TK. * 29-Jun-93 M. Baker Add acceptance check, modify Ntuples. * 28-Jun-93 M. Baker Protect against P=0, Pt=0, NHITSL>NHTM. * 7-Jun-93 R. V. Move IEVENT and Epstate reset to GUOUT * 14-May-93 R. V. Multipass mods: add NtPrev to stored track # * 22-Feb-93 R. V. Correct directory handling via HCDIR * 5-Feb-93 R. V. Add optional call to UHITSOUT for hits text file * 12-Jan-93 R. V. Change to separate Hits and Truth ntuples; * COMMON.NTU & COMMON.HST -> NTU.CMN & HST.CMN * 17-Nov-92 R. V. Separated PH_OUT * 21-Jul-92 R. V. Interchange Pvert(1) & Pvert(1) in Tphi calc. * 1-Jul-92 R. Verdier Store additional information in ntuple * 17-Jun-92 C. Parsons Separated from package including other subrs. * Apr-92 D. Mcleod Creation in GPH package as GUOUT ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ,BANGC. +SEQ,FLAG. +SEQ,GCBANK. +SEQ,GCFLAG. +SEQ,GCLIST. +SEQ,GCNUM. +SEQ,GCVOLU. +SELF,IF=-NONTUP. +SEQ,HST. +SEQ,NTU. +SELF. +SEQ,MUPEP. +SEQ,IO. +SEQ,RHSIL. +SEQ,UHITS. +SEQ,UJKBUF. C Local definitions: C ================== INTEGER LWRTRMAX PARAMETER (LWRTRMAX=30000) LOGICAL LWRTR(LWRTRMAX) integer NHHTMAX parameter (NHHTMAX=200) INTEGER NHHT, IPLHT(NHHTMAX) CHARACTER*4 PLHT(NHHTMAX) EQUIVALENCE (IPLHT(NHHTMAX),PLHT(NHHTMAX)) REAL XHT(NHHTMAX), YHT(NHHTMAX), ZHT(NHHTMAX) REAL DEHT(NHHTMAX), DTHT(NHHTMAX) REAL DXHT(NHHTMAX), DYHT(NHHTMAX), DZHT(NHHTMAX) REAL HITS(11,NHHTMAX) INTEGER NUMBV(NHHTMAX), ITRA(NHHTMAX) LOGICAL PLNHIT(NSLPM) INTEGER IPART,ITRK,IPARENT,NNTRACK,IVOL,NVERT,NUB,I,ID,IX,IY integer Idet, IIudet, IIuset, ios, Iplane, Iset, Isret, J, Jdh, 1 Jdp, NHITS, Nhitp, Nsetsa, LSTPLN, isign, ISLPL c Ndetsa = number of active detectors in each set, determined from c UGCDATA and from LSETS in /GCLIST/, set by the SETS card. Its c dimension should be >= that of LSETS. integer Ndetsa(20) character*4 Iudet, Iuset equivalence (Iudet,IIudet), (Iuset,IIuset) c Equivalences for testing CERN integer-type character strings character*4 chall /'ALL'/, challlc /'all'/, chblank /' '/, 1 chstar /'*'/ integer all, alllc, blank, star equivalence (all,chall), (alllc,challlc), (blank,chblank), 1 (star,chstar) REAL RDUM, RDAR(20) REAL VERT(3),PVERT(4),AMASS,ACHG REAL UB(NWUBMAX) INTEGER IUB(NWUBMAX) EQUIVALENCE (UB,IUB) CHARACTER*20 ADUM20 INTEGER dummy, IDUM, NDUM c Storage for additional information in ntuples, temporarily c overstoring ntuple information REAL UJKBN(NWUBMAX) EQUIVALENCE (UJKBN(1), STOP) LOGICAL FIRST SAVE FIRST DATA FIRST / .TRUE. / REAL ACCCHK EXTERNAL ACCCHK C Executable Statements C ===================== *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ IF(FIRST .AND. ISAOU .GT. 0) THEN WRITE(IUSRAOU, '('' EOH '')' ) FIRST = .FALSE. ENDIF **************************************************** * Loop over all the tracks including secondaries * **************************************************** DO 100 ITRK = 1,NTRACK C Get the "truth" CALL GFKINE(ITRK,VERT,PVERT,IPART,NVERT,UBUF,NUB) C Omit nonexistent tracks IF(IPART.EQ.0) GOTO 100 +SELF,IF=-NONTUP. C Fill some of /RHTUP/: CALL VZERO(TUP,NVTUP) RUN = IDRUN EVENT = IEVENT BIMP = 0.0 ! Not Yet Implemented XPROD = VERT(1) YPROD = VERT(2) ZPROD = VERT(3) IDPART = IPART C Get the charge and mass of the particle. CALL GFPART( IPART, ADUM20, IDUM, AMASS, ACHG, RDUM, > RDAR, NDUM) CHRG = ACHG c Store the track number for the whole event, not just this pass TRACK = ITRK + NtPrev GEN = IGEN ANAL = IANAL SCAT = ISCAT TP = SQRT(PVERT(1)**2+PVERT(2)**2+PVERT(3)**2) TK = PVERT(4) -AMASS C MDB: Protect against P=0 or Pt=0. IF (ABS(PVERT(1)).GE.0.0001 .OR. ABS(PVERT(2)).GE.0.0001) THEN TPHI = ATAN2(PVERT(2),PVERT(1)) ELSE TPHI = 0.0 ENDIF IF (TP.GT.0.0001) THEN TTHETA = ACOS(PVERT(3)/TP) ELSE TTHETA = 0.0 ENDIF C Initialize hit counters: Nhitsl is the total hit count, Iplane is c the cumulative index for all detectors regardless of set NHITSL = 0 LSTPLN = 0 Iplane = 0 +SELF. C Total number of hits on the track NHHT = 0 ! for GUVERSION **************************************************************** * Get quantities from HITS. Cycle over Si plane numbers: * **************************************************************** c Get the number of active detector sets, Nsetsa, from GCBANK. c Utilities to do this ought to be available. Nsetsa = IQ(JSET - 1) do Iset = 1, Nsetsa c Get the ASCII set name, Iuset, and the number Ndets of detectors in it c IIuset is the integer alias of the character string. IIuset = IQ(JSET + Iset) Jdp = LQ(JSET - Iset) c On first track only, set the number of detectors used in each set to c be the number specified in the geometry data file, as modified by c LSETS, loaded from the SETS line in the control file: c if SETS(1) is blank, *, ALL or all, then all sets specified will be c active; otherwise, only detector sets listed on the SETS line will be c active. Thus, SETS none would turn off all detectors, unless there c were actually a set called 'none'. If there is no SETS line, all c specified sets are active. if (TRACK .eq. 1) then Ndetsa(Iset) = IQ(Jdp - 1) if (LSETS(1) .ne. blank .and. LSETS(1) .ne. star .and. 1 LSETS(1) .ne. all .and. LSETS(1) .ne. alllc) then call GLOOK(Iuset, LSETS, Nsets, Isret) if (Isret .le. 0) Ndetsa(Iset) = 0 endif endif do Idet = 1, Ndetsa(Iset) +SELF,IF=-NONTUP. Iplane = Iplane + 1 PLNHIT(Iplane) = .FALSE. +SELF. c Get the ASCII detector name and number of hit parameters IIudet = IQ(Jdp + Idet) Jdh = LQ(Jdp - Idet) Nhitp = IQ(Jdh + 4) c Get and store the hits on this detector. c NOTE: Multiple hits on one plane from one track are ignored here. call GFHITS (Iuset, Iudet, 1, Nhitp, NHHTMAX-1, ITRK, 0, 1 ITRA, NUMBV, HITS, NHITS) IF (NHITS .gt. 0) THEN +SELF,IF=-NONTUP. LSTPLN = Iplane PLNHIT(Iplane) = .TRUE. +SELF. DO J=1,NHITS IF(NHHT .LT. NHHTMAX) THEN NHHT = NHHT + 1 IPLHT(NHHT) = IIUDET XHT(NHHT) = HITS(1,J) YHT(NHHT) = HITS(2,J) ZHT(NHHT) = HITS(3,J) DEHT(NHHT) = HITS(4,J) DTHT(NHHT) = HITS(9,J) DXHT(NHHT) = HITS(5,J) DYHT(NHHT) = HITS(6,J) DZHT(NHHT) = HITS(7,J) ENDIF ENDDO +SELF,IF=-NONTUP. IF (NHITSL .lt. NHTM) THEN NHITSL = NHITSL + 1 C Fill the entries for the hit in the Ntuple, starting with cumulative c plane index, provided the hit storage is not exceeded. c Q: WOULDN'T IUDET BE A BETTER VARIABLE FOR NTUPLE PLANE TAGGING? TRK(1,NHITSL) = Iplane DO J = 1, MIN(Nsip, NsipMaxp) TRK(J+1,NHITSL) = HITS(J,1) ENDDO ENDIF +SELF. ENDIF ! NHITS .GT. 0 enddo ! Idet enddo ! Iset +SELF,IF=-NONTUP. ************************************************************* * Decide whether a particle has been accepted * * Note that this acceptance check doesn't check * * detector type * ************************************************************* IF (NHITSL.EQ.0) THEN ACCEPT = 0.0 ELSE ACCEPT = ACCCHK( TP, IPART, PLNHIT, DETNAME, NHITSL, LSTPLN) ENDIF ***************************************************************** * Any other quantities added to spares in Ntuples: * ***************************************************************** +SELF. CALL USANAL C Check if there are ancestors of the track with hit(s) C that should be written to ASCII file IPARENT = UBUF(2) IF(ISAOU .EQ. 3 .AND. ISECT .GE. 2) THEN IF(ITRK .GT. LWRTRMAX) THEN WRITE(*,*) ' PH_OUT: TOO LARGE NUMBER OF TRACKS' WRITE(*,*) ' PH_OUT: DECREASE THE NTCO PARAMETER' WRITE(*,*) ' PH_OUT: OR CHANGE THE SIZE OF TABLE LWRTR' CALL STOPER('PH_OUT', 'TOO SMALL INTERNAL TABLES', 1) ENDIF IF(IPARENT .EQ. 0) THEN LWRTR(ITRK) = .TRUE. ! primary track will be written ELSE LWRTR(ITRK) = .FALSE. ENDIF IF(NHHT .GT. 0) THEN LWRTR(ITRK) = .TRUE. 51 CONTINUE IF(IPARENT .LE. 0) GO TO 55 IF(LWRTR(IPARENT-NTPREV)) GO TO 55 LWRTR(IPARENT-NTPREV) = .TRUE. CALL GFKINE(IPARENT-NTPREV, VERT, PVERT, IPART, + NVERT, UB, NUB) NNTRACK = IPARENT IPARENT = UB(2) IVOL = IUB(3) J = 0 WRITE(IUSRAOU, + '('' P '', A4, I8, I9, I4, I3, 3F10.4,3F10.3)', + IOSTAT = ios) + IVOL, NNTRACK, IPARENT, J, IPART, + PVERT(1),PVERT(2),PVERT(3), VERT GO TO 51 55 CONTINUE CALL GFKINE(ITRK,VERT,PVERT,IPART,NVERT,UBUF,NUB) ENDIF ! NHHT .GT. 0 ENDIF ! ISAOU .EQ. 3 ... C IPARENT = UBUF(2) IF(ISAOU .GE. 4 .OR. + (ISAOU .GE. 2 .AND. IPARENT .EQ. 0) .OR. + (ISAOU .GE. 1 .AND. NHHT .GT. 0) ) THEN IVOL = IUBUF(3) C find correct name of the origin volume for secondary particles C with hits (SECT=1 mode) as there is no such informatinon in KINE bank IF(ISECT .EQ. 1 .AND. IPARENT .NE. 0) THEN CALL GTMEDI(VERT, J) IVOL = NAMES(NLEVEL) ENDIF NNTRACK = ITRK + NTPREV IF(IPARENT .EQ. 0) THEN WRITE(IUSRAOU, + '('' P ORIG'', 2I7, I4,I3, 3F10.4,3F10.3)', + IOSTAT = ios) + NNTRACK, IPARENT, NHHT, IPART, + PVERT(1),PVERT(2),PVERT(3), VERT ELSE WRITE(IUSRAOU, + '('' P '', A4,2I7, I4,I3, 3F10.4,3F10.3)', + IOSTAT = ios) + IVOL, NNTRACK, IPARENT, NHHT, IPART, + PVERT(1),PVERT(2),PVERT(3), VERT ENDIF IF(NHHT .GT. 0) THEN ISIGN = 0 DO J=1,NHHT DO I=1,NSLP ISLPL = I IF(PLHT(J) .EQ. DETNAME(I)) GO TO 80 ENDDO WRITE(*,*) ' *** ERROR IN PH_OUT: ', + ' NO PADS DATA FOR DETECTOR ', + PLHT(J) 80 CONTINUE C WRITE(IUSRAOU, C + '(1X, A4, 3F11.4, F10.6, E15.7, 3F9.4, I2)' ) C + IPLHT(J), XHT(J),YHT(J),ZHT(J), DEHT(J), DTHT(J), C + DXHT(J),DYHT(J),DZHT(J), ISIGN WRITE(IUSRAOU, + '(1X, I4, 3F11.4, F10.6, E15.7, 3F9.4, I2, 1X,A4)', + IOSTAT = ios) + ISLPL, XHT(J),YHT(J),ZHT(J), DEHT(J), DTHT(J), + DXHT(J),DYHT(J),DZHT(J), ISIGN, PLHT(J) ENDDO ENDIF ! NHHT .GT. 0 ENDIF +SELF,IF=-NONTUP. c Temporarily store user words from JKINE structure in c Ntuple analysis words IF (NUB .GT. 0 .AND. NUB .LE. NWUBMAX) THEN DO I = 1, NUB UJKBN(I) = UBUF(I) ENDDO ENDIF ******************************************************************* * The Ntuple image is now filled. Output track ntuple if ISNTU * contains 1 and either the track produced some hits or ISNTU also * contains 4; output MC Ntuple (the first part of the track ntuple) * if ISNTU contains 2 ******************************************************************* if (IAND(ISNTU,1) .ne. 0 .and. 1 (NHITSL .gt. 0 .or. IAND(ISNTU,4) .ne. 0)) then c Set directory to the ntuple disk file call HCDIR ('//RHTUPF', ' ') c Set directory to the ntuple in memory call HCDIR ('//PAWC/RHTUP', ' ') call HFN (1,TUP) call HCDIR ('//PAWC', ' ') if (ISWIT(2).EQ.1 .AND. IDEBUG.EQ.1) then * print the track ntuple call PRNTUP (IUSROUT, TAGS, TUP, NVTUP, 1 ' Track Ntuple at end of PH_OUT') endif endif if (IAND(ISNTU,2) .ne. 0) then call HCDIR ('//MCTUPF', ' ') call HCDIR ('//PAWC/MCTUP', ' ') call HFN (2,TUP) call HCDIR ('//PAWC', ' ') if (ISWIT(2).EQ.1 .and. IDEBUG.EQ.1) then * print the MC ntuple call PRNTUP (IUSROUT, TAGS, TUP, NVMCTUP, 1 ' MC Ntuple at end of PH_OUT') endif endif ************************************************************ * Fill any in-line plots requested by HIST data cards: * ************************************************************ IF(NHSTS.NE.0) THEN DO I = 1,NHSTS ID = NINT(HCONTROL(1,I)) IX = NINT(HCONTROL(2,I)) IY = NINT(HCONTROL(6,I)) IF(IY.EQ.0) THEN CALL HFILL(ID,TUP(IX),1.0,1.0) ELSE CALL HFILL(ID,TUP(IX),TUP(IY),1.0) ENDIF ENDDO ENDIF +SELF. 100 CONTINUE ******************************************************* * Write end-of-event information in Hits text file: * ******************************************************* if(ISAOU .GT. 0 .AND. epstate .ge. 2) then WRITE(IUSRAOU, '('' EOE ! END OF EVENT'')' ) endif RETURN END +DECK,PRNTUP. *CMZU: 2.00/02 05/04/96 11.45.35 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : SUBROUTINE PRNTUP(LU,TAGS,INVAL,N,HEAD) *Documentation_Block ************************************************************************ * * Description: * Print out an Ntuple (or similar) and its tags in 4 columns * * Arguments: * *LU Logical unit for output (input) * *TAGS Ntuple tag fieldnames (input) * *INVAL Values from the ntuple (input) * *N # of columns in the ntuple (input) * *HEAD Output header line (input) * * Called by: * PH_OUT * * Calls: * none * * Implicit inputs, outputs, side effects: * none * * History: * Date Name Description * ---- ---- ----------- * 05-Apr-96 D. Mcleod Remove extra parentheses in write(lu,201 * 19-Nov-92 R. Verdier Separated from package * Apr-92 D. Mcleod Creation in GPH package ************************************************************************ *End_Documentation_Block IMPLICIT NONE INTEGER N, LU, I, J, K, KK CHARACTER*8 TAGS(N) CHARACTER*(*) HEAD REAL INVAL(N) C User specified header line; then output in columns WRITE(LU,100) HEAD K = (N + 3)/4 KK = 3*K WRITE(LU,101) ((J-1)*K,J=1,4) DO I = 1,K IF((KK+I).GT.N) THEN WRITE(LU,201)I,(TAGS(J),INVAL(J),J=I,KK+I-K,K) ELSE WRITE(LU,200)I,(TAGS(J),INVAL(J),J=I,KK+I,K) ENDIF ENDDO RETURN 100 FORMAT(1X,A) 101 FORMAT(' # ',4('|TAGS',2X,I3,2X,'VALUE',2X)) 200 FORMAT(1X,I2,1X,4('|',A8,G10.3)) 201 FORMAT(1X,I2,1X,3('|',A8,G10.3)) END +DECK,psking. *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : C ===================================================================== C File: pmc_src:psking.for subroutine psking(NVERT) C C Description: Replacement for GEANT GSKING that adds user buffers C ============ to the KINE and VERT structures. C C C Arguments: C ========== C INTEGER NVERT !Vertex to associate with track. Booked in GUSTEP C C Conditions returned: C ==================== C C Implicit inputs, outputs, side effects: C ======================================= C C Called by:GUSTEP C Calls: GSVERT, GSKING,GSSTAK C C Impicit inputs Common block GCKINE (current track) GCKING (new tracks) C Stacking is controled by IFLGK in GCKING C IFLGK(NTRACK)>=0 store track. <0 flushes it. C C C Implicit outputs: Adds to JSTAK KINE and VERT banks C C C Author: C. Parsons , R Verdier. C ======= C C Creation Date: 3-July-1992 C ========================== C C Revisions: C ========== C Date Name Description C ------- ---- ------------------------------------------------- * 14-May-93 R. V. Multipass mods: NtTot, MUPEP.CMN C C Global specifictions: C ===================== implicit none INTEGER NVERT !Vertex to associate with track. Booked in GUSTEP C C External specifications: C ======================== +SEQ, GCKING. +SEQ, GCKINE. +SEQ, GCTRAK. +SEQ, GCVOLU. +SEQ, MUPEP. +SEQ, UJKBUF. C C Local definitions: C ================== C. REAL PSTO(3), VSTO(3),TOFSTO !Temporary storage of PVERT, VERT,TOFG Integer I,N !Loop indices & ,IPASTO !Temporary storage of IPART & ,ITRSTO !Temporary storage of ITRA & ,NT !KINE bank inice of new track C C Executable Statements C ===================== C. C. ****************************************************************** C. * * C. * USED TO BE THIS BUT ITS DIFFERENT NOW!!!!! * C. * * C. * * C. * SUBR. GSKING (IGK) * C. * * C. * Stores in stack JSTAK either the IGKth track of /GCKING/, * C. * or the NGKINE tracks when IGK is 0. * C. * * C. * Called by : 'User' * C. * Authors : R.Brun, F.Bruyant * C. * * C. ****************************************************************** C. C C. C. ------------------------------------------------------------------ * IF (NGKINE.LE.0) GO TO 999 * * *** Save original information from /GCKINE/ and /GCTRAK/ * IPASTO = IPART TOFSTO = TOFG ITRSTO = ITRA DO 19 I = 1,3 VSTO(I) = VERT(I) PSTO(I) = PVERT(I) 19 CONTINUE * * *** Store required tracks in stack JSTAK * DO 90 N = 1,NGKINE IF (IFLGK(N).LT.0) GO TO 90 TOFG = TOFSTO +TOFD(N) IPART = GKIN(5,N) DO 80 I = 1,3 VERT(I) = VECT(I) PVERT(I) = GKIN(I,N) 80 CONTINUE c Store all the secondary tracks in JKINE, adding space for user c words to contain stop flag, parent id, and final kimematics. c At this point we could decide to drop low energy tracks and c neutrinos to save time. c Clear user buffer call UZERO(UBuf, 1, Nwubmax) UBuf(2) = ITRSTO + NtTot IUBuf(3) = Names(NLevel) call GSKINE (PVERT,IPART, NVERT, UBuf,Nwubmax, Nt) c Force GSSTAK to use the correct track number; argument 2 makes c GSSTAK use the existing JKINE entry. ITRA = Nt CALL GSSTAK (2) 90 CONTINUE * * *** Restore original information in /GCKINE/ and /GCTRAK/ * IPART = IPASTO ITRA = ITRSTO TOFG = TOFSTO DO 99 I = 1,3 VERT(I) = VSTO(I) PVERT(I) = PSTO(I) 99 CONTINUE * END GSKING 999 END +DECK,SETBATCH. *CMZU: 1.00/00 21/11/93 18.19.23 by R. Verdier * Changed GCFLAX to GCFLAG (now contains old GCFLAX) *-- Author : C ===================================================================== C File PMC_SRC:SETBATCH.FOR SUBROUTINE SETBATCH(IFLAG) C C Description: Set the BATCH flag in GCFLAX C ============ C C C Arguments: C ========== C Integer IFLAG ! Set BATCH to .true. if 1 .false. otherwise C C Conditions returned: C ==================== C C Implicit inputs, outputs, side effects: C ======================================= C C Called by: User via comis C Calls: C C Author: C. Parsons C ======= C C Creation Date: 29-June-1992 C ========================== C C Revisions: C ========== C Date Name Description C ------- ---- ------------------------------------------------- C 21-Nov-93 R. V. Changed GCFLAX to GCFLAG (now contains old GCFLAX) C C Global specifictions: C ===================== implicit none C C External specifications: C ======================== +SEQ, GCFLAG. C C Local definitions: C ================== Integer IFLAG ! Set BATCH to .true. if 1 .false. otherwise C C Executable Statements C ===================== If(IFLAG.eq.1)then BATCH=.TRUE. Else BATCH=.FALSE. Endif End +DECK,STEND. *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : INTEGER FUNCTION STEND (STRING) *********************************************************************** * * * INTEGER FUNCTION STEND (STRING) * * * * Created: 29-FEB-1988 John James Ryan * * * * This routine determines the 'Non-Blank' End of a Character * * String. * * In case of all blanks, STEND=1 upon return. For an empty * * string (zero length), STEND=0 upon return. * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE CHARACTER*(*) STRING INTEGER INDEX *********************************************************************** STEND = LEN (STRING) IF (STEND .EQ. 0) RETURN C DO 100 INDEX = STEND, 1, -1 IF (STRING (INDEX : INDEX) .NE. ' ') THEN STEND = INDEX GOTO 200 ENDIF 100 CONTINUE STEND = 1 C 200 RETURN C END +DECK,STLEN. *CMZU: 2.00/06 21/07/96 21.55.58 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : INTEGER FUNCTION STLEN (STRING) *********************************************************************** * * * INTEGER FUNCTION STLEN (STRING) * * * * Created: 29-FEB-1988 John James Ryan * * * * This routine determines the 'Non-Blank' Length of a Character * * String. * * In case of all blanks, STLEN=1 upon return. For an empty * * string (zero length), STLEN=0 upon return. * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 21-Jul-96 R. V. Removed unused variable index C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE CHARACTER*(*) STRING INTEGER STSTR, STEND EXTERNAL STSTR, STEND C STLEN = STEND (STRING) - STSTR (STRING) + 1 C 200 RETURN C END +DECK,STOPER. *CMZU: 2.01/01 12/03/97 22.11.15 by Phobos (R. Verdier) *-- Author : *Deck STOPER ! SHELL routines SUBROUTINE STOPER (FROM, MESS, IERR) *Documentation_Block *********************************************************************** * * * This routine performs a standard program stop. It should always * * be used to stop the program. * * * *Start_verbatim * * * * Inputs: * * FROM = (character*(*)) string containing name of * * calling routine * * MESS = (character*(*)) string containing user supplied * * error message * * IERR = user supplied error number * * Outputs: * * An error message that is written onto the unit 'IOLOG'. The * * routine also issues a program stop. * * * * Modified: 30-Nov-96: Message simplified and protected against * * format errors in STOPER itself (R.V.) * * Created: 6-JUN-1992 John James Ryan * * * *End_verbatim * *********************************************************************** *End_Documentation_Block IMPLICIT NONE *************************** * Input Variables * *************************** CHARACTER*(*) FROM, MESS INTEGER IERR *************************** * Local Variables * *************************** INTEGER IYSTOP INTEGER NLVLS PARAMETER (NLVLS= 40) INTEGER IOLOG PARAMETER (IOLOG= 6) ************************ * Send the messages * ************************ write (iolog,'(3a,i11,a/1x,a)') ' STOPER: run stopped by ', from, 1 ' for error # ', ierr, ':', mess ***************************** * Print a Traceback * ***************************** WRITE (IOLOG, '('' Trace-Back Follows ....'')') CALL TRACEQ (IOLOG, NLVLS) **************************** * Stop the program * **************************** c*? IYSTOP = -9 CALL ZEND END +DECK,STPARS. *CMZ : 1.00/00 17/12/93 07.30.07 by Phobos *-- Author : SUBROUTINE STPARS (LINE,NFIELD,NFOUND,FIELDS,LENFDS) *********************************************************************** * * * STPARS (LINE, NFIELD, NFOUND, FIELDS, LENFDS) * * * * Created: JUN-1988 Harry Melanson * * * * This subroutine is used to "Parse" a line of text, extracting * * "Fields" (words separated by arbitrary numbers of spaces), * * which is returned in an array. The number of found fields * * is also returned to the user; if no fields are found, a value * * of zero is returned. The length of each field is also * * returned. * * * * Inputs: * * LINE The Character String to be Parsed * * * * NFIELD The Number of Fields for which to * * search (STPARS returns after finding * * this number of fields). * * * * Outputs: * * NFOUND The Number of found fields * * * * FIELDS Array containing the found fields. * * The dimension of this variable * * should be greater than or equal to * * the number of fields requested in * * the parsing. * * * * LENFDS Array containing the lengths of the * * found fields. * * The dimension of this variable * * should be greater than or equal to * * the number of fields requested in * * the parsing. * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE CHARACTER*(*) LINE,FIELDS(*) INTEGER NFIELD,LENFDS(*),NFOUND INTEGER ICHAR,IFIELD,IPOS,LENLIN,LENFLD,START ****************************** * INITIALIZE FIELDS * ****************************** NFOUND=0 LENFLD = LEN (FIELDS(1)) DO 10 IFIELD=1,NFIELD FIELDS (IFIELD) = ' ' 10 CONTINUE ********************************************* * GET TO THE FIRST NON-BLANK CHARACTER * ********************************************* LENLIN=LEN(LINE) DO 100 IPOS=1,LENLIN IF (LINE(IPOS:IPOS).NE.' ') THEN START=IPOS GOTO110 ENDIF 100 CONTINUE RETURN ******************************************** * PARSE THE LINE, PULLING OUT THE FIELDS * ******************************************** 110 CONTINUE ICHAR=0 IFIELD=1 DO 120 IPOS=START,LENLIN IF (LINE(IPOS:IPOS).NE.' ') THEN ICHAR=ICHAR+1 IF (ICHAR.LE.LENFLD) THEN FIELDS(IFIELD)(ICHAR:ICHAR)=LINE(IPOS:IPOS) ENDIF ELSE IF (ICHAR.NE.0) THEN IF (ICHAR.LE.LENFLD) THEN LENFDS(IFIELD)=ICHAR ELSE LENFDS(IFIELD)=LENFLD ENDIF ICHAR=0 IFIELD=IFIELD+1 NFOUND=NFOUND+1 IF (IFIELD.GT.NFIELD) RETURN ENDIF ENDIF 120 CONTINUE RETURN END +DECK,STSTR. *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : INTEGER FUNCTION STSTR (STRING) *********************************************************************** * * * INTEGER FUNCTION STSTR (STRING) * * * * Created: 29-FEB-1988 John James Ryan * * * * This routine determines the 'Non-Blank' Start of a Character * * String. * * A Blank String returns a value of "1" * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE CHARACTER*(*) STRING INTEGER INDEX C STSTR = 1 C DO 100 INDEX = 1, LEN (STRING) IF (STRING (INDEX : INDEX) .NE. ' ') THEN STSTR = INDEX GOTO 200 ENDIF 100 CONTINUE C 200 RETURN C END +DECK,STTOIN. *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : INTEGER FUNCTION STTOIN (STRING) *********************************************************************** * * * INTEGER FUNCTION STTOIN (STRING) * * * * Created: 21-MAY-1988 Harry Melanson * * * * THIS ROUTINE CONVERTS A STRING INTO AN INTEGER. IT ASSUMES THE * * STRING ONLY HAS ONE FIELD OF NUMBERS. IT IGNORES ANY SPACES. * * * * Inputs: * * STRING = (CHARACTER) THE STRING * * Outputs: * * STTOIN = THE INTEGER * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE INTEGER STLEN,STSTR,STEND EXTERNAL STLEN,STSTR,STEND CHARACTER*(*) STRING CHARACTER FORM*15 ************************************************************* * CONVERT THE STRING TO AN INTEGER, IGNORING SPACES * ************************************************************* WRITE (FORM,'(''(I'',I11.11,'')'')') STLEN(STRING) READ (STRING(STSTR(STRING):STEND(STRING)),FORM) STTOIN RETURN END +DECK,STTORL. *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : REAL FUNCTION STTORL (STRING) *********************************************************************** * * * INTEGER FUNCTION STTORL (STRING) * * * * Created: 21-MAY-1988 Harry Melanson * * * * THIS ROUTINE CONVERTS A STRING INTO A REAL. IT ASSUMES THE * * STRING ONLY HAS ONE FIELD OF NUMBERS. IT IGNORES ANY SPACES. * * * * Inputs: * * STRING = (CHARACTER) THE STRING * * Outputs: * * STTOIN = THE REAL NUMBER * * * *********************************************************************** C Description: above C ============= C Routine stolen from E665 SHELL to handle input cards better than FFREAD C C Arguments: C =========== C STRING C C Implicit inputs, outputs, side effects:- C ======================================== C none C C Author: above C ======= C C Creation Date: above C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 23 Oct 92 R. V. Separated from GE_... C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST IMPLICIT NONE INTEGER STLEN,STSTR,STEND EXTERNAL STLEN,STSTR,STEND CHARACTER*(*) STRING CHARACTER FORM*20 ************************************************************* * CONVERT THE STRING TO A REAL, IGNORING SPACES * ************************************************************* WRITE (FORM,'(''(E'',I10.10,''.0)'')') STLEN(STRING) READ (STRING(STSTR(STRING):STEND(STRING)),FORM) STTORL RETURN END +DECK,UFILE. *CMZU: 2.03/01 25/07/97 14.35.29 by Phobos (D. McLeod) *-- Author : subroutine UFILE(Mode, LogName, LogUnit, FileName) *Documentation_Block ************************************************************************ * * Description: * Assigns Fortran logical unit numbers for, and optionally opens or * closes, a file for the Phobos MC. * * Arguments: * Mode (integer; input): specifies actions to be preformed by UFILE; * = 0: Assign a logical unit number to the file, and, if it is not * in the list of files already assigned, open it. * = 1: Same action as mode = 0, but do not open the file. * = 2: Close the file. * = 3: Close all assigned files and delete all assignments. * LogName (character*(*), input): specifies the logical file name, * presumed to have been assigned to an actual file by DCL statements. * If the name contains a period (.), DCL treats it as an actual * (not logical) file name. * If the name contains no period, and no logical assignment was made, * Fortran will take FILENAME.DAT as the actual file name. * LogUnit (integer, output) is the returned Fortran Logical Unit * Number; if an error occurred, LogUnit will be 0 or negative. * FileName (character*(*), output): the actual filename assigned * to the file. This uses VAX-specific system calls, but a KUIP * alternative is available for platform independence. * * This is an interim version, saving old hooks and information transfer * via IO.CMN, until the File server is ready. * * Called by: * UGINIT * * Calls: * LIB$SYS_TRNLOG or GETENV, LENOCC * * Implicit inputs: IO.CMN for parameterized unit #s * * Implicit outputs: opened files; unit numbers in common IO * * Filename: pmc_src:UFILE.FOR * * History: * Date Name Description * ---- ---- ----------- * 20-Jul-97 DMcL Report level, AIX vs. non-AIX now set by * preprocessor switches REP2, AIX * 15-Jul-97 DMcL GETENV call in place of LIB$SYS_TRNLOG in UNIX * environment, to obtain (setenv) file name. * OPENs altered to use full file names. * 25-Mar-97 R. V. Version for DEC osf1, status 'new' -> 'unknown' * if CMZ selects OSF1; added reporting options; * list alternate selections as comments for * testing without CMZ * 13-Aug-96 R. V. Change READONLY to ACTION = READ if CMZ selects * IBM; replace FLDZBR by BATKUMAC * 21-Jul-96 R. V. Removed unused nn * 08-Jul-96 R. V. Use lib$sys_trnlog if sel VMS, else KUQUINF * 18-Jul-94 K. Wozniak Increase NFILES to 10 * 06-Jun-93 R. V. Add GENEVS * 10-Jan-93 R. V. Add VAX-specific code to get actual filename. * There is also a KUIP non-specific alternative * 10-Dec-92 R. V. Changed name to UFILE; restructured to allow * programs to call for individual files to be * located and/or opened * 9-Dec-92 C. Conner Add field map in pre-sorted Zebra bank * 15-Nov-92 R. Verdier Save unit values in IO common to flag * results of file opens, add gcdefs * 6-Jun-92 C. Parsons Separated from package, added cards$def * Apr-92 D. Mcleod Creation in GPH package as UFILES ************************************************************************ *End_Documentation_Block C Global specifictions: IMPLICIT NONE c Arguments: integer LogUnit, Mode character*(*) LogName, FileName C External specifications: +SEQ, IO. integer LENOCC c Local definitions: integer MaxFiles parameter (MaxFiles = 12) integer IFile, ios character*11 Form, Forms(3) /'formatted', 'unformatted', * 'unspecified'/ character*7 Stat, Status(3) /'old', 'new', 'unknown'/ c Preassigned files: c RHDATA is for FFREAD and STPARS control input c GCDEFS is for UGC system geometry and control input c CARDS$DEF is for interactive input of FFREAD and STPARS data c RHASC is for standard debug output c BATKUMAC is for a KUIP batch command file c FLDASC is for ascii-format magnetic field data c RHZEB is for Zebra output c RHNTU is for Ntuple output for tracks containing hits only c MCNTU is for Ntuple output for all tracks c GENEVS is for the ascii track input file c The corresponding standard logical unit numbers usrin, ... are c defined in IO.CMN now, but eventually should be defined directly by c the definition for Luns below. c Additional numbers 101, ... are pre-set for formatted ascii output c files; for other file types, the user should call with mode = 1 and c do his own OPEN. integer NFiles /10/, NFilesPre /10/ character*32 LogNames(MaxFiles) * /'RHDATA', 'GCDEFS', 'CARDS$DEF', 'RHASC', 'BATKUMAC', * 'FLDASC', 'RHZEB', 'RHNTU', 'MCNTU', 'GENEVS', 2*' '/ character*63 FileNames(MaxFiles) integer Luns(MaxFiles) * / usrin, usrgcin, carddef, usrout, usrbatkumac, usrmap, usrzeb, * usrntu, usrmcntu, 91, 92, 93 / c Iform = 1 for FORMATTED, 2 for UNFORMATTED, 3 for unspecified integer Iform(MaxFiles) * / 1, 1, 1, 1, 1, 1, 2, 5*1/ c Irw = 1 for READONLY, 2 for normal READ/WRITE integer Irw(MaxFiles) * / 1, 1, 1, 2, 1, 1, 2, 2*2, 1, 2*2/ c Istat = 1 for OLD, 2 for NEW, 3 for UNKNOWN c Created file status: UNKNOWN for OSF1, NEW for other o.s.'s +SELF,IF=-OSF1,IF=-HP-UX. c*****integer Istat(MaxFiles) / 1, 1, 1, 3, 1, 1, 3, 2*3, 1, 2*3/ integer Istat(MaxFiles) / 1, 1, 1, 2, 1, 1, 2, 2*2, 1, 2*2/ +SELF,IF=OSF1,HP-UX. c*****integer Istat(MaxFiles) / 1, 1, 1, 2, 1, 1, 2, 2*2, 1, 2*2/ integer Istat(MaxFiles) / 1, 1, 1, 3, 1, 1, 3, 2*3, 1, 2*3/ +SELF. c Temporary report level: 0 = no output, 1 = errors only, 2 = always +SELF,IF=-REP2. integer report / 1 / +SELF,IF=REP2. integer report / 2 / +SELF. c Executable Statements: if (Mode .ge. 0 .and. Mode .le. 2) then c Find logical unit number assigned to this file, if any LogUnit = 0 IFile = 0 do while (LogUnit .eq. 0 .and. IFile .lt. NFiles) IFile = IFile + 1 if (LogNames(IFile) .eq. LogName) LogUnit = Luns(IFile) enddo c If none, and mode = 0 or 1, assign a Lun if (LogUnit .eq. 0 .and. NFiles .lt. MaxFiles .and. * (Mode .eq. 0 .or. Mode .eq. 1)) then NFiles = NFiles + 1 IFile = NFiles LogNames(IFile) = LogName LogUnit = Luns(IFile) endif c Get actual file name from system call.. system dependent: if (IFile .gt. 0) then FileNames(IFile) = ' ' +SELF,IF=VMS. C get file name set by ASSIGN in VMS call LIB$SYS_TRNLOG (LogName,,FileNames(IFile),,,) +SELF,IF=-VMS. C Similarly (7/15/97) get actual file name in UNIX environment, C assuming set by setenv call. Otherwise use logical name & link to it. call GETENV(LogName,FileNames(IFile)) +SELF. if( FileNames(IFile).eq. ' ') FileNames(IFile) = LogName FileName = FileNames(IFile)(1:LENOCC(FileNames(IFile))) endif c Open the file if mode = 0 and a Lun was assigned. The form of the c statement has to be different for different platforms because the c Fortran standard prevents file characteristics like READONLY, c essential for reading data files that may be open concurrently for c other jobs, from being entered as character strings or flag words. if (Mode .eq. 0 .and. LogUnit .gt. 0) then Form = Forms(Iform(IFile)) Stat = Status(Istat(IFile)) if (Irw(IFile) .eq. 1) then c Open existing files with ACTION=READ for IBM AIX, READONLY for c other o.s.'s +SELF,IF=-AIX. OPEN (UNIT=LogUnit, FILE=FileName, FORM=Form, STATUS=Stat, 1 READONLY, IOSTAT=ios) +SELF,IF=AIX. OPEN (UNIT=LogUnit, FILE=FileName, FORM=Form, STATUS=Stat, 1 ACTION='READ', IOSTAT=ios) +SELF. else c Open output file as status new, formatted/unformatted normally, c status unknown under DEC OSF1 Unix OPEN (UNIT=LogUnit, FILE=FileName, * FORM=Form, STATUS=Stat, IOSTAT=ios) endif c Report results if (Report .gt. 0) then if (ios .eq. 0 .and. Report .gt. 1) * print '(3a,i4,5a/2a)', ' UFILE: opened ', LogName, * ' on unit', LogUnit, ', format = ', Form, ', status = ', * Stat, ',', ' file ', FileName if (ios .ne. 0) * print '(3a,i4,5a,i6,a/2a)', ' UFILE: error opening ', * LogName, ' on unit', LogUnit, ', format = ', Form, * ', status = ', Stat, ', IOSTAT =', ios, ',', * ' file ', FileName endif c Return the negative of the i/o error code if the open failed if (ios .ne. 0) LogUnit = -abs(ios) endif ! Mode = 0 C Mode = 2: Close the open file if (Mode .eq. 2 .and. LogUnit .gt. 0) close(LogUnit) else if (Mode .eq. 3) then c Mode 3: close all assigned files do IFile = 1, NFiles close (Luns(IFile)) end do NFiles = NFilesPre endif ! Mode = [0, 2] return end +DECK,UGCDEF. *CMZU: 2.03/00 24/07/97 11.22.52 by K. Wozniak *CMZU: 2.02/00 17/03/97 12.11.21 by K. Wozniak *CMZU: 2.00/08 25/07/96 13.40.24 by Phobos (R. Verdier) *CMZU: 1.01/17 19/04/95 13.54.05 by Phobos (R. Verdier) *CMZU: 1.01/08 13/06/94 15.55.32 by Phobos (R. Verdier) *CMZU: 1.01/07 05/19/94 16.22.30 by R. Verdier *CMZU: 1.01/03 03/01/94 10.10.59 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : subroutine UGCDEF (key, nargs, atypes, iargs, rargs, lsargs, * ssargs, line, ires) *Documentation_Block ************************************************************************ * * Description: * UGCDEF executes geometry and control information definitions for * Phobos. * UGCDEF receives the information from a UGC input line and passes the * specified values of the variables to specialized (e.g., Geant) * geometry- and reconstruction-defining subroutines. * * Arguments: * atypes: list of argument types: 1 = integer, 2 = real, 3 = string * iargs: array of integer arguments * ires: integer value returned to caller: * 0 if no errors were encountered; * 1 if the keyword was not recognized; * -1 if the expected number of arguments was not found; * -2 if an argument was of the wrong type. * -4 if a special argument was of the wrong type, probably * a temporary condition until code is generalized. * key: keyword identifying this data * line: storage for string arguments * lsargs: array of locations of string arguments in line * nargs: total number of arguments of all types * rargs: array of real arguments * ssargs: array of sizes of string arguments * * Called by: * UGCIN, after parsing a line of UGC text input with primary key GS. * * Sub- * key Calls: * ATT GSATT to set volume attributes such as 'inactive'; * CLOS GGCLOS to close geometry banks, required by Geant; * DET GSDET to define a Geant sensitive volume [detector]; * DETH GSDETH to define a Geant detector's hit handling parameters; * DET GSDETV to define a sensitive volume, Geant sets NAMESV; * DVN GSDVN to divide a sensitive voulme into subvolumes (pixels) * MATE GSMATE to define a Geant material; * MIXT GSMIXT to define a Geant material mixture; * POS GSPOS to position one Geant volume inside another; * ROTM GSROTM to define a rotation matrix; * TMED GSTMED to define a Geant tracking medium; * TPAR GSTPAR to define individual Geant tracking medium parameters; * VOLU GSVOLU to define a Geant volume; * Other Geant subroutine calls will be added as required. * * Implicit inputs, outputs, side effects: * Geant creates Zebra banks containing all the description data, * and the data structures JPART, JMATE, JTMED, JROTM, JVOLUM, and * JSET. * * History: * Date Name Description * ---- ---- ----------- * 2-Jul-97 K.W. added GS DVN command for division of senvitive volumes * 2-Mar-97 K.W. unused IRET, ISET, IDET tables changed to single * variables to protect against overflow numbers * in the UGCDATA input file * 25-Jul-96 R. V. ")," -> ")" in writes for ANSI compliance * 19-Apr-95 A. Trzupek Allow NLMAT <0 in GS MIXT for mix by # atoms * 13-Jun-94 R. V. Add GSDETV to enable GLVOLU; store NSIP * 19-May-94 R. V. Added GSTPAR * 28-Dec-93 R. V. Added GSATT * 27-Apr-93 R. V. Move UGCPAR definitions to RHSIL.CMN * 29-Dec-92 R. V. Discard returned Geant volume #s if more than * MaxVolDef volumes are defined, since they are * unused; improve error messages. * 02-Nov-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block implicit none c Argument declarations: character*(*) key, line integer nargs, atypes(*), iargs(*), lsargs(*), ssargs(*), * ires real rargs(*) c Common declaration for access to hits parameter definition vectors c used by UGCDEF and UGCSET: +SEQ,RHSIL. c Local declarations: c local debug controls: c Idebug = 0 for no output, 1 for fatal errors only, ... integer idebug /1/, ios, lun /6/ c Storage for volume definitions: integer MaxVolDef, nvoldef /0/ parameter (MaxVolDef = 100) integer ivoldef, ivolu(MaxVolDef) /MaxVolDef*0/ logical FlagTooMany /.true./ c Declarations for keys and validation of input data: integer nkeys, maxargs parameter (nkeys = 14, maxargs = 20) character*8 keys(nkeys) character*24 typename(3) /'an integer.', * 'a floating point number.', 'a character string.'/ data keys / 'ATT', 'CLOS', 'DET', 'DETH', 'DETV', 'MATE', 'MIXT', * 'POS', 'ROTM', 'TMED', 'TPAR', 'VOLU', 'VOLU', 'DVN' / integer iarg, ikey, kk integer nargsexp(nkeys), vtypes(maxargs, nkeys) c A negative expected number of args means that at least one argument c is variable size, so that the actual number can be known only by c code specific to the called subroutine; only the first -n args c are checked for type. data nargsexp / 3, 0, 12, 7, 9, 9, -3, 8, 7, 13, 3, 5, -4, 4 / c Data type code vtype = 1: integer; 2: real; 3: character string. data (vtypes (kk, 1), kk=1,3) / 3, 3, 1 / data (vtypes (kk, 3), kk=1,12) / 3, 3, 1, 3, 4*1, 3, 1, 3, 1 / data (vtypes (kk, 4), kk=1,7) / 3, 3, 1, 3, 3, 3, 3 / data (vtypes (kk, 5), kk=1,9) / 3, 3, 3*1, 3, 1, 3, 1 / data (vtypes (kk, 6), kk=1,9) / 1, 3, 5*2, 2*1 / data (vtypes (kk, 7), kk=1,3) / 1, 3, 2 / data (vtypes (kk, 8), kk=1,8) / 3, 1, 3, 2, 2, 2, 1, 3 / data (vtypes (kk, 9), kk=1,7) / 1, 6*2 / data (vtypes (kk,10), kk=1,13) / 1, 3, 3*1, 6*2, 2*1 / data (vtypes (kk,11), kk=1,3) / 1, 3, 2 / data (vtypes (kk,12), kk=1,5) / 3, 3, 1, 3, 1 / data (vtypes (kk,13), kk=1,4) / 3, 3, 1, 2 / data (vtypes (kk,14), kk=1,4) / 3, 3, 1, 1 / c Local definitions unique to Phobos integer idiv, iaxis character*4 ddname, dmname c Unused GSDET returns: INTEGER IRETDUM, ISETDUM, IDETDUM c End of declarations ires = 0 c Check the given key against the list of keywords. c At completion of loop, ikey will be the index of the found c keyword; = 0 means none was found, < 0 means one was found that c failed a validity test. c Ires will have the flag for the last failure found for the key. kk = 0 ikey = 0 do while (ikey .le. 0 .and. kk .lt. nkeys) kk = kk + 1 if (key .eq. keys(kk)) then ikey = kk c The following is *** wrong ***, it loses the old ires. ires = 0 endif c Verify that the number of tokens found is correct. As multiple c entries for a keyword are allowed, this and the following c condition may not be permanent errors. if (ikey .gt. 0) then if (nargsexp(ikey) .gt. 0 .and. nargs .ne. nargsexp(ikey)) * then if (idebug .ge. 2) write (lun,'(a,i3,3a,i3,a)',iostat=ios) * ' UGCDEF:', nargs, ' arguments found for keyword ', * key, '; ', nargsexp(ikey), ' expected.' ires = -1 endif endif c Verify that the argument variable types are correct. if (ires .eq. 0 .and. ikey .gt. 0) then do iarg = 1, iabs(nargsexp(ikey)) if (vtypes(iarg, ikey) .gt. 0 .and. * atypes(iarg) .ne. vtypes(iarg, ikey)) ires = -2 enddo if (idebug .ge. 2 .and. ires .eq. -2) * write (lun, '(3a,i2,2a)', iostat=ios) * ' UGCDEF: ', line(lsargs(1):lsargs(1)+ssargs(1)-1), * ' argument #', iarg, ' is not ', * typename(iabs(vtypes(iarg, ikey))) endif if (ires .eq. 0) then c If no errors so far, call the subroutine for this key: if (ikey .eq. 1) then call GSATT (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), iargs(3)) elseif (ikey .eq. 2) then call GGCLOS elseif (ikey .eq. 3) then if (line(lsargs(4):lsargs(4)+ssargs(4)-1) .eq. 'ISET' * .and. line(lsargs(5):lsargs(5)+ssargs(5)-1) .eq. 'IDET') * then call GSDET (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), iargs(1), * line(lsargs(3):lsargs(3)+ssargs(3)-1), iargs(2), * iargs(3), iargs(4), iargs(5), ISETDUM, * IDETDUM) else ires = -1 endif elseif (ikey .eq. 4) then c Temporarily, use only standard detector information tables referenced c by the names that Geant uses: if (line(lsargs(3):lsargs(3)+ssargs(3)-1) .eq. 'NAMESH' * .and. line(lsargs(4):lsargs(4)+ssargs(4)-1) .eq. 'NBITSH' * .and. line(lsargs(5):lsargs(5)+ssargs(5)-1) .eq. 'ORIG' * .and. line(lsargs(6):lsargs(6)+ssargs(6)-1) .eq. 'FACT') * then NSIP = iargs(1) call GSDETH (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), NSIP, * SINAMH, SIBITH, SIORIG, SIFACT) else ires = -2 endif elseif (ikey .eq. 5) then if (line(lsargs(3):lsargs(3)+ssargs(3)-1) .eq. 'ISET' * .and. line(lsargs(4):lsargs(4)+ssargs(4)-1) .eq. 'IDET') * then call GSDETV (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), iargs(1), * iargs(2), iargs(3), ISETDUM, IDETDUM) else ires = -1 endif elseif (ikey .eq. 6) then call GSMATE (iargs(1), * line(lsargs(1):lsargs(1)+ssargs(1)-1), rargs(1), * rargs(2), rargs(3), rargs(4), rargs(5), rargs(2), * iargs(3)) elseif (ikey .eq. 7) then if (ABS(iargs(2)) .eq. 2 .and. * nargs .eq. 3 * ABS(iargs(2)) + 4) then call GSMIXT (iargs(1), * line(lsargs(1):lsargs(1)+ssargs(1)-1), rargs(1), * rargs(3), rargs(5), iargs(2), rargs(6)) else ires = -2 endif elseif (ikey .eq. 8) then call GSPOS (line(lsargs(1):lsargs(1)+ssargs(1)-1), * iargs(1), line(lsargs(2):lsargs(2)+ssargs(2)-1), * rargs(1), rargs(2), rargs(3), iargs(2), * line(lsargs(3):lsargs(3)+ssargs(3)-1)) elseif (ikey .eq. 9) then call GSROTM (iargs(1), rargs(1), rargs(2), rargs(3), * rargs(4), rargs(5), rargs(6)) elseif (ikey .eq. 10) then call GSTMED (iargs(1), * line(lsargs(1):lsargs(1)+ssargs(1)-1), iargs(2), * iargs(3), iargs(4), rargs(1), rargs(2), rargs(3), * rargs(4), rargs(5), rargs(6), iargs(5), iargs(6)) elseif (ikey .eq. 11) then call GSTPAR (iargs(1), * line(lsargs(1):lsargs(1)+ssargs(1)-1), rargs(1)) elseif (ikey .eq. 12) then c If volume shape parameters were specified in a vector, check that c the name is "SPARS"; this will be generalized later to any recognized c vector if (line(lsargs(3):lsargs(3)+ssargs(3)-1) .eq. 'SPARS') * then c Protect against storage overflow of returned results. This informa- c tion is presently unused; if required in future, the solution is to c recompile with MaxVolDef increased. nvoldef = nvoldef+1 ivoldef = min(nvoldef, MaxVolDef) call GSVOLU (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), * iargs(1), Ugcpars(1), iargs(2), ivolu(ivoldef)) else c Flag attempt to reference an arbitrary parameter vector, rather c than the special vector Ugcpars. This will be generalized later. ires = -4 endif elseif (ikey .eq. 13) then c If volume shape parameters were specified inline, check that the c # of parameters found agrees with the number specified if (nargs .eq. iargs(2)+4) then nvoldef = nvoldef+1 ivoldef = min(nvoldef, MaxVolDef) call GSVOLU (line(lsargs(1):lsargs(1)+ssargs(1)-1), * line(lsargs(2):lsargs(2)+ssargs(2)-1), * iargs(1), rargs(1), iargs(2), ivolu(ivoldef)) else c Flag nmber of arguments inconsistent with number of shape parameters. ires = -1 endif elseif (ikey .eq. 14) then c Division of a volume ddname = line(lsargs(1):lsargs(1)+ssargs(1)-1) dmname = line(lsargs(2):lsargs(2)+ssargs(2)-1) idiv = iargs(1) iaxis = iargs(2) if(iaxis .eq. 1) then if(ndivx(ndets) .ne. 0) go to 90 if(dmname .eq. detname(ndets)) go to 95 if(dmname .eq. divyname(ndets)) go to 95 if(dmname .eq. divzname(ndets)) go to 95 else if(iaxis .eq. 2) then if(ndivy(ndets) .ne. 0) go to 90 if(dmname .eq. detname(ndets)) go to 95 if(dmname .eq. divxname(ndets)) go to 95 if(dmname .eq. divzname(ndets)) go to 95 else if(iaxis .eq. 3) then if(ndivz(ndets) .ne. 0) go to 90 if(dmname .eq. detname(ndets)) go to 95 if(dmname .eq. divxname(ndets)) go to 95 if(dmname .eq. divyname(ndets)) go to 95 endif write(*,*) ' *** ERROR IN UGCDATA FILE: ', + 'GS DVN command: mother volume: ', dmname, + ' not defined in last GS SET PADS or GS DVN command' write(*,*) ' (GS DVN has to be right after ', + 'GS SET PADS)' go to 96 90 continue write(*,*) ' *** ERROR IN UGCDATA FILE: ', + 'GS DVN command: axis: ', iaxis, + ' already divided or the axis number wrong' go to 96 95 continue if(iaxis .eq. 1) then ndivx(ndets) = idiv divxname(ndets) = ddname else if(iaxis .eq. 2) then ndivy(ndets) = idiv divyname(ndets) = ddname else if(iaxis .eq. 3) then ndivz(ndets) = idiv divzname(ndets) = ddname endif call GSDVN (ddname, dmname, idiv, iaxis) 96 continue endif ! if ikey endif ! if ires c If an error occurred, reset ikey negative and try again if (ires .lt. 0) ikey = -iabs(ikey) enddo ! while ikey <= 0 and kk <= nkeys c Flag unrecognized key: this is not necessarily an error, if we pass c non-UGC control data through UGC. if (ikey .le. 0 .and. ires .eq. 0) ires = 1 c Debug: display errors (if idebug >= 1) or success (if idebug >= 3) if (ires .eq. 1 .and. idebug .ge. 2) then write (lun, '(3a)', iostat=ios) ' UGCDEF: key ', key, * ' unknown, information not processed.' elseif (idebug .ge. 1) then if (ires .eq. -1) then write (lun, '(3a)', iostat=ios) ' UGCDEF: ', key, * ' had an unexpected number of arguments, not processed.' elseif (ires .eq. -2) then write (lun, '(3a)', iostat=ios) ' UGCDEF: ', key, * ' had an argument of unexpected type, not processed.' elseif (ires .eq. -4) then write (lun, '(3a)', iostat=ios) ' UGCDEF: ', key, * ' had a special argument of unexpected type, not processed.' endif elseif (ires .eq. 0 .and. idebug .ge. 2) then if (FlagTooMany .and. Nvoldef .gt. MaxVolDef) then write (lun, '(3a,i3)', iostat=ios) * ' UGCDEF: more than', MaxVolDef, ' volumes defined, excess', * ' volume indices discarded.' FlagTooMany = .false. endif write (lun, '(3a,i3)', iostat=ios) * ' UGCDEF found ', key, ' = key #', ikey endif return end +DECK,UGCGET. *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : subroutine UGCGET (line, lline, itoken, loct, lent, lnext) *Documentation_Block ************************************************************************ * * Description: * UGCGET executes geometry and control information definitions for * Phobos. * UGCGET fetches the next token from a UGC input line, skipping * in-line comments (initially delimited by curly brackets "{ }") and * information following the line terminator (initially "!"). * Tokens are separated by white space, initially consisting of * sequential blanks and tabs. * Strings are composed of any legal characters; if they contain * embedded white space, they must be surrounded by apostrophes ('). * Continuation lines, quotes within strings such as 'isn''t', and * logical nesting are not yet implemented. * * Arguments: * *line: storage for text lines and stored definitions * *lline: length of the line to be parsed * itoken*: index of the next token = 1, 2, ...; < 0 if error * loct*: location in line of the start of the found token * lent*: length of the found token * lnext*: location in line of the whitespace following the found * token * * Called by: * UGCIN, while processing a line of UGC text input. * * Calls: * none * * Implicit inputs, outputs, side effects: * none * * History: * Date Name Description * ---- ---- ----------- * 02-Nov-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block implicit none c Argument declarations: character*(*) line integer itoken, loct, lent, lline, lnext c Local declarations: character*1 cch, blank /' '/, tab /' '/, apos /''''/, * opencomment /'{'/, closecomment /'}'/ integer idebug /1/, mode, n1, n2 c End of declarations c Check both loct and lline for validity if (loct .le. 0) then if (idebug .gt. 0) print '(a,i8,a)', * 'UGCGET called with loct = ', loct, ', taken as 1.' loct = 1 endif if (lline .le. 0) then if (idebug .gt. 0) print '(a,i8,a)', * 'UGCGET called with lline = ', lline, ', taken as 1.' c The following must be fixed: lline = 1 endif c Set n1 and n2 to the indices of the first and last-plus-1 non- c whitespace [blank or tab] characters in the string, and mode to c 0 (normal search) n1 = 0 n2 = 0 mode = 0 do while (n1 .eq. 0 .or. n2 .eq. 0) cch = line(loct:loct) if (cch .eq. opencomment .and. mode .eq. 0) then mode = 2 else if (cch .eq. closecomment .and. mode .eq. 2) then mode = 0 else if (mode .eq. 2) then else if (cch .ne. blank .and. cch .ne. tab) then if (n1 .eq. 0) then if (cch .eq. apos .and. mode .eq. 0) then mode = 1 else n1 = loct endif else if (cch .eq. apos .and. mode .eq. 1) then if (line(loct-1:loct-1) .ne. apos) mode = 0 c The treatment of 'xxx''xxx' here must be changed so that the c two internal apostrophes are compressed to one; this apparently c requires all strings to be moved to separate storage, to avoid c modifying input. endif else if (n1 .ne. 0 .and. n2 .eq. 0 .and. mode .eq. 0) then n2 = loct endif endif if (loct .ge. lline) n2 = lline if (idebug .gt. 2) print '(a,i3,3a,i3,a,i3)', * ' UGCGET: loct=', loct, ', cch=', cch, ', n1=', n1, * ', n2=', n2 loct = loct + 1 end do itoken = itoken + 1 loct = n1 lnext = n2 lent = n2 - n1 if (line(lnext-1:lnext-1) .eq. apos) lent = lent - 1 return end +DECK,UGCIN. *CMZU: 2.00/08 25/07/96 13.42.34 by Phobos (R. Verdier) *CMZU: 2.00/02 05/04/96 13.52.44 by Phobos (R. Verdier) *CMZU: 1.00/00 22/11/93 23.59.59 by R. Verdier * -maxargs -> mmaxargs, idebug -> ldebug for non-VMX Fortrans *CMZ : 17/12/93 07.30.08 by Phobos *-- Author : subroutine UGCIN (ludat, lurep, lstor, lline, line, ires) *Documentation_Block ************************************************************************ * * Description: * Geometry and control information text file reader for Phobos * UGCIN reads the data file on logical unit "UGCDATA", parses * the lines, and calls UGCDEF to pass the specified values of the * variables to the geometry- and reconstruction-defining subroutines, * or UGCSET to pass values to user commons, banks and variables. * * Arguments: * ires*: integer value returned to caller, <>0 if error(s) occurred * line*: storage for text lines and stored definitions * *lline: the length of the line storage * *lstor: the total length reserved for line plus stored definitions * *ludat: Fortran logical input unit for reading GCDEFS: * if > 0, already open; if 0, quit; if < 0, open abs(ludat) * *lurep: Fortran logical unit for reporting errors * * Called by: * UGINIT * * Calls: * SERVER to open geometry text file gcdefs * UGCDEF to dispatch variables to geometry subroutine * UGCSET to set values in commons and banks * UGCGET to extract the next token from a character string * UGCVAL to classify and evaluate a token by content * * Implicit inputs, outputs, side effects: * none * * History: * Date Name Description * ---- ---- ----------- * 05-Aug-96 R. V. ")," -> ")" in writes for ANSI compliance; * open -> call UFILE to handle IBM-specific open * 05-Apr-96 Don McLeod Open GCDEFS via SERVER to interpret logical * 22-Nov-93 R. V. -maxargs -> mmaxargs, idebug -> ldebug for * non-VMS Fortrans * 24-Apr-93 R. V. Implement vector handling: pass Ielem, * ArgTypes and ArgLengths to UGCSET; get * Index from UGCVAL. * 02-Nov-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block implicit none character*(*) line integer ires, lline, lstor, ludat, lurep c Declare common with IDRUN for SERVER +SEQ, GCFLAG. c Declare local variables: c Debug control: 0 for no output, 1 for fatal errors only, ... integer ldebug /1/ c Keys and data for validation of input: integer maxargs, mmaxargs, nkeys, nsubkeys parameter (nkeys = 2, nsubkeys = 3, maxargs = 20, mmaxargs = -20) c Note when changing keys, also check the lengths lkeys. character*8 keys(nkeys) /'GS', 'GC' / integer lkeys(nkeys) / 2, 2 / character*4 subkeys(nsubkeys) /'SET', 'DEF', 'END' / integer iarg, iiv, ikey, ils, irv, isubkey, kk integer ArgLengths(maxargs) /maxargs*0/, * ArgTypes(maxargs) /maxargs*0/, * ivalues(maxargs) /maxargs*0/, * lsargs(maxargs) /maxargs*0/, * ssargs(maxargs) /maxargs*0/ real rvalues(maxargs) /maxargs*0/ c Define the number and types of arguments expected for each kind c of input. c Note that the number of tokens for UGC lines is two greater than c the number of arguments seen by UGCDEF, since the input line c includes the Id and the the name of the subroutine integer nargs(nkeys), vtypes(maxargs, nkeys) data nargs / mmaxargs, mmaxargs / c Following must understand any variable type: data (vtypes (kk, 1), kk=1,1) / -1 / data (vtypes (kk, 2), kk=1,1) / -1 / integer ielem, index, ios, itoken, ivtype, ivalue, lent, * lnext, loct, lui real rvalue logical eof, eol character*1 term /'!'/ c ArgLengths: the lengths in storage of the arguments, in bytes c ArgTypes: the types of the arguments: 1=integer, 2=real, 3=string c ielem: the vector index found in the current variable name c index: ielem returned by UGCVAL for the current token c ivalue: the value of the current token, if integer c ivtype: the ArgType of the current token c lent: the length of the current token c loct: the index (1..lline) of the current token c lnext: the index of the whitespace preceding the next token c rvalue: the value of the current token, if real c term: the line termination character c For long form SERVER returns: INTEGER IRUN1,IRUN2 CHARACTER*80 FILENAME c End of declarations ires = 0 c Open dataset only if not already done by caller lui = iabs(ludat) if (ludat .lt. 0) then +SELF,IF=NOSERV. call UFILE (0, 'GCDEFS', lui, FileName) +SELF,IF=-NOSERV. call SERVER('GCDEFS',IDRUN,LUI,FILENAME,0,0,0,IRUN1,IRUN2) +SELF. endif c Bypass reading if ludat is 0 eof = lui .eq. 0 c Loop over input lines until end of file is reached do while (.not. eof) read (lui, '(a)', iostat=ios) line eof = ios .ne. 0 itoken = 0 if (ldebug .ge. 2) write (lurep, '(a,i3/1x,a)') * ' UGCIN line read, length = ', lline, line(1:lline) loct = 1 if (eof) loct = lline + 1 ikey = 0 isubkey = 0 iarg = 0 irv = 0 iiv = 0 ils = 0 eol = loct .gt. lline .or. line(loct:loct) .eq. term c Unless read failed, loop extracting tokens from the current line do while (.not. eol) c Set loct and lent to the location and length of the next token call UGCGET (line, lline, itoken, loct, lent, lnext) eol = loct .gt. lline .or. line(loct:loct) .eq. term if (.not. eol) then if (ldebug .ge. 4) write (lurep, '(3(a,i3),2a)') * ' UGCGET returned loct = ', loct, ', lent = ', lent, * ', token # ', itoken, ' = ', line(loct:loct+lent-1) c Determine the token type by its content call UGCVAL (line(loct:loct+lent-1), lent, ivtype, * rvalue, ivalue, index) C Store the token's type and value, or its location if a string if (iarg .lt. maxargs) iarg = iarg + 1 ArgTypes(iarg) = ivtype if (ivtype .eq. 1) then iiv = iiv + 1 ivalues(iiv) = ivalue ArgLengths(iarg) = 4 elseif (ivtype .eq. 2) then irv = irv + 1 rvalues(irv) = rvalue ArgLengths(iarg) = 4 elseif (ivtype .eq. 3) then ils = ils + 1 lsargs(ils) = loct ssargs(ils) = lent ArgLengths(iarg) = lent endif c If this is the first token, compare it with the list of keywords. c The match is case-sensitive and the exact length must be matched. c Ikey will be the index of the found keyword; <=0 if none matched. if (itoken .eq. 1) then kk = 1 ikey = 0 do while (ikey .eq. 0 .and. kk .le. nkeys) if (lent .eq. lkeys(kk) .and. * line(loct:loct+lent-1) .eq. keys(kk)(1:lkeys(kk))) * ikey = kk kk = kk + 1 enddo if (ikey .gt. 0 .and. ldebug .ge. 3) * write (lurep, '(3a,i3)') ' UGCIN found ', * line(loct:loct+lent-1), ' = key #', ikey elseif (itoken .le. 3 .and. ivtype .eq. 3 * .and. ikey .gt. 0) then if (itoken .eq. 2) then kk = 1 isubkey = 0 do while (isubkey .eq. 0 .and. kk .le. nsubkeys) if (line(loct:loct+lent-1) .eq. subkeys(kk)) * isubkey = kk kk = kk + 1 enddo if (isubkey .gt. 0) then if (ldebug .ge. 3) * write (lurep, '(3a,i3)') ' UGCIN found ', * line(loct:loct+lent-1), ' = subkey #', isubkey endif elseif (isubkey .gt. 0) then c If third token and subkey found, save vector index ielem = index endif endif c Update the starting location for the next token loct = lnext endif c Stop parsing if end of line or if first token was unrecognized eol = eol .or. (itoken .eq. 1 .and. ikey .le. 0) enddo ! while .not. eol c Verify that the number of tokens found is correct if (ikey .gt. 0) then if (nargs(ikey) .gt. 0 .and. iarg .ne. nargs(ikey)) then if (ldebug .gt. 0) write (lurep, '(3(a,i3),a)') * ' UGCIN:', iarg, ' arguments found for keyword ', * ikey, '; ', nargs(ikey), ' expected.' ikey = -1 endif endif c Call the dispatch subroutine if (ikey .gt. 0) then if (isubkey .eq. 1) then call UGCSET (line(lsargs(3):lsargs(3)+ssargs(3)-1), * ielem, iarg-3, ArgTypes(4), ArgLengths(4), rvalues, * ivalues, line(lsargs(4):lsargs(4)+ssargs(4)-1), ires) c Note the string argument of UGCSET is a single value for now. c Map ires into UGCIN definitions: if (ires .gt. 0) then ires = 0 elseif (ires .lt. 0) then if (ldebug .gt. 0) write (lurep, '(a,i4,2a)') * ' UGCIN: UGCSET returned error code', ires, * ' while processing values of ', * line(lsargs(3):lsargs(3)+ssargs(3)-1) endif elseif (isubkey .eq. 2) then c DEF (local definition): not yet implemented elseif (isubkey .eq. 3) then c END: quit reading, return the argument ires = ivalues(1) eof = .true. else call UGCDEF (line(lsargs(2):lsargs(2)+ssargs(2)-1), * iarg-2, ArgTypes(3), * ivalues, rvalues, lsargs(3), ssargs(3), line, ires) endif ! isubkey endif ! ikey enddo ! while not eof c Close dataset only if opened here if (ludat .lt. 0) close (lui) return end +DECK,UGCONB. *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : SUBROUTINE UGCONB *Documentation_Block ************************************************************************ * * Description: * UGCONB is a user hook for the interactive Geant main program that * runs the standard batch mode. See UGCONS for mode selection. * * Arguments: none * * Called by: * GXINT, as an alternative to calling KUEXEC * * Calls: * GRUN, UGLAST * * Implicit inputs, outputs, side effects: none * * Filename: UGCONB.FOR * * History: * Date Name Description * ---- ---- ----------- * 06-Jun-93 R. Verdier Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE call GRUN call UGLAST return end +DECK,UGCONS. *CMZU: 2.00/08 13/08/96 15.23.23 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : SUBROUTINE UGCONS (Batch, Batchf, NoLog) *Documentation_Block ************************************************************************ * * Description: * UGCONS is a user hook for the interactive Geant main program that * allows the user to choose the mode of operation, as follows: * If the program is running in batch mode, as determined by the CERN * INTRAC function, then if a readable file is assigned to logical * name BATKUMAC, it is interpreted as a KUMAC file of KUIP commands; * if it is not readable or not present, the program runs in ordinary * batch mode. * This overcomes the problem that the standard Geant way of specifying * batch mode for some reason ignores the /nodebug qualifier and makes * the program run in debug mode, requiring an additional batch debug * control file. * * Arguments: * Batch*: Logical variable specifying batch mode if true * Batchf*: Character string specifying the name of the Batch file * Nolog*: Logical variable: read GTLOGIN.KUMAC if true * * Called by: * GXINT, after calling KUARGS to get command line arguments. * * Calls: * none * * Implicit inputs, outputs, side effects: * via COMMONs included or defined below, in particular RHSIL * * Filename: UGCONS.FOR * * History: * Date Name Description * ---- ---- ----------- * 13-Aug-96 R. V. open -> call UFILE; SERVER can't be used * here as it aborts on file not found * 02-Jun-93 R. Verdier Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE c Argument declarations: character*(*) Batchf logical Batch, Nolog logical INTRAC integer dummy, ios, Lun c End of declarations if (INTRAC(dummy)) then Batch = .false. else Batch = .true. call UFILE (0, 'BATKUMAC', Lun, Batchf) if (Lun .le. 0) Batchf = ' ' endif c* print *, ' UGCONS: Batch =', Batch, ', filename="', batchf, '".' Nolog = .true. return end +DECK,UGCSET. *CMZU: 2.03/00 02/07/97 12.48.57 by K. Wozniak *CMZU: 2.02/00 18/03/97 12.34.58 by K. Wozniak *CMZU: 2.00/10 24/09/96 07.57.19 by K.Wozniak *CMZU: 2.00/06 21/07/96 21.59.39 by Phobos (R. Verdier) *CMZU: 2.00/04 16/07/96 11.33.55 by Phobos (K. Wozniak) *CMZU: 2.00/03 09/07/96 13.32.20 by K.Wozniak *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : SUBROUTINE UGCSET (Key, Iielem, Nvalues, Vtypes, Vlengths, * Rvalues, Ivalues, Svalues, Ires) *Documentation_Block ************************************************************************ * * Description: * UGCSET copies user geometry and control variables read by the UGC text * file input system to local, common or bank storage, for any necessary * communication with Geant or user programs. This is the user-specific * section of the UGC system, and must be modified to allow access to c new user variables. * * Arguments: * *Key: Character substring identifying the variable to be set * *Iielem: Index of initial variable element * *Nvalues: Number of values to be set * *Vtypes: Variable types, 1=integer*4, 2=real*4, 3=string * *Vlengths: Storage lengths of variable elements * *Rvalues: Vector of real values for the variable * *Ivalues: Vector of integer values for the variable * *Svalues: Vector of string values for the variable, not yet * implemented * Ires*: Result flag = # of variables copied, 0 if key was not * recognized, < 0 if error (wrong variable type or bad value) * * Called by: * UGCIN, after parsing an input record and evaluating tokens * * Calls: * STOPER * * Implicit inputs, outputs, side effects: * via COMMONs included or defined below, in particular RHSIL * * Filename: UGCSET.FOR * * History: * Date Name Description * ---- ---- ----------- * 1-Jul-97 K.W. modified code for GS SET PADS - to enable GS DVN * 3-Mar-97 K.W. modified GS SET SLP and GS SET IUDET * added GS SET PADS * 23-Sep-96 K.W. Removed definitions of MAGX, MAGZ, RFLD, BFLD, MOFF * (they must not appear in the UGCDATA file now) * 21-Jul-96 R. V. Removed unused par, r1, x1, z1, z2 * 9-Jul-96 K. W. magnetic field center (MAGX,MAGZ) separated from * the field offset (MOFF(3)) * 9-Jul-96 K. W. Added geometry version GEOV * MAGT, RFLG etc. are defined now in the magnetic field * map (defaults set in control file) and left here * for backward compatibility only * 24-Apr-93 R. V. Added Iielem, Vtypes, and Vlengths args to * implement limited vector cabability; moved SIxxx defs to RHSIL.CMN * 21-Feb-93 R. V. Added magt, tmag, rfld, nslp = nplanes * 03-Nov-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE c Argument declarations: character*(*) Key integer Iielem, Ires, Nvalues, Ivalues(*), Vlengths(*), * Vtypes(*) real Rvalues(*) character*(*) Svalues c Common declarations: +SEQ, CARDS. +SEQ, FLAG. +SEQ, GCFLAG. +SEQ, IO. +SEQ, RHSIL. +SEQ, RHSYS. C Local declarations: c UGCDebug = 0 for no output, 1 for fatal errors, ... integer IelMin, ipl, nn, Nvstore, UGCDebug /1/ LOGICAL PADSNEW, PADSOLD DATA PADSNEW, PADSOLD / .FALSE., .FALSE. / SAVE PADSNEW, PADSOLD c End of declarations Ires = 1 Nvstore = Nvalues IelMin = MAX(Iielem, 1) c GEOV - geometry version number (real) in format 3.02 c provided to identify the geometry used i nthe simulations if (Key .eq. 'GEOV') then GEOV = Rvalues(1) c Bfld is used to scale the magnetic field: elseif (Key .eq. 'BFLD') then BFLD = Rvalues(1) c The next vectors are used for calls to the Geant hit subroutine, c GSDETH elseif (Key .eq. 'NBITSH') then c Get the numbers of bits to save for each hit parameter nvstore = MIN(Nvalues, NSIP - IelMin + 1) do nn = 1, nvstore SIBITH(nn+IelMin-1) = Ivalues(nn) enddo elseif (Key .eq. 'FACT') then c Get the hit parameter scale factors nvstore = MIN(Nvalues, NSIP - IelMin + 1) do nn = 1, nvstore SIFACT(nn+IelMin-1) = Rvalues(nn) enddo elseif (Key .eq. 'IUDET') then C OBSOLETE - KEPT FOR BACKWARD COMPATIBILITY ONLY: c Get the user-assigned names of the detector planes, passed in the c character*4 array DETNAME in common RHSIL to PH_OUT. c The UGC statement c GS SET NPLANES nn c should precede any SET that depends on NPLANES. c Names are read in as a single string; long strings can be read c by specifying segments on more than one record, e.g. by c GS SET IUDET(1) 'aaaabbbbcccc...' c GS SET IUDET(21) 'wwwwxxxxyyyy...' IF(PADSNEW) THEN WRITE(*,*) ' *** ERROR IN UGCSET - GS SET PADS MIXED WITH ', + ' GS SET IUDET OR GS SET SLP' WRITE(*,*) ' GS SET IUDET - IGNORED' ELSE PADSOLD = .TRUE. nvstore = MIN((Vlengths(1)+3)/4, NSLP - IelMin + 1) do nn = 1, nvstore DETNAME(nn+IelMin-1) = Svalues(4*nn-3:4*nn) enddo ENDIF elseif (Key .eq. 'PADS') then C SUBSTITUTES: GS SET IUDET and GS SET SLP C Reads the name of the volume, pad type flag and up to 4 pad parameters IF(PADSOLD) THEN WRITE(*,*) ' *** ERROR IN UGCSET - GS SET PADS MIXED WITH ', + ' GS SET IUDET OR GS SET SLP' ELSE PADSNEW = .TRUE. NDETS = NDETS + 1 IF(NDETS .GT. NSLPM) + CALL STOPER('UGCSET', + 'TOO MANY DETECTORS - INCREASE TABLES SIZE NSLPM',1) DETNAME(NDETS) = SVALUES(1:4) IPADFL(NDETS) = IVALUES(1) PAD1(NDETS) = RVALUES(1) PAD2(NDETS) = RVALUES(2) PAD3(NDETS) = RVALUES(3) PAD4(NDETS) = RVALUES(4) DIVXNAME(NDETS) = '????' DIVYNAME(NDETS) = '????' DIVZNAME(NDETS) = '????' NDIVX(NDETS) = 0 NDIVY(NDETS) = 0 NDIVZ(NDETS) = 0 ENDIF elseif (Key .eq. 'NAMESH') then c Assign names of hit parameters to be saved by Geant nvstore = MIN((Vlengths(1)+3)/4, NSIP - IelMin + 1) do nn = 1, nvstore SINAMH(nn+IelMin-1) = Svalues(4*nn-3:4*nn) enddo elseif (Key .eq. 'NPLANES') then c Get number of silicon planes NSLP = Ivalues(1) IF(NSLP .GT. NSLPM) + CALL STOPER('UGCSET', + 'TOO MANY DETECTORS - INCREASE TABLES SIZE NSLPM',1) elseif (Key .eq. 'NHITPAR') then c Get number of hit parameters NSIP = Ivalues(1) elseif (Key .eq. 'ORIG') then c Get the zeroes of the hit parameters nvstore = MIN(Nvalues, NSIP - IelMin + 1) do nn = 1, nvstore SIORIG(nn+IelMin-1) = Rvalues(nn) enddo elseif (Key .eq. 'SLP') then C OBSOLETE - KEPT FOR BACKWARD COMPATIBILITY ONLY: c Get the hit parameters IF(PADSNEW) THEN WRITE(*,*) ' *** ERROR IN UGCSET - GS SET PADS MIXED WITH ', + ' GS SET IUDET OR GS SET SLP' WRITE(*,*) ' GS SET SLP - IGNORED' ELSE PADSOLD = .TRUE. Ipl = Ivalues(1) c Types should be checked here, but aren't at present if (Ipl .gt. 0 .and. Ipl .le. NSLPM) then IPADFL(IPL) = 1 ! assumed PAD type 1 PAD1(IPL) = RVALUES(2) PAD2(IPL) = RVALUES(4) PAD3(IPL) = 0.0 PAD4(IPL) = 0.0 else Ires = -1 endif ENDIF elseif (Key .eq. 'SPARS') then c note there's no protection for number of values nvstore = MIN(Nvalues, UgcpMax - IelMin + 1) do nn = 1, nvstore UGCpars(nn) = Rvalues(nn) enddo else Ires = 0 endif if (UGCDebug .gt. 0) then if (Ires .gt. 0) then if (UGCDebug .ge. 2) * print '(3a,i2,a,/5(e12.4,a))', ' UGCSET: variable ', Key, * '(1..', min(Nvstore, 10), ') set to ', * (Rvalues(nn), ', ', nn=1, min(Nvstore, 10)) elseif (Ires .eq. 0) then if (UGCDebug .ge. 2) * print '(3a)', ' UGCSET: "', Key, '" not recognized.' else print '(4a)', ' *** ERROR IN UGCSET - ', + 'invalid values specified for', * ' variable "', Key, '" ignored.' endif endif return end +DECK,UGCVAL. *CMZU: 2.00/08 25/07/96 16.47.49 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.08 by Phobos *-- Author : subroutine UGCVAL (token, lent, ivtype, rvalue, ivalue, index) *Documentation_Block ************************************************************************ * * Description: * UGCVAL classifies and evaluates a token on the basis of its content. * The token is first assumed to be an integer; if it contains an "e" or * a decimal point, it is called real; if it fails either case, or if it * is embedded in apostrophes (', not "), it is called a string. * If the token contains left and right parentheses, UGCVAL converts the * characters between them to an integer and returns the result in * index; otherwise index = 0. * * Arguments: * *token: character string to be evaluated; * *lent*: on input, the length of the token; * on output, the length up to a left parenthesis, if any * ivtype*: the returned classification of the token: * = 1, ivalue = integer value of token if token is integer * = 2, value = real value of token if token is real * = 3, if token is neither integer nor real * < 0, if error converting value * index*: the returned vector index value * * Called by: * UGCIN, after receiving a token from UGCGET * * Calls: * none * * Implicit inputs, outputs, side effects: * none * * History: * Date Name Description * ---- ---- ----------- * 25-Jul-96 R. V. correct (i) read format * 23-Apr-93 R. V. Add lent and index arguments for vectors * 02-Nov-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block implicit none c Argument declarations: character*(*) token integer index, ivalue, ivtype, lent real rvalue c Local declarations: integer mindig, maxdig parameter (mindig = ichar('0'), maxdig = ichar('9')) character cch*1, fmt*7, lpar*1 /'('/, rpar*1 /')'/ integer ich, idebug /1/, ios, lc, lenind, llpar, lrpar c End declarations lc = 0 llpar = 0 lrpar = 0 index = 0 c Determine the token type: assume integer, promote to real if c decimal point or e is found, else treat it as a string. ivtype = 1 do while (lc .lt. lent) lc = lc + 1 cch = token(lc:lc) ich = ichar(cch) if (ivtype .lt. 3) then if (ich .lt. mindig .or. ich .gt. maxdig) then if (cch .eq. 'e' .or. cch .eq. 'E' .or. cch .eq. '.') then ivtype = 2 else if (cch .ne. '-' .and. cch .ne. '+') then ivtype = 3 c* else if (cch .eq. '''') then c* ivtype = 3 ! single quote c Note that in this case we should strip the quotes. But to allow c blanks in the quoted string, and also quoted quotes, the stripping c should have been done by UGCGET. endif endif endif if (ivtype .eq. 3) then c If a string, check for presence of a vector index. Note that an c erroneous expression like 123(5) will be identified as a vector, and, c if not found as a keyword, will be ignored by UGCSET. if (llpar .eq. 0) then if (cch .eq. lpar) llpar = lc else if (cch .eq. rpar) lrpar = lc endif endif enddo c Convert the value according to the assigned type. We could return c values in both variables (with suitable limits on real->integer) if c that turned out to be useful. if (ivtype .eq. 1) then write (fmt,'(a,i2,a)') '(i', lent, ') ' read (token, fmt, iostat=ios) ivalue else if (ivtype .eq. 2) then write (fmt,'(a,i2,a)') '(e', lent, '.0)' read (token,fmt,iostat=ios) rvalue c Convert the index, if any else if (llpar .ge. 2) then lenind = lrpar - llpar - 1 if (lenind .ge. 1) then write (fmt,'(a,i2,a)') '(i', lenind, ') ' read (token(llpar+1:lrpar-1), fmt, iostat=ios) index endif lent = llpar - 1 endif c Return ivtype = -|io error code| if the conversion failed. if (ios .ne. 0) ivtype = iabs(ios) c Display error message only in debug mode, pending standard facility if (idebug .ge. 1 .and. ios .ne. 0) print '(a,i3,2a)', * ' UGCVAL: Error ', ios, ' converting token ', token c Display results only in debug mode if (idebug .ge. 3 .and. ivtype .ge. 1) then if (ivtype .eq. 1) print '(3a,i3,a,i8)', ' UGCVAL: token ', * token, ': type ', ivtype, ', value =', ivalue if (ivtype .eq. 2) print '(3a,i3,a,e12.4)', ' UGCVAL: token ', * token, ': type ', ivtype, ', value =', rvalue if (ivtype .eq. 3) print '(3a,i3 )', ' UGCVAL: token ', * token, ': type ', ivtype endif return end +DECK,UGINIT. *CMZU: 2.03/00 24/07/97 11.11.46 by K. Wozniak *CMZU: 2.02/01 23/04/97 11.17.38 by K.Wozniak *CMZU: 2.02/00 17/03/97 12.13.47 by K. Wozniak *CMZU: 2.01/00 07/02/97 13.54.41 by K.Wozniak *CMZU: 2.00/10 23/09/96 10.43.21 by Unknown *CMZU: 2.00/08 25/07/96 12.59.11 by Phobos (R. Verdier) *CMZU: 2.00/06 21/07/96 22.02.20 by Phobos (R. Verdier) *CMZU: 2.00/04 16/07/96 10.50.43 by Phobos (K. Wozniak) *CMZU: 2.00/03 09/07/96 14.36.49 by K.Wozniak *CMZU: 2.00/02 18/07/96 10.28.45 by Phobos (R. Verdier) *CMZU: 1.01/17 20/03/95 14.54.16 by K.Wozniak *-- Author : K.Wozniak 09/03/95 SUBROUTINE UGINIT *Documentation_Block ************************************************************************ * * Description: * Initializes GEANT program, reads control dataset(s), and sets up * geometry description for Phobos. * * Arguments: none * * Called by: * GEPHOB, the main program * * Calls: +SELF,IF=EUCARD. * EUCARD, FFKEY, FFSET, GDRAW, GFFGO, GINIT, GOPEN, GPART, GPHYSI, +SELF,IF=-EUCARD. * FFKEY, FFSET, GDRAW, GFFGO, GINIT, GOPEN, GPART, GPHYSI, +SELF,IF=NOSERV. * GPRINT, GZINIT, STPARS, STTOIN, STTORL, UFILE, UGCIN, UGEOM, +SELF,IF=-NOSERV. * GPRINT, GZINIT, SERVER, STPARS, STTOIN, STTORL, UGCIN, UGEOM, +SELF. * USCOM, USINIT, VZERO * * Implicit inputs, outputs, side effects: * Via COMMONs listed below * * File: pmc_src:UGINIT.FOR * * History: * Date Name Description * ---- ---- ----------- * 23-Apr-97 K. W. time limit switch - to ignore time limit * 4-Mar-97 K. W. Removed unused commands SILD and SILP * 7-Feb-97 K. W. SIMVER and CMZ PHOSIM version coordinated at 2.02 * 23-SEP-96 K. W. SIMVER initialization added (moved from GEPHOB) * 20-SEP-96 K. W. Added new parameters for BANG mode=2 * More information in the AScii Output file * Removed obsolete keywords * 25-Jul-96 R. V. Remove +SEQ,*D. and redundant "," in write, * for ANSI compliance * 21-Jul-96 R. V. Removed unused cc, j, n * 12-Jul-96 K.W. magnetic field center (MAGX,MAGZ) separated from * the field offset (MOFF(3)) * 09-Jul-96 K.W. added commands to define magnetic field from * control file * 04-Jul-96 K.W. added Ascii OUtput file code (initialzation and * instructions to write the header of AOU file) * 18-Jul-96 R.V. Remove the EUCARD facility unless CMZ selects EUCARD * 08-Sep 95 DMcL DATE, TIME => Cernlib DATIMH & associated changes * 23-Jul-95 DMcL Changed UFILE to SERVER calls for UNIX port * idebug => jdebug to avoid GCFLAG conflict * 31 Mar-95 R.V. Change STRA to SECT to avoid GEANT 3.21 conflict * 20-MAR-95 K.W. A call to USCOM was added * 10-MAR-95 K.W. Changed parameters required by GUKINE and BANG * 10-May-94 R.V. Add data SEQs NTUD & RHSILD, after D. McLeod * 5-May-94 R.V. Remove control card setting IZEB=DISP * 9-Nov-93 R.V. BANG.CMN -> BANGC.CMN to avoid MMS confusion; * also NTUEX.CDA -> NTUEXD.CMN for code mgmt. * 17-Jun-93 R.V. Added NHTK, NTTK, NTUEX.CMN & .CDA for ntuples, * NTPE and NTCO for multi-pass processing * 20-Mar-93 K. Wozniak Added MAGT = 3 for cylindrical field map * 7-Feb-93 R.V. Added SAHO to control ascii hit output * 12-Jan-93 R.V. FileName added to UFILE; * COMMON.NTU & COMMON.HST -> NTU.CMN & HST.CMN * 11-Dec-92 R.V. Changed to use UFILE instead of UFILES, move * GPRINT call from UGEOM * 23-Nov-92 R.V. Added MAGT, ZOFF, and RFLD setting for * C.P.'s perfect dipole field mods to GUFLD * 14-Nov-92 R. Verdier Connected to UGC text file geometry input * system, made EUCARD call conditional * 1 Jul 92 J. Shea Separated from GE_..., replaced hard-coded * data by card input, added CARDS * 1 Jun 92 C. Parsons Moved from GPH into GE_ALL-THE-REST.FOR, * changed COMMON=>.CMN, UHINIT=>USINIT, ... * 28-Mar-92 D. McLeod Creation * ************************************************************************ *End_Documentation_Block IMPLICIT NONE C Common blocks from GEANT which might be referred to: INTEGER LIN,LOUT,NUNITS,LUNITS COMMON/GCUNIT/LIN,LOUT,NUNITS,LUNITS(5) INTEGER NHSTA,NGET,NSAVE,NSETS,NPRIN,NGEOM,NVIEW,NPLOT INTEGER NSTAT,LHSTA,LGET,LSAVE,LSETS,LPRIN INTEGER LGEOM,LVIEW,LPLOT,LSTAT COMMON/GCLIST/NHSTA,NGET ,NSAVE,NSETS,NPRIN,NGEOM,NVIEW,NPLOT + ,NSTAT,LHSTA(20),LGET (20),LSAVE(20),LSETS(20),LPRIN(20) + ,LGEOM(20),LVIEW(20),LPLOT(20),LSTAT(20) +SEQ,BANGC. +SEQ,CARDS. +SEQ,FLAG. +SEQ,FLAG2. +SEQ,IO. +SEQ,GCBANK. +SEQ,GCCUTS. +SEQ,GCFLAG. +SEQ,GCKINE. +SEQ,GCPHYS. +SEQ,HST. +SEQ,MUPEP. +SEQ,NTU. +SEQ,NTUEX. +SEQ,RHSIL. +SEQ,RHSYS. +SEQ,UHITS. +SEQ,TLIMIT. C Local: CHARACTER mapfile*6 CHARACTER*8 FIELD(11) character*63 FileName character*1 apostr INTEGER jdebug/1/, I, NFLDS, LENFLD(11), STTOIN, ITAG, IER INTEGER HDATE(2), HTIME(2) CHARACTER RECORD*80 c Declaration to force loading external PMCBDAT C Added for SERVER long form calls: INTEGER IRUN1, IRUN2 REAL STTORL EXTERNAL STTOIN,STTORL !SHELL routines for decoding strings c Declarations to use UGC geometry and control input: integer lline, lstor, iugcres parameter (lline = 132, lstor = 200) character*(lline + lstor) storage c Fortran logical units for UGC input (file GCDEFS) and report output: c IUSRGCIN and IUSROUT are set by calls to subroutine SERVER; but the c latter is not used by UGC. integer lurep /6/ C+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C Key to data cards below (these go into GPH.DAT or similar .DAT files): C Keyword type what it sets (Units cm., Kgauss, Gev/c) C C Magnetic field parameters: C BFLD REAL magnetic field, central value C MAGT INTEGER if = 0, use Zebra field map; if = 1, use c dipole field; if = 2, use ASCII field map C if = 3, use ASCII cylindrical field map C TMAG INTEGER alias to MAGT C MAGX REAL dipole field center X C MAGZ REAL dipole field center Z C MOFF 3*REAL offset of the magnetic field C RFLD REAL dipole field radius C C Standard GEANT cards we will likely use: C TRIG INTEGER number of events simulated (upper limit if reading) C RUNG INTEGER user run number C MULS INTEGER multiple scattering type: 0 = none, C 1 = Gaussian (default), 2 = Moliere C DCAY INTEGER decay in flight: 0 =none, 1 = make secondaries, C 2 = ignore secondaries. (1 = default) C LOSS INTEGER 1 = no fluctuations; average energy loss C 2 = Landau fluctuations (default), 0 = no loss C CUTS REALS up to 16 entries, see GEANT. We're interested in C the second entry, CUTELE; set large e.g. 0.1 to C suppress delta rays when LOSS = 1 is set. C RNDM INTEGERS 2 integers to establish random # seed C DEBUG INTEGERS 2 integers to set range of event numbers for debug C SWIT INTEGERS up to 10 user flags to control printout etc. C via ISWIT(10) in /GCFLAG/ C Flags: 0 or card omitted = option is suppressed C (DATA refers to the data input file name) C GEN INTEGER Event generator type. 1 = fixed, starts at beam C 2 = BANG aimed toward the detectors, C 3 = random BANG, 4 = momentum, position or angle C incremented by DMOM, DXX or DANG from one track C to the next (one track per event), 5 = Monte C Carlo Zebra input C PIXL INTEGER pixilated flag.. 0 = exact intercepts with plane, C 1 = coordinates set to center of nearest pixel C in the mother coord. X1, Y1, Z1 etc., not XP & YP. C ANAL INTEGER Event analysis type. 1 = generate Ntuple only C 2 = calculate errors from fit C SHBO INTEGER 1 = DATA.HST binary plot output (for PAW) C SHDO INTEGER 1 = HISTO is called to output plots in DATA.OUT C SNTU INTEGER 1 = Ntuples are output to file DATA.NTU C SZEB INTEGER 1 = Output SETS, KINE & HITS banks in DATA.FZO C DRAW INTEGER 1 = draw apparatus, 2 = draw hits also C WPIX REAL 1.0 = include tracking errors in chi squared sum C WLOS REAL 1.0 = include energy loss in chi squared sum C C Event generator parameters, depending on GEN above: C NAME TYPE GEN= MEANING C RMUL INTEG 1-4 Multiplicity in BANG random generator C RARM INTEG 1-5 Selected one or two arms C RANG 3 REAL 4 Polar angle range and step C RPHI 2 REAL 1-5 Azimuth range C RETA 2 REAL 1,3,5 Eta max and min C RROT REAL 5 Phi rotation angle C RBXX REAL 1-5 Position of particle production, vertex of C RBYY REAL 1-5 the interaction C RBZZ REAL 1-5 C RBXY REAL 1-3,5 Standard dev. of projected intersection width in x-y C RBDX REAL 1-4,5 interval arround the vertex C RBDY REAL 1-4,5 C RBDZ REAL 1-4,5 C RMOM 3 REAL 1-5 Particle momentum range and step C REXP REAL 3 Mean transverse momentum - falloff parameter C RPID 2 INTEG 1-4 Particle type range; GEANT convention C RSPR REAL 2 Radius of the circle describing the spectgrometer C RSPX REAL 2 Position of the spectrometer (RSPX,RSPZ) C RSPZ REAL 2 used to find cos theta range (2) C Parameters for multi-pass event processing C C NTCO INTEG Maximum number of tracks processed concurrently C NTPE INTEG Maximum number of tracks per event C CPU time limit test variable C TLIM INTEG 0 if not zero time left is tested and program stops. C Default is 0 as for several computers the time limit C is not correctly recognized C Parameters determining ntuple size allocation, if SNTU is non-0: C C NHTK INTEG Total of tracks expected to hit detector C NTTK INTEG Total of tracks expected including secondaries C In-line histogram and scatterplot control cards: C HIST ID TAGNAME (short form.. default bins and interval) C TAGNAME can be Ntuple tag name or e.g. #35 for 35th entry C HIST ID TAGNAME NCHANNELS XMIN XMAX is the long form. C HIST ID TAGX NX XMI XMA TAGY NY YMI YMA scatterplot, args as HBOOK2 C (The number of arguments distinguishes these three formats.) C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ****************************************************************************** * PMC version number should be changed with every modification of the code SIMVER = 2.03 ****************************************************************************** c Open the standard text output file +SELF,IF=NOSERV. call UFILE (0, 'RHASC', iusrout, FileName) +SELF,IF=-NOSERV. call SERVER('RHASC',IDRUN,iusrout,FileName,0,0,1,IRUN1,IRUN2) +SELF. C Initialise GEANT CALL GINIT ************************************** * define magnetic field parameters * ************************************** CALL FFKEY('BFLD',BFLD ,1,'REAL') CALL FFKEY('MAGT',MAGT ,1,'INTEGER') CALL FFKEY('TMAG',MAGT ,1,'INTEGER') ! alias to MAGT CALL FFKEY('MAGX',MAGX ,1,'REAL') CALL FFKEY('MAGZ',MAGZ ,1,'REAL') CALL FFKEY('MOFF',MOFF ,3,'REAL') CALL FFKEY('RFLD',RFLD ,1,'REAL') ************************************************ * set defaults for magnetic field parameters * ************************************************ MAGT = 2 ! default - read from magnetic field map file RFLD = 0.0 ! uninitialized (zero) values MAGX = 0.0 MAGZ = 0.0 MOFF(1) = 0.0 ! default offset is zero MOFF(2) = 0.0 MOFF(3) = 0.0 *************************************** * Set defaults for event generators * *************************************** IRMUL = 1 ! multiplicity per event IRARM = 2 ! number of spectrometer arms (1 or 2) IRPID(1) = 0 ! particle type range: min (also used for GEN=4) IRPID(2) = 99 ! max RMOM(1) = 0.001 ! Production momentum: min RMOM(2) = 900.0 ! max RMOM(3) = 0.100 ! step (GEN=4) REXP = 0.350 ! Mean transverse momentum - falloff parameter RETA(1) = -20.0 ! eta range: min RETA(2) = 20.0 ! max RANG(1) = 20.0 ! polar angle range: min (GEN=4 only) RANG(2) = 60.0 ! max RANG(3) = 5.0 ! step RPHI(1) = -360.0 ! azimuth in mother system: min RPHI(2) = 360.0 ! max RROT = 15.0 ! Rhi rotation angle (GEN=5) RBXX = 0.0 ! Production position RBYY = 0.0 ! " " RBZZ = 0.0 ! " " RBXY = 0.0 ! Production intersection sigma RBDX = 0.0 ! Production position range RBDY = 0.0 ! " " " RBDZ = 0.0 ! " " " RSPX = 43.0 ! position of the spectrometer center (X) RSPZ = 43.0 ! " " " (Z) RSPR = 40.0 ! radius of the circle covering the spectrometer C ! used to set angle range ************************************** * Parameters for event generators * ************************************** CALL FFKEY('RMUL',IRMUL,1,'INTEGER') CALL FFKEY('RARM',IRARM,1,'INTEGER') CALL FFKEY('RPID',IRPID,2,'INTEGER') CALL FFKEY('RMOM',RMOM,3,'REAL') CALL FFKEY('REXP',REXP,1,'REAL') CALL FFKEY('RETA',RETA,2,'REAL') CALL FFKEY('RANG',RANG,3,'REAL') CALL FFKEY('RPHI',RPHI,3,'REAL') CALL FFKEY('RBXX',RBXX,1,'REAL') CALL FFKEY('RBYY',RBYY,1,'REAL') CALL FFKEY('RBZZ',RBZZ,1,'REAL') CALL FFKEY('RBXY',RBXY,1,'REAL') CALL FFKEY('RBDX',RBDX,1,'REAL') CALL FFKEY('RBDY',RBDY,1,'REAL') CALL FFKEY('RBDZ',RBDZ,1,'REAL') CALL FFKEY('RSPX',RSPX,1,'REAL') CALL FFKEY('RSPZ',RSPZ,1,'REAL') CALL FFKEY('RSPR',RSPR,1,'REAL') CALL FFKEY('RROT',RROT,1,'REAL') ************************************ * Set defaults for user flags * ************************************ HITSOUT = 0 !ascii hit output flag ISAOU = 0 ! ASCII output file with tracks and hits ISASC = 0 !ascii event output flag ISHBO = 0 !.HST plot binary output ISHDO = 0 !HISTDO print flag ISNTU = 0 !Ntuple file output flag IZEB = 0 !Zebra bank output flag ISECT = 0 !secondaries tracking IDRAW = 0 !control graphics output IGEN = 1 !event generator type IANAL = 1 !analysis type IPIXL = 0 !pixilated? WPIXL = 1.0 !chisq includes tracking WLOSS = 0.0 !chisq includes de/dx ************************* * Set user flags * ************************* CALL FFKEY('SAHO',HITSOUT,1,'INTEGER') CALL FFKEY('SAOU',ISAOU,1,'INTEGER') CALL FFKEY('SASC',ISASC,1,'INTEGER') CALL FFKEY('SHBO',ISHBO,1,'INTEGER') CALL FFKEY('SHDO',ISHDO,1,'INTEGER') CALL FFKEY('SNTU',ISNTU,1,'INTEGER') CALL FFKEY('SZEB',IZEB ,1,'INTEGER') CALL FFKEY('SECT',ISECT,1,'INTEGER') CALL FFKEY('DRAW',IDRAW,1,'INTEGER') CALL FFKEY('GEN ',IGEN ,1,'INTEGER') CALL FFKEY('ANAL',IANAL,1,'INTEGER') CALL FFKEY('PIXL',IPIXL,1,'INTEGER') CALL FFKEY('WPIX',WPIXL,1,'REAL') CALL FFKEY('WLOS',WLOSS,1,'REAL') **************************************************************** * CPU time limit test: * * TLIM 1 - program stops when estimated time is small * * TLIM 0 - program ignores time limit, for long queues * * always extremely underestimated (set to 2 hours)* **************************************************************** NTLIM = 0 CALL FFKEY('TLIM', NTLIM, 1, 'INTEGER') **************************************************************** * Set multi-pass event processing parameters in common MUPEP * * Defaults set in MUPEP.CDA: NTCO = 1000, NTPE = 20000 * **************************************************************** CALL FFKEY('NTCO', NtConc, 1, 'INTEGER') CALL FFKEY('NTPE', Ntpe, 1, 'INTEGER') NESKIP = 0 NTSKIP = 0 CALL FFKEY('NESK', NESKIP, 1, 'INTEGER') CALL FFKEY('NTSK', NTSKIP, 1, 'INTEGER') *********************************************************** * Set ntuple size options in common NTUEX * * Defaults set by NTUEX.CDA: NHTK = 60000, NTTK = 60000 * *********************************************************** CALL FFKEY('NHTK', NHtrks, 1, 'INTEGER') CALL FFKEY('NTTK', NMCtrks, 1, 'INTEGER') *********************************************************** * Call USCOM to enable the user to define extra commands *********************************************************** CALL USCOM ********************************************************************** * Open the standard control input file; iusrin < 0 means open failed ********************************************************************** +SELF,IF=NOSERV. call UFILE (0, 'RHDATA', iusrin, FileName) +SELF,IF=-NOSERV. call SERVER('RHDATA',IDRUN,iusrin,FileName,0,0,0,IRUN1,IRUN2) +SELF. **************************************************************************** * Read in the silicon positions and in-line histogram and scatterplot * * specifications. This is not done via FFKEY because of * * the limitations of FFREAD; we want multiple cards with the same keyword * * and we have to avoid overflowing the smallish FFREAD array sizes! * **************************************************************************** CALL VZERO(HCONTROL,9*NHMX) NHSTS = 0 20 READ(IUSRIN,'(A)',END=25) RECORD IF(RECORD(1:3) .EQ. 'END') GOTO 25 !exit on this or EOF IF(RECORD(1:1) .EQ. '*') GOTO 20 !skip comments CALL STPARS(RECORD,11,NFLDS,FIELD,LENFLD) !Melanson's parsing C Internal histogram keyword: IF(FIELD(1)(1:4).EQ.'HIST')THEN NHSTS = NHSTS+1 IF(NHSTS.GT.NHMX)NHSTS = NHMX HCONTROL(1,NHSTS) = STTORL(FIELD(2)(1:LENFLD(2))) IF(FIELD(3)(1:1).EQ.'#') THEN HCONTROL(2,NHSTS) = STTORL(FIELD(3)(2:LENFLD(3))) ELSE ITAG = 0 C Search for match to Ntuple tag: DO I = 1,NVTUP IF(FIELD(3).EQ.TAGS(I)) ITAG = I ENDDO HCONTROL(2,NHSTS) = FLOAT(ITAG) ENDIF C Non-default histogram parameters: IF(NFLDS.GT.3) THEN HCONTROL(3,NHSTS) = STTORL(FIELD(4)(1:LENFLD(4))) HCONTROL(4,NHSTS) = STTORL(FIELD(5)(1:LENFLD(5))) HCONTROL(5,NHSTS) = STTORL(FIELD(6)(1:LENFLD(6))) ELSE !default parameters HCONTROL(3,NHSTS) = 50.0 !Default number of bins HCONTROL(4,NHSTS) = 1.0 !Do automatic range selection HCONTROL(5,NHSTS) = 0.0 ENDIF HCONTROL(6,NHSTS) = 0.0 !Default if not scatterplot C Full scatterplot parameter set: IF(NFLDS.EQ.10)THEN IF(FIELD(7)(1:1).EQ.'#') THEN HCONTROL(6,NHSTS) = STTORL(FIELD(7)(2:LENFLD(7))) ELSE ITAG = 0 DO I = 1,NVTUP IF(FIELD(7).EQ.TAGS(I)) ITAG = I ENDDO HCONTROL(6,NHSTS) = FLOAT(ITAG) ENDIF HCONTROL(7,NHSTS) = STTORL(FIELD(8)(1:LENFLD(8))) HCONTROL(8,NHSTS) = STTORL(FIELD(9)(1:LENFLD(9))) HCONTROL(9,NHSTS) = STTORL(FIELD(10)(1:LENFLD(10))) ELSE HCONTROL(6,NHSTS) = 0.0 ENDIF ENDIF GOTO 20 25 REWIND IUSRIN !ready for GFFGO +SELF,IF=EUCARD. c Call EUCARD for interactive read dialogue if CARD$DEF file exists, c otherwise call GFFGO directly to read in control data +SELF,IF=NOSERV,IF=EUCARD. call UFILE (0, 'CARDS$DEF', icarddef, FileName) +SELF,IF=-NOSERVE,IF=EUCARD. call SERVER('CARDS$DEF',IDRUN,icarddef,FileName,0,0,0,IRUN1,IRUN2) +SELF,IF=EUCARD. if (icarddef .gt. 0) then CALL EUCARD else CALL FFSET ('LINP', iusrin) CALL GFFGO endif +SELF,IF=-EUCARD. c Call GFFGO to read in control data CALL FFSET ('LINP', iusrin) CALL GFFGO +SELF. ******************************************* * REMAINDER OF GEANT INITIALIZATION * ******************************************* CALL GZINIT CALL GPART !use standard list of particles c Define detector geometry and materials +SELF,IF=NOSERV. call UFILE (0, 'GCDEFS', iusrgcin, FileName) +SELF,IF=-NOSERV. call SERVER('GCDEFS',IDRUN,iusrgcin,FileName,0,0,0,IRUN1,IRUN2) +SELF. call UGCIN (iusrgcin, lurep, lstor, lline, storage, iugcres) if (jdebug .gt. 1) * write (lurep,'(a,i3)') ' UGINIT: UGCIN returned iugcres =', * iugcres c If the geometry file ends with UGC END i, UGCIN will return iugcres=i; c this was formerly used to call UGEOM with default geometry. if (iugcres .ne. 0) write(IUSROUT,*)'UGEOM removed 9/16/95' c Make diagnostic printout of all components of the detector if (jdebug .gt. 1) call GPRINT ('VOLU', 0) ********************** * Miscellaneous * ********************** IF(NDETS .NE. NSLP) THEN WRITE(IUSROUT,*) ' *** ERROR DETECTED BY UGINIT:', + ' NUMBER OF DETECTORS FOR WHICH PADS DATA ARE', + ' PROVIDED', NDETS WRITE(IUSROUT,*) ' DIFFERENT THAN THE DECLARED', + ' NUMBER OF DETECTORS (NPLANES =', NSLP, ' )' ENDIF IF(IPIXL .GT. 0) THEN WRITE(IUSROUT,*) ' *** ERROR DETECTED BY UGINIT:', + ' OBSOLETE PIXELIZATION MODE REQUESTED', IPIXL WRITE(IUSROUT,*) ' PIXELIZATION IS NOT SUPPORTED', + ' - THE REQUEST IS IGNORED' IPIXL = 0 ENDIF ISCAT = IMULS + 3*ILOSS + 9*IPIXL !track scattering type ISEQ = 0 !Used for IGEN = 4 IF(IRMUL.GT.MXMUL) THEN IRMUL = MXMUL WRITE(IUSROUT,*)' MULTIPLICITY CANNOT BE > ',IRMUL ENDIF c Open Ascii file (MAGT = 2 or 3) for the magnetic field map c or none (MAGT=0 no field, MAGT=1, dipole field) mapfile = ' ' if (MAGT .eq. 2 .or. MAGT .eq. 3) mapfile = 'FLDASC' +SELF,IF=NOSERV. if (mapfile .ne. ' ') call UFILE (0, mapfile, iusrmap, FileName) +SELF,IF=-NOSERV. if (mapfile .ne. ' ') 1 call SERVER(MAPFILE,IDRUN,iusrmap,FileName,0,0,0,IRUN1,IRUN2) +SELF. C Define user histograms CALL USINIT C Open ZEBRA output file IF(IZEB.NE.0) THEN +SELF,IF=NOSERV. CALL UFILE (0, 'RHZEB', IUSRZEB, FileName) +SELF,IF=-NOSERV. CALL SERVER('RHZEB',IDRUN,IUSRZEB,FileName,1,0,1,IRUN1,IRUN2) +SELF. CALL GOPEN(IUSRZEB,'O',2440,IER) IF(IER.NE.0) WRITE(IUSROUT,*)' IN UGINIT, GOPEN IER= ',IER ENDIF C Energy loss and cross-sections initialisations CALL GPHYSI C output header lines in ASCII output IF(ISASC.NE.0) THEN CALL DATIMH(HDATE, HTIME) WRITE(IUSROUT,1000) HDATE, HTIME 1000 FORMAT(' GPH DETECTOR VERSION 2 ',2A4,', ',2A4) ENDIF IF(ISAOU .NE. 0) THEN ! open AOU file and write the header +SELF,IF=NOSERV. call UFILE (0, 'RHAOU', iusraou, FileName) +SELF,IF=-NOSERV. CALL SERVER('RHAOU', IDRUN,IUSRAOU,FILENAME,0,0,1,IRUN1,IRUN2) +SELF. WRITE(IUSRAOU, '('' * PMC simulations ASCII OUTPUT file'')' ) CALL DATIMH(HDATE, HTIME) WRITE(IUSRAOU, '('' * Date and time: '', 2A4, 2X, 2A4)' ) + HDATE, HTIME WRITE(IUSRAOU, '('' * '')' ) WRITE(IUSRAOU, '('' * PMC version:'', F15.3)' ) SIMVER WRITE(IUSRAOU, '('' * GEANT version:'', F15.3)' ) GVERSN WRITE(IUSRAOU, '('' * ZEBRA version:'', F15.3)' ) ZVERSN WRITE(IUSRAOU, '('' * '')' ) WRITE(IUSRAOU, '('' * Geometry version'')' ) WRITE(IUSRAOU, '('' G GEOV '', F10.3)' ) GEOV CALL PH_GEOM WRITE(IUSRAOU, '('' * '')' ) WRITE(IUSRAOU, '('' * Run number, random numbers '')' ) WRITE(IUSRAOU, '('' S RUNG '', I10)' ) IDRUN WRITE(IUSRAOU, '('' S RNDM '', 2I10)' ) NRNDM(1), NRNDM(2) APOSTR = '''' IF(NSAVE .GT. 0) WRITE(IUSRAOU, 7700) 'SAVE', + (APOSTR,LSAVE(I),APOSTR, I=1,NSAVE) IF(NSETS .GT. 0) WRITE(IUSRAOU, 7700) 'SETS', + (APOSTR,LSETS(I),APOSTR, I=1,NSETS) 7700 FORMAT(' S ', A4, 20(1X, A1, A4, A1) ) WRITE(IUSRAOU, '('' * '')' ) WRITE(IUSRAOU, '('' * Simulation parameters'')' ) WRITE(IUSRAOU, '('' S SECT '', I10)' ) ISECT WRITE(IUSRAOU, '('' S RPID '', 2I10)' ) IRPID WRITE(IUSRAOU, '('' S RMOM '', 3F10.4)' ) RMOM WRITE(IUSRAOU, '('' S RETA '', 2F10.4)' ) RETA WRITE(IUSRAOU, '('' S RPHI '', 3F10.4)' ) RPHI WRITE(IUSRAOU, '('' S RANG '', 3F10.4)' ) RANG WRITE(IUSRAOU, '('' S RARM '', I10)' ) IRARM WRITE(IUSRAOU, '('' S RMUL '', I10)' ) IRMUL WRITE(IUSRAOU, '('' S REXP '', F10.4)' ) REXP WRITE(IUSRAOU, '('' S RSPX '', F10.4)' ) RSPX WRITE(IUSRAOU, '('' S RSPZ '', F10.4)' ) RSPZ WRITE(IUSRAOU, '('' S RSPR '', F10.4)' ) RSPR WRITE(IUSRAOU, '('' S RROT '', F10.4)' ) RROT WRITE(IUSRAOU, '('' * Vertex'')' ) WRITE(IUSRAOU, '('' S RBXX '', F10.4)' ) RBXX WRITE(IUSRAOU, '('' S RBYY '', F10.4)' ) RBYY WRITE(IUSRAOU, '('' S RBZZ '', F10.4)' ) RBZZ WRITE(IUSRAOU, '('' S RBDX '', F10.4)' ) RBDX WRITE(IUSRAOU, '('' S RBDY '', F10.4)' ) RBDY WRITE(IUSRAOU, '('' S RBDZ '', F10.4)' ) RBDZ WRITE(IUSRAOU, '('' S RBXY '', F10.4)' ) RBXY WRITE(IUSRAOU, '('' * Geant parameters'')' ) WRITE(IUSRAOU, '('' S ANNI '', I10)' ) IANNI WRITE(IUSRAOU, '('' S BREM '', I10)' ) IBREM WRITE(IUSRAOU, '('' S COMP '', I10)' ) ICOMP WRITE(IUSRAOU, '('' S DCAY '', I10)' ) IDCAY WRITE(IUSRAOU, '('' S DRAY '', I10)' ) IDRAY WRITE(IUSRAOU, '('' S HADR '', I10)' ) IHADR WRITE(IUSRAOU, '('' S MULS '', I10)' ) IMULS WRITE(IUSRAOU, '('' S LOSS '', I10)' ) ILOSS WRITE(IUSRAOU, '('' S PAIR '', I10)' ) IPAIR WRITE(IUSRAOU, '('' S PFIS '', I10)' ) IPFIS WRITE(IUSRAOU, '('' S PHOT '', I10)' ) IPHOT WRITE(IUSRAOU, '('' S RAYL '', I10)' ) IRAYL WRITE(IUSRAOU, '('' S CUTS '', 5F10.6)' ) + CUTGAM, CUTELE, CUTNEU, CUTHAD, CUTMUO WRITE(IUSRAOU, '('' * Run controls '')' ) WRITE(IUSRAOU, '('' S ANAL '', I10)' ) IANAL WRITE(IUSRAOU, '('' S PIXL '', I10)' ) IPIXL WRITE(IUSRAOU, '('' S WPIX '', F10.4)' ) WPIXL WRITE(IUSRAOU, '('' S WLOS '', F10.4)' ) WLOSS WRITE(IUSRAOU, '('' S SAHO '', I10)' ) HITSOUT WRITE(IUSRAOU, '('' S SAOU '', I10)' ) ISAOU WRITE(IUSRAOU, '('' S SASC '', I10)' ) ISASC WRITE(IUSRAOU, '('' S SHBO '', I10)' ) ISHBO WRITE(IUSRAOU, '('' S SHDO '', I10)' ) ISHDO WRITE(IUSRAOU, '('' S SNTU '', I10)' ) ISNTU WRITE(IUSRAOU, '('' S SZEB '', I10)' ) IZEB WRITE(IUSRAOU, '('' S NHTK '', I10)' ) NHTRKS WRITE(IUSRAOU, '('' S NTTK '', I10)' ) NMCTRKS WRITE(IUSRAOU, '('' * Generation mode'')' ) WRITE(IUSRAOU, '('' S GEN '', I10)' ) IGEN WRITE(IUSRAOU, '('' S NTCO '', I10)' ) NTCONC WRITE(IUSRAOU, '('' S NTPE '', I10)' ) NTPE ENDIF RETURN END +DECK,UGLAST. *CMZU: 2.01/00 07/02/97 13.58.40 by K.Wozniak *CMZU: 2.00/09 31/07/96 17.32.04 by Phobos (R. Verdier) *CMZU: 2.00/08 25/07/96 15.33.33 by Phobos (R. Verdier) *CMZU: 2.00/02 05/04/96 13.35.23 by Phobos (R. Verdier) *CMZU: 1.01/02 05/05/94 13.48.57 by R. Verdier *-- Author : C====================== SUBROUTINE UGLAST C====================== C C Description:- C ============= C User termination routine called at end of run. C Optionally prints run control cards. C Called by KUEXIT or UGCONB. C Calls USLAST, GLAST, GCLOSE; SERVPR C C Arguments:- C =========== C none C C Implicit inputs, outputs, side effects:- C ======================================== C izeb control switch from common FLAG C C Author: D. McLeod C ======= C C Creation Date: 28-Mar-1992 C =========================== C C Revisions: C ========== C Date Name Description C --------- ------- -------------------------------------------- C C 7 Feb 97 K.W. GCNUM sequence added (a variable was undefined) C 31 Jul 96 R. V. Select STAT call only on SUN C 25 Jul 96 R. V. Remove unreferenced IERR C 14 Oct 95 DMcL Remove obsolete control card file printout; C the relevant unit (4) was no longer opened! C Added server file and general info printout C Corrected error in GCLOSE call! C 5 May 94 R. V. Include FLAG to define izeb C 23 Oct 92 R. V. Separated from GE_... C 22 Jul 92 RV Restore declaration of CARD C 1 Jun 92 C. Parsons Moved from GPH into GE_ALL_THE_REST +SEQ, FLAG. +SEQ, FLAG2. +SEQ, GCFLAG. +SEQ, GCNUM. +SEQ, GCKINE. C LOCAL: INTEGER LOUT/6/ INTEGER IER, I, NDH(2), NTH(2), STATB(13) CHARACTER*13 CSTATUS CHARACTER*24 LKTIME, CTIME INTEGER STEND, LENOCC, STAT EXTERNAL STEND EXTERNAL LENOCC EXTERNAL CTIME EXTERNAL STAT C------------------------------------------------------------------------- CALL USLAST C Print job statistics CALL GLAST C Finish bank output IF(IZEB.NE.0) THEN CALL GCLOSE(USRZEB,IER) ENDIF C Print final summary of the run CALL DATIMH (NDH, NTH) +SELF,IF=UNIX. LKTIME = ' ' +SELF,IF=UNIX,IF=SUN. C Determine when the SIM executable was generated: IERR = STAT( ROOTPATH(1 : LENOCC(ROOTPATH))// * ROOTVERS(1 : LENOCC(ROOTVERS))//'/exe/sim.exe', STATB) IF(IERR.NE.0) WRITE(LOUT,*)' Error in uglast UNIX STAT call' LKTIME = CTIME(STATB(10)) +SELF,IF=UNIX. C The following is meaningful only for UNIX systems: IF( IPSIG .EQ. 1) THEN CSTATUS = 'stopped early' ELSE CSTATUS = 'all completed' ENDIF C +SELF. +SELF,IF=-NOSERV. WRITE(LOUT,100) SERNAME(1:STEND(SERNAME)), (NDH(I),I=1,2), * (NTH(I),I=1,2),CSTATUS,IDRUN, * NTMULT,IEVENT,NEVENT,SIMVER,LKTIME C C Print the locations of the files used in this run (SERVPR) CALL SERVPR(' ****** FILES USED FOR DATA AND OUTPUT:') C +SELF. RETURN 100 FORMAT(3X,76('*'),/,3X,'* PHOBOS SIM run ',A,' on ', * 2A4,', ',2A4,', ',A13, T79,'*',/,3X, *'* Run # ',I4,', did ',I5,' tracks (primaries and secondaries)' * ,T79,'*',/,3X,'* on last event (# ',I4,') out of ', * I3,' events requested.',T79,'*', * /,3X,'* SIM version ',F5.2, * ' linked on ',A,T79,'*',/,3X,76('*'),/) END +DECK,UHITSOUT. *CMZU: 2.02/00 17/03/97 12.15.11 by K. Wozniak *CMZU: 2.00/02 05/04/96 13.43.46 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : subroutine UHITSOUT (MODE, HITS, IP, ITRACK, IPARTYP) *Documentation_Block ************************************************************************ * * Description: * User routine called at the end of each tracking step to record hits * on the detector planes in an ASCII file for tracking studies * * Arguments: * *MODE 1 to write hits, 2 to write vertex at end (input) * *HITS True hits (intercepts on detector plane) (input) * *IP Plane ID (input) * *ITRACK Geant track # (input) * *IPARTYP Geant particle type code (input) * * Called by: * PH_HIT * * Calls: * none * * Implicit inputs, outputs, side effects: * Input and output variables in commons included below; * Data written to dataset with logical name 'HITSOUT' * * History: * Date Name Description * ---- ---- ----------- * 4-Mar-97 K.W. routine to be removed - removed code * 27-Jul-95 DMcL changed UFILE to SERVER for UNIX port etc. * 12-Feb-93 GSFS Corrected reformatting of pads to I5 * Deleted unnecessary code from Chuck's start at track * reconstruction. * 10-Feb-93 R. V. Added Mode arg to write vertex at end and * iostat to avoid abend on write error; * reformat pad numbers to i5 * 12-Jan-93 R. V. Added FileName * 15-Dec-92 Robin Verdier Moved into UHITSOUT, called by PH_HIT * 11-Aug-92 Chuck Parsons Creation as MY_HIT, a version of PH_HIT ************************************************************************ *End_Documentation_Block IMPLICIT NONE REAL HITS(9) INTEGER IP, IPARTYP, ITRACK, MODE return end +DECK,USANAL. *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USANAL *Documentation_Block ************************************************************************ * * Description: * User additional analysis, usually on elements of Ntuple * with output to extra entries at end of Ntuples * This version is a dummy * * Arguments: * none * * Called by: * PH_OUT * * Calls: * none * * Implicit inputs, outputs, side effects: * none * * History: * Date Name Description * ---- ---- ----------- * 12-Jan-93 R. V. COMMON.NTU & COMMON.HST -> NTU.CMN & HST.CMN * 19-Nov-92 R. Verdier Separated from PH_OUT * Apr-92 D. Mcleod Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE +SEQ, FLAG. !control words and flags +SEQ, IO. !I/O channels etc. +SEQ, RHSYS. !PHOBOS detector general parameters +SEQ, NTU. !Ntuple structure +SEQ, RHSIL. !Detector module parameters +SEQ, GCFLAG. !GEANT flags C LOCAL: none RETURN END +DECK,USINIT. *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USINIT *Documentation_Block ************************************************************************ * * Description: * User interface routine to be called once at the begining of a run * for booking histograms etc. * * Arguments: * none * * Called by: * UGINIT * * Calls: * PH_INIT * * Implicit inputs, outputs, side effects: * via listed COMMONs * * History: * Date Name Description * ---- ---- ----------- * 30-Jun-92 R. Verdier Add call to PH_INIT * 10-Jun-92 C. Parsons Creation of dummy version ************************************************************************ *End_Documentation_Block IMPLICIT NONE C C Executable Statements C ===================== C call PH_INIT RETURN END +DECK,USLAST. *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USLAST *Documentation_Block ************************************************************************ * * Description: * User routine called once at end of run. * * Arguments: * none * * Called by: * GUOUT * * Calls: * PH_LAST * * Implicit inputs, outputs, side effects: * inputs: GEANT common blocks containing info on current event * * History: * Date Name Description * ---- ---- ----------- * 30-Jun-92 R.Verdier Added call to PH_LAST * 10-Jun-92 Chuck Parsons Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE call PH_LAST RETURN END +DECK,USOUT. *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USOUT *Documentation_Block ************************************************************************ * * Description: * User routine called once at the end of each event. * * Arguments: * none * * Called by: * GUOUT * * Calls: * PH_OUT * * Implicit inputs, outputs, side effects: * inputs: GEANT common blocks containing info on current event * * History: * Date Name Description * ---- ---- ----------- * 27-Jun-92 R.Verdier Added call to PH_OUT * 10-Jun-92 Chuck Parsons Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE call PH_OUT RETURN END +DECK,USSTEP. *CMZU: 2.00/14 21/11/96 14.55.55 by K. Wozniak *CMZU: 2.00/08 25/07/96 13.55.28 by Phobos (R. Verdier) *CMZU: 2.00/06 21/07/96 22.05.42 by Phobos (R. Verdier) *CMZU: 2.00/03 01/07/96 16.58.59 by K.Wozniak *CMZU: 2.00/02 08/07/96 15.30.45 by Phobos (R. Verdier) *CMZU: 1.01/19 16/05/95 14.55.42 by Phobos (R. Verdier) *CMZU: 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USSTEP *Documentation_Block ************************************************************************ * * Description: * User extension to handle produced secondary tracks. * * This version creates banks in the JKINE and JVERT data structures for * no, selected, or all tracks, depending on the control variable ISECT * set by a SECT control statement: * SECT 0 drops all secondaries. * SECT 1 tracks all secondaries but creates VERT and KINE banks for all * primary tracks and for secondary tracks that produce at least one * HIT. * SECT 2 tracks and creates VERT and KINE banks for all tracks. * Additional user words, defined in UJKBUF.CMN, are also stored * in the user KINE bank extension. * * Arguments: * none * * Called by: * GUSTEP once for each step before returning * * Calls: * GSKINE to create track banks, GSVERT to create vertex banks, GSKING * to put newly created secondaries on the tracking stack JSTAK, * MZGARB to release unused space in the storage division containing KINE * * Implicit inputs, outputs, side effects: * inputs: GEANT common blocks contain info on current particle * outputs: entries in VERT, KINE and STAK data structures * * History: * Date Name Description * ---- ---- ----------- * 20-Nov-96 K. W. In SECT=1 mode the origin volume name is set to 0 * for secondaries in place of the name of detector hit * (which is current volume when the particle is stored) * The name of the origin volume has to be retrieved later * 21-Jul-96 R. V. Removed unused id, ip, jst, mm, stdout * 1-JUL-96 K. W. Correct position of the last point on the * trajectory stored in the KINE bank * 08-Jul-96 R. V. IMPLICIT NONE restored [?], format string con- * tinued across line fixed, ios SAVEd * 16-May-95 K. W. IFLG(nn) = ITRA => 0 before GSKING call for * SECT=2, reqired by Geant 3.21, reason unknown * 31-Mar-95 R.V. Change STRA to SECT to avoid GEANT 3.21 conflict * 18-Jul-94 K. Wozniak IUBuf(1) -> KCASE, UBuf(11) -> ISTOP * 18-Jul-94 RV Implement STRA = 1 to make KINE banks only for * tracks that produce hits; add call to MZGARB; * save # hits on track in common /UJKB/; * replace PSKING call by inline code for clarity * 1-Nov-93 R. V. Move NtTot update from GUOUT in case STRA = 1 * 11-Jun-93 MDB Implement STRA=0; make FLAGS available * 14-May-93 R. V. Multipass mods: NtTot, MUPEP.CMN * 3-Jul-92 RV Move into USSTEP; call PSKING; change GCBANK * expansion * 30-Jun-92 RV Added call to PH_HIT * 18-Jun-92 RV Dump only at end of event * 6-Jun-92 RV Store secondaries in the JKINE structure, with * final kinematics and parent track index * 27-May-92 R.Verdier Original GUSTESI using separate stack * 10-Jun-92 Chuck Parsons Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE c Should the following be declared here, or in the main program? C C Declare minimum size GEANT common. True size of the GEANT common is C determined by the GCBANKSIZE shareable image. The linker will give an C error message if it is less than this value. C integer nwgean real geant PARAMETER (NWGEAN=300000) c* Following changed 4-Jul-92 to avoid overriding the GCBANK layout (RV): c* COMMON/GCBANK/GEANT(NWGEAN) equivalence (GEANT, NZEBRA) c* End of mod C C C integer npaw,nwpaw PARAMETER(NPAW=100000) C This declares the MINIMUM size of the PAWC common via the array NWPAW. C true size is declared via PAWCSIZE shareable image. C COMMON/PAWC/NWPAW(NPAW) C C The GEANT fixed size commons. C +SEQ,GCBANK. +SEQ,GCFLAG. +SEQ,GCKINE. +SEQ,GCKING. +SEQ,GCNUM. +SEQ,GCSETS. +SEQ,GCSTAK. +SEQ,GCTRAK. +SEQ,GCVOLU. +SEQ,IO. +SEQ,MUPEP. +SEQ,UJKBUF. +SEQ,FLAG. c The following, copied from ZEBRA.CAR, is used only for diagnostics COMMON /MZCC/ mzskip(58), LQSTA(21), LQEND(20), NQDMAX(20) integer mzskip, LQSTA, LQEND, NQDMAX C C Local definitions: C ================== C c Local control. Diagnostic level, Debuglev, should be externally c controlled; LUD should be assigned to a separate unit integer Debuglev /1/ ! diagnostic printout level, none if 0 integer LUD /6/ ! diagnostic printout logical unit integer Newtl /50/ ! write tracklist every newtl events ! if debugging integer SaveSec /2/ ! see SECT above; this is the default c Temporaries for GEANT calls: integer Itl, jk, jku, Nnew, Nt, Nvtx c Variables for user buffer display and diagnostic print: integer ios, ipa, Iparent, ll, Nfw, nn, Ntact, NUBW real PhiPFi, PhiPIn, PIn(4), RIn(3), ThePFi, ThePIn real DegRad /57.2958/ save ios c Initialization flag: integer IevPrev/-1/ save IevPrev c Local storage for temporarily saving the cumulative ID's of tracks c until we decide to create permanent VERT and KINE banks for c them. Note the cumulative ID is used only for diagnostics: integer NltsLim parameter (NltsLim = 200) integer ItStack, Nlts, NltsMax integer IdCum, IdCums(NltsLim) c Saved starting values of r and p for active track real Pinit(6) c Saved parent track number, particle type, and # of active track integer IpaSave, IpSave, ITRASave c Saved cumulative id of active track integer IdcAct c Index of division containing KINE banks, for garbage collection integer Idiv_KINE /2/ C Executable Statements C ===================== C c Initialize active track count and # final writes when the event c sequence number changes. if (Ievent .ne. IevPrev) then if (ISECT.ge.0 .and. ISECT.le.2) SaveSec=ISECT Nfw = 0 ! Clear # final writes if (debuglev .ge. 2) 1 write (LUD,*) ' USSTEP: starting event ', Ievent c Initialize the user words for the primary tracks, which are c already stored in the JKINE structure. do Itl = 1, NTRACK jk = LQ(JKINE-Itl) if (jk .gt. 0) then jku = LQ(jk-1) if (jku .gt. 0) then do nn = 1, Nwubmax Q(jku+nn) = 0. enddo IQ(jku+3) = NAMES(NLEVEL) endif ! jku endif ! jk enddo ! Itl c If in SaveSec = 1 mode, force the division containing the KINE c structure, which initially is allocated all unused ZEBRA space, to c give up its unused space. This keeps the 1st attempt to add a c generated track to the tracking stack from aborting on insufficient c space. Apparently if the first expansion is done by GSVERT, as c in SaveSec = 2, the garbage collection is performed automatically. if (Debuglev .ge. 4) 1 write (LUD,*) ' USSTEP: div limits: 1=', LQSTA(1), '-', 2 LQEND(1), ', 2=', LQSTA(2), '-', LQEND(2), ', 19=', 3 LQSTA(19),'-',LQEND(19), ', 20=', LQSTA(20),'-',LQEND(20) if (Idiv_KINE .ne. 0 .and. SaveSec .eq. 1) 1 CALL MZGARB (Idiv_KINE, 0) if (Debuglev .ge. 4) 1 write (LUD,*) ' USSTEP: div limits: 1=', LQSTA(1), '-', 2 LQEND(1), ', 2=', LQSTA(2), '-', LQEND(2), ', 19=', 3 LQSTA(19),'-',LQEND(19), ', 20=', LQSTA(20),'-',LQEND(20) Ntact = NTRACK IdCum = NtPrev + Ntact Nlts = 0 NltsMax = 0 IevPrev = Ievent endif ! Ievent c Save the starting position, momentum and ID of each track in case c we need to create VERT and KINE banks for it. The track belongs to c KINE bank # ITRA if ISTAK = 0, else to the ISTAKth entry (-1?) in c the temporary stack if (NSTEP .eq. 0) then c Update the active Id and # of entries in the local tracking storage. c Clear the number of hits on the active track NHitsAct = 0 do nn = 1, 3 Pinit(nn) = VECT(nn) Pinit(nn+3) = VECT(nn+3) * VECT(7) enddo c Debug: write track starting information if (Nlts .eq. 0) then IdcAct = NtPrev + ITRA else IdcAct = IdCums(Nlts) Nlts = Nlts - 1 endif if (Debuglev .ge. 4) then if (ISTAK .ne. 0) IpaSave = -IpaSave IpaSave = ITRA IpSave = IPART write (LUD,'(2(a,i6),a,i3,4(a,f7.2))', iostat=ios) 1 ' USSTEP: IDc=', IdcAct, ', ipa=', IpaSave, 2 ', ip=', IpSave, ', r=(', VECT(1), ',', VECT(2), 3 ',', VECT(3), '), p=', VECT(7) endif c TEMPORARY debug: check that particle type agrees with the currently c active entry on the tracking stack ItStack = IQ(JSTAK+1) + 1 if (IPART .ne. IQ(JSTAK + NWSTAK * ItStack - 7)) then if (Debuglev .ge. 1) write (LUD,'(2(a,i3))', iostat=ios) 1 ' USSTEP: error, IPART =', IPART, 2 ', ip saved from tracking stack =', 3 IQ(JSTAK + NWSTAK * ItStack - 7) endif endif ! NSTEP c If the current track is in a sensitive detector and is for a c charged particle if (ISET .ge. 1 .and. CHARGE .ne. 0.) then c On entry, if (INWVOL .eq. 1) then c Update its number of hits NHitsAct = NHitsAct + 1 c Create new VERT and KINE banks if none existed and SaveSec = 1 if (ISTAK .ne. 0 .and. SaveSec .eq. 1 1 .and. NHitsAct .eq. 1) then call GSVERT (Pinit, 0, ITRA, 0, 0, Nvtx) c Debug: error message if vertex creation failed if (Nvtx .le. 0 .and. Debuglev .ge. 1) 1 write (LUD,'(a,i6)', iostat=ios) 2 ' USSTEP: error creating vertex for stack track #', 3 ISTAK c Init user buffer. Negate parent track # to indicate that one or c more secondary tracks were created since the primary track call UZERO(UBuf, 1, Nwubmax) IUBuf(1) = KCASE UBuf(2) = -(ITRA + NtPrev) IUBuf(3) = 0 ! origin volume of secondary is not the name C ! of the current volume (detector hit) C ! to avoid changes of GEANT volume tree C ! a flag indicates that the name have to be C ! retrieved later (if needed) call GSKINE (Pinit(4), IPART, NVtx, UBuf, Nwubmax, Nt) c Set ITRA to connect the current track with its new KINE bank ITRA = Nt c Clear ISTAK to identify this track as having a KINE bank ISTAK = 0 c Debug: note created banks if level >= 3 if (Debuglev .ge. 3) 1 write (LUD,'(4(a,i6))', iostat=ios) 2 ' USSTEP: created vertex', Nvtx, ', KINE bank', Nt, 3 ' for IDc = ', IdcAct, ', ip=', IPART endif ! ISTAK .ne. 0 ... endif ! INWVOL .eq. 1 c Call PH_HIT to create a HITS bank and store hit information in it. call PH_HIT() endif ! ISET .ge. 1 ... c If current track interacted or stopped, and has a KINE bank, enter c terminal information from GCTRAK and GCKINE into the user part if (Istop .ne. 0) then if (ISTAK .eq. 0 .or. SaveSec .eq. 2) then jk = LQ(JKINE-ITRA) if (jk .gt. 0) then jku = LQ(jk-1) if (jku .gt. 0) then c Bookkeeping check: does the stopped track have the correct c particle type? if (INT(Q(jk+5)) .ne. IPART .and. Debuglev .ge. 1) 1 write (LUD,'(2(a,i3))',iostat=ios) 2 ' USSTEP: error, IPART=', IPART, ', active ptype=', 3 INT(Q(jk+5)) c Save stop flag, final position, momentum, and total energy in the c user extension to the KINE bank do nn = 1, 3 Q(jku+nn+3) = VECT(nn) Q(jku+nn+6) = VECT(7) * VECT(nn+3) enddo Q(jku+10) = GETOT Q(jku+11) = ISTOP endif ! jku endif ! jk endif ! ISTAK Ntact = Ntact - 1 endif ! Istop c Process any secondary tracks produced in this step and update counts. c Note the id's printed out here are not necessarily correct, since c the new tracks may have kine banks created later, or be discarded. c Option: bypass processing if SaveSec is 0 if (SaveSec .eq. 0) go to 100 Nnew = NGKINE if (Nnew .gt. 0) then if (debuglev .ge. 4) then write (LUD,'(a,2(i4,a),z8,a)', iostat=ios) 1 ' USSTEP: step ', nstep, 2 ' found', Nnew, ' secondary tracks produced by mech. ', 3 KCASE, ':' do nn = 1, Nnew ipa = GKIN(5,nn) write (LUD,'(2(a,i5),a,f8.3,a,3f8.3)',iostat=ios) 1 ' Id=', NtTot+nn, ', ip=', ipa, 2 ', E=', GKIN(4,nn), ', p=', (GKIN(ll,nn), ll = 1, 3) end do endif if (SaveSec .eq. 1) then c If SaveSec = 1, call GSKING to put the track on the tracking stack; c we will create KINE and VERT banks later, if the track produces hits c Limit saved tracks to available local storage if (Nlts + Nnew .gt. NltsLim) then if (debuglev .ge. 1) then write (LUD, '(3(a,i6))',iostat=ios) ' USSTEP: error,', 1 Nlts, ' tracks on stack, saved', NltsLim - Nlts, 2 ' of requested', Nnew endif Nnew = MAX(NltsLim - Nlts, 0) endif do nn = 1, Nnew IdCums(Nlts + nn) = NtTot + nn c Set flag to 0 so GSKING will not create a new KINE bank IFLGK(nn) = 0 call GSKING(nn) end do Nlts = Nlts + Nnew NltsMax = MAX(Nlts, NltsMax) else if (SaveSec .ge. 2) then c If SaveSec = 2, create a new vertex for the secondaries at the c current point; the vertex index, Nvtx, is returned by GSVERT. c Create KINE banks for all the secondary tracks in the JKINE c structure, adding space for user words to contain stop flag, c parent id, and final kimematics. Also put the new tracks on the c tracking stack, where they will be picked up and propagated AFTER c the current track has stopped or decayed. c At this point we could set IFLGK < 0 for low energy tracks and c neutrinos to save time by discarding them. call GSVERT (VECT, 0, ITRA, 0, 0, Nvtx) ITRASave = ITRA do nn = 1, Nnew call UZERO(UBuf, 1, Nwubmax) IUBuf(1) = KCASE UBuf(2) = ITRASave + NtPrev IUBuf(3) = Names(NLevel) c Create a KINE bank for the new track call GSKINE (GKIN(1,nn), INT(GKIN(5,nn)), NVtx, UBuf, 1 Nwubmax, Nt) c Create a tracking stack entry for the new track ITRA = Nt IFLGK(nn) = 0 call GSKING(nn) end do ! nn ITRA = ITRASave if (debuglev .ge. 6) then c Debug: print space points for all tracks and tracking and physics c parameters after the current step write (LUD,'(a)') ' USSTEP: GPJXYZ(0) output:' call GPJXYZ(0) write (LUD,'(a)') ' USSTEP: GPCXYZ output:' call GPCXYZ endif endif ! SaveSec NtTot = NtTot + Nnew Ntact = Ntact + Nnew endif ! Nnew .gt. 0 100 continue c Debug: display current track at each step if (debuglev .ge. 5) then if (mod(Nstep,10) .eq. 0) ! NB-- this restarts for each track 1 write (LUD,'(12a)') ' St#', ' Ip', ' x', ' y', 2 ' z', ' tx', ' ty', ' tz', ' p', 3 ' dE', ' Stp', ' Mec' write (LUD,'(2i4,3f7.2,3f7.3,2f8.3,2i4)', iostat=ios) 1 Nstep, Ipart, (Vect(nn), nn=1,7), DeStep, Istop, Nmec endif c Debug: write out final track list every Newtl events c (this should be a user exit call) if (Debuglev .ge. 2 .and. NTRACK .gt. 0 .and. Nfw .eq. 0 .and. 1 mod(Ievent,Newtl) .eq. 0 .and. Ntact .eq. 0) then write (LUD,'(a,3(i6,a))') ' USSTEP: The track list for event', 1 Ievent, ' now has', NTRACK, ' total entries,', Ntact, 2 ' active.' write (LUD,'(10a)') 1 ' Id', ' Ip', ' ', 'Idpar', ' E', 2 ' x', ' y', ' z', ' Thetap', ' Phip' do Itl = 1, NTRACK call GFKINE(Itl, RIn, PIn, ipa, Nvtx, UBuf, NUBW) if (PIn(1) .ne. 0. .or. PIn(2) .ne. 0. 1 .or. PIn(3) .ne. 0.) then ThePIn = atan2(sqrt(PIn(1)**2 + PIn(2)**2), PIn(3)) else ThePIn = 0. endif if (PIn(1) .ne. 0. .or. PIn(2) .ne. 0.) then PhiPIn = atan2(PIn(2), PIn(1)) else PhiPIn = 0. endif if (UBuf(7) .ne. 0. .or. UBuf(8) .ne. 0. 1 .or. UBuf(9) .ne. 0.) then ThePFi = atan2(sqrt(UBuf(7)**2 + UBuf(8)**2), UBuf(9)) else ThePFi = 0. endif if (UBuf(7) .ne. 0. .or. UBuf(8) .ne. 0.) then PhiPFi = atan2(UBuf(8), UBuf(7)) else PhiPFi = 0. endif Iparent = UBuf(2) write (LUD,'(1x,i6,i6,1x,2a4,i5,f8.3,3f7.2,2f7.1 /'// 1 '7x,a8,i6,a1,5x,f8.3,3f7.2,2f7.1)', iostat=ios) 2 Itl + NtTot, ipa, (IQ(LQ(JPART-ipa)+ll), ll=1,2), 3 Iparent, PIn(4), (RIn(nn), nn=1,3), 4 DegRad * ThePIn, DegRad * PhiPIn, 5 'at stop', int(UBuf(1)), ':', UBuf(10), 6 (UBuf(nn+3), nn=1,3), DegRad * ThePFi, 7 DegRad * PhiPFi enddo ! Itl endif ! Debuglev + ... return end +DECK,UNSATREFS. *CMZU: 2.00/08 25/07/96 13.48.15 by Phobos (R. Verdier) *CMZU: 1.01/17 19/04/95 15.34.48 by R. Verdier *-- Author : subroutine UNSATREFS *Documentation_Block ************************************************************************ * * Description: * UNSATREFS satisfies undefined linker references to avoid meaningless * error warnings for unused GEANT subroutine references. * It should be included explicitly it the end of the link. * * THIS SUBROUTINE SHOULD BE ELIMINATED WHEN CERN LIBRARIES ARE * STRAIGHTENED OUT. * * History: * Date Name Description * ---- ---- ----------- * 25-Jul-96 R. V. ")," -> ")" in writes for ANSI compliance * 19-Apr-92 R. Verdier Creation ************************************************************************ *End_Documentation_Block implicit none c Local declarations: c Names of unsatisfied references as of Geant 3.21 and Cernlib 94b: character*16 names(4) / 'CTL$GL_PCB', 'CTL$T_ACCOUNT', 1 'CTL$T_USERNAME', 'QNEXT' / c Idebug = 0 for no output, 1 to warn if called, 2 to stop integer idebug /2/, ie, ios, lun /6/, ncalls(4) / 4 * 0 / c End of declarations entry CTL$GL_PCB ie = 1 goto 10 entry CTL$T_ACCOUNT ie = 2 goto 10 entry CTL$T_USERNAME ie = 3 goto 10 entry QNEXT ie = 4 10 ncalls(ie) = ncalls(ie) + 1 if (idebug .ge. 1) then if (ncalls(ie) .le. 10) write (lun,'(3a)',iostat=ios) 1 ' UNSATREFS: ', names(ie), ' unexpectedly called.' if (ncalls(ie) .eq. 10) write (lun,'(a)',iostat=ios) 1 ' Additional warnings will be suppressed.' if (idebug .ge. 2) stop ' UNSATREFS: quit on unexpected call.' endif return end +DECK,USCOM. *CMZU: 1.01/17 20/03/95 14.53.13 by K.Wozniak *CMZ : 1.01/06 13/05/94 06.18.39 by K.Wozniak *CMZ : 1.00/00 17/12/93 07.30.09 by Phobos *-- Author : SUBROUTINE USCOM *Documentation_Block ************************************************************************ * * Description: * User interface routine to be called once at the begining of a run * to define parameters and flags that can be read from control file * They have to be defined before the control file is read - and it * is read before USINIT is called * * Arguments: * none * * Called by: * UGINIT * * Calls: * * Implicit inputs, outputs, side effects: * via listed COMMONs * * History: * Date Name Description * ---- ---- ----------- * 13-May-94 K.W. Creation ************************************************************************ *End_Documentation_Block IMPLICIT NONE C C Executable Statements C ===================== C RETURN END +PATCH,INC. *CMZ : 2.00/04 16/07/96 11.08.01 by K.Wozniak +KEEP, IOGEN. *CMZU: 2.00/02 05/04/96 16.21.02 by Phobos (R. Verdier) *-- Author : *Include IOGEN.BLK *Start_Documentation *********************************************************************** * * * INCLUDE file 'IOGEN.BLK' * * * *Start_Verbatim * * * * Created: 08-JUN-1992 Clive Halliwell * * Updated: * * * *********************************************************************** * * * GENERAL I/O UNITS * * ----------------- * * * * IOWRIT: GENERAL OUTPUT UNIT * * IOLOG: OUTPUT UNIT FOR ERROR MESS. * * IOREAD: GENERAL INPUT UNIT * * IOZBOT: ZEBRA output unit number * * IODATA: DATA FILES * * ITAPIN: INPUT TAPE UNIT * * ITAPOT: OUTPUT TAPE UNIT * * ITAPSC: STREAMER CHAMBER MERGER IO * * * * LIMITS ON MULTIPLE STREAM UNITS * * -------------------------------- * * IOSPLF = FIRST UNIT FOR SPLIT OUTPUT * * IOSPLL = LAST UNIT FOR SPLIT OUTPUT * * IOMRGF = FIRST UNIT FOR MERGED INPUT * * IOMRGL = LAST UNIT FOR MERGED INPUT * * IOQUOF = OFFSET FOR IOQUST STATUS INDEX * * * * * *End_Verbatim * * * *********************************************************************** *End_Documentation INTEGER IOSPLF, IOSPLL, IOMRGF, IOMRGL, IOQUOF PARAMETER (IOSPLF = 61, * IOSPLL = 70, * IOMRGF = 71, * IOMRGL = 80, * IOQUOF = IOSPLF-1) INTEGER IOWRIT, IOLOG, IOREAD, IOZBOT, IODATA, ITAPIN * , ITAPOT, ITAPSC * , BOTSCR, IZCEDX, IOLAST, BOTSC0 COMMON /IOGEN/ IOWRIT, IOLOG, IOREAD, IOZBOT, IODATA, ITAPIN * , ITAPOT, ITAPSC * , BOTSCR, IZCEDX, IOLAST, BOTSC0 +KEEP, IOCON. *CMZU: 2.00/02 05/04/96 16.19.56 by Phobos (R. Verdier) *-- Author : D. McLeod, Sep-95 *Include IOCON.BLK *Start_Documentation *********************************************************************** * * * /IOCON/ - CONSTANTS FILE I/O STUFF * * * *Start_Verbatim * * * * IOCONS = Constants directory unit (external server file) * * IOCONF = First unit for constants * * IOCONH = First unit for Alternate files * * IOCONL = Last unit for constants * * IOCON9 = Last unit for Alternate files * * IOCOND = Scratch unit used in server (working directory) * * IOCONS = Scratch unit used for server indirect files * * * * NIOCON = Number of constants files possible at one time * * NHBCON = Number of Alternate files possible at one time * * * * CONDIR = Directory of constants files * * * * CONFIL() = List of constants files in use * * CONTYP() = Type of constants in use * * ICONR1() = First run of range in use * * ICONR2() = Last run of range in use * * * * CONFHB() = List of Alternate files in use * * CONTHB() = Type of Alternate in use * * ICONR3() = First run of range in use * * ICONR4() = Last run of range in use * * * *End_Verbatim * * * *********************************************************************** *End_Documentation INTEGER IOCONT, IOCONS, IOCONF, IOCONL PARAMETER (IOCONT= 19, IOCONS= 20, IOCONF= 21, IOCONL= 60) INTEGER IOCONH, IOCON9 PARAMETER (IOCONH= 81, IOCON9= 99) INTEGER NIOCON, NHBCON PARAMETER (NIOCON= IOCONL-IOCONF, NHBCON= IOCON9-IOCONH) INTEGER IOCOND PARAMETER (IOCOND= IOCONF) INTEGER ICONR1, ICONR2, ICONR3, ICONR4 COMMON /IOCON/ ICONR1 (NIOCON), ICONR2 (NIOCON) * , ICONR3 (NHBCON), ICONR4 (NHBCON) CHARACTER*60 CONDIR, CONFIL, CONFHB, CONTYP*10, CONTHB*10 COMMON /IOCONC/ CONDIR, CONFIL (NIOCON), CONTYP (NIOCON) * , CONFHB (NHBCON), CONTHB (NHBCON) +KEEP, FLAG2. *CMZU: 2.00/02 05/04/96 16.42.16 by Phobos (R. Verdier) *-- Author : C PHOBOS flags, run control, operating modes, misc. File FLAG2.INC C 14-Nov-95 D. McLeod * Glossary: IPSIG = identity of kill signal sent by user as interrupt * EXSERV = flag for existence of external server file * SERNAME = name part only of server file, also run name * ROOTPATH = program environment pathname (no trailing /) * ROOTVERS = version subdirectory e.g. /prod, /test, /dev * SIMVER = version number for the PHOBOS Monte Carlo INTEGER IPSIG REAL SIMVER LOGICAL EXSERV CHARACTER SERNAME*20, ROOTPATH*60, ROOTVERS*10 COMMON/RHFLG2/IPSIG, EXSERV, SIMVER, SERNAME, ROOTPATH, ROOTVERS +KEEP, RHSILD. *CMZ : 2.00/02 05/04/96 14.03.25 by Phobos (R. Verdier) *CMZU: 1.01/06 10/05/94 17.50.40 by R. Verdier *-- Author : R. Verdier 10/05/94 C RHSILD.INC: Data for PHOBOS detector hit parameters c 26-Sep-95 D. McL. Moved data value for UgcpMax from RHSIL; UgcpMaxp is c defined there c 10-May-94 R. V. Extracted from RHSIL.INC, added Don McLeod's mods c Number of hit parameters: data NSIP /11/ c Names of parameters: DATA SINAMH / 'X ', 'Y ', 'Z ', 'DE ', 'COSX', 'COSY', 1 'COSZ', 'EFIN', 'IVOL', 'ITRK', 'ISEQ', ' '/ c Mumber of bits stored for each parameter: DATA SIBITH / 12*32 / c Multiplicative scale factors and origins, defined so that c Stored value = (Parameter value + SIORIG) * SIFACT: DATA SIORIG / 3*50., 0., 3*1., 5*0. / DATA SIFACT / 3*1.0E3, 1.0E7, 3*5.0E3, 1.0E4, 4*1. / c Number of UGC parameters DATA UgcpMax /UgcpMaxp/ +KEEP,NTUD. *CMZ : 1.01/21 11/07/95 13.24.34 by K.Wozniak *CMZ : 1.01/17 16/03/95 17.38.13 by K.Wozniak *CMZ : 1.01/12 19/07/94 12.12.54 by Phobos (R. Verdier) *-- Author : C Data for Ntuple element tag names. File NTUD.INC C Variables are in common NTTAGS, defined in NTU.INC. C 20-APR-95 R. V. Change last tagnames to ... TFn, ITn, SVn C 16-MAR-95 K. W. Increase the number of planes to 15 C 19-Jul-94 R. V. Update tagnames: Cxx -> Dxx, VOLTERM -> VOLUME C 10-May-94 R.Verdier Extracted from NTU.INC with new HITS info DATA TAGS/'RUN', 'EVENT', 'TRACK', 'GEN', 'ANAL', 'SCAT', 'BIMP', 1 'XPROD', 'YPROD', 'ZPROD', 'IDPART', 'CHRG', 'TP', 'TK', 2 'TPHI', 'TTHETA', 'ACCEPT', 'NHITSL', 'USR1', 'USR2', 'STOP', 3 'PARENT', 'VOLUME', 'XTERM', 'YTERM', 'ZTERM', 'PXTERM', 4 'PYTERM', 'PZTERM', 'ETERM', 'UNUSED', 5 'PL1 ','X1 ','Y1 ','Z1 ','DE1 ','DX1 ','DY1 ','DZ1 ','EF1 ', 6 'TF1 ','IT1 ','SV1 ', 7 'PL2 ','X2 ','Y2 ','Z2 ','DE2 ','DX2 ','DY2 ','DZ2 ','EF2 ', 8 'TF2 ','IT2 ','SV2 ', 9 'PL3 ','X3 ','Y3 ','Z3 ','DE3 ','DX3 ','DY3 ','DZ3 ','EF3 ', * 'TF3 ','IT3 ','SV3 ', 1 'PL4 ','X4 ','Y4 ','Z4 ','DE4 ','DX4 ','DY4 ','DZ4 ','EF4 ', 2 'TF4 ','IT4 ','SV4 ', 3 'PL5 ','X5 ','Y5 ','Z5 ','DE5 ','DX5 ','DY5 ','DZ5 ','EF5 ', 4 'TF5 ','IT5 ','SV5 ', 5 'PL6 ','X6 ','Y6 ','Z6 ','DE6 ','DX6 ','DY6 ','DZ6 ','EF6 ', 6 'TF6 ','IT6 ','SV6 ', 7 'PL7 ','X7 ','Y7 ','Z7 ','DE7 ','DX7 ','DY7 ','DZ7 ','EF7 ', 8 'TF7 ','IT7 ','SV7 ', 9 'PL8 ','X8 ','Y8 ','Z8 ','DE8 ','DX8 ','DY8 ','DZ8 ','EF8 ', * 'TF8 ','IT8 ','SV8 ', 1 'PL9 ','X9 ','Y9 ','Z9 ','DE9 ','DX9 ','DY9 ','DZ9 ','EF9 ', 2 'TF9 ','IT9 ','SV9 ', 3 'PL10','X10 ','Y10 ','Z10 ','DE10','DX10','DY10','DZ10','EF10', 4 'TF10','IT10','SV10', 5 'PL11','X11 ','Y11 ','Z11 ','DE11','DX11','DY11','DZ11','EF11', 6 'TF11','IT11','SV11', 7 'PL12','X12 ','Y12 ','Z12 ','DE12','DX12','DY12','DZ12','EF12', 8 'TF12','IT12','SV12' , 9 'PL13','X13 ','Y13 ','Z13 ','DE13','DX13','DY13','DZ13','EF13', * 'TF13','IT13','SV13', 1 'PL14','X14 ','Y14 ','Z14 ','DE14','DX14','DY14','DZ14','EF14', 2 'TF14','IT14','SV14', 3 'PL15','X15 ','Y15 ','Z15 ','DE15','DX15','DY15','DZ15','EF15', 4 'TF15','IT15','SV15', 5 'PL16','X16 ','Y16 ','Z16 ','DE16','DX16','DY16','DZ16','EF16', 6 'TF16','IT16','SV16', 7 'PL17','X17 ','Y17 ','Z17 ','DE17','DX17','DY17','DZ17','EF17', 8 'TF17','IT17','SV17' / +KEEP, BANGC. *CMZ : 2.00/10 19/09/96 13.27.44 by Unknown *CMZ : 1.01/21 11/07/95 12.07.16 by K.Wozniak *CMZ : 1.01/17 20/03/95 13.18.09 by K.Wozniak *-- Author : K.Wozniak 09/03/95 C Event generator parameters File: BANGC.CMN C 20-Sep-96 K. Wozniak Added new parameters to control BANG mode = 2 C RSPX, RSPZ, RSPR (removed RMAG) C 10-Mar-95 K. Wozniak Added new parameters to control track generation c and selection (ETAMIN,ETAMAX, IDMIN,IDMAX ..) c 22-Jun-94 R. V. Remove NSEQN storage (see PH_HIT) c 10-May-94 D. McLeod Increased MXMUL to 13000 for HIJET events c 17-Dec-92 R. Verdier Changed name from BANG to BANGC for CMS c 22-Nov-92 D. Mcleod Added EXF and NSEQN INTEGER MXMUL PARAMETER (MXMUL=13000) ! maximum multiplicity for BANG etc. INTEGER IRMUL ! multiplicity in random particle generation INTEGER IRARM ! particles going to 1 or 2 arms selected INTEGER IRPID(2) ! particle id range: min, max REAL RMOM(3) ! momentum of particles: min, max and step ! (first step if 1/p is changed) REAL REXP ! mean transv. mom. - for momentum generation REAL RETA(2) ! ETA range: min, max REAL RANG(3) ! starting theta angle and step REAL RPHI(2) ! range of emission phi angle: min, max REAL RROT ! phi rotation angle (GEN=5) REAL RBXX,RBYY,RBZZ ! central position of the vertex REAL RBXY ! width of the beam intersection in x-y REAL RBDX,RBDY,RBDZ ! the range of positions of the vertex C ! REAL RSPX,RSPZ,RSPR ! position and radius of the circle describing C ! area covered by spectrometer REAL PHIR,CZ,ZC,RS ! working variables for BANG COMMON/RHBNG/IRMUL, IRARM, IRPID, RMOM, REXP, RETA, RANG, RPHI, 1 RROT, 2 RBXX,RBYY,RBZZ, RBDX, RBDY, RBDZ, RBXY, 3 RSPX,RSPZ,RSPR, PHIR,CZ,ZC,RS +KEEP, CARDS. *CMZ : 1.00/00 17/12/93 07.30.26 by Phobos *-- Author : C Common blocks for GPH PHOBOS simulation: FILE CARDS.CMN C General geometric layout of PHOBOS detector exclusive of detectors C These values are on input cards or data statements. C REAL YGAP,YCRH,THCR C 1 OUT1,OUT2,BMV1,BMV2,BMT1,BMT2,SPE1,SPE2,CRB1,CRB2, C 1 CRS1,CRS2,FIL1,FIL2 C COMMON/CARDS/YGAP,YCRH,THCR C OUT1(6),OUT2(6),BMV1(6),BMV2(6), C 1 BMT1(6),BMT2(6),SPE1(7),SPE2(7),CRB1(6),CRB2(6), C 1 CRS1(6),CRS2(6),FIL1(6),FIL2(6) +KEEP, CYFLDC. *CMZ : 1.00/00 17/12/93 07.30.26 by Phobos *-- Author : *Include CYBFLD.BLK *Start_Documentation *********************************************************************** * * * INCLUDE file 'CYBFLD.INC' * *Start_Verbatim * * * * Created: 02-MAR-1993 K. Wozniak * * * * Cylindrical magnetic field map * * ------------------------------ * * * * NNRMAX Parameter - maximal size of the map in radial direction * * NNVMAX Parameter - maximal size of the map in vertical direction * * NNR actual size of the map in radial direction * * NNV actual size of the map in vertical direction * * XTAB radial (XTAB(1)..XTYAB(NNR) and vertical (XTAB(NNR+1).. * * XTAB(NNR+NNV)) coordiantes of the grid points of the map* * BRTAB table of the radial compoments of the field * * BVTAB table of the vertical components of the field * * Field value at the point (XTAB(I), XTAB(NNR+K) is: * * (BRTAB(I+(K-1)*NNR), BVTAB(I+(K-1)*NNR)) * * * * * *End_Verbatim * *********************************************************************** *End_Documentation INTEGER NNRMAX, NNR, NNVMAX, NNV PARAMETER (NNRMAX = 200, NNVMAX = 150) REAL XTAB, BRTAB, BVTAB COMMON /CYBFLD/ NNR, NNV, XTAB(NNRMAX+NNVMAX), + BRTAB(NNRMAX*NNVMAX), BVTAB(NNRMAX*NNVMAX) +KEEP, FLAG. *CMZ : 2.00/03 04/07/96 18.10.18 by K.Wozniak *CMZ : 1.01/17 31/03/95 15.46.22 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.26 by Phobos *-- Author : C PHOBOS flags, run control, operating modes, misc. File FLAG.CMN C 31-Mar-95 R.V. Change STRA to SECT to avoid GEANT 3.21 conflict C 22-Nov-92 D. McLeod C These are set in input cards INTEGER ISASC,ISHBO,ISHDO,ISNTU,ISAOU, ISECT,IDRAW, 1 IGEN,IANAL,ISCAT,IPIXL,ISEQ,NTRK,IZEB REAL WPIXL,WLOSS COMMON/RHFLG/ISASC,ISHBO,ISHDO,ISNTU,ISAOU, ISECT,IDRAW, 1 IGEN,IANAL,ISCAT,IPIXL,ISEQ,NTRK,IZEB,WPIXL,WLOSS +KEEP, HST. *CMZ : 1.00/00 17/12/93 07.30.26 by Phobos *-- Author : C File HST.CMN (originally COMMON.HST) C Common block for inline plot control.. to generate plots during C the GEANT run from the track Ntuples (rather than later via PAW) C Its contents are set by control cards in the same file as FFREAD: C HIST ID TAGNAME (short form.. default bins and interval) C TAGNAME can be Ntuple tag name or e.g. #35 for 35th entry C HIST ID TAGNAME NCHANNELS XMIN XMAX is the long form. C HIST ID TAGX NX XMI XMA TAGY NY YMI YMA scatterplot, args as HBOOK2 C (The number of arguments distinguishes these three formats.) C HCONTROL(I,J), J = 1,NHMX contains the control information: C I = 1: User supplied ID number of plot, floated integer C I = 2: Ntuple entry number (floated), from TAGNAME or # input C I = 3: number of channels (0 if short form card) C I = 4-5 or 4-9: arguments as in card formats above, all floating INTEGER NHMX,NHSTS PARAMETER(NHMX=50) REAL HCONTROL COMMON/RHHST/HCONTROL(9,NHMX),NHSTS +KEEP, IO. *CMZ : 2.00/08 13/08/96 13.16.58 by Phobos (R. Verdier) *CMZ : 2.00/06 21/07/96 21.43.11 by Phobos (R. Verdier) *CMZ : 2.00/03 04/07/96 18.08.51 by K.Wozniak *CMZ : 2.00/02 18/07/96 10.40.46 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.27 by Phobos *-- Author : C Common block for GPH logical units etc.: file IO.CMN c 13-Aug-96 R. V. Added USRBATCHK for KUIP commands for UGCONS c 21-Jul-96 R. V. Remove unused record; note CARDDEF now obsolete c 22-Feb-93 R. V. Added USRMCNTU and IMCNTU for MC Ntuple c 14-Nov-92 R. Verdier Added UGCIN, IUGCIN, CARDDEF and ICARDDEF +SELF,IF=EUCARD. c for UGC and EUCARD input units +SELF,IF=-EUCARD. c for UGC and EUCARD (obsolete) input units +SELF. C Apr-92 C. Parsons Replacement for original COMMON.CDT INTEGER USRGCIN, CARDDEF, USRIN, USROUT, USRMAP, USRNTU, USRZEB, * USRMCNTU, USRBATKUMAC PARAMETER (USRIN = 4, USROUT = 16, USRMAP = 18) PARAMETER (USRNTU = 15, USRZEB = 17, USRGCIN = 19, CARDDEF = 20) PARAMETER (USRMCNTU = 21, USRBATKUMAC = 22) INTEGER ICARDDEF, IMCNTU, IUSRGCIN, IUSRIN, IUSROUT, IUSRMAP, * IUSRNTU, IUSRZEB, IUSRAOU, IUSRBATKUMAC COMMON /IO/ IUSRIN, IUSROUT, IUSRMAP, IUSRNTU, IUSRZEB, IUSRGCIN, * ICARDDEF, IMCNTU, IUSRAOU, IUSRBATKUMAC +KEEP, MUPEP. *CMZ : 1.01/17 16/03/95 17.43.09 by K.Wozniak *CMZ : 1.00/00 17/12/93 07.30.27 by Phobos *-- Author : c MUPEP.CMN: PHOBOS MC multi-pass event processing variables c 16-Mar-95 K. W. NeSkip added c 6-Jun-93 R. V. Creation c Multi-pass event processing breaks up each event into groups of c tracks, in order to avoid overflowing Zebra track storage. c Common for access to control variables: common /MUPEP/ EPState, NtConc, NtpE, NtPrim, NeSkip, NtSkip, 1 MPind, NtPrev, NtTot, NtMax, NvPrev c Parameters and data values are assigned in MUPEP.CDA. c Event processing state: EPState = 0 for first pass, c 1 for continuing pass, 2 for final pass integer EPState c Current pass index: integer MPind c Maximum number of tracks to process concurrently in a group: integer NtConc c Maximum track number for this group: integer NtMax c Maximum number of tracks per event: integer NtpE c Number of primary and secondary tracks generated before this pass: integer NtPrev c Number of primary tracks and vertices generated: integer NtPrim, NvPrev c Number of input file events to skip initially: integer NeSkip c Number of tracks to skip initially: integer NtSkip c Total number of primary and secondary tracks generated: integer NtTot +KEEP, MUPEPD. *CMZ : 1.01/17 16/03/95 17.42.16 by K.Wozniak *CMZ : 1.00/00 17/12/93 07.30.27 by Phobos *-- Author : c MUPEPD.CMN: Data for PHOBOS common MUPEP c 16-Mar-95 K. W. NeSkip added c 9-May-93 R. V. Creation data EPState /0/, NtConc /1000/, Neskip /0/, NtSkip /0/ data NtpE /20000/ +KEEP, NTU. *CMZ : 1.01/21 11/07/95 13.21.44 by K.Wozniak *CMZ : 1.01/17 16/03/95 18.07.54 by K.Wozniak *CMZ : 1.01/12 19/07/94 12.10.03 by Phobos (R. Verdier) *CMZ : 1.01/06 12/05/94 10.24.22 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.27 by Phobos *-- Author : C Common block for Ntuple image and other analysis info. File NTU.INC C There may be one Truth Ntuple and/or one Hits Ntuple for each track. C These must be correlated into events using the event number and other C event information. C 10-Jul-95 K. W. Increased number of planes for spectrometer to 17 C 10-Mar-95 K. W. Increased number of planes for spectrometer C 19-Jul-94 R. V. Update tagnames: Cxx -> Dxx, VOLTERM -> VOLUME C 10-May-94 R. V. Modify Ntuples to contain new hits information; C add NTTAGS common for tags; move data to NTUD.INC C 29-Jun-93 M. Baker Modify Ntuples C 10-Jan-93 R.Verdier Separate Hits and Truth ntuples; rename to NTU.CMN C Mar-92 D. Mcleod Creation as COMMON.NTU C Number: Name: --------------- Description:---------------------------- C>>>>>>>GENERAL INFORMATION<<<<<<<<<<<<<<<<<< * 1 RUN run number * 2 EVENT event number * 3 TRACK track number * 4 GEN event generator type; 1 = fixed, 2 = random, etc. * 5 ANAL event analysis type; 1 = Ntuple only, 2 = resolution, etc. * 6 SCAT ISCAT = IMULS + 3*ILOSS + 9*IPIXL; 1st 2 are in /GCPHYS/ * 7 BIMP Impact Parameter ** NOT YET IMPLEMENTED ** C>>>>>>>THE TRUTH<<<<<<<<<<<<<<<<<<<<<<<<<<<<< * 8 XPROD track origin * 9 YPROD " " * 10 ZPROD " " * 11 IDPART particle type (GEANT code) * 12 CHRG particle charge * 13 TP particle momentum (at production) * 14 TK " kinetic energy " * 15 TPHI " azimuth angle * 16 TTHETA " polar angle C>>>>>>>ANALYSIS RESULTS..FOR THE WHOLE TRACK<<<<<<<<<<<<<<<<<< * 17 ACCEPT Acceptance Flag (+/-1=acc. in +/- wing, 2=both, 0=neither) * 18 NHITSL number of hits on track, set to a maximum of NHTM * 19 USR1 spare, for later use * 20 USR2 " C>>>>>>>TRACK HITS<<<<<<<< * The Truth ntuple stops here; the Hits ntuple continues with * A series of particle history words * NHITSL groups of 12 words each, at index = 32 + 12*(Ihit-1): * * 21 KCASE creation mechanism * 22 PARENT track number * 23 VOLUME creation volume name * 24 XTERM * 25 YTERM * 26 ZTERM * 27 PXTERM * 28 PYTERM * 29 PZTERM * 30 ETERM * 31 STOP stop mechanism * 32+ PL plane number hit * 33+ X Track center in plane in master coords (maybe pixeled) * 34+ Y " " " " " " " " " * 35+ Z " " " " " " " " " * 36+ DE Energy deposited in the plane * 37+ DX Exit minus entry position in master coord system * 38+ DY " " " " " " " * 39+ DZ " " " " " " " * 40+ EFIN track energy at exit from plane * 41+ TOF time registered by a TOF detector, in seconds * 42+ ITRK track number for this hit * 43+ IS Combined information: IS = IVOL + 1000 * ISEQ * ISEQ = sequential (first = 1) hit number on this track * IVOL = system volume number of the plane C The maximal number of hits is now NHTM = 17 C There are thus 31 + 12*NHTM or 235 entries in a Hits Ntuple, with zeroes C after the last hit INTEGER NVMCTUP,NVTUP,NTOFF,NHTM PARAMETER (NTOFF=31, NVMCTUP=20, NHTM=17) PARAMETER (NVTUP=31+12*NHTM) REAL RUN, EVENT, TRACK, GEN, ANAL, SCAT, BIMP REAL XPROD, YPROD, ZPROD, IDPART, CHRG, TP, TK, TPHI, TTHETA REAL ACCEPT, NHITSL, USR1, USR2 REAL STOP, PARENT, VOLTERM, XTERM, YTERM, ZTERM, PXTERM, PYTERM REAL PZTERM, ETERM, UNUSED REAL TRK(12,NHTM), TUP(NVTUP) COMMON/RHTUP/ RUN, EVENT, TRACK, GEN, ANAL, SCAT, BIMP, 1 XPROD, YPROD, ZPROD, IDPART, CHRG, TP, TK, TPHI, TTHETA, 2 ACCEPT, NHITSL, USR1, USR2, STOP, PARENT, VOLTERM, XTERM, 3 YTERM, ZTERM, PXTERM, PYTERM, PZTERM, ETERM, UNUSED, 4 TRK EQUIVALENCE (TUP(1),RUN) COMMON /NTTAGS/ TAGS(NVTUP) CHARACTER*8 TAGS +KEEP, NTUEX. *CMZ : 1.01/06 12/05/94 10.26.15 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.28 by Phobos *-- Author : c NTUEX.INC: PHOBOS MC Ntuple option extensions c 10-May-94 R. V. Correct filenames in documentation c 6-Jun-93 R. V. Creation c This include file defines options for the size and format of the c Phobos ntuples. Data values are assigned in NTUEXD.INC. c Define sizes for allocating ntuples, in 4-byte words. The NHtrks c and NMCtrks values limit the total size of the created disk file. c The default values assigned to NWHits and NWMC here are actually c overridden by Nvtup and Nvmctup, respectively, in NTUD.INC. common /NTUEX/ LreclW, NWHits, NWMC, NWover, NWPRIM, 1 NHtrks, NMCtrks integer 1 LreclW, ! Disk file logical record length, words 2 NWHits, ! # Hits ntuple variables [columns] 3 NWMC, ! # MC Truth ntuple variables [columns] 4 NWover, ! Approx. Zebra system overhead, words 5 NWprim, ! Primary storage buffer, words 6 NHtrks, ! Maximum # of tracks in Hits ntuple 7 NMCtrks ! Maximum # of tracks in MC ntuple +KEEP, NTUEXD. *CMZ : 1.01/06 12/05/94 10.27.38 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.28 by Phobos *-- Author : c NTUEXD.INC: PHOBOS MC Ntuple option extensions data c 10-May-94 R. V. NWHits and NWMC changed for new HITS information c 6-Jun-93 R. V. Creation c This include file specifies data values for common NTUEX, defined c in NTUEX.INC. c Define sizes for allocating ntuples, in 4-byte words. The NHtrks c and NMCtrks values limit the total size of the created disk file. c The default values assigned to NWHits and NWMC here are actually c overridden by Nvtup and Nvmctup, respectively, in NTUD.INC. data 1 LreclW / 1024 /, ! Disk file logical record length, words 2 NWHits / 175 /, ! # Hits ntuple variables [columns] 3 NWMC / 20 /, ! # MC Truth ntuple variables [columns] 4 NWover / 3500 /, ! Approx. Zebra system overhead, words 5 NWprim / 8192 /, ! Primary storage buffer, words 6 NHtrks / 60000 /, ! Maximum # of tracks in Hits ntuple 7 NMCtrks/ 60000 / ! Maximum # of tracks in MC ntuple +KEEP, RHSIL. *CMZ : 2.03/00 02/07/97 12.53.11 by K. Wozniak *CMZ : 2.02/01 01/05/97 12.31.23 by Phobos (R. Verdier) *CMZ : 2.02/00 17/03/97 12.08.22 by K. Wozniak *CMZ : 2.01/00 15/01/97 14.34.10 by K.Wozniak *CMZ : 2.00/03 09/07/96 13.34.33 by K.Wozniak *CMZ : 2.00/02 05/04/96 13.59.09 by Phobos (R. Verdier) *CMZ : 2.00/00 08/10/95 08.50.51 by Phobos (R. Verdier) *CMZ : 1.01/06 10/05/94 17.43.02 by R. Verdier *CMZ : 1.01/04 22/03/94 11.52.02 by R. Verdier *CMZ : 1.00/00 17/12/93 07.30.28 by Phobos *-- Author : C RHSIL.CMN: PHOBOS detector plane dimensions, positions, and c granularity; UGC parameters c The actual and maximum numbers of detector planes and detector hit c parameters. Their default values are defined in RHSILD.INC. c 1-Jul-97 K. W. Added data for GEANT pixelization (GSDVN) c 1-May-97 R. V. Increased NSLPM to 500 c 3-MAR-97 K. W. Removed SPL, added PADS data C 3-Jan-97 K. W. Increased NSLPM to 180 c 3-Jul-96 K. W. Geometry version number added c 5-Apr-96 D. McL. Moved data value of UgcpMax to RHSILD c ... c Mar-92 D.McLeod Creation c Storage limit for number of silicon planes: INTEGER NSLPM PARAMETER (NSLPM=500) c Storage limit for number of parameters for each hit: integer NSipMaxp parameter (NSipMaxp = 12) c Safety limit for number of parameter values that may be entered in c a UGC text input record: integer UgcpMaxp parameter (UgcpMaxp = 10) c Number of silicon planes in use: integer NSLP c Additional information on detectors - pad sizes: C DETNAME - name of the detector volume C DIVXNAME - name for division in X direction C DIVYNAME - name for division in Y direction C DIVZNAME - name for division in Z direction C NDIVX - number of divisions in X direction C NDIVY - number of divisions in Y direction C NDIVZ - number of divisions in Z direction C IPADFL - pad type flag C PADn - four pad parameters C (pad size in X, Y, Z direction for IPADFL=1 for example) CHARACTER*4 DETNAME(NSLPM), DIVXNAME(NSLPM), + DIVYNAME(NSLPM), DIVZNAME(NSLPM) INTEGER NDIVX(NSLPM), NDIVY(NSLPM), NDIVZ(NSLPM) REAL PAD1(NSLPM), PAD2(NSLPM), PAD3(NSLPM), PAD4(NSLPM) INTEGER NDETS, IPADFL(NSLPM) COMMON /RHPADS/ NDETS, DETNAME, DIVXNAME, DIVYNAME, DIVZNAME, + NDIVX, NDIVY, NDIVZ, + IPADFL, PAD1, PAD2, PAD3, PAD4 c Number of silicon planes - compared with final value of NDETS COMMON /RHSIL/ NSLP c UGC parameter information: integer UgcpMax real UGCpars(UgcpMaxp) c Declare silicon plane parameters; their default values are specified c in RHSILD.INC integer NSIP c Names of parameters: CHARACTER*4 SINAMH(NSipMaxp) c Mumber of bits stored for each parameter: INTEGER SIBITH(NSipMaxp) c Multiplicative scale factors and origins, defined so that c Stored value = (Parameter value + SIORIG) * SIFACT: REAL SIFACT(NSipMaxp), SIORIG(NSipMaxp) c Common for access to UGC parameters and hit parameter definitions: common /UGCPAR/ UgcpMax, UGCpars, 1 NSIP, SINAMH, SIBITH, SIORIG, SIFACT real GEOV ! geometry version number common /ugGEOV/ GEOV +KEEP, RHSYS. *CMZ : 2.00/10 19/09/96 13.23.14 by Unknown *CMZ : 2.00/04 16/07/96 11.08.01 by Phobos (K. Wozniak) *CMZ : 1.00/00 17/12/93 07.30.29 by Phobos *-- Author : C Common blocks for GPH PHOBOS simulation: FILE RHSYS.CMN C General geometric layout of PHOBOS detector exclusive of detectors C These values are on input cards or data statements, except *MAX are C calculated to encompass all elements of the system. C 20-Sep-96 K.W Removed obsolete BMTBRAD, BERTHIK C Removed FANGL - now local variable in BANG C 12-Jul-96 K.W Position of the magnet pole center MAGX, MAGZ C (previously XOFF,ZOFF) separated from the magnet C offset (now MOFF - 3-D vector) C 14 Dec-92 R.V. TMAG redefined and changed to integer C 22-Nov-92 D. McLeod Renamed from COMMON.SYS; TMAG, ZOFF, XOFF C are added from the original GPH version REAL BFLD ! Magnetic field strength & ,MAGX,MAGZ ! Coordinates of field center & ,MOFF(3) ! offset of the field & ,RFLD ! Radius of field (perfect dipole only) 1 ,XMAX,YMAX,ZMAX,ZMIN,XMMAX,ZMMAX INTEGER MAGT, TMAG ! Field type: 0 Zebra bank, 1 = dipole, ! 2 = ASCII map COMMON/RHSYS/ BFLD,MAGT,MAGX,MAGZ,MOFF 1 ,RFLD,XMAX,YMAX,ZMAX,ZMIN,XMMAX,ZMMAX EQUIVALENCE (TMAG, MAGT) +KEEP,TLIMIT. *CMZU: 2.02/01 23/04/97 11.15.47 by K.Wozniak *-- Author : K.Wozniak 23/04/97 C CPU time limit flag C NTLIM = 1 simulation stops about 1 second before the CPU C time assigned to batch job is exhausted C NTLIM = 0 ignores estimated CPU time limit, program continues C with a warning message and could eventually crash. C It is the default as for long queues CERN library C assumes only 9999 seconds (about 2 hours 47 minutes) C INTEGER NTLIM COMMON /TLIMIT/ NTLIM +KEEP, UHITS. *CMZ : 1.00/00 17/12/93 07.30.29 by Phobos *-- Author : c UHITS.CMN: control variables for UHITSOUT.FOR c 5-Feb-93 R. Verdier Creation integer draw_mode, HitsOut logical draw_hits common /Hitsocon/ HitsOut, draw_hits, draw_mode +KEEP, UJKBUF. *CMZ : 2.02/00 17/03/97 12.08.22 by K. Wozniak *CMZ : 2.00/14 21/11/96 14.58.39 by Unknown *CMZ : 2.00/03 09/07/96 14.01.10 by K.Wozniak *CMZ : 1.01/12 18/07/94 11.24.51 by Phobos (R. Verdier) *CMZ : 1.00/00 17/12/93 07.30.30 by Phobos *-- Author : C PHOBOS JKINE user buffer definitions. File: UJKBUF.INC c 18-Jul-94 R. V. Added NHitsAct integer Nwubuf, Nwubmax, NHitsAct parameter (Nwubmax = 11) common /UJKB/ Nwubuf, Ubuf(Nwubmax), NHitsAct real Ubuf integer IUBUF(Nwubmax) equivalence (IUBUF, UBUF) c NHitsAct: The number of hits on the track being propagated c The user words at present are: c UBUF(1): Istop at track termination c (3): Volume number at origin, not definded for primaries c undefined for all tracks in SECT=1 mode c (3): Volume number at origin, (4 characters in one integer word) c not definded for primaries and undefined for all tracks c in SECT=1 mode (integer value 0) c (4-6): X, Y, Z at termination c (7-10): Px, Py, Pz, E at termination c (11): Unused +KEEP, ZBBFLD. *CMZ : 1.00/00 17/12/93 07.30.30 by Phobos *-- Author : *Include ZBBFLD.BLK *Start_Documentation *********************************************************************** * * * Storage of the PHOBOS magnetic field. The field is stored in a * * single ZEBRA bank with no links. * * * *Start_Verbatim * * * * BFLD bank structure * * -------------------- * * * * BFLDTL: Total number of links * * BFLDSL: Number of structural links * * BFLDDA: Number of data words * * BFLDIO: IO charateristic (not standard) * * BFLDFM: IO form of bank * * * * BFLD data POINTERS * * ------------------ * * Pointer Contents * * ------- -------- * * * * BFLDMX Field value at center of one coil (for normalization) * * BFLDBX X cordinates of field * * BFLDBY Y cordinates of field * * BFLDBZ Z cordinates of field * * BFLDA Grid points * * BFLDNA Number of grid points (NX, NY, NZ) * * * * To accesses values: * * * * BMAX = Q (BFLDPT + BFLDMX) * * NX = IQ(BFLDPT + BFLDNA + 1) * * NY = IQ(BFLDPT + BFLDNA + 2) * * NZ = IQ(BFLDPT + BFLDNA + 3) * * * * BFLDBX = BFLDA + NX + NY + NZ * * BFLDBY = BFLDBX + NX * NY * NZ * * BFLDBZ = BFLDBY + NX * NY * NZ * * * * Created: 15-JUL-1992 Christopher Conner * * Updated: 18-NOV-1992 Christopher Conner (added BFLDMX) * * * *End_Verbatim * *********************************************************************** *End_Documentation INTEGER BFLDSL, BFLDTL, BFLDDA, BFLDIO PARAMETER (BFLDSL = 0, * BFLDTL = 0) INTEGER BFLDBX, BFLDBY, BFLDBZ, BFLDA, BFLDNA, BFLDMX PARAMETER (BFLDNA = 0, * BFLDMX = 4, * BFLDA = 4) ********************** * I/O format * ********************** CHARACTER*5 BFLDFM PARAMETER (BFLDFM = '3I -F') COMMON /ZBBFLD/ BFLDBX, BFLDBY, BFLDBZ, BFLDIO +PATCH,KUMAC. *CMZ : 1.01/00 18/04/94 16.12.57 by Phobos (R. Verdier) +DECK,TOPVIEW ,T=DATA. *CMZU: 2.03/00 23/07/97 11.07.04 by Phobos (R. Verdier) *-- Author : MACRO TOPVIEW [1]=' ' [2]=' ' * Draw a labelled plan view of the active elements of the Phobos detector * Use: in Geant, * exe topview