How To Simulate CMS Detector Response to Particles in CMSIM

 
 



What we want to do :

    Generate a bunch of particles via Monte Carlo in PYTHIA, or single particles from a "Particle Gun", and pass them along to a simulated CMS detector (CMSIM).  We are ultimately interested in doing the Reconstruction and Analysis in ORCA, so we will keep this in mind as we procede.
 

To generate a bunch of particles (from collisions):

     Follow the instructions for making particles with PYTHIA on the How To "Use ROOT For Analysis of HEPEVT Ntuples Generated From CMGEN" web page.

EXCEPT:  When excecuting the script, replace 'none' at the end of the command line with the generator name.  For example :

     setup.csh muon higgs_muon 1 10 800001 800000 800000 1 cms120 kine_make_ntpl_pyt_cms120.exe  cms120.exe

where my title card is higgs_muon_gen.tit in the muon Template directory and the generator is cmsim120.

From here on out, you can proceed as before with the same commands we used to make the HEPEVT Ntuples.
 
 

To generate a bunch of single particles (the "Particle Gun"):

     This is sort of similiar to making particles with PYTHIA on the How To "Use ROOT For Analysis of HEPEVT Ntuples Generated From CMGEN" web page.

EXCEPT:    To create a single particle to send through the detector (say a muon with pt=100GeV at eta =2.0 and phi=90), we will need to make a slightly different datacard and use a different executable than when making a bunch of particles.  The datacard we need to make has to be called  <something>_sim.tit.  This datacard should only contain CMSIM commands or options.  To keep it simple, we only tell CMSIM to generate a bunch of single particles (no changes to the detector responses) by makeing the following datacard called muon_gun_sim.tit: 

    C-------------------------------------------------------------------
    C    *.ntpl no use   etamin etamax  fimin  fimax  ptmin ptmax
    KINE   1      5.     1.4    1.4      90.    90.    10.   10. 1.
    C
    GEOM  'CMSE' 3 'VCAL' 1

   Everything with a 'C' in front is a comment line.  KINE specificies the kinematics to use, the '1' tells CMSIM to take the local information ('0' would tell it to read it out of a ntuple, like when we generated a bunch of particles w/  collisions).  The next line specifies the detail of the detector geometry (see the CMSIM manual or the annotations I made to a CMSIM script at the bottom of the page).

  To execute the the script which will generate everything we need, we specify the PYTHIA generator as 'none' and the generator name as cms120_single.exe

     setup.csh muon higgs_muon 1 10 800001 800000 800000 1 cms120 none  cms120_single.exe

  From here on out, you can proceed as before with the same commands we used to make the HEPEVT Ntuples.

   If you really want to impress your advisor, you can make some very nice pictures of what you are doing with your particle gun and the detector.   Check out the instructions on "How To Use Interactive CMSIM".
 

Now that you sort of know what to do ... you can do some more.

If you want to make additional changes to the default script which tells cmsim what to do, you can edit the .run file produced by the setup.csh script located in the ./Projects/<your_script_name>/scripts directory or the makeJob.pl file in the ./scripts directory.

The CMSIM manuals are located at http://cmsdoc.cern.ch/cmsim/manual.  I thought the documentation for CMSIM was incomplete and a little hard to understand, so I annotated some of the important entries for the default file generated by makeJob.pl and placed it at the very bottom of this web page.  I recommend you stick with the default script generated, but you should take a look at the manual at least once in your life - particularly if you want to understand how each sub-detector simulation is carried out.

Important Note : The default script does not turn on the digitization and track reconstruction for the detector simulation.  You will not want to do the digitization in CMSIM if you plan on using ORCA to do the reconstruction and analysis (especially if you plan on incorporating pileup into your simulation) as the amount of CPU time to simulation digitization is very large and the simulation of even a small set of event would be tremendously time consuming.  It will be better to fold in the pile up and/or minimum bias events already prepared at CERN into your dataset when using ORCA.
 

