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"
31 #include "AliPHOSGetter.h"
33 // --- Standard library ---
37 // --- AliRoot header files ---
39 #include "AliPHOSCpvRecPoint.h"
40 #include "AliPHOSPpsdRecPoint.h"
42 ClassImp(AliPHOSCpvRecPoint)
44 //____________________________________________________________________________
45 AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : AliPHOSEmcRecPoint()
53 //____________________________________________________________________________
54 AliPHOSCpvRecPoint::~AliPHOSCpvRecPoint()
60 //____________________________________________________________________________
61 Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
63 // Tells if (true) or not (false) two digits are neighbors)
65 Bool_t aren = kFALSE ;
67 AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
68 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
71 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
74 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
76 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
77 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
79 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
85 //____________________________________________________________________________
86 Int_t AliPHOSCpvRecPoint::Compare(const TObject * obj) const
88 // Compares two RecPoints according to their position in the PHOS modules
90 Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
91 //value (what is senseless) change as vell delta in
92 //AliPHOSTrackSegmentMakerv* and other RecPoints...
96 if( (strcmp(obj->ClassName() , "AliPHOSPpsdRecPoint" )) == 0) // PPSD Rec Point
98 AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ;
99 if(this->GetPHOSMod() < clu->GetPHOSMod() )
107 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
109 Int_t phosmod1 = GetPHOSMod() ;
110 Int_t phosmod2 = clu->GetPHOSMod() ;
113 GetLocalPosition(locpos1) ;
115 clu->GetLocalPosition(locpos2) ;
117 if(phosmod1 == phosmod2 ) {
118 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
123 else if(locpos1.Z()>locpos2.Z())
130 if(phosmod1 < phosmod2 )
140 //______________________________________________________________________________
141 void AliPHOSCpvRecPoint::ExecuteEvent(Int_t event, Int_t px, Int_t py) const
143 // // Execute action corresponding to one event
144 // // This member function is called when a AliPHOSRecPoint is clicked with the locator
146 // // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
147 // // and switched off when the mouse button is released.
150 // // static Int_t pxold, pyold;
152 // AliPHOSGetter * gime = AliPHOSGetter::GetInstance() ;
154 // static TGraph * digitgraph = 0 ;
156 // if (!gPad->IsEditable()) return;
158 // TH2F * histo = 0 ;
159 // TCanvas * histocanvas ;
163 // case kButton1Down: {
164 // AliPHOSDigit * digit ;
165 // AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
169 // const Int_t kMulDigit = AliPHOSCpvRecPoint::GetDigitsMultiplicity() ;
170 // Float_t * xi = new Float_t[kMulDigit] ;
171 // Float_t * zi = new Float_t[kMulDigit] ;
173 // // create the histogram for the single cluster
174 // // 1. gets histogram boundaries
175 // Float_t ximax = -999. ;
176 // Float_t zimax = -999. ;
177 // Float_t ximin = 999. ;
178 // Float_t zimin = 999. ;
180 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
181 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
182 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
183 // phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
184 // if ( xi[iDigit] > ximax )
185 // ximax = xi[iDigit] ;
186 // if ( xi[iDigit] < ximin )
187 // ximin = xi[iDigit] ;
188 // if ( zi[iDigit] > zimax )
189 // zimax = zi[iDigit] ;
190 // if ( zi[iDigit] < zimin )
191 // zimin = zi[iDigit] ;
193 // ximax += phosgeom->GetCrystalSize(0) / 2. ;
194 // zimax += phosgeom->GetCrystalSize(2) / 2. ;
195 // ximin -= phosgeom->GetCrystalSize(0) / 2. ;
196 // zimin -= phosgeom->GetCrystalSize(2) / 2. ;
197 // Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
198 // Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
200 // // 2. gets the histogram title
202 // Text_t title[100] ;
203 // sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
209 // histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
212 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
213 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
214 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
215 // phosgeom->RelPosInModule(relid, x, z);
216 // histo->Fill(x, z, fEnergyList[iDigit] ) ;
219 // if (!digitgraph) {
220 // digitgraph = new TGraph(kMulDigit,xi,zi);
221 // digitgraph-> SetMarkerStyle(5) ;
222 // digitgraph-> SetMarkerSize(1.) ;
223 // digitgraph-> SetMarkerColor(1) ;
224 // digitgraph-> Paint("P") ;
228 // histocanvas = new TCanvas("cluser", "a single cluster", 600, 500) ;
229 // histocanvas->Draw() ;
230 // histo->Draw("lego1") ;
240 // delete digitgraph ;
248 //____________________________________________________________________________
249 void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits)
251 // wraps other methods
252 AliPHOSEmcRecPoint::EvalAll(logWeight,digits) ;
253 EvalClusterLengths(digits) ;
255 //____________________________________________________________________________
256 void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits)
258 // Calculates the center of gravity in the local PHOS-module coordinates
267 AliPHOSDigit * digit ;
269 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
273 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
274 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]);
278 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
279 phosgeom->RelPosInModule(relid, xi, zi);
280 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
292 if (fMulDigit != 0) cout << "AliPHOSCpvRecPoint: too low log weight factor "
293 << "to evaluate cluster's center\n";
301 //____________________________________________________________________________
302 void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits)
304 //Modified 15.03.2001 by Dmitri Peressounko
306 // Calculates the cluster lengths along X and Z axes
307 // These characteristics are needed for CPV to tune
308 // digitization+reconstruction to experimental data
309 // Yuri Kharlov. 24 October 2000
313 AliPHOSDigit * digit ;
315 AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
317 const Int_t kMaxLeng=20;
318 Int_t idX[kMaxLeng], idZ[kMaxLeng];
323 for(Int_t iDigit=0; iDigit<fMulDigit; iDigit++) {
324 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
325 Int_t absId = digit->GetId();
326 phosgeom->AbsToRelNumbering(absId, relid) ;
330 for (i=0; i<fLengX; i++) if (relid[2]==idX[i]) { dejavu=kTRUE; break; }
332 idX[fLengX]=relid[2];
334 fLengX = TMath::Min(fLengX,kMaxLeng);
338 for (i=0; i<fLengZ; i++) if (relid[3]==idZ[i]) { dejavu=kTRUE; break; }
340 idZ[fLengZ]=relid[3];
342 fLengZ = TMath::Min(fLengZ,kMaxLeng);
349 //____________________________________________________________________________
350 void AliPHOSCpvRecPoint::Print(Option_t * option)
352 // Print the list of digits belonging to the cluster
354 cout << "AliPHOSCpvRecPoint: " << endl ;
358 cout << "Digits # " ;
359 for(iDigit=0; iDigit<fMulDigit; iDigit++)
360 cout << fDigitsList[iDigit] << " " ;
363 cout << "Energies: " ;
364 for(iDigit=0; iDigit<fMulDigit; iDigit++)
365 cout << fEnergyList[iDigit] << " " ;
368 cout << " Multiplicity = " << fMulDigit << endl ;
369 cout << " Cluster Energy = " << fAmp << endl ;
370 cout << " Stored at position " << GetIndexInList() << endl ;