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.8 2006/05/04 19:41:42 hristov
19 Possibility for partial TOF geometry (S.Arcelli)
21 Revision 1.7 2006/04/27 13:13:29 hristov
22 Moving the destructor to the implementation file
24 Revision 1.6 2006/04/20 22:30:49 hristov
25 Coding conventions (Annalisa)
27 Revision 1.5 2006/04/16 22:29:05 hristov
28 Coding conventions (Annalisa)
30 Revision 1.4 2006/04/05 08:35:38 hristov
31 Coding conventions (S.Arcelli, C.Zampolli)
33 Revision 1.3 2006/03/31 13:49:07 arcelli
34 Removing some junk printout
36 Revision 1.2 2006/03/31 11:26:30 arcelli
37 changing CDB Ids according to standard convention
39 Revision 1.1 2006/03/28 14:54:48 arcelli
40 class for TOF alignment
42 author: Silvia Arcelli, arcelli@bo.infn.it
45 /////////////////////////////////////////////////////////
47 // Class for alignment procedure //
51 /////////////////////////////////////////////////////////
58 #include "AliAlignObj.h"
59 #include "AliAlignObjAngles.h"
60 #include "AliCDBManager.h"
61 #include "AliCDBMetaData.h"
63 #include "AliCDBEntry.h"
64 #include "AliTOFAlignment.h"
66 ClassImp(AliTOFAlignment)
68 //_____________________________________________________________________________
69 AliTOFAlignment::AliTOFAlignment():TTask("AliTOFAlignment","") {
70 //AliTOFalignment main Ctor
73 fTOFAlignObjArray=0x0;
75 //_____________________________________________________________________________
76 AliTOFAlignment::AliTOFAlignment(const AliTOFAlignment &t):TTask("AliTOFAlignment",""){
77 //AliTOFAlignment copy Ctor
79 fNTOFAlignObj=t.fNTOFAlignObj;
80 fTOFAlignObjArray=t.fTOFAlignObjArray;
84 //_____________________________________________________________________________
85 AliTOFAlignment& AliTOFAlignment::operator=(const AliTOFAlignment &t){
86 //AliTOFAlignment assignment operator
88 this->fNTOFAlignObj=t.fNTOFAlignObj;
89 this->fTOFAlignObjArray=t.fTOFAlignObjArray;
94 //_____________________________________________________________________________
95 AliTOFAlignment::~AliTOFAlignment() {delete fTOFAlignObjArray;}
97 //_____________________________________________________________________________
98 void AliTOFAlignment::Smear( Float_t *tr, Float_t *rot)
100 //Introduce Random Offset/Tilts
101 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
102 Float_t dx, dy, dz; // shifts
103 Float_t dpsi, dtheta, dphi; // angular displacements
104 TRandom *rnd = new TRandom(1567);
107 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
108 UShort_t iIndex=0; //dummy volume index
109 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
110 // Int_t iIndex=1; //dummy volume index
111 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
113 for (i = 0; i<nSMTOF ; i++) {
115 sprintf(path,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",i,i);
117 dx = (rnd->Gaus(0.,1.))*tr[0];
118 dy = (rnd->Gaus(0.,1.))*tr[1];
119 dz = (rnd->Gaus(0.,1.))*tr[2];
123 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
124 fTOFAlignObjArray->Add(o);
127 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
128 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
132 //_____________________________________________________________________________
133 void AliTOFAlignment::Align( Float_t *tr, Float_t *rot)
135 //Introduce Offset/Tilts
137 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
138 Float_t dx, dy, dz; // shifts
139 Float_t dpsi, dtheta, dphi; // angular displacements
143 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
144 UShort_t iIndex=0; //dummy volume index
145 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
146 // Int_t iIndex=1; //dummy volume index
147 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
149 for (i = 0; i<nSMTOF ; i++) {
152 sprintf(path,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",i,i);
160 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
161 fTOFAlignObjArray->Add(o);
163 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
164 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
166 //_____________________________________________________________________________
167 void AliTOFAlignment::WriteParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
169 //Write Align Par on CDB
170 AliCDBManager *man = AliCDBManager::Instance();
171 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
172 Char_t *sel1 = "AlignPar" ;
174 sprintf(out,"%s/%s",sel,sel1);
175 AliCDBId idTOFAlign(out,minrun,maxrun);
176 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
177 mdTOFAlign->SetResponsible("TOF");
178 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
179 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
181 //_____________________________________________________________________________
182 void AliTOFAlignment::ReadParFromCDB(Char_t *sel, Int_t nrun)
184 //Read Align Par from CDB
185 AliCDBManager *man = AliCDBManager::Instance();
186 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
187 Char_t *sel1 = "AlignPar" ;
189 sprintf(out,"%s/%s",sel,sel1);
190 AliCDBEntry *entry = man->Get(out,nrun);
191 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
192 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
193 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
196 //_____________________________________________________________________________
197 void AliTOFAlignment::WriteSimParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
199 //Write Sim Align Par on CDB
200 AliCDBManager *man = AliCDBManager::Instance();
201 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
202 Char_t *sel1 = "AlignSimPar" ;
204 sprintf(out,"%s/%s",sel,sel1);
205 AliCDBId idTOFAlign(out,minrun,maxrun);
206 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
207 mdTOFAlign->SetResponsible("TOF");
208 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
209 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
211 //_____________________________________________________________________________
212 void AliTOFAlignment::ReadSimParFromCDB(Char_t *sel, Int_t nrun){
213 //Read Sim Align Par from CDB
214 AliCDBManager *man = AliCDBManager::Instance();
215 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
216 Char_t *sel1 = "AlignSimPar" ;
218 sprintf(out,"%s/%s",sel,sel1);
219 AliCDBEntry *entry = man->Get(out,nrun);
220 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
221 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
222 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
225 //_____________________________________________________________________________
226 void AliTOFAlignment::WriteOnCDBforDC()
228 //Write Align Par on CDB for DC06
229 AliCDBManager *man = AliCDBManager::Instance();
230 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
231 AliCDBId idTOFAlign("TOF/Align/Data",0,0);
232 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
233 mdTOFAlign->SetComment("Alignment objects for ideal geometry, i.e. applying them to TGeo has to leave geometry unchanged");
234 mdTOFAlign->SetResponsible("TOF");
235 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
236 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
238 //_____________________________________________________________________________
239 void AliTOFAlignment::ReadFromCDBforDC()
241 //Read Sim Align Par from CDB for DC06
242 AliCDBManager *man = AliCDBManager::Instance();
243 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
244 AliCDBEntry *entry = man->Get("TOF/Align/Data",0);
245 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
246 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
247 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));