* * $Id$ * * $Log: uginit.F,v $ * Revision 1.12 2005/01/29 19:25:30 jonesrt * hitLGD.c * - renamed to hitFCal.c [rtj] * Makefile.orig * - modified to reflect the name change for hitLGD.c [rtj] * control.in * - it seems that I always have touched this file at some point! [rtj] * gustep.F * - added argument ISTAK to argument list for hitXXX functions, so that * they can determine whether a given track is the primary or not [rtj] * - some of the names of volumes have been changed in the recent geometry * update, reflect that fact in the Makefile [rtj] * hddm_s.c, hddm_s.h * - updated from hddm (you should generate these using hddm-c and then * copy them over from hddm to this folder) [rtj] * hddsGeant3.F * - updated from hdds (you should generate this using hdds-geant and * then copy it over from hdds to this folder) [rtj] * uginit.F * - added a line to switch HBOOK from //LUN3 (closed after return from * GRFILE) back to the geant.hbook output file on unit 50 [rtj] * hddmInput.c * - modified to store the actual coordinates of the event vertex in the * Monte Carlo section of the output record, in case that the vertex * was generated by the simulator instead of the generator [rtj] * hitXXX.c * - modified to accommodate an extra tag primary="boolean" on all of * the cheat tags, to tell whether the hit was produced by one of the * original primaries, or by a secondary produced by one of them. * - hitFTOF.c modified to accommodate two layers instead of one [rtj] * - hitStart.c modified to accommodate the segmented readout [rtj] * - hitCerenkov.c - modified to accommodate the segmented readout [rtj] * - hitCerenkov.c - added a cheat tag to the Cerenkov readout [rtj] * - all cheat tags have been modified to report all three coordinates * (in the global reference system) instead of only two [rtj] * * Revision 1.11 2005/01/21 09:36:34 davidl * Read in BFIELD and NOSECONDARIES cards and store in hdtrackparams common block * * Revision 1.10 2003/10/30 12:29:24 jonesrt * README.txt: updated build procedures that work up to Redhat 9 * hddmInput.c,hddmOutput.c: small change to hddm input/output library * that reflects a change in the Monte Carlo hddm template. * uginit.F: added a line to generate geometry rz file needed by g2root * Makefile: updates to make build work under Redhat 9 and cernlib 2003 * gelhad/Makefile: updates to make build work under Redhat 9 * [richard.t.jones@uconn.edu] * * Revision 1.9 2002/07/10 19:53:08 jonesrt * - moved open/close of hbook file from hdgeant.f to uginit.F/uglast.F so that * it gets called from hdgeant++ [rtj] * - fixed Makefile to make hdgeant++ export its symbols to dynamic COMIS * functions [rtj] * * Revision 1.8 2002/07/10 14:57:18 jonesrt * - fixed wierd problem with g77 compiler that wanted to interpret "slash star" * in a fortran comment line as a comment indicator a-la-c (complained about * unterminated comment) so I just removed the asterisk - rtj. * - corrected the statistics printout from gelh_last() -rtj. * - changed confusing use of VSCAN (card SCAP) to define the origin for single * particle generation; now gukine.F uses PKINE (card KINE) for both origin * and direction of single-particle generator, with the following format: * KINE kind energy theta phi vertex(1) vertex(2) vertex(3) * - fixed gelh_outp() to remove the BaBar-dependent code so that it correctly * updates the photo-hadronic statistics that get reported at gelh_last() -rtj. * - updated gelhad/Makefile to follow the above changes -rtj. * * Revision 1.7 2002/06/28 19:01:03 jonesrt * Major revision 1.1 -Richard Jones, Chris Gauthier, University of Connecticut * * 1. Added hadronic interactions for photons with the Gelhad package * http://www.slac.stanford.edu/BFROOT/www/Computing/Offline/Simulation/gelhad.html * Routines affected are: * - uginit.F : added new card GELH to set up gelhad parameters and * call to gelh_vrfy() to print out their values. * - uglast.F : added call to gelh_last() to print out summary info. * - gtgama.F : Gelhad replacement for standard Geant routine that adds * simulation of hadronic photoproduction processes. * - gelhad/ : contains a number of new functions (Fortran) and includes * to support the hadronic photoproduction simulation. * * 2. Added muon-pair production by stealing every (Melectron/Mmuon)**2 pair * production events and trying to convert to muon pairs. The deficit in * e+/e- events resulting from this theft is negligible. The angular * distribution of muon pairs is generated using the general Geant method * in gpairg.F with the electron mass replaced by the muon mass. * Routines affected are: * - gpairg.F : added a switch to replace e+/e- with mu+/mu- in a small * fraction of the pair-production vertices. * * Revision 1.6 2001/09/27 20:07:39 jonesrt * -fixed memcheck.c to solve alpha compiler problems * -rtj- * * Revision 1.5 2001/08/02 15:54:18 jonesrt * added a check to uginit to verify that the random number generator has been * correctly initialized with valid seeds (or sequency number 1..215 !!!) -rtj * * Revision 1.4 2001/08/02 03:08:05 jonesrt * Now the BEAM data card is supported, with correct generation of * coherent bremsstrahlung radiation. -rtj * * Revision 1.3 2001/07/19 23:25:51 jonesrt * numerous new files as I develop the prototype hits libraries -rtj * * Revision 1.2 2001/07/15 07:31:38 jonesrt * HDGeant now supportskinematic input from Monte Carlo generators * via the routines in hddmInput.c -rtj * * Revision 1.1 2001/07/08 06:24:35 jonesrt * First release of the Geant3 geometry package for Hall D based on hdds. -rtj * * Revision 1.1.1.1 1995/10/24 10:21:52 cernlib * Geant * * #include "geant321/pilot.h" *CMZ : 3.21/02 29/03/94 15.41.35 by S.Giani *-- Author : SUBROUTINE UGINIT * ************************************************************************ * * * To initialise GEANT3 program and read data cards * * * ************************************************************************ * #include "geant321/gckine.inc" #include "geant321/gcunit.inc" #include "geant321/gcphys.inc" #include "geant321/gcscan.inc" #include "geant321/gctrak.inc" #include "hdtrackparams.inc" #include "backgrounds.inc" #include "controlparams.inc" * integer iskip integer infile(20) integer outfile(20) integer bfield_type(20) integer bfield_map(20) common /inputFile/ iskip,infile,outfile data iskip/0/ data infile/20*0/ data outfile/20*0/ integer postsmear integer mcsmearopts(64) integer deleteunsmeared common /smearing/ postsmear,mcsmearopts,deleteunsmeared data mcsmearopts/64*0/ data postsmear/0/ data deleteunsmeared/0/ integer openInput, skipInput, openOutput external openInput, skipInput, openOutput real beamE0, beamEpeak, beamEmin, radColDist common /beamPars/ beamE0,beamEpeak,beamEmin,radColDist data beamE0,beamEpeak,beamEmin,radColDist/0,0,0,76.0/ data bfield_type/20*0/ data bfield_map/20*0/ c The following parameters are declared in hdtrackparams.inc above. data nosecondaries/0/ data storetraj/0/ data plog_particle_gun/0/ data tlog_particle_gun/0/ c The following parameters are declared in controlparams.inc above. data writenohits/0/ data showersincol/0/ data driftclusters/0/ data tgtwidth/2*0/ C Use this parameter to set up a minimum photon energy C for the coherent bremsstrahlung beam generator - see beamgen.F real xMinimum,freqMaximum,beamStartZ,Theta02 common /coherentGen/xMinimum,freqMaximum,beamStartZ,Theta02 * * ----------------------------------------------------------------- * * Initialize GEANT C..geant.. call trapfpe() CALL GINIT * * Prints version number * WRITE(LOUT,1000) 1000 FORMAT(/,' MODE VERSION 1.00 : ',/) * * IKINE = particle type (default=1=gamma) * PKINE(1)=particle energy * IKINE and PKINE can be changed with the data card KINE * PKINE(1)=10. PKINE(5)=4. IKINE=1 ICOMP=1 IPAIR=1 IBREM=1 IANNI=1 IPHOT=1 IHADR=1 MAXNST=100000 ILOSS=1 * * Make the default origin for the particle gun at 0,0,65cm * and the default widths of vertex volume dR=0,dZ=0cm. * VSCAN(1)=0 VSCAN(2)=0 VSCAN(3)=65 tgtwidth(1)=0. tgtwidth(2)=0. * * Initialize GEANT/ZBOOK data structures * C..geant.. CALL GZINIT * * Define user FFREAD data cards (format free input) * * * Read the data cards * OPEN(UNIT=4,FILE='control.in',STATUS='UNKNOWN') CALL FFSET('LINP',4) CALL FFSET('SIZE',16) call ffkey('infile',infile,20,'MIXED') call ffkey('skip',iskip,1,'INTEGER') call ffkey('outfile',outfile,20,'MIXED') call ffkey('postsmear',postsmear,1,'INTEGER') call ffkey('mcsmearopts',mcsmearopts,64,'MIXED') call ffkey('deleteunsmeared',deleteunsmeared,1,'INTEGER') call ffkey('beam',beamE0,4,'REAL') call ffkey('bfieldmap', bfield_map,20,'MIXED') call ffkey('bfieldtype', bfield_type,20,'MIXED') call ffkey('nosecondaries', nosecondaries,1,'INTEGER') call ffkey('trajectories', storetraj,1,'INTEGER') call ffkey('plog', plog_particle_gun,1,'INTEGER') call ffkey('tlog', tlog_particle_gun,1,'INTEGER') CALL FFKEY('bgrate',bgrate,1,'REAL') CALL FFKEY('bggate',bggate,2,'REAL') CALL FFKEY('savehits',writenohits,1,'INTEGER') CALL FFKEY('showersincol',showersincol,1,'INTEGER') call FFKEY('driftclusters',driftclusters,1,'INTEGER') call FFKEY('tgtwidth',tgtwidth,2,'REAL') call gtgamaff() CALL GFFGO * * Verify that the random number seeds are OK * call GRNDMQ(iseed1,iseed2,0,'G') if ((iseed1.eq.0).and.(iseed2.eq.0)) then write(LOUT,980) 'UGINIT error: ' 980 format(a14,'initial random number generator seeds are 0!') stop 'cannot continue without good random numbers' endif * * Open the input stream * if (infile(1) .gt. 0) then ifail = openInput(infile) if (ifail .ne. 0) then write(lout,9000) infile 9000 format('GUKINE ERROR - Could not open input stream ',20a4) stop endif if (iskip .gt. 0) then ifail = skipInput(iskip) endif if (nevent .eq. 0) then nevent = 999999999 endif endif * * Open the output stream * if (outfile(1) .ne. 0) then ifail = openOutput(outfile) if (ifail .ne. 0) then write(lout,9010) outfile 9010 format('GUKINE ERROR - Could not open output stream ',20a4) stop endif endif * * Assign the beam parameters * if (beamEmin.lt.0) then print * print *, 'Error in uginit:', + ' beamEmin is specified with negative value,', + ' cannot continue.' stop elseif (beamEmin.gt.0.12) then print * print *, 'Error in uginit:', + ' beamEmin is larger than a default value of 0.12 GeV,', + ' cannot continue.' stop endif if(showersincol.ne.0) then print *,'uginit.F: Enable showers in the primary collimator' endif if(writenohits.ne.0) then print *, 'uginit.F: Enable writing events with no hits in the', + ' detector to the hddm output file' endif * Scale BG rate according to the threshold set on energy of bremsstrahlung * photons. bgrate corresponds to Rate(E_brem = 0.12 GeV). if (beamEmin.gt.0) then bgrate = bgrate*(0.12*9.1625*LOG(0.12/beamEmin)/4.936 + 1.0) xMinimum = beamEmin/beamE0 print *,'uginit.F: BGRATE rate is ',bgrate endif if (bgrate .lt. 0) then print * print *, 'Error in uginit:', + ' BGRATE specified with negative value,', + ' cannot continue.' stop elseif (bggate(1) .gt. bggate(2)) then print * print *, 'Error in uginit:', + ' BGGATE specified with negative interval,', + ' cannot continue.' stop endif if (beamE0 .gt. 0) then call cobrems(beamE0,beamEpeak,radColDist) elseif (infile(1) .eq. 0) then continue ! single-particle gun (mode 1), ignore background gen. elseif (bgrate .gt. 0) then print * print *, 'Error in uginit:', + ' BGRATE specified without BEAM card,', + ' cannot continue.' stop endif * * Initialize graphics package * CALL GDINIT * * Initialize the Hall D geometry * call HDDSgeant3_wrapper * if (runtime_geom .eq. 0) then * call HDDSgeant3 * else * call HDDSgeant3_runtime * endif call Goptimize call initcalibdb(bfield_type, bfield_map) call copytocplusplus(infile,outfile,postsmear,mcsmearopts +,deleteunsmeared) call copygatetocplusplus(bggate(1), bggate(2)) * * Open the HBOOK file for output * call HROPEN(50,'RZfile','geant.hbook','N',65536,istat) * * Initialize GEANT tracking structures * C..geant.. CALL GGCLOS CALL GPART CALL GPHYSI CALL GRFILE(3,'hdgeant.rz','ON') CALL HCDIR('//RZfile',' ') * * Initialize the GELHAD package and verify parameters * call gelh_vrfy() * * Load FLUKA and MICAP cross section data if selected * if (IHADR.ge.3) call FLINIT if (IHADR.eq.4) call GMORIN END