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