+//____________________________________________________________________
+//
+// 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
+//
+//
+// +----------+ +----------+
+// | AliFMDv1 | | AliFMDv0 |
+// +----------+ +----------+
+// | | +-----------------+
+// +----+--------------+ +--| AliFMDDigitizer |
+// | | +-----------------+
+// | +---------------------+ |
+// | +--| AliFMDBaseDigitizer |<--+
+// V 1 | +---------------------+ |
+// +--------+<>--+ | +------------------+
+// | AliFMD | +--| AliFMDSDigitizer |
+// +--------+<>--+ +------------------+
+// 1 | +---------------------+
+// +--| AliFMDReconstructor |
+// +---------------------+
+//
+// * 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.
+//
+
+// These files are not in the same directory, so there's no reason to
+// ask the preprocessor to search in the current directory for these
+// files by including them with `#include "..."'
+#include <TBrowser.h> // ROOT_TBrowser
+#include <TClonesArray.h> // ROOT_TClonesArray
+#include <TGeoGlobalMagField.h> // ROOT_TGeoGlobalMagField
+#include <TGeoManager.h> // ROOT_TGeoManager
+#include <TRotMatrix.h> // ROOT_TRotMatrix
+#include <TTree.h> // ROOT_TTree
+#include <TVector2.h> // ROOT_TVector2
+#include <TVirtualMC.h> // ROOT_TVirtualMC
+#include <cmath> // __CMATH__
+
+#include <AliRunDigitizer.h> // ALIRUNDIGITIZER_H
+#include <AliLoader.h> // ALILOADER_H
+#include <AliRun.h> // ALIRUN_H
+#include <AliMC.h> // ALIMC_H
+#include <AliMagF.h> // ALIMAGF_H
+// #include <AliLog.h> // ALILOG_H
+#include "AliFMDDebug.h" // Better debug macros
+#include "AliFMD.h" // ALIFMD_H
+#include "AliFMDDigit.h" // ALIFMDDIGIT_H
+#include "AliFMDSDigit.h" // ALIFMDSDIGIT_H
+#include "AliFMDHit.h" // ALIFMDHIT_H
+#include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
+#include "AliFMDDetector.h" // ALIFMDDETECTOR_H
+#include "AliFMDRing.h" // ALIFMDRING_H
+#include "AliFMDDigitizer.h" // ALIFMDDIGITIZER_H
+#include "AliFMDHitDigitizer.h" // ALIFMDSDIGITIZER_H
+// #define USE_SSDIGITIZER
+//#ifdef USE_SSDIGITIZER
+//# include "AliFMDSSDigitizer.h" // ALIFMDSDIGITIZER_H
+//#endif
+// #include "AliFMDGeometryBuilder.h"
+#include "AliFMDRawWriter.h" // ALIFMDRAWWRITER_H
+#include "AliFMDRawReader.h" // ALIFMDRAWREADER_H
+#include "AliTrackReference.h"
+#include "AliFMDStripIndex.h"
+#include "AliFMDParameters.h"
+#include "AliFMDReconstructor.h"
+
+//____________________________________________________________________
+ClassImp(AliFMD)
+#if 0
+ ; // This is to keep Emacs from indenting the next line
+#endif
+
+//____________________________________________________________________
+AliFMD::AliFMD()
+ : AliDetector(),
+ fSDigits(0),
+ fNsdigits(0),
+ fDetailed(kTRUE),
+ fUseOld(kFALSE),
+ fUseAssembly(kTRUE),
+ fBad(0)