Updated names of the environment variables (no dollar sign). Gaussian distribution...
[u/mrichter/AliRoot.git] / MUON / MakeMUONZeroMisAlignment.C
CommitLineData
d3a9c52a 1void MakeMUONZeroMisAlignment(Bool_t volpaths = false,
2 Bool_t transforms = false,
3 Bool_t svmaps = false)
4// Macro for generating the geometry data files:
5// (volpath.dat, transform.dat, svmap.dat)
6// and local CDB storage with zero, residual and full misalignment
7//
8// The generated files do not replace the existing ones
9// but have different names (with extension ".out").
10//
11// Author: I. Hrivnacova, IPN Orsay
12//
13{
14 // Initialize
15 gAlice->Init("$ALICE_ROOT/MUON/Config.C");
16 cout << "Init done " << endl;
17
18 // Get MUON detector
19 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
20 if (!muon) {
21 AliFatal("MUON detector not defined.");
22 return 0;
23 }
24
25 // Get geometry builder
26 AliMUONGeometryBuilder* builder = muon ->GetGeometryBuilder();
27
28 if (volpaths) {
29 cout << "Generating volpath file ..." << endl;
30 builder->GetTransformer()->WriteVolumePaths("volpath.dat.out");
31 }
32
33 if (transforms) {
34 cout << "Generating transformation file ..." << endl;
35 builder->GetTransformer()->WriteTransformations("transform.dat.out");
36 }
37
38 if (svmaps) {
39 cout << "Generating svmaps file ..." << endl;
40 builder->WriteSVMaps();
41 }
42
5bd470e1 43 cout << "Generating zero misalignment data in MUON/ZeroMisAlignCDB/Data..." << endl;
d3a9c52a 44
45 AliMUONGeometryMisAligner misAligner(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
46 AliMUONGeometryTransformer* newTransform
47 = misAligner.MisAlign(builder->GetTransformer(), true);
48 TClonesArray* array = newTransform->GetMisAlignmentData();
49
5bd470e1 50 if( gSystem->Getenv("TOCDB") != TString("kTRUE") ){
d3a9c52a 51 // Create a File to store the alignment data
5bd470e1 52 TFile f("MUONzeroMisalignment.root","RECREATE");
d3a9c52a 53 if(!f) {cerr<<"cannot open file for output\n";}
54
55 f.cd();
56 f.WriteObject(array,"MUONAlignObjs ","kSingleKey");
57 f.Close();
58 }else{
59 // save in CDB storage
5bd470e1 60 const char* Storage = gSystem->Getenv("STORAGE");
d3a9c52a 61 AliCDBManager* cdbManager = AliCDBManager::Instance();
62 AliCDBStorage* storage = cdbManager->GetStorage(Storage);
63 AliCDBMetaData* cdbData = new AliCDBMetaData();
64 cdbData->SetResponsible("Dimuon Offline project");
5bd470e1 65 cdbData->SetComment("MUON alignment objects with zero misalignment");
66 cdbData->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
d3a9c52a 67 AliCDBId id("MUON/Align/Data", 0, 9999999);
68 storage->Put(array, id, cdbData);
69 }
70
71 delete newTransform;
72}
73