Skip to content

OzAmram/PixelTemplateProduction

Repository files navigation

Pixel Template Production

Code for production of pixel templates for CMS

Compiling

Everything is run standalone from the cmssw environment but makes use of some of the code in it.

Run the script fetch_cmssw_code.sh grabs the latest version of all the needed pixel code from the cmssw github. If you want to grab from a branch other than the cmssw master (eg to test some changes), you can change the branch variable in the script to point to a different branch.

The code shared with CMSSW uses the vdt library so you must have it installed. For instructions to install vdt see their github. The Makefile assumes it installed to /usr/local/, if it is installed to some other location, change the vdt_dir variable in the Makefile to point to the correct location.

All of the source code is in the src/ directory which contains a Makefile. So you should be able to compile by simply changing to the src/ directory and running make. All the compiled executables are put in the bin/ directory.

Note that this can be compiled and run from within a CMSSW release by linking to the compiled vdt and BOOST used in CMSSW. Eg on lxplus:

vdt_dir=/cvmfs/cms.cern.ch/slc7_amd64_gcc820/cms/vdt/0.4.0-nmpfii/include includes= -I. -I../cmssw_code/ -I$(vdt_dir) -I/cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/boost/1.67.0-pafccj/include

Making Templates

There are two simple bash scripts that run the necessary executables to make templates: make_1d_templates.sh and make_2d_templates.sh.

They should be run inside a directory containing pixelav events and a config file named pix_2t.proc. They take 1 argument, which is the location of the bin/ directory.

Many files are produced when making templates but for the 1d production the real output is one template file named template_summary_zpXXXX.outand one gen errors file named generror_summary_zpXXXX.out. For 2d production it is one 2d template file named template_summary2D_zpXXXX.out. (The XXXX will be the starting file number in your config).

The format pix_2t.proc is as follows:

start_file nfiles noise thresh1 thresh2 thresh1_noise_frac common_noise_frac gain_noise_frac readout_noise frontend_type

use_l1_offset write_header xtalk_frac xtalk_spread do_cluster_healing

id NTy NTyx NTxx DType Bfield VBias temp fluenc qscale

Note that NTy is not used by the 2D templates so its value doesn't matter, but to keep the format consistent something must be there. Using 0 for xtalk_frac will turn off cross talk. Extra parameters on any of the lines will be ignored.

An example config for 1D barrel templates is:

58401 205 250. 1600. 1600. 0.073 0.080 0.080 350. 0

0 1 0.0 0.0 0

900 60 5 29 0 3.8 125. 263. 0. 1.

Additional lines can be added which turn on the creation of the PixelResolutionHistograms and define their binning.

For gen_zp_template (which stores resolutions in 2x 1D bins of fixed width) this additional line should be structured as:

name CotBetaBinWidth CotBetaStart nCotBetaBins CotAlphaBinWidth CotAlphaStart nCotAlphaBins

For gen_zp_template2d (which stores resolutions in 2D bins) these additional lines should be structured as:

name CotBetaBinEdge1 CotBetaBinEdge2 CotBetaBinEdge3 CotBetaBinEdge4 ... CotAlphaBinEdge1 CotAlphaBinEdge2 CotAlphaBinEdge3 CotAlphaBinEdge4 ...

Where the 2nd and 3rd rows can be as long as desired and list the bin edges for the CotBeta and CotAlpha binning. Examples can be found in the config_db directory.

Description of Executables

gen_xy_template : Makes 1D projections of average charge distributions from pixelav events. Also does charge variance fits. Makes files like ptemp_XXXX.txt and ztemp_XXXX.txt.

gen_xy_template2d : Makes 2d projections of average charge distributions from pixelav events. Makes files like zptemp_XXXX.txt.

gen_zp_template: Uses the 1D projections and pixelav events. Runs the generic and template reco (using CMSSW code) on pixelav events to get resolution different algorithms and compute corrections to be saved in templates. Outputs one template file named template_summary_zpXXXX.outand one gen errors file named generror_summary_zpXXXX.out.

gen_zp_template2d: Uses the 1D and 2D projections and pixelav events. Runs the 2D template reco (using CMSSW code) on pixelav events to get resolution. Outputs one 2d template file named template_summary2D_zpXXXX.out.

compare_templates: Takes in the file names of two templates and checks that all numerical values are the same within some threshold (default is 10^-5). It lists any discrepancies with the line number for investigation. Useful for testing changes.

test_template: Uses pre-made 1D templates to run local version of CMSSW 1D template reco and makes various plots. Useful for testing a new set of 1D templates. Should be run a directory with template_events, generror and template_summary files. Also takes a config called test_params.txt. The first line of the config is the same as the pix_2t.proc but without the nfiles parameter (because it will only use one file). The second line has six parameters:

nFile use_l1_offset xtalk_frac xtalk_noise do_cluster_healing do_IBCs do_2d_templates

nFile is the file number of the template (the XXXXX) and the second is the use_l1_offset parameter, xtalk_frac is the fractional charge sharing for the cross talk, the xtalk_noise is the gaussian spread on the central value of the charge sharing, do_cluster_healing turns on the cluster healing before the CPEs, do_IBCs turns on the irradiation bias corrections for the generic algorithm, do_2d_templates tests the 2d reco as well and produces some additional plots (2d templates must be provided).

An example test_params.txt config is:

58606 150. 1600. 1600. 0.073 0.080 0.08 350. 0

58401 0 0.0 0.0 1 0 0

About

Code to make pixel templates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •