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 //_________________________________________________________________________
21 // 3 identifiers for the primary particle(s) at the origine of the digit
22 // The digits are made in FinishEvent() by summing all the hits in a single PHOS crystal or PPSD gas cell
23 // It would be nice to replace the 3 identifiers by an array, but, because digits are kept in a TClonesQArray,
24 // it is not possible to stream such an array... (beyond my understqnding!)
26 //*-- Author: Laurent Aphecetche & Yves Schutz (SUBATECH)
29 // --- ROOT system ---
31 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliPHOSDigit.h"
40 ClassImp(AliPHOSDigit)
42 //____________________________________________________________________________
43 AliPHOSDigit::AliPHOSDigit()
54 //____________________________________________________________________________
55 AliPHOSDigit::AliPHOSDigit(Int_t primary, Int_t id, Int_t DigEnergy, Int_t index)
61 fIndexInList = index ;
68 //____________________________________________________________________________
69 AliPHOSDigit::AliPHOSDigit(const AliPHOSDigit & digit)
75 fIndexInList = digit.fIndexInList ;
76 fNprimary = digit.fNprimary ;
77 fPrimary1 = digit.fPrimary1 ;
78 fPrimary2 = digit.fPrimary2 ;
79 fPrimary3 = digit.fPrimary3 ;
82 //____________________________________________________________________________
83 Int_t AliPHOSDigit::Compare(TObject * obj)
85 // Compares two digits with respect to its Id
86 // to sort according increasing Id
90 AliPHOSDigit * digit = (AliPHOSDigit *)obj ;
92 Int_t iddiff = fId - digit->GetId() ;
96 else if ( iddiff < 0 )
105 //____________________________________________________________________________
106 Int_t AliPHOSDigit::GetPrimary(Int_t index) const
108 // Returns the primary particle id index =1,2,3
112 cout << "AliPHOSDigit ERROR > only 3 primaries allowed" << endl ;
131 //____________________________________________________________________________
132 Bool_t AliPHOSDigit::operator==(AliPHOSDigit const & digit) const
134 // Two digits are equal if they have the same Id
136 if ( fId == digit.fId )
142 //____________________________________________________________________________
143 AliPHOSDigit& AliPHOSDigit::operator+(AliPHOSDigit const & digit)
145 // Adds the amplitude of digits and completes the list of primary particles
149 // Here comes something crummy ... but I do not know how to stream pointers
150 // because AliPHOSDigit is in a TCLonesArray
153 tempo1[0] = fPrimary1 ;
154 tempo1[1] = fPrimary2 ;
155 tempo1[2] = fPrimary3 ;
158 tempo2[0] = digit.fPrimary1 ;
159 tempo2[1] = digit.fPrimary2 ;
160 tempo2[2] = digit.fPrimary3 ;
162 Int_t max1 = fNprimary ;
163 Int_t max2 = digit.fNprimary ;
165 if ( fNprimary >= 3 ) {
166 cout << "AliPHOSDigit + operator ERROR > too many primaries, modify AliPHOSDigit" << endl ;
169 fNprimary += digit.fNprimary ;
170 if ( fNprimary > 3 ) {
171 cout << "AliPHOSDigit + operator ERROR > too many primaries, modify AliPHOSDigit" << endl ;
177 for (index = 0 ; index < 3 ; index++)
180 for (index = 0 ; index < max1 ; index++)
181 tempo3[index] = tempo1[index] ;
183 for (index = 0 ; index < max2 ; index++)
184 tempo3[index+max1] = tempo2[index] ;
186 fPrimary1 = tempo3[0] ;
187 fPrimary2 = tempo3[1] ;
188 fPrimary3 = tempo3[2] ;
191 // end of crummy stuff
196 //____________________________________________________________________________
197 ostream& operator << ( ostream& out , const AliPHOSDigit & digit)
199 // Prints the data of the digit
201 out << "ID " << digit.fId << " Energy = " << digit.fAmp << endl
202 << "Primary 1 = " << digit.fPrimary1 << endl
203 << "Primary 2 = " << digit.fPrimary2 << endl
204 << "Primary 3 = " << digit.fPrimary3 << endl
205 << "Position in list = " << digit.fIndexInList << endl ;