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