Related Topics
LHC fast facts
This is a repository of LHC-related info.
CMS basics (source:
wiki
)
- Compact Muon Solenoid
- 25m long, 15m diameter, 12.5 ktons
- 3600 scientists from 180 institutes (40 countries)
- 4T solenoid magnet
Trigger basics
- LHC rate: 40 MHz (NB: This is just 1/25ns.)
Decision times (2012):
L1 |
2.5 x 10-6 s |
L2 |
40 x 10-3 s |
EF |
4 s |
Tau fast facts
This is a repository of tau-related info.
Tau basics (source:
pdg
)
- Mass: 1,776.82 ± 0.16 MeV
- Mean lifetime (T): (290.6 ± 1.0) x 10-15 s
- cT = 87.11 µm
b-hadron basics (for comparison) (sources:
pdg
,
LHCb conf
):
- B±, B0
- Mass: 5279.25 ± 0.17 MeV, 5279.58 ± 0.17 MeV
- Mean lifetime (T): (1.641 ± 0.008) x 10-12 s, (1.519 ± 0.007) x 10-12 s
- cT: 492.0 µm, 455.4 µm
Tau-pertinent mesons (h/t
delphi
and
Rutgers
)
Documents
Twiki genesis
AlexanderTunaMeetings is begun. 20 May 2013.
VBFTriggerLepHad2012 is begun. 12 Feb 2013.
PennTauElectronVetoTrain2012 is begun. 27 Nov 2012.
PennTauHiggsTauTau2012 is begun. 10 Nov 2012.
TuesdayIdentificationMethods is begun. 27 Sep 2016.
Phrases
- Ad-hoc: Made up.
- Bremstrahlung: At ATLAS, when an electron emits a photon via material interaction. German for "braking radiation".
- Color flow: Describes how freely internal colored particles travel in a diagram. VBF: minimal color flow. ttbar: hella color flow.
- Gamma: Photon.
- Heavy flavor: Relatively heavy quarks (or heavy-quark-initiated jets) like t, b, c.
- ISF: Integrated simulation framework. Gives the user the freedom to fully simulate some aspects of the process and fast simulate others.
- ISR/FSR: Initial/final state radiation. The radiation is typically photons or jets.
- Light flavor: Relatively light quarks (or light-quark-initiated jets) like u, d, s. Gluons (gluon-initiated jets) are included.
- Nominal: Baseline, standard, un-new
- Sea quark: In a proton-proton collision, this is a quark which popped out of the vacuum (ie, not a valence quark).
- Valence quark: In a proton, this is one of the actual uud quarks.
Template for task force twiki
Operations Problems 2016
Run 299584: Broken power board on RPC A-side, 4/32 trigger sectors down. (
https://atlasop.cern.ch/elisa/display/302888
)
Run 299340, 299343: Broken optical transceiver in MDT MROD (
https://atlasop.cern.ch/elisa/display/302600
)
Scratch notes
How to mess with oks in git
Thanks Jared:
https://twiki.cern.ch/twiki/bin/viewauth/Atlas/CSCPartitions
Also classic:
https://twiki.cern.ch/twiki/bin/viewauth/Atlas/DaqHltOks
cd ~/
mkdir -p oks/$tdaqrelease #If you don't have it
cd oks/$tdaqrelease
export TDAQ_DB_USER_REPOSITORY=$(pwd)
oks-checkout.sh muons #This will download the whole muon folder there
oks_data_editor muons/partitions/part_CSC-Standalone.data.xml #Standalone Partition
Online:
pc-tdq-git.cern.ch/gitea/oks/
https://gitlab.cern.ch/atlas-tdaq-oks/p1
How to avoid a black background when uploading images with transparency to mattermost
Resize your image to be 128x128 or smaller.
The black background only appears when mattermost needs to resize for you.
h/t
https://github.com/mattermost/mattermost-server/issues/6299
How to crop an image from the command line
> identify image.jpg
image.jpg JPEG 720x482 720x482+0+0 8-bit DirectClass 100KB 0.000u 0:00.009
# top 5px
# bottom 7px
# right 14px
# left 3px
> convert image.jpg -crop 703x470+3+5 output.jpg
h/t
https://askubuntu.com/questions/631689/cropping-images-using-command-line-tools-only
How to make a gif from a set of images
convert -delay 20 -loop 0 *.jpg myimage.gif
And in case you'd like to preserve transparency by refreshing on each frame: add
-dispose Background
h/t
https://askubuntu.com/questions/648244/
and
https://askubuntu.com/questions/365051/
How to enable vector< vector< int > > in ROOT C++
// ROOT black magic
if (channel_rates) {
std::cout << "ROOT: Generating dict for vector<vector<int32>>..." << std::endl;
gInterpreter->GenerateDictionary("vector<vector<uint32_t> >", "vector");
std::cout << "ROOT: Done." << std::endl;
}
How to force a gif to loop
convert -delay 5 -loop 0 cosmicparrot_unlooping.gif cosmicparrot.gif
convert is from
ImageMagick.
h/t
https://superuser.com/questions/159212/how-do-i-make-an-existing-animated-gif-loop-repeatedly
How to recover a lost file on afs
BRETTT
https://twiki.cern.ch/twiki/bin/view/Main/BrettJacksonRecoverAFS
afs_admin recover <full_afs_path>
How to workaround annoying Firefox error: Firefox is already running
find ~/.mozilla/ -name .parentlock
# delete that lockfile
h/t
https://support.mozilla.org/en-US/kb/Firefox-already-running-not-responding
How to mess with CVMFS
https://cernvm.cern.ch/portal/cvmfs/examples
Thx RK.
How to password-less login to lxplus
- Do the usual id_rsa for ssh keys? Not sure if this is necessary
-
kinit -f $USER@CERN.CH
- Add this to your
~/.ssh/config/
Host lxplus.cern.ch aiadm.cern.ch
GSSAPIAuthentication yes
GSSAPIDelegateCredentials yes
How to VNC from OSX to lxplus
In my local bashrc:
export CERNUSER="tuna"
v(){
if ! klist -s; then
kinit -f $CERNUSER@CERN.CH
fi
echo "Randomly choosing a port and lxplus node..."
# jot for OSX, shuf for Linux
# the ports between 0 and 30 are mostly occupied :(
PORT=$(jot -r 1 30 99)
HOST=$CERNUSER@lxplus.cern.ch
OPT="59${PORT}:localhost:59${PORT}"
MSG="Press [Enter] to exit. To run:"
RUN="open vnc://localhost:59${PORT}"
GEO="-geometry 2560x1600"
CHK="\$( /usr/sbin/ss -l -t | grep \":..${PORT}\" )"
SAD="Port $PORT is occupied on \$HOSTNAME. Sorry! Please try again."
CMD="if [[ $CHK ]]; then echo $SAD; else vncserver :${PORT} -localhost $GEO && sleep 1 && echo $MSG && echo $RUN && read DUMMY && vncserver -kill :${PORT}; fi"
ssh -L $OPT $HOST $CMD
}
In my lxplus bashrc:
vclean(){
for FI in $(ls $HOME/.vnc/ | grep pid); do
# lxplus718.cern.ch:7.pid => ssh lxplus718 "vncserver -kill :7"
HOST=$(echo $FI | sed 's/\.cern.ch.*//')
PORT=$(echo $FI | sed 's/.*cern.ch//' | sed 's/\.pid//')
echo $FI
ssh $HOST "vncserver -kill $PORT"
done
}
Run `vclean` occasionally to clean up dangling vnc sessions.
How to ERS
export TDAQ_ERS_DEBUG_LEVEL=1
How to use class functions for nefarious purposes
If:
error: invalid use of non-static member function
Consider:
https://stackoverflow.com/questions/11057800/passing-member-functions-to-stdthread
How to tell apache a new directory is okay for web content
h/t:
https://askubuntu.com/a/720162
chcon -R -t httpd_sys_content_t MY_WANNABE_WEB_DIR
How to set up python3 with cvmfs
lsetup "lcgenv -p LCG_94python3 x86_64-slc6-gcc62-opt Python"
How to replace "0.0" with "-" in the post-fit tables
for FI in tables/misc/*postFit.tex; do sed -i 's/ 0.0 / - /g' ${FI}; done
How to merge EVNT files
EVNTMerge_tf.py --outputEVNTFile EVNT.merge.pool.root --inputEVNTFile EVNT.0000.pool.root.1,EVNT.0001.pool.root.1
NB: If you're subsequently analyzing the merged EVNT file, make sure your merging and analyzing releases are similar.
How to run a job on NET3
qsub -V -q tier3 script.sh
- -V copies the environment
- -q sends jobs to the tier3 cluster
How to view the ART signals from VMM0 on mini-SAS breakout board
B2-B3
How to install Xilinx cable drivers (incl. parallels virtual machine)
# cd to the Xilinx installation dir
find . -name install_script
cd $(find . -name install_script)
cd install_drivers
sudo ./install_drivers
h/t
http://www.nhn.ou.edu/~bumm/ELAB/Mac-Linux_Digilab_instructions_2017.html
And how to check if they're already installed:
ls -al /etc/udev/rules.d
Look for rules like 52-digilent-usb.rules, 52-xilinx-pcusb.rules.
ht/
https://www.xilinx.com/support/answers/66440.html
How to better navigate NET3
How to power the CTF via cables
- Latch onto the cables in the back
- Hot pin is in the middle
- Ground pin is in the corner
How to log onto anything Greek
m3gasmu
How to get command line metadata from AMI / pyami
asetup AthAnalysis,21.2,latest
lsetup PyAMI
getMetadata.py --help
How to pip install something locally which already exists globally
I'm going to regret having two python installations.
pip install --user <PACKAGE> --ignore-installed
How to tell emacs to recognize your Option key on OSX
Terminal -> Preferences -> Profiles -> Keyboard -> Use Option as Meta key
How to log onto Harvard RC without leaving the command line
- Visit https://software.rc.fas.harvard.edu/oa
to receive an email with your RC info
- Follow the link from the email, and find your secret token (as the name implies, this should be kept secret!)
- Download the oathtool, which the RC GUI uses under the hood to generate verification codes:
brew install oath-toolkit
- Whenever you want to ssh, first run the oathtool and pipe the decision into the clipboard:
oathtool --totp --base32 YOUR_TOKEN | pbcopy
- ssh as normal, with the knowledge that Ctrl+V will paste your time-sensitive Verification Code
How to develop in a common area with many users
find . -type d -exec chmod a+rwx {} \; # Make folders traversable and read/write
find . -type f -exec chmod a+rw {} \; # Make files read/write
How to reset / unset / undo the colz color palette
ROOT.gStyle.SetPalette(1)
How to unfuck rucio list-content
rucio list-content data16_13TeV.periodI.physics_Main.PhysCont.DAOD_HIGG3D1.grp16_v01_p2840 | grep "data16" | tr -d "|" | tr -d " " | sed 's/DATASET//g' | sed 's/data16_13TeV://g'
How to git
Fetch upstream changes for your fork:
git remote add upstream relevant@shit.com:person/repo.git
git fetch upstream
git rebase upstream/master
Get rid of deleted branches:
git remote prune origin --dry-run
git branch -d branch_I_want_deleted
If git tells you "error: The requested URL returned error: 401 while accessing BLAH" and "fatal: HTTP request failed" on a non-lxplus machine, try
kinit
.
Get an older version of a file:
git checkout HASH_ID -- path/to/file.txt
How to consolidate your slurm jobs root files
for sample in */; do
echo ${sample}
mkdir -p ${sample}/data/
for job in $(ls -1 ${sample}); do
[ ${job} == "data" ] && continue
for rootfile in $(find ${sample}/${job} -name "*.root*" | grep "data\-"); do
echo " - " ${job}
mv ${rootfile} ${sample}/data/${job}_$(basename ${rootfile})
done
done
done
How to count dataset events from the command line
for ds in $(dq2-ls mc15_13TeV.3641*DAOD_HIGG3D1*p2812/ | sort); do
do printf '%10s %s\n' $(ami show dataset info ${ds/mc15_13TeV:/} | grep totalEvents | tr -d 'totalEvents:') ${ds}
done
How to make your directory web viewable
cd ~/www/directory_of_interest/
echo "Options +Indexes" >> .htaccess
How to recursively move files
This is useful when a directory has hella subdirectories in svn, and you wanna overwrite all the files and subfiles, but you don't wanna fuck with the
.svn/
folder.
for fi in $(find . -type f); do
mv ${fi} ${svn}/${fi}
done
How to check what packages are used in a derivation release without asetup
cache="20.7.7.4"
grep Derivation /cvmfs/atlas.cern.ch/repo/sw/software/x86_64-*/${cache:0:6}/*/${cache}/AtlasDerivationRelease/cmt/requirements
How to rucio
rucio add-container |
dq2-register-container |
rucio attach |
dq2-register-datasets-container |
rucio list-content |
dq2-list-datasets-container |
How to check a package version for a given release, Rel.21 edition
> grep Hough /cvmfs/atlas.cern.ch/repo/sw/software/21.0/*/21.0.6/InstallArea/*/packages.txt
/cvmfs/atlas.cern.ch/repo/sw/software/21.0/AtlasReconstruction/21.0.6/InstallArea/x86_64-slc6-gcc49-opt/packages.txt:MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools MuonHoughPatternTools-01-00-31
/cvmfs/atlas.cern.ch/repo/sw/software/21.0/AtlasReconstruction/21.0.6/InstallArea/x86_64-slc6-gcc49-opt/packages.txt:MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonHoughPatternEvent MuonHoughPatternEvent-01-00-04
/cvmfs/atlas.cern.ch/repo/sw/software/21.0/AtlasReconstruction/21.0.6/InstallArea/x86_64-slc6-gcc49-opt/packages.txt:MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough MuonLayerHough-00-00-28
How to overwrite an output line in bash (e.g. progress bar)
while true; do
echo -ne "$(date)\r"
sleep 1
done
How to clean up a big directory of ESDs where something could be broken
mkdir check
for file in data16_13TeV.* ; do
checkFile.py --fast ${file} | grep -i "failed to open" > check/${file}.txt
if [[ -s check/${file}.txt ]] ; then
echo "rm -f $file" >> kill.sh
fi
done
How to diff recursively
diff -r dir_1 dir_2 | grep diff
Remove the pipe if you want to see the diffs in full glory.
How to tell vivado about your license
- Browser
- Go to xilinx.com
- Support -> Downloads & Licensing
- License solution center
- Xilinx Product Licensing Site
- Click desired licence
- Generate Node-Locked License
- Select the computer to run on, Next, Next (OR ADD NEW HOST)
- Download license using terribly small download button (blue down-pointing arrow)
- Vivado
- Help -> Manage Licenses
- Load License
- Copy Licence
- Boom.
- View License Status to see whats available.
How to upload a new reference at P1
https://twiki.cern.ch/twiki/bin/viewauth/Atlas/InstructionsForUpdatingReferencePlots
ssh lxplus.cern.ch
scp image.png atlasgw:.
ssh atlasgw
ssh vm-atlas-www-edit-01
cp blah.png /www/ALL/prod/webscripts/${DET}/webref/run_276689/blah.png
How to ask for the total size of many directories (i.e. datasets)
> du -sm mc15_13TeV.36110* | awk '{ total += $1 }; END { print total/1024 " GB" }'
116.439 GB
How to ask rucio what datasets you requested
rucio list-rules --account tuna
How to convert svn diff to something patch-able
svn diff --diff-cmd /usr/bin/diff -x "-i -b" PhysicsAnalysis/HiggsPhys/Run2/HWW/HWWxAODCode/HWWCommonxAODConfig/python/HWWCommonAnalysisFlags.py > patch_isLHVeryLoose.patch
How to EOS from Harvard
export KRB5_CONFIG=${HOME}/krb5.conf
kinit ${USER}@CERN.CH
xrdcp -r root://eosuser.cern.ch//eos/user/n/ndang/DataMC/PAOD/PAOD_2L/v9_DFonly/mc/410000F/ ./
How to MMTP
Vivado:
where
${XILINX_VIVADO}
is the installation directory, e.g.,
/tmp/tuna/Xilinx/Vivado/2015.1
.
Matlab:
Build the project:
source ${vivado}/Xilinx/Vivado/2015.1/settings64.sh
PATH=$PATH:${modelsim}/target/modeltech/linux_x86_64
export LM_LICENSE_FILE=XXXXX
svn co $SVNNSWELX/TriggerProcessor/firmware/mm/trunk/ ./firmware/
cd firmware/scripts/
vivado -mode batch -nojournal -nolog -notrace -source implementation/vivado_project_import_horx.tcl
cd ../projects/mm_top_horx/
vivado
--- Open Project -> mm_top_horx.xpr (1-5 minutes. critical messages are apparently okay.)
--- Tools -> Compile Simulation Libraries (1-5 minutes. default settings are okay.)
--- # If this fails, especially on herophysics: consider making your Simulator=Questasim, instead of Modelsim
--- Run Simulation -> Run Behavioral Simulation (critical messages are apparently okay.)
echo "Good to go. Project built but not yet compiled."
cd mm_top_horx.sim/sim_1/behav/
vsim -64
--- do tb_axi_file_io_compile.do
--- do ../../../../../scripts/simulation/user/tuna/top.do # change paths as desired
Building a lookup table (LUT):
-
vivado
- Open your project
- Project Manager => IP Catalog
- Vivado Repository => Memories & Storage Elements => RAMs & ROMs => Block Memory Generator
-
Port A Width
:: size of words in the LUT (e.g. the LUT holds 16-bit words)
-
Port A Depth
:: depth of the LUT (e.g. the LUT holds 1024 words)
- NB: check the Read Latency in the summary. The selected output registers can affect this.
- This will create IP in your PROJECT.srcs/sources_1/ip/ directory with whatever name you supplied
- Move this to your IP repository (e.g. cores/ip/) to save it in SVN
- Update the COE file paths in the .xci and .xml files since you moved it
- Update your project building tcl file to load this IP upon building the project
Declare this in your vhdl code like:
component rom_mxlocal_C_L
port (
clka : in std_logic;
addra : in std_logic_vector(5 downto 0); -- depth of LUT (e.g. 2^6 = 64 words)
douta : out std_logic_vector(17 downto 0) -- size of LUT elements (e.g. 18-bit words)
);
end component;
How to run OHP and DQMD outside P1
ssh -Y lxplus.cern.ch
ssh -Y atlasgw
source /det/tdaq/scripts/setup_TDAQ.sh
exec ohp -p ATLAS -c /atlas/moncfg/tdaq-06-01-01/muons/ohp/muon.ohp.xml &
/sw/atlas/tdaq/tdaq-06-01-01/installed/x86_64-slc6-gcc49-opt/bin/dqm_display -p ATLAS &
How to recursively remove all files matching a given pattern
rm $(find . -name "*~")
rm $(find . -name "*.pyc")
# etc
How to get unisim for your modelsim simulation
- Setup the Xilinx environment
- Setup the ModelSim environment
- Open Vivado and do Tools -> Compile Simulation Libraries
- Check that it worked by looking at
compile_simlib.log
- In your project environment, do:
-
vmap unisim ${XILINX_VIVADO}/ids_lite/ISE/unisim
How to go from an outdated fork to a pull request (git)
git clone git@github.com:alexandertuna/xAODAnaHelpers.git
cd xAODAnaHelpers/
git remote add upstream git@github.com:UCATLAS/xAODAnaHelpers.git
git fetch upstream
git merge upstream/master
git push origin master
git checkout -b jelpers
e scripts/checkoutASGtags.py
git add scripts/checkoutASGtags.py
git commit -m 'jelpers -> helpers'
git push origin jelpers
How to convert a hex number to a 32-bit binary
python
$ "{:032b}".format(0x1301)
'00000000000000000001001100000001'
$
How to unfuck your git push origin master
$
$ git remote -v
origin https://github.com/UCATLAS/xAODAnaHelpers (fetch)
origin https://github.com/UCATLAS/xAODAnaHelpers (push)
$
$ git remote rm origin
$ git remote add origin git@github.com:UCATLAS/xAODAnaHelpers
$
$ git remote -v
origin git@github.com:UCATLAS/xAODAnaHelpers (fetch)
origin git@github.com:UCATLAS/xAODAnaHelpers (push)
$
How to find the OHP xmls for muon and DQ desk
Muon:
/atlas/moncfg/tdaq-05-05-00/muons/ohp/muon.ohp.xml
DQ:
/atlas/moncfg/tdaq-05-05-00/muons/ohp/globaldq-muons_includes.xml
How to do shit with slurm on pleiades
Check the active jobs:
-
squeue -u all -p pleiades
Summarize running, idle, and pending jobs:
showq-slurm -p pleaides
Send the output to a particular directory:
-
sbatch --workdir=${workdir} ${executable}
How to calculate the maximum number of bunches in the LHC
> lhc = 27 * 1000
> c = 3e8
> spacing = 25e-9
> lhc / (c*spacing)
3600
How to unfuck your athena development
If you are told
mkdir: cannot create directory `/share': Permission denied
, make sure you are not doing
asetup
within the package directory.
How to find out OTP allocations
Go to OTP, click Browse, find the OTP task you want.
https://atlas-otp.cern.ch/mao/client/cern.ppt.mao.app.gwt.MaoClient/MaoClient.html#MaO_Planning_browser
How to do stuff with the TGC online
tracing stuff:
-
grep Computer /atlas/oks/tdaq-05-05-00/muons/segments/TGC/GNAM/*xml
-
ls /logs/tdaq-05-05-00/ATLAS/
-
/det/tgc/data/gnam/TGCGnamTriggerProfile_278748.root
find computer:
grep Computer /atlas/oks/tdaq-05-05-00/muons/segments/TGC/GNAM/*xml
find logs:
ls /logs/tdaq-05-05-00/ATLAS/
find root files:
/det/tgc/data/gnam/TGCGnamTriggerProfile_278748.root
algorithms:
/det/muon/sw/tdaq-05-05-00/TGCGnam/TGCGnamDQMF/src/
configs [atlasgw]:
/atlas/oks/tdaq-05-05-00/muons/segments/DQM/DQM_Segment_TGC.data.xml
input histograms:
https://atlasdaq.cern.ch/info/mda/coca/TGCGnam
OHP histograms:
/atlas/moncfg/tdaq-06-01-01/muons/ohp/muon.ohp.xml
source setupmuon.sh
mkdir -p $HOME/db/tdaq-05-05-00
export TDAQ_DB_USER_REPOSITORY=$HOME/db/tdaq-05-05-00
oks-checkout.sh muons/segments/DQM/DQM_Segment_TGC.data.xml
oks-commit.sh -m "update thresholds" -u DQM_Segment_TGC.data.xml
How to set a variable on a twiki
- Go to the bottom of the page
- Click "More topic actions"
- Click "Edit settings" under "Edit topic preference settings"
- Then add something like:
* Set HISTPATH = https://atlasdaq.cern.ch/info/mda/get/MDA-ID
h/t Lisa.
How to find the generator filter efficiency
> grep "GenFiltEff\|Filter Efficiency" log.generate
06:33:34 Py:EvgenFilterSeq INFO Filter Efficiency = 0.004064 [2101 / 516990]
06:33:34 Py:EvgenFilterSeq INFO Weighted Filter Efficiency = 0.003853 [0.001387 / 0.359899]
06:33:34 MetaData: GenFiltEff = 3.852751e-03
How to then take an average from the command line:
for dir in user.jzhong.MttSlice_999001.evgen*/*/; do
cd ${dir}
str=$(grep "GenFiltEff" log.generate)
echo ${str: -12}
cd ../../
done | awk '{total+=$1; count+=1} END {print total/count}'
How to set the x-axis on a ROOT graph (TGraph, TMultiGraph, et al)
# doesnt work
# multi.GetXaxis().SetRangeUser(0, 1)
# works
multi.GetXaxis().SetLimits(0, 1)
SetRangeUser will do nothing and also not throw a warning/error. Why? Because fuck ROOT.
How to get stuff out of a P1 computer
echo "message" | mail -s "subject" -a "attachment.pdf" -c "cc1@cern.ch,cc2@cern.ch" recipient@cern.ch
Shoutout to Sarb.
How to stop your TCanvas's from disappearing
Is your TCanvas going out of scope? Are the histograms within the TCanvas going out of scope? All things are possible.
for obj in [hist1, hist2, canvas]:
ROOT.SetOwnership(obj, False)
Josh knows all things.
How to merge xAODs or ESDs
> rcSetup
> xAODMerge output.root input_1.root input_2.root
It does not like wildcards. Shoutout to Joey and Khilesh.
https://twiki.cern.ch/twiki/bin/view/AtlasComputing/MergeTrf
Shoutout to Jochen.
How to delete a wildcard of datasets from Penn
> echo "be careful"
> echo "rucio is dumb"
> for dataset in $(rucio-ls PATTERN* | grep -v "/" | sort) ; do dq2-delete-replicas ${dataset/user.tuna:/} UPENN_LOCALGROUPDISK ; done
How to translate p0 to Z0 and back
p0 = ROOT.RooStats.SignificanceToPValue(2)
Z0 = ROOT.RooStats.PValueToSignificance(0.01)
h/t Tae.
How to make Helvetica the default font for matplotlib on OSX
In terminal:
> cd /System/Library/Fonts/
> brew install fondu
> sudo fondu Helvetica.dfont
> rm ~/.matplotlib/fontList.cache
In script:
from matplotlib import rcParams
rcParams['font.family'] = 'sans-serif'
rcParams['font.sans-serif'] = ['Helvetica']
import matplotlib.pyplot as plt
Shoutout to:
How to deal with xAOD bullshit
https://twiki.cern.ch/twiki/bin/viewauth/AtlasComputing/XAODMiniTutorial
https://twiki.cern.ch/twiki/bin/view/AtlasComputing/SoftwareTutorialxAODEDM
How to convert tex file to webpage
Shoutout to Sarah and Zach.
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/GuidelinesForPaperSubmission
https://twiki.cern.ch/twiki/bin/view/AtlasProtected/GuidelinesConfnotes
https://twiki.cern.ch/twiki/bin/viewauth/AtlasProtected/FigureProcessingScript
scp ${USER}@lxplus:/afs/cern.ch/user/z/zmarshal/public/process_tex.py ./process_tex.py
python process_tex.py -i main.tex -o webpage
cd webpage/
for file in *txt; do echo "<p>" >> test.html ; cat ${file} >> test.html ; echo "</p>" >> test.html ; done
How to add SVN rights
Go to
https://atlas-svnadmin.cern.ch/
. Go to the repo and add users. Don't forget to Commit Changes to SVN.
How to map/reduce TTrees (brainstorm)
name = "physics"
trees = analyze(input_tree, ["%s_%i" % (name, icore) for icore in xrange(mp.cpu_count())])
if hadd_method:
chain = ROOT.TChain(name)
for tree in trees:
chain.Add(tree)
chain.Merge(output_filename, 0, "keep")
if jackknife_method:
treelist = ROOT.TList()
for tr in trees:
treelist.Add(tr)
tree = ROOT.TTree.MergeTrees(treelist)
The function (
TChain.Merge
) is used by
hadd
.
How to avoid a stupid red outline on your fitted TF1
TH1.Fit() draws this by default. Turn it off with the "N" option.
How to avoid OSX asking for usr+pw for the system keychain multiple times
Drag the relevant certificate from the
System keychain to the
login keychain.
How to troubleshoot plots looking weird in latex
This is because
ROOT's eps files are built with an old postscript standard. If I run eps2eps on the
ROOT-generated eps file, either conversion command works fine.
How to futz around with truth d3pd maker
asetup 17.2.13.5,here
cmt co PhysicsAnalysis/D3PDMaker/TruthD3PDMaker # Gets the head
# pkgco.py TruthD3PDMaker # Gets the version currently in the release
cd PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/cmt
gmake
cd $TestArea
How to delete equivalent subdirectories from one directory in another
dir1="tnts-00-17-02"
dir2="tnts-00-17-01"
for dir in ${dir1}/*/ ; do rm -rf ${dir2}/$(basename ${dir})/ ; done
How to make all your failing grid jobs succeed
Switch from
--athenaTag=17.2.7
to
--rootVer=5.34.07
.
How to check packages of a given release
> asetup 17.0.6.2.2
> cmt show versions Reconstruction/MissingET
Reconstruction/MissingET MissingET-03-03-15 /cvmfs/atlas.cern.ch/repo/sw/software/i686-slc5-gcc43-opt/17.0.6/AtlasPhysics/17.0.6.2.2
Reconstruction/MissingET MissingET-03-03-08 /cvmfs/atlas.cern.ch/repo/sw/software/i686-slc5-gcc43-opt/17.0.6/AtlasReconstruction/17.0.6
> echo ${dimitris}
wizard
How to get a new grid certificate
Use firefox. Go to the cern grid certificate authority, and look for the section about Firefox Usage. Be sure to export as a p12 file.
https://gridca.cern.ch/gridca/Help/?fdid=6
Then do the bullshit on every machine.
openssl pkcs12 -in cert.p12 -clcerts -nokeys -out $HOME/.globus/usercert.pem
openssl pkcs12 -in cert.p12 -nocerts -out $HOME/.globus/userkey.pem
chmod 400 $HOME/.globus/userkey.pem
chmod 600 $HOME/.globus/usercert.pem
How to hadd together (zip up) two output directories
indir1="output/hists-2014-01-10-13h49m52s/merged"
indir2="output/hists-2014-01-10-14h37m32s/merged"
outdir="output/hists-2014-01-10-15h00m00s/merged"
mkdir ${outdir}
for dir in ${indir1}/*/ ; do echo "mkdir ${outdir}/$(basename ${dir})" ; done
for dir in ${indir1}/*/ ; do hadd ${outdir}/$(basename ${dir})/hadd.root ${indir1}/$(basename ${dir})/hadd.root ${indir2}/$(basename ${dir})/hadd.root ; done
How to see files of a dataset at a site
dq2-list-file-replicas mc12_8TeV.169502.AlpgenJimmy_Auto_AUET2CTEQ6L1_TVBF_ZeeNp2.merge.NTUP_TAU.e1733_s1581_s1586_r3658_r3549_p1344_tid01200398_00 FZK-LCG2_PERF-TAU
How to compile and link something on osx
> g++ helloworld.cpp -o helloworld
> ./helloworld
Hello World!
>
How to turn on line numbers in emacs
- download setnu.el
- move
setnu.el
to ~/.emacs.d/
- load
setnu.el
by adding (load "~/.emacs.d/setnu")
to the ~/.emacs
file
- turn setnu on by default by adding the following lines to the
~/.emacs
file:
(add-hook 'find-file-hook 'turn-on-setnu-mode)
(add-hook 'find-file-not-found-hooks 'turn-on-setnu-mode)
How to figure out the parent dataset of a local file
dq2-list-parent-datasets srm://srm.hep.upenn.edu:8443/srm/v2/server?SFN=/disk/space00/srm/atlaslocalgroupdisk/rucio/user/tuna/bull/shit/user.tuna.skim.root
How to tell python where to install stuff
PYTHONUSERSITE
How to re-draw canvas axis (axes) in ROOT
In case histogram attributes are drawn on top of the axes.
ROOT.gPad.RedrawAxis()
How to skim events from a AOD
acmd.py filter-files --output pool.root --selection ~/public/eventdisplaysCERN2013/runevent.txt data12_8TeV.*/*.root*
What to do when "X is abstract and can not be instantiated"
> import ROOT
> ROOT.gROOT.ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+")
> tool = ROOT.Root.TElectronLikelihoodTool()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: TElectronLikelihoodTool is abstract and can not be instantiated
Current solution: complain to Kurt, hn-atlas-EGammaWG, and hn-atlas-PATHelp. The problem is
TCalculatorTool or some shit.
How to find where datasets (replicas) live on the grid
> dq2-list-dataset-replicas mc12_8TeV.147806.PowhegPythia8_AU2CT10_Zee.merge.NTUP_TAU.e1169_s1469_s1470_r3542_r3549_p1344_tid01106023_00
INCOMPLETE:
COMPLETE: FZK-LCG2_PERF-TAU,TRIUMF-LCG2_PERF-TAU
How to turn ROOT types into generic types
> ROOT.TClassEdit.ResolveTypedef("Bool_t", True)
'bool'
Relevant cross-sections for Htautau
Source:
Table 1
Process |
Cross section (pb) |
Wlnu+jets |
12.22 x 103 |
Zll+jets |
1.15 x 103 |
ttbar |
129.6 |
single top (t) |
28.4 |
single top (s) |
1.8 |
Wt |
22.4 |
WW |
20.76 |
WZ |
6.8 |
ZZ |
1.55 |
gg H tautau lh |
0.56 |
VBF H tautau lh |
0.045 |
WH H tautau lh |
0.020 |
ZH H tautau lh |
0.011 |
Single-object L1 menu in 2012
h/t Sarah for her
sleuthing skills
Muon |
Electron |
Tau |
Jet |
CFJet |
FJet |
L1_MU4 (MU4 ) |
L1_EM6 (EM6 ) |
L1_TAU8 (HA8 ) |
L1_J10 (J10 ) |
L1_J15CF (J15CF ) |
L1_FJ15 (JF15 ) |
L1_MU6 (MU6 ) |
L1_EM10VH (EM10VH ) |
L1_TAU11 (HA11 ) |
L1_J15 (J15 ) |
|
L1_FJ30 (JF30 ) |
L1_MU10 (MU10 ) |
L1_EM12 (EM12 ) |
L1_TAU11I (HA11I ) |
L1_J20 (J20 ) |
|
L1_FJ50 (JF50 ) |
L1_MU11 (MU11 ) |
L1_EM14VH (EM14VH ) |
L1_TAU15 (HA15 ) |
L1_J30 (J30 ) |
|
L1_FJ75 (JF75 ) |
L1_MU15 (MU15 ) |
L1_EM16V (EM16V ) |
L1_TAU15I (HA15I ) |
L1_J50 (J50 ) |
|
|
L1_MU20 (MU20 ) |
L1_EM16VH (EM16VH ) |
L1_TAU20 (HA20 ) |
L1_J75 (J75 ) |
|
|
|
L1_EM18VH (EM18VH ) |
L1_TAU40 (HA40 ) |
L1_J100 (J100 ) |
|
|
How to bookkeep skims at Penn
python bookkeep.py --metadata="h_n_events" --ptag=p1344 --tags="skim-all.v02-00" --input="/xrootd/srm/atlaslocalgroupdisk/user/tuna/mc12_8TeV/" --samples=mc.ggFHs,mc.VBFHs,mc.ZeeNpXs,mc.ZmumuNpXs,mc.ZtautauNpXs,mc.ZeeVBFNpXs,mc.ZmumuVBFNpXs,mc.ZtautauVBFNpXs,mc.ZeeTVBFNpXs,mc.ZmumuTVBFNpXs,mc.ZtautauTVBFNpXs,mc.WenuNpXs,mc.WmunuNpXs,mc.WtaunuNpXs,mc.tops,mc.dibosons
How to "flatten" directory structure of TNTs at Penn
We want:
user.tuna.dataset/job_000/tnt.root --> user.tuna.dataset/job_000.tnt.root
Do:
# Did jobs finish?
for dataset in * ; do echo $dataset ; for job in $dataset/job_* ; do ls $job/tnt.root ; done ; done
# Move them.
for dataset in * ; do echo $dataset ; for job in $dataset/job_* ; do echo "mv $job/tnt.root $job.tnt.root" ; done ; done
How to configure Ubuntu to read exfat file systems
If:
Unable to mount XX GB Filesystem
Error mounting: mount: unknown filesystem type 'exfat'
Then:
sudo apt-add-repository ppa:relan/exfat
sudo apt-get update
sudo apt-get install fuse-exfat
h/t
How to make 256 colors available in terminal emacs
env TERM=xterm-256color emacs -nw
How to do a for loop in bash
for file in *eps
do
epstopdf ${file}
done
How to steer where TeX looks for files
export TEXINPUTS=.:$HOME/code/tex/:$TEXINPUTS
h/t
http://www2.ph.ed.ac.uk/~wjh/tex/documents/environmental.pdf
How to divide a TH1F with binomial errors
h/t
http://steve.cooleysekula.net/goingupalleys/2011/08/09/python-and-root-tricks-efficiency-graphs/
How to add a ssh key on bitbucket
[User icon in the top-right] -- [Manage account] -- [SSH keys] -- [Add keys]
SSH keys can be generated with
ssh-keygen -t rsa
and retrieved with
cat ~/.ssh/id_rsa.pub
.
On github, bitbucket
"I use github for public stuff and bitbucket for private stuff. The community is overall much bigger on github but github charges $ for private repositories. Private repositories are free on bitbucket."
- Noel, 20 Jan 2013
How to use athena software to break GRL into periods
source /afs/cern.ch/atlas/offline/external/GRID/ddm/DQ2Clients/setup.sh
voms-proxy-init -voms atlas
asetup 17.3.2.1,here
dqu_grl_extract_period.py --period=[PERIOD] --project-tag=[TAG] [GRL]
An example period arg is
A. An example project tag arg is
data12_8TeV. Note that setting up dq2 is necessary for pyAMI login.
How to ask ls to only show directories
ls -d */
How to make correlation plots with bin content printed in large black text
import rootlogon
th2 = file.Get(...path to TH2...)
th2.SetMarkerColor(ROOT.kBlack)
th2.SetMarkerSize(3)
th2.Draw('COLZTEXT')
How to dq2-get a list of datasets
dq2-get -F list_of_datasets.txt -f *root*
How to break up a file into smaller chunks
Use Josh's killer script
DivideAndRandomizeTree.py
. Example:
python DivideAndRandomizeTree.py --input-dir=`pwd` --output-dir=`pwd`/chunks --treename=tau --nout=10
How to turn on grid superpowers
voms-proxy-init -voms atlas:/atlas/phys-higgs/Role=production
How to check electron ID bit words
It can be valuable to know why an electron failed PID. TRT? BLayer? The isEM bitwords are magic for this. The following shows how to manipulate the bitwords in pyroot x rootcore.
Load egamma PID defs
import ROOT
import os
ROOT.gSystem.Load('%s/lib/libegammaEvent.so' % os.environ['ROOTCOREDIR'])
from ROOT import egammaPID
Check whether [CUT] passed [MENU]++
if [MENU BITWORD] & (0x1 >> egammaPID.[CUT]) == 0:
print 'You passed %s!' % [CUT]
el_isEMLoose
el_isEMMedium
el_isEMTight
ClusterEtaRange = 0 /* cluster eta range */
ConversionMatch = 1 /* matching to photon (not necessarily conversion--the name is historical) */
ClusterHadronicLeakage = 2 /* cluster leakage into the hadronic calorimeter */
ClusterMiddleEnergy = 3 /* energy in 2nd sampling (e.g E277>0) */
ClusterMiddleEratio37 = 4 /* energy ratio in 2nd sampling (e.g E237/E277) */
ClusterMiddleEratio33 = 5 /* energy ratio in 2nd sampling (e.g E233/E237) */
ClusterMiddleWidth = 6 /* width in the second sampling (e.g Weta2) */
ClusterBackEnergyFraction = 7 /* energy fraction in the third layer */
ClusterStripsEratio = 8 /* fraction of energy found in 1st sampling (NB: not used in fact for electrons)*/
ClusterStripsDeltaEmax2 = 9 /* energy of 2nd maximum in 1st sampling ~e2tsts1/(1000+const_lumi*et) */
ClusterStripsDeltaE = 10 /* difference between 2nd maximum and 1st minimum in strips (e2tsts1-emins1) */
ClusterStripsWtot = 11 /* shower width in 1st sampling */
ClusterStripsFracm = 12 /* shower shape in shower core 1st sampling */
ClusterStripsWeta1c = 13 /* shower width weighted by distance from the maximum one */
ClusterStripsDEmaxs1 = 15 /* difference between max and 2nd max in strips */
TrackBlayer = 16 /* B layer hit */
TrackPixel = 17 /* number of Pixel hits */
TrackSi = 18 /* number of Pixel and SCT hits */
TrackA0 = 19 /* distance of closet approach */
TrackMatchEta = 20 /* eta difference between cluster and extrapolated track in the 1st sampling */
TrackMatchPhi = 21 /* phi difference between cluster and extrapolated track in the 2nd sampling */
TrackMatchEoverP = 22 /* energy-momentum match */
TrackTRThits = 24 /* number of TRT hits */
TrackTRTratio = 25 /* ratio of high to all TRT hits for isolated electrons */
TrackTRTratio90 = 26 /* ratio of high to all TRT hits for non-isolated electrons (not for new ++ menus) */
TrackA0Tight = 27 /* distance of closet approach for tight selection (not to be used in new ++ menus) */
TrackMatchEtaTight = 28 /* dEta between cluster and extrap track in the 1st sampling for tight selection (not used in new ++ menus)*/
Isolation = 29 /* isolation */
ClusterIsolation = 30 /* calorimetric isolation */
TrackIsolation = 31 /* tracker isolation */
Relevant info:
Package: atlasoff/Reconstruction/egamma/egammaEvent/tags/egammaEvent-03-06-38
SVN:
https://svnweb.cern.ch/trac/atlasoff/browser/Reconstruction/egamma/egammaEvent/trunk/egammaEvent/egammaPIDdefs.h#L127
XP with KG round 3: Tar magic
Issue: Tar doesnt like absolute paths:
tar cvzf tar.tar.gz /afs/cern.ch/user/t/tuna/tmp/
tar: Removing leading `/' from member names
...
Untarring yields an unwarranted directory structure
afs/cern.ch/user/t/tuna/tmp/[FILES].
Solution: The
-C option helps here.
tar -cvzf tar.tar.gz -C /afs/cern.ch/user/t/tuna/ tmp/
Untarring yields the desired directory structure:
tmp/[FILES].
XP with KG round 2
# Configure shipping the framework to the grid
runfolder = parent_folder_name+'/run'
kw['RunDirName'] = runfolder
# If the shipment doesnt already exist, make it
if not os.path.isdir(runfolder):
# Make a full copy of the analysis directory
os.makedirs(runfolder)
for f in glob.glob(curdir + "/*"):
#if os.path.isfile(f):
if not 'output' in f and not '.svn' in f and not 'ntuple.root' in f:
if 'libs' in f:
subprocess.call(['ln', '-s', f, '.'])
elif os.path.isdir(f):
#subprocess.call(['cp', '-R', f, '.'])
copytree(f, runfolder, ignore=ignore_patterns('*.pyc', '.svn', '.git'))
# Tar the package
tar_command = ['tar', 'cvzf', 'inTarBall.tar.gz']
for excl in exclude_files:
tar_command.append('--exclude="*%s*"' % excl)
subprocess.call(tar_command)
XP with KG
# Make a full copy of the analysis directory
runfolder = parent_folder_name+'/run'
kw['RunDirName'] = runfolder
if not os.path.isdir(runfolder):
os.makedirs(runfolder)
for f in glob.glob(curdir + "/*"):
#if os.path.isfile(f):
if not 'output' in f and not '.svn' in f and not 'ntuple.root' in f:
if 'libs' in f:
subprocess.call(['ln', '-s', f, '.'])
elif os.path.isdir(f):
#subprocess.call(['cp', '-R', f, '.'])
copytree(f, runfolder, ignore=ignore_patterns('*.pyc', '.svn', '.git'))
Trouble with skype on imo
Issue: I receive a call while logged onto skype via imo. I hear an incoming call, and I press accept, but no call is received.
Solution: imo was being blocked by Flashblocker. Click the upper-half panel to enable the flash.
Draft of MC bookkeeping