]>
Commit | Line | Data |
---|---|---|
a65a7e70 | 1 | void MakePHOSAlignmentModule2() |
2 | { | |
3 | // Create misalignment object for PHOS module 2 | |
4 | // from the survey measurements on P2 in May 2008. | |
5 | // To store alignment in OCDB, define the evnironment variables: | |
6 | // TOCDB=kTRUE | |
7 | // STORAGE="local://$ALICE_ROOT/OCDB" | |
8 | // Author: Timur Pocheptsov, 19.06.2008 | |
9 | ||
10 | const char * macroName = "MakePHOS2Alignment"; | |
11 | ||
12 | const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP"); | |
13 | if (!phosGeom) { | |
14 | Error(macroName, "Cannot obtain AliPHOSGeometry singleton.\n"); | |
15 | return; | |
16 | } | |
17 | ||
18 | //Activate CDB storage and load geometry from CDB | |
19 | //I need valid gGeoManager to create local transformations. | |
20 | ||
21 | //[Part of code, taken from ITS version of MakexxxFullMisalignment | |
22 | AliCDBManager * cdb = AliCDBManager::Instance(); | |
23 | if (!cdb->IsDefaultStorageSet()) | |
24 | cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); | |
25 | cdb->SetRun(0); | |
26 | ||
27 | if (TString(gSystem->Getenv("TOCDB")) == TString("kTRUE")) { | |
28 | const TString storageENV(gSystem->Getenv("STORAGE")); | |
29 | if (!storageENV.BeginsWith("local://") && !storageENV.BeginsWith("alien://")) { | |
30 | Error(macroName, "STORAGE variable set to %s is not valid.\n", storageENV.Data()); | |
31 | return; | |
32 | } | |
33 | ||
34 | AliCDBStorage * storage = cdb->GetStorage(storageENV.Data()); | |
35 | if (!storage) { | |
36 | Error(macroName, "Unable to open storage %s.\n", storageENV.Data()); | |
37 | return; | |
38 | } | |
39 | ||
40 | AliCDBPath path("GRP","Geometry","Data"); | |
41 | AliCDBEntry * entry = storage->Get(path.GetPath(), cdb->GetRun()); | |
42 | if (!entry) { | |
43 | Error(macroName,"Could not get the specified CDB entry!"); | |
44 | return; | |
45 | } | |
46 | ||
47 | entry->SetOwner(0); | |
48 | AliGeomManager::SetGeometry((TGeoManager*) entry->GetObject()); | |
49 | }else{ | |
50 | AliGeomManager::LoadGeometry("geometry.root"); //load geom from default CDB storage | |
51 | } | |
52 | //end of code taken from ITS version of MakexxxFullMisalignment] | |
53 | ||
54 | AliPHOSEMCAGeometry * emca = phosGeom->GetEMCAGeometry(); | |
55 | TClonesArray alobj("AliAlignObjParams", 16);// + phosGeom->GetNModules() * emca->GetNStripX() * emca->GetNStripZ()); | |
56 | ||
57 | const Double_t dpsi = 0., dtheta = 0., dphi = 0.; | |
58 | const Double_t displacement = 10.; | |
59 | Int_t iIndex = 0; //let all modules have index=0 in a layer with no LUT | |
60 | const AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer; | |
61 | UShort_t volid = AliGeomManager::LayerToVolUID(iLayer, iIndex); | |
62 | Int_t i = 0; | |
63 | ||
64 | // Alignment for 5 PHOS modules | |
65 | ||
66 | new(alobj[i++]) AliAlignObjParams("PHOS/Module1", | |
67 | volid, 0., 0., 0., 0., 0., 0., kTRUE); | |
68 | new(alobj[i++]) AliAlignObjParams("PHOS/Module2", | |
69 | volid, 0., 0., 0., 0., 0., 0., kTRUE); | |
70 | ||
71 | Double_t rotMatrix[9] = {0.999992695, -0.00295322, -0.0024267, | |
72 | 0.002955489, 0.999995199, 0.00093165, | |
73 | 0.002423942, -0.000938811, 0.99999662}; | |
74 | TGeoRotation rotation; | |
75 | rotation.SetMatrix(rotMatrix); | |
76 | Double_t dX=1.25474126, dY=-1.4088643, dZ=-12.856; | |
77 | AliAlignObjParams * mod3 = | |
78 | new(alobj[i++]) AliAlignObjParams("PHOS/Module3", volid, dX, dY, dZ, 0., 0., 0., kFALSE); | |
79 | mod3->SetRotation(rotation); | |
80 | ||
81 | new(alobj[i++]) AliAlignObjParams("PHOS/Module4", | |
82 | volid, 0., 0., 0., 0., 0., 0., kTRUE); | |
83 | new(alobj[i++]) AliAlignObjParams("PHOS/Module5", | |
84 | volid, 0., 0., 0., 0., 0., 0., kTRUE); | |
85 | ||
86 | const Double_t dx = 0., dy = 0., dz = 0. ; | |
87 | // Alignment of CPV modules | |
88 | new(alobj[i++]) AliAlignObjParams("PHOS/Module1/CPV", | |
89 | volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
90 | new(alobj[i++]) AliAlignObjParams("PHOS/Module2/CPV", | |
91 | volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
92 | new(alobj[i++]) AliAlignObjParams("PHOS/Module3/CPV", | |
93 | volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
94 | new(alobj[i++]) AliAlignObjParams("PHOS/Module4/CPV", | |
95 | volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
96 | new(alobj[i++]) AliAlignObjParams("PHOS/Module5/CPV", | |
97 | volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE); | |
98 | ||
99 | // Alignment for PHOS cradle | |
100 | new(alobj[i++]) AliAlignObjParams("PHOS/Cradle0", | |
101 | volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE); | |
102 | new(alobj[i++]) AliAlignObjParams("PHOS/Cradle1", | |
103 | volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE); | |
104 | ||
105 | // Alignment for cradle wheels | |
106 | new(alobj[i++]) AliAlignObjParams("PHOS/Wheel0", | |
107 | volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE); | |
108 | new(alobj[i++]) AliAlignObjParams("PHOS/Wheel1", | |
109 | volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE); | |
110 | new(alobj[i++]) AliAlignObjParams("PHOS/Wheel2", | |
111 | volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE); | |
112 | new(alobj[i++]) AliAlignObjParams("PHOS/Wheel3", | |
113 | volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE); | |
114 | ||
115 | // ************************* 2nd step *************** | |
116 | if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) { | |
117 | // save on file | |
118 | const char * fileName = "PHOSfullMisalignment.root"; | |
119 | TFile f(fileName,"RECREATE"); | |
120 | if (!f) { | |
121 | Error(macroName, "cannot open file for output\n"); | |
122 | return; | |
123 | } | |
124 | ||
125 | Info(macroName,"Saving alignment objects to the file %s", fileName); | |
126 | f.cd(); | |
127 | f.WriteObject(&alobj,"PHOSAlignObjs","kSingleKey"); | |
128 | f.Close(); | |
129 | }else{ | |
130 | // save in CDB storage | |
131 | TString storageENV = gSystem->Getenv("STORAGE"); | |
132 | if(!storageENV.BeginsWith("local://") && !storageENV.BeginsWith("alien://")) { | |
133 | Error(macroName,"STORAGE variable set to %s is not valid. Exiting\n", storageENV.Data()); | |
134 | return; | |
135 | } | |
136 | ||
137 | Info(macroName,"Saving alignment objects in CDB storage %s", storageENV.Data()); | |
138 | AliCDBManager * cdb = AliCDBManager::Instance(); | |
139 | AliCDBStorage * storage = cdb->GetStorage(storageENV.Data()); | |
140 | if (!storage) { | |
141 | Error(macroName, "Unable to open storage %s\n", storageENV.Data()); | |
142 | return; | |
143 | } | |
144 | ||
145 | AliCDBMetaData md; | |
146 | md.SetResponsible("Timur Pocheptsov"); | |
147 | md.SetComment("Alignment objects for PHOS module 2; survey in May 2008"); | |
148 | md.SetAliRootVersion(gSystem->Getenv("ARVERSION")); | |
149 | AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity()); | |
150 | storage->Put(&alobj, id, &md); | |
151 | } | |
152 | ||
153 | alobj.Delete(); | |
154 | } |