Skip to content

Instantly share code, notes, and snippets.

View andrey-popov's full-sized avatar

Andrey Popov andrey-popov

View GitHub Profile
/**
* An example of looping over combinations. Can be compiled with
* g++ -std=c++11 permutations.cpp -o permutations
*/
#include <iostream>
#include <deque>
#include <algorithm>
from copy import deepcopy
from CRABAPI.RawCommand import crabCommand
class Sample:
""" A simple auxiliary class to aggregate information about a dataset
"""
def __init__(self, requestName, datasetName, outputName):
self.requestName = requestName
self.datasetName = datasetName
self.outputName = outputName
/**
* Program performs the baseline event selection and saves information to evaluate performance of
* the jet-assignment procedures.
*/
#include <ValidateRecoTHPlugin.hpp>
#include <ValidateRecoTTbarPlugin.hpp>
#include <JetPtFilterPlugin.hpp>
#include <MetFilterPlugin.hpp>
@andrey-popov
andrey-popov / buildRooFitModel.py
Last active March 16, 2016 12:30
A script that builds a RooStats model for the combine tool using a custom class for interpolation of templates
#!/usr/bin/env python
"""The script creates a RooFit workspace for a real model."""
import ROOT
import sys
from optparse import OptionParser
#! /usr/bin/env python
"""
This script compares two lists of event IDs and prints the differences.
For each input file independently user can provide an optional scheme
that describes how to read an event ID from a line of the file. The
line can contain several integer numbers separated by any non-numeric
symbols. The scheme is composed of indices of run, luminosity section,
and event numbers, in the specified order. Indices start from zero and
@andrey-popov
andrey-popov / printTriggerResults.py
Last active July 19, 2016 23:03
FWLite PyROOT code to dump TriggerResults for a specific event from MiniAOD
#!/usr/bin/env python
"""Prints TriggerResults in the given event.
Example call:
./printTriggerResults.py root://cmsxrootd.fnal.gov//store/data/Run2015D/SingleMuon/MINIAOD/16Dec2015-v1/10000/00006301-CAA8-E511-AD39-549F35AD8BC9.root 259861:162358311
"""
import argparse
import re
@andrey-popov
andrey-popov / dummyDataMC.py
Created October 5, 2016 12:27
Scripts that produce dummy data/MC plots to facilitate selection of a common set of colour codes
#!/usr/bin/env python
"""Plots a data/MC plot to visualize colour coding of simulation.
Most of templates are taken from simulation.
"""
import math
import ROOT
# This configuration fragment is based on [1], and Pythia tune settings
# are updated.
# [1] Configuration/Generator/python/Hadronizer_TuneCUETP8M1_13TeV_generic_LHE_pythia8_cff.py
import FWCore.ParameterSet.Config as cms
from Configuration.Generator.Pythia8CommonSettings_cfi import *
generator = cms.EDFilter('Pythia8HadronizerFilter',
maxEventsToPrint = cms.untracked.int32(1),
pythiaPylistVerbosity = cms.untracked.int32(1),
#!/usr/bin/env python
"""Adds per-bunch crossing luminosity to data tuples.
The luminosity is written per lumi section per bunch crossing. It is
read from a dedicated ROOT file. Output is put in an independent ROOT
file, which can be added as a friend to the original tuple.
In order to limit the memory footprint, luminosity information is read
for one run at a time. This approach relies on the input data being
@andrey-popov
andrey-popov / syncTTReco.py
Created February 24, 2017 10:21
A script to facilitate synchronization of tt reconstruction
#!/usr/bin/env python
"""Compares ROOT files with information on tt reconstruction."""
import argparse
from collections import defaultdict
from functools import total_ordering
import os
from uuid import uuid4