Latex – Splitting the page into two colomns

To make the whole document to have multiple columns –  \documentclass[11pt,twocolumn]{article}

To start a new page with two column – \twocolumn

To define the distance between the two columns – \setlength{\columnsep}{distance}

If you need a line to separate the columns – \setlength{\columnseprule}{thickness}

 

 

For more info – http://texblog.wordpress.com/2007/08/11/creating-two-columns-in-article-report-or-book/

 

http://texblog.wordpress.com/2007/08/01/placing-figurestables-side-by-side-minipage/

Leave a comment

Filed under LaTeX

sed a powerful command line editor.

Recently I had to work with a lot of xml files in connection to my work. Now there are few 10’s of them less 100 arranged in a several directories. The original xml files that I had was passed on to me by a colleague who obviously had a different directory structure and she developed it accordingly for her directory layout. Also there is a special xml tag which lets the file identify itself in terms of its absolute path. Something like <path file=”/l1calo/segments/dqm/<thisfile>.xml” /> Now I need to repace the root path “/l1calo” with “myhome/l1calo”. Only then could I load these xml files to the application. Otherwise it wouldn’t work. So How do I do it. I could open each file in gvim and have done a pattern substitution. But this is extremely inefficient, given the fact that I have to go through 10 directories which on an average contains 5 or 6 xml files.

This problem can be easily solved using sed. A command line text editor. I just had to loop through all the directories and execute sed to replace the specific pattern with my choice. Here is command .  cd to the root directory of your xml’s and then do

for dir in `ls -d */`; do (cd $dir; sed -i 's/\/l1calo\/segments/\/home/\/myhome\/l1calo\/segments/g' * ); done;

Thats it.

Leave a comment

Filed under Unix

Luminosity and LHC beam parameters

A good paper on luminosity and LHC beam parameters  Luminosities

Leave a comment

Filed under LHC

Acoplanarity

Here is a small article about “Acoplanarity and beam line rotation”.

http://www.slac.stanford.edu/BFROOT/www/Detector/Trigger/software/L3TFilters/rotation.ps

 

Leave a comment

Filed under Physics

Pythia6 tips

The PYLIST(12) subroutine of Pythia will give a list of all decay channels with their IDC numbers and many more details. The output of the PYLIST(12) is available here

The PDG standard, with the local Pythia extensions, is referred to as the KF particle code.  This code you have to be thoroughly familiar with. It is described below.  The KF code is not convenient for a direct storing of masses, decay data, or other particle properties, since the KF codes are so spread out.  Instead a compressed code KC between 1 and 500 is used here. A particle and its antiparticle are mapped to the same KC code, but else the mapping is unique. To generate processes 14, 18 and 29, for instance, one needs MSEL=0 MSUB(14)=1 MSUB(18)=1 MSUB(29)=1 MSUB(ISUB) = 1 is the command to switch on process ISUB Selection of kinematics cuts in the CKIN array. To generate hard scatterings with 50 GeV ≤ p⊥ ≤ 100 GeV, for instance, use CKIN(3)=50D0 CKIN(4)=100D0

Leave a comment

Filed under Pythia

Memory Leak in Action

The most important and interesting thing we come across while learning about pointers is memory leak. If we declare a pointer and forgets to delete it manually, it will stay in existence and can cause memory leak. I do not know how many of you have tried to see it in action. However I wanted to see it and so I wrote this small code:

//The program illustrates the destructive power of pointers
//Author:Thomas Mathew tm1729@gmail.com
#include "iostream"
using namespace std;

int main()
{
   int i=0;
   while (i!=-1){
         double *pi = new double;
         if (i%100000==0) { cout<<"Pointer : "<<i<<" Address: "<<pi<<endl;}
         i++;
         }
   return 0;
}

To see the effect of the code on memory consumption, have a look at the system monitor display

As you can see the memory consumption increases so rapidly and once it uses 100% RAM, it starts to use up Swap. And as soon as I terminate the program, its all back to normal. The ripple effect is due to the occasional cout command. You can change the frequency of cout and see how fast/slow memory consumption increases.

 

 

3 Comments

Filed under C++

Relativistic Kinematics

A very good material on Relativistic Kinematics for particle physicists Kinematics for PP

You can also access it from http://pdg.lbl.gov/2008/reviews/kinemarpp.pdf

 

1 Comment

Filed under Physics