]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PHOS/AliPHOSPpsdRecPoint.cxx
Fix for transient fSDigits, AliITSRawStream classes adapted to changed AliRawReader...
[u/mrichter/AliRoot.git] / PHOS / AliPHOSPpsdRecPoint.cxx
CommitLineData
d15a28e7 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 **************************************************************************/
b2a60966 15/* $Id$ */
d15a28e7 16//_________________________________________________________________________
b2a60966 17// A RecPoint (cluster) in the PPSD
18// A PPSD RecPoint ends up to be a single digit
2f04ed65 19// Why should I put meaningless comments
20// just to satisfy
21// the code checker
b2a60966 22//
23//*-- Yves Schutz (SUBATECH)
d15a28e7 24
25// --- ROOT system ---
b2a60966 26
9f616d61 27#include "TPad.h"
b2a60966 28
d15a28e7 29// --- Standard library ---
30
d15a28e7 31// --- AliRoot header files ---
32
33#include "AliPHOSGeometry.h"
34#include "AliPHOSPpsdRecPoint.h"
c4073cad 35#include "AliPHOSCpvRecPoint.h"
d15a28e7 36#include "AliRun.h"
88cb7938 37#include "AliPHOSLoader.h"
d15a28e7 38
39ClassImp(AliPHOSPpsdRecPoint)
40
41//____________________________________________________________________________
42AliPHOSPpsdRecPoint::AliPHOSPpsdRecPoint(void)
43{
b2a60966 44 // ctor
45
d15a28e7 46 fMulDigit = 0 ;
d15a28e7 47 fLocPos.SetX(1000000.) ; //Local position should be evaluated
48}
49
d15a28e7 50//____________________________________________________________________________
83974468 51void AliPHOSPpsdRecPoint::AddDigit(AliPHOSDigit & digit, Float_t Energy)
d15a28e7 52{
53 // adds a digit to the digits list
54 // and accumulates the total amplitude and the multiplicity
55
56
57 if ( fMulDigit >= fMaxDigit ) { // increase the size of the lists
9f616d61 58 fMaxDigit*=2 ;
59 int * tempo = new ( int[fMaxDigit] ) ;
d15a28e7 60 Int_t index ;
61
62 for ( index = 0 ; index < fMulDigit ; index++ )
63 tempo[index] = fDigitsList[index] ;
64
9f616d61 65 delete [] fDigitsList ;
66 fDigitsList = new ( int[fMaxDigit] ) ;
67
68 for ( index = 0 ; index < fMulDigit ; index++ )
69 fDigitsList[index] = tempo[index] ;
70
71 delete [] tempo ;
d15a28e7 72 }
9f616d61 73
83974468 74 fDigitsList[fMulDigit++] = digit.GetIndexInList() ;
d15a28e7 75 fAmp += Energy ;
2731cd1e 76 EvalPHOSMod(&digit) ;
d15a28e7 77}
78
d15a28e7 79//____________________________________________________________________________
2a941f4e 80Int_t AliPHOSPpsdRecPoint::Compare(const TObject * obj) const
d15a28e7 81{
b2a60966 82 // Compares according to the position
2731cd1e 83 Float_t delta = 1 ; //width of the "Sorting row"
84
d15a28e7 85 Int_t rv ;
86
c4073cad 87 if( (strcmp(obj->ClassName() , "AliPHOSPpsdRecPoint" )) == 0) // PPSD Rec Point
88 {
89 AliPHOSPpsdRecPoint * clu = (AliPHOSPpsdRecPoint *)obj ;
90
2731cd1e 91 Float_t x1 , z1 ; //This rec point
92 Float_t x2 , z2 ; //
c4073cad 93
94 Int_t phosmod1 ;
95 Int_t phosmod2 ;
96
97 Int_t up1 ;
98 Int_t up2 ;
d15a28e7 99
c4073cad 100 if(GetUp()) // upper layer
101 up1 = 0 ;
102 else // lower layer
103 up1 = 1 ;
104
105 if(clu->GetUp()) // upper layer
106 up2 = 0 ;
107 else // lower layer
108 up2 = 1 ;
109
110 TVector3 posloc ;
2731cd1e 111 GetLocalPosition(posloc) ;
c4073cad 112 x1 = posloc.X() ;
113 z1 = posloc.Z() ;
2731cd1e 114 phosmod1 = GetPHOSMod();
c4073cad 115 clu->GetLocalPosition(posloc) ;
116 x2 = posloc.X() ;
117 z2 = posloc.Z() ;
118 phosmod2 = clu->GetPHOSMod();
119
120 if(phosmod1 == phosmod2 ) {
121
122 if(up1 == up2 ){
2731cd1e 123 Int_t rowdif = (Int_t)TMath::Ceil(x1/delta) - (Int_t) TMath::Ceil(x2/delta) ;
c4073cad 124
125 if (rowdif> 0)
2731cd1e 126 rv = 1 ;
127 else if(rowdif < 0)
c4073cad 128 rv = -1 ;
c4073cad 129 else if(z1>z2)
130 rv = -1 ;
131 else
132 rv = 1 ;
133 }
134
135 else {
136
137 if(up1 < up2 ) // Upper level first (up = True or False, True > False)
2731cd1e 138 rv = -1 ;
c4073cad 139 else
2731cd1e 140 rv = 1 ;
c4073cad 141 }
142
143 } // if phosmod1 == phosmod2
144
145 else {
146
147 if(phosmod1 < phosmod2 )
148 rv = -1 ;
149 else
150 rv = 1 ;
151
152 }
153
154 return rv ;
d15a28e7 155 }
c4073cad 156 else
157 {
158 AliPHOSCpvRecPoint * clu = (AliPHOSCpvRecPoint *) obj ;
2731cd1e 159 if(GetPHOSMod() < clu->GetPHOSMod() )
c4073cad 160 rv = -1 ;
d15a28e7 161 else
c4073cad 162 rv = 1 ;
163 return rv ;
d15a28e7 164 }
d15a28e7 165
d15a28e7 166
d15a28e7 167}
168
169//____________________________________________________________________________
a4e98857 170void AliPHOSPpsdRecPoint::EvalAll(Float_t logWeight,TClonesArray * digits )
171{
172 // calculates all the characteristics of the RecPoint
2731cd1e 173 AliPHOSRecPoint::EvalAll(logWeight,digits) ;
174 EvalLocalPosition(logWeight,digits) ;
175 EvalUp(digits) ;
ad8cfaf4 176}
177
178//____________________________________________________________________________
2731cd1e 179void AliPHOSPpsdRecPoint::EvalLocalPosition(Float_t logWeight,TClonesArray * digits )
b2a60966 180{
a4e98857 181 // Calculates the local position in the PHOS-PPSD-module coordinates
b2a60966 182
d15a28e7 183 Int_t relid[4] ;
184
185 Float_t x = 0. ;
186 Float_t z = 0. ;
187
88cb7938 188 AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ;
7b7c1533 189 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
d15a28e7 190
191 AliPHOSDigit * digit ;
192 Int_t iDigit;
193
6ad0bfa0 194 for(iDigit = 0; iDigit < fMulDigit; iDigit++) {
2731cd1e 195 digit = (AliPHOSDigit *) digits->At(fDigitsList[iDigit]) ;
d15a28e7 196
197 Float_t xi ;
198 Float_t zi ;
92862013 199 phosgeom->AbsToRelNumbering(digit->GetId(), relid) ;
200 phosgeom->RelPosInModule(relid, xi, zi);
d15a28e7 201 x += xi ;
202 z += zi ;
203 }
204
6ad0bfa0 205 x /= fMulDigit ;
206 z /= fMulDigit ;
d15a28e7 207
208 fLocPos.SetX(x) ;
209 fLocPos.SetY(0.) ;
210 fLocPos.SetZ(z) ;
211
d15a28e7 212}
213
214//____________________________________________________________________________
2731cd1e 215void AliPHOSPpsdRecPoint::EvalUp(TClonesArray * digits)
d15a28e7 216{
6c370def 217 // Are we in the uper PPSD module ?
218
d15a28e7 219 Int_t relid[4] ;
220
88cb7938 221 AliPHOSLoader * gime = AliPHOSLoader::GetInstance() ;
7b7c1533 222 AliPHOSGeometry * phosgeom = (AliPHOSGeometry*)gime->PHOSGeometry();
d15a28e7 223
83974468 224
2731cd1e 225 AliPHOSDigit *digit = (AliPHOSDigit *) digits->At(fDigitsList[0]) ;
d15a28e7 226
92862013 227 phosgeom->AbsToRelNumbering(digit->GetId(),relid);
d15a28e7 228
229 if((Int_t)TMath::Ceil((Float_t)relid[1]/
92862013 230 (phosgeom->GetNumberOfModulesPhi()*phosgeom->GetNumberOfModulesZ())-0.0001 ) > 1)
2731cd1e 231 fUp = kFALSE ;
d15a28e7 232 else
2731cd1e 233 fUp = kTRUE ;
d15a28e7 234
d15a28e7 235}
9f616d61 236//______________________________________________________________________________
237void AliPHOSPpsdRecPoint::Paint(Option_t *)
238{
b2a60966 239 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiRecPoint as a TMarker with its current attributes*-*-*-*-*-*-*
240 //*-* =============================================
241
242 TVector3 pos(0.,0.,0.) ;
243 GetLocalPosition(pos) ;
244 Coord_t x = pos.X() ;
245 Coord_t y = pos.Z() ;
246 Color_t markercolor = 1 ;
247 Size_t markersize = 1. ;
248 Style_t markerstyle = 2 ;
249 if (GetUp())
250 markerstyle = 3 ;
251
252 if (!gPad->IsBatch()) {
253 gVirtualX->SetMarkerColor(markercolor);
254 gVirtualX->SetMarkerSize (markersize);
255 gVirtualX->SetMarkerStyle(markerstyle);
256 }
257 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize);
258 gPad->PaintPolyMarker(1,&x,&y,"");
259
260
9f616d61 261}
d15a28e7 262
263//____________________________________________________________________________
264void AliPHOSPpsdRecPoint::Print(Option_t * option)
265{
b2a60966 266 // Print the digits information
267
21cd0c07 268 Info("Print","AliPHOSPpsdRecPoint: " ) ;
d15a28e7 269
2731cd1e 270 Int_t iDigit;
21cd0c07 271 Info("Print"," Digit{s} # ") ;
2731cd1e 272 for(iDigit=0; iDigit<fMulDigit; iDigit++)
21cd0c07 273 Info("Print", "%d", fDigitsList[iDigit]) ;
274 Info("Print"," Multiplicity = %d", fMulDigit ) ;
275 Info("Print"," Stored at position %d", fIndexInList ) ;
d15a28e7 276}
277
278