Skip to content

Instantly share code, notes, and snippets.

View andrey-popov's full-sized avatar

Andrey Popov andrey-popov

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@andrey-popov
andrey-popov / L1TElectronMatchProducer.cc
Created March 28, 2017 11:54
CMSSW plugin to perform matching between L1T EG objects and reconstructed electrons
#include "L1TElectronMatchProducer.h"
#include <DataFormats/Common/interface/ValueMap.h>
#include <DataFormats/Math/interface/deltaR.h>
#include <FWCore/Framework/interface/MakerMacros.h>
#include <limits>
#include <vector>
@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
#!/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
# 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),
@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
@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
#! /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 / 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