]>
Commit | Line | Data |
---|---|---|
f74edaba | 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 | /* $Id$ */ | |
17 | ||
702ab87e | 18 | /* History of cvs commits: |
19 | * | |
20 | * $Log$ | |
43fbaae1 | 21 | * Revision 1.11 2005/05/28 14:19:04 schutz |
22 | * Compilation warnings fixed by T.P. | |
23 | * | |
702ab87e | 24 | */ |
25 | ||
f74edaba | 26 | //_________________________________________________________________________ |
cd228525 | 27 | // Class provides correspondence between "raw numbers" i.e. number of crustall |
28 | // in prototype and PHOT AbsId numer, used in reconstruction. | |
29 | // First it calculates correspondence automatically, assuming, that | |
30 | // prototype, having N raws and M columns is situated in the center | |
31 | // of middle (third) PHOS module. Then this correspondence can be edited | |
32 | // manually. One can convert Raw->AbsId and visa versa AbsId->RawId. | |
f74edaba | 33 | // |
cd228525 | 34 | //*-- Author : D.Peressounko ("RRC Kurchatov Institute") |
f74edaba | 35 | ////////////////////////////////////////////////////////////////////////////// |
36 | ||
37 | // --- ROOT system --- | |
38 | #include "TArrayS.h" | |
39 | #include "TH2S.h" | |
40 | ||
41 | // --- Standard library --- | |
21cd0c07 | 42 | |
f74edaba | 43 | // --- AliRoot header files --- |
351dd634 | 44 | #include "AliLog.h" |
f74edaba | 45 | #include "AliPHOSGeometry.h" |
46 | #include "AliPHOSConTableDB.h" | |
47 | ||
48 | ClassImp(AliPHOSConTableDB) | |
49 | ||
50 | ||
51 | //____________________________________________________________________________ | |
43fbaae1 | 52 | AliPHOSConTableDB::AliPHOSConTableDB(): |
53 | TNamed("AliPHOSConTableDB","Beamtest2002"), | |
54 | fGeom(0), | |
55 | fProtoRaws(0), | |
56 | fProtoColumns(0), | |
57 | fRawOffset(0), | |
58 | fColOffset(0), | |
59 | fNcrInProto(0), | |
60 | fMinAbsId(0), | |
61 | fMaxAbsId(0), | |
62 | fAbsIdMap(0), | |
63 | fRawIdMap(0) | |
f74edaba | 64 | { |
43fbaae1 | 65 | //default constructor, nothing created. |
f74edaba | 66 | } |
67 | ||
68 | //____________________________________________________________________________ | |
43fbaae1 | 69 | AliPHOSConTableDB::AliPHOSConTableDB(const char * title): |
70 | TNamed("AliPHOSConTableDB",title), | |
71 | fGeom(0), | |
72 | fProtoRaws(0), | |
73 | fProtoColumns(0), | |
74 | fRawOffset(0), | |
75 | fColOffset(0), | |
76 | fNcrInProto(0), | |
77 | fMinAbsId(0), | |
78 | fMaxAbsId(0), | |
79 | fAbsIdMap(0), | |
80 | fRawIdMap(0) | |
f74edaba | 81 | { |
43fbaae1 | 82 | //Normally used constructor |
cd228525 | 83 | fGeom = AliPHOSGeometry::GetInstance("IHEP","") ; |
f74edaba | 84 | } |
85 | ||
540e818b | 86 | //____________________________________________________________________________ |
43fbaae1 | 87 | AliPHOSConTableDB::AliPHOSConTableDB(const AliPHOSConTableDB& cdb): |
88 | TNamed(cdb.GetName(), cdb.GetTitle()), | |
89 | fGeom(0), | |
90 | fProtoRaws(cdb.fProtoRaws), | |
91 | fProtoColumns(cdb.fProtoColumns), | |
92 | fRawOffset(cdb.fRawOffset), | |
93 | fColOffset(cdb.fColOffset), | |
94 | fNcrInProto(cdb.fNcrInProto), | |
95 | fMinAbsId(cdb.fMinAbsId), | |
96 | fMaxAbsId(cdb.fMaxAbsId), | |
97 | fAbsIdMap(new TArrayS(*(cdb.fAbsIdMap))), | |
98 | fRawIdMap(new TArrayS(*(cdb.fRawIdMap))) | |
540e818b | 99 | { |
100 | //Copy constructor | |
cd228525 | 101 | } |
540e818b | 102 | |
f74edaba | 103 | //____________________________________________________________________________ |
104 | AliPHOSConTableDB::~AliPHOSConTableDB() | |
105 | { | |
106 | if(fAbsIdMap) | |
48cebc3e | 107 | delete fAbsIdMap ; |
503394a6 | 108 | if(fRawIdMap) |
48cebc3e | 109 | delete fRawIdMap ; |
f74edaba | 110 | } |
111 | ||
112 | //____________________________________________________________________________ | |
113 | void AliPHOSConTableDB::BuildDB(void) | |
114 | { | |
115 | //Make a map between Protopype cristalls and PHOS crystalls | |
116 | //assuming, that prototype is centered in the third module of the PHOS | |
117 | fNcrInProto =fProtoRaws*fProtoColumns ; | |
118 | if(!fNcrInProto){ | |
351dd634 | 119 | AliError(Form("configuratio of prototype is not known!!!\n Specify number of raws and columns in prototype")); |
f74edaba | 120 | return ; |
121 | } | |
122 | fRawOffset = (fGeom->GetNPhi() - fProtoRaws)/2 ; | |
123 | fColOffset = (fGeom->GetNZ() - fProtoColumns )/ 2 ; | |
124 | fAbsIdMap = new TArrayS(fNcrInProto) ; | |
503394a6 | 125 | fMinAbsId = fGeom->GetNCristalsInModule()*2 + |
126 | fRawOffset*fGeom->GetNZ()+fColOffset+1 ; | |
127 | fMaxAbsId = fGeom->GetNCristalsInModule()*2 + | |
128 | (fRawOffset + fProtoRaws)*fGeom->GetNZ()- | |
129 | fColOffset ; | |
130 | fRawIdMap = new TArrayS(fMaxAbsId-fMinAbsId+1) ; | |
131 | for(Int_t raw =0; raw < fProtoRaws ; raw ++){ | |
f74edaba | 132 | for(Int_t col = 0; col < fProtoColumns ; col ++){ |
503394a6 | 133 | Int_t rawId = raw*fProtoColumns + col ; |
f74edaba | 134 | Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module |
503394a6 | 135 | rel[2]=raw + fRawOffset+1 ; |
136 | rel[3]=col + fColOffset+1 ; | |
f74edaba | 137 | Int_t absId ; |
138 | fGeom->RelToAbsNumbering(rel,absId) ; | |
139 | fAbsIdMap->AddAt(static_cast<UInt_t>(absId),rawId) ; | |
503394a6 | 140 | fRawIdMap->AddAt(static_cast<UInt_t>(rawId),absId-fMinAbsId) ; |
f74edaba | 141 | } |
142 | } | |
143 | ||
144 | } | |
145 | //____________________________________________________________________________ | |
146 | void AliPHOSConTableDB::PlotProtoMap(Option_t * opt) | |
147 | { | |
148 | //Visualyse connection table | |
149 | ||
150 | TH2S * hMapProto = new TH2S("hMap","Map of Prototype ids", | |
151 | fGeom->GetNPhi(),0,fGeom->GetNPhi(), | |
152 | fGeom->GetNZ(),0,fGeom->GetNZ()) ; | |
153 | TH2S * hMapPHOS = new TH2S("hMapPHOS","Map of PHOS ids", | |
154 | fGeom->GetNPhi(),0,fGeom->GetNPhi(), | |
155 | fGeom->GetNZ(),0,fGeom->GetNZ()) ; | |
156 | TH2C * hMapBox = new TH2C("hMapBox","Map of Prototype ids", | |
157 | fGeom->GetNPhi(),0,fGeom->GetNPhi(), | |
158 | fGeom->GetNZ(),0,fGeom->GetNZ()) ; | |
159 | for(Int_t raw =0; raw <fGeom->GetNPhi() ; raw ++) | |
160 | for(Int_t col = 0; col <fGeom->GetNZ() ; col ++) | |
161 | hMapBox->SetBinContent(raw+1,col+1,1) ; | |
162 | ||
163 | for(Int_t raw =0; raw < fProtoRaws; raw ++){ | |
164 | for(Int_t col = 0; col < fProtoColumns ; col ++){ | |
165 | Int_t rawId = col*fProtoRaws + raw ; | |
166 | Int_t rel[4] = {3,0,0,0} ; //We assume, that we deal with third module | |
167 | rel[2]=raw + fRawOffset ; | |
168 | rel[3]=col + fColOffset ; | |
169 | hMapProto->SetBinContent(rel[2]+1,rel[3]+1,rawId); | |
170 | Int_t absId ; | |
171 | fGeom->RelToAbsNumbering(rel,absId) ; | |
172 | hMapPHOS->SetBinContent(rel[2]+1,rel[3]+1,absId) ; | |
173 | } | |
174 | } | |
175 | ||
176 | ||
177 | if(strstr(opt,"Zoom")||strstr(opt,"zoom")){ | |
178 | static_cast<TAxis *>(hMapBox->GetXaxis())->SetRange(fRawOffset+1,fGeom->GetNPhi()-fRawOffset) ; | |
179 | static_cast<TAxis *>(hMapBox->GetYaxis())->SetRange(fColOffset+1,fGeom->GetNZ()-fColOffset) ; | |
180 | } | |
181 | hMapBox->Draw("box") ; | |
182 | if(strstr(opt,"PHOS")) | |
183 | hMapPHOS->Draw("textsame") ; | |
184 | else | |
185 | hMapProto->Draw("textsame") ; | |
186 | ||
187 | } | |
188 | //____________________________________________________________________________ | |
cd228525 | 189 | Int_t AliPHOSConTableDB::AbsId2Raw(Int_t absId)const{ |
503394a6 | 190 | //converts numbering of modules in PHOS into |
191 | //numbering in prototype | |
192 | if(absId >= fMinAbsId && absId<=fMaxAbsId){ | |
193 | return fRawIdMap->At(absId-fMinAbsId) ; | |
194 | } | |
195 | else | |
196 | return -1 ; | |
197 | } | |
198 | //____________________________________________________________________________ | |
cd228525 | 199 | Int_t AliPHOSConTableDB::Raw2AbsId(Int_t rawId)const{ |
f74edaba | 200 | //converts numbering of modules in prototipe into |
201 | //numbering in PHOS | |
202 | if(rawId >= 0 && rawId<fNcrInProto) | |
203 | return fAbsIdMap->At(rawId) ; | |
204 | else | |
205 | return 0 ; | |
206 | } | |
207 | //____________________________________________________________________________ | |
702ab87e | 208 | void AliPHOSConTableDB::Print(const Option_t *)const { |
cd228525 | 209 | //prints configuraion |
f74edaba | 210 | |
21cd0c07 | 211 | TString message ; |
212 | message = " %s %s\n" ; | |
213 | message += "PHOS Geometry configured for " ; | |
f74edaba | 214 | if(fGeom) |
21cd0c07 | 215 | message += "%s %s \n" ; |
f74edaba | 216 | else |
21cd0c07 | 217 | message += " null \n" ; |
218 | ||
351dd634 | 219 | AliInfo(Form(message.Data(), GetName(), GetTitle(), fGeom->GetName(), fGeom->GetTitle() )) ; |
21cd0c07 | 220 | |
48cebc3e | 221 | message = "\n-------Prototype parameters--------\n" ; |
222 | message += " number of columns: %d \n" ; | |
223 | message += " number of raws: %d \n" ; | |
224 | message += " centered in third PHOS module with offsets: \n " ; | |
21cd0c07 | 225 | message += " raw: %d of %d\n" ; |
226 | message += " col: %d of %d\n" ; | |
48cebc3e | 227 | message += "------------------------------------ \n" ; |
21cd0c07 | 228 | |
351dd634 | 229 | AliInfo(Form(message.Data(), fProtoColumns, fProtoRaws, fRawOffset, fGeom->GetNPhi(), fColOffset,fGeom->GetNZ() )); |
f74edaba | 230 | } |
cd228525 | 231 | //____________________________________________________________________________ |
232 | AliPHOSConTableDB& AliPHOSConTableDB::operator=(const AliPHOSConTableDB& cdb){ | |
233 | //Operator for coding convetion | |
234 | fGeom=cdb.fGeom ; //! PHOS geometry class | |
235 | fProtoRaws=cdb.fProtoRaws ; // Parameters | |
236 | fProtoColumns=cdb.fProtoColumns ; // used to calculate | |
237 | fRawOffset=cdb.fRawOffset ; // correspondance | |
238 | fColOffset=cdb.fColOffset ; // map | |
239 | fNcrInProto=cdb.fNcrInProto ; //Number of channels in prototype | |
240 | fMinAbsId=cdb.fMinAbsId ; //Minimal AbsId, corresponding to some prototype cristall. | |
241 | fMaxAbsId=cdb.fMaxAbsId ; //Maximal AbsId, corresponding to some prototype cristall | |
242 | fAbsIdMap=new TArrayS(*(cdb.fAbsIdMap)) ; //Map of correspondance between Raw and PHOS ID | |
243 | fRawIdMap=new TArrayS(*(cdb.fRawIdMap)) ; //Map of correspondance between AbsId and Raw | |
244 | return *this ; | |
245 | } | |
246 | ||
247 | ||
248 |