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