]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFdigit.cxx
removal of effective c++ warnings (C.Zampolli)+ use of additional calib parameters...
[u/mrichter/AliRoot.git] / TOF / AliTOFdigit.cxx
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  **************************************************************************/
15
16 /* $Id$ */
17
18 //_________________________________________________________________________//
19 //                                                                         //
20 //  TOF digit: member variables                                            //
21 //  fSector  : TOF sector                                                  //
22 //  fPlate   : TOF plate                                                   //
23 //  fStrip   : strips number                                               //
24 //  fPadx    : pad number along x                                          //
25 //  fPadz    : pad number along z                                          //
26 //  fTdc     : TDC                                                         //
27 //  fAdc     : ADC                                                         //
28 //                                                                         //
29 //  Getters, setters and member functions  defined here                    //
30 //                                                                         //
31 // -- Authors: F. Pierella, A. Seganti, D. Vicinanza                       //
32 //_________________________________________________________________________//
33
34  
35 #include "Riostream.h"
36
37 #include "AliTOFdigit.h"
38 #include "AliTOFGeometry.h"
39
40 ClassImp(AliTOFdigit)
41
42 //______________________________________________________________________________
43 AliTOFdigit::AliTOFdigit(Int_t *tracks, Int_t *vol,Float_t *digit)
44 :AliDigit(tracks)
45 {
46 //
47 // Constructor of digit object
48 //
49
50   fSector = vol[0];
51   fPlate  = vol[1];
52   fStrip  = vol[2];
53   fPadx   = vol[3];
54   fPadz   = vol[4];
55   fTdc    = digit[0];
56   fTdcND  = digit[3];
57   fAdc    = digit[1];
58   fToT    = digit[2];
59
60 }
61
62 //____________________________________________________________________________
63 AliTOFdigit::AliTOFdigit(const AliTOFdigit & digit)
64 :AliDigit(digit)
65 {
66   // 
67   // copy ctor for AliTOFdigit object
68   //
69
70   Int_t i ;
71   for ( i = 0; i < 3 ; i++)
72     fTracks[i]  = digit.fTracks[i] ;
73   fSector = digit.fSector;
74   fPlate  = digit.fPlate;
75   fStrip  = digit.fStrip;
76   fPadx   = digit.fPadx;
77   fPadz   = digit.fPadz;
78   fTdc    = digit.fTdc;
79   fTdcND    = digit.fTdcND;
80   fAdc    = digit.fAdc;
81   fToT = digit.fToT;
82
83 }
84
85 //______________________________________________________________________________
86 AliTOFdigit::AliTOFdigit(Int_t sector, Int_t plate, Int_t strip, Int_t padx,
87 Int_t padz, Float_t tdc, Float_t adc)
88 {
89 //
90 // Constructor for sdigit
91 //
92   fSector = sector;
93   fPlate  = plate;
94   fStrip  = strip;
95   fPadx   = padx;
96   fPadz   = padz;  
97   fTdc    = tdc;   
98   fTdcND    = 0;   
99   fAdc    = adc;     
100   fToT = 0;
101 }
102    
103 //______________________________________________________________________________
104 void AliTOFdigit::GetLocation(Int_t *Loc) const
105 {
106 //
107 // Get the cohordinates of the digit
108 // in terms of Sector - Plate - Strip - Pad
109 //
110
111    Loc[0]=fSector;
112    Loc[1]=fPlate;
113    Loc[2]=fStrip;
114    Loc[3]=fPadx;
115    Loc[4]=fPadz;
116 }
117
118 //______________________________________________________________________________
119 Int_t AliTOFdigit::GetTotPad(AliTOFGeometry *tofGeom) const
120 {
121 //
122 // Get the "total" index of the pad inside a Sector
123 // starting from the digits data.
124 //
125
126   Int_t before=0;
127
128   switch(fPlate){ 
129   case 0:
130     //before = 0;
131     break;
132   case 1:
133     before = tofGeom->NStripC();
134     break;
135   case 2:
136     before = tofGeom->NStripC() +   AliTOFGeometry::NStripB();
137     break;
138   case 3:
139     before = tofGeom->NStripC() +   AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
140     break;
141   case 4:
142     before = tofGeom->NStripC() + 2*AliTOFGeometry::NStripB() + AliTOFGeometry::NStripA();
143     break;
144   }
145   
146   Int_t pad = 2*fPadx + fPadz;
147   //Int_t pad = fPadx+AliTOFGeometry::NpadX()*fPadz;
148   Int_t strip  = fStrip + before;
149   Int_t padTot = AliTOFGeometry::NpadXStrip()*strip + pad;
150
151   return padTot;
152 }
153
154 //______________________________________________________________________________
155 void AliTOFdigit::AddTrack(Int_t track)
156 {
157 //
158 // Add a new and different track to the digit 
159 //
160   if (track==fTracks[0] || track==fTracks[1] || track==fTracks[2]) return;
161    if (fTracks[1]==0){
162       fTracks[1] = track;
163    }else if (fTracks[2]==0){
164       fTracks[2] = track;
165    }else{
166    // printf("AliTOFdigit::AddTrack ERROR: Too many Tracks (>3) \n");
167    }
168 }
169
170 // Overloading of Streaming, Sum and Comparison operators
171
172 //______________________________________________________________________________
173 Bool_t AliTOFdigit::operator==(AliTOFdigit const &digit) const
174 {
175 //
176 // Overloading of Comparison operator
177 //   
178  if (fSector==digit.fSector &&
179      fPlate==digit.fPlate &&
180      fStrip==digit.fStrip &&
181      fPadx==digit.fPadx &&
182      fPadz==digit.fPadz &&
183      fTdc==digit.fTdc &&
184      fTdcND==digit.fTdcND &&
185      fAdc==digit.fAdc &&
186      fToT==digit.fToT ) return kTRUE;
187      else return kFALSE;
188 }
189
190 //______________________________________________________________________________
191 AliTOFdigit& AliTOFdigit::operator+(AliTOFdigit const &digit)
192 {
193 //
194 // Overloading of Sum operator
195 // Note: Some convolution 
196 // between the two digit variables has to be inserted
197 //
198 if  (fSector==digit.fSector &&
199      fPlate==digit.fPlate &&
200      fStrip==digit.fStrip &&
201      fPadx==digit.fPadx &&
202      fPadz==digit.fPadz) {
203                             // convolution to be inserted here
204                              fTdc+=digit.fTdc;
205                              fAdc+=digit.fAdc;
206                            } else
207                 AliTOFdigit(fSector,fPlate,fStrip,fPadx,fPadz,fTdc,fAdc);
208   return *this;
209 }
210
211 //______________________________________________________________________________
212 ostream& operator << (ostream& out, const AliTOFdigit &digit)
213 {
214   //
215   // Output streamer: output of the digit data
216   //
217
218   out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
219   out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
220   out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
221
222   return out;
223 }