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