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 | |
'''Report the SMART status of hard disks using a log file.''' | |
import argparse | |
import subprocess | |
import sys | |
# Nagios status codes | |
OK, WARNING, CRITICAL, UNKNOWN = range(4) |
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 | |
git clone git://github.com/jhs/build-couchdb.git | |
cd build-couchdb | |
git submodule init | |
git submodule update | |
rake erl_checkout="OTP_R15B03-1" git="git://git.apache.org/couchdb.git 1.6.1" install=/opt/build-couchdb-dependencies couchdb_build=/opt/couchdb/1.6.1 |
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
'''A minimal example of how Orca might interact with the CouchDB database | |
to load settings from the DB at startup and write settings to the DB only | |
when they change. | |
Because Orca is the only *producer* of the database data, it can keep track | |
internally of whether the detector configuration has changed. | |
NO: Checking in-memory settings against values in the DB | |
for fec in fecs: |
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
// Draw overlaid histograms from a RAT ntuple (for example). | |
// | |
// Usage: | |
// $ root -l -x 'overlay.C("filename1.root", "filename2.root")' | |
// | |
// The trick is that histograms are associated with a TDirectory | |
// upon creation, which is most likely the open file. When the | |
// directory changes when a new file is opened, the pointer to | |
// the histogram is invalidated. TH1::SetDirectory is used to | |
// detach a histogram from a file. |
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
/** | |
* Plot ES scattering angle for 8B solar neutrinos vs. recoil energy, | |
* weighted by the neutrino spectrum. | |
* | |
* This uses the 8B spectrum and ES cross section code in RAT. | |
* | |
* Build: | |
* | |
* g++ -g -o es es.cpp -L$RATROOT/lib -I$RATROOT/include \ | |
* -lrat_Linux `root-config --libs --cflags` \ |
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
'''Plot PMT hit time residuals from the RAT DS. | |
Usage: | |
$ python time_residuals.py "filenames_*.root" | |
With one filename or wildcards (use quotes when using wildcards). | |
The histogram opens in an interactive ROOT window for editing. | |
''' |
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
/** | |
* Creating a list of keys from an STL map. | |
* | |
* Build: g++ -o keys keys.cpp | |
* Run: ./keys | |
*/ | |
#include <iostream> | |
#include <map> | |
#include <string> |
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 | |
'''Report the SMART status of hard disks using a log file.''' | |
import argparse | |
import subprocess | |
import sys | |
# Nagios status codes | |
OK, WARNING, CRITICAL, UNKNOWN = range(4) |
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 |