Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / MUON / READMEgeometry.txt
CommitLineData
518eb852 1// $Id$
b453c965 2
518eb852 3/*!
b453c965 4
91509ec6 5\page README_geometry Geometry
518eb852 6
7
8\section geometry_s1 General Information about MUON Geometry
1ecf5e57 9
10Our geometry is described in the geometry builder classes.
91509ec6 11The main geometrical constants are set in the class AliMUONConstants.
12The geometry is built from the code during running simulation
13and it is automatically exported in a geometry.root file
14via the framework. Then aliroot takes this geometry.root file as
15a unique geometrical info of our apparatus during the generation
16and the reconstruction and analysis (if needed)
17
9f9989b1 18The macros MakeMUONZeroMisAlignment.C, MakeMUONResMisAlignment.C
19and MakeMUONFullMisAlignment.C generate the mis-alignment
20data (see more in the chapter \ref geometry_s4 below).
21
91509ec6 22The code can also generate the special geometry
23data files, transform.dat and svmap.dat, via the macro
9f9989b1 24MUONGenerateGeometryData.C (see more in the chapter \ref geometry_s5 below).
91509ec6 25The svmap.dat data file have to be recreated each time the code
26of the geometry is modified. The info (well updated) in this file
27is needed during the simulation.
1ecf5e57 28We can also decide to use the transform.dat file as input of our
29geometry. This allows for changing the position of our detection elements
30and/or half-planes (half-chambers in code jargon) without modifying
31and recompiling the code.
32
1ecf5e57 33Misalignments are in the official AliRoot code applied to the geometry.root
34file.
35
b453c965 36
91509ec6 37\section geometry_s2 How to check the geometry with the Root geometrical modeler
1ecf5e57 38
518eb852 39\see ftp://root.cern.ch/root/doc/chapter16.pdf
40\see http://agenda.cern.ch/fullAgenda.php?ida=a05212
1ecf5e57 41
518eb852 42<pre>
27d27e68 43TGeoManager::Import("geometry.root");
1ecf5e57 44gGeoManager->GetMasterVolume()->Draw();
518eb852 45</pre>
46
fce55b81 47A helper macro for adding and removing volumes in the
48scene, MUONGeometryViewingHelper.C is also available.
49
50
91509ec6 51\section geometry_s3 How to check the overlaps with the Root geometrical modeler
1ecf5e57 52
518eb852 53\see ftp://root.cern.ch/root/doc/chapter16.pdf
54\see http://agenda.cern.ch/fullAgenda.php?ida=a05212
1ecf5e57 55
518eb852 56<pre>
27d27e68 57TGeoManager::Import("geometry.root");
d10c5d17 58gGeoManager->CheckOverlaps(0.001);
1ecf5e57 59gGeoManager->PrintOverlaps();
518eb852 60</pre>
1ecf5e57 61
9f9989b1 62More extensive, but also more time consuming checking,
63can be performed in this way:
64<pre>
fce55b81 65gGeoManager->CheckGeometryFull(1000000,0,0,0,"o"); >& check_full.out
9f9989b1 66</pre>
fce55b81 67Then, you will find in the output file \em check_full.out the list of
68volumes where any overlaps have been detected. As TGeoManager
69does not remember all overlaps found during checking,
70in order to investigate them, one has to re-run the checking for
71each listed volume:
72<pre>
d10c5d17 73gGeoManager->FindVolumeFast("MyVolume")->CheckOverlaps(0.001, "s");
fce55b81 74gGeoManager->PrintOverlaps(); >& overlaps_MyVolume.txt
75</pre>
76At this stage the overlaps found for the selected volume can be also browsed
77with TBrowser. Sometimes it happens that the reported overlapping
78volumes are assemblies and nothing is visualized on the scene
79when clicking on the overlap icon in the browser.
80In this case you can use the function setDaughtersVisibility()
81from the MUONGeometryViewingHelper.C macro, which propagates the
82visibility setting through all assembly levels up to the real
83volumes.
1ecf5e57 84
518eb852 85\section geometry_s4 Macro MUONGenerateGeometryData.C
1ecf5e57 86
91509ec6 87Macro for generating the geometry data files:
1ecf5e57 88- MUON/data/svmap.dat file contains all the information to link
89each geant volume (it can be extended to other virtual MC) with
90a detection element. The point here is that a given detection
91element, i.e. a slat chamber can consist of more geant volumes.
92the correspondence is then defined in an input file.
93Each time there is a change in the definition of MC geometry, these
94input files must be re-generated via the macro
95MUONGenerateGeometryData.C
91509ec6 96- MUON/data/transform.dat file contains the transformations
97data (translation and rotation) for all alignable objects
98(modules & detection elements)
1ecf5e57 99
100To be run from aliroot:
518eb852 101<pre>
1ecf5e57 102.x MUONGenerateGeometryData.C
518eb852 103</pre>
1ecf5e57 104
105The generated files do not replace the existing ones
106but have different names (with extension ".out").
107Replacement with new files has to be done manually.
108
109
518eb852 110\section geometry_s5 Macros to generate Mis-alignment data
1ecf5e57 111
518eb852 112Macros for generating the geometry mis-alignment data:
113- MakeMUONFullMisAlignment.C
114- MakeMUONResMisAlignment.C
115- MakeMUONZeroMisAlignment.C
1ecf5e57 116
117To be run from aliroot:
518eb852 118<pre>
91509ec6 119.x MakeMUONFullMisAlignment.C
518eb852 120</pre>
1ecf5e57 121
91509ec6 122etc.
123
1ecf5e57 124If the environment variable TOCDB is not set to "kTRUE",
125the misalignment data are generated in a local file:
9f9989b1 126MUONfullMisalignment.root, etc.
1ecf5e57 127
128If the data are stored in CDB, the storage can be specified in
129the environment variable STORAGE. The misalignment data are then
130generated in the CDB folder (defaults are ResMisAlignCDB and FullMisAlignCDB
131in the working directory). Inside the local CDB the path for the
132alignment data is (and must be) "MUON/Align/Data/".
133Residual misalignment: Default is our current estimate of
134misalignment after all our alignment procedure has been applied.
135Full misalignment: Default is our current estimate of initial
136misalignment.
137
9f9989b1 138The mis-alignment data can be then retrieved from a file
139and applied to ideal geometry in this way.
140
141<pre>
142TGeoManager::Import("geometry.root");
143TFile f("MUONfullMisalignment.root");
144TClonesArray* misAlignObjsArray = (TClonesArray*)f.Get("MUONAlignObjs");
145AliGeomManager::ApplyAlignObjsToGeom(*misAlignObjsArray);
146</pre>
147
148Mis-aligned geometry can be then inspected in the same
149way as described in the chapters \ref geometry_s2 and \ref geometry_s3.
518eb852 150
151\section geometry_s6 How to check the alignment software
1ecf5e57 152
153The script AlirootRun_MUONtestAlign.sh allows you to check the software for
154the alignment with physics tracks. The script will:
155- Generate a misaligned geometry in a local CDB (default FullMisAlignCDB)
156- Simulate 1000 events using previously misaligned geometry
157- Reconstruct the events using perfect geometry
158- Run the alignment code over the above events using MUONAlignment.C
159
160To run you need to type:
518eb852 161<pre>
1ecf5e57 162$ALICE_ROOT/MUON/AlirootRun_MUONtestAlign.sh
518eb852 163</pre>
1ecf5e57 164
165The results of the test are saved in test_align/ directory. The file measShifts.root
166contains useful graphs for studying the alignment performances. A local CDB
167containing the realigned geometry is also created (default is ReAlignCDB). The
168file $ALICE_ROOT/MUON/data/transform2ReAlign.dat contains the
169transformations describing the realigned geometry to be compared with the
170used misaligned geometry $ALICE_ROOT/MUON/data/transform2.dat.
171
172IMPORTANT NOTE: For a useful test of the alignment performances, the
173order of 100 000 tracks is needed, it is then advisable to generate and
174reconstruct enough events separately and run MUONAlignment.C providing a file list
175afterwards.
518eb852 176
701d0777 177\section geometry_s7 Macro MUONCheckMisAligner.C
178
179The macro MUONCheckMisAligner.C performs the misalignment on an existing muon
180arm geometry based on the standard definition of the detector elements.
181
1ba08db3 182To be run from aliroot:
183<pre>
184AliMpCDB::LoadMpSegmentation2();
185.x MUONCheckMisAligner.C
186</pre>
187
701d0777 188It uses AliMUONGeometryAligner :
91509ec6 189- Creates a new AliMUONGeometryTransformer and AliMUONGeometryAligner
1ba08db3 190- Loads the geometry from the specified geometry file (default is geometry.root)
91509ec6 191- Creates a second AliMUONGeometryTransformer by misaligning the existing
701d0777 192one using AliMUONAligner::MisAlign
193
194User has to specify the magnitude of the alignments, in the Cartesian
195co-ordiantes (which are used to apply translation misalignments) and in the
196spherical co-ordinates (which are used to apply angular displacements)
197
198User can also set misalignment ranges by hand using the methods :
199SetMaxCartMisAlig, SetMaxAngMisAlig, SetXYAngMisAligFactor
200(last method takes account of the fact that the misalingment is greatest in
201the XY plane, since the detection elements are fixed to a support structure
202in this plane. Misalignments in the XZ and YZ plane will be very small
203compared to those in the XY plane, which are small already - of the order
204of microns)
205
206Default behavior generates a "residual" misalignment using gaussian
207distributions. Uniform distributions can still be used, see
208AliMUONGeometryAligner.
209
210User can also generate module misalignments using SetModuleCartMisAlig
211and SetModuleAngMisAlig
212Note : If the detection elements are allowed to be misaligned in all
213directions, this has consequences for the alignment algorithm, which
214needs to know the number of free parameters. Eric only allowed 3 :
215x,y,theta_xy, but in principle z and the other two angles are alignable
216as well.
217
218
91509ec6 219\section geometry_s8 Geometry data files format
518eb852 220
701d0777 221\subsection geometry_s8_sub1 transform.dat
518eb852 222
223 List of transformations for chambers geometry modules and detection
224 elements; in format:
225<pre>
226 KEY ID [nofDE] pos: posX posY posZ rot: theX phiX theY phiY theZ phiZ
227
228 where KEY = CH or DE
229 ID = chamberId or detElemId
230 pos: posX posY posZ = position in cm
231 rot: theX phiX theY phiY theZ phiZ = rotation angles as in Geant3 in deg
232</pre>
233
701d0777 234\subsection geometry_s8_sub2 svmap.dat
518eb852 235
236 Map of sensitive volumes to detction element Ids;
237 in format:
238
239<pre>
240 KEY volpath detElemId
241
242 where KEY = SV
243 volpath = volume path in format /volname1_copyNo1/volname2_copyNo2/...
244 detElemId = detection element Id
245 </pre>
246
247
91509ec6 248This chapter is defined in the READMEgeometry.txt file.
249
518eb852 250*/