1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 ***************************************************************************/
18 Revision 1.6 2006/04/20 22:30:49 hristov
19 Coding conventions (Annalisa)
21 Revision 1.5 2006/04/16 22:29:05 hristov
22 Coding conventions (Annalisa)
24 Revision 1.4 2006/04/05 08:35:38 hristov
25 Coding conventions (S.Arcelli, C.Zampolli)
27 Revision 1.3 2006/03/31 13:49:07 arcelli
28 Removing some junk printout
30 Revision 1.2 2006/03/31 11:26:30 arcelli
31 changing CDB Ids according to standard convention
33 Revision 1.1 2006/03/28 14:54:48 arcelli
34 class for TOF alignment
36 author: Silvia Arcelli, arcelli@bo.infn.it
39 /////////////////////////////////////////////////////////
41 // Class for alignment procedure //
45 /////////////////////////////////////////////////////////
53 #include "AliAlignObj.h"
54 #include "AliAlignObjAngles.h"
55 #include "AliCDBManager.h"
56 #include "AliCDBMetaData.h"
58 #include "AliCDBEntry.h"
59 #include "AliTOFAlignment.h"
61 ClassImp(AliTOFAlignment)
63 //_____________________________________________________________________________
64 AliTOFAlignment::AliTOFAlignment():TTask("AliTOFAlignment","") {
65 //AliTOFalignment main Ctor
68 fTOFAlignObjArray=0x0;
70 //_____________________________________________________________________________
71 AliTOFAlignment::AliTOFAlignment(const AliTOFAlignment &t):TTask("AliTOFAlignment",""){
72 //AliTOFAlignment copy Ctor
74 fNTOFAlignObj=t.fNTOFAlignObj;
75 fTOFAlignObjArray=t.fTOFAlignObjArray;
79 //_____________________________________________________________________________
80 AliTOFAlignment& AliTOFAlignment::operator=(const AliTOFAlignment &t){
81 //AliTOFAlignment assignment operator
83 this->fNTOFAlignObj=t.fNTOFAlignObj;
84 this->fTOFAlignObjArray=t.fTOFAlignObjArray;
89 //_____________________________________________________________________________
90 AliTOFAlignment::~AliTOFAlignment() {delete fTOFAlignObjArray;}
92 //_____________________________________________________________________________
93 void AliTOFAlignment::Smear( Float_t *tr, Float_t *rot)
95 //Introduce Random Offset/Tilts
96 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
97 Float_t dx, dy, dz; // shifts
98 Float_t dpsi, dtheta, dphi; // angular displacements
99 TRandom *rnd = new TRandom(1567);
102 const char *sSM71="/ALIC_1/B077_1/B071_"; //1-13
103 const char *sm71="/BTO1_1";
104 const char *sSM74="/ALIC_1/B077_1/B074_"; //1-2
105 const char *sm74="/BTO2_1";
106 const char *sSM75="/ALIC_1/B077_1/B075_"; //1-3
107 const char *sm75="/BTO3_1";
110 Int_t nSM71 = 13, nSM74=2, nSM75=3;
111 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
112 UShort_t iIndex=0; //dummy volume index
113 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
114 // Int_t iIndex=1; //dummy volume index
115 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
117 for (i = 1; i<=nSM71 ; i++) {
119 dx = (rnd->Gaus(0.,1.))*tr[0]/nSM71;
120 dy = (rnd->Gaus(0.,1.))*tr[1]/nSM71;
121 dz = (rnd->Gaus(0.,1.))*tr[2]/nSM71;
123 dtheta = rot[1]/nSM71;
129 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
130 fTOFAlignObjArray->Add(o);
133 for (i = 1; i<=nSM74 ; i++) {
135 dx = (rnd->Gaus(0.,1.))*tr[0]/nSM74;
136 dy = (rnd->Gaus(0.,1.))*tr[1]/nSM74;
137 dz = (rnd->Gaus(0.,1.))*tr[2]/nSM74;
139 dtheta = rot[1]/nSM74;
145 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
146 fTOFAlignObjArray->Add(o);
149 for (i = 1; i<=nSM75; i++) {
151 dx = (rnd->Gaus(0.,1.))*tr[0]/nSM75;
152 dy = (rnd->Gaus(0.,1.))*tr[1]/nSM75;
153 dz = (rnd->Gaus(0.,1.))*tr[2]/nSM75;
155 dtheta = rot[1]/nSM75;
161 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
162 fTOFAlignObjArray->Add(o);
164 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
165 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
169 //_____________________________________________________________________________
170 void AliTOFAlignment::Align( Float_t *tr, Float_t *rot)
172 //Introduce Offset/Tilts
174 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
175 Float_t dx, dy, dz; // shifts
176 Float_t dpsi, dtheta, dphi; // angular displacements
178 const char *sSM71="/ALIC_1/B077_1/B071_"; //1-13
179 const char *sm71="/BTO1_1";
180 const char *sSM74="/ALIC_1/B077_1/B074_"; //1-2
181 const char *sm74="/BTO2_1";
182 const char *sSM75="/ALIC_1/B077_1/B075_"; //1-3
183 const char *sm75="/BTO3_1";
186 Int_t nSM71 = 13, nSM74=2, nSM75=3;
187 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
188 UShort_t iIndex=0; //dummy volume index
189 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
190 // Int_t iIndex=1; //dummy volume index
191 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
193 for (i = 1; i<=nSM71 ; i++) {
199 dtheta = rot[1]/nSM71;
205 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
206 fTOFAlignObjArray->Add(o);
209 for (i = 1; i<=nSM74 ; i++) {
215 dtheta = rot[1]/nSM74;
221 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
222 fTOFAlignObjArray->Add(o);
225 for (i = 1; i<=nSM75; i++) {
231 dtheta = rot[1]/nSM75;
237 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
238 fTOFAlignObjArray->Add(o);
240 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
241 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
243 //_____________________________________________________________________________
244 void AliTOFAlignment::WriteParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
246 //Write Align Par on CDB
247 AliCDBManager *man = AliCDBManager::Instance();
248 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
249 Char_t *sel1 = "AlignPar" ;
251 sprintf(out,"%s/%s",sel,sel1);
252 AliCDBId idTOFAlign(out,minrun,maxrun);
253 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
254 mdTOFAlign->SetResponsible("TOF");
255 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
256 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
258 //_____________________________________________________________________________
259 void AliTOFAlignment::ReadParFromCDB(Char_t *sel, Int_t nrun)
261 //Read Align Par from CDB
262 AliCDBManager *man = AliCDBManager::Instance();
263 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
264 Char_t *sel1 = "AlignPar" ;
266 sprintf(out,"%s/%s",sel,sel1);
267 AliCDBEntry *entry = man->Get(out,nrun);
268 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
269 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
270 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
273 //_____________________________________________________________________________
274 void AliTOFAlignment::WriteSimParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
276 //Write Sim Align Par on CDB
277 AliCDBManager *man = AliCDBManager::Instance();
278 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
279 Char_t *sel1 = "AlignSimPar" ;
281 sprintf(out,"%s/%s",sel,sel1);
282 AliCDBId idTOFAlign(out,minrun,maxrun);
283 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
284 mdTOFAlign->SetResponsible("TOF");
285 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
286 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
288 //_____________________________________________________________________________
289 void AliTOFAlignment::ReadSimParFromCDB(Char_t *sel, Int_t nrun){
290 //Read Sim Align Par from CDB
291 AliCDBManager *man = AliCDBManager::Instance();
292 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
293 Char_t *sel1 = "AlignSimPar" ;
295 sprintf(out,"%s/%s",sel,sel1);
296 AliCDBEntry *entry = man->Get(out,nrun);
297 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
298 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
299 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
302 //_____________________________________________________________________________
303 void AliTOFAlignment::WriteOnCDBforDC()
305 //Write Align Par on CDB for DC06
306 AliCDBManager *man = AliCDBManager::Instance();
307 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
308 AliCDBId idTOFAlign("TOF/Align/Data",0,0);
309 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
310 mdTOFAlign->SetComment("Alignment objects for ideal geometry, i.e. applying them to TGeo has to leave geometry unchanged");
311 mdTOFAlign->SetResponsible("TOF");
312 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
313 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
315 //_____________________________________________________________________________
316 void AliTOFAlignment::ReadFromCDBforDC()
318 //Read Sim Align Par from CDB for DC06
319 AliCDBManager *man = AliCDBManager::Instance();
320 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
321 AliCDBEntry *entry = man->Get("TOF/Align/Data",0);
322 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
323 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
324 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));