3 // Script to create alignment parameters and store them into CDB
4 // Two sets of alignment parameters can be created:
5 // 1) 1 PHOS module with exact position
6 // 2) 5 PHOS modules with small disalignments
9 #include "TControlBar.h"
16 #include "AliPHOSAlignData.h"
17 #include "AliCDBMetaData.h"
19 #include "AliCDBEntry.h"
20 #include "AliCDBManager.h"
21 #include "AliCDBStorage.h"
25 void AliPHOSSetAlignment()
27 TControlBar *menu = new TControlBar("vertical","PHOS alignment control");
28 menu->AddButton("Help to run PHOS alignment control","Help()",
29 "Explains how to use PHOS alignment control menus");
30 menu->AddButton("PHOS 2007","SetAlignment(0)",
31 "Set PHOS alignment for the LHC run 2007");
32 menu->AddButton("Full PHOS","SetAlignment(1)",
33 "Set all 5 modules with random displacement");
34 menu->AddButton("Read PHOS 2007","GetAlignment(0)",
35 "Read PHOS geometry for the LHC run 2007");
36 menu->AddButton("Read full PHOS","GetAlignment(1)",
37 "Read full PHOS geometry with random displacements");
41 //------------------------------------------------------------------------
45 "\nSet PHOS alignment parameters and write them into ALICE CDB.
46 Press button \"PHOS 2007\" to create PHOS geometry for the first LHC run in 2007.
47 Press button \"Full PHOS\" to create full PHOS geometry with radnomly displaced modules\n";
51 //------------------------------------------------------------------------
52 void SetAlignment(Int_t flag=0)
54 // Write alignment parameters into CDB
56 // flag=0: ideal geometry with one module
57 // flag=1: disligned geometry with 5 modules
58 // Author: Yuri Kharlov
67 AliPHOSAlignData *alignda=new AliPHOSAlignData("PHOS");
71 DBFolder ="local://InitAlignDB";
74 objFormat = "PHOS ideal geometry with 1 module";
76 alignda->SetNModules(1);
78 alignda->SetModuleCenter(0,0, 0.);
79 alignda->SetModuleCenter(0,1,-460.);
80 alignda->SetModuleCenter(0,2, 0.);
82 alignda->SetModuleAngle(0,0,0, 90.);
83 alignda->SetModuleAngle(0,0,1, 0.);
84 alignda->SetModuleAngle(0,1,0, 0.);
85 alignda->SetModuleAngle(0,1,1, 0.);
86 alignda->SetModuleAngle(0,2,0, 90.);
87 alignda->SetModuleAngle(0,2,1, 270.);
90 DBFolder ="local://DisAlignDB";
93 objFormat = "PHOS disaligned geometry with 5 modules";
96 alignda->SetNModules(nModules);
101 for (Int_t iModule=0; iModule<nModules; iModule++) {
102 Float_t r = r0 + gRandom->Uniform(0.,40.);
103 Float_t angle = dAngle * ( iModule - nModules / 2.0 + 0.5 ) ;
104 angle += gRandom->Uniform(-0.1,+0.1);
105 Float_t x = r * TMath::Sin(angle * TMath::DegToRad() );
106 Float_t y =-r * TMath::Cos(angle * TMath::DegToRad() );
107 Float_t z = gRandom->Uniform(-0.05,0.05);
109 alignda->SetModuleCenter(iModule,0,x);
110 alignda->SetModuleCenter(iModule,1,y);
111 alignda->SetModuleCenter(iModule,2,z);
113 theta = 90 + gRandom->Uniform(-1.,1.);
115 alignda->SetModuleAngle(iModule,0,0,theta);
116 alignda->SetModuleAngle(iModule,0,1,phi);
119 alignda->SetModuleAngle(iModule,1,0,theta);
120 alignda->SetModuleAngle(iModule,1,1,phi);
121 theta = 90 + gRandom->Uniform(-1.,1.);
123 alignda->SetModuleAngle(iModule,2,0,theta);
124 alignda->SetModuleAngle(iModule,2,1,phi);
128 printf("Unknown flag %d, can be 0 or 1 only\n",flag);
133 //Store calibration data into database
136 md.SetComment(objFormat);
137 md.SetBeamPeriod(beamPeriod);
138 md.SetResponsible("Yuri Kharlov");
140 AliCDBId id("PHOS/Alignment/Geometry",firstRun,lastRun);
142 AliCDBManager* man = AliCDBManager::Instance();
143 AliCDBStorage* loc = man->GetStorage(DBFolder.Data());
144 loc->Put(alignda, id, &md);
148 //------------------------------------------------------------------------
149 void GetAlignment(Int_t flag=0)
151 // Read alignment parameters into CDB
153 // flag=0: ideal geometry with one module
154 // flag=1: disligned geometry with 5 modules
155 // Author: Yuri Kharlov
159 AliPHOSAlignData *alignda=new AliPHOSAlignData("PHOS");
163 DBFolder ="local://InitAlignDB";
166 DBFolder ="local://DisAlignDB";
169 printf("Unknown flag %d, can be 0 or 1 only\n",flag);
172 AliPHOSAlignData* alignda = (AliPHOSAlignData*)
173 (AliCDBManager::Instance()
174 ->GetStorage(DBFolder.Data())
175 ->Get("PHOS/Alignment/Geometry",run)->GetObject());