Monday, November 07, 2005

How to throttle a *nix box

tc qdisc add dev eth# root tbf rate 207Kbit buffer 5Kb/8 limit 10Kb
(207Kbit is 80% of 256Kbit in this example, so set according to your needs)

Not tried it yet though

TODO List

  • Complete jet matching code
    • Jet Resolution
  • Scaling
  • Plot interesting quantities
    • Jet Resolution & MET calibrations
    • Quantities (MET, eta, phi, Mjj) after each cut
    • Number of events remaining after each cut

Tuesday, September 13, 2005

Deleting empty directories

FOund this to be hand, especially after iTunes (or similar) buggers up the filestructure of your mp3 colleciton...

find . -type d -empty -exec rmdir {} \;

or if you are a bit more cautious

find . -type d -empty -ok rmdir {} \;

Works in cygwin, might need some more escaping etc for other *nix's

Monday, September 05, 2005

Debugging ROOT macro's

Sometimes you need to debug a ROOT macro. Often you'll end up putting in loads of cout statements and solving it that way, but its also possible to use the cint debugger to solve your issues. Below is an example of how to do this.

.L libPhysics.so
.L libRFIO.so
.L libQqHinvisible.so
.L Utilities.C
.L L1JetCalibration.C
.L MetDifference.C
.L JetResolution.C
.L JetPlots.C
.L JetPairs.C
.L VBFCuts.C
.L CutPlots.C
.L Analysis.C
TString NumberEvents = "1000";
TString FirstEvent = "0";
double limit = 0.9;
VBFCuts * theCuts = new VBFCuts();
TFile * calibrations = new TFile("InvHalfStatCorr2.root");
L1JetCalibration * jetetcalibration = new L1JetCalibration(calibrations);
.b Analysis::184
.b Analysis::run
.b Analysis::~Analysis
Analysis * qqh120 = new Analysis("hg03_qq_qqh120_inv", NumberEvents, FirstEvent, limit, theCuts, jetetcalibration);
qqh120->run()
.c or .s


Run: S : step over function/loop
s : step into function/loop
i : ignore and step over
c <[line]>: continue
e : step out from function
f [file] : select file to debug
b [line] : set break point
db [line] : delete break point
a [assert]: break only if assertion is true
O [0~4] : Set bytecode compiler mode
debug : bytecode status display on/off
dasm : disassembler

Wednesday, July 13, 2005

Useful commands

Queue commands:

bsub -q 1nw ~/qqh_simple.job 1000 0 - submit 1000 jobs, starting at event 0
qstat -u metson 1nw - check on the status of the jobs

Castor commands:
nsls /castor/cern.ch/user/m/metson/ - list files in castor
nsrm /castor/cern.ch/user/m/metson/file - remove file from castor
rfcp /castor/cern.ch/user/m/metson/file . - copy file from castor to $PWD

Catalog commands:
/afs/cern.ch/user/c/cmsprod/scripts/CreateORCARCForZips.pl --owner hg_2x1033PU8713_TkMu_g133_OSC --dataset hg05_wminus_jj_vbf_qcd_madgr

Tuesday, May 24, 2005

Debugging ORCA code

