Macros for residual and full misalignment, collected by Raffaele
[u/mrichter/AliRoot.git] / ITS / MakeITSFullMisAlignment.C
CommitLineData
1895a097 1void MakeITSFullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for ITS
3 //
4 TClonesArray *array = new TClonesArray("AliAlignObjAngles",4000);
5 TClonesArray &alobj = *array;
6
7 if(!gGeoManager) TGeoManager::Import("geometry.root");
8 // needed for the constructors with local coordinates not to fail
9
10 Double_t globalZ = 0.005; // in cm, = 50 microns
11 Double_t resFact = 0.7;
12 Double_t spdXY = 0.0015*resFact;
13 Double_t sddXYZ = 0.0030*resFact;
14 Double_t ssdXY = 0.0020*resFact;
15 Double_t rot = 0.018;
16
17 Double_t spdZ = 0.002;
18 Double_t ssdZ = 0.010;
19
20 TRandom *rnd = new TRandom(65416087);
21 AliAlignObjAngles a;
22
23 Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
24
25 Int_t j = 0;
26 new(alobj[j]) AliAlignObjAngles("ALIC_1/ITSV_1", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
27 j++;
28
29 for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) {
30
31 printf("%i modules in layer %i\n", AliAlignObj::LayerSize(l), l);
32 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(l); iModule++) {
33
34 dpsi = rnd->Gaus(0., rot);
35 dtheta = rnd->Gaus(0., rot);
36 dphi = rnd->Gaus(0., rot);
37
38 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
39 switch (l) {
40 case 1: {
41 iLayer = AliAlignObj::kSPD1;
42 dx = rnd->Gaus(0., spdXY);
43 dy = rnd->Gaus(0., spdXY);
44 dz = rnd->Gaus(0., spdZ);
45 }; break;
46 case 2: {
47 iLayer = AliAlignObj::kSPD2;
48 dx = rnd->Gaus(0., spdXY);
49 dy = rnd->Gaus(0., spdXY);
50 dz = rnd->Gaus(0., spdZ);
51 }; break;
52 case 3: {
53 iLayer = AliAlignObj::kSDD1;
54 dx = rnd->Gaus(0., sddXYZ);
55 dy = rnd->Gaus(0., sddXYZ);
56 dz = rnd->Gaus(0., sddXYZ);
57 }; break;
58 case 4: {
59 iLayer = AliAlignObj::kSDD2;
60 dx = rnd->Gaus(0., sddXYZ);
61 dy = rnd->Gaus(0., sddXYZ);
62 dz = rnd->Gaus(0., sddXYZ);
63 }; break;
64 case 5: {
65 iLayer = AliAlignObj::kSSD1;
66 dx = rnd->Gaus(0., ssdXY);
67 dy = rnd->Gaus(0., ssdXY);
68 dz = rnd->Gaus(0., ssdZ);
69 }; break;
70 case 6: {
71 iLayer = AliAlignObj::kSSD2;
72 dx = rnd->Gaus(0., ssdXY);
73 dy = rnd->Gaus(0., ssdXY);
74 dz = rnd->Gaus(0., ssdZ);
75 }; break;
76 default: Printf("Wrong layer index in ITS (%d) !",l);
77 };
78 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
79 const char *path = AliAlignObj::SymName(volid);
80
81 new(alobj[j]) AliAlignObjAngles(path, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
82 j++;
83
84 }
85 }
86
87 if(!gSystem->Getenv("$TOCDB")){
88 // save on file
89 TFile f("ITSfullMisalignment.root","RECREATE");
90 if(!f) {cerr<<"cannot open file for output\n";}
91 f.WriteObject(array,"ITSAlignObjs","kSingleKey");
92 f.Close();
93 }else{
94 // save in CDB storage
95 const char* Storage = gSystem->Getenv("$STORAGE");
96 AliCDBManager *CDB = AliCDBManager::Instance();
97 AliCDBStorage* storage = CDB->GetStorage(Storage);
98 AliCDBMetaData *md= new AliCDBMetaData();
99 md->SetResponsible("Ludovic Gaudichet");
100 md->SetComment("Alignment objects with actual ITS misalignment");
101 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
102 AliCDBId id("ITS/Align/Data",0,9999999);
103 storage->Put(array,id, md);
104 }
105
106 array->Delete();
107
108}
109
110