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