]>
Commit | Line | Data |
---|---|---|
1895a097 | 1 | void MakeITSResMisAlignment(){ |
2 | // Create TClonesArray of residual misalignment objects for ITS | |
3 | // | |
90dbf5fb | 4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",4000); |
1895a097 | 5 | TClonesArray &alobj = *array; |
6fce62af | 6 | const char* macroname = "MakeITSResMisAlignment.C"; |
1895a097 | 7 | |
6fce62af | 8 | // Activate CDB storage and load geometry from CDB |
9 | AliCDBManager* cdb = AliCDBManager::Instance(); | |
10 | if(!cdb->IsDefaultStorageSet()) cdb->SetDefaultStorage("local://$ALICE_ROOT"); | |
11 | cdb->SetRun(0); | |
12 | ||
13 | AliCDBStorage* storage; | |
14 | ||
a24be56b | 15 | if( TString(gSystem->Getenv("TOCDB")) == TString("kTRUE") ){ |
6fce62af | 16 | TString Storage = gSystem->Getenv("STORAGE"); |
17 | if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) { | |
18 | Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data()); | |
19 | return; | |
20 | } | |
21 | storage = cdb->GetStorage(Storage.Data()); | |
22 | if(!storage){ | |
23 | Error(macroname,"Unable to open storage %s\n",Storage.Data()); | |
24 | return; | |
25 | } | |
26 | AliCDBPath path("GRP","Geometry","Data"); | |
27 | AliCDBEntry *entry = storage->Get(path.GetPath(),cdb->GetRun()); | |
28 | if(!entry) Fatal(macroname,"Could not get the specified CDB entry!"); | |
29 | entry->SetOwner(0); | |
30 | TGeoManager* geom = (TGeoManager*) entry->GetObject(); | |
31 | AliGeomManager::SetGeometry(geom); | |
32 | }else{ | |
33 | AliGeomManager::LoadGeometry(); //load geom from default CDB storage | |
34 | } | |
1895a097 | 35 | |
36 | Double_t globalZ = 0.005; // in cm, = 50 microns | |
37 | Double_t resFact = 0.7; | |
38 | Double_t spdXY = 0.0015*resFact; | |
39 | Double_t sddXYZ = 0.0030*resFact; | |
40 | Double_t ssdXY = 0.0020*resFact; | |
41 | Double_t rot = 0.018; | |
42 | ||
43 | Double_t spdZ = 0.002; | |
44 | Double_t ssdZ = 0.010; | |
45 | ||
46 | TRandom *rnd = new TRandom(65416087); | |
1895a097 | 47 | |
48 | Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; | |
ae079791 | 49 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
1895a097 | 50 | |
51 | Int_t j = 0; | |
7e154d52 | 52 | |
90dbf5fb | 53 | new(alobj[j++]) AliAlignObjParams("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); |
54 | AliAlignObjParams* its_alobj = (AliAlignObjParams*) array->UncheckedAt(0); | |
d3a9c52a | 55 | its_alobj->ApplyToGeometry(); |
56 | ||
1895a097 | 57 | |
ae079791 | 58 | for ( Int_t l = AliGeomManager::kSPD1; l <= AliGeomManager::kSSD2; l++) { |
1895a097 | 59 | |
ae079791 | 60 | printf("%i modules in layer %i\n", AliGeomManager::LayerSize(l), l); |
61 | for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(l); iModule++) { | |
1895a097 | 62 | |
63 | dpsi = rnd->Gaus(0., rot); | |
64 | dtheta = rnd->Gaus(0., rot); | |
65 | dphi = rnd->Gaus(0., rot); | |
66 | ||
ae079791 | 67 | iLayer = AliGeomManager::kInvalidLayer; |
1895a097 | 68 | |
69 | switch (l) { | |
70 | case 1: { | |
ae079791 | 71 | iLayer = AliGeomManager::kSPD1; |
1895a097 | 72 | dx = rnd->Gaus(0., spdXY); |
73 | dy = rnd->Gaus(0., spdXY); | |
74 | dz = rnd->Gaus(0., spdZ); | |
75 | }; break; | |
76 | case 2: { | |
ae079791 | 77 | iLayer = AliGeomManager::kSPD2; |
1895a097 | 78 | dx = rnd->Gaus(0., spdXY); |
79 | dy = rnd->Gaus(0., spdXY); | |
80 | dz = rnd->Gaus(0., spdZ); | |
81 | }; break; | |
82 | case 3: { | |
ae079791 | 83 | iLayer = AliGeomManager::kSDD1; |
1895a097 | 84 | dx = rnd->Gaus(0., sddXYZ); |
85 | dy = rnd->Gaus(0., sddXYZ); | |
86 | dz = rnd->Gaus(0., sddXYZ); | |
87 | }; break; | |
88 | case 4: { | |
ae079791 | 89 | iLayer = AliGeomManager::kSDD2; |
1895a097 | 90 | dx = rnd->Gaus(0., sddXYZ); |
91 | dy = rnd->Gaus(0., sddXYZ); | |
92 | dz = rnd->Gaus(0., sddXYZ); | |
93 | }; break; | |
94 | case 5: { | |
ae079791 | 95 | iLayer = AliGeomManager::kSSD1; |
1895a097 | 96 | dx = rnd->Gaus(0., ssdXY); |
97 | dy = rnd->Gaus(0., ssdXY); | |
98 | dz = rnd->Gaus(0., ssdZ); | |
99 | }; break; | |
100 | case 6: { | |
ae079791 | 101 | iLayer = AliGeomManager::kSSD2; |
1895a097 | 102 | dx = rnd->Gaus(0., ssdXY); |
103 | dy = rnd->Gaus(0., ssdXY); | |
104 | dz = rnd->Gaus(0., ssdZ); | |
105 | }; break; | |
106 | default: Printf("Wrong layer index in ITS (%d) !",l); | |
107 | }; | |
ae079791 | 108 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule); |
109 | const char *symname = AliGeomManager::SymName(volid); | |
1895a097 | 110 | |
90dbf5fb | 111 | new(alobj[j]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); |
1895a097 | 112 | j++; |
113 | ||
114 | } | |
115 | } | |
116 | ||
a24be56b | 117 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 118 | // save on file |
dfe9c69d | 119 | const char* filename = "ITSresidualMisalignment.root"; |
120 | TFile f(filename,"RECREATE"); | |
121 | if(!f){ | |
122 | Error(macroname,"cannot open file for output\n"); | |
123 | return; | |
124 | } | |
125 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
126 | f.cd(); | |
1895a097 | 127 | f.WriteObject(array,"ITSAlignObjs","kSingleKey"); |
128 | f.Close(); | |
129 | }else{ | |
130 | // save in CDB storage | |
1895a097 | 131 | AliCDBMetaData *md= new AliCDBMetaData(); |
132 | md->SetResponsible("Ludovic Gaudichet"); | |
133 | md->SetComment("Alignment objects with actual ITS misalignment"); | |
5bd470e1 | 134 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 135 | AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 136 | storage->Put(array,id, md); |
137 | } | |
138 | ||
139 | array->Delete(); | |
140 | ||
141 | } | |
142 | ||
143 |