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"
18 rnd.SetSeed(98723456);
20 void MakeITSResMisAlignment() {
21 //========================================================================
23 // Steering macro for ITS residual (realistic) misalignment
25 // Main author: L. Gaudichet
26 // Contact: andrea.dainese@lnl.infn.it
28 //========================================================================
31 const char* macroname = "MakeITSResMisAlignment.C";
33 // Activate CDB storage and load geometry from CDB
34 AliCDBManager* cdb = AliCDBManager::Instance();
35 if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT");
38 AliCDBStorage* storage = NULL;
40 if(TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")){
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());
46 storage = cdb->GetStorage(Storage.Data());
48 Error(macroname,"Unable to open storage %s\n",Storage.Data());
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!");
55 TGeoManager* geom = (TGeoManager*) entry->GetObject();
56 AliGeomManager::SetGeometry(geom);
58 AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage
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
70 const Float_t kRadToDeg = 180./TMath::Pi();
73 //=****************************************
74 // misalignment of the whole ITS according to survey as reported by Werner Riegler (18/07/2008)
75 // + 100um smearing for translations and 0.1mrad smearing for rotations
76 //=****************************************
77 Double_t sigmatrW = 0.01;
78 Double_t sigmarotW = 0.006;
79 Double_t its_dx = AliMathBase::TruncatedGaus(-0.12,sigmatrW,3.*sigmatrW);
80 Double_t its_dy = AliMathBase::TruncatedGaus(-0.07,sigmatrW,3.*sigmatrW);
81 Double_t its_dz = AliMathBase::TruncatedGaus(0.29,sigmatrW,3.*sigmatrW);
82 Double_t its_dpsi = AliMathBase::TruncatedGaus(0.,sigmarotW,3.*sigmarotW);
83 Double_t its_dtheta = AliMathBase::TruncatedGaus(0.03,sigmarotW,3.*sigmarotW);
84 Double_t its_dphi = AliMathBase::TruncatedGaus(0.04,sigmarotW,3.*sigmarotW);
85 const char* unifits="fixed";
87 //=****************************************
88 // misalignment at the level of SPD sectors : source - A.Pepato
89 //=****************************************
90 Float_t spdsector_dx = 0.0050/5.; // 50 micron (~tangetial, i.e. rphi)
91 Float_t spdsector_dy = 0.0100/5.; // 100 micron (~radial)
92 Float_t spdsector_dz = 0.0100/5.; // 100 micron
93 Float_t spdsector_dpsi = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
94 Float_t spdsector_dtheta = 0.0100/30.*kRadToDeg/5.; // so as to have 100 micron difference at the two extremes
95 Float_t spdsector_dphi = 0.0050/1.5*kRadToDeg/5.; // so as to have 50 micron difference at the two extremes
96 Bool_t unifspdsector=kFALSE;
98 //=****************************************
99 // misalignment at the level of SPD half-barrels : source - A.Pepato
100 //=****************************************
101 Float_t spdhalfbarrel_dx = 0.000; // 200 micron
102 Float_t spdhalfbarrel_dy = 0.000; // 200 micron
103 Float_t spdhalfbarrel_dz = 0.000; // 200 micron
104 Float_t spdhalfbarrel_dpsi = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
105 Float_t spdhalfbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 100 micron difference at the two extremes
106 Float_t spdhalfbarrel_dphi = 0.000/7.*kRadToDeg; // so as to have 100 micron difference at the two extremes
108 //=****************************************
109 // misalignment at the level of SPD barrel : source - A.Pepato
110 //=****************************************
111 Float_t spdbarrel_dx = 0.000; // 1 mm (very pessimistic)
112 Float_t spdbarrel_dy = 0.000; // 1 mm (very pessimistic)
113 Float_t spdbarrel_dz = 0.000; // 1 mm (very pessimistic)
114 Float_t spdbarrel_dpsi = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
115 Float_t spdbarrel_dtheta = 0.000/30.*kRadToDeg; // so as to have 500 micron difference at the two extremes
116 Float_t spdbarrel_dphi = 0.000/7.*kRadToDeg; // so as to have 500 micron difference at the two extremes
119 //=****************************************
120 // misalignment at the level of SDD and SSD layers: source
121 //=****************************************
122 Float_t sddlayer_dx = 0.0000;
123 Float_t sddlayer_dy = 0.0000;
124 Float_t sddlayer_dz = 0.0000;
125 Float_t sddlayer_dpsi = 0.0000;
126 Float_t sddlayer_dtheta = 0.0000;
127 Float_t sddlayer_dphi = 0.0000;
129 Float_t ssdlayer_dx = 0.0000;
130 Float_t ssdlayer_dy = 0.0000;
131 Float_t ssdlayer_dz = 0.0000;
132 Float_t ssdlayer_dpsi = 0.0000;
133 Float_t ssdlayer_dtheta = 0.0000;
134 Float_t ssdlayer_dphi = 0.0000;
137 //=****************************************
138 // misalignment at the level of half-staves (SPD) : source - S.Moretto
139 // ladders (SDD,SSD) : source -
140 //=****************************************
141 Float_t spdhalfstave_dx = 0.0100/4.; // 100 micron
142 Float_t spdhalfstave_dy = 0.0020/4.; // 20 micron
143 Float_t spdhalfstave_dz = 0.0020/4.; // 20 micron
144 Float_t spdhalfstave_dpsi = 0.0020/7.*kRadToDeg/4.; // so as to have 20 micron difference at the two extremes
145 Float_t spdhalfstave_dtheta = 0.0050/7.*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
146 Float_t spdhalfstave_dphi = 0.0050/0.7*kRadToDeg/4.; // so as to have 50 micron difference at the two extremes
147 Bool_t unifspdhalfstave=kFALSE;
149 Float_t sddladder_dx = 0.0005; // 5 micron
150 Float_t sddladder_dy = 0.0005; // 5 micron
151 Float_t sddladder_dz = 0.0005; // 5 micron
152 Float_t sddladder_dpsi = 0.00; // ?
153 Float_t sddladder_dtheta = 0.00; // ?
154 Float_t sddladder_dphi = 0.00; // ?
156 Float_t ssdladder_dx = 0.0005; // 5 micron
157 Float_t ssdladder_dy = 0.0005; // 5 micron
158 Float_t ssdladder_dz = 0.0005; // 5 micron
159 Float_t ssdladder_dpsi = 0.00; // ?
160 Float_t ssdladder_dtheta = 0.00; // ?
161 Float_t ssdladder_dphi = 0.00; // ?
164 //=****************************************
165 // misalignment at the level of ladders (SPD) : source - R.Santoro
166 // modules (SDD) : source - L.Gaudichet
167 // modules (SSD) : source -
168 //=****************************************
169 Float_t spdladder_dx = 0.0010/5.; // 10 micron
170 Float_t spdladder_dy = 0.0050/5.; // 50 micron
171 Float_t spdladder_dz = 0.0010/5.; // 10 micron
172 Float_t spdladder_dpsi = 0.0001*kRadToDeg/5.; // 0.1 mrad
173 Float_t spdladder_dtheta = 0.0001*kRadToDeg/5.; // 0.1 mrad
174 Float_t spdladder_dphi = 0.0001*kRadToDeg/5.; // 0.1 mrad
176 Float_t sddmodule_dx = 0.0045/5.; // 45 micron
177 Float_t sddmodule_dy = 0.0045/5.; // 45 micron
178 Float_t sddmodule_dz = 0.0105/5.; // 105 micron
179 Float_t sddmodule_dpsi = 0.00; // ?
180 Float_t sddmodule_dtheta = 0.00; // ?
181 Float_t sddmodule_dphi = 0.00; // ?
183 Float_t ssdmodule_dx = 0.0050/5.; // 50 micron
184 Float_t ssdmodule_dy = 0.0050/5.; // 50 micron
185 Float_t ssdmodule_dz = 0.0050/5.; // 50 micron
186 Float_t ssdmodule_dpsi = 0.00; // ?
187 Float_t ssdmodule_dtheta = 0.00; // ?
188 Float_t ssdmodule_dphi = 0.00; // ?
192 AliITSMisalignMaker alignMaker;
194 //=****************************************
195 // overall ITS misalignment :
196 //=****************************************
198 alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,unifits);
201 //=****************************************
202 // misalignment at the level of SPD barrel, half-barrels, and at the level
204 //=****************************************
206 Double_t vx,vy,vz,vpsi,vtheta,vphi;
207 Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
210 vxbarrel = AliMathBase::TruncatedGaus(0.,spdbarrel_dx/3,spdbarrel_dx);
211 vxbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dx/3,spdbarrel_dx);
212 vybarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dy/3,spdbarrel_dy);
213 vzbarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dz/3,spdbarrel_dz);
214 vpsibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dpsi/3,spdbarrel_dpsi);
215 vthetabarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dtheta/3,spdbarrel_dtheta);
216 vphibarrel = AliMathBase::TruncatedGaus(0,spdbarrel_dphi/3,spdbarrel_dphi);
219 vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
220 vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
221 vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
222 vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
223 vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
224 vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
230 vtheta += vthetabarrel;
233 alignMaker.AddSectorAlignObj(1,5,spdsector_dx,spdsector_dy,spdsector_dz,
234 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
235 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
237 // bottom half-barrel
238 vx = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dx/3,spdhalfbarrel_dx);
239 vy = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dy/3,spdhalfbarrel_dy);
240 vz = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dz/3,spdhalfbarrel_dz);
241 vpsi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dpsi/3,spdhalfbarrel_dpsi);
242 vtheta = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dtheta/3,spdhalfbarrel_dtheta);
243 vphi = AliMathBase::TruncatedGaus(0,spdhalfbarrel_dphi/3,spdhalfbarrel_dphi);
249 vtheta += vthetabarrel;
252 alignMaker.AddSectorAlignObj(6,10,spdsector_dx,spdsector_dy,spdsector_dz,
253 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
254 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
257 //=****************************************
258 // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
259 //=****************************************
261 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
262 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
264 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
265 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
267 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
268 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
270 //=****************************************
271 // misalignment at the level of ladders (SPD)/modules (SDD,SSD) :
272 //=****************************************
274 alignMaker.AddAlignObj(0,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD1 ladders
275 alignMaker.AddAlignObj(1,spdladder_dx,spdladder_dy,spdladder_dz,spdladder_dpsi,spdladder_dtheta,spdladder_dphi,kFALSE); // all SPD2 ladders
277 alignMaker.AddAlignObj(2,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD1 modules
278 alignMaker.AddAlignObj(3,sddmodule_dx,sddmodule_dy,sddmodule_dz,sddmodule_dpsi,sddmodule_dtheta,sddmodule_dphi,kFALSE); // all SDD2 modules
280 alignMaker.AddAlignObj(4,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD1 modules
281 alignMaker.AddAlignObj(5,ssdmodule_dx,ssdmodule_dy,ssdmodule_dz,ssdmodule_dpsi,ssdmodule_dtheta,ssdmodule_dphi,kFALSE); // all SSD2 modules
284 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
286 const char* filename = "ITSresidualMisalignment.root";
287 TFile f(filename,"RECREATE");
289 Error(macroname,"cannot open file for output\n");
292 Info(macroname,"Saving alignment objects to the file %s",filename);
294 f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
297 // save in CDB storage
298 AliCDBMetaData *md= new AliCDBMetaData();
299 md->SetResponsible("Andrea Dainese");
300 md->SetComment("Alignment objects with residual ITS misalignment");
301 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
302 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
303 storage->Put(alignMaker.GetArray(),id,md);