Ok, so sometimes your orca job will seg fault or crash for no reason. If it does nothing at all (eg. it doesn't enter your analysis block) check that you have :
PKBuilder eventAnalyser("QQH_L1TriggerTest");
as the lasst line in your code. If you get crash you may want to run your program through a debugger, usually GDB, and to do this you must build debug libraries. Here's a mail from Lassi Turra:
If this is scramv1 project, edit your BuildFile and add a line
<
Flags CXXFLAGS="-g -O0">

and rebuild (scramv1 b clean && scramv1 b).

If it's old scram, edit config/compiler.mk (CXXFLAGS) to disable optimisation (remove -O2) and enable debugging (add -g), then rebuild your code (scram b clean && scram b).

You can now run the program with GDB. Information on GDB Usage can be found here.

Tuesday, April 05, 2005

Setting up CygWin

I'm moving away from using Linux (mainly due to lots of small annoyances). I now use CygWin in XP. There is one configuration thats vital for X11 forwarding:

echo "ForwardX11 yes" > /etc/ssh_config
echo "ForwardAgent yes" >> /etc/ssh_config

Else you won't be able to send back a remote window (of course you need to set up all the X11 software first).

Thursday, March 17, 2005

Simon's ORCA Blog: Toot toot, time to use root

Root code to plot four Et graphs in two sections on one canvas and four Eta plots onto a second canvas, it assumes you have started root by
root filename
and that the file has loaded correctly

TH1F * jet1mcEt = _file0->Get("EMCjet1");
TH1F * jet1Et = _file0->Get("Ejet1");
TH1F * jet2mcEt = _file0->Get("EMCjet2");
TH1F * jet2Et = _file0->Get("Ejet2");

// Create and divide the canvas
TCanvas *jet1Canv = new TCanvas("Jet Et Canvas","Jet Et Canvas",1);
jet1Canv -> Divide(2,1);

// Go to first area of canvas
jet1Canv -> cd(1);
// Set colours and draw two histograms
jet1mcEt->SetLineColor(2);
jet1Et->Draw();
jet1mcEt->Draw();
jet1Et->SetLineColor(1);
jet1Et->Draw("SAME");

jet1Canv -> cd(2);
jet2Et->SetLineColor(1);
jet2Et->Draw();
jet2mcEt->SetLineColor(2);
jet2mcEt->Draw();
jet2Et->Draw("SAME");

TH1F * jet1mcEta = _file0->Get("EtaMCjet1");
TH1F * jet1Eta = _file0->Get("Etajet1");
TH1F * jet2mcEta = _file0->Get("EtaMCjet2");
TH1F * jet2Eta = _file0->Get("Etajet2");

// Create and divide the canvas
TCanvas *jet2Canv = new TCanvas("Jet Eta Canvas","Jet Eta Canvas",1);
jet2Canv -> Divide(2,2);
jet2Canv -> cd(1);
jet1Eta->SetLineColor(1);
jet1Eta->Draw();
jet2Canv -> cd(2);
jet1mcEta->SetLineColor(2);
jet1mcEta->Draw();

jet2Canv -> cd(3);
jet2Eta->SetLineColor(1);
jet2Eta->Draw();
jet2Canv -> cd(4);
jet2mcEta->SetLineColor(2);
jet2mcEta->Draw();
jet2Canv->SaveAs("JetEtaCanvas.eps");

TH1F * metEtC = _file0->Get("MetEtCC");
TH1F * metEtU = _file0->Get("MetEtU");

TCanvas *metCanv = new TCanvas("Missing Et Canvas","Missing Et Canvas",1);
metCanv -> cd();
metEtC->SetLineColor(1);
metEtC->Draw();
metEtU->SetLineColor(2);
metEtU->Draw();
metEtC->Draw();
metEtU->Draw("SAME");

TH1F * nojets = _file0->Get("nojets");
TH1F * nomcjets = _file0->Get("nomcjets");

TCanvas *njetsCanv = new TCanvas("Number of Jets Canvas","Number of Jets Canvas",1);
njetsCanv -> cd();
nojets->SetLineColor(1);
nojets->Draw();
nomcjets->SetLineColor(2);
nomcjets->Draw();
nojets->Draw();
nomcjets->Draw("SAME");


// Need to moce the pallettes about a bit - ask Rob
jet1Canv->SaveAs("JetEtCanvas.eps");
metCanv->SaveAs("MetCanvas.eps");
njetsCanv->SaveAs("NoJetCanvas.eps");

Monday, February 14, 2005

C++ top tips #1

C++ Namespaces:

Should use std namespace for cout etc eg:

std::cout << "Output via std::cout" << std::endl;

and not

cout << "Regular cout output" << endl;

Namespaces can be created by:

namespace simon { class simonsclass { }; void simonsfunction { } }

Saturday, February 12, 2005

Questions, ideas and plans

The current status of code is that events with 2 or more jets are reconstructed and interesting quantities (eta etc) are placed in ROOT histograms. This is not especially useful for analysis as quantities are not linked (cutting, in ROOT, makes no sense). However it does give us a useful sanity check. I will try and get Kajari to run the codes over each of our signal datasets. It might also be useful (as another sanity check) to plot some MEt/lepton information. It may be senseible to put a soft cut on jet energy at 20-30Gev.

The current plan is to use ORCA solely to reconstruct events, and ROOT to apply cuts/do the
analysis. This gives us more flexibility in tuning cuts etc. It also means we need to store interesting events as objects (inherit from TObject) containing Jets, Leptons and Missing Et. I'm currently planning on having 4 classes:

MyEvent

Inheritted from TObject (or prehaps the ROOT Event object), basically as a holder for the other three classes. We will store in a ROOT tree one MyEvent per interesting event (obviously). Will be made of a MyMET object and arrays of MyJet and MyLepton. The arrays will hold one object per jet/lepton in the event.

MyJet

Will contain (at least) jet mass & energy, Et, eta, the Lorentz vector, the algorithm and RecQuery used to reconstruct the event and the calo towers that make up the event.

MyLepton

Will contain charge, type (muon/electron - unless these are stored as two separate objects), and how they were reconstructed (calo towers, dt/csc hits)

MyMET

Stores the algorithm and RecQuery used to reconstruct the MET, it's magnitude and the phi-direction


Questions:

  1. HLT path - how do we write our own?

  2. L1 trigger and HLT - how do we put our events through these?

  3. Signal & Background - how do we add background to the signal

  4. QCD background - where is it? how do we use it?

  5. How are leptons reconstructed? Will we need an electron and muon object?

Thursday, January 20, 2005

Perl script to resubmit failed madgraph jobs

#! /usr/bin/perl
# Written by T. Barras and S. Metson
# Resubmits failed MadGraph jobs, to be run in the SubProcesses directory
opendir(DIR, ".");
while(defined($file=readdir(DIR))){
if($file=~/^P.+_.+/){
opendir(SUBDIR,"./$file");
while(defined($subfile=readdir(SUBDIR))){
if($subfile=~/wait\.ajob/){
#print"$file\n";
#print"$subfile\n";
$subfile=~s/wait\.//;
#print"$subfile\n";
$name = substr($file,0,13)."_".substr($subfile,4,1);
#Just to check its not over qsubs 15char limit
$name = substr($name,0,14);
#print"$name\n";
chdir("./$file");
#print"qsub " . $subfile . " -q bulk -N " . $name."\n";
system("qsub " . $subfile . " -q bulk -N " . $name);
chdir("../");
}
}
close(SUBDIR);
}
}
close(DIR);

Command for cat'ing MadGraph events together

grep -v '#' file2|cat file1 - > file0

This will strip the header from file2 and create file0 as a sum of file1 and file2. It's probably best to have file1 as the bigger of the two files to join. The "-" takes the stdout from the grep as the input to the cat.