1 #if !defined(__CINT__) || defined(__MAKECINT__)
4 #include <TGeoManager.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"
15 void MakeITSFullMisAlignment() {
16 //========================================================================
18 // Macro for ITS full (realistic) misalignment
20 // Main author: L. Gaudichet
21 // Contact: andrea.dainese@lnl.infn.it
23 //========================================================================
26 const char* macroname = "MakeITSFullMisAlignment.C";
28 // Activate CDB storage and load geometry from CDB
29 AliCDBManager* cdb = AliCDBManager::Instance();
30 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
33 AliCDBStorage* storage = NULL;
35 TString compare("kTRUE");
36 if(gSystem->Getenv("TOCDB") == compare.Data()){
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());
42 storage = cdb->GetStorage(Storage.Data());
44 Error(macroname,"Unable to open storage %s\n",Storage.Data());
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!");
51 TGeoManager* geom = (TGeoManager*) entry->GetObject();
52 AliGeomManager::SetGeometry(geom);
54 AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
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
66 const Float_t kRadToDeg = 180./TMath::Pi();
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; // ?
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;
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
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
111 //=****************************************
112 // misalignment at the level of SDD and SSD layers: source
113 //=****************************************
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; // ?
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; // ?
130 //=****************************************
131 // misalignment at the level of half-staves (SPD) : source - S.Moretto
132 // ladders (SDD,SSD) : source -
133 //=****************************************
134 Float_t spdhalfstave_dx = 0.0020; // 20 micron
135 Float_t spdhalfstave_dy = 0.0100; // 100 micron
136 Float_t spdhalfstave_dz = 0.0020; // 20 micron
137 Float_t spdhalfstave_dpsi = 0.0050/7.*kRadToDeg; // so as to have 50 micron difference at the two extremes
138 Float_t spdhalfstave_dtheta = 0.0020/7.*kRadToDeg; // so as to have 20 micron difference at the two extremes
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;
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; // ?
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; // ?
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
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; // ?
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; // ?
186 AliITSMisalignMaker alignMaker;
188 //=****************************************
189 // overall ITS misalignment :
190 //=****************************************
192 alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,kFALSE);
195 //=****************************************
196 // misalignment at the level of SPD barrel, half-barrels, and at the level
198 //=****************************************
200 Double_t vx,vy,vz,vpsi,vtheta,vphi;
201 Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
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);
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);
223 vtheta += vthetabarrel;
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);
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);
242 vtheta += vthetabarrel;
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);
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
261 //=****************************************
262 // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
263 //=****************************************
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
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
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
274 //=****************************************
275 // misalignment at the level of ladders (SPD)/modules (SDD, SSD) :
276 //=****************************************
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
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
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
289 if( gSystem->Getenv("TOCDB") != compare.Data() ){
291 const char* filename = "ITSfullMisalignment.root";
292 TFile f(filename,"RECREATE");
294 Error(macroname,"cannot open file for output\n");
297 Info(macroname,"Saving alignment objects to the file %s", filename);
299 f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
302 // save in CDB storage
303 AliCDBMetaData *md= new AliCDBMetaData();
304 md->SetResponsible("Andrea Dainese");
305 md->SetComment("Alignment objects with actual ITS misalignment");
306 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
307 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
308 storage->Put(alignMaker.GetArray(),id,md);