1 void MakeITSResMisAlignment() {
2 //========================================================================
4 // Steering macro for ITS residual (realistic) misalignment
6 // Main author: L. Gaudichet
7 // Contact: andrea.dainese@lnl.infn.it
9 //========================================================================
12 const char* macroname = "MakeITSResMisAlignment.C";
14 // Activate CDB storage and load geometry from CDB
15 AliCDBManager* cdb = AliCDBManager::Instance();
16 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
19 AliCDBStorage* storage = NULL;
21 if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
22 TString Storage = gSystem->Getenv("STORAGE");
23 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
24 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
27 storage = cdb->GetStorage(Storage.Data());
29 Error(macroname,"Unable to open storage %s\n",Storage.Data());
32 AliCDBPath path("GRP","Geometry","Data");
33 AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun());
34 if(!entry) Fatal(macroname,"Could not get the specified CDB entry!");
36 TGeoManager* geom = (TGeoManager*) entry->GetObject();
37 AliGeomManager::SetGeometry(geom);
39 AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
43 // - tranformations are defined by the "maximum transformation"
44 // dx,dy,dz,dpsi,dtheta,dphi: then we take a Gaussian with sigma=dx/3
45 // and we cut it at +- 3*sigma = dx
46 // (the option "unif" allows to sample from a uniform distr.)
47 // - units are cm and deg
48 // - transformations are defined in the local frame of the volume
51 const Float_t kRadToDeg = 180./TMath::Pi();
54 //=****************************************
55 // overall ITS misalignment : source -
56 //=****************************************
57 Float_t its_dx = 0.0000; // ?
58 Float_t its_dy = 0.0000; // ?
59 Float_t its_dz = 0.0000; // ?
60 Float_t its_dpsi = 0.0000; // ?
61 Float_t its_dtheta = 0.0000; // ?
62 Float_t its_dphi = 0.0000; // ?
64 //=****************************************
65 // misalignment at the level of SPD sectors : source - A.Pepato
66 //=****************************************
67 Float_t spdsector_dx = 0.0050/5.; // 50 micron (~tangetial, i.e. rphi)
68 Float_t spdsector_dy = 0.0100/5.; // 100 micron (~radial)
69 Float_t spdsector_dz = 0.0100/5.; // 100 micron
70 Float_t spdsector_dpsi = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
71 Float_t spdsector_dtheta = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
72 Float_t spdsector_dphi = 0.0050/1.5*kRadToDeg/5.; // so as to have 50 micron difference at the two extremes
73 Bool_t unifspdsector=kFALSE;
75 //=****************************************
76 // misalignment at the level of SPD half-barrels : source - A.Pepato
77 //=****************************************
78 Float_t spdhalfbarrel_dx = 0.000; // 200 micron
79 Float_t spdhalfbarrel_dy = 0.000; // 200 micron
80 Float_t spdhalfbarrel_dz = 0.000; // 200 micron
81 Float_t spdhalfbarrel_dpsi = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
82 Float_t spdhalfbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
83 Float_t spdhalfbarrel_dphi = 0.000/7.*kRadToDeg; // so as to have 100 micron difference at the two extremes
85 //=****************************************
86 // misalignment at the level of SPD barrel : source - A.Pepato
87 //=****************************************
88 Float_t spdbarrel_dx = 0.000; // 1 mm (very pessimistic)
89 Float_t spdbarrel_dy = 0.000; // 1 mm (very pessimistic)
90 Float_t spdbarrel_dz = 0.000; // 1 mm (very pessimistic)
91 Float_t spdbarrel_dpsi = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
92 Float_t spdbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
93 Float_t spdbarrel_dphi = 0.000/7.*kRadToDeg; // so as to have 500 micron difference at the two extremes
96 //=****************************************
97 // misalignment at the level of SDD and SSD layers: source
98 //=****************************************
100 Float_t sddlayer_dx = 0.0000; // ?
101 Float_t sddlayer_dy = 0.0000; // ?
102 Float_t sddlayer_dz = 0.0000; // ?
103 Float_t sddlayer_dpsi = 0.0000; // ?
104 Float_t sddlayer_dtheta = 0.0000; // ?
105 Float_t sddlayer_dphi = 0.0000; // ?
107 Float_t ssdlayer_dx = 0.0000; // ?
108 Float_t ssdlayer_dy = 0.0000; // ?
109 Float_t ssdlayer_dz = 0.0000; // ?
110 Float_t ssdlayer_dpsi = 0.0000; // ?
111 Float_t ssdlayer_dtheta = 0.0000; // ?
112 Float_t ssdlayer_dphi = 0.0000; // ?
115 //=****************************************
116 // misalignment at the level of half-staves (SPD) : source - S.Moretto
117 // ladders (SDD,SSD) : source -
118 //=****************************************
119 Float_t spdhalfstave_dx = 0.0100/4.; // 100 micron
120 Float_t spdhalfstave_dy = 0.0020/4.; // 20 micron
121 Float_t spdhalfstave_dz = 0.0020/4.; // 20 micron
122 Float_t spdhalfstave_dpsi = 0.0020/7.*kRadToDeg/4.; // so as to have 20 micron difference at the two extremes
123 Float_t spdhalfstave_dtheta = 0.0050/7.*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
124 Float_t spdhalfstave_dphi = 0.0050/0.7*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
125 Bool_t unifspdhalfstave=kFALSE;
127 Float_t sddladder_dx = 0.0005; // 5 micron
128 Float_t sddladder_dy = 0.0005; // 5 micron
129 Float_t sddladder_dz = 0.0005; // 5 micron
130 Float_t sddladder_dpsi = 0.00; // ?
131 Float_t sddladder_dtheta = 0.00; // ?
132 Float_t sddladder_dphi = 0.00; // ?
134 Float_t ssdladder_dx = 0.0005; // 5 micron
135 Float_t ssdladder_dy = 0.0005; // 5 micron
136 Float_t ssdladder_dz = 0.0005; // 5 micron
137 Float_t ssdladder_dpsi = 0.00; // ?
138 Float_t ssdladder_dtheta = 0.00; // ?
139 Float_t ssdladder_dphi = 0.00; // ?
142 //=****************************************
143 // misalignment at the level of ladders (SPD) : source - R.Santoro
144 // modules (SDD) : source - L.Gaudichet
145 // modules (SSD) : source -
146 //=****************************************
147 Float_t spdladder_dx = 0.0010/5.; // 10 micron
148 Float_t spdladder_dy = 0.0050/5.; // 50 micron
149 Float_t spdladder_dz = 0.0010/5.; // 10 micron
150 Float_t spdladder_dpsi = 0.0001*kRadToDeg/5.; // 0.1 mrad
151 Float_t spdladder_dtheta = 0.0001*kRadToDeg/5.; // 0.1 mrad
152 Float_t spdladder_dphi = 0.0001*kRadToDeg/5.; // 0.1 mrad
154 Float_t sddmodule_dx = 0.0045/5.; // 45 micron
155 Float_t sddmodule_dy = 0.0045/5.; // 45 micron
156 Float_t sddmodule_dz = 0.0105/5.; // 105 micron
157 Float_t sddmodule_dpsi = 0.00; // ?
158 Float_t sddmodule_dtheta = 0.00; // ?
159 Float_t sddmodule_dphi = 0.00; // ?
161 Float_t ssdmodule_dx = 0.0050/5.; // 50 micron
162 Float_t ssdmodule_dy = 0.0050/5.; // 50 micron
163 Float_t ssdmodule_dz = 0.0050/5.; // 50 micron
164 Float_t ssdmodule_dpsi = 0.00; // ?
165 Float_t ssdmodule_dtheta = 0.00; // ?
166 Float_t ssdmodule_dphi = 0.00; // ?
171 AliITSMisalignMaker alignMaker;
173 //=****************************************
174 // overall ITS misalignment :
175 //=****************************************
177 alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,kFALSE);
180 //=****************************************
181 // misalignment at the level of SPD barrel, half-barrels, and at the level
183 //=****************************************
185 Double_t vx,vy,vz,vpsi,vtheta,vphi;
186 Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
189 vxbarrel = alignMaker.GaussCut(0, spdbarrel_dx/3, spdbarrel_dx);
190 vybarrel = alignMaker.GaussCut(0, spdbarrel_dy/3, spdbarrel_dy);
191 vzbarrel = alignMaker.GaussCut(0, spdbarrel_dz/3, spdbarrel_dz);
192 vpsibarrel = alignMaker.GaussCut(0, spdbarrel_dpsi/3, spdbarrel_dpsi);
193 vthetabarrel = alignMaker.GaussCut(0, spdbarrel_dtheta/3, spdbarrel_dtheta);
194 vphibarrel = alignMaker.GaussCut(0, spdbarrel_dphi/3, spdbarrel_dphi);
197 vx = alignMaker.GaussCut(0, spdhalfbarrel_dx/3, spdhalfbarrel_dx);
198 vy = alignMaker.GaussCut(0, spdhalfbarrel_dy/3, spdhalfbarrel_dy);
199 vz = alignMaker.GaussCut(0, spdhalfbarrel_dz/3, spdhalfbarrel_dz);
200 vpsi = alignMaker.GaussCut(0, spdhalfbarrel_dpsi/3, spdhalfbarrel_dpsi);
201 vtheta = alignMaker.GaussCut(0, spdhalfbarrel_dtheta/3, spdhalfbarrel_dtheta);
202 vphi = alignMaker.GaussCut(0, spdhalfbarrel_dphi/3, spdhalfbarrel_dphi);
208 vtheta += vthetabarrel;
211 alignMaker.AddSectorAlignObj(1, 5, spdsector_dx,spdsector_dy,spdsector_dz,
212 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
213 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
215 // bottom half-barrel
216 vx = alignMaker.GaussCut(0, spdhalfbarrel_dx/3, spdhalfbarrel_dx);
217 vy = alignMaker.GaussCut(0, spdhalfbarrel_dy/3, spdhalfbarrel_dy);
218 vz = alignMaker.GaussCut(0, spdhalfbarrel_dz/3, spdhalfbarrel_dz);
219 vpsi = alignMaker.GaussCut(0, spdhalfbarrel_dpsi/3, spdhalfbarrel_dpsi);
220 vtheta = alignMaker.GaussCut(0, spdhalfbarrel_dtheta/3, spdhalfbarrel_dtheta);
221 vphi = alignMaker.GaussCut(0, spdhalfbarrel_dphi/3, spdhalfbarrel_dphi);
227 vtheta += vthetabarrel;
230 alignMaker.AddSectorAlignObj(6, 10, spdsector_dx,spdsector_dy,spdsector_dz,
231 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
232 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
235 //=****************************************
236 // misalignment at the level of SDD and SSD layers
237 //=****************************************
238 /* alignMaker.AddAlignObj("ITS/SDD2", sddlayer_dx,sddlayer_dy,sddlayer_dz, sddlayer_dpsi,sddlayer_dtheta,sddlayer_dphi);
239 alignMaker.AddAlignObj("ITS/SDD3", sddlayer_dx,sddlayer_dy,sddlayer_dz, sddlayer_dpsi,sddlayer_dtheta,sddlayer_dphi);
240 alignMaker.AddAlignObj("ITS/SSD4", ssdlayer_dx,ssdlayer_dy,ssdlayer_dz, ssdlayer_dpsi,ssdlayer_dtheta,ssdlayer_dphi);
241 alignMaker.AddAlignObj("ITS/SSD5", ssdlayer_dx,ssdlayer_dy,ssdlayer_dz, ssdlayer_dpsi,ssdlayer_dtheta,ssdlayer_dphi); */
242 // still waiting for some changes in aliroot
246 //=****************************************
247 // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
248 //=****************************************
250 alignMaker.AddAlignObj(0, -1, spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz, spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,unifspdhalfstave); // all SPD1 half-staves
251 alignMaker.AddAlignObj(1, -1, spdhalfstave_dx,spdhalfstave_dy,spdhalfstave_dz, spdhalfstave_dpsi,spdhalfstave_dtheta,spdhalfstave_dphi,unifspdhalfstave); // all SPD2 half-staves
253 alignMaker.AddAlignObj(2, -1, sddladder_dx,sddladder_dy,sddladder_dz, sddladder_dpsi,sddladder_dtheta,sddladder_dphi,kFALSE); // all SDD1 ladders
254 alignMaker.AddAlignObj(3, -1, sddladder_dx,sddladder_dy,sddladder_dz, sddladder_dpsi,sddladder_dtheta,sddladder_dphi,kFALSE); // all SDD2 ladders
256 alignMaker.AddAlignObj(4, -1, ssdladder_dx,ssdladder_dy,ssdladder_dz, ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,kFALSE); // all SSD1 ladders
257 alignMaker.AddAlignObj(5, -1, ssdladder_dx,ssdladder_dy,ssdladder_dz, ssdladder_dpsi,ssdladder_dtheta,ssdladder_dphi,kFALSE); // all SSD2 ladders
259 //=****************************************
260 // misalignment at the level of ladders (SPD)/modules (SDD, SSD) :
261 //=****************************************
263 alignMaker.AddAlignObj(0, spdladder_dx,spdladder_dy,spdladder_dz, spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD1 ladders
264 alignMaker.AddAlignObj(1, spdladder_dx,spdladder_dy,spdladder_dz, spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD2 ladders
266 alignMaker.AddAlignObj(2, sddmodule_dx,sddmodule_dy,sddmodule_dz, sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD1 modules
267 alignMaker.AddAlignObj(3, sddmodule_dx,sddmodule_dy,sddmodule_dz, sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD2 modules
269 alignMaker.AddAlignObj(4, ssdmodule_dx,ssdmodule_dy,ssdmodule_dz, ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD1 modules
270 alignMaker.AddAlignObj(5, ssdmodule_dx,ssdmodule_dy,ssdmodule_dz, ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD2 modules
274 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
276 const char* filename = "ITSresidualMisalignment.root";
277 TFile f(filename,"RECREATE");
279 Error(macroname,"cannot open file for output\n");
282 Info(macroname,"Saving alignment objects to the file %s", filename);
284 f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
287 // save in CDB storage
288 AliCDBMetaData *md= new AliCDBMetaData();
289 md->SetResponsible("Andrea Dainese");
290 md->SetComment("Alignment objects with residual ITS misalignment");
291 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
292 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
293 storage->Put(alignMaker.GetArray(),id,md);