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
ifndef ROOTSYS | |
$(error ROOTSYS is not defined) | |
endif | |
all: minuit_example | |
minuit_example: | |
g++ -o minuit_example minuit_example.cpp `root-config --libs --cflags` -lMinuit | |
clean: |
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
// Find the number of events simulated and the efficiency for a set of ntuples | |
// Usage: root -b -q "evcount.cxx([filename], rate=0)" # "filename" can have wildcards | |
// If provided, rate is events/detector-year | |
void evcount(TString filenames, float rate=0) { | |
TChain tc("output"); | |
tc.Add(filenames); | |
int entries = tc.GetEntries(); | |
cout << "Total entries: " << entries << endl; | |
// ROOT branch pointers |
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
Backend.get_data_source_list() | |
Returns: list of data source names | |
Backend.create_data_source(name, type, reduction, interpolation, unit, description) | |
Returns: None | |
Backend.add_data(source_name, time, value) | |
Returns: (index, url) tuple, where index is index of data point and url is an image URL or None | |
Raises: | |
- TimeOrderError: The timestamp for the data point is before the last recorded data point |
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 <iostream> | |
class Foo { | |
public: | |
class Bar { | |
public: | |
Bar(Foo* owner) : owner(owner) {} | |
int getter() { return owner->a; } | |
private: | |
Foo* const owner; |
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
'''An example PyROOT analysis which applies several different NHIT cuts, | |
calculates the fraction of events failing, and produces a plot. | |
''' | |
import sys | |
import array | |
from rat import ROOT | |
def fast_dsreader(filename): |
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
/** Get a value from a TNtuple by event id and name */ | |
float get_ntuple_entry(TNtuple* nt, int i, std::string field) { | |
float v; | |
nt->SetBranchAddress(field.c_str(), &v); | |
nt->GetEvent(i); | |
nt->ResetBranchAddresses(); | |
return v; | |
} | |
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 <cmath> | |
#include <TH2F.h> | |
#include <TVector3.h> | |
#include <QEvent.h> | |
#include <QGlobals.h> | |
#include <QPMTxyz.h> | |
TH2F* hough(const QEvent* event, TVector3& vfit, float tres_cut, bool qweight) { | |
// Calculate Cherenkov angle using FTK energy | |
float beta = sqrt(1.0 - (0.511 / (0.511 + e)) * (0.511 / (0.511 + e))); |
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
FROM ubuntu:14.04 | |
RUN apt-get update && apt-get -y install munge slurm-llnl | |
RUN mkdir -p /var/run/munge && \ | |
chown munge:munge /var/run/munge && \ | |
chmod 0700 /etc/munge && \ | |
chmod 0711 /var/lib/munge && \ | |
chmod 0700 /var/log/munge && \ | |
chmod 0755 /var/run/munge && \ |
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 | |
# Collect the Markdown. Webpage it. | |
# | |
# Searches subdirectories for Markdown files and creates a static webpage | |
# with frames for navigation in a new directory _notebook/. Also copies | |
# over any images referenced in the md source. | |
# | |
# A. Mastbaum <mastbaum@hep.upenn.edu>, 10/2015 | |
# |
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
'''Example of labeling only some plots in a matplotlib legend. | |
Tested with matplotlib==1.0.1 | |
''' | |
from matplotlib import pyplot as plt | |
plt.figure(1, facecolor='white') | |
plt.plot([1,2,3,4], [1,2,3,4], label='foo') | |
plt.plot([1,2,3,4], [2,4,6,8]) |