Skip to content

Instantly share code, notes, and snippets.

root://xrootd-cms.infn.it//store/mc/RunIIFall17MiniAODv2/TTWJetsToLNu_TuneCP5_PSweights_13TeV-amcatnloFXFX-madspin-pythia8/MINIAODSIM/PU2017_12Apr2018_94X_mc2017_realistic_v14-v1/10000/068FFE22-6743-E811-81AD-0025905B855C.root
Length of weight names is 14
nominal
Baseline
fsrRedHi
isrRedLo
fsrRedLo
@dteague
dteague / fill_influx.cpp
Created July 1, 2020 14:59
Basic cpp file for filling a influxDB
#include <iostream>
#include <string>
#include <map>
#include <chrono>
#include <vector>
#include <fstream>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
@dteague
dteague / index.html
Last active July 1, 2020 14:38
Make webpage of plots from influxdb
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
</head>
<body>
import ROOT
import math
import argparse
import os.path
parser = argparse.ArgumentParser()
parser.add_argument('infile', help='infile name')
args = parser.parse_args()
@dteague
dteague / Iso.cc
Created August 20, 2019 14:27
Code showing the extra Iso cuts and how they are used
/// example of use (currently in code)
passFullIso(goodLeptons.back().v, 0.76, 7.2, 1/(Muon_jetRelIso[i]+1));
bool ThreeLepSelector::passFullIso(LorentzVector& lep, double I2, double I3, double ptRatio) {
LorentzVector closeJet(SetupPtEtaPhiM(Jet, getCloseJetIndex(lep)));
bool debug = false;
#ifdef DEBUG
debug = true;
@dteague
dteague / chamberInfo.py
Last active August 2, 2019 09:13
Full implimentation of chamberInfo.py with new dictionaries for gemType
r"""
``chamberInfo`` --- Information about installed chambers
========================================================
.. code-block:: python
import gempython.gemplotting.mapping.chamberInfo
Documentation
-------------
@dteague
dteague / getSummaryCanvas.py
Created July 31, 2019 15:38
New "saveSummary" function that combines saveSummary, saveSummaryByiEta, and make3x8/2x4Canvas functionality into one
def getSummaryCanvas(dictSummary, dictSummaryPanPin2=None, name='Summary', trimPt=None, drawOpt="colz", gemType="ge11", save=False, isEtaPlot=False):
"""
Makes an image with summary canvases drawn on it
dictSummary - dict of TObjects to be drawn, one per VFAT. Each will be
drawn on a separate pad
dictSummaryPanPin2 - Optional, as dictSummary but if the independent variable is the
readout connector pin this is the other side of the connector
name - Name of output image
trimPt - Optional, list of trim points the dependent variable was aligned
@dteague
dteague / makeAxBCanvas.py
Created July 31, 2019 09:12
Code for new AxBCanvas functions
def makeAxBCanvas(name, initialContent = None, initialDrawOpt = '', secondaryContent = None, secondaryDrawOpt = '', canv=None, xyPair = (8,3), index2PadIdx = None):
"""
Creates a A by B sized canvas for summary plots.
name - TName of output TCanvas
initialContent - either None or an array of 24 (one per VFAT) TObjects that will be drawn on the canvas.
initialDrawOpt - draw option to be used when drawing elements of initialContent
secondaryContent - either None or an array of 24 (one per VFAT) TObjects that will be drawn on top of the canvas.
secondaryDrawOpt - draw option to be used when drawing elements of secondaryContent
canv - TCanvas previously produced by make3x8Canvas() or one that has been subdivided into a 3x8 grid
#include <unordered_map>
#include <vector>
#include <string>
#include <TBranch.h>
#include <TTree.h>
struct BranchManager {
std::vector<TBranch*> branchHolder;
std::unordered_map<std::string, TBranch*> specificBranch;
TTree* fChain;
////// put in your fill_folder function to change weight AT the point it needs to be changed
{
double boostz = getZBoostWeight(t1, t2);
double ut_par = getParallelRecoilWeight(t1, t2);
if(boostz > 0 && boostz <= 50) {wgt *= 1.1192;}
else if (boostz > 50 && boostz <= 100) {wgt *= 1.1034;}
else if (boostz > 100 && boostz <= 150) {wgt *= 1.0675;}
else if (boostz > 150 && boostz <= 200) {wgt *= 1.0637;}
else if (boostz > 200 && boostz <= 300) {wgt *= 1.0242;}