# CVS for Magic Software Development

### Introduction

More than one software developer are involved in the progress of Software for the MAGIC telescope. Because the developers are distributed all over Europe, a version control system is needed. There exists more than one possibility of such version control systems, but for the beginning we take CVS ( Concurrent Versions System ).

CVS is a version control system, which allows you to keep old versions of files (usually source code), keep a log of who, when, and why changes occurred, etc., like RCS or SCCS. Unlike the simpler systems, CVS does not just operate on one file at a time or one directory at a time, but operates on hierarchical collections of directories consisting of version controlled files. CVS helps to manage releases and to control the concurrent editing of source files among multiple authors. CVS allows triggers to enable/log/control various operations and works well over a wide area network.

CVS keeps a single copy of the master sources. This copy is called the source ``repository''; it contains all the information to permit extracting previous software releases at any time based on either a symbolic revision tag, or a date in the past.

For CVS updates, more information on documentation, software related to CVS, development of CVS, and more, see:
http://www.cyclic.com
http://www.loria.fr/~molli/cvs-index.html

Repository

The single copy of the master source for all MAGIC software is held in the repository on a single (security reasons) linux computer in Max-Planck-Institut für Physik in Munich. To access the repository you need an account on that computer. As a remote developer you must declare the environment variable CVSROOT on your home computer in the following way.

setenv CVSROOT :pserver:username@pchegra4.mppmu.mpg.de:/CvsRepository for tcsh (use the syntax of your shell)

If you want access please inform Harald Kornmayer in Munich. For more details about the structure of the repository see here.

For those developers, that work in other repositories in other experiments. You can access to the repository of MAGIC by typing:

cvs -d :pserver:username@pchegra4.mppmu.mpg.de:/CvsRepository {command} {project}

Here is a small example of a cvs session (Assuming the CVSROOT is set!)
cvs login
cvs checkout CvsDoku
cvs release -d MagicSoft
cvs logout

Just for Beginners

All developers should use CVS commands for further development. I set up different projects of software development. Please take only the source file from the repository which are necessary for the project you want to work on. Please don't work on to much projects in parallel. If you are planning to do bigger changes create your own development branch. But don't wait to long with committing.

If you want to play a little around with CVS for magic, there is a project only for testing. The project is calles CvsDummy. Inside this projects there are some file. You can try tho change them, add new file and test also the commit command.

Projects

The software is separated in different software projects. This projects are:

> Mmcs (Magic Monte Carlo Simulation )
> This is the adapted CORSIKA code for calculating air showers.

> Checkmc
> This progam is to check the output of Mmcs. It is using hbook stuff.

> Reflector
> With this program you can track the cerenkov photons generated by Mmcs to the camera plane. So all the geometry of the telescope is inside this program.

> TimeCam
> This is a simulation of the camera bahaviour taking the infomation of the arrival times of cerenkov photons and photo electrons into account.
> This results of this project were presented at the general MAGIC meeting in Barcelona (February 2000). There will be very soon a conection
> to the FADC simulation. It may be not very good to have to different project in the future. So may be, we continuing with this one.

> (Camera)
> To change the information of the cerenkov photons to FADC counts you have to use the camera program. This program contains a lot of different other sources that are also used by the reflector or the Evita project.

> StarFieldAdder
> This is a project to simulate the effects of star light for MAGIC. First steps of this program were done by Mirella Dosil. It was put in the
> repository by Dirk Petry. Have a look at the README file!

> Evita (EVent Imaging Tool for Analysis)
> To display one event use this nice Gui package.

> .......

> CvsDummy
> This is the project for CVS beginners to play with a project. How to use comand with out the danger of destroying some stuff.

It is obvious that some source code of a given directory is part of different projects. I.e. the directory include-MC is a part of the reflector and the camera project.

Commands

1. Continue with development of existing projects
   command: cvs checkout project
   Then you will get all the directories that are necessary for compiling the given project. So go first in the directory with the Makefile and try to compile it. Then you can start with working on the source files. At the end of your work you will have modified source files.
2. Check the status of the files in your directory
   command: cvs status
   Then you will get a long list with information of all files in this directory and all sub directory.
   If you want to see only the names of the modified files use the
   command:cvs status | grep odi
3. See differences of your files and the repository
   command: cvs diff [filename]
   This will show you the changed you did.
