1 / 23

GlueX Simulation

GlueX Simulation. Richard Jones Parallelism in Experimental Nuclear Physics Workshop January 6-7, 2011 Christopher Newport University Newport News, VA. Outline. simulation tools browsing the hits browsing the geometry getting under the hood. Simulation tools. log. prescription.

nanji
Download Presentation

GlueX Simulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. GlueX Simulation Richard Jones Parallelism in Experimental Nuclear Physics WorkshopJanuary 6-7, 2011Christopher Newport UniversityNewport News, VA

  2. Outline • simulation tools • browsing the hits • browsing the geometry • getting under the hood Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  3. Simulation tools log prescription event generator prescription log hdgeant histos parameters parameters mcsmear log event analyser Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  4. running hdgeant • very simple interface: $ hdgeant • reads prescription, parameters from: ./control.in + many more parameters: see distribution control.in C a very simple control.in example INFILE 'rhop.hddm‘ OUTFILE 'hdgeant.out' TRIG 1000 Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  5. running hdgeant c This is the control file for the GEANT simulation. Parameters defined c in this file control the kind and extent of simulation that is performed. c The full list of options is given in section BASE-40 of the GEANT manual. c c In addition, some new cards have been defined to set up the input source c for the simulation. Three kinds of simulation runs are available, selected c by which of the following three "cards" are present below. c 1. Input from Monte Carlo generator (card INFILE) c 2. Built-in coherent bremsstrahlung source (card BEAM) c 3. Built-in single-track event generator (card KINE) c The order of the list is significant, that is if INFILE is present then the c BEAM and KINE cards are ignored, otherwise if BEAM is present then KINE is c ignored. For example, the 3-card sequence: c INFILE 'phi-1680.hddm' c SKIP 25 c TRIG 100 c instructs HDGeant to open ./phi-1680.hddm, skip the first 25 events and then c process the following 100 input events and stop. If the end of the file is c reached before the event count specified in card TRIG is exhausted then the c processing will stop at the end of file. cINFILE 'rhop.hddm' TRIG 1000 c The BEAM card configures the built-in coherent bremsstralung photon c beam generator in HDGeant. If the INFILE card is not present and BEAM c is specified, the internal coherent bremsstralung generator is the primary c source of events for the simulation. If INFILE is specified, the primary c event source is the external Monte Carlo generator that produced the file, c but the BEAM card may still be present, and it is needed if beam-related c backgrounds are being superimposed on top of the primary event signals, c as requested with the BGRATE card (see below). The beam card accepts c the following three parameters. c Emax - end-point energy of the electron beam (GeV) c Epeak - energy of the primary coherent peak edge (GeV) c Emin - minimum energy of the coherent bremsstrahlung beam (GeV) c Omitting the final parameter Emin results in the default value being used. BEAM 12. 9. c Commenting out the following line will disable simulated hits output. OUTFILE 'hdgeant.hddm' c The following are used to automatically invoke the mcsmear program c to do the final stage digitization of hits after the simulation c stage is complete. This simply invokes the mcsmear program passing c it any optional arguments supplied here and then optionally deletes c the OUTFILE specified above leaving only the smeared file. This stage c can be invoked by hand afterwards, but having it done automatically c here allows hdgeant and mcsmear to function as though it were a single c program. The specific keys are as follows. c c POSTSMEAR - set this 1 to auto-invoke the mcsmear program and 0 to not c DELETEUNSMEARED - set this to 1 to delete the OUTFILE after running mcsmear c MCSMEAROPTS - String to specify additional arguments to pass to mcsmear POSTSMEAR 0 DELETEUNSMEARED 0 c MCSMEAROPTS '-t1000 -d0' c The following card enables single-track generation (for testing). c For a single-particle gun, set the momentum (GeV/c), direction c theta,phi (degrees) and vertex position (cm), and for the particle c type insert the Geant particle type code plus 100 (eg. 101=gamma, c 103=electron, 107=pi0, 108=pi+, 109=pi-, 114=proton). If you use c the particle code but do not add 100 then theta,phi are ignored c and the particle direction is generated randomly over 4pi sr. c For a listing of the Geant particle types, see the following URL. c http://wwwasdoc.web.cern.ch/wwwasdoc/geant_html3/node72.html c The meaning of the arguments to KINE are as follows. c - particle = GEANT particle type of primary track + 100 c - momentum = initial track momentum, central value (GeV/c) c - theta = initial track polar angle, central value (degrees) c - phi = initial track azimuthal angle, central value (degrees) c - delta_momentum = spread in initial track momentum, full width (GeV/c) c - delta_theta = spread in initial track polar angle, full width (degrees) c - delta_phi = spread in initial track azimuthal angle, full width (degrees) c c If you do explicitly specify the momentum/angle (by adding 100 as c described above, you may also choose to distibute tracks evenly in c log(P) or log(theta) by setting the appropriate PLOG and TLOG flags c to a non-zero value. c PLOG 1 c TLOG 1 c c particle momentum theta phi delta_momentum delta_theta delta_phi KINE 101 9.0 10. 0. 0. 3. 360. c The SCAP card determines the vertex position for the particle gun. It c supports the following three arguments, all of which default to 0. c c vertex_x vertex_y vertex_z SCAP 0. 0. 65. Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  6. running hdgeant • 2 (3) running modes: batch or interactive (+ motif) $ hdgeant $ hdgeant++ (“m” = motif) Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  7. running mcsmear • can be run automatically by hdgeant (POSTSMEAR) • custom parameters specified on command line Usage: mcsmear [options] file.hddm Read the given, Geant-produced HDDM file as input and smear the truth values for "hit" data before writing out to a separate file. The truth values for the thrown particles are not changed. Noise hits can also be added using the -n option. Note that all smearing is done using Gaussians, with the sigmas configurable with the options below. Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  8. running mcsmear • can be run automatically by hdgeant (POSTSMEAR) • custom parameters specified on command line Options: -N Add random background hits to CDC and FDC -s Don't smear real hits (default is to smear) -u# Sigma CDC anode drift time in ns (def:2.72727ns) (NOTE: this is only used if -y is also specified!) -y Do NOT apply drift distance dependence error to CDC (default is to apply) -t# CDC time window for background hits in ns [1000ns] -U# Sigma FDC anode drift time in ns [3.63636ns] -C# Sigma FDC cathode strips in microns [3.63636e-09ns] -t# FDC time window for background hits in ns [1000ns] . . . -h Print this usage statement. Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  9. running mcsmear • can be run automatically by hdgeant (POSTSMEAR) • custom parameters specified on command line Example: mcsmear -u3.5 -t500 hdgeant.hddm This will produce a file named hdgeant_nsmeared.hddm that includes the hit information from the input file hdgeant.hddm but with the FDC and CDC hits smeared out. The CDC hits will have their drift times smeared via a gaussian with a 3.5ns width while the FDC will be smeared using the default values. In addition, background hits will be added, the exact number of of which are determined by the time windows specified for the CDC and FDC. In this examplem the CDC time window was explicitly set to 500 ns. Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  10. Browsing the hits • uses browsable xml-style “hddm” format • to see what is in file xy.hddm, just do $ more xy.hddm gryphn> more out.hddm <HDDM class="s" version="1.0" xmlns="http://www.gluex.org/hddm"> <physicsEvent eventNo="int" maxOccurs="unbounded" runNo="int"> <reaction maxOccurs="unbounded" minOccurs="0" type="int" weight="float"> <beam minOccurs="0" type="Particle_t"> <momentum E="float" px="float" py="float" pz="float" /> <properties charge="int" mass="float" /> </beam> <target minOccurs="0" type="Particle_t"> <momentum E="float" px="float" py="float" pz="float" /> <properties charge="int" mass="float" /> </target> <vertex maxOccurs="unbounded"> <product decayVertex="int" id="int" maxOccurs="unbounded" mech="int" par entid="int" pdgtype="int" type="Particle_t"> <momentum E="float" px="float" py="float" pz="float" /> <properties charge="int" mass="float" /> Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  11. Browsing the hits • to see contents of file xy.hddm, do $ hddm-xml xy.hddm gryphn> hddm-xml out.hddm <?xml version="1.0" encoding="UTF-8"?> <HDDM class="s" version="1.0" xmlns="http://www.gluex.org/hddm"> <physicsEvent eventNo="58" runNo="1"> <reaction type="0" weight="0"> <vertex> <product decayVertex="0" id="1" mech="0" parentid="0" pdgtype="0" type=" gamma"> <momentum E="9.1194" px="-0.000276329" py="-0.000385855" pz="9.1194" /> </product> <origin t="-7.55523e-08" vx="-0.223289" vy="-0.226387" vz="-2200" /> </vertex> </reaction> <hitView version="2.0"> <tagger> <microChannel E="9.1344" column="112" row="0"> <taggerHit t="0" /> Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  12. Browsing the geometry • 2 ways: read plain xml or hdgeant++ graphical viewer hierarchical structure documentation in comments readable names for structural elements Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  13. Browsing the geometry • 2 ways: read plain xml or hdgeant++ graphical viewer gryphn> hdgeant++ *************************************************** * * * G E A N T 3 . 2 1 * * * * C E R N * * * * 15/3/94 Geneva CH * * * *************************************************** *** Using default PAWLOGON file "/home/jonesrt/.pawlogon.kumac" GEANT > usage dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] GEANT > dxcut site 90 0 65 Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  14. Browsing the geometry GEANT > help dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] NAME C 'Volume name' CUTTHE R 'Theta angle of the line normal to cut plane' R=0.:360. CUTPHI R 'Phi angle of the line normal to cut plane' R=0.:360. CUTVAL R 'Cut plane distance from the origin along the axis' THETA R 'Viewing angle theta (for 3D projection)' R=0.:360. PHI R 'Viewing angle phi (for 3D projection)' R=0.:360. U0 R 'U-coord. (horizontal) of volume origin' V0 R 'V-coord. (vertical) of volume origin' SU R 'Scale factor for U-coord.' SV R 'Scale factor for V-coord.' CALL GDRAWX(name,cutthe,cutphi,cutval,theta,phi,u0,v0,su,sv) The cut plane is normal to the line given by the cut angles cutthe and cutphi and placed at the distance cutval from the origin. The resulting picture is seen from the viewing angles theta,phi. If optional parameters are missing, the current values in /GCDRAW/ are taken. Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  15. Browsing the geometry GEANT > usage dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] GEANT > dxcut site 90 0 1 GEANT > Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  16. Browsing the geometry GEANT > usage dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] GEANT > dxcut site 90 0 1 GEANT > wc#setview 10 10 .01 .01 GEANT > wc#angles 30 150 GEANT > wc#dxcut site 90 0 1 GEANT > Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  17. Browsing the geometry GEANT > usage dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] GEANT > dxcut site 90 0 1 GEANT > wc#setview 10 10 .01 .01 GEANT > wc#angles 30 150 GEANT > wc#dxcut site 90 0 1 GEANT > wc#pick o 1 points have been hit wc origin reset to (1,-0.61207,68.9271) GEANT > Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  18. Browsing the geometry GEANT > usage dxcut * GEANT/DRAWING/DXCUT NAME CUTTHE CUTPHI CUTVAL [ THETA PHI U0 V0 SU SV ] GEANT > dxcut site 90 0 1 GEANT > wc#setview 10 10 .01 .01 GEANT > wc#angles 30 150 GEANT > wc#dxcut site 90 0 1 GEANT > wc#pick o 1 points have been hit wc origin reset to (1,-0.61207,68.9271) GEANT > wc#setview 10 10 .3 .3 GEANT > wc#dxcut site 90 0 1 GEANT > wc#pick m GEANT > wc#pick 1 points have been hit point 1: 1.0000005 -0.14630273 71.088165 LIH2 LiqHydrogen /SITE 1/HALL 1/TARG 1/TGTV 1/LIH2 1/ inhomogeneous field (0.023536, -0.0034433, -18.454) kG GEANT > Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  19. Getting under the hood • a place to start: gustep.F • instrument gustep() to snoop on the simulation • lots of examples in the code • enclose your customizations in #ifdef / #endif blocks SUBROUTINE GUSTEP * ************************************************************************ * * * User routine called at the end of each tracking step * * MEC is the mechanism origin of the step * * INWVOL is different from 0 when the track has reached * * a volume boundary * * ISTOP is different from 0 if the track has stopped * * * ************************************************************************ Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  20. Getting under the hood • example: CERENKOV_PID_NTUPLE • near the top, add a block to define variables to be saved • place them in the desired order in a named common block • define a string like below to document the common block #if defined CERENKOV_PID_NTUPLE integer evno,part real xvtx(3),xdet(3),pdet(3) common /ckovNtuple/evno,xvtx,xdet,pdet,part save /ckovNtuple/ character*80 ntckovdef parameter (ntckovdef='ev:I,xv(3):R,xt(3):R,p(3):R,part:I,vid:I') integer ntckov parameter (ntckov=10) #endif Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  21. Getting under the hood • example: CERENKOV_PID_NTUPLE • down in the body, add the code to define, fill the ntuple #if defined CERENKOV_PID_NTUPLE if (.not.HEXIST(ntckov)) then call HBNT(ntckov,'cerenkov counter hits','') call HBNAME(ntckov,'hits',evno,ntckovdef) endif if (NSTEP.eq.0) then xvtx(1) = VECT(1) xvtx(2) = VECT(2) xvtx(3) = VECT(3) elseif (INWVOL.eq.1) then if (cnames(NLEVEL).eq.'CGAS') then xdet(1) = VECT(1) xdet(2) = VECT(2) . . . call HFNT(ntckov) endif endif #endif Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  22. Getting under the hood • example: CERENKOV_PID_NTUPLE • run the simulation in interactive mode: $ hdgeant++ • simulate a few events: GEANT> trig 10 • browse the ntuple for results: GEANT> n/pl 10.ev • if satisfied, run a longer simulation • output ntuple appears in new file geant.hbook Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

  23. Now for the real tutorial… • The goals of this session are • generate events with the genr8 program • generate events with the bggen program (pythia) • run hdgeant (+mcsmear) to simulate events Parallelism in Experimental Nuclear Physics Workshop, Jan. 6-7, 2011, Newport News, VA

More Related