]>
Commit | Line | Data |
---|---|---|
1895a097 | 1 | void MakeITSFullMisAlignment(){ |
2 | // Create TClonesArray of full misalignment objects for ITS | |
3 | // | |
90dbf5fb | 4 | TClonesArray *array = new TClonesArray("AliAlignObjParams",4000); |
1895a097 | 5 | TClonesArray &alobj = *array; |
6fce62af | 6 | const char* macroname = "MakeITSFullMisAlignment.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 | |
a2de6586 | 36 | Double_t globalZ = 0.015; // in cm, = 150 microns |
37 | Double_t mecanicalPrec = 0.0020; | |
38 | ||
39 | Double_t resFact = 0.; | |
1895a097 | 40 | Double_t spdXY = 0.0015*resFact; |
41 | Double_t sddXYZ = 0.0030*resFact; | |
42 | Double_t ssdXY = 0.0020*resFact; | |
43 | Double_t rot = 0.018; | |
44 | ||
45 | Double_t spdZ = 0.002; | |
46 | Double_t ssdZ = 0.010; | |
47 | ||
a2de6586 | 48 | |
1895a097 | 49 | TRandom *rnd = new TRandom(65416087); |
1895a097 | 50 | |
51 | Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.; | |
52 | ||
53 | Int_t j = 0; | |
90dbf5fb | 54 | new(alobj[j++]) AliAlignObjParams("ITS", 0, dx, dy, globalZ, dpsi, dtheta, dphi, kTRUE); |
55 | AliAlignObjParams* its_alobj = (AliAlignObjParams*) array->UncheckedAt(0); | |
d3a9c52a | 56 | its_alobj->ApplyToGeometry(); |
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 | AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; |
1895a097 | 68 | switch (l) { |
69 | case 1: { | |
ae079791 | 70 | iLayer = AliGeomManager::kSPD1; |
a2de6586 | 71 | dx = rnd->Gaus(0., spdXY + mecanicalPrec); |
72 | dy = rnd->Gaus(0., spdXY + mecanicalPrec); | |
73 | dz = rnd->Gaus(0., spdZ + mecanicalPrec); | |
1895a097 | 74 | }; break; |
75 | case 2: { | |
ae079791 | 76 | iLayer = AliGeomManager::kSPD2; |
a2de6586 | 77 | dx = rnd->Gaus(0., spdXY + mecanicalPrec); |
78 | dy = rnd->Gaus(0., spdXY + mecanicalPrec); | |
79 | dz = rnd->Gaus(0., spdZ + mecanicalPrec); | |
1895a097 | 80 | }; break; |
81 | case 3: { | |
ae079791 | 82 | iLayer = AliGeomManager::kSDD1; |
a2de6586 | 83 | dx = rnd->Gaus(0., sddXYZ + mecanicalPrec); |
84 | dy = rnd->Gaus(0., sddXYZ + mecanicalPrec); | |
85 | dz = rnd->Gaus(0., sddXYZ + mecanicalPrec); | |
1895a097 | 86 | }; break; |
87 | case 4: { | |
ae079791 | 88 | iLayer = AliGeomManager::kSDD2; |
a2de6586 | 89 | dx = rnd->Gaus(0., sddXYZ + mecanicalPrec); |
90 | dy = rnd->Gaus(0., sddXYZ + mecanicalPrec); | |
91 | dz = rnd->Gaus(0., sddXYZ + mecanicalPrec); | |
1895a097 | 92 | }; break; |
93 | case 5: { | |
ae079791 | 94 | iLayer = AliGeomManager::kSSD1; |
a2de6586 | 95 | dx = rnd->Gaus(0., ssdXY + mecanicalPrec); |
96 | dy = rnd->Gaus(0., ssdXY + mecanicalPrec); | |
97 | dz = rnd->Gaus(0., ssdZ + mecanicalPrec); | |
1895a097 | 98 | }; break; |
99 | case 6: { | |
ae079791 | 100 | iLayer = AliGeomManager::kSSD2; |
a2de6586 | 101 | dx = rnd->Gaus(0., ssdXY + mecanicalPrec); |
102 | dy = rnd->Gaus(0., ssdXY + mecanicalPrec); | |
103 | dz = rnd->Gaus(0., ssdZ + mecanicalPrec); | |
1895a097 | 104 | }; break; |
105 | default: Printf("Wrong layer index in ITS (%d) !",l); | |
106 | }; | |
ae079791 | 107 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule); |
108 | const char *symname = AliGeomManager::SymName(volid); | |
1895a097 | 109 | |
90dbf5fb | 110 | new(alobj[j++]) AliAlignObjParams(symname, volid, dx, dy, dz, dpsi, dtheta, dphi, kFALSE); |
1895a097 | 111 | |
112 | } | |
113 | } | |
114 | ||
a24be56b | 115 | if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){ |
1895a097 | 116 | // save on file |
dfe9c69d | 117 | const char* filename = "ITSfullMisalignment.root"; |
118 | TFile f(filename,"RECREATE"); | |
119 | if(!f){ | |
120 | Error(macroname,"cannot open file for output\n"); | |
121 | return; | |
122 | } | |
123 | Info(macroname,"Saving alignment objects to the file %s", filename); | |
124 | f.cd(); | |
1895a097 | 125 | f.WriteObject(array,"ITSAlignObjs","kSingleKey"); |
126 | f.Close(); | |
127 | }else{ | |
128 | // save in CDB storage | |
1895a097 | 129 | AliCDBMetaData *md= new AliCDBMetaData(); |
130 | md->SetResponsible("Ludovic Gaudichet"); | |
131 | md->SetComment("Alignment objects with actual ITS misalignment"); | |
5bd470e1 | 132 | md->SetAliRootVersion(gSystem->Getenv("ARVERSION")); |
dfe9c69d | 133 | AliCDBId id("ITS/Align/Data",0,AliCDBRunRange::Infinity()); |
1895a097 | 134 | storage->Put(array,id, md); |
135 | } | |
136 | ||
137 | array->Delete(); | |
138 | ||
139 | } | |
140 | ||
141 | ||
a2de6586 | 142 |