Using symbolic names instead of volume paths (Raffaele)
[u/mrichter/AliRoot.git] / ITS / MakeITSResMisAlignment.C
CommitLineData
1895a097 1void MakeITSResMisAlignment(){
2 // Create TClonesArray of residual 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 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
25
26 Int_t j = 0;
7e154d52 27
28 new(alobj[j]) AliAlignObjAngles("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE);
1895a097 29 j++;
30
31 for ( Int_t l = AliAlignObj::kSPD1; l <= AliAlignObj::kSSD2; l++) {
32
33 printf("%i modules in layer %i\n", AliAlignObj::LayerSize(l), l);
34 for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(l); iModule++) {
35
36 dpsi = rnd->Gaus(0., rot);
37 dtheta = rnd->Gaus(0., rot);
38 dphi = rnd->Gaus(0., rot);
39
40 iLayer = AliAlignObj::kInvalidLayer;
41
42 switch (l) {
43 case 1: {
44 iLayer = AliAlignObj::kSPD1;
45 dx = rnd->Gaus(0., spdXY);
46 dy = rnd->Gaus(0., spdXY);
47 dz = rnd->Gaus(0., spdZ);
48 }; break;
49 case 2: {
50 iLayer = AliAlignObj::kSPD2;
51 dx = rnd->Gaus(0., spdXY);
52 dy = rnd->Gaus(0., spdXY);
53 dz = rnd->Gaus(0., spdZ);
54 }; break;
55 case 3: {
56 iLayer = AliAlignObj::kSDD1;
57 dx = rnd->Gaus(0., sddXYZ);
58 dy = rnd->Gaus(0., sddXYZ);
59 dz = rnd->Gaus(0., sddXYZ);
60 }; break;
61 case 4: {
62 iLayer = AliAlignObj::kSDD2;
63 dx = rnd->Gaus(0., sddXYZ);
64 dy = rnd->Gaus(0., sddXYZ);
65 dz = rnd->Gaus(0., sddXYZ);
66 }; break;
67 case 5: {
68 iLayer = AliAlignObj::kSSD1;
69 dx = rnd->Gaus(0., ssdXY);
70 dy = rnd->Gaus(0., ssdXY);
71 dz = rnd->Gaus(0., ssdZ);
72 }; break;
73 case 6: {
74 iLayer = AliAlignObj::kSSD2;
75 dx = rnd->Gaus(0., ssdXY);
76 dy = rnd->Gaus(0., ssdXY);
77 dz = rnd->Gaus(0., ssdZ);
78 }; break;
79 default: Printf("Wrong layer index in ITS (%d) !",l);
80 };
81 UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule);
7e154d52 82 const char *symname = AliAlignObj::SymName(volid);
1895a097 83
7e154d52 84 new(alobj[j]) AliAlignObjAngles(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE);
1895a097 85 j++;
86
87 }
88 }
89
90 if(!gSystem->Getenv("$TOCDB")){
91 // save on file
92 TFile f("ITSresidualMisalignment.root","RECREATE");
93 if(!f) {cerr<<"cannot open file for output\n";}
94 f.WriteObject(array,"ITSAlignObjs","kSingleKey");
95 f.Close();
96 }else{
97 // save in CDB storage
98 const char* Storage = gSystem->Getenv("$STORAGE");
99 AliCDBManager *CDB = AliCDBManager::Instance();
100 AliCDBStorage* storage = CDB->GetStorage(Storage);
101 AliCDBMetaData *md= new AliCDBMetaData();
102 md->SetResponsible("Ludovic Gaudichet");
103 md->SetComment("Alignment objects with actual ITS misalignment");
104 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
105 AliCDBId id("ITS/Align/Data",0,9999999);
106 storage->Put(array,id, md);
107 }
108
109 array->Delete();
110
111}
112
113