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…

 

5 Principles of Apple in Their Success Story

Success story of Apple is not a mystery for over a billion of people who are fond of technology products since everyone can easily follow the rise of the company. I know there are plenty of books about Apple and Steve Jobs that talk about their internal-management ideas or secrets which became legend in business management. And one can find tons of articles about Apple’s main principles or even legends. After reading a lot about these, i think it’s important for every constitution to take lessons for themselves. Here i got my own lessons in the following 5 principles.

If you are producing something and if you want to make it like Apple, you can use this prescription:

1- Design in Principles: 3 design principles of Apple are (i) it should be elegant (ii) it should be minimalist (ii) follow the same design outline of company for every single product.

2- Produce easy to use products: This is what they called “user-friendliness”. To be able to reach the most user-friendly product one should try it hard and push the boundaries in quality control.

3- Add some innovation: Apple normally doesn’t invent a new product or product category. Sure, the company did invent the first commercial PC with the Apple II, and the Mac improved on PCs with a graphical user interface and mouse input. But since then, all of Apple’s other products have been recreations of existing products. Apple did not invent the MP3 player; Apple reinvented it and made it better. Apple did not invent the smart phone; Apple reinvented it and made it better. And Apple did not invent the tablet; Apple reinvented it and made it better.

As Apple designer Jonathan Ive said recently, “Our goals are very simple — to design and make better products. If we can’t make something that is better, we won’t do it.” Clearly, Apple applied that thinking first to iPods, then smart phones and more recently, to the iPad.

4- Provide Customer Support: Jobs understood one of the major conundrums of technology: even if you create products that are easy to use, the variety of things that people want to use technology for often creates complexity. Because of this, consumers at all levels may need some hand holding from time to time. I was one of the most vocal critics of Apple when it introduced its first retail store in Tokyo in 2002. I thought it was crazy for Apple to try and go into retail. At the time, and even today, tech retail stores are in decline while big-box stores like Costco and Walmart sell products on price and nothing else.
Apple uses this conundrum to its advantage. Because it keeps product SKUs simple, the salespeople inside the stores know the products really well. Notice that when you go into an Apple store and are greeted by one of the sales staff, you’re not asked, “How can I help you?” Instead they ask, “What would you like to do today?” They go right to the heart of any technology user’s question, a question that’s always related to what they want to do with the technology the user is interested in.

5- Satisfy Yourself: If you order something from a company, they produce it just because they can. Apple’s approach is quite different. The engineers who are creating Apple products actually make them for themselves. And Jobs was the chief “user” of Apple products when he was alive. All of Apple’s products are based on the fact that Jobs represented the real customer. And his engineers had to come to grips with that when designing a product. It has to be something that they personally couldn’t live without.

Top 10 Theoretical Physicists Alive

Here is my list of top 10 theoretical physicists alive:
1.Stephen Hawking

S. Hawking

2.Steven Weinberg

S. Weinberg

3.Sir Roger Penrose

R. Penrose

4.Edward Witten

E. Witten

5.Peter Higgs

P. Higgs

6.Murray Gell-man

M. Gellman

7.Gerard ‘t Hooft

G. 't Hooft

8.Martinus Veltman

M. Veltman

9.Makoto Kobayashi

M. Kobayashi

10.Toshihide Maskawa

T. Maskawa

Synchronized Code Developing Using GIT and DROPBOX

Simplify your life, if you have too much troubles in code developing with your staff. One of the usual ways is to use a common server and install a Concurrent Versions System (CVS). If you don’t have such facilities around you, you can get a free common server which always readily serve for your interests using DROPBOX. This is a great service! Subscribe to site, invite your staff and start sharing your code or documents through it now.

When it comes to use a CVS, i can suggest you to make the best of using GIT. It is an free & open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. If your code is in a <code_folder> and you installed GIT successfully, use below steps to be synchronized with your staff using DROPBOX now.

If you are the first person who will share your code with your staff through DROPBOX:

  • Open terminal and cd into your code folder.
  • Write “git init”
  • Write “cd .git” and you’ll see branches, objects and config files here.
  • Edit your git config file writing “nano config”. Your config file should be like that in order to stay synchronized through DROPBOX:

[core]

repositoryformatversion = 0

filemode = true

bare = false

logallrefupdates = true

[user]

        name = <USER NAME>

        email = <EMAIL ADDRESS>

[remote "origin"]

url = /Users/kuday/Dropbox/git-archive/.git

