/*!
-\page README_geometry README geometry
+\page README_geometry Geometry
\section geometry_s1 General Information about MUON Geometry
Our geometry is described in the geometry builder classes.
-Main geometrical constants are set in the class AliMUONConstants.
-The code can then generate the geometry data files
-transform.dat and svmap.dat (see description below) via the macro
-MUONGenerateGeometryData.C (more info below).
-
-The geometry data files have to be recreated each time the code
-of the geometry is modified. The info (well updated) in this files
-(svmap) is need during the simulation.
+The main geometrical constants are set in the class AliMUONConstants.
+The geometry is built from the code during running simulation
+and it is automatically exported in a geometry.root file
+via the framework. Then aliroot takes this geometry.root file as
+a unique geometrical info of our apparatus during the generation
+and the reconstruction and analysis (if needed)
+
+The macros MakeMUONZeroMisAlignment.C, MakeMUONResMisAlignment.C
+and MakeMUONFullMisAlignment.C generate the mis-alignment
+data (see more in the chapter \ref geometry_s4 below).
+
+The code can also generate the special geometry
+data files, transform.dat and svmap.dat, via the macro
+MUONGenerateGeometryData.C (see more in the chapter \ref geometry_s5 below).
+The svmap.dat data file have to be recreated each time the code
+of the geometry is modified. The info (well updated) in this file
+is needed during the simulation.
We can also decide to use the transform.dat file as input of our
geometry. This allows for changing the position of our detection elements
and/or half-planes (half-chambers in code jargon) without modifying
and recompiling the code.
-First step in the official aliroot simulation process is to create
-the geometry.root file from the builders to build the MUON geometry
-within the geometrical modeler framework of root.
-Then aliroot takes the geometry.root file as a unique geometrical
-info of our apparatus during the generation and the reconstruction
-and analysis (if needed)
-
Misalignments are in the official AliRoot code applied to the geometry.root
file.
-\section geometry_s2 How to check the Geometry with the new Geometrical modeler
+\section geometry_s2 How to check the geometry with the Root geometrical modeler
\see ftp://root.cern.ch/root/doc/chapter16.pdf
\see http://agenda.cern.ch/fullAgenda.php?ida=a05212
<pre>
-gAlice->Init("$ALICE_ROOT/MUON/Config.C");
+TGeoManager::Import("geometry.root");
gGeoManager->GetMasterVolume()->Draw();
</pre>
+A helper macro for adding and removing volumes in the
+scene, MUONGeometryViewingHelper.C is also available.
+
-\section geometry_s3 How to check the overlap with the new Geometrical modeler
+\section geometry_s3 How to check the overlaps with the Root geometrical modeler
\see ftp://root.cern.ch/root/doc/chapter16.pdf
\see http://agenda.cern.ch/fullAgenda.php?ida=a05212
<pre>
-gAlice->Init("$ALICE_ROOT/MUON/Config.C");
-gGeoManager->CheckOverlaps();
+TGeoManager::Import("geometry.root");
+gGeoManager->CheckOverlaps(0.001);
gGeoManager->PrintOverlaps();
</pre>
+More extensive, but also more time consuming checking,
+can be performed in this way:
+<pre>
+gGeoManager->CheckGeometryFull(1000000,0,0,0,"o"); >& check_full.out
+</pre>
+Then, you will find in the output file \em check_full.out the list of
+volumes where any overlaps have been detected. As TGeoManager
+does not remember all overlaps found during checking,
+in order to investigate them, one has to re-run the checking for
+each listed volume:
+<pre>
+gGeoManager->FindVolumeFast("MyVolume")->CheckOverlaps(0.001, "s");
+gGeoManager->PrintOverlaps(); >& overlaps_MyVolume.txt
+</pre>
+At this stage the overlaps found for the selected volume can be also browsed
+with TBrowser. Sometimes it happens that the reported overlapping
+volumes are assemblies and nothing is visualized on the scene
+when clicking on the overlap icon in the browser.
+In this case you can use the function setDaughtersVisibility()
+from the MUONGeometryViewingHelper.C macro, which propagates the
+visibility setting through all assembly levels up to the real
+volumes.
\section geometry_s4 Macro MUONGenerateGeometryData.C
-Macro for generating the geometry data files
-
-Geometry data files:
-- MUON/data/transform.dat file contains the transformations
-data (translation and rotation) for all alignable objects
-(modules & detection elements)
+Macro for generating the geometry data files:
- MUON/data/svmap.dat file contains all the information to link
each geant volume (it can be extended to other virtual MC) with
a detection element. The point here is that a given detection
Each time there is a change in the definition of MC geometry, these
input files must be re-generated via the macro
MUONGenerateGeometryData.C
+- MUON/data/transform.dat file contains the transformations
+data (translation and rotation) for all alignable objects
+(modules & detection elements)
To be run from aliroot:
<pre>
To be run from aliroot:
<pre>
-.x MakeMUONFullMisAlignment.C etc.
+.x MakeMUONFullMisAlignment.C
</pre>
+etc.
+
If the environment variable TOCDB is not set to "kTRUE",
the misalignment data are generated in a local file:
-(MUONFullMisalignment.root, etc.)
+MUONfullMisalignment.root, etc.
If the data are stored in CDB, the storage can be specified in
the environment variable STORAGE. The misalignment data are then
Full misalignment: Default is our current estimate of initial
misalignment.
+The mis-alignment data can be then retrieved from a file
+and applied to ideal geometry in this way.
+
+<pre>
+TGeoManager::Import("geometry.root");
+TFile f("MUONfullMisalignment.root");
+TClonesArray* misAlignObjsArray = (TClonesArray*)f.Get("MUONAlignObjs");
+AliGeomManager::ApplyAlignObjsToGeom(*misAlignObjsArray);
+</pre>
+
+Mis-aligned geometry can be then inspected in the same
+way as described in the chapters \ref geometry_s2 and \ref geometry_s3.
\section geometry_s6 How to check the alignment software
The macro MUONCheckMisAligner.C performs the misalignment on an existing muon
arm geometry based on the standard definition of the detector elements.
+To be run from aliroot:
+<pre>
+AliMpCDB::LoadMpSegmentation2();
+.x MUONCheckMisAligner.C
+</pre>
+
It uses AliMUONGeometryAligner :
-- creates a new AliMUONGeometryTransformer and AliMUONGeometryAligner
-- reads the transformations in from the transform.dat file (make sure that
-this file is the _standard_ one by comparing it to the one in CVS)
-- creates a second AliMUONGeometryTransformer by misaligning the existing
+- Creates a new AliMUONGeometryTransformer and AliMUONGeometryAligner
+- Loads the geometry from the specified geometry file (default is geometry.root)
+- Creates a second AliMUONGeometryTransformer by misaligning the existing
one using AliMUONAligner::MisAlign
User has to specify the magnitude of the alignments, in the Cartesian
as well.
-\section geometry_s8 Geometry data files description
+\section geometry_s8 Geometry data files format
\subsection geometry_s8_sub1 transform.dat
</pre>
+This chapter is defined in the READMEgeometry.txt file.
+
*/