Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Line Segment Tracking Sample Generation

Manos Vourliotis edited this page Apr 11, 2023 · 16 revisions

Line Segment Tracking Sample Generation Wiki

Setup for CMSSW_12_6_3 samples

In a directory of your choice:

source /cvmfs/cms.cern.ch/cmsset_default.sh
cmsrel CMSSW_12_6_3
cd CMSSW_12_6_3/src
cmsenv

Sample configuration

The samples are created from runTheMatrix.py workflows. One can use the following command to print a collection of workflows:

runTheMatrix.py -w upgrade -n -e

The -w flag results in only the "upgrade" relevant workflows to be shown, the -n flags only shows the workflows, instead of also running them, while the -e flag shows details of each workflow.

ttbar sample

The commands of the relevant workflow can be found with:

runTheMatrix.py -w upgrade -n -e -l 21034.0

The [1] and [2] steps need to be run, adjusting the number of events (-n flag) accordingly.

Rename the output of step[1] by

mv TTbar_14TeV_TuneCP5_cfi_GEN_SIM.root step2_SIM.root

In the step2 configuration, the files used for the PU should be noted (see process.mix.input.fileNames option), as they will be used in step3 (tracking NTuple production). These files can be accessed remotely, e.g.:

/store/relval/CMSSW_12_3_0_pre5/RelValMinBias_14TeV/GEN-SIM/123X_mcRun4_realistic_v4_2026D88noPU-v1/10000/066fc95d-1cef-4469-9e08-3913973cd4ce.root

but they have also been downloaded locally for convenience on phi3 in:

/data2/segmentlinking/PUSamplesForCMSSW1263/CMSSW_12_3_0_pre5/RelValMinBias_14TeV/GEN-SIM/123X_mcRun4_realistic_v4_2026D88noPU-v1/

and can be used by including like this:

file:/data2/segmentlinking/PUSamplesForCMSSW1263/CMSSW_12_3_0_pre5/RelValMinBias_14TeV/GEN-SIM/123X_mcRun4_realistic_v4_2026D88noPU-v1/066fc95d-1cef-4469-9e08-3913973cd4ce.root

rename the output of step [2] by

mv step2_DIGI_L1TrackTrigger_L1_DIGI2RAW_HLT_PU.root step2.root

Gun samples

The commands of the workflow that produces a muon gun of 10 particles (5 particles + 5 antiparticles) with a flat energy distribution from 0 to 200 GeV can be found with:

runTheMatrix.py -w upgrade -n -e -l 20811.0

In order to get a sample of 10 independent particles per event, the line

AddAntiParticle = cms.bool(True)

needs to be changed to False and the line

ParticleID = cms.vint32(-13, -13, -13, -13, -13),

needs to be replaced by

ParticleID = cms.vint32(13, -13, 13, -13, 13, -13, 13, -13, 13, -13),

The samples that we use have a flat pT distribution. As a result, one should run step [1] with the number of events adjusted and the extra --no_exec flag added, so that the configuration is only created and not run. Then, the EDFilter Pythia8EGun needs to be changed to Pythia8PtGun, together with MaxE to MaxPt and same for the min parameter. The range of pT needs to also change accordingly, along with, possibly, some of the naming in the configuration file.

For the muon gun samples, only the pT ranges are left to change.

  • For the muonGun sample (low pT), the pT range is set to 0.5 and 2 GeV.
  • For the muonGun_highPt sample (high pT), the pT range is set to 0.5 and 50 GeV.

For the cube samples, the same setups as above (naming convention and pT range) exist. Moreover, the line

process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC_cfi')

needs to be replaced by

process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi')

Additionally, the following lines need to be added:

process.VtxSmeared.MaxZ = 5
process.VtxSmeared.MinZ =-5
process.VtxSmeared.MaxX = 5
process.VtxSmeared.MinX =-5
process.VtxSmeared.MaxY = 5
process.VtxSmeared.MinY =-5
process.VtxSmeared.MaxT = 0.001
process.VtxSmeared.MinT = 0.001

Use the lines exactly as above for the cube(5cm) sample and replace 5 with 50 for the cube50cm sample.

For pion sample, the only change with respect to the muonGun_highE configuration is that the line

