Skip to content

Instantly share code, notes, and snippets.

View Brainz22's full-sized avatar

Russell Marroquin Brainz22

View GitHub Profile
@Brainz22
Brainz22 / ccScriptWith_cmsenv.md
Created October 31, 2025 00:56
Create and run a `.cc` (or `.cpp`) script and run it with the compiler from a cmsenv.

Assuming you are in src from a CMSSW distribution, start env with the command cmsenv. Then:

  1. Let's say your file is test.cc:
#include <iostream>
#include <filesystem>
#include <string>

namespace fs = std::filesystem;
@Brainz22
Brainz22 / jobs.md
Created October 25, 2025 04:17
Find the jobs running in the background.

When jobs command does not work because you closed your shell, try:

ps aux | grep cmsRun

The command I left running in the background is nohup cmsRun rerun_.py &amp;.

@Brainz22
Brainz22 / cmsDataAggregationSystem.md
Last active October 31, 2025 01:02
How to work with CMS data aggregation system.

Note: See comment 4 for how Daniel found a new Phase2Spring24 dataset.

My cmsDriver.py failed because of the following --filein "root://cmsxrootd.fnal.gov///store/mc/Phase2Spring23DIGIRECOMiniAOD/MinBias_TuneCP5_14TeV-pythia8/GEN-SIM-DIGI-RAW-MINIAOD/PU200_L1TFix_Trk1GeV_131X_mcRun4_realistic_v9_ext1-v2/80000/0061cc5d-056b-41f5-ba7b-aada40915e3f.root". According to CMS people (Artur Lobanov), the file now only exists "on tape", so I need to find the one that "on disk." We can do this via browser by accessing CMS DAS at https://cmsweb.cern.ch/das/ via the browser.

  • Need to import a grid certificate on the browser you are using. For firefox, I found this: https://ca.cern.ch/ca/help/?kbid=040111. There were some slight changes like there's no "options" button but a "settings" button. Everything else is pretty much the same. With this, I can access the CMS DAS website.
  • The person found out that my file was wrong as `site file=/store/mc/Phase2Spring23DIGIRECOMiniAOD/MinBias_TuneCP5_14TeV-pythia8/GEN
@Brainz22
Brainz22 / pipdeptree.md
Created July 18, 2025 19:22
Using pipdeptree

The package pipdeptree can be used to show a tree of all package dependencies in your environment. Install and use it as:

pip install pipdeptree
pipdeptree > pipdeptree.log

Then, open the pipdeptree.log file to see the tree.

@Brainz22
Brainz22 / vncserver-instructions.md
Created April 21, 2025 20:22
How to use vncserver on Fermilab correlator 4.

VNCserver on Mac

  1. You should be able to ssh into correlator 4 with something like: ssh -L 5908:localhost:5907 <LPCusername>@correlator4.fnal.gov. This ssh command will tunnel from a local port 5908 into remote the port 5907 on correlator4.

  2. Once in correlator 4, check for an existing vncserver with: vncserver -list. If there is one, you will see some output and the port for your server, e.g. you will that a port :01 exists. We shuld kill this port and create a new with vncserver -kill :01. Like check to see with vncserver -list.

  3. Create the new port with: vncserver :07 -geometry 2000x1800 and set a password if you are prompted. You can use your kinit password. Check that port :07 has been created. You can try another geometry to see what looks better on your screen.

  4. Exit correlator 4.

@Brainz22
Brainz22 / modelTest.ipynb
Created April 16, 2024 23:50
SepConv2D tests using tracing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Brainz22
Brainz22 / CRAB_L1Nano_Minbias.py
Last active October 31, 2025 00:23
Crab job for 1000 events of MinBias.
#Located in my LPC.
from WMCore.Configuration import Configuration
config = Configuration()
config.section_("General")
config.General.requestName = "_ucsd_MinBias"
config.General.workArea = "partial_crab_projects"
config.section_("JobType")
config.JobType.pluginName = "Analysis"
config.JobType.psetName = "rerunL1_cfg.py" #config file resulting from cmsDriver command
@Brainz22
Brainz22 / ManuallyInstallJupyterKernel.md
Last active July 21, 2025 22:33
Explicitly install a Jupyter kernel that points to my new virtual env to use Jupyter notebooks on VS code.

We can't simply activate Jupyter-lab or Notebook from the virtual environment, or in this case, select it on VS code. We need to explicitly install a Jupyter kernel that points to the new Python virtual environment. For that, we run the following:

python3 -m ipykernel install --user --name=projectname

project name is the name of our environment, which contains all of the packages we need. After this is done, we must restart VS code, then click select kernel on top right corner and select jupyter kernel when promted. The name of your environment should appear, thus select that for it to work.

Uninstall the kernel

  1. jupyter kernelspec list lists which kernels you installed.
@Brainz22
Brainz22 / switch-local-git-repo-to-fork.md
Last active December 9, 2023 00:22 — forked from ElectricRCAircraftGuy/switch-local-git-repo-to-fork.md
How to move to a fork after cloning. Then, next file is in case you want a new branch in your fork.

If you are like me you find yourself cloning a repo, making some proposed changes and then deciding to later contributing back using the GitHub Flow convention. Below is a set of instructions I've developed for myself on how to deal with this scenario and an explanation of why it matters based on jagregory's gist.

To follow GitHub flow you should really have created a fork initially as a public representation of the forked repository and the clone that instead. My understanding is that the typical setup would have your local repository pointing to your fork as origin and the original forked repository as upstream so that you can use these keywords in other git commands.

  1. Clone some repo (you've probably already done this step).

@Brainz22
Brainz22 / PkgInstallFromBranch.md
Last active October 2, 2024 23:26
Clone Single Branch and pip install it
conda activate your_environment_name
git clone --single-branch --branch split_pointwise_conv_by_rf_rebase_latest https://github.com/jmduarte/hls4ml.git
cd hls4ml
git branch --all #shows you are on your desired branch
pip install -e .