Skip to content

Instantly share code, notes, and snippets.

@mcitron
mcitron / Make bparking ntuples
Created May 30, 2023 20:16
Production instructions
#setup cmssw
mkdir bparkingGeneration
cd bparkingGeneration
source /cvmfs/cms.cern.ch/cmsset_default.sh
cmsrel CMSSW_10_2_22
cd CMSSW_10_2_22/src
git clone git@github.com:mieskolainen/nanotron.git nanotron
#use singularity for slc6
@mcitron
mcitron / setup.sh
Created May 23, 2023 19:15
Try to compile CMSSW_10_2_27 with pythia 803.7
#!/bin/bash
TOOLS=(
pythia8 \
evtgen \
tauolapp \
)
TOOLFILE_LIST=""
for TOOL in ${TOOLS[@]}; do
TOOLFILE_LIST="$TOOLFILE_LIST $TOOL-toolfile"
process.hltEcalUncalibRecHit = cms.EDProducer( "EcalUncalibRecHitProducer",
EEdigiCollection = cms.InputTag( 'hltEcalDigis','eeDigis' ),
EBdigiCollection = cms.InputTag( 'hltEcalDigis','ebDigis' ),
EEhitCollection = cms.string( "EcalUncalibRecHitsEE" ),
EBhitCollection = cms.string( "EcalUncalibRecHitsEB" ),
algo = cms.string( "EcalUncalibRecHitWorkerMultiFit" ),
algoPSet = cms.PSet(
ebSpikeThreshold = cms.double( 1.042 ),
EBtimeFitLimits_Upper = cms.double( 1.4 ),
EEtimeFitLimits_Lower = cms.double( 0.2 ),
import math
def intersec(vx,vy,vz,px,py,pz):
lightSpeed = 29979245800;
#Intersection with cylinder with following radius and length (in cm as vertex)
radius = 130;
length = 300;
energy = math.sqrt(px*px+py*py+pz*pz);
#First work out intersection with cylinder (barrel)
double reallySimplified(std::string modelName="signal",std::string outname="ht400Output"){
RooArgList xlist_;
RooArgList muA_;
RooCategory sampleType("bin_number","Bin Number");
RooRealVar observation("observed","Observed Events bin",1);
double bkg[1] = {9.0};
double sig[1] = {3.0};
int nbins = 1;//
for (int b=1;b<=nbins;b++){
import ROOT as r
class Transpose():
def transposeHist(self,inHist):
outName = inHist.GetName()
binWidthX = 2*(inHist.GetXaxis().GetBinCenter(1)-inHist.GetXaxis().GetBinLowEdge(1))
binWidthY = 2*(inHist.GetYaxis().GetBinCenter(1)-inHist.GetYaxis().GetBinLowEdge(1))
xMass = [inHist.GetXaxis().GetBinCenter(x) for x in range(1,inHist.GetXaxis().GetNbins()+1)]
yMass = [inHist.GetYaxis().GetBinCenter(y) for y in range(1,inHist.GetYaxis().GetNbins()+1)]
xLow = [inHist.GetXaxis().GetBinLowEdge(x) for x in range(1,inHist.GetXaxis().GetNbins()+1)]
double testRooHistPdf(){
TFile * inputFile = TFile::Open("./testShapes.root");
TH1F * dataHist = (TH1F *)inputFile->Get("Signal/data_obs");
TH1F * zinv = (TH1F *)inputFile->Get("Signal/Zinv");
TH1F * ttw = (TH1F *)inputFile->Get("Signal/Ttw");
TH1F * qcd = (TH1F *)inputFile->Get("Signal/Qcd");
TH1F * sigHist = (TH1F *)inputFile->Get("Signal/sig");
TH1F * totalHist = (TH1F *)zinv->Clone("total");
@mcitron
mcitron / recursiveHadd.py
Created March 2, 2016 14:53
Recursive hadd script for batch
#!/usr/bin/python
import optparse
import os
import string
from collections import OrderedDict as odict
import glob
import sys,stat,shlex,subprocess
import random
def parse_args():
@mcitron
mcitron / pickleViewer.py
Last active April 30, 2020 14:43
Viewer for arbitrary pickle files
#!/usr/bin/python
import pickle
from collections import defaultdict
from collections import OrderedDict
import sys
def checkDict(inputData):
return (type(inputData) == dict or type(inputData) == defaultdict\
or type(inputData) == OrderedDict)