Difference: JacobBlancoTutorials (5 vs. 6)

Revision 611 May 2013 - JacobBlanco

Line: 1 to 1
 
META TOPICPARENT name="JacobBlanco"

Jacob's collection of useful tutorials and tips

Line: 6 to 6
 

How to mount your pphome on your personal laptop/computer at RHUL

Changed:
<
<
This is a particularly useful tip if you, like myself, want to edit files from your local machine running the latest version of emacs. More often then not the version available on linappserv is either outdated or simply too vanilla for you. I run Aquamacs on my MacBook which has several customizations specific to OS X and the Mac.
>
>
This is a particularly useful tip if you, like myself, want to edit files from your local machine running the latest version of emacs. More often then not the version available on linappserv is either outdated or simply too vanilla for you. I run Aquamacs on my MacBook which has several customizations specific to OS X and the Mac.
  N.B. You need to be within PP network, either via the wired network or the Stella wireless network. Check below for instructions on how to mount your pphome from outside of the network.
Line: 40 to 38
  Once you have changed your UID and made sure that all the appropriate ownerships have been changed and directories have been renamed we can proceed to mount the NFS share.
Changed:
<
<
On Mac OS X this can be easily accomplished from Disk Utility.app. First of all create a new mount directory either through the terminal or Finder. Now, in your dock click on Applications->Utilities->Disk Utility, here select File->NFS Mounts... A new window should open with an empty list, select the + sign to add a new mount. The address should be of the following form, making sure you replace jblanco with your Linux username:
>
>
On Mac OS X this can be easily accomplished from Disk Utility.app. First of all create a new mount directory either through the terminal or Finder. Now, in your dock click on Applications->Utilities->Disk Utility, here select File->NFS Mounts... A new window should open with an empty list, select the + sign to add a new mount. The address should be of the following form, making sure you replace jblanco with your Linux username:
 
nfs://134.219.108.207/pptank/home/jblanco
Line: 153 to 149
 This should copy all files needed to the ROOTSYS folder you specified in your bash configuration. This should let you run ROOT in the normal way.

Enjoy smile

Added:
>
>

Making Data vs MC-style plots with SF plot attached

So we've seen these sort of plots everywhere and they are cool (in a PP ROOT plotting sort of way. Stockholm-syndrome much?). They are however a little tricky to get right. Learning the anatomy of a TCanvas is painful and even when you think you know what you're doing, you really don't. You'll have something that looks like that plot below, note that the X-axis of the top plot is behind the bottom plot, so you need to make sure that both top and bottom plot have the same range for things to make sense.

So here is a simple way of getting these sort of canvases drawn. One might be tempted to create a canvas and then call TCanvas::Divide, but this will produce two pads that have margins and its a mess. Instead you want to create the pads yourself. First lets make the canvas and the top pad.

TCanvas* canvas = new TCanvas( "SomeName", "SomeTitle", 900, 700 );
TPad top_pad("top_pad", "top_pad",0,0.4, 1.0, 1.0);
top_pad.Draw();
top_pad.cd();
top_pad.SetBottomMargin(0);

You just created a pad of a certain size in the canvas and set the bottom margin of that pad to zero, that way the SF plot that will be going in the bottom pad is flush with the top pad. After this portion of code then go ahead and draw whatever you want on the top pad, including things like histograms and legends.

Next we'll create the bottom pad making sure things are flush with the top pad content:

canvas->cd(); // This line is REALLY important otherwise you'll draw a subpad in the top pad :-(
 
Added:
>
>
TPad bottom_pad("bottom_pad", "bottom_pad", 0, 0.03, 1.0, 0.4); bottom_pad.Draw(); bottom_pad.cd(); bottom_pad.SetTopMargin(0); bottom_pad.SetGrid(1,1); // Optional: Enable gridlines on plots

Then draw whatever you need on the bottom pad, save the canvas to a root file or output as EPS/PNG/PDF for slides and notes.

 
Added:
>
>
Enjoy!
 

Making beautiful 2D plots

If you've ever made 2D plots in ROOT using the colz command you know how ugly the colours are. If you have no idea what I'm talking about look at the plot on the left, here I'm gonna show you how to turn that into the plot on the right.*

Line: 162 to 185
 In this tutorial I will be using a fake 2D histogram called foo. This tutorial will be written in the language of C++ however this can be easily ported to Python if you want to.

So normally to plot foo with a colour gradient one uses the following command

Changed:
<
<
root [0] foo->Draw("colz")
>
>
root [0] foo->Draw("colz")
 
Added:
>
>
 This will use the hideous black, pink, bright green and grey palette. To change this behaviour, before running the draw command, run:
Changed:
<
<
root [0] gStyle->SetPalette(1)
>
>
root [0] gStyle->SetPalette(1)
 
Added:
>
>
 This will force the use of the more familiar IR-type gradient for your plots. Remember that if you like this, you can always add this to your global style definition.

To make the gradient even smoother you can also add something like the following:

Line: 173 to 196
  To make the gradient even smoother you can also add something like the following:
Changed:
<
<
void set_plot_style()
>
>
void set_plot_style()
 { const Int_t NRGBs = 5; const Int_t NCont = 255;
Line: 193 to 215
 Enjoy!

* http://ultrahigh.org/2007/08/20/making-pretty-root-color-palettes/ \ No newline at end of file

Added:
>
>
META FILEATTACHMENT attachment="Barrel_smt.png" attr="h" comment="" date="1368263504" name="Barrel_smt.png" path="Barrel_smt.png" size="16795" user="zrap013" version="1"
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding RHUL Physics Department TWiki? Send feedback