Skip to content

Instantly share code, notes, and snippets.

@tmadlener
tmadlener / spack.yaml
Last active October 26, 2022 15:03
spack containerized install
spack:
config:
install_tree:
root: /opt/software
projections:
all: ${PACKAGE}/${VERSION}/${target}-${os}-${$COMPILERNAME}${COMPILERVER}-opt/${HASH}
install_missing_compilers: true
include:
- packages.yaml
view: false
#!/usr/bin/env python3
"""
Schema definitions for the different parts that can occur in a yaml
datalayout file.
"""
from __future__ import print_function, unicode_literals, absolute_import
# TODO:
# - [x] syntactic checks of format read from yaml file
#!/usr/bin/env python3
"""
Schema definitions for the different parts that can occur in a yaml
datalayout file.
"""
from __future__ import print_function, unicode_literals, absolute_import
# TODO:
# - [x] syntactic checks of format read from yaml file
surrounding_y = None
class ClosureClass:
def __init__(self, x):
self.x = x
self.y = surrounding_y
def __repr__(self):
return '{}, {}'.format(self.x, self.y)
def make_closure_class(y):
{
"PU36to40": {
"HLT_Dimuon14_Phi_Barrel_Seagulls_v1": 146,
"HLT_Mu20_TkMu0_Phi_v1": 63,
"HLT_Mu25_TkMu0_Onia_v1": 75,
"HLT_Mu25_TkMu0_Phi_v1": 35,
"HLT_Mu30_TkMu0_Onia_v1": 47
},
"PU40to44": {
"HLT_Dimuon14_Phi_Barrel_Seagulls_v1": 95,
@tmadlener
tmadlener / shuffle_vec.cc
Last active June 12, 2017 15:33
randomly shuffle entries of a vector
#include <vector>
#include <random>
#include <algorithm>
#include <iostream>
#include "TRandom3.h"
// g++ -std=c++11 shuffle_vec.cc $(root-config --libs --cflags)
// for a non-c++11 compliant version this function can be used instead of the lambda defined below in main
#!/bin/bash
menuFile=${1}
## part extracting the modules and the corresponding seeds
menuFile=${1}
outputFile="modules_seeds.txt"
# extract the L1 seed modules
std::vector<std::string> m_trigPathNames; // taken from config
edm::Handle<edm::TriggerResults> trigResults;
event.getByToken(m_trigResultToken, trigResults); // Token from config
std::vector<int> trigRes{};
if (trigResults.isValid()) {
const edm::TriggerNames& triggerNames = event.triggerNames(*trigResults);
for (const auto& name : m_trigPathNames) {
auto trigBit = triggerNames.triggerIndex(edm::InputTag(name).label());
// std::cout << name << " " << trigBit << "/" << trigResults->size() <<"\n";