]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFAlignment.cxx
Updates needed to be in synch with TDPMjet.
[u/mrichter/AliRoot.git] / TOF / AliTOFAlignment.cxx
CommitLineData
b33ed6c7 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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. *
0e46b9ae 14***************************************************************************/
15
16/*
b33ed6c7 17$Log$
06e24a91 18Revision 1.7 2006/04/27 13:13:29 hristov
19Moving the destructor to the implementation file
20
e78d8265 21Revision 1.6 2006/04/20 22:30:49 hristov
22Coding conventions (Annalisa)
23
0e46b9ae 24Revision 1.5 2006/04/16 22:29:05 hristov
25Coding conventions (Annalisa)
26
7aeeaf38 27Revision 1.4 2006/04/05 08:35:38 hristov
28Coding conventions (S.Arcelli, C.Zampolli)
29
340693af 30Revision 1.3 2006/03/31 13:49:07 arcelli
31Removing some junk printout
32
0120b1d1 33Revision 1.2 2006/03/31 11:26:30 arcelli
34 changing CDB Ids according to standard convention
35
28dd10b6 36Revision 1.1 2006/03/28 14:54:48 arcelli
37class for TOF alignment
38
b33ed6c7 39author: Silvia Arcelli, arcelli@bo.infn.it
40*/
41
0e46b9ae 42/////////////////////////////////////////////////////////
43// //
44// Class for alignment procedure //
45// //
46// //
47// //
48/////////////////////////////////////////////////////////
49
b33ed6c7 50#include <Rtypes.h>
0e46b9ae 51
52#include "TRandom.h"
53#include "TString.h"
54
b33ed6c7 55#include "AliLog.h"
b33ed6c7 56#include "AliAlignObj.h"
57#include "AliAlignObjAngles.h"
58#include "AliCDBManager.h"
59#include "AliCDBMetaData.h"
b33ed6c7 60#include "AliCDBId.h"
61#include "AliCDBEntry.h"
0e46b9ae 62#include "AliTOFAlignment.h"
b33ed6c7 63
64ClassImp(AliTOFAlignment)
65
66//_____________________________________________________________________________
67AliTOFAlignment::AliTOFAlignment():TTask("AliTOFAlignment","") {
68 //AliTOFalignment main Ctor
69
70 fNTOFAlignObj=0;
71 fTOFAlignObjArray=0x0;
72}
73//_____________________________________________________________________________
74AliTOFAlignment::AliTOFAlignment(const AliTOFAlignment &t):TTask("AliTOFAlignment",""){
75 //AliTOFAlignment copy Ctor
76
77 fNTOFAlignObj=t.fNTOFAlignObj;
78 fTOFAlignObjArray=t.fTOFAlignObjArray;
79
80}
81
82//_____________________________________________________________________________
7aeeaf38 83AliTOFAlignment& AliTOFAlignment::operator=(const AliTOFAlignment &t){
84 //AliTOFAlignment assignment operator
85
86 this->fNTOFAlignObj=t.fNTOFAlignObj;
87 this->fTOFAlignObjArray=t.fTOFAlignObjArray;
88 return *this;
89
90}
91
92//_____________________________________________________________________________
e78d8265 93AliTOFAlignment::~AliTOFAlignment() {delete fTOFAlignObjArray;}
94
95//_____________________________________________________________________________
340693af 96void AliTOFAlignment::Smear( Float_t *tr, Float_t *rot)
97{
98 //Introduce Random Offset/Tilts
b33ed6c7 99 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
100 Float_t dx, dy, dz; // shifts
101 Float_t dpsi, dtheta, dphi; // angular displacements
102 TRandom *rnd = new TRandom(1567);
06e24a91 103
104 Int_t nSMTOF = 18;
28dd10b6 105 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
106 UShort_t iIndex=0; //dummy volume index
107 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
108 // Int_t iIndex=1; //dummy volume index
b33ed6c7 109 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
110 Int_t i;
06e24a91 111 for (i = 0; i<nSMTOF ; i++) {
112 Char_t path[100];
113 sprintf(path,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",i,i);
114
115 dx = (rnd->Gaus(0.,1.))*tr[0];
116 dy = (rnd->Gaus(0.,1.))*tr[1];
117 dz = (rnd->Gaus(0.,1.))*tr[2];
118 dpsi = rot[0];
119 dtheta = rot[1];
120 dphi = rot[2];
b33ed6c7 121 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
122 fTOFAlignObjArray->Add(o);
123 }
124
b33ed6c7 125 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
126 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
127 delete rnd;
128}
129
130//_____________________________________________________________________________
340693af 131void AliTOFAlignment::Align( Float_t *tr, Float_t *rot)
132{
133 //Introduce Offset/Tilts
b33ed6c7 134
135 fTOFAlignObjArray = new TObjArray(kMaxAlignObj);
136 Float_t dx, dy, dz; // shifts
137 Float_t dpsi, dtheta, dphi; // angular displacements
b33ed6c7 138
139
06e24a91 140 Int_t nSMTOF = 18;
28dd10b6 141 AliAlignObj::ELayerID iLayer = AliAlignObj::kInvalidLayer;
142 UShort_t iIndex=0; //dummy volume index
143 // AliAlignObj::ELayerID iLayer = AliAlignObj::kTOF;
144 // Int_t iIndex=1; //dummy volume index
b33ed6c7 145 UShort_t dvoluid = AliAlignObj::LayerToVolUID(iLayer,iIndex); //dummy volume identity
146 Int_t i;
06e24a91 147 for (i = 0; i<nSMTOF ; i++) {
148
149 Char_t path[100];
150 sprintf(path,"/ALIC_1/B077_1/BSEGMO%i_1/BTOF%i_1",i,i);
151 dx = tr[0];
152 dy = tr[1];
153 dz = tr[2];
154 dpsi = rot[0];
155 dtheta = rot[1];
156 dphi = rot[2];
b33ed6c7 157
b33ed6c7 158 AliAlignObjAngles *o =new AliAlignObjAngles(path, dvoluid, dx, dy, dz, dpsi, dtheta, dphi);
159 fTOFAlignObjArray->Add(o);
160 }
161 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
162 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
163}
164//_____________________________________________________________________________
340693af 165void AliTOFAlignment::WriteParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
166{
167 //Write Align Par on CDB
b33ed6c7 168 AliCDBManager *man = AliCDBManager::Instance();
169 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
170 Char_t *sel1 = "AlignPar" ;
171 Char_t out[100];
172 sprintf(out,"%s/%s",sel,sel1);
173 AliCDBId idTOFAlign(out,minrun,maxrun);
174 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
175 mdTOFAlign->SetResponsible("TOF");
176 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
177 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
178}
179//_____________________________________________________________________________
340693af 180void AliTOFAlignment::ReadParFromCDB(Char_t *sel, Int_t nrun)
181{
182 //Read Align Par from CDB
b33ed6c7 183 AliCDBManager *man = AliCDBManager::Instance();
184 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
185 Char_t *sel1 = "AlignPar" ;
186 Char_t out[100];
187 sprintf(out,"%s/%s",sel,sel1);
188 AliCDBEntry *entry = man->Get(out,nrun);
189 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
190 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
191 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
192
193}
194//_____________________________________________________________________________
340693af 195void AliTOFAlignment::WriteSimParOnCDB(Char_t *sel, Int_t minrun, Int_t maxrun)
196{
197 //Write Sim Align Par on CDB
b33ed6c7 198 AliCDBManager *man = AliCDBManager::Instance();
199 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
200 Char_t *sel1 = "AlignSimPar" ;
201 Char_t out[100];
202 sprintf(out,"%s/%s",sel,sel1);
203 AliCDBId idTOFAlign(out,minrun,maxrun);
204 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
205 mdTOFAlign->SetResponsible("TOF");
206 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
207 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
208}
209//_____________________________________________________________________________
210void AliTOFAlignment::ReadSimParFromCDB(Char_t *sel, Int_t nrun){
340693af 211 //Read Sim Align Par from CDB
b33ed6c7 212 AliCDBManager *man = AliCDBManager::Instance();
213 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
214 Char_t *sel1 = "AlignSimPar" ;
215 Char_t out[100];
216 sprintf(out,"%s/%s",sel,sel1);
217 AliCDBEntry *entry = man->Get(out,nrun);
218 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
219 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
220 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
221
222}
28dd10b6 223//_____________________________________________________________________________
340693af 224void AliTOFAlignment::WriteOnCDBforDC()
225{
226 //Write Align Par on CDB for DC06
28dd10b6 227 AliCDBManager *man = AliCDBManager::Instance();
228 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
229 AliCDBId idTOFAlign("TOF/Align/Data",0,0);
230 AliCDBMetaData *mdTOFAlign = new AliCDBMetaData();
231 mdTOFAlign->SetComment("Alignment objects for ideal geometry, i.e. applying them to TGeo has to leave geometry unchanged");
232 mdTOFAlign->SetResponsible("TOF");
233 AliInfo(Form("Number of Alignable Volumes: %d",fNTOFAlignObj));
234 man->Put(fTOFAlignObjArray,idTOFAlign,mdTOFAlign);
235}
236//_____________________________________________________________________________
340693af 237void AliTOFAlignment::ReadFromCDBforDC()
238{
239 //Read Sim Align Par from CDB for DC06
28dd10b6 240 AliCDBManager *man = AliCDBManager::Instance();
241 if(!man->IsDefaultStorageSet())man->SetDefaultStorage("local://$ALICE_ROOT");
242 AliCDBEntry *entry = man->Get("TOF/Align/Data",0);
243 fTOFAlignObjArray=(TObjArray*)entry->GetObject();
244 fNTOFAlignObj=fTOFAlignObjArray->GetEntries();
245 AliInfo(Form("Number of Alignable Volumes from CDB: %d",fNTOFAlignObj));
246
247}