Skip to content

Instantly share code, notes, and snippets.

View ram1123's full-sized avatar
💭
I may be slow to respond.

Ram krishna Sharma ram1123

💭
I may be slow to respond.
View GitHub Profile
@ram1123
ram1123 / FileReadIssue.md
Last active December 2, 2025 16:47
Log of file Read Issue

File information

From dasgoclient

adler32 = b866399c

(/depot/cms/users/yun79/conda_envs/yun_coffea_latest) [shar1172@purdue-af-182 copperheadV2_main]$ dasgoclient --query="file=/store/mc/RunIII2024Summer24NanoAODv15/TTtoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/NANOAODSIM/150X_mcRun3_2024_realistic_v2-v2/2520000/004eb958-f042-48a7-b7a3-2f1cd5185215.root" --json
[
{"das":{"expire":1764689399,"instance":"prod/global","primary_key":"file.name","record":1,"services":["dbs3:files"]},"file":[{"adler32":"b866399c","auto_cross_section":0,"block.name":"/TTtoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/RunIII2024Summer24NanoAODv15-150X_mcRun3_2024_realistic_v2-v2/NANOAODSIM#c405159c-915d-4680-bcc7-ef75513c7895","block_id":40603398,"block_name":"/TTtoLNu2Q_TuneCP5_13p6TeV_powheg-pythia8/RunIII2024Summer24NanoAODv15-150X_mcRun3_2024_realistic_v2-v2/NANOAODSIM#c405159c-915d-4680-bcc7-ef75513c7895","branch_hash_id":null,"check_sum":"699935532","create_by":"WMAgent","created_by":"WMAgent","creation_date":1745031136,"crea
@ram1123
ram1123 / DaskGatewayLogs.md
Last active December 1, 2025 16:05
Log while running the dask gateway
@ram1123
ram1123 / test_glossaries.tex
Created September 19, 2025 16:30
Test the glossaries with latex
\documentclass{beamer}
\usetheme{Boadilla}
\usecolortheme{beaver}
% \usepackage{glossaries}
% \makeglossaries
% % \makenoidxglossaries
% \newglossaryentry{latex}
# Draw ratio plot
rp = ROOT.TRatioPlot(h2,h1)
rp.SetH1DrawOpt('p e0 same')
rp.SetH2DrawOpt('p e0 same')
rp.Draw()
# rp.GetLowerRefGraph().SetMinimum(0.0)
# rp.GetLowerRefGraph().SetMaximum(1.5)
leg = TLegend(0.60, 0.65, 0.88, 0.88)
leg.SetBorderSize(0)
@ram1123
ram1123 / removeDuplicates.C
Created March 20, 2025 09:28
script to remove the duplicates in CMS dataset
#include <iostream>
#include <set>
#include <TString.h>
#include <TFile.h>
#include <TTree.h>
void removeDuplicates() {
//TString prefix = "/raid/raid9/qguo/Run2/after/Run2_2/new/CMSSW_10_2_18/src/data_2018_NotBestMelaCand";
//TString prefix = "/publicfs/cms/data/hzz/guoqy/newNTuple_UL/2018/Data/DataUL2018_all";
//TString prefix = "/publicfs/cms/user/qyguo/lacked_Data1718/18/DoubleMuon_Run18A_1";
@ram1123
ram1123 / print_hist_contents.py
Created November 29, 2024 08:38
Print the histogram content like: binNo: label: content
import uproot
def print_histogram_bins(file_name, hist_name):
with uproot.open(file_name) as root_file:
hist = root_file[hist_name]
bin_contents = hist.values()
x_axis = hist.member("fXaxis")
if hasattr(x_axis, "labels") and callable(x_axis.labels):
@ram1123
ram1123 / PrintWorkspaceToTextFile.C
Created October 16, 2024 11:59
Print Workspace content into a text file
#include <fstream>
#include <iostream>
#include <streambuf>
#include "TFile.h"
#include "RooWorkspace.h"
// void PrintWorkspaceToTextFile(const char *rootFilePath, const char *textFilePath)
void PrintWorkspaceToTextFile(const char *rootFilePath)
{
@ram1123
ram1123 / List of daily uses commands.md
Created May 28, 2024 14:32
List of general commands that i use frequently
@ram1123
ram1123 / PrintHist.py
Last active August 8, 2023 15:27
Print the cut-flow histogram. Then arrange the cuts based on number of events. Also, print the 3rd column as the % change in the number of events.
import ROOT
# Set ROOT to run in batch mode
ROOT.gROOT.SetBatch(True)
def print_bins_noSort(hist):
xaxis = hist.GetXaxis()
for i in range(1, hist.GetNbinsX() + 1):
bin_content = hist.GetBinContent(i)
bin_label = xaxis.GetBinLabel(i)
@ram1123
ram1123 / gist:bf8921377949c3b19f82ce14e1ea95a0
Last active July 23, 2023 16:12 — forked from jdye64/gist:ca07e01ff3d8e93210c3
Convert .dav files in current directory to .mp4
#!/usr/bin/python
print("Converting all of the .dav files in this current directory into .mp4 files using ffmpeg")
import os
from subprocess import call
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
ext = f.split(".")[-1]
if ext == "dav" or ext == "DAV":