Separating run-dependent mapping data from data, which are not
[u/mrichter/AliRoot.git] / MUON / MUONGenerateGeometryData.C
CommitLineData
5e377ba0 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// $Id$
17//
e54bf126 18/// \ingroup macros
19/// \file MUONGenerateGeometryData.C
20/// \brief Macro for generating the geometry data files:
21/// transform.dat, svmap.dat.
22///
23/// To be run from aliroot:
24///
25/// .x MUONGenerateGeometryData.C
26///
27/// The generated files do not replace the existing ones
28/// but have different names (with extension ".out").
29///
30/// \author: I. Hrivnacova, IPN Orsay
5e377ba0 31
7d6a7daa 32#if !defined(__CINT__) || defined(__MAKECINT__)
33
34#include "AliMUON.h"
35#include "AliMUONGeometryBuilder.h"
36#include "AliMUONGeometryTransformer.h"
37
38#include "AliRun.h"
23a85b2f 39#include "AliCDBManager.h"
7d6a7daa 40
41#include <Riostream.h>
42
43#endif
44
fa70609b 45void MUONGenerateGeometryData(Bool_t transforms = true,
4665bb48 46 Bool_t svmaps = true,
47 Bool_t writeEnvelopes = true)
5e377ba0 48{
e54bf126 49/// \param transforms option to generete transform.dat
50/// \param svmaps option to generete svmap.dat
51/// \param writeEnvelope option to include virtual envelopes
52/// in the volume paths
53
23a85b2f 54 // Default CDB and run number
55 AliCDBManager* man = AliCDBManager::Instance();
56 man->SetDefaultStorage("local://$ALICE_ROOT");
57 man->SetRun(0);
58
5e377ba0 59 // Initialize
d3467161 60 gAlice->Init("$ALICE_ROOT/MUON/Config.C");
5e377ba0 61 cout << "Init done " << endl;
62
63 // Get MUON detector
64 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
65 if (!muon) {
7d6a7daa 66 cerr << "MUON detector not defined." << endl;
67 return;
5e377ba0 68 }
69
70 // Get geometry builder
71 AliMUONGeometryBuilder* builder = muon ->GetGeometryBuilder();
72
73 if (transforms) {
7120ee1e 74 cout << "Generating transformation file ..." << endl;
75 builder->GetTransformer()->WriteTransformations("transform.dat.out");
5e377ba0 76 }
77
78 if (svmaps) {
7120ee1e 79 cout << "Generating svmaps file ..." << endl;
4665bb48 80 builder->WriteSVMaps("svmap.dat.out", true, writeEnvelopes);
5e377ba0 81 }
82}