Archive | Uncategorized

# Insert LATEX code of “Missing Transverse Energy” Symbol into your LYX article

This is how one can insert LATEX code of “Missing Transverse Energy” Symbol into a LYX article.

• Open Latex preamble (under Document > Settings > LaTeX Preamble)
• Add the following line and click apply: \usepackage{cancel}
• Click Command-L to insert a latex code (assuming you are using macosx)
• Add the following code into the box: $\cancel{\it{E}}_{T}$

It’s actually easy and good-looking…

Advertisements

# MacOSX: TurboC Installation

If you’d like to use C++ graphic features which is provided by “graphics.h” and “conio.h” , you should install several packages more to your MacBook. I assume that you already installed C compilers and X11 by Fink or other ways (Make sure “cc” command is working!) . You will also need ncurses package which you can easily install by fink as well. Then continue with the followings:

1. Download TurboC binaries for MacOSx into your working directory.
2. tar -xvf TurboC-dev.tar.gz
3. cd TurboC-source
4. Before running “make” command you may need to edit Makefile. (I remember that i’ve just added a space at the line starting with “hex2h:” as “-o $@” (not -o$@)
5. make

If your system is proper, you won’t get any warnings or error messages after installation. It is important to have “libTurboC.a” in your directory after installation. You have to include this file during compiling c++ files you created.

Now if you look at the structure it’s quite simple. If you locate your programs in the Programs directory which is created after installation, it will be easier for you to show the path.

I’m adding a simple code for you to test.


/*
*  circle.c
*
*
*  Created by Sinan Kuday on 26.02.2010.
*  Copyright 2010. All rights reserved.
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "../graphics.h"
#include "graphics.h"
#include "conio.h"

main(void)
{

int gd=DETECT, gm;
int poly[12]={350,450, 350,410, 430,400, 350,350, 300,430, 350,450 };
initgraph(&gd, &gm, "");
setcolor(3);
setfillstyle(SOLID_FILL,WHITE);
circle(100,100,50);
outtextxy(75,170, "Circle");
rectangle(200,50,350,150);
outtextxy(240, 170, "Rectangle");
ellipse(500, 100,0,360, 100,50);
outtextxy(480, 170, "Ellipse");
line(100,250,540,250);
outtextxy(300,260,"Line");
sector(150, 400, 30, 300, 100,50);
outtextxy(120, 460, "Sector");
drawpoly(6, poly);
outtextxy(340, 460, "Polygon");
getch();
closegraph();

}



You add this code in “circle.c” and compile it with the following command:
cd ..

cc -O0 -g -DWITH_X -I/usr/X11R6/include -o circle -I. Programs/circle.c -L. -L/usr/X11R6/lib -lTurboC -lncurses -lX11 -lm -lpthread

Then run it as usual way:
./circle

If you can see circles, polygons, …etc. in your X11 window, you are done!! Congrats.

# MacOSX: Installing PAW and PAW++

Normally, PAW and PAW++ comes after your cernlib installation. If you didn’t install cernlib before, all you need to do is writing the following command in your terminal window

$fink install cernlib As a more advanced version of PAW, you can use PAW++ only if you also have the right components installed. Otherwise you will get an error like; dyld: Library not loaded: /sw/lib/libXm.2.dylib Referenced from: /usr/bin/paw++ Reason: image not found Trace/BPT trap SW is your fink folder. So the error prompts that you have a missing library file related with lesstif package. So write the following; $ fink install lesstif

In a few minutes later, fink will download and install your missing library files and you can run paw++ writing it in your terminal window.

# Draw Feynman Diagrams Using ROOT

It is needless to say that ROOT Data Analysis Framework provides tons of great tools to write a scientific article. But it happened one more time again and i had a great respect for ROOT after i learned that one can also draw Feynman Diagrams as well.

Although there are alternative ways of drawing the diagrams of your scientific article, why not drawing them using the tool by which you made the analysis ? It’s easier!

Here i am presenting a little code to modify or to use directly just changing some variables. Actually i have just drown a simple S-Channel scattering and i’m leaving the rest of the work to you.

USAGE:

• Copy the code below and paste it on a text file.
• Click “Save as” and name the file as workDiagram.C (which is a name for ROOT macro)
• Open your console and run ROOT writing “root” at the directory you saved workDiagram.C file
• .L workDiagram.C (Load the file)
• simpleSCh() (Run the function)
• You will see something like a compton scattering diagram but the labels are wrong. You can change labels right clicking on them.
• FEATURES:
After running the script on the canvas that ROOT opened for you;

• You can change the labels and their positions by right clicking on
• You can rearrange the size of the picture by dragging the edge of the window
• You can right click on the line and choose “SetLineAttributes” and at the “shape” tab you can rearrange its direction.
• By Drag&Dropping you can change any of the elements on the screen
• Click “File” and choose “Save as”. You will see that you can save your diagram almost any formats: ps, eps, svc, pdf, jpg, gif, xml, tiff, ..etc.
• TIPS:

• Drawing Higss Boson: Right Click on the line and choose “SetLineAttributes” and then make the line dashed choosing at combo box options.
• Drawing Photon, Ws and Zs: Run script using the variables simpleSCh(“zigzag”,”zigzag”,”zigzag”,”zigzag”,”zigzag”). The first and second variables represents the incoming particles. The third one represents middle propagator and the last two one is outgoing particles.
• Drawing gluons: Run script using the variables simpleSCh(“curly”,”curly”,”curly”,”curly”,”curly”).
• Drawing fermions: Run script with default variables simpleSCh() or simpleSCH (“”,””,””,””,””)
void simpleSCh(char *a="",char *b="",char *c="",char *d="",char *e="")
{
//Draw Feynman diagrams
//Open Source ROOT Script Library
//Author: Sinan Kuday

TCanvas *c1 = new TCanvas("c1", "A canvas", 10,10, 500, 300);
c1->SetFillColor(0);
c1->Range(0, 0, 140, 60);
Int_t linsav = gStyle->GetLineWidth();
gStyle->SetLineWidth(3);
TLatex t;
t.SetTextAlign(20);
t.SetTextSize(0.1);
switch(a){
case "zigzag":
TCurlyLine *lt = new TCurlyLine(10,50,40,30); lt->SetWavy();
break;
case "curly":
TCurlyLine *lt = new TCurlyLine(10,50,40,30);
break;
default:
lt = new TArrow(10, 50, 40, 30, 0.03,"->|-"); 			break; 	} 	lt->Draw();

switch (b) {
case "zigzag":
TCurlyLine *lb = new TCurlyLine(10, 10, 40, 30); lb->SetWavy();
break;
case "curly":
TCurlyLine *lb = new TCurlyLine(10, 10, 40, 30);
break;
default:
TArrow *lb; lb = new TArrow(10, 10, 40, 30, 0.03,"-|>-");
break;
}
lb->Draw();

t.DrawLatex(24,10,"e^{-}");
t.DrawLatex(24,46,"e^{+}");

switch (c) {
case "zigzag":
TCurlyLine *middle = new TCurlyLine(40, 30, 100, 30);
middle->SetWavy();
break;
case "curly":
TCurlyLine *middle = new TCurlyLine(40, 30, 100, 30);
break;
default:
TArrow *middle; middle = new TArrow(40, 30, 100, 30, 0.03,"-|>-");
break;
}
middle->Draw();

t.DrawLatex(72,36,"#gamma");

switch (d) {
case "zigzag":
TCurlyLine *rt = new TCurlyLine(100, 30, 130, 10);
rt->SetWavy();
break;
case "curly":
TCurlyLine *rt = new TCurlyLine(100, 30, 130, 10);
break;
default:
TArrow *rt; rt = new TArrow(100, 30, 130, 10, 0.03,"-<|-"); 			break; 	} 	rt->Draw();

switch (e) {
case "zigzag":
TCurlyLine *rb = new TCurlyLine(100, 30, 130, 50);
rb->SetWavy();
break;
case "curly":
TCurlyLine *rb = new TCurlyLine(100, 30, 130, 50);
break;
default:
TArrow *rb; rb = new TArrow(100, 30, 130, 50, 0.03,"-<|-"); 			break; 	} 	rb->Draw();

t.DrawLatex(113,10,"#bar{q}");
t.DrawLatex(113,46,"q");

c1->Update();
gStyle->SetLineWidth(linsav);
}