AliRoot Core  edcc906 (edcc906)
AliEMCALSetAlignment.C
Go to the documentation of this file.
1 
18 #if !defined(__CINT__)
19 #include <TControlBar.h>
20 #include <TString.h>
21 #include <TRandom.h>
22 #include <TStyle.h>
23 #include <TH2.h>
24 #include <TF1.h>
25 #include <TCanvas.h>
26 
27 #include "AliRun.h"
28 #include "AliAlignObjParams.h"
29 #include "AliCDBMetaData.h"
30 #include "AliCDBId.h"
31 #include "AliCDBEntry.h"
32 #include "AliCDBManager.h"
33 #include "AliCDBStorage.h"
34 #endif
35 
39 //------------------------------------------------------------------------
40 
42 {
43  TControlBar *menu = new TControlBar("vertical","EMCAL alignment control");
44  menu->AddButton("Help to run EMCAL alignment control","Help()",
45  "Explains how to use EMCAL alignment control menus");
46 
47  menu->AddButton("Ideal geometry","IdealAlignment()",
48  "Set ideal EMCAL geometry with zero displacement");
49  menu->AddButton("Misaligned geometry","FullMisalignment()",
50  "Set EMCAL geometry with large displacement");
51  menu->AddButton("Residual misaligned geometry","ResidualAlignment()",
52  "Set EMCAL geometry with small residual displacement");
53 
54  menu->Show();
55 }
56 
57 //------------------------------------------------------------------------
58 void Help()
59 {
60  printf("\n\n\nSet EMCAL alignment parameters and write them into ALICE CDB."
61  "Press button \"Ideal geometry\" to create EMCAL geometry with ideal geometry."
62  "Press button \"Misaligned geometry\" to create EMCAL geometry with fully displaced"
63  " and disorientated geometry."
64  "Press button \"Residual misaligned geometry\" to create EMCAL geometry with"
65  "infinitesimal displacement and disorientation\n\n\n");
66 }
67 
71 //------------------------------------------------------------------------
73 {
74  // ************************* 1st step ***************
75  // Create TClonesArray of alignment objects for EMCAL
76 
77  TClonesArray *array = new TClonesArray("AliAlignObjParams",20);
78  TClonesArray &alobj = *array;
79 
81 
82  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
83  // null shifts and rotations
84 
85  UShort_t iIndex=0;
87  UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
88 
89  //
90  // EMCAL
91  //
92  TString basePath = "EMCAL/FullSupermodule";
93  for (Int_t iModule = 0; iModule < 10; iModule++)
94  {
95  TString newPath = basePath;
96  newPath += iModule+1;
97  new(alobj[iModule]) AliAlignObjParams(newPath.Data(),
98  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
99  }
100 
101  //1/3 SMs
102  new(alobj[10]) AliAlignObjParams("EMCAL/OneThrdSupermodule1",
103  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
104  new(alobj[11]) AliAlignObjParams("EMCAL/OneThrdSupermodule2",
105  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
106  //
107  // DCal
108  //
109  basePath = "EMCAL/DCALSupermodule";
110  for (Int_t iModule = 0; iModule < 6; iModule++)
111  {
112  TString newPath = basePath;
113  newPath += iModule+1;
114  new(alobj[12+iModule]) AliAlignObjParams(newPath.Data(),
115  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
116  }
117 
118  //1/3 SMs
119  new(alobj[18]) AliAlignObjParams("EMCAL/OneThrdSupermodule3",
120  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
121  new(alobj[19]) AliAlignObjParams("EMCAL/OneThrdSupermodule4",
122  dvoluid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
123 
124 
125  // ************************* 2nd step ***************
126  // Make CDB storage and put TClonesArray in
127  //
129  CDB->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
130 
131  AliCDBMetaData *md= new AliCDBMetaData();
132  md->SetResponsible("EMCAL Expert");
133  md->SetComment("Alignment objects for ideal geometry, i.e. applying them to TGeo has to leave geometry unchanged");
134  AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
135  CDB->Put(array,id, md);
136 }
137 
141 //------------------------------------------------------------------------
143 {
144  // ************************* 1st step ***************
145  // Create TClonesArray of alignment objects for EMCAL
146 
147  TClonesArray *array = new TClonesArray("AliAlignObjParams",20);
148  TClonesArray &alobj = *array;
149 
151 
152  UShort_t iIndex=0;
154  UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
155 
156  Double_t sigmaTrans = 0.01; Double_t sigmaRot = 0.001;
157  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
158 
159  TRandom *pRnd = new TRandom(4357);
160 
161  //
162  // EMCAL
163  //
164  TString basePath = "EMCAL/FullSupermodule";
165  for(Int_t iSM = 0; iSM < 10; iSM++)
166  {
167  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
168  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
169  TString newPath = basePath;
170  newPath += iSM + 1;
171  new(alobj[iSM]) AliAlignObjParams(newPath.Data(),
172  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
173  }
174 
175  //1/3 SMs
176  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
177  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
178  new(alobj[10]) AliAlignObjParams("EMCAL/HalfSupermodule1",
179  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
180 
181  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
182  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
183  new(alobj[11]) AliAlignObjParams("EMCAL/HalfSupermodule2",
184  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
185 
186  //
187  // DCal
188  //
189  basePath = "EMCAL/DCALSupermodule";
190  for(Int_t iSM = 0; iSM < 6; iSM++)
191  {
192  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
193  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
194  TString newPath = basePath;
195  newPath += iSM + 1;
196  new(alobj[12+iSM]) AliAlignObjParams(newPath.Data(),
197  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
198  }
199 
200  //1/3 SMs
201  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
202  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
203  new(alobj[18]) AliAlignObjParams("EMCAL/HalfSupermodule4",
204  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
205 
206  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
207  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
208  new(alobj[19]) AliAlignObjParams("EMCAL/HalfSupermodule3",
209  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
210 
211 
212  // ************************* 2nd step ***************
213  // Make CDB storage and put TClonesArray in
214  //
216  CDB->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
217 
218  AliCDBMetaData *md= new AliCDBMetaData();
219  md->SetResponsible("EMCAL Expert");
220  md->SetComment("Alignment objects for slightly misaligned geometry, i.e. applying them to TGeo has to distirbes geometry very little (resisual misalignment");
221  AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
222  CDB->Put(array,id, md);
223 }
224 
227 //------------------------------------------------------------------------
229 {
230  // ************************* 1st step ***************
231  // Create TClonesArray of alignment objects for EMCAL
232 
233  TClonesArray *array = new TClonesArray("AliAlignObjParams",20);
234  TClonesArray &alobj = *array;
235 
237 
238  UShort_t iIndex=0;
240  UShort_t dvoluid = AliGeomManager::LayerToVolUID(iLayer,iIndex); //dummy volume identity
241 
242 
243  Double_t sigmaTrans = 10.; Double_t sigmaRot = 0.1;
244  Double_t dx=0., dy=0., dz=0., dpsi=0., dtheta=0., dphi=0.;
245 
246  TRandom *pRnd = new TRandom(4357);
247 
248  //
249  // EMCAL
250  //
251  TString basePath = "EMCAL/FullSupermodule";
252  for(Int_t iSM = 0; iSM < 10; iSM++)
253  {
254  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
255  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
256  TString newPath = basePath;
257  newPath += iSM + 1;
258  new(alobj[iSM]) AliAlignObjParams(newPath.Data(),
259  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
260  }
261 
262  //1/3 SMs
263  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
264  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
265  new(alobj[10]) AliAlignObjParams("EMCAL/HalfSupermodule1",
266  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
267 
268  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
269  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
270  new(alobj[11]) AliAlignObjParams("EMCAL/HalfSupermodule2",
271  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
272 
273  //
274  // DCAL
275  //
276  for(Int_t iSM = 0; iSM < 6; iSM++)
277  {
278  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
279  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
280  TString newPath = basePath;
281  newPath += iSM + 1;
282  new(alobj[12+iSM]) AliAlignObjParams(newPath.Data(),
283  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
284  }
285 
286  //1/3 SMs
287  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
288  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
289  new(alobj[18]) AliAlignObjParams("EMCAL/HalfSupermodule1",
290  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
291 
292  dx = pRnd->Gaus(0,sigmaTrans); dy = pRnd->Gaus(0,sigmaTrans); dz = pRnd->Gaus(0,sigmaTrans);
293  dpsi = pRnd->Gaus(0,sigmaRot); dtheta = pRnd->Gaus(0,sigmaRot); dphi = pRnd->Gaus(0,sigmaRot);
294  new(alobj[19]) AliAlignObjParams("EMCAL/HalfSupermodule2",
295  dvoluid, dx,dy,dz,dpsi,dtheta,dphi, kTRUE);
296 
297 
298  // ************************* 2nd step ***************
299  // Make CDB storage and put TClonesArray in
300  //
302  CDB->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
303 
304  AliCDBMetaData *md= new AliCDBMetaData();
305  md->SetResponsible("EMCAL Expert");
306  md->SetComment("Alignment objects for fully misaligned geometry, i.e. applying them to TGeo has to distirbes geometry very much");
307  AliCDBId id("EMCAL/Align/Data",0,AliCDBRunRange::Infinity());
308  CDB->Put(array,id, md);
309 }
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
void ResidualAlignment()
void AliEMCALSetAlignment()
void SetComment(const char *comment)
void IdealAlignment()
void SetResponsible(const char *yourName)
TObjArray * array
Definition: AnalyzeLaser.C:12
Bool_t Put(TObject *object, const AliCDBId &id, AliCDBMetaData *metaData, const char *mirrors="", DataType type=kPrivate)
void SetDefaultStorage(const char *dbString)
void Help()
static UShort_t LayerToVolUID(ELayerID layerId, Int_t modId)
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
void FullMisalignment()
Create alignment objects for EMCAL with fully misaligned geometry.
static Int_t Infinity()