1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 //_________________________________________________________________________
19 // RecPoint implementation for PHOS-CPV
20 // An CpvRecPoint is a cluster of digits
21 //*-- Author: Yuri Kharlov
22 // (after Dmitri Peressounko (RRC KI & SUBATECH))
25 // --- ROOT system ---
30 #include "TClonesArray.h"
32 // --- Standard library ---
36 // --- AliRoot header files ---
38 #include "AliPHOSCpvRecPoint.h"
39 #include "AliPHOSGetter.h"
40 ClassImp(AliPHOSCpvRecPoint)
42 //____________________________________________________________________________
43 AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : AliPHOSEmcRecPoint()
51 //____________________________________________________________________________
52 AliPHOSCpvRecPoint::AliPHOSCpvRecPoint(const char * opt) : AliPHOSEmcRecPoint(opt)
60 //____________________________________________________________________________
61 AliPHOSCpvRecPoint::~AliPHOSCpvRecPoint()
66 //____________________________________________________________________________
67 Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
69 // Tells if (true) or not (false) two digits are neighbors)
71 Bool_t aren = kFALSE ;
73 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
74 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
77 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
80 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
82 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
83 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
85 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
91 //____________________________________________________________________________
92 Int_t AliPHOSCpvRecPoint::Compare(const TObject * obj) const
94 // Compares two RecPoints according to their position in the PHOS modules
96 Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
97 //value (what is senseless) change as vell delta in
98 //AliPHOSTrackSegmentMakerv* and other RecPoints...
102 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
104 Int_t phosmod1 = GetPHOSMod() ;
105 Int_t phosmod2 = clu->GetPHOSMod() ;
108 GetLocalPosition(locpos1) ;
110 clu->GetLocalPosition(locpos2) ;
112 if(phosmod1 == phosmod2 ) {
113 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
118 else if(locpos1.Z()>locpos2.Z())
125 if(phosmod1 < phosmod2 )
135 //______________________________________________________________________________
136 void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
138 // // Execute action corresponding to one event
139 // // This member function is called when a AliPHOSRecPoint is clicked with the locator
141 // // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
142 // // and switched off when the mouse button is released.
145 // // static Int_t pxold, pyold;
147 // AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
149 // static TGraph * digitgraph = 0 ;
151 // if (!gPad->IsEditable()) return;
153 // TH2F * histo = 0 ;
154 // TCanvas * histocanvas ;
158 // case kButton1Down: {
159 // AliPHOSDigit * digit ;
160 // AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
164 // const Int_t kMulDigit = AliPHOSCpvRecPoint::GetDigitsMultiplicity() ;
165 // Float_t * xi = new Float_t[kMulDigit] ;
166 // Float_t * zi = new Float_t[kMulDigit] ;
168 // // create the histogram for the single cluster
169 // // 1. gets histogram boundaries
170 // Float_t ximax = -999. ;
171 // Float_t zimax = -999. ;
172 // Float_t ximin = 999. ;
173 // Float_t zimin = 999. ;
175 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
176 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
177 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
178 // phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
179 // if ( xi[iDigit] > ximax )
180 // ximax = xi[iDigit] ;
181 // if ( xi[iDigit] < ximin )
182 // ximin = xi[iDigit] ;
183 // if ( zi[iDigit] > zimax )
184 // zimax = zi[iDigit] ;
185 // if ( zi[iDigit] < zimin )
186 // zimin = zi[iDigit] ;
188 // ximax += phosgeom->GetCrystalSize(0) / 2. ;
189 // zimax += phosgeom->GetCrystalSize(2) / 2. ;
190 // ximin -= phosgeom->GetCrystalSize(0) / 2. ;
191 // zimin -= phosgeom->GetCrystalSize(2) / 2. ;
192 // Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
193 // Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
195 // // 2. gets the histogram title
197 // Text_t title[100] ;
198 // sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
204 // histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
207 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
208 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
209 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
210 // phosgeom->RelPosInModule(relid, x, z);
211 // histo->Fill(x, z, fEnergyList[iDigit] ) ;
214 // if (!digitgraph) {
215 // digitgraph = new TGraph(kMulDigit,xi,zi);
216 // digitgraph-> SetMarkerStyle(5) ;
217 // digitgraph-> SetMarkerSize(1.) ;
218 // digitgraph-> SetMarkerColor(1) ;
219 // digitgraph-> Paint("P") ;
223 // histocanvas = new TCanvas("cluser", "a single cluster", 600, 500) ;
224 // histocanvas->Draw() ;
225 // histo->Draw("lego1") ;
235 // delete digitgraph ;
243 //____________________________________________________________________________
244 void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits)
246 // wraps other methods
247 AliPHOSEmcRecPoint::EvalAll(logWeight,digits) ;
248 EvalClusterLengths(digits) ;
250 //____________________________________________________________________________
251 void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits)
253 // Calculates the center of gravity in the local PHOS-module coordinates
262 AliPHOSDigit * digit ;
264 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
265 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
269 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
270 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]);
274 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
275 phosgeom->RelPosInModule(relid, xi, zi);
276 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
288 if (fMulDigit != 0) cout << "AliPHOSCpvRecPoint: too low log weight factor "
289 << "to evaluate cluster's center\n";
298 //____________________________________________________________________________
299 void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits)
301 //Modified 15.03.2001 by Dmitri Peressounko
303 // Calculates the cluster lengths along X and Z axes
304 // These characteristics are needed for CPV to tune
305 // digitization+reconstruction to experimental data
306 // Yuri Kharlov. 24 October 2000
310 AliPHOSDigit * digit ;
312 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
313 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
315 const Int_t kMaxLeng=20;
316 Int_t idX[kMaxLeng], idZ[kMaxLeng];
321 for(Int_t iDigit=0; iDigit<fMulDigit; iDigit++) {
322 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
323 Int_t absId = digit->GetId();
324 phosgeom->AbsToRelNumbering(absId, relid) ;
328 for (i=0; i<fLengX; i++) if (relid[2]==idX[i]) { dejavu=kTRUE; break; }
330 idX[fLengX]=relid[2];
332 fLengX = TMath::Min(fLengX,kMaxLeng);
336 for (i=0; i<fLengZ; i++) if (relid[3]==idZ[i]) { dejavu=kTRUE; break; }
338 idZ[fLengZ]=relid[3];
340 fLengZ = TMath::Min(fLengZ,kMaxLeng);
347 //____________________________________________________________________________
348 void AliPHOSCpvRecPoint::Print(Option_t * option)
350 // Print the list of digits belonging to the cluster
352 cout << "AliPHOSCpvRecPoint: " << endl ;
356 cout << "Digits # " ;
357 for(iDigit=0; iDigit<fMulDigit; iDigit++)
358 cout << fDigitsList[iDigit] << " " ;
361 cout << "Energies: " ;
362 for(iDigit=0; iDigit<fMulDigit; iDigit++)
363 cout << fEnergyList[iDigit] << " " ;
366 cout << " Multiplicity = " << fMulDigit << endl ;
367 cout << " Cluster Energy = " << fAmp << endl ;
368 cout << " Stored at position " << GetIndexInList() << endl ;