fetch = +refs/heads/*:refs/remotes/origin/*

[branch "master"]

remote = origin

merge = refs/heads/master

  • Save your config file and come back to terminal, then write “git add . ” This will add all of the files in to git repository.
  • Move <codefolder>.git into your DROPBOX and send invitation to your staff to share this code.
  • You’ll see your code repository in sharing after you open your dropbox as <codefolder>.git
If you are not the first person who creates the git repository for your code and you can reach <codefolder>.git file through DROPBOX, things are even easier to clone it into your computer:
  • Open terminal in DROPBOX and copy your <codefolder>.git (–> its behaviour is like a zip file) in to a proper location.
  • Go to this location and write “git clone <codefolder>.git” .This will create back your entire code.
  • Write “cd <codefolder>”
  • Edit your config file in .git folder as above.
  • Write “git add .” on your terminal.
  • Start developing!
SOME USEFUL GIT COMMANDS:

git pull origin master
This command gets the latest changes from your staff. Don’t forget to do it often.
git commit -m “Here will be written some messages after editing the code”
After you decide to share the new version of your code with your staff, this command will search for changed files in the repository and updates DROPBOX. You’ll see a spinning wheel near DROPBOX icon which means that you started sharing you new code.
git log
This will show you the entire history of code developing with users, comments and dates.
gitk 
This command opens a useful interface to trace user activities and changes.
git merge origin
This will merge the separate branches which bear different users developments. Use this command if you believe that your code branching too much.

Fastest Way to Calculate Hadronic Cross Sections

Many of the particle physicists may think that CompHEP is not a proper way of making hadronic calculations. Since in numerical calculations CompHEP treats each subprocess separately, calculation of a process with lots of subprocesses (as it happens usually in calculations for hadron colliders) can be a laborious task. In order to make the task simpler and enable non-GUI calculations both symbolic and numerical programs in CompHEP are equipped with the batch PERL scripts symb batch.pl and num batch.pl correspondingly.

Here’s an example how you can use these scripts:

1 -) Open CompHEP in your working directory as ./comphep

2 -) Enter a scattering process like pb,pb -> t,T.

3 -) Enter C-compiler and complete symbolic calculation.

4 -) You will get the numerical session GUI and see Process, SubProcess, Monte Carlo seesion…etc. Notice that you can only calculate subprocess cross sections here.

5 -) Open a new terminal but don’t close CompHEP numerical session window.

6 -) Open your CompHEP working directory where num_batch.pl and sym_batch.pl are located.

7 -) Write ‘./num_batch.pl -run vegas’

8 -) Write ‘./num_batch.pl -show cs’ and you’ll get the total cross section through all subprocesses.

OR edit process.dat to enter your process and use sym_batch.pl in terminal window to complete symbolic calculations.

Reference: http://arxiv4.library.cornell.edu/pdf/0901.4757v1

MacOSX: Solution to PYTHIA / HBOOK Problem in Cernlib

Last month, I was trying to compile some pythia codes to calculate snutau (scalar tau) cross section, Pt and eta distributions. But unfortunately my trusted g77 compiler insistently rejected to compile my code with the following errors:


Undefined symbols:
"_pylist_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pyevnt_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pyinit_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hropen_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hlimit_", referenced from:
_MAIN__ in ccJ7qu36.o
"_pystat_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_pydata_", referenced from:
___g77_forceload_0.0 in ccJ7qu36.o
"_hfill_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_hrout_", referenced from:
_MAIN__ in ccJ7qu36.o
"_hbook1_", referenced from:
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
_MAIN__ in ccJ7qu36.o
"_hrend_", referenced from:
_MAIN__ in ccJ7qu36.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

After a little research about HBOOK technology, i discovered that it’s a quite old component even before Fortran 77 and the only way to make it run in this way is to include Cernlib components while compiling. But that didn’t work either for MacOsX because probably MacosX version of Cernlib doesn’t support HBOOK libraries although it’s possible for Linux.

Anyway why do we have to use HBOOK? At the end of the day, we just want to have some data files to draw using Paw or Root and it’s possible using Pythia’s own components. So the principle must be “Use Pythia Commands to get an Output file because that’s the easiest way!” Here is my solution: I changed all HBOOK commands to PY..s in my code below and it worked perfect.

Write “g77 -o mycode.x -w mycode.f libpythia6421.a” to compile.

C...All real arithmetic in double precision.
      IMPLICIT DOUBLE PRECISION(A-H, O-Z)
      IMPLICIT INTEGER(I-N)
C...Three Pythia functions return integers, so need declaring.
      INTEGER PYK,PYCHGE,PYCOMP
C...Parameter statement to help give large particle numbers
C...(left- and righthanded SUSY, technicolor, excited fermions,
C...extra dimensions).
      PARAMETER (KSUSY1=1000000,KSUSY2=2000000,KTECHN=3000000,
     &KEXCIT=4000000,KDIMEN=5000000)
C...EXTERNAL statement links PYDATA on most machines.
      EXTERNAL PYDATA
      DIMENSION IHI(10)
C...Commonblocks.
C...The event record.
      COMMON/PYJETS/N,NPAD,K(4000,5),P(4000,5),V(4000,5)
C...Parameters.
      COMMON/PYDAT1/MSTU(200),PARU(200),MSTJ(200),PARJ(200)
C...Particle properties + some flavour parameters.
      COMMON/PYDAT2/KCHG(500,4),PMAS(500,4),PARF(2000),VCKM(4,4)
C...Decay information.
      COMMON/PYDAT3/MDCY(500,3),MDME(8000,2),BRAT(8000),KFDP(8000,5)
C...Selection of hard scattering subprocesses.
      COMMON/PYSUBS/MSEL,MSELPD,MSUB(500),KFIN(2,-40:40),CKIN(200)
C...Parameters.
      COMMON/PYPARS/MSTP(200),PARP(200),MSTI(200),PARI(200)
C...Supersymmetry parameters.
      COMMON/PYMSSM/IMSS(0:99),RMSS(0:99)

C....Real definitions...
      REAL CTETM,CTETP,ETAUP,ETAUM,PTAUP,PTAUP2,PTAUM,PTAUM2
      REAL PTAUMX, PTAUMY, PTAUMZ
      REAL PTAUPX, PTAUPY, PTAUPZ
      REAL PTX, ETAX, XMTAU
C ....rapidity: YX
C--------------------------------------------

C...First section: initialization.
      NEV=10000

C...Select generic SUSY generation.
C...39:all MSSM processes except Higgs prod.
C...41:stop pair(ISUB=261-265), 42:slepton pair(201-214), 45:sbottom(281-296)
C...ISUB=210,211,212 for slepton+sneutrino
      MSEL=0
      MSUB(214)=1

C...Set SUSY parameters in SUGRA scenario.
      IMSS(1)=2		!mSUGRA parameters given to PYTHIA
      RMSS(8)=230D0	!m_0
      RMSS(1)=360D0	!m_1/2
      RMSS(5)=10D0	!tan(beta)
      RMSS(4)=1D0	!sign(mu)
      RMSS(16)=0D0	!A_0

C...Channels
      do kk=1949,1974
      MDME(kk,1)=0
      enddo
      MDME(1950,1)=1

C...Channels for W boson
      do kw=206,208
      MDME(kw,1)=0
      enddo

C...If interested only in cross sections and resonance decays:
C...switch on/off initial and final state radiation,
C...multiple interactions and hadronization.
      MSTP(11)=0	! 1:QED radiation
      MSTP(61)=0	! 2:ISR
      MSTP(71)=0	! 1:FSR
      MSTP(81)=0	! 1:multiple int.
      MSTP(111)=0 	! 1:hadronization

C...Initialization for the LHC.
       CALL PYINIT('CMS','e-','e+',3000D0)

C...List resonance data: decay channels, widths etc.
       CALL PYSTAT(2)

C...Book Histograms
	CALL PYBOOK(10,'PT',100,0D0,1000D0)
	CALL PYBOOK(20,'ETA',100,-5D0,5D0)
	CALL PYBOOK(30,'MTAUTAU',100,0D0,2000D0)

C--------------------------------------------------

C...Second section: event loop.

C...Loop over the number of events.
       DO 200 IEV=1,NEV
        IF(MOD(IEV,500).EQ.0) WRITE(6,*)
     &  'Now at event number',IEV

C...Event generation.
         CALL PYEVNT

C...List first few events.
          IF(IEV.LE.5) CALL PYLIST(1)

C...Fill the masses of interesting (s)particles.
C...Fill pt of particle
       DO I=1,N
C...Catch tau- lepton
       IF((K(I,2).EQ.15).AND.(K(I,1).EQ.1)) THEN
       PTX=SQRT(P(I,1)**2+P(I,2)**2)
       CTETM=P(I,3)/SQRT(P(I,1)**2+P(I,2)**2+P(I,3)**2)
       ETAX=-LOG(TAN(ACOS(CTETM)/2.))
       etaum=P(I,4)
       ptaum2=P(I,1)**2+P(I,2)**2+P(I,3)**2
       ptaum=SQRT(P(I,1)**2+P(I,2)**2+P(I,3)**2)
       ptaumx=P(I,1)
       ptaumy=P(I,2)
       ptaumz=P(I,3)

       CALL PYFILL(10,DBLE(PTX),1D0)
       CALL PYFILL(20,DBLE(ETAX),1D0)
C......       CALL HFILL(10,PTX,0.,1.)
C......       CALL HFILL(20,ETAX,0.,1.)
       ENDIF
C...Catch tau+ lepton
       IF((K(I,2).EQ.-15).AND.(K(I,1).EQ.1)) THEN
       etaup=P(I,4)
       ptaup2=P(I,1)**2+P(I,2)**2+P(I,3)**2
       ptaup=SQRT(P(I,1)**2+P(I,2)**2+P(I,3)**2)
       ptaupx=P(I,1)
       ptaupy=P(I,2)
       ptaupz=P(I,3)
       ENDIF
       XMTAU=SQRT((ETAUP+ETAUM)**2-(ptaup2+ptaum2
     .   +2.0*(ptaupx*ptaumx+ptaupy*ptaumy+ptaupz*ptaumz)))
C...       CALL HFILL(30,XMTAU,0.,1.)
       CALL PYFILL(30,DBLE(XMTAU),1D0)
       ENDDO

C...End of documentation and event loops.
200    CONTINUE

C--------------------------------------------

C...Third section: produce output and end.

C...Cross section table.
       CALL PYSTAT(1)

C...Histogram close
C...       CALL HROUT(0,ICYCLE,' ')
C...       CALL HREND('SUSY')

C...Histograms.

       OPEN(11,file='pt.dat',STATUS='unknown')
       IHI(1)=10
       CALL PYDUMP(3,11,1,IHI)
       CLOSE(11)
       OPEN(22,file='eta.dat',STATUS='unknown')
       IHI(1)=20
       CALL PYDUMP(3,22,1,IHI)
       CLOSE(22)
       OPEN(33,file='MTau.dat',STATUS='unknown')
       IHI(1)=30
       CALL PYDUMP(3,33,1,IHI)
       CLOSE(33)
       CALL PYHIST
       END

A Simple C++ Simulation For Beginners

Phenomenology in physics, mostly deals with the simulation of events and obtaining data from simulations to compare it with real time event datas. Obviously during event processing, it’s not necessary to give extra effort to visuality. So one should not confuse it with visual simulations. We’r just making event based calculations. Therefore you can ask what exactly do we simulate? or can any calculation be a simulation? Notice that in scientific experiments, you always need a satisfactory amount of statistics. So basically you should have a scenario for gathering statistics in simulations. Here i’d like to present a calculation of “Pi” number as a simulation sample. Here we are collecting statistics via producing random numbers which is included a circle with r=1.

Calculation: Pi number
The method: Monte Carlo Simulation
Fundamental Formulas: (pi)r 2 and x2+y2 = 1 (Note that radius of circle is unit 1.)

1-) Write below code and compile it writing “g++ pi.cpp -o pi.x”

#include<iostream>
#include<math.h>
#include<stdlib.h>
#include<time.h>

using namespace std;
int main(){
	int jmax=1000; // maximum value of HIT number. (Length of output file)
	int imax=1000; // maximum value of random numbers for producing HITs.
	double x,y;    // Coordinates
	int hit;       // storage variable of number of HITs
	srand(time(0));
	for (int j=0;j<jmax;j++){
		hit=0;
		x=0; y=0;
		for(int i=0;i<imax;i++){
			x=double(rand())/double(RAND_MAX);
			y=double(rand())/double(RAND_MAX);
		if(y<=sqrt(1-pow(x,2))) hit+=1; }          //Choosing HITs according to analytic formula of circle
	cout<<""<<4*double(hit)/double(imax)<<endl; }  // Print out Pi number
}

2-) To understand the code: We have just 2 loops here. The inner loop produce random number (<1) and uses these numbers for coordinates x,y. “If” condition increases hit number if this (x,y) point locates in the area of quarter circle (Look at the figure below.)

Hit Production Area

The outer loop resets our variables and print out Pi number according to formula: Area of Quarter Circle/ Area of Square = (1/4)πr2/r2 = (1/4)π= accepted hits / total hits = hits / imax.

3-) Run it as “./pi.x > pi.dat”

4-) Draw output file.

Pi Graph

I used below “root macro” to read and convert it to a .root file.

{
	gROOT->Reset();
	ifstream in;
	in.open("pi.dat");
	Float_t x; Int_t nlines = 0;
	TFile *f = new TFile("pi1.root","RECREATE");
	TH1F *h1 = new TH1F("h1","pi_grafik",100,2.5,4.0);
	TNtuple *ntuple = new TNtuple("ntuple","pi","x");
	for (nlines=0; nlines<10000; nlines++) {
		in >> x;
		if (!in.good()) {break;}
		if (nlines < 5) {printf("x=%5f\n",x);}
		h1->Fill(x);
		ntuple->Fill(x);
		nlines++;
	}
	in.close();
	f->Write();
	printf("%d deger bulundu\n",nlines);
	h1->SetXTitle("pi");
	h1->SetYTitle("Olay");
	h1->Draw();
}
  • Paste above root macro in a C file and name it as “pintuple.c”
  • Open your root analysis program in the same directory you saved pintuple.c : “root”
  • Execute the file: “root> .x pintuple.c”
  • You’ll get an ntuple file called “pi1.root”
  • Write “TBrowser g” in root.
  • Open pi1.root file and you’ll get the above histogram. Congratulations 🙂