This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in {1..10}; do | |
echo 'Sleeping' $i | |
sleep $i & | |
# prevent more than 5 tasks at a time | |
while [[ `jobs|wc -l` -gt 4 ]]; do sleep 1; done; | |
done | |
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dasQuery(queryString, entryTitle) : | |
import das_client | |
dasinfo = das_client.get_data('https://cmsweb.cern.ch', queryString, 0, 0, False) | |
if dasinfo['status'] != 'ok' : | |
raise Exception('DAS query failed.\nQuery: %s\nDAS Status returned: %s' % (queryString, dasinfo['status'])) | |
for entry in dasinfo['data'] : | |
if len(entry[entryTitle]) > 0 : | |
yield entry[entryTitle][0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete all tags | |
git ls-remote -t my-cmssw | sed 's:^.*refs/tags/::' | while read t; do git push my-cmssw :$t; done | |
# Delete all branches | |
git ls-remote -h my-cmssw |sed 's:^.*refs/heads/::' | while read b; do git push my-cmssw :$b; done | |
# Or, save list of branches, and remove ones you want to keep | |
git ls-remote -h my-cmssw |sed 's:^.*refs/heads/::' > branches_to_del | |
vim branches_to_del | |
while read b; do git push my-cmssw :$b; done < branches_to_del |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Nick Smith <nick.smith@cern.ch> | |
# coding: utf-8 | |
import argparse | |
parser = argparse.ArgumentParser(description='Reads EDM files and dumps raw data from list of FEDs to text files.') | |
parser.add_argument('--input', '-i', help='EDM File (Note, only reads first event in file, so use edmPickEvents to get right event)', required=True) | |
parser.add_argument('--output', '-o', help='Output file prefix (will be appended with "_fedN.txt" for N FEDs dumped)', required=True) | |
parser.add_argument('--feds', '-f', help='List of FEDs to dump, will write one text file per FED', required=True) | |
parser.add_argument('--label', help='Label in EDM file of FEDRawDataCollection', default='rawDataCollector') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
sys.path.append('/afs/cern.ch/cms/PPD/PdmV/tools/McM/') | |
from rest import * | |
mcm = restful(dev=False) | |
# when not json (so much for being RESTful...) | |
def get_raw(url): | |
fullurl = 'https://' + mcm.server + url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Math/GenVector/Boost.h" | |
#include "Math/LorentzVector.h" | |
#include "Math/PtEtaPhiE4D.h" | |
typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float>> LorentzVector; | |
double cosTheta(LorentzVector wP4, LorentzVector zP4, LorentzVector lP4) { | |
ROOT::Math::Boost boostWcm; | |
boostWcm.SetComponents(wP4.BoostToCM()); | |
ROOT::Math::Boost boostWZcm; | |
boostWZcm.SetComponents((wP4+zP4).BoostToCM()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Nick Smith <nick.smith@cern.ch> | |
import argparse | |
import numpy as np | |
import tqdm | |
import pickle | |
import gzip | |
import ROOT | |
ROOT.PyConfig.IgnoreCommandLineOptions = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bestdatasets(primarydataset, campaign, datatier): | |
'''Get best dataset search string | |
Form the appropriate wildcard-containing string to find the | |
most recent dataset corresponding to the input parameters, based on | |
https://twiki.cern.ch/twiki/bin/viewauth/CMS/PdmVAnalysisSummaryTable | |
The parameters correspond to the groups extracted using a regular expression: | |
``/([^/]*)/([^-]*)-[^/]*/(.*)`` | |
applied to a dataset name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import numpy as np | |
import tqdm | |
import pickle | |
import gzip | |
import ROOT | |
ROOT.PyConfig.IgnoreCommandLineOptions = True | |
ROOT.gROOT.SetBatch(True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def repack(array, n): | |
"""Repack a uint8 array as a contiguous stream of n-bit values | |
Works for arbitrary 0 < n <= 64, drops tail elements as necessary to evenly divide | |
""" | |
if not 0 < n <= 64: | |
raise ValueError(n) |
OlderNewer