+#ifndef ALIFMD_H
+#define ALIFMD_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
+ * reserved.
+ *
+ * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
+ *
+ * See cxx source for full Copyright notice
+ */
+/** @file AliFMD.h
+ @author Christian Holm Christensen <cholm@nbi.dk>
+ @date Sun Mar 26 17:59:37 2006
+ @brief Declaration of AliFMD detector driver
+*/
+/** @mainpage ALICE FMD Off-line code
+
+ @b Contents
+ - @ref intro
+ - @ref structure
+ - @ref base (see also @ref FMD_base)
+ - @ref sim (see also @ref FMD_sim)
+ - @ref rec (see also @ref FMD_rec)
+ - @ref flow (see also @ref FMD_flow)
+ - @ref ana (see also @ref FMD_ana)
+ - @ref util (see also @ref FMD_util)
+ - @ref script (see also @ref FMD_script)
+ - @ref quick
+ - @ref authors
+
+ @section intro Introduction:
+
+ This file contains a short overview of the FMD code. It is by no
+ means authoritative - only the code is good for that. However,
+ I'll try to explain things a bit here.
+
+ @section structure Structure:
+
+ There are 4 libraries build for the FMD. These are
+
+ - libFMDbase: This contains the basic stuff, like data classes and
+ managers.
+ - libFMDsim: This contains code used by the simulation only. That
+ includes the detector class AliFMD and it's derivatives. It
+ also contains the code for building the geometry, as well as the
+ digitisers and raw data writer.
+ - libFMDrec: Code needed for the reconstruction. This include the
+ reconstruction code itself, as well as a raw data reader.
+ - libFMDutil: This is a special library that contains various
+ utility classes for the FMD expert/developer/tester. It
+ includes code to read all data produced by the FMD, a simple
+ event display, and code to make fake calibration and alignment
+ data. This library is @e not loaded by aliroot
+ automatically. The user has to load it herself:
+ @code
+ gSystem->Load("libFMDutil.so");
+ @endcode
+ The content of these libraries is detailed more below.
+
+ @subsection base libFMDbase:
+
+ This currently (18th or March 2006) contains the classes
+
+ - AliFMDBaseDigit, AliFMDDigit, AliFMDSDigit: Base class for
+ digits, real digits, and summable digits. The are all data
+ classes that holds the ADC value(s) for a single strip.
+ - AliFMDBoolMap: A map of booleans, one for each strip.
+ - AliFMDUShortMap: A map of unsigned short integers, one for each
+ strip.
+ - AliFMDDetector, AliFMD1, AliFMD2, AliFMD3: 3 classes that holds
+ the parameters for each of the 3 FMD sub-detectors. These
+ derive from AliFMDDetector, and are managed by AliFMDGeometry.
+ Each of these also contains the translation from sensor
+ reference frame to global reference frame.
+ - AliFMDRing: Parameters for the FMD rings (inner and outer type).
+ These are managed by AliFMDGeometry.
+ - AliFMDGeometry: Manager of FMD geometry data. All code queries
+ this manager for geometry parameters, so that the data is always
+ consistent.
+ - AliFMDParameters: Manager of FMD parameters, like calibration
+ parameters. This class fetches data from CDB if necessary.
+ All code queries this manager for parameters, so that the data
+ is always consistent.
+ - AliFMDCalibPedestal, AliFMDCalibGain, AliFMDCalibSampleRate,
+ AliFMDAltroMapping: Containers of calibration parameters. These
+ correspond to the pedestal and its width, the gain of each
+ strip, the oversampling rate used in read-out, and the map from
+ hardware address to detector.
+ - AliFMDAltroIO, AliFMDAltroReader, AliFMDAltroWriter: Low-level
+ classes to do input/output on ALTRO formated buffers.
+
+
+
+ @subsection sim libFMDsim:
+
+ This currently (18th or March 2006) contains the classes
+
+ - AliFMDEdepMap: Cache of energy deposited and total number of
+ hits for each strip. The digitiser AliFMDDigitizer uses this to
+ store simulation data before making digits.
+ - AliFMDHit: A hit in the FMD active elements, as described by the
+ simulation back-end during transport.
+ - AliFMD, AliFMDv0, AliFMDv1: Simulation drivers for the FMD.
+ AliFMD is the base class. AliFMDv0 corresponds to a simulation
+ where no hits are created, but the material distribution is
+ right. AliFMDv1 is like AliFMDv0, except that hits are
+ produced.
+ - AliFMDGeometryBuilder: Build the FMD geometry in terms of TGeo
+ objects. The information for building the geometry is retrieved
+ from AliFMDGeometry.
+ - AliFMDBaseDigitizer, AliFMDDigitizer, AliFMDSDigitizer: Base
+ class for the digitisers. AliFMDDigitizer makes `real' digits
+ (AliFMDDigit) from hits, and AliFMDSDigitizer makes summable
+ digits from hits.
+ - AliFMDRawWriter: Writes a pseudo raw data file from the digits
+ created by the digitisers. It uses the AliFMDAltroMapping from
+ AliFMDParameters to make the mapping from detector coordinates
+ to hardware addresses.
+
+ @subsection rec libFMDrec:
+
+ This currently (18th or March 2006) contains the classes
+
+ - AliFMDReconstructor: Reconstruct (in a naiive way) the charged
+ particle multiplicity in the FMD strips. This also writes an
+ AliESDFMD object to the ESD files (that class is in libESD).
+
+ - AliFMDRecPoint: Reconstructed point in the FMD. These objects
+ are made AliFMDReconstructor.
+
+ - AliFMDRawReader: Classes to read raw data files.
+
+ @subsection flow libFMDflow:
+
+ This library contains flow analysis code that works similar to
+ histograms.
+
+ @subsection ana libFMDanalysis:
+
+ This library contains analysis code.
+
+
+ @subsection util libFMDutil:
+
+ This currently (18th or March 2006) contains the classes
+
+ - AliFMDInput, AliFMDInputHits, AliFMDInputDigits,
+ AliFMDInputSDigits, AliFMDInputRecPoints: Base class, and
+ concrete classes to read in FMD generated data. These provide a
+ simple and unified way of getting the data. Hooks are defined
+ to process hits, tracks, digits, and reconstructed points, as
+ well as geometry and ESD data. See for example the scripts
+ @c DrawHits.C, @c DrawHitsDigits.C, @c DrawHitsRecs.C, @c
+ DrawDigitsRecs.C in the @c FMD/scripts sub-directory.
+
+ - AliFMDDisplay: Simple event display for FMD data, including
+ hits, digits, reconstructed points and ESD data.
+
+ - AliFMDCalibFaker, AliFMDAlignFaker: Classes to write fake (or
+ dummy) calibration and alignment data.
+
+
+ @section script Scripts
+
+ Most scripts live in @c FMD/scripts. The notiable exceptions are
+ @ref Simulate.C, @ref Reconstruct.C, and @ref Config.C
+
+ @section quick Quick start
+
+ First, install ROOT. Then Install TGeant3:
+ @verbatim
+ > cd ~/
+ > mkdir alice
+ > cd alice
+ > cvs -d :pserver:cvs@root.cern.ch:/user/cvs login
+ Password: cvs
+ > cvs -d :pserver:cvs@root.cern.ch:/user/cvs co geant3
+ > cd geant3
+ > make
+ @endverbatim
+
+ Now you can install AliRoot
+ @verbatim
+ > cd ../
+ > cvs -d :pserver:cvs@alisoft.cern.ch:/soft/cvsroot login
+ Password: <empty>
+ > cvs -d :pserver:cvs@alisoft.cern.ch:/soft/cvsroot co AliRoot
+ > cd AliRoot
+ > export ALICE_TARGET=`root-config --arch`
+ > export ALICE=${HOME}/alice
+ > export ALICE_ROOT=${ALICE}/AliRoot
+ > export ALICE_LEVEL=new
+ > export LD_LIBRARY_PATH=${ALICE_ROOT}/lib/tgt_${ALICE_TERGET}:${LD_LIBRARY_PATH}
+ > export PATH=${ALICE_ROOT}/bin/tgt_${ALICE_TERGET}:${PATH}
+ > export G3SYS=${ALICE}/geant3
+ > make
+ @endverbatim
+
+ To simulate one event, do something like
+
+ @verbatim
+ > aliroot ${ALICE_ROOT}/FMD/Simulate.C
+ @endverbatim
+
+ To reconstruct the generated event, do
+ @verbatim
+ > aliroot ${ALICE_ROOT}/FMD/Reconstruct.C
+ @endverbatim
+
+ Now, open the file `AliESDs.root' in AliRoot, and browse through that.
+
+ @section authors Authors:
+
+ - Alla Maevskaya <Alla.Maevskaia@cern.ch>
+ - Christian Holm Christensen <cholm@nbi.dk>
+*/
+/** @defgroup FMD_sim Simulation */
+
+//____________________________________________________________________
+//
+// Manager class for the FMD - Base class.
+// AliFMDv1, AliFMDv0, and AliFMDAlla
+// provides concrete implementations.
+// This class is sooooo crowded
+//
+#ifndef ALIDETECTOR_H
+# include <AliDetector.h>
+#endif
+#ifndef ROOT_TArrayI
+# include <TArrayI.h>
+#endif
+class TBranch;
+class TClonesArray;
+class TBrowser;
+class TMarker3DBox;
+class TArrayI;
+class AliDigitizer;
+class AliFMDHit;
+
+//____________________________________________________________________
+/** @class AliFMD AliFMD.h <FMD/AliFMD.h>
+ @brief Forward Multiplicity Detector based on Silicon wafers.
+ This class is the driver for especially simulation.
+
+ The Forward Multiplicity Detector consists of 3 sub-detectors FMD1,
+ FMD2, and FMD3, each of which has 1 or 2 rings of silicon sensors.
+
+ This is the base class for all FMD manager classes.
+
+ The actual code is done by various separate classes. Below is
+ diagram showing the relationship between the various FMD classes
+ that handles the simulation
+
+ @verbatim
+ +----------+ +----------+
+ | AliFMDv1 | | AliFMDv0 |
+ +----------+ +----------+
+ | | +-----------------+
+ +----+--------------+ +--| AliFMDDigitizer |
+ | | +-----------------+
+ | +---------------------+ |
+ | +--| AliFMDBaseDigitizer |<--+
+ V 1 | +---------------------+ |
+ +--------+<>--+ | +------------------+
+ | AliFMD | +--| AliFMDSDigitizer |
+ +--------+<>--+ +------------------+
+ 1 | +---------------------+
+ +--| AliFMDReconstructor |
+ +---------------------+
+ @endverbatim
+
+ - AliFMD
+ This defines the interface for the various parts of AliROOT that
+ uses the FMD, like AliFMDSimulator, AliFMDDigitizer,
+ AliFMDReconstructor, and so on.
+ - AliFMDv0
+ This is a concrete implementation of the AliFMD interface.
+ It is the responsibility of this class to create the FMD
+ geometry.
+ - AliFMDv1
+ This is a concrete implementation of the AliFMD interface.
+ It is the responsibility of this class to create the FMD
+ geometry, process hits in the FMD, and serve hits and digits to
+ the various clients.
+ - AliFMDSimulator
+ This is the base class for the FMD simulation tasks. The
+ simulator tasks are responsible to implment the geoemtry, and
+ process hits.
+ - AliFMDReconstructor
+ This is a concrete implementation of the AliReconstructor that
+ reconstructs pseudo-inclusive-multiplicities from digits (raw or
+ from simulation)
+
+ Calibration and geometry parameters are managed by separate
+ singleton managers. These are AliFMDGeometry and
+ AliFMDParameters. Please refer to these classes for more
+ information on these.
+ */
+class AliFMD : public AliDetector
+{