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