Reading muon trigger scalers with the DA of the muon trigger and transfer
[u/mrichter/AliRoot.git] / PHOS / MakePHOSFullMisAlignment.C
... / ...
CommitLineData
1void MakePHOSFullMisAlignment()
2{
3 // Create misalignment object for PHOS module 2,3,3
4 // from the survey measurements on P2 in August 2009.
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 // Modified: Yuri Kharlov, 11.03.2010
10
11 const char * macroName = "MakePHOS2Alignment";
12
13 const AliPHOSGeometry *phosGeom = AliPHOSGeometry::GetInstance("IHEP", "IHEP");
14 if (!phosGeom) {
15 Error(macroName, "Cannot obtain AliPHOSGeometry singleton.\n");
16 return;
17 }
18
19 AliPHOSEMCAGeometry * emca = phosGeom->GetEMCAGeometry();
20 TClonesArray alobj("AliAlignObjParams", 16);// + phosGeom->GetNModules() * emca->GetNStripX() *
21 // emca->GetNStripZ());
22
23 const Double_t dpsi = 0., dtheta = 0., dphi = 0.;
24 const Double_t displacement = 10.;
25 Int_t iIndex = 0; //let all modules have index=0 in a layer with no LUT
26 const AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
27 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer, iIndex);
28 Int_t i = 0;
29
30 // Alignment for 5 PHOS modules
31
32 TString surveyFileName;
33
34 const Char_t * szEnv = gSystem->Getenv("ALICE_ROOT");
35 if (szEnv && szEnv[0]) {
36 surveyFileName += szEnv;
37 if (surveyFileName[surveyFileName.Length() - 1] != '/')
38 surveyFileName += '/';
39 } else {
40 Warning(macroName, "cannot find ALICE_ROOT environment variable\n"
41 "probably, I wan't be able to find survey file");
42 }
43
44 surveyFileName += "PHOS/data/Survey_1053236_PHOS.txt";
45
46 AliSurveyObj survey;
47 survey.FillFromLocalFile(surveyFileName.Data());
48 TGeoHMatrix module3Delta, module2Delta, module1Delta;
49 AliPHOSModuleMisalignment delta(*phosGeom);
50
51 delta.DeltaTransformation(0, survey.GetData(), "410000", "410027", "424000",
52 &module1Delta);
53 new(alobj[i++]) AliAlignObjParams("PHOS/Module1", volid, module1Delta, kTRUE);
54
55 delta.DeltaTransformation(1, survey.GetData(), "310000", "310027", "324000",
56 &module2Delta);
57 new(alobj[i++]) AliAlignObjParams("PHOS/Module2", volid, module2Delta, kTRUE);
58
59 delta.DeltaTransformation(2, survey.GetData(), "210000", "210027", "224000",
60 &module3Delta);
61 new(alobj[i++]) AliAlignObjParams("PHOS/Module3", volid, module3Delta, kTRUE);
62
63 new(alobj[i++]) AliAlignObjParams("PHOS/Module4", volid, 0., 0., 0., 0., 0., 0., kTRUE);
64
65 new(alobj[i++]) AliAlignObjParams("PHOS/Module5", volid, 0., 0., 0., 0., 0., 0., kTRUE);
66
67 const Double_t dx = 0., dy = 0., dz = 0. ;
68 // Alignment of CPV modules
69 new(alobj[i++]) AliAlignObjParams("PHOS/Module1/CPV",
70 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
71 new(alobj[i++]) AliAlignObjParams("PHOS/Module2/CPV",
72 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
73 new(alobj[i++]) AliAlignObjParams("PHOS/Module3/CPV",
74 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
75 new(alobj[i++]) AliAlignObjParams("PHOS/Module4/CPV",
76 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
77 new(alobj[i++]) AliAlignObjParams("PHOS/Module5/CPV",
78 volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
79
80 // Alignment for PHOS cradle
81 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle0",
82 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
83 new(alobj[i++]) AliAlignObjParams("PHOS/Cradle1",
84 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
85
86 // Alignment for cradle wheels
87 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel0",
88 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
89 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel1",
90 volid, 0., 0., -displacement, dpsi, dtheta, dphi, kTRUE);
91 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel2",
92 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
93 new(alobj[i++]) AliAlignObjParams("PHOS/Wheel3",
94 volid, 0., 0., +displacement, dpsi, dtheta, dphi, kTRUE);
95
96 // ************************* 2nd step ***************
97 if ( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ) {
98 // save on file
99 const char * fileName = "PHOSfullMisalignment.root";
100 TFile f(fileName,"RECREATE");
101 if (!f) {
102 Error(macroName, "cannot open file for output\n");
103 return;
104 }
105
106 Info(macroName,"Saving alignment objects to the file %s", fileName);
107 f.cd();
108 f.WriteObject(&alobj,"PHOSAlignObjs","kSingleKey");
109 f.Close();
110 }else{
111 // save in CDB storage
112 TString storageENV = gSystem->Getenv("STORAGE");
113 if(!storageENV.BeginsWith("local://") && !storageENV.BeginsWith("alien://")) {
114 Error(macroName,"STORAGE variable set to %s is not valid. Exiting\n", storageENV.Data());
115 return;
116 }
117
118 Info(macroName,"Saving alignment objects in CDB storage %s", storageENV.Data());
119 AliCDBManager * cdb = AliCDBManager::Instance();
120 AliCDBStorage * storage = cdb->GetStorage(storageENV.Data());
121 if (!storage) {
122 Error(macroName, "Unable to open storage %s\n", storageENV.Data());
123 return;
124 }
125
126 AliCDBMetaData md;
127 md.SetResponsible("Yuri Kharlov");
128 md.SetComment("Alignment objects for PHOS modules 2,3,4; survey in August 2009");
129 md.SetAliRootVersion(gSystem->Getenv("ARVERSION"));
130 AliCDBId id("PHOS/Align/Data",0,AliCDBRunRange::Infinity());
131 storage->Put(&alobj, id, &md);
132 }
133
134 alobj.Delete();
135}