When the job is finished running, you can look at the output :

 cd ../output    // For Pythia Output (ntuples)
 cd ../results    // For CMSIM Output (.fz Zebra file)

The ntuple contains the HEPEVT info from PYTHIA/CMGEN.  The .fz file contains the information regarding how and where the particle passed through the detector (magnetic fields, energy loss, scattering of iron., etc) and what sort of response each subdetector will give.  To look at this data, you need ORCA ...
 
 



Sample portion of a *.run file containing the CMSIM Datacard:
 
 
$simexe > ${OUTPUT_PATH}${SIMOUTPUT} <<EOF2
LIST
C    GET  'INIT'
DCAY 1
MULS 1
MUNU 1
LOSS 2
PHOT 1
COMP 1
PAIR 1
BREM 1
DRAY 0
ANNI 1
HADR 1                          // Turn On/Off Hadron Showers
AUTO 1
RNDM 800000 1
CUTS 0.0001 (CUTGAM)  0.001 (CUTELE)  0.01  (CUTNEU)  0.01 (CUTHAD)
     0.01  (CUTMUO)  0.001 (BCUTE )  0.001 (BCUTM )  1.E4 (DCUTE )
     1.E4  (DCUTM )  0.01  (PPCUTM)  1.E10 (TOFMAX)  5*0. (GCUTS/User)
C-------------------------------------------------------------------
C    Nominal collision point and     sigmas  (cm)   Lumi/10**34  Nppfl
BEAM    0.    0.    0.       0.0015  0.0015    5.3    0.1         0
C-------------------------------------------------------------------
C    *.ntpl no use   etamin etamax  fimin  fimax  ptmin ptmax
KINE   0      0.     -5.5    5.5      0.    360.    0.   9999. 1.
                        // Kine generates particles (separate table from PYTHIA)
                        // Kine 1. means external data (Pythia)
C
GEOM  'CMSE' 3 'VCAL' 1         // Pick CMS detector geometry
                                // (3=detail, 2=simple, 1= average)

TIME  5.   5.  1
RUNG 800001  1

GAST 1 0.0001
SETS  'CMSE' 1 'MUON' 1         // Turn ON(1)/Off(0) HITS [Trigger on particle] JUNK  'CMSE' 0
                                                                  // Turn ON(1)/Off(0) Particle Noise
PILE  'CMSE' -1                 // # Bunches before and after initial bunch
                                                     // (-1=only initial bunch, no minimum bias events)
NOIS  'CMSE' 0                  // Turn ON(1)/Off(0) Electronics Noise
DIGI  'CMSE' 1                   // Turn ON(1)/Off(0) DIGITIZATION (make signals from E deposits)
TRGP  'CMSE' -1              // Turn ON(1)/Off(0) Trigger Primatives

RHIT  'CMSE' 1                  // Turn ON(1)/Off(0) Hit Reconstruction
RECO  'CMSE' 0                 // Turn ON(1)/Off(0) Reconstruction (as in final Recon)
                                                     // (leave OFF - we want ORCA)
CFIL                                          // CFIL is Flag to use other DB files (seen below)
     'HBKO' '$OUTPUT_PATH/Z_Production_retry2_800001.hbook '                // HBOOK output file
     'FMAP' '$CMS_DB/detc/fmap_2dfld100.tz '                                                            // user field map
     'EVSI' '$OUTPUT_PATH/Z_Production_retry2_800001.ntpl '                       // ntuple kinematics input
     'EVTO' '$RESULTS_PATH/Z_Production_retry2_800001.fz '                        // events output file
     'VCSH' '$CMS_DB/vcal/vfcal_tdr.rz '

SAVE 'HEAD' 'HITS' 'KINE' 'VERT'        // Output Structures selection
HSTA 'TIME' 'SIZE' 'MULT' 'NTRA' 'STAK'
HBOOK 'CMSE' -1                                               // HBOOK output (-1 = turn ON all)
                                                                                         // (default is 0=OFF)
CMSC -1 (turn off scan )
SWIT   0      3       0       0       6*0    (to see charged & neutrals)
TRIG  1