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.

Cernlib Manual Installation

If you are using Unix/Linux based operating system and having difficulties for installing CERNLIB, the best way is to try the simplest way: manual installation.

1- ) Go to http://cernlib.web.cern.ch/cernlib/version.html and click “compressed tar files” link which is proper with your system.

2-) cd / (open your root folder)

3-) mkdir cern

4-) copy 3 tar files that you’ve already downloaded (cernlib.tar.gz, cernbin.tar.gz, include.tar.gz)  into cern folder you created.

5-) Go into your Cern folder you’ve already created and write the command:
tar -xvf cernlib.tar
tar -xvf cernbin.tar
tar -xvf include.tar
6-) Create symbolic links in this folder:
ln -s 2006 pro
ln -s 2006 new
(If you don’t have a folder 2006, change it with the name you have exp: 2004,2005,2007…etc)

7-) Now you should set some system variables: write “export” on the command line to see all fixed system variables and their values which has been declared in the past.

8 ) You must change the variables related to CERN. So either write following commands on the command line or add them into your /etc/bashrc file (for unix). If you add them into your /etc/baschrc file, you won’t need to set these variables everytime you open your computer.

export CERN=<Your Cern Directory>
export CERN_ROOT=<Your Cern Directory>
export CERNLIB=$CERN/pro/lib
export CERNBIN=$CERN/pro/bin
export PATH=$PATH:$CERNBIN

IMPORTANT: Please check your environmental variables by writing “export” in your command line. If you installed Cernlib by Fink or apt-get before, you may not get correct CERN_ROOT, CERNLIB or CERNBIN variables. In this case, open corresponding bashrc/profile files and edit your CERN variables. For fink, edit cernlib… csh, sh files under /sw/etc/profile.d folder.

MacOSX: Manage Programs that Automatically Launch at Startup

