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 ---
28 #include "TClonesArray.h"
30 // --- Standard library ---
32 // --- AliRoot header files ---
33 #include "AliPHOSGeometry.h"
34 #include "AliPHOSDigit.h"
35 #include "AliPHOSCpvRecPoint.h"
36 #include "AliPHOSLoader.h"
38 ClassImp(AliPHOSCpvRecPoint)
40 //____________________________________________________________________________
41 AliPHOSCpvRecPoint::AliPHOSCpvRecPoint() : AliPHOSEmcRecPoint()
49 //____________________________________________________________________________
50 AliPHOSCpvRecPoint::AliPHOSCpvRecPoint(const char * opt) : AliPHOSEmcRecPoint(opt)
58 //____________________________________________________________________________
59 AliPHOSCpvRecPoint::~AliPHOSCpvRecPoint()
64 //____________________________________________________________________________
65 Bool_t AliPHOSCpvRecPoint::AreNeighbours(AliPHOSDigit * digit1, AliPHOSDigit * digit2 ) const
67 // Tells if (true) or not (false) two digits are neighbors)
69 Bool_t aren = kFALSE ;
71 AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry();
74 phosgeom->AbsToRelNumbering(digit1->GetId(), relid1) ;
77 phosgeom->AbsToRelNumbering(digit2->GetId(), relid2) ;
79 Int_t rowdiff = TMath::Abs( relid1[2] - relid2[2] ) ;
80 Int_t coldiff = TMath::Abs( relid1[3] - relid2[3] ) ;
82 if (( coldiff <= 1 ) && ( rowdiff <= 1 ) && (coldiff + rowdiff > 0))
88 //____________________________________________________________________________
89 Int_t AliPHOSCpvRecPoint::Compare(const TObject * obj) const
91 // Compares two RecPoints according to their position in the PHOS modules
93 Float_t delta = 1 ; //Width of "Sorting row". If you changibg this
94 //value (what is senseless) change as vell delta in
95 //AliPHOSTrackSegmentMakerv* and other RecPoints...
99 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
101 Int_t phosmod1 = GetPHOSMod() ;
102 Int_t phosmod2 = clu->GetPHOSMod() ;
105 GetLocalPosition(locpos1) ;
107 clu->GetLocalPosition(locpos2) ;
109 if(phosmod1 == phosmod2 ) {
110 Int_t rowdif = (Int_t)TMath::Ceil(locpos1.X()/delta)-(Int_t)TMath::Ceil(locpos2.X()/delta) ;
115 else if(locpos1.Z()>locpos2.Z())
122 if(phosmod1 < phosmod2 )
132 //______________________________________________________________________________
133 void AliPHOSCpvRecPoint::ExecuteEvent(Int_t, Int_t, Int_t ) const
135 // // Execute action corresponding to one event
136 // // This member function is called when a AliPHOSRecPoint is clicked with the locator
138 // // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
139 // // and switched off when the mouse button is released.
142 // // static Int_t pxold, pyold;
144 // AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ;
146 // static TGraph * digitgraph = 0 ;
148 // if (!gPad->IsEditable()) return;
150 // TH2F * histo = 0 ;
151 // TCanvas * histocanvas ;
155 // case kButton1Down: {
156 // AliPHOSDigit * digit ;
157 // AliPHOSGeometry * phosgeom = (AliPHOSGeometry *) fGeom ;
161 // const Int_t kMulDigit = AliPHOSCpvRecPoint::GetDigitsMultiplicity() ;
162 // Float_t * xi = new Float_t[kMulDigit] ;
163 // Float_t * zi = new Float_t[kMulDigit] ;
165 // // create the histogram for the single cluster
166 // // 1. gets histogram boundaries
167 // Float_t ximax = -999. ;
168 // Float_t zimax = -999. ;
169 // Float_t ximin = 999. ;
170 // Float_t zimin = 999. ;
172 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
173 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
174 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
175 // phosgeom->RelPosInModule(relid, xi[iDigit], zi[iDigit]);
176 // if ( xi[iDigit] > ximax )
177 // ximax = xi[iDigit] ;
178 // if ( xi[iDigit] < ximin )
179 // ximin = xi[iDigit] ;
180 // if ( zi[iDigit] > zimax )
181 // zimax = zi[iDigit] ;
182 // if ( zi[iDigit] < zimin )
183 // zimin = zi[iDigit] ;
185 // ximax += phosgeom->GetCrystalSize(0) / 2. ;
186 // zimax += phosgeom->GetCrystalSize(2) / 2. ;
187 // ximin -= phosgeom->GetCrystalSize(0) / 2. ;
188 // zimin -= phosgeom->GetCrystalSize(2) / 2. ;
189 // Int_t xdim = (int)( (ximax - ximin ) / phosgeom->GetCrystalSize(0) + 0.5 ) ;
190 // Int_t zdim = (int)( (zimax - zimin ) / phosgeom->GetCrystalSize(2) + 0.5 ) ;
192 // // 2. gets the histogram title
194 // Text_t title[100] ;
195 // sprintf(title,"Energy=%1.2f GeV ; Digits ; %d ", GetEnergy(), GetDigitsMultiplicity()) ;
201 // histo = new TH2F("cluster3D", title, xdim, ximin, ximax, zdim, zimin, zimax) ;
204 // for(iDigit=0; iDigit<kMulDigit; iDigit++) {
205 // digit = (AliPHOSDigit *) ( gime->Digit(fDigitsList[iDigit]) ) ;
206 // phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
207 // phosgeom->RelPosInModule(relid, x, z);
208 // histo->Fill(x, z, fEnergyList[iDigit] ) ;
211 // if (!digitgraph) {
212 // digitgraph = new TGraph(kMulDigit,xi,zi);
213 // digitgraph-> SetMarkerStyle(5) ;
214 // digitgraph-> SetMarkerSize(1.) ;
215 // digitgraph-> SetMarkerColor(1) ;
216 // digitgraph-> Paint("P") ;
220 // histocanvas = new TCanvas("cluser", "a single cluster", 600, 500) ;
221 // histocanvas->Draw() ;
222 // histo->Draw("lego1") ;
232 // delete digitgraph ;
240 //____________________________________________________________________________
241 void AliPHOSCpvRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits)
243 // wraps other methods
244 AliPHOSEmcRecPoint::EvalAll(logWeight,digits) ;
245 EvalClusterLengths(digits) ;
247 //____________________________________________________________________________
248 void AliPHOSCpvRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits)
250 // Calculates the center of gravity in the local PHOS-module coordinates
259 AliPHOSDigit * digit ;
261 AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry();
265 for(iDigit=0; iDigit<fMulDigit; iDigit++) {
266 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]);
270 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
271 phosgeom->RelPosInModule(relid, xi, zi);
272 Float_t w = TMath::Max( 0., logWeight + TMath::Log( fEnergyList[iDigit] / fAmp ) ) ;
285 Warning(":EvalLocalPosition", "Too low log weight factor to evaluate cluster's center" ) ;
294 //____________________________________________________________________________
295 void AliPHOSCpvRecPoint::EvalClusterLengths(TClonesArray * digits)
297 //Modified 15.03.2001 by Dmitri Peressounko
299 // Calculates the cluster lengths along X and Z axes
300 // These characteristics are needed for CPV to tune
301 // digitization+reconstruction to experimental data
302 // Yuri Kharlov. 24 October 2000
306 AliPHOSDigit * digit ;
308 AliPHOSGeometry * phosgeom = AliPHOSLoader::GetPHOSGeometry();
310 const Int_t kMaxLeng=20;
311 Int_t idX[kMaxLeng], idZ[kMaxLeng];
316 for(Int_t iDigit=0; iDigit<fMulDigit; iDigit++) {
317 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
318 Int_t absId = digit->GetId();
319 phosgeom->AbsToRelNumbering(absId, relid) ;
323 for (i=0; i<fLengX; i++) if (relid[2]==idX[i]) { dejavu=kTRUE; break; }
325 idX[fLengX]=relid[2];
327 fLengX = TMath::Min(fLengX,kMaxLeng);
331 for (i=0; i<fLengZ; i++) if (relid[3]==idZ[i]) { dejavu=kTRUE; break; }
333 idZ[fLengZ]=relid[3];
335 fLengZ = TMath::Min(fLengZ,kMaxLeng);
342 //____________________________________________________________________________
343 void AliPHOSCpvRecPoint::Print()
345 // Print the list of digits belonging to the cluster
348 message = "AliPHOSCpvRecPoint: " ;
349 message += "Digits # " ;
350 Info("Print", message.Data()) ;
354 for(iDigit=0; iDigit<fMulDigit; iDigit++)
355 Info("Print", " %d ", fDigitsList[iDigit]) ;
357 Info("Print", "Energies: ") ;
358 for(iDigit=0; iDigit<fMulDigit; iDigit++)
359 Info("Print", " %f ", fEnergyList[iDigit]) ;
361 message = " Multiplicity = %d\n" ;
362 message += " Cluster Energy = %f\n" ;
363 message += " Stored at position %d\n" ;
365 Info("Print", message.Data(), fMulDigit, fAmp, GetIndexInList() ) ;