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