]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/MakeITSFullMisAlignment.C
- introduce IsBad() virtual method in AliITSCalibration to check the status
[u/mrichter/AliRoot.git] / ITS / MakeITSFullMisAlignment.C
CommitLineData
259b0bd4 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TError.h>
3#include <TFile.h>
4#include <TGeoManager.h>
5#include <TMath.h>
6#include <TString.h>
7#include <TSystem.h>
8#include "AliCDBPath.h"
9#include "AliCDBEntry.h"
10#include "AliCDBManager.h"
11#include "AliCDBStorage.h"
12#include "AliGeomManager.h"
13#include "AliITSMisalignMaker.h"
14#endif
15void MakeITSFullMisAlignment() {
16//========================================================================
17//
18// Macro for ITS full (realistic) misalignment
19//
20// Main author: L. Gaudichet
21// Contact: andrea.dainese@lnl.infn.it
22//
23//========================================================================
24
25
6fce62af 26 const char* macroname = "MakeITSFullMisAlignment.C";
259b0bd4 27
6fce62af 28 // Activate CDB storage and load geometry from CDB
29 AliCDBManager* cdb = AliCDBManager::Instance();
30 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
31 cdb->SetRun(0);
32
259b0bd4 33 AliCDBStorage* storage = NULL;
34
35 TString compare("kTRUE");
36 if(gSystem->Getenv("TOCDB") == compare.Data()){
6fce62af 37 TString Storage = gSystem->Getenv("STORAGE");
38 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
39 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
40 return;
41 }
42 storage = cdb->GetStorage(Storage.Data());
43 if(!storage){
44 Error(macroname,"Unable to open storage %s\n",Storage.Data());
45 return;
46 }
47 AliCDBPath path("GRP","Geometry","Data");
48 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
49 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
50 entry->SetOwner(0);
51 TGeoManager* geom = (TGeoManager*) entry->GetObject();
52 AliGeomManager::SetGeometry(geom);
53 }else{
259b0bd4 54 AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
6fce62af 55 }
1895a097 56
259b0bd4 57 // SETTINGS:
58 // - tranformations are defined by the "maximum transformation"
59 // dx,dy,dz,dpsi,dtheta,dphi: then we take a Gaussian with sigma=dx/3
60 // and we cut it at +- 3*sigma = dx
61 // (the option "unif" allows to sample from a uniform distr.)
62 // - units are cm and deg
63 // - transformations are defined in the local frame of the volume
64 // being misaligned
65 //
66 const Float_t kRadToDeg = 180./TMath::Pi();
67
1895a097 68
259b0bd4 69 //=****************************************
70 // overall ITS misalignment : source -
71 //=****************************************
72 Float_t its_dx = 0.0000; // ?
73 Float_t its_dy = 0.0000; // ?
74 Float_t its_dz = 0.0000; // ?
75 Float_t its_dpsi = 0.0000; // ?
76 Float_t its_dtheta = 0.0000; // ?
77 Float_t its_dphi = 0.0000; // ?
78
79 //=****************************************
80 // misalignment at the level of SPD sectors : source - A.Pepato
81 //=****************************************
82 Float_t spdsector_dx = 0.0050; // 50 micron (~tangetial, i.e. rphi)
83 Float_t spdsector_dy = 0.0100; // 100 micron (~radial)
84 Float_t spdsector_dz = 0.0100; // 100 micron
85 Float_t spdsector_dpsi = 0.0100/30.*kRadToDeg;; // so as to have 100 micron difference at the two extremes
86 Float_t spdsector_dtheta = 0.0100/30.*kRadToDeg;; // so as to have 100 micron difference at the two extremes
87 Float_t spdsector_dphi = 0.0050/1.5*kRadToDeg;; // so as to have 50 micron difference at the two extremes
88 Bool_t unifspdsector=kTRUE;
89
90 //=****************************************
91 // misalignment at the level of SPD half-barrels : source - A.Pepato
92 //=****************************************
93 Float_t spdhalfbarrel_dx = 0.0200; // 200 micron
94 Float_t spdhalfbarrel_dy = 0.0200; // 200 micron
95 Float_t spdhalfbarrel_dz = 0.0200; // 200 micron
96 Float_t spdhalfbarrel_dpsi = 0.0100/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
97 Float_t spdhalfbarrel_dtheta = 0.0100/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
98 Float_t spdhalfbarrel_dphi = 0.0100/7.*kRadToDeg; // so as to have 100 micron difference at the two extremes
99
100 //=****************************************
101 // misalignment at the level of SPD barrel : source - A.Pepato
102 //=****************************************
103 Float_t spdbarrel_dx = 0.1000; // 1 mm (very pessimistic)
104 Float_t spdbarrel_dy = 0.1000; // 1 mm (very pessimistic)
105 Float_t spdbarrel_dz = 0.1000; // 1 mm (very pessimistic)
106 Float_t spdbarrel_dpsi = 0.0500/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
107 Float_t spdbarrel_dtheta = 0.0500/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
108 Float_t spdbarrel_dphi = 0.0500/7.*kRadToDeg; // so as to have 500 micron difference at the two extremes
109
110
111 //=****************************************
112 // misalignment at the level of SDD and SSD layers: source
113 //=****************************************
114 /*
115 Float_t sddlayer_dx = 0.0000; // ?
116 Float_t sddlayer_dy = 0.0000; // ?
117 Float_t sddlayer_dz = 0.0000; // ?
118 Float_t sddlayer_dpsi = 0.0000; // ?
119 Float_t sddlayer_dtheta = 0.0000; // ?
120 Float_t sddlayer_dphi = 0.0000; // ?
121
122 Float_t ssdlayer_dx = 0.0000; // ?
123 Float_t ssdlayer_dy = 0.0000; // ?
124 Float_t ssdlayer_dz = 0.0000; // ?
125 Float_t ssdlayer_dpsi = 0.0000; // ?
126 Float_t ssdlayer_dtheta = 0.0000; // ?
127 Float_t ssdlayer_dphi = 0.0000; // ?
128 */
129
130 //=****************************************
131 // misalignment at the level of half-staves (SPD) : source - S.Moretto
132 // ladders (SDD,SSD) : source -
133 //=****************************************
3b96c7be 134 Float_t spdhalfstave_dx = 0.0100; // 100 micron // normal to plane
135 Float_t spdhalfstave_dy = 0.0020; // 20 micron
259b0bd4 136 Float_t spdhalfstave_dz = 0.0020; // 20 micron
3b96c7be 137 Float_t spdhalfstave_dpsi = 0.0020/7.*kRadToDeg; // so as to have 20 micron difference at the two extremes
138 Float_t spdhalfstave_dtheta = 0.0050/7.*kRadToDeg; // so as to have 50 micron difference at the two extremes
259b0bd4 139 Float_t spdhalfstave_dphi = 0.0050/0.7*kRadToDeg; // so as to have 50 micron difference at the two extremes
140 Bool_t unifspdhalfstave=kTRUE;
141
142 Float_t sddladder_dx = 0.0005; // 5 micron
143 Float_t sddladder_dy = 0.0005; // 5 micron
144 Float_t sddladder_dz = 0.0005; // 5 micron
145 Float_t sddladder_dpsi = 0.00; // ?
146 Float_t sddladder_dtheta = 0.00; // ?
147 Float_t sddladder_dphi = 0.00; // ?
148
149 Float_t ssdladder_dx = 0.0005; // 5 micron
150 Float_t ssdladder_dy = 0.0005; // 5 micron
151 Float_t ssdladder_dz = 0.0005; // 5 micron
152 Float_t ssdladder_dpsi = 0.00; // ?
153 Float_t ssdladder_dtheta = 0.00; // ?
154 Float_t ssdladder_dphi = 0.00; // ?
155
156
157 //=****************************************
158 // misalignment at the level of ladders (SPD) : source - R.Santoro
159 // modules (SDD) : source - L.Gaudichet
160 // modules (SSD) : source -
161 //=****************************************
162 Float_t spdladder_dx = 0.0010; // 10 micron
163 Float_t spdladder_dy = 0.0050; // 50 micron
164 Float_t spdladder_dz = 0.0010; // 10 micron
165 Float_t spdladder_dpsi = 0.0001*kRadToDeg; // 0.1 mrad
166 Float_t spdladder_dtheta = 0.0001*kRadToDeg; // 0.1 mrad
167 Float_t spdladder_dphi = 0.0001*kRadToDeg; // 0.1 mrad
168
169 Float_t sddmodule_dx = 0.0045; // 45 micron
170 Float_t sddmodule_dy = 0.0045; // 45 micron
171 Float_t sddmodule_dz = 0.0105; // 105 micron
172 Float_t sddmodule_dpsi = 0.00; // ?
173 Float_t sddmodule_dtheta = 0.00; // ?
174 Float_t sddmodule_dphi = 0.00; // ?
175
176 Float_t ssdmodule_dx = 0.0050; // 50 micron
177 Float_t ssdmodule_dy = 0.0050; // 50 micron
178 Float_t ssdmodule_dz = 0.0050; // 50 micron
179 Float_t ssdmodule_dpsi = 0.00; // ?
180 Float_t ssdmodule_dtheta = 0.00; // ?
181 Float_t ssdmodule_dphi = 0.00; // ?
182 //
183 // END SETTINGS
184
185
186 AliITSMisalignMaker alignMaker;
187
188 //=****************************************
189 // overall ITS misalignment :
190 //=****************************************
191
192 alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,kFALSE);
1895a097 193
259b0bd4 194
195 //=****************************************
196 // misalignment at the level of SPD barrel, half-barrels, and at the level
197 // of SPD sectors
198 //=****************************************
199
200 Double_t vx,vy,vz,vpsi,vtheta,vphi;
201 Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
202
203 // barrel
204 vxbarrel = alignMaker.GaussCut(0, spdbarrel_dx/3, spdbarrel_dx);
205 vybarrel = alignMaker.GaussCut(0, spdbarrel_dy/3, spdbarrel_dy);
206 vzbarrel = alignMaker.GaussCut(0, spdbarrel_dz/3, spdbarrel_dz);
207 vpsibarrel = alignMaker.GaussCut(0, spdbarrel_dpsi/3, spdbarrel_dpsi);
208 vthetabarrel = alignMaker.GaussCut(0, spdbarrel_dtheta/3, spdbarrel_dtheta);
209 vphibarrel = alignMaker.GaussCut(0, spdbarrel_dphi/3, spdbarrel_dphi);
210
211 // top half-barrel
212 vx = alignMaker.GaussCut(0, spdhalfbarrel_dx/3, spdhalfbarrel_dx);
213 vy = alignMaker.GaussCut(0, spdhalfbarrel_dy/3, spdhalfbarrel_dy);
214 vz = alignMaker.GaussCut(0, spdhalfbarrel_dz/3, spdhalfbarrel_dz);
215 vpsi = alignMaker.GaussCut(0, spdhalfbarrel_dpsi/3, spdhalfbarrel_dpsi);
216 vtheta = alignMaker.GaussCut(0, spdhalfbarrel_dtheta/3, spdhalfbarrel_dtheta);
217 vphi = alignMaker.GaussCut(0, spdhalfbarrel_dphi/3, spdhalfbarrel_dphi);
218
219 vx += vxbarrel;
220 vy += vybarrel;
221 vz += vzbarrel;
222 vpsi += vpsibarrel;
223 vtheta += vthetabarrel;
224 vphi += vphibarrel;
225
226 alignMaker.AddSectorAlignObj(1, 5, spdsector_dx,spdsector_dy,spdsector_dz,
227 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
228 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
229
230 // bottom half-barrel
231 vx = alignMaker.GaussCut(0, spdhalfbarrel_dx/3, spdhalfbarrel_dx);
232 vy = alignMaker.GaussCut(0, spdhalfbarrel_dy/3, spdhalfbarrel_dy);
233 vz = alignMaker.GaussCut(0, spdhalfbarrel_dz/3, spdhalfbarrel_dz);
234 vpsi = alignMaker.GaussCut(0, spdhalfbarrel_dpsi/3, spdhalfbarrel_dpsi);
235 vtheta = alignMaker.GaussCut(0, spdhalfbarrel_dtheta/3, spdhalfbarrel_dtheta);
236 vphi = alignMaker.GaussCut(0, spdhalfbarrel_dphi/3, spdhalfbarrel_dphi);
237
238 vx += vxbarrel;
239 vy += vybarrel;
240 vz += vzbarrel;
241 vpsi += vpsibarrel;
242 vtheta += vthetabarrel;
243 vphi += vphibarrel;
244
245 alignMaker.AddSectorAlignObj(6, 10, spdsector_dx,spdsector_dy,spdsector_dz,
246 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
247 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
248
249
250 //=****************************************
251 // misalignment at the level of SDD and SSD layers
252 //=****************************************
253 /* alignMaker.AddAlignObj("ITS/SDD2", sddlayer_dx,sddlayer_dy,sddlayer_dz, sddlayer_dpsi,sddlayer_dtheta,sddlayer_dphi);
254 alignMaker.AddAlignObj("ITS/SDD3", sddlayer_dx,sddlayer_dy,sddlayer_dz, sddlayer_dpsi,sddlayer_dtheta,sddlayer_dphi);
255 alignMaker.AddAlignObj("ITS/SSD4", ssdlayer_dx,ssdlayer_dy,ssdlayer_dz, ssdlayer_dpsi,ssdlayer_dtheta,ssdlayer_dphi);
256 alignMaker.AddAlignObj("ITS/SSD5", ssdlayer_dx,ssdlayer_dy,ssdlayer_dz, ssdlayer_dpsi,ssdlayer_dtheta,ssdlayer_dphi); */
257 // still waiting for some changes in aliroot
258
259
260
261 //=****************************************
262 // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
263 //=****************************************
264
265 alignMaker.AddAlignObj(0, -1, spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz, spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,unifspdhalfstave); // all SPD1 half-staves
266 alignMaker.AddAlignObj(1, -1, spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz, spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,unifspdhalfstave); // all SPD2 half-staves
267
268 alignMaker.AddAlignObj(2, -1, sddladder_dx,sddladder_dy,sddladder_dz, sddladder_dpsi,sddladder_dtheta,sddladder_dphi,kFALSE); // all SDD1 ladders
269 alignMaker.AddAlignObj(3, -1, sddladder_dx,sddladder_dy,sddladder_dz, sddladder_dpsi,sddladder_dtheta,sddladder_dphi,kFALSE); // all SDD2 ladders
270
271 alignMaker.AddAlignObj(4, -1, ssdladder_dx,ssdladder_dy,ssdladder_dz, ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,kFALSE); // all SSD1 ladders
272 alignMaker.AddAlignObj(5, -1, ssdladder_dx,ssdladder_dy,ssdladder_dz, ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,kFALSE); // all SSD2 ladders
273
274 //=****************************************
275 // misalignment at the level of ladders (SPD)/modules (SDD, SSD) :
276 //=****************************************
277
278 alignMaker.AddAlignObj(0, spdladder_dx,spdladder_dy,spdladder_dz, spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD1 ladders
279 alignMaker.AddAlignObj(1, spdladder_dx,spdladder_dy,spdladder_dz, spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD2 ladders
280
281 alignMaker.AddAlignObj(2, sddmodule_dx,sddmodule_dy,sddmodule_dz, sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD1 modules
282 alignMaker.AddAlignObj(3, sddmodule_dx,sddmodule_dy,sddmodule_dz, sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD2 modules
283
284 alignMaker.AddAlignObj(4, ssdmodule_dx,ssdmodule_dy,ssdmodule_dz, ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD1 modules
285 alignMaker.AddAlignObj(5, ssdmodule_dx,ssdmodule_dy,ssdmodule_dz, ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD2 modules
286
287
288
289 if( gSystem->Getenv("TOCDB") != compare.Data() ){
1895a097 290 // save on file
dfe9c69d 291 const char* filename = "ITSfullMisalignment.root";
292 TFile f(filename,"RECREATE");
259b0bd4 293 if(!f.IsOpen()){
dfe9c69d 294 Error(macroname,"cannot open file for output\n");
295 return;
296 }
297 Info(macroname,"Saving alignment objects to the file %s", filename);
298 f.cd();
259b0bd4 299 f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
1895a097 300 f.Close();
301 }else{
302 // save in CDB storage
1895a097 303 AliCDBMetaData *md= new AliCDBMetaData();
259b0bd4 304 md->SetResponsible("Andrea Dainese");
1895a097 305 md->SetComment("Alignment objects with actual ITS misalignment");
5bd470e1 306 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
dfe9c69d 307 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
259b0bd4 308 storage->Put(alignMaker.GetArray(),id,md);
1895a097 309 }
310
1895a097 311
259b0bd4 312 return;
3b96c7be 313}