Mac Os X operating system has different options to manage startup items. If you have already installed skype, some messengers, orb or some agents, you may not want to use them at the startup of your computer. To inactivate these processes, actually you should remove your login accounts related to corresponding process. So;

  • Open System Preferences (if it’s not in your Dock, you can go to Apple > System Preferences at the top of the screen)
  • From the System Preferences screen, click the “Accounts” icon under the “System” settings.
  • For each account, there is a “Login Items” tab where you can add and remove programs to automatically launch at startup. If you cannot edit your Login Items there it is one of two things:
    • You do not have proper access to edit the person’s account you are looking at.
    • You have proper access, but you need to “Click the lock to make changes.” Just look at the padlock icon at the bottom-left corner of the page. If it’s locked, that’s what you need to do.
  • 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

    Click here to learn how you can install package manager ‘FINK’ on your Macbook.

    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.

    Running ROOT on Lxplus Server of CERN

    Mac OsX terminal window has powerful features than any other operating systems but if you are working on a remote server you need to know a little more about it.

    If you are using MacOSX and if you are connecting lxplus@cern using regular command ssh, the first thing you will observe is that your system cannot open X11 window which is needed by ROOT. To overcome this problem, you should connect using either

    ssh -X username@lxplus.cern.ch
    or
    ssh -Y username@lxplus.cern.ch

    X option, provides you a ssh connection forwarding X11. And Y option, provides a ssh connection Forwarding trusted X11.

    After you logged in using your user name and password, you have 2 options to run ROOT.

    1 -) Entering ROOT variables below:

    export ROOTSYS=/afs/cern.ch/sw/lcg/app/releases/ROOT/5.28.00/i686-slc5-gcc43-opt/root
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ROOTSYS/lib
    export PATH=$PATH:$ROOTSYS/bin

    2-) Or just source Athena Framework and setup root from Athena: (Note that Athena consists much more than ROOT)

    export AtlasSetup=/afs/cern.ch/atlas/software/releases/16.6.0/AtlasSetup
    alias asetup='source $AtlasSetup/scripts/asetup.sh'
    asetup 16.6.0

    –Recently this procedure has been changed and became eaiser. Please google for sourcing Athena framework–

    Then just write “root” and start your analysis.

    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);
    }
    
  • Abbreviations at CERN

    If you are someone new at CERN, lets say an undergraduate or a Ph.D. student, sooner or later you’ll realize the abbreviation list you have to learn. And this is not an ordinary task to be able to understand while someone is talking about AODs,ESDs,DPDs…etc. So you’d better memorize the list below before losing your mind like “what the hell is going on here!!” I am presenting a short dictionary below, actual list is quite longer. :))

    ACCU: Advisory Committee of CERN Users; High level committee to discuss the projects of member countries and users.

    AFS: Andrew File System; a network file system that allows users to reach datasets and experimental results. AFS is a distributed file system available for UNIX and other operating systems.

    AMI: Atlas Metadata Interface; AMI is the primary physicist web tool that provides physics metadata bookkeeping and access to the Dataset Selection Catalog for ATLAS through an optimized search interface.

    ALICE: A Large Ion Collider Experiment; it is also the name of the corresponding detector which is located outside of CERN facility.

    AOD: Analysis Object Data; This is the file format of reduced datasets from ESD.

    ARDA: A Realization of Distributed Analysis; is an LCG project whose main activity is to enable LHC analysis on the grid.

    ATHENA: is the name of the framework which is a derivative of the Gaudi Common Framework Project.

    ATLAS: A Toroidal LHC ApparatuS; the name of one of the detectors which is 44 meters long and 25 meters in diameter.

    ATLFAST: is the package for fast simulation of ATLAS detector and physics analysis.

    BSM: Beyond Standard Model; generally used for expressing models other than Standard Model like Supersymmetric, extra dimensional, exotic, technicolor…etc.

    CAF: Cern Analysis Facility; is a cluster at CERN running PROOF. It can be used for prompt analysis of pp data as well as selected PbPb data. Furthermore calibration programs can be run on the CAF.

    CASTOR: Cern Advanced STORage Manager; is a hierarchical storage management (HSM) system developed at CERN used to store physics production files and user files.

    CERN: European Organization for Nuclear Research, (Originally French: Organisation Européenne pour la Recherche Nucléaire)

    CDS: Cern Document Server; This is simply the site located at the address http://cdsweb.cern.ch/

    CINT: is an interpreter for C and C++ code. It is useful e.g. for situations where rapid development is more important than execution time.

    CLIC: The Compact Linear Collider; is another planning Cern project which will collide particles at 3 TeV in a linear orbit.

    CMS: The Compact Muon Solenoid Experiment; is also the name of the corresponding detector at Cern.

    COMPHEP: is a stand-alone software to generate events and high energy physics calculations via Matrix Element Monte Carlo method.

    CSC: 1) Cathode Strip Chambers; 2) Cern School of Computing

    DDM: Distributed Data Management; allows user to manage distributed experiment datas to the Tier centers around the world.

    DFS: Data File System;

    DLF: Distributed Logging Facility is a powerful logging facility which allows centralised logging and accounting in CASTOR.

    DPD: Derived Physics Dataset; This is the file format of datasets which is derived from either ESDs or AODs.

    DQM: Data Quality Monitoring; is an experimental online/offline data monitoring system developed by Cern.

    EDM: Event Data Model; is the platform that allows the use of common software between online data processing and offline reconstruction.

    ESD: Event Summary Data; is the file format derived by raw data in collision experiments at Cern.

    EVO: Enabling Virtual Organizations; is a java network messenger and communication tool dominantly used in Cern.

    GANGA: is an easy-to-use frontend for job definition and management with a basic interface, implemented in Python.

    GLIMOS: Group Leader in Matters of Safety for Experiments and Tasks

    LCG: LHC Worldwide Computing Grid; is a global collaboration of more than 170 computing centres in 34 countries. The mission of the WLCG project is to build and maintain a data storage and analysis infrastructure for the entire high energy physics community that will use the Large Hadron Collider at

    LHC: Large Hadron Collider;

    LHCb: Large Hadron Collider b-quark; is an experiment set up to explore what happened after the Big Bang that allowed matter to survive and build the Universe we inhabit today.

    LHCf: Large Hadron Collider Forward experiment; consists of two small calorimeters each one placed 140 meter away from the Atlas interaction point. Their purpose is to study forward production of neutral particles in pp collisions.

    LSF: Local Sharing Facility; This is a batch service by Cern computing department.

    MICROMEGAS: MicroMEsh GAseous Structure; is a detector first developed at CERN in Geneva for high-energy physics charged-particle tracking applications.

    N-Tuple: in set theory, n-tuple is a sequence (or ordered list) of n elements, where n is a positive integer. In high energy physics, n defines separate measurements such as rapidity, missing transverse energy, photon, muon, tau multipicity…etc. versus events.

    NICE: A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the single unix specification. It is also required a NICE account to be able to use the system for users at Cern.

    PANDA: Production and Distributed Analysis system; Job defining and executing system at Grid.

    PLUS: Public Login User Service (LXPLUS)

    PROOF: Parallel ROOT Facility; allows interactive parallel analysis on a local cluster. Interactive means that you see the results right away.

    OSG: Open Science Grid;

    ROOT: An object oriented framework for large scale data analysis.

    Savannah: is the department at Cern which is responsible for development, distribution and maintainance of software.

    SPS: The Super Proton Synchrotron (SPS) is a 6.9 km long particle accelerator at Cern. This is also used for injection the particles to LHC.

    SUSY: Supersymmetry; an extra dimensional model which assumes that fermions or bosons has an extra symmetry with an invisible corresponding boson field or fermion field.

    SM: Standard Model; is the model that unified known 3 interactions (electromagnetic+weak+strong) and its particles excluding the effects of gravitation which is the 4th known interaction field.

    TOTEM: Total Cross Section, Elastic Scattering and Diffraction Dissociation at the LHC; is the experiment studies forward particles to focus on physics that is not accessible to the general-purpose experiments.

    TIER: grid centers that collects the experiment data around the world. They also named according to the data they received such as Tier-0, Tier-1, Tier-2.

    TPC: The Time Projection Chamber (TPC) is the main tracking detector in the central barrel of the ALICE experiment at LHC.

    TSO: Territorial Safety Officer.

    VO: Virtual organization; this is related to the certification at Cern Grid.