Bug fix by Markus
[u/mrichter/AliRoot.git] / T0 / MakeT0FullMisAlignment.C
CommitLineData
dc7ca31d 1void MakeT0FullMisAlignment(){
2 // Create TClonesArray of full misalignment objects for T0
3 //
90dbf5fb 4 TClonesArray *array = new TClonesArray("AliAlignObjParams",30);
dc7ca31d 5 TClonesArray &alobj = *array;
6
dc7ca31d 7 Double_t dx, dy, dz, dpsi, dtheta, dphi;
8 TRandom *rnd = new TRandom(4321);
d3a9c52a 9 Double_t sigmatr = 0.05; // sigma for shifts in cm
10 Double_t sigmarot = 0.3; // sigma for tilts in degrees
dc7ca31d 11
d3a9c52a 12 TString symName, sn;
dc7ca31d 13
d3a9c52a 14 Int_t iIndex=0;
ae079791 15 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
32236ea7 16 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
17
18 Int_t j=0;
19 for (Int_t imod=0; imod<24; imod++){
20 if (imod < 12){
21 sn="T0/C/PMT";
22 }else{
23 sn="T0/A/PMT";
24 }
25 symName = sn;
26 symName += imod+1;
27
28 dx = rnd->Gaus(0.,sigmatr);
29 dy = rnd->Gaus(0.,sigmatr);
30 dz = rnd->Gaus(0.,sigmatr);
31 dpsi = rnd->Gaus(0.,sigmarot);
32 dtheta = rnd->Gaus(0.,sigmarot);
33 dphi = rnd->Gaus(0.,sigmarot);
34
35 new(alobj[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi,
36dtheta, dphi, kTRUE);
37 }
38
39 const char* macroname = "MakeT0FullMisAlignment.C";
40 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
41 // save on file
42 const char* filename = "T0fullMisalignment.root";
43 TFile f(filename,"RECREATE");
44 if(!f){
45 Error(macroname,"cannot open file for output\n");
46 return;
47 }
48 Info(macroname,"Saving alignment objects to the file %s", filename);
49 f.cd();
50 f.WriteObject(array,"T0AlignObjs","kSingleKey");
51 f.Close();
52 }else{
53
54 // save in CDB storage
55 TString Storage = gSystem->Getenv("STORAGE");
56 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
57 Error(macroname,"STORAGE variable set to %s is not valid.
58Exiting\n",Storage.Data());
59 return;
60 }
61 Info(macroname,"Saving alignment objects in CDB storage %s",
62 Storage.Data());
63 AliCDBManager* cdb = AliCDBManager::Instance();
64 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
65 if(!storage){
66 Error(macroname,"Unable to open storage %s\n",Storage.Data());
67 return;
68 }
69 AliCDBMetaData* md = new AliCDBMetaData();
70 md->SetResponsible("Tomasz Malkiewicz");
71 md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and
72sigmarot=0.3 in the local RS");
73 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
74 AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
75 storage->Put(array,id,md);
76 }
77
78 array->Delete();
79}
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104void MakeT0FullMisAlignment(){
105 // Create TClonesArray of full misalignment objects for T0
106 //
107 TClonesArray *array = new TClonesArray("AliAlignObjParams",30);
108 TClonesArray &alobj = *array;
109
110 Double_t dx, dy, dz, dpsi, dtheta, dphi;
111 TRandom *rnd = new TRandom(4321);
112 Double_t sigmatr = 0.05; // sigma for shifts in cm
113 Double_t sigmarot = 0.3; // sigma for tilts in degrees
114
115 TString symName, sn;
116
117 Int_t iIndex=0;
118 AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
ae079791 119 UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
dc7ca31d 120
d3a9c52a 121 Int_t j=0;
122 for (Int_t imod=0; imod<24; imod++){
123 if (imod < 12){
124 sn="T0/C/PMT";
125 }else{
126 sn="T0/A/PMT";
127 }
128 symName = sn;
129 symName += imod+1;
130
131 dx = rnd->Gaus(0.,sigmatr);
132 dy = rnd->Gaus(0.,sigmatr);
133 dz = rnd->Gaus(0.,sigmatr);
134 dpsi = rnd->Gaus(0.,sigmarot);
135 dtheta = rnd->Gaus(0.,sigmarot);
136 dphi = rnd->Gaus(0.,sigmarot);
137
90dbf5fb 138 new(alobj[j++]) AliAlignObjParams(symName.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
d3a9c52a 139 }
140
dfe9c69d 141 const char* macroname = "MakeT0FullMisAlignment.C";
142 if( TString(gSystem->Getenv("TOCDB")) != TString("kTRUE") ){
dc7ca31d 143 // save on file
dfe9c69d 144 const char* filename = "T0fullMisalignment.root";
145 TFile f(filename,"RECREATE");
146 if(!f){
147 Error(macroname,"cannot open file for output\n");
148 return;
149 }
150 Info(macroname,"Saving alignment objects to the file %s", filename);
dc7ca31d 151 f.cd();
dfe9c69d 152 f.WriteObject(array,"T0AlignObjs","kSingleKey");
153 f.Close(); TFile f(filename,"RECREATE");
dc7ca31d 154 }else{
155 // save in CDB storage
dfe9c69d 156 TString Storage = gSystem->Getenv("STORAGE");
157 if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
158 Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
159 return;
160 }
161 Info(macroname,"Saving alignment objects in CDB storage %s",
162 Storage.Data());
dc7ca31d 163 AliCDBManager* cdb = AliCDBManager::Instance();
dfe9c69d 164 AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
165 if(!storage){
166 Error(macroname,"Unable to open storage %s\n",Storage.Data());
167 return;
168 }
dc7ca31d 169 AliCDBMetaData* md = new AliCDBMetaData();
170 md->SetResponsible("Tomasz Malkiewicz");
171 md->SetComment("Full misalignment for T0, produced with sigmatr=0.05 and sigmarot=0.3 in the local RS");
8d0a15a4 172 md->SetAliRootVersion(gSystem->Getenv("$ARVERSION"));
dfe9c69d 173 AliCDBId id("T0/Align/Data",0,AliCDBRunRange::Infinity());
dc7ca31d 174 storage->Put(array,id,md);
175 }
176
177 array->Delete();
178
179}
180