4. Commit your changes to the repository
   command: cvs commit [filename]
   The changes you made will then be in the repository and are available for all other developers.
5. Remove all your files
   command: cvs release -d [filename]
   Do this in the most upper directory (There you can see i.e. MagicSoft.). If CVS find some altered files it will not deleted all immediately. But if you have no altered files say yes and delete all the files and directory you worked on. So you are always sure that there is no old or changed version of a project.

Structure of the Repository

All the Software is inside the directory. The structure of the sub directories is following one:

MagicSoft | CvsDoku |  |  |
| Simulation | Corsika | Mmcs |
|  |  | Checkmc |
|  | Detector | Reflector |
|  |  | TimeCam |
|  |  | StarField |
|  |  | Camera |
|  |  | include-GENERAL |
|  |  | include-CORSIKA |
|  |  | include-MC |
|  |  | include-MTrigger |
|  |  | Data |
|  |  | lib |
| include-Classes |  |  |
| Analysis |  |  |
| CvsDummy |  |  |

### Detail of sub directories in the repository

MagicSoft

In this directory of the cvs-repository you find all software that is developed for MAGIC using CVS.
This directory contain four sub directories, CvsDoku, Simulation, Analysis and include-Classes.

> CvsDoku

> In this directory of the cvs-repository you find some html pages like the one you are looking at the moment. This documentation is written as a guideline for MAGIC developers using the CVS tool. Also the documentation for CVS usage is using CVS!!

> Simulation
> For MAGIC a lot of programs were developed to simulate the behavior of Air Showers, the Mirrors and the Camera. All this things you need for simulation is inside this directory.

> > Corsika
> > All things needed for the simulation of Air Showers. All this simulation are based on the CORSIKA program of the KASCADE group in Karlsruhe.

> > > Mmcs
> > > (Magic Monte Carlo Simulation)
> > > Here you find all stuff for the generation of air showers using the CORSIKA program.

> > > Checkmc
> > > After the production of air shower it is good to get an impression about the reliabability of the produced data. This can be done by this project.

> > Detector
> > Every thing that is needed to transfer the simulated events to the common raw data format. There are a lot of different tools inside this directory, mainly based on the work of Jose Carlos Gonzales.

> > > Reflector
> > > Here you find the source code of the reflector program. This is written to read the CORSIKA (Mmcs) output. With this data you can simulate the behavior of the MAGIC mirrors. But to compile and run the program some other sub directories are needed.

> > > TimeCam
> > > To simulate the full behaviour of MAGIC you have to take into account the timing information of the cerenkov photons (or the photo electrons). All this stuff can be found in this directory. At the end we get for each triggered event the FADC values in a file.

> > > StarField
> > > Here you can find all the code for the StarField adder. Don't forget to read the README file!

> > > Camera

> > > In this directory are all the files of the camera program. The camera program is calculating the response of each photo multiplier of the camera. At the end we get the number of ADC count for each time slice of each pixel. In the previous there were also some smaller calculations of the camera pixels in it.

> > > include-CORSIKA
> > > Here you can find a implementation to read the CORSIKA output. This classes are needed by the reflector program.

> > > include-MC
> > > Here you can find a implementation to write and read the output of the reflector program. This classes are needed by the reflector and the camera program.

> > > include-GENERAL
> > > Here you can find some header file that are needed by reflector and camera. For example the declaration of the runlib is found here.

> > > include-MTrigger
> > > Studies of the trigger behavior are very fundamental things. The simulation of the trigger is a part of the camera program. All the methods are put in the Classes (called MTRigger ) in this directory. Also a gui class (MGTrigger) is inside this directory.

> > > Data
> > > All the different data files for the simulation tools reflector and camera are in this directory. For example the geometry of the MAGIC telescope is stored in magic.def or the data of the focal points is stored in focal.dat.

> > > lib
> > > Here you find the ranlib that is used by reflector and camera.

> include-Classes

> In this directory you can find all Classes (C++ and hopefully OOP ) that are used for simulation and for analysis. An example is the RawDataFormat used in the Analysis and the Camera programs. The Classes are MRawPixel, MRawEvt, MRawMc .....

> Analysis

> In this directory you can find all Programs to analyze data of MAGIC. Here you will find tools to look on single Events, to calculate the Hillas parameters and to find the periodicity of one special source. (But all this is still under construction!!!! Here the must development is needed in the future!!!)

H.Kornmayer