]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONGenerateGeometryData.C
new trigger code set to default
[u/mrichter/AliRoot.git] / MUON / MUONGenerateGeometryData.C
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 //
18 // Macro for generating the geometry data files:
19 // (volpath.dat, transform.dat, svmap.dat)
20 // and local CDB storage with zero, residual and full misalignment
21 // To be run from aliroot:
22 // .x MUONGenerateGeometryData.C
23 //
24 // The generated files do not replace the existing ones
25 // but have different names (with extension ".out").
26 //
27 //  Author: I. Hrivnacova, IPN Orsay
28
29 void MUONGenerateGeometryData(Bool_t volpaths = true,
30                               Bool_t transforms = true, 
31                               Bool_t svmaps = true,
32                               Bool_t zeroAlign = true,
33                               Bool_t resMisAlign = true,
34                               Bool_t fullMisAlign = true)
35 {
36   // Initialize
37   gAlice->Init("$ALICE_ROOT/MUON/Config.C");
38   cout << "Init done " << endl;
39
40   // Get MUON detector
41   AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
42   if (!muon) {
43     AliFatal("MUON detector not defined.");
44     return 0;
45   }  
46
47   // Get geometry builder
48   AliMUONGeometryBuilder* builder = muon ->GetGeometryBuilder();
49   
50   if (volpaths) {
51     cout << "Generating volpath file ..." << endl;
52     builder->GetTransformer()->WriteVolumePaths("volpath.dat.out");
53   }  
54
55   if (transforms) {
56     cout << "Generating transformation file ..." << endl;
57     builder->GetTransformer()->WriteTransformations("transform.dat.out");
58   }  
59
60   if (svmaps) {
61     cout << "Generating svmaps file ..." << endl;
62     builder->WriteSVMaps();
63   }  
64
65   if (zeroAlign) {
66     cout << "Generating zero misalignment data in  MUON/Align/Data..." << endl;
67    
68     // Create zero alignment data
69     TClonesArray* array 
70       = builder->GetTransformer()->CreateZeroAlignmentData();
71    
72     // CDB manager
73     AliCDBManager* cdbManager = AliCDBManager::Instance();
74     cdbManager->SetDefaultStorage("local://$ALICE_ROOT");
75   
76     AliCDBMetaData* cdbData = new AliCDBMetaData();
77     cdbData->SetResponsible("Dimuon Offline project");
78     cdbData->SetComment("MUON alignment objects for ideal geometry");
79     AliCDBId id("MUON/Align/Data", 0, 0); 
80     cdbManager->Put(array, id, cdbData);
81     
82     delete array;
83   } 
84   
85   if (resMisAlign) {
86     cout << "Generating residual misalignment data in  MUON/ResMisAlignCDB/Data..." << endl;
87    
88     AliMUONGeometryMisAligner misAligner(0.0, 0.004, 0.0, 0.003, 0.0, 0.0023);
89     AliMUONGeometryTransformer* newTransform 
90       = misAligner.MisAlign(builder->GetTransformer(), true);
91     TClonesArray* array = newTransform->GetMisAlignmentData();
92
93     AliCDBManager* cdbManager = AliCDBManager::Instance();
94     cdbManager->SetDefaultStorage("local://ResMisAlignCDB");
95   
96     AliCDBMetaData* cdbData = new AliCDBMetaData();
97     cdbData->SetResponsible("Dimuon Offline project");
98     cdbData->SetComment("MUON alignment objects with residual misalignment");
99     AliCDBId id("MUON/Align/Data", 0, 0); 
100     cdbManager->Put(array, id, cdbData);
101     
102     delete newTransform;
103   }   
104            
105   if (fullMisAlign) {
106     cout << "Generating residual misalignment data in  MUON/FullMisAlignCDB/Data..." << endl;
107    
108     AliMUONGeometryMisAligner misAligner(0.0, 0.03, 0.0, 0.03, 0.0, 0.03);
109     AliMUONGeometryTransformer* newTransform 
110       = misAligner.MisAlign(builder->GetTransformer(), true);
111     TClonesArray* array = newTransform->GetMisAlignmentData();
112
113     AliCDBManager* cdbManager = AliCDBManager::Instance();
114     cdbManager->SetDefaultStorage("local://FullMisAlignCDB");
115   
116     AliCDBMetaData* cdbData = new AliCDBMetaData();
117     cdbData->SetResponsible("Dimuon Offline project");
118     cdbData->SetComment("MUON alignment objects with full misalignment");
119     AliCDBId id("MUON/Align/Data", 0, 0); 
120     cdbManager->Put(array, id, cdbData);
121     
122     delete newTransform;
123   }   
124            
125
126 }