ParticleID = cms.vint32(13, -13, 13, -13, 13, -13, 13, -13, 13, -13),

needs to be changed to something like

ParticleID = cms.vint32(211, -211, 211, -211, 211, -211),

i.e. produce 3 charged pions + 3 charged antipions.

Finally, after all of the previous adjustments have been made, step [1] can be run with cmsRun, followed by step [2] from the workflow.

Tracking NTuple

cmsDriver.py step3  \
    --conditions auto:phase2_realistic_T21 \
    --datatier GEN-SIM-RECO,MINIAODSIM,DQMIO \
    --eventcontent FEVTDEBUGHLT,MINIAODSIM,DQM \
    --geometry Extended2026D88 \
    --era Phase2C17I13M9  \
    -n -1  \
    --filein  file:step2.root  \
    --fileout file:step3.root  \
    --lazy_download \
    --nThreads 1 \
    --customise Validation/RecoTrack/customiseTrackingNtuple.customiseTrackingNtuple \
    --customise Validation/RecoTrack/customiseTrackingNtuple.extendedContent \
    --customise_command="process.trackingNtuple.clusterMasks = []" \
    -s RAW2DIGI,L1Reco,RECO,RECOSIM,PAT,VALIDATION:@phase2Validation+@miniAODValidation,DQM:@phase2+@miniAODDQM \
    --no_exec

cmsRun step3_RAW2DIGI_L1Reco_RECO_RECOSIM_PAT_VALIDATION_DQM.py > trackingNTuple.log  2>&1

The --conditions, --geometry, --era and -n flags should agree with the previous steps run and --filein flag should point to the file created on the previous step (step2). The customization with extendedContent is also not strictly needed but is useful because it includes the simhit momentum, which used to be used in some (now commented out) functions within TrackLooper repo.

ttbar sample

As mentioned also in the previous section, the PU files used for the creation of the ttbar sample must be included during the production of the tracking NTuple. This is achieved by adding the following options to the above command:

        --pileup AVE_200_BX_25ns \
        --pileup_input ${PUFILES}  \

where ${PUFILES} are the files mentioned in the step2 config.

If you run with the local PU files, you need to manually modify process.mix.input.fileName part in step3_RAW2DIGI_L1Reco_RECO_RECOSIM_PAT_VALIDATION_DQM_PU.py to include all the pile up file used in step2. But if you use files from das, you may have to deal with poor connections to fnal file system....

In this case, the resulting configuration file will be named step3_RAW2DIGI_L1Reco_RECO_RECOSIM_PAT_VALIDATION_DQM_PU.py and the following line needs to be added to it, before the customizations:

process.simHitTPAssocProducer.simHitSrc += ["g4SimHits:TrackerHitsPixelBarrelHighTof", "g4SimHits:TrackerHitsPixelEndcapHighTof"]

The resulting trackingNtuple.root file is the one to be used as the input for the LST Geometry and TrackLooper repos.

Notes on resource usage

Creating the tracking NTuple can be very resource demanding, especially in the case where there is PU. Listed below are some estimations for the disk space, memory and time needed for the producing the tracking NTuple with 4 threads for 500 events of the PU200 ttbar sample with different configurations:

  • Nominal configuration (instructions above):

    • Disk space: ~71GB
    • Memory: ~17GB
    • Time: ~4h
  • Configuration without the extendedContent customization:

    • Disk space: ~14GB
    • Memory: ~14GB
    • Time: ~4h
  • Configuration without the extendedContent customization and dropping the simhits:

    • Disk space: ~5GB
    • Memory: ~11GB
    • Time: ~4h

The last configuration does not currently work with our code. However, modifications will be explored so that we no longer do the simhit-to-recohit matching in our code but we instead pass it down from the tracking NTuple.

make tracking mtv plots in CMSSW(optional)

step [4] in the workflow creates DQM output root files, which can be used to generate mtv plots. run the tracking only for ttbar+pileup.

runTheMatrix.py -w upgrade -n -e -l 21034.1

Following all the steps through [1] to [4]. Need to rename the output of step [3]

mv step3_RAW2DIGI_RECO_VALIDATION_DQM_PU_inDQM.root step4_RECO.root

Then do the plotting with

makeTrackValidationPlots.py --extended DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root