Skip to content

Instantly share code, notes, and snippets.

View kpedro88's full-sized avatar

Kevin Pedro kpedro88

  • Fermi National Accelerator Laboratory
View GitHub Profile
@kpedro88
kpedro88 / fork_and_pull.md
Last active July 8, 2024 23:01
Basic fork and pull development model

This tutorial assumes you are working on a repository TheRepo whose main instance is hosted by an organization TheOrg with a main branch TheBranch. (TheRepo, TheOrg, and TheBranch are placeholder values that you should fill in based on the repo you're using.)

1. Fork TheRepo on GitHub to create your fork TheFork (only needs to be done once):

In the top-right corner of the page, click Fork.

See example at GitHub: Fork A Repo
(Don't actually follow the exact steps on this page; use it as an example and apply the steps to the repo you're using.)

2. Clone a local version of the code from TheFork (and follow any other necessary installation instructions for the repo):

#!/bin/bash -e
# this script follows:
# https://github.com/cms-sw/cmsdist/blob/IB/CMSSW_7_1_X/stable/pythia8.spec
# https://github.com/cms-sw/cmsdist/blob/IB/CMSSW_7_1_X/stable/pythia8-toolfile.spec
# environment check
if [ -z "$CMSSW_BASE" ]; then
echo "you need to run \cmsenv\""
exit 1
@kpedro88
kpedro88 / testSiPMs.py
Last active January 7, 2017 23:44
testSiPMs
import FWCore.ParameterSet.Config as cms
from FWCore.ParameterSet.VarParsing import VarParsing
options = VarParsing("analysis")
# geant time, photostatistics, pedestal width (noise), timeslew, dark current, crosstalk, nonlinearity
_params = ["GT", "PS", "PW", "TS", "DC", "CT", "NL"]
for p in _params:
options.register(p, False, VarParsing.multiplicity.singleton, VarParsing.varType.bool)
options.register("outpre", "step2", VarParsing.multiplicity.singleton, VarParsing.varType.string)
options.register("output", "FEVTDEBUGHLToutput", VarParsing.multiplicity.singleton, VarParsing.varType.string)
@kpedro88
kpedro88 / Era_Run2_2017_FastSim_cff.py
Created December 7, 2017 16:16
temp era for fastsim 2017 testing
import FWCore.ParameterSet.Config as cms
from Configuration.Eras.Era_Run2_2017_cff import Run2_2017
from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017
Run2_2017_FastSim = Run2_2017.copyAndExclude([run2_GEM_2017])
#!/bin/bash
export SCRAM_ARCH=slc6_amd64_gcc530
# cmsrel
CMSSWVER=CMSSW_8_0_30
scram project ${CMSSWVER}
cd ${CMSSWVER}
git clone git@github.com:cms-sw/pkgtools.git -b V00-30-XX
git clone git@github.com:kpedro88/cmsdist.git -b cgal_and_fastjet/IB/CMSSW_8_0_X/gcc530
pkgtools/cmsBuild -i pkgs -a ${SCRAM_ARCH} --builders 2 -j 8 build cgal-toolfile fastjet-toolfile
#!/bin/bash
NEWDIR=unagedECAL
mkdir -p $NEWDIR
for i in *.py; do
sed 's/customise_aging_4500_ultimate(process)/ageHcal(process,4500,7.5e34,"ultimate")/; s/customise_aging_4500_ultimate/ageHcal/' $i > ${NEWDIR}/$i
done
@kpedro88
kpedro88 / ntuple_instructions.md
Last active March 29, 2019 22:48
TreeMaker Ntuple Production V17 Instructions
  1. Log into CMS Connect (replace [username] with your CMS Connect username):
    ssh [username]@login.uscms.org
    
  2. Make a working directory:
    mkdir -p /local-scratch/`whoami`/work/v17; cd /local-scratch/`whoami`/work/v17
    
  3. Follow the TreeMaker installation instructions:
from EventListFilter import *
filter_dir = '/uscms_data/d3/pedrok/SUSY2015/upgrade/for2018/CMSSW_10_2_11_patch1/src/TreeMaker/ecalBadCalibFilterLists/test/'
filter_files = [
filter_dir+'Summer16v5-Nano1June2019_QCD_Pt_300to470_TuneCUETP8M1_13TeV_pythia8_EcalDeadCellBoundaryEnergyFilterList.txt',
filter_dir+'Summer16v5-Nano1June2019_QCD_Pt_300to470_TuneCUETP8M1_13TeV_pythia8_ext1_EcalDeadCellBoundaryEnergyFilterList.txt',
]
EcalDeadCellBoundaryEnergyFilter = EventListFilterMC(filter_files)
#!/bin/bash
WHICH_CMSSW=CMSSW_9_4_14_patch1
export SCRAM_ARCH=slc6_amd64_gcc630
scramv1 project CMSSW $WHICH_CMSSW
cd $WHICH_CMSSW
eval `scramv1 runtime -sh`
# some really bad ways to get info out of scram
@kpedro88
kpedro88 / get_cpu_compare_data.py
Created November 30, 2020 21:09
Phase 2 CPU usage plot
files = dict(
D41 = [
["cl_compare_cpu_11_0_0Pre1vsPre2___.txt",["11_0_0_pre1","11_0_0_pre2"]],
["cl_compare_cpu_11_0_0Pre2vsPre3.txt",["11_0_0_pre3"]],
["cl_compare_cpu_11_0_0Pre3vsPre4.txt",["11_0_0_pre4"]],
["cl_compare_cpu_11_0_0Pre4vsPre5.txt",["11_0_0_pre5"]],
# ["cl_compare_cpu_11_0_0Pre5vsPre6.txt",["11_0_0_pre6"]], # bug
["cl_compare_cpu_11_0_0Pre6vsPre7.txt",["11_0_0_pre7"]],
["cl_compare_cpu_11_0_0Pre7vsPre8.txt",["11_0_0_pre8"]],
["cl_compare_cpu_11_0_0Pre8vsPre9.txt",["11_0_0_pre9"]],