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 // no smearing added (would clash with vertex constraint)
76 //=****************************************
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;
83 const char* unifits="fixed";
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;
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
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
117 //=****************************************
118 // misalignment at the level of SDD and SSD layers: source
119 //=****************************************
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;
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;
135 //=****************************************
136 // misalignment at the level of half-staves (SPD) : source - S.Moretto
137 // ladders (SDD,SSD) : source -
138 //=****************************************
139 Float_t spdhalfstave_dx = 0.0100/4.; // 100 micron
140 Float_t spdhalfstave_dy = 0.0020/4.; // 20 micron
141 Float_t spdhalfstave_dz = 0.0020/4.; // 20 micron
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
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;
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; // ?
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; // ?
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
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; // ?
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; // ?
190 AliITSMisalignMaker alignMaker;
192 //=****************************************
193 // overall ITS misalignment :
194 //=****************************************
196 alignMaker.AddAlignObj("ITS",its_dx,its_dy,its_dz,its_dpsi,its_dtheta,its_dphi,unifits);
199 //=****************************************
200 // misalignment at the level of SPD barrel, half-barrels, and at the level
202 //=****************************************
204 Double_t vx,vy,vz,vpsi,vtheta,vphi;
205 Double_t vxbarrel,vybarrel,vzbarrel,vpsibarrel,vthetabarrel,vphibarrel;
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);
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);
228 vtheta += vthetabarrel;
231 alignMaker.AddSectorAlignObj(1,5,spdsector_dx,spdsector_dy,spdsector_dz,
232 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
233 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
235 // bottom half-barrel
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);
247 vtheta += vthetabarrel;
250 alignMaker.AddSectorAlignObj(6,10,spdsector_dx,spdsector_dy,spdsector_dz,
251 spdsector_dpsi,spdsector_dtheta,spdsector_dphi,
252 vx,vy,vz,vpsi,vtheta,vphi,unifspdsector);
255 //=****************************************
256 // misalignment at the level of half-staves (SPD)/ladders (SDD,SSD) :
257 //=****************************************
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
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
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
268 //=****************************************
269 // misalignment at the level of ladders (SPD)/modules (SDD,SSD) :
270 //=****************************************
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
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
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
282 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
284 const char* filename = "ITSresidualMisalignment.root";
285 TFile f(filename,"RECREATE");
287 Error(macroname,"cannot open file for output\n");
290 Info(macroname,"Saving alignment objects to the file %s",filename);
292 f.WriteObject(alignMaker.GetArray(),"ITSAlignObjs","kSingleKey");
295 // save in CDB storage
296 AliCDBMetaData *md= new AliCDBMetaData();
297 md->SetResponsible("Andrea Dainese");
298 md->SetComment("Alignment objects with residual ITS misalignment");
299 md->SetAliRootVersion(gSystem->Getenv("ARVERSION"));
300 AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity());
301 storage->Put(alignMaker.GetArray(),id,md);