]>
Commit | Line | Data |
---|---|---|
458282ff | 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$ | |
3663622c | 21 | * Revision 1.23 2005/12/20 14:28:47 hristov |
22 | * Additional protection | |
23 | * | |
f33a3764 | 24 | * Revision 1.22 2005/05/28 14:19:04 schutz |
25 | * Compilation warnings fixed by T.P. | |
26 | * | |
702ab87e | 27 | */ |
28 | ||
458282ff | 29 | //_________________________________________________________________________ |
30 | // RecPoint implementation for PHOS-CPV | |
31 | // An CpvRecPoint is a cluster of digits | |
a3dfe79c | 32 | //*-- Author: Yuri Kharlov |
33 | // (after Dmitri Peressounko (RRC KI & SUBATECH)) | |
34 | // 30 October 2000 | |
458282ff | 35 | |
36 | // --- ROOT system --- | |
e957fea8 | 37 | |
458282ff | 38 | #include "TMath.h" |
b5241d61 | 39 | #include "TClonesArray.h" |
458282ff | 40 | |
41 | // --- Standard library --- | |
42 | ||
458282ff | 43 | // --- AliRoot header files --- |
351dd634 | 44 | #include "AliLog.h" |
e957fea8 | 45 | #include "AliPHOSGeometry.h" |
46 | #include "AliPHOSDigit.h" | |
458282ff | 47 | #include "AliPHOSCpvRecPoint.h" |
88cb7938 | 48 | #include "AliPHOSLoader.h" |
e957fea8 | 49 | |
458282ff | 50 | ClassImp(AliPHOSCpvRecPoint) |
51 | ||
52 | //____________________________________________________________________________ | |
3663622c | 53 | AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : |
54 | AliPHOSEmcRecPoint(), | |
55 | fLengX(-1), | |
56 | fLengZ(-1) | |
458282ff | 57 | { |
58 | // ctor | |
458282ff | 59 | } |
60 | ||
73a68ccb | 61 | //____________________________________________________________________________ |
3663622c | 62 | AliPHOSCpvRecPoint::AliPHOSCpvRecPoint(const char * opt) : |
63 | AliPHOSEmcRecPoint(opt), | |
64 | fLengX(-1), | |
65 | fLengZ(-1) | |
73a68ccb | 66 | { |
67 | // ctor | |
3663622c | 68 | } |
73a68ccb | 69 | |
458282ff | 70 | //____________________________________________________________________________ |
71 | AliPHOSCpvRecPoint::~AliPHOSCpvRecPoint() | |
72 | { | |
73 | // dtor | |
458282ff | 74 | } |
75 | ||
458282ff | 76 | //____________________________________________________________________________ |
ad8cfaf4 | 77 | Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const |
458282ff | 78 | { |
79 | // Tells if (true) or not (false) two digits are neighbors) | |
80 | ||
81 | Bool_t aren = kFALSE ; | |
82 | ||
88cb7938 | 83 | AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); |
ed652fe0 | 84 | |
458282ff | 85 | Int_t relid1[4] ; |
86 | phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ; | |
87 | ||
88 | Int_t relid2[4] ; | |
89 | phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ; | |
90 | ||
91 | Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ; | |
92 | Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ; | |
93 | ||
94 | if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0)) | |
95 | aren = kTRUE ; | |
96 | ||
97 | return aren ; | |
98 | } | |
99 | ||
100 | //____________________________________________________________________________ | |
2a941f4e | 101 | Int_t AliPHOSCpvRecPoint::Compare(const TObject * obj) const |
458282ff | 102 | { |
103 | // Compares two RecPoints according to their position in the PHOS modules | |
104 | ||
b5241d61 | 105 | Float_t delta = 1 ; //Width of "Sorting row". If you changibg this |
106 | //value (what is senseless) change as vell delta in | |
107 | //AliPHOSTrackSegmentMakerv* and other RecPoints... | |
108 | ||
458282ff | 109 | Int_t rv ; |
110 | ||
9688c1dd | 111 | AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ; |
112 | ||
113 | Int_t phosmod1 = GetPHOSMod() ; | |
114 | Int_t phosmod2 = clu->GetPHOSMod() ; | |
115 | ||
116 | TVector3 locpos1; | |
117 | GetLocalPosition(locpos1) ; | |
118 | TVector3 locpos2; | |
119 | clu->GetLocalPosition(locpos2) ; | |
120 | ||
121 | if(phosmod1 == phosmod2 ) { | |
122 | Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ; | |
123 | if (rowdif> 0) | |
124 | rv = 1 ; | |
125 | else if(rowdif < 0) | |
126 | rv = -1 ; | |
127 | else if(locpos1.Z()>locpos2.Z()) | |
128 | rv = -1 ; | |
129 | else | |
130 | rv = 1 ; | |
131 | } | |
132 | ||
133 | else { | |
134 | if(phosmod1 < phosmod2 ) | |
135 | rv = -1 ; | |
136 | else | |
137 | rv = 1 ; | |
138 | } | |
139 | ||
140 | return rv ; | |
141 | ||
458282ff | 142 | } |
143 | ||
144 | //______________________________________________________________________________ | |
702ab87e | 145 | void AliPHOSCpvRecPoint::ExecuteEvent(Int_t, Int_t, Int_t ) /*const*/ |
458282ff | 146 | { |
b5241d61 | 147 | // // Execute action corresponding to one event |
148 | // // This member function is called when a AliPHOSRecPoint is clicked with the locator | |
149 | // // | |
150 | // // If Left button is clicked on AliPHOSRecPoint, the digits are switched on | |
151 | // // and switched off when the mouse button is released. | |
152 | // // | |
458282ff | 153 | |
b5241d61 | 154 | // // static Int_t pxold, pyold; |
458282ff | 155 | |
88cb7938 | 156 | // AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ; |
458282ff | 157 | |
b5241d61 | 158 | // static TGraph * digitgraph = 0 ; |
458282ff | 159 | |
b5241d61 | 160 | // if (!gPad->IsEditable()) return; |
458282ff | 161 | |
b5241d61 | 162 | // TH2F * histo = 0 ; |
163 | // TCanvas * histocanvas ; | |
458282ff | 164 | |
b5241d61 | 165 | // switch (event) { |
458282ff | 166 | |
b5241d61 | 167 | // case kButton1Down: { |
168 | // AliPHOSDigit * digit ; | |
169 | // AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ; | |
170 | // Int_t iDigit; | |
171 | // Int_t relid[4] ; | |
458282ff | 172 | |
b5241d61 | 173 | // const Int_t kMulDigit = AliPHOSCpvRecPoint::GetDigitsMultiplicity() ; |
174 | // Float_t * xi = new Float_t[kMulDigit] ; | |
175 | // Float_t * zi = new Float_t[kMulDigit] ; | |
458282ff | 176 | |
b5241d61 | 177 | // // create the histogram for the single cluster |
178 | // // 1. gets histogram boundaries | |
179 | // Float_t ximax = -999. ; | |
180 | // Float_t zimax = -999. ; | |
181 | // Float_t ximin = 999. ; | |
182 | // Float_t zimin = 999. ; | |
458282ff | 183 | |
b5241d61 | 184 | // for(iDigit=0; iDigit<kMulDigit; iDigit++) { |
7b7c1533 | 185 | // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ; |
b5241d61 | 186 | // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
187 | // phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]); | |
188 | // if ( xi[iDigit] > ximax ) | |
189 | // ximax = xi[iDigit] ; | |
190 | // if ( xi[iDigit] < ximin ) | |
191 | // ximin = xi[iDigit] ; | |
192 | // if ( zi[iDigit] > zimax ) | |
193 | // zimax = zi[iDigit] ; | |
194 | // if ( zi[iDigit] < zimin ) | |
195 | // zimin = zi[iDigit] ; | |
196 | // } | |
197 | // ximax += phosgeom->GetCrystalSize(0) / 2. ; | |
198 | // zimax += phosgeom->GetCrystalSize(2) / 2. ; | |
199 | // ximin -= phosgeom->GetCrystalSize(0) / 2. ; | |
200 | // zimin -= phosgeom->GetCrystalSize(2) / 2. ; | |
201 | // Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ; | |
202 | // Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ; | |
458282ff | 203 | |
b5241d61 | 204 | // // 2. gets the histogram title |
458282ff | 205 | |
b5241d61 | 206 | // Text_t title[100] ; |
207 | // sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ; | |
458282ff | 208 | |
b5241d61 | 209 | // if (!histo) { |
210 | // delete histo ; | |
211 | // histo = 0 ; | |
212 | // } | |
213 | // histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ; | |
458282ff | 214 | |
b5241d61 | 215 | // Float_t x, z ; |
216 | // for(iDigit=0; iDigit<kMulDigit; iDigit++) { | |
7b7c1533 | 217 | // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ; |
b5241d61 | 218 | // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; |
219 | // phosgeom->RelPosInModule(relid, x, z); | |
220 | // histo->Fill(x, z, fEnergyList[iDigit] ) ; | |
221 | // } | |
458282ff | 222 | |
b5241d61 | 223 | // if (!digitgraph) { |
224 | // digitgraph = new TGraph(kMulDigit,xi,zi); | |
225 | // digitgraph-> SetMarkerStyle(5) ; | |
226 | // digitgraph-> SetMarkerSize(1.) ; | |
227 | // digitgraph-> SetMarkerColor(1) ; | |
228 | // digitgraph-> Paint("P") ; | |
229 | // } | |
458282ff | 230 | |
b5241d61 | 231 | // Print() ; |
232 | // histocanvas = new TCanvas("cluser", "a single cluster", 600, 500) ; | |
233 | // histocanvas->Draw() ; | |
234 | // histo->Draw("lego1") ; | |
458282ff | 235 | |
b5241d61 | 236 | // delete[] xi ; |
237 | // delete[] zi ; | |
458282ff | 238 | |
b5241d61 | 239 | // break; |
240 | // } | |
458282ff | 241 | |
b5241d61 | 242 | // case kButton1Up: |
243 | // if (digitgraph) { | |
244 | // delete digitgraph ; | |
245 | // digitgraph = 0 ; | |
246 | // } | |
247 | // break; | |
458282ff | 248 | |
b5241d61 | 249 | // } |
458282ff | 250 | } |
251 | ||
252 | //____________________________________________________________________________ | |
a4e98857 | 253 | void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits) |
254 | { | |
255 | // wraps other methods | |
b5241d61 | 256 | AliPHOSEmcRecPoint::EvalAll(logWeight,digits) ; |
257 | EvalClusterLengths(digits) ; | |
ad8cfaf4 | 258 | } |
259 | //____________________________________________________________________________ | |
b5241d61 | 260 | void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits) |
ad8cfaf4 | 261 | { |
262 | // Calculates the center of gravity in the local PHOS-module coordinates | |
263 | ||
ad8cfaf4 | 264 | Float_t wtot = 0. ; |
265 | ||
266 | Int_t relid[4] ; | |
267 | ||
268 | Float_t x = 0. ; | |
269 | Float_t z = 0. ; | |
270 | ||
271 | AliPHOSDigit * digit ; | |
272 | ||
88cb7938 | 273 | AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); |
274 | ||
ad8cfaf4 | 275 | Int_t iDigit; |
276 | ||
277 | for(iDigit=0; iDigit<fMulDigit; iDigit++) { | |
b5241d61 | 278 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]); |
ad8cfaf4 | 279 | |
280 | Float_t xi ; | |
281 | Float_t zi ; | |
282 | phosgeom->AbsToRelNumbering(digit->GetId(), relid) ; | |
283 | phosgeom->RelPosInModule(relid, xi, zi); | |
f33a3764 | 284 | if (fAmp>0 && fEnergyList[iDigit]>0) { |
285 | Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ; | |
286 | x += xi * w ; | |
287 | z += zi * w ; | |
288 | wtot += w ; | |
289 | } | |
290 | else | |
291 | AliError(Form("Wrong energy %f and/or amplitude %f\n", fEnergyList[iDigit], fAmp)); | |
ad8cfaf4 | 292 | } |
293 | ||
294 | if (wtot != 0) { | |
295 | x /= wtot ; | |
296 | z /= wtot ; | |
297 | } else { | |
298 | x = -1e6 ; | |
299 | z = -1e6 ; | |
21cd0c07 | 300 | if (fMulDigit != 0) |
351dd634 | 301 | AliWarning(Form("Too low log weight factor to evaluate cluster's center" )) ; |
ad8cfaf4 | 302 | } |
303 | fLocPos.SetX(x) ; | |
304 | fLocPos.SetY(0.) ; | |
305 | fLocPos.SetZ(z) ; | |
0d6c7a69 | 306 | fLocPosM = 0 ; |
ad8cfaf4 | 307 | |
308 | } | |
309 | ||
310 | //____________________________________________________________________________ | |
b5241d61 | 311 | void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits) |
458282ff | 312 | { |
b5241d61 | 313 | //Modified 15.03.2001 by Dmitri Peressounko |
458282ff | 314 | |
458282ff | 315 | // Calculates the cluster lengths along X and Z axes |
316 | // These characteristics are needed for CPV to tune | |
317 | // digitization+reconstruction to experimental data | |
318 | // Yuri Kharlov. 24 October 2000 | |
319 | ||
458282ff | 320 | Int_t relid[4] ; |
321 | ||
322 | AliPHOSDigit * digit ; | |
323 | ||
88cb7938 | 324 | AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry(); |
458282ff | 325 | |
a3dfe79c | 326 | const Int_t kMaxLeng=20; |
327 | Int_t idX[kMaxLeng], idZ[kMaxLeng]; | |
b5241d61 | 328 | fLengX = 0; |
329 | fLengZ = 0; | |
458282ff | 330 | Bool_t dejavu; |
331 | ||
332 | for(Int_t iDigit=0; iDigit<fMulDigit; iDigit++) { | |
b5241d61 | 333 | digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ; |
458282ff | 334 | Int_t absId = digit->GetId(); |
335 | phosgeom->AbsToRelNumbering(absId, relid) ; | |
336 | ||
cd461ab8 | 337 | Int_t i; |
458282ff | 338 | dejavu=kFALSE; |
b5241d61 | 339 | for (i=0; i<fLengX; i++) if (relid[2]==idX[i]) { dejavu=kTRUE; break; } |
458282ff | 340 | if (!dejavu) { |
b5241d61 | 341 | idX[fLengX]=relid[2]; |
342 | fLengX++; | |
343 | fLengX = TMath::Min(fLengX,kMaxLeng); | |
458282ff | 344 | } |
345 | ||
346 | dejavu=kFALSE; | |
b5241d61 | 347 | for (i=0; i<fLengZ; i++) if (relid[3]==idZ[i]) { dejavu=kTRUE; break; } |
458282ff | 348 | if (!dejavu) { |
b5241d61 | 349 | idZ[fLengZ]=relid[3]; |
350 | fLengZ++; | |
351 | fLengZ = TMath::Min(fLengZ,kMaxLeng); | |
458282ff | 352 | } |
353 | } | |
458282ff | 354 | } |
355 | ||
458282ff | 356 | |
357 | ||
358 | //____________________________________________________________________________ | |
702ab87e | 359 | void AliPHOSCpvRecPoint::Print(const Option_t *) const |
458282ff | 360 | { |
361 | // Print the list of digits belonging to the cluster | |
362 | ||
21cd0c07 | 363 | TString message ; |
364 | message = "AliPHOSCpvRecPoint: " ; | |
365 | message += "Digits # " ; | |
351dd634 | 366 | AliInfo(Form(message.Data())) ; |
21cd0c07 | 367 | |
458282ff | 368 | Int_t iDigit; |
458282ff | 369 | |
b5241d61 | 370 | for(iDigit=0; iDigit<fMulDigit; iDigit++) |
351dd634 | 371 | printf(" %d \n", fDigitsList[iDigit]) ; |
458282ff | 372 | |
351dd634 | 373 | printf("Energies: \n") ; |
b5241d61 | 374 | for(iDigit=0; iDigit<fMulDigit; iDigit++) |
351dd634 | 375 | printf(" %f ", fEnergyList[iDigit]) ; |
b5241d61 | 376 | |
21cd0c07 | 377 | message = " Multiplicity = %d\n" ; |
378 | message += " Cluster Energy = %f\n" ; | |
379 | message += " Stored at position %d\n" ; | |
458282ff | 380 | |
351dd634 | 381 | printf(message.Data(), fMulDigit, fAmp, GetIndexInList() ) ; |
21cd0c07 | 382 | |
458282ff | 383 | } |