New data member (cerenkov angle) in Cerenkov data structure.
[u/mrichter/AliRoot.git] / RICH / DataStructures.cxx
CommitLineData
e885d048 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/*
17 $Log$
04ac79df 18 Revision 1.1 2000/04/19 13:32:48 morsch
19 Data classes for RICH (completely updated) (JB,AM)
20
e885d048 21*/
22
23
24#include "DataStructures.h"
25#include "AliRun.h"
26#include <TObjArray.h>
27#include <TParticle.h>
28
29ClassImp(AliRICHPadHit)
30
31ClassImp(AliRICHHit)
32
33//___________________________________________
34AliRICHHit::AliRICHHit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
35 AliHit(shunt, track)
36{
37 fChamber=vol[0];
38 fParticle=hits[0];
39 fX=hits[1];
40 fY=hits[2];
41 fZ=hits[3];
42 fTheta=hits[4];
43 fPhi=hits[5];
44 fTlength=hits[6];
45 fEloss=hits[7];
46 fPHfirst=(Int_t) hits[8];
47 fPHlast=(Int_t) hits[9];
48 fLoss=hits[13];
49 fMomX=hits[14];
50 fMomY=hits[15];
51 fMomZ=hits[16];
52}
53
54ClassImp(AliRICHCerenkov)
55//___________________________________________
56AliRICHCerenkov::AliRICHCerenkov(Int_t shunt, Int_t track, Int_t *vol, Float_t *hits):
57 AliHit(shunt, track)
58{
59 fChamber=vol[0];
60 fX=hits[1];
61 fY=hits[2];
62 fZ=hits[3];
63 fTheta=hits[4];
64 fPhi=hits[5];
65 fEloss=hits[7];
66 fPHfirst=(Int_t) hits[8];
67 fPHlast=(Int_t) hits[9];
68 fCMother=Int_t(hits[10]);
69 fIndex = hits[11];
70 fProduction = hits[12];
71 fLoss=hits[13];
72 fMomX=hits[14];
73 fMomY=hits[15];
74 fMomZ=hits[16];
04ac79df 75 fCerenkovAngle=hits[17];
e885d048 76}
77
78//___________________________________________
79AliRICHPadHit::AliRICHPadHit(Int_t *clhits)
80{
81 fHitNumber=clhits[0];
82 fCathode=clhits[1];
83 fQ=clhits[2];
84 fPadX=clhits[3];
85 fPadY=clhits[4];
86 fQpad=clhits[5];
87 fRSec=clhits[6];
88}
89
90ClassImp(AliRICHDigit)
91//_____________________________________________________________________________
92AliRICHDigit::AliRICHDigit(Int_t *digits)
93{
94 //
95 // Creates a RICH digit object to be updated
96 //
97 fPadX = digits[0];
98 fPadY = digits[1];
99 fSignal = digits[2];
100
101}
102//_____________________________________________________________________________
103AliRICHDigit::AliRICHDigit(Int_t *tracks, Int_t *charges, Int_t *digits)
104{
105 //
106 // Creates a RICH digit object
107 //
108 fPadX = digits[0];
109 fPadY = digits[1];
110 fSignal = digits[2];
111 for(Int_t i=0; i<100; i++) {
112 fTcharges[i] = charges[i];
113 fTracks[i] = tracks[i];
114 }
115}
116
117ClassImp(AliRICHTransientDigit)
118
119//____________________________________________________________________________
120AliRICHTransientDigit::AliRICHTransientDigit(Int_t ich, Int_t *digits):
121 AliRICHDigit(digits)
122{
123 //
124 // Creates a RICH digit list object
125 //
126
127 fChamber = ich;
128 fTrackList = new TObjArray;
129
130}
131//_____________________________________________________________________________
132
133
134ClassImp(AliRICHRawCluster)
135Int_t AliRICHRawCluster::Compare(TObject *obj)
136{
137 AliRICHRawCluster *raw=(AliRICHRawCluster *)obj;
138 Float_t y=fY;
139 Float_t yo=raw->fY;
140 if (y>yo) return 1;
141 else if (y<yo) return -1;
142 else return 0;
143
144}
145
146Int_t AliRICHRawCluster::
147BinarySearch(Float_t y, TArrayF coord, Int_t from, Int_t upto)
148{
149 // Find object using a binary search. Array must first have been sorted.
150 // Search can be limited by setting upto to desired index.
151
152 Int_t low=from, high=upto-1, half;
153 while(high-low>1) {
154 half=(high+low)/2;
155 if(y>coord[half]) low=half;
156 else high=half;
157 }
158 return low;
159}
160
161void AliRICHRawCluster::SortMin(Int_t *idx,Float_t *xdarray,Float_t *xarray,Float_t *yarray,Float_t *qarray, Int_t ntr)
162{
163 //
164 // Get the 3 closest points(cog) one can find on the second cathode
165 // starting from a given cog on first cathode
166 //
167
168 //
169 // Loop over deltax, only 3 times
170 //
171
172 Float_t xmin;
173 Int_t jmin;
174 Int_t id[3] = {-2,-2,-2};
175 Float_t jx[3] = {0.,0.,0.};
176 Float_t jy[3] = {0.,0.,0.};
177 Float_t jq[3] = {0.,0.,0.};
178 Int_t jid[3] = {-2,-2,-2};
179 Int_t i,j,imax;
180
181 if (ntr<3) imax=ntr;
182 else imax=3;
183 for(i=0;i<imax;i++){
184 xmin=1001.;
185 jmin=0;
186
187 for(j=0;j<ntr;j++){
188 if ((i == 1 && j == id[i-1])
189 ||(i == 2 && (j == id[i-1] || j == id[i-2]))) continue;
190 if (TMath::Abs(xdarray[j]) < xmin) {
191 xmin = TMath::Abs(xdarray[j]);
192 jmin=j;
193 }
194 } // j
195 if (xmin != 1001.) {
196 id[i]=jmin;
197 jx[i]=xarray[jmin];
198 jy[i]=yarray[jmin];
199 jq[i]=qarray[jmin];
200 jid[i]=idx[jmin];
201 }
202
203 } // i
204
205 for (i=0;i<3;i++){
206 if (jid[i] == -2) {
207 xarray[i]=1001.;
208 yarray[i]=1001.;
209 qarray[i]=1001.;
210 idx[i]=-1;
211 } else {
212 xarray[i]=jx[i];
213 yarray[i]=jy[i];
214 qarray[i]=jq[i];
215 idx[i]=jid[i];
216 }
217 }
218
219}
220
221
222Int_t AliRICHRawCluster::PhysicsContribution()
223{
224 Int_t iPhys=0;
225 Int_t iBg=0;
226 Int_t iMixed=0;
227 for (Int_t i=0; i<fMultiplicity; i++) {
228 if (fPhysicsMap[i]==2) iPhys++;
229 if (fPhysicsMap[i]==1) iMixed++;
230 if (fPhysicsMap[i]==0) iBg++;
231 }
232 if (iMixed==0 && iBg==0) {
233 return 2;
234 } else if ((iPhys != 0 && iBg !=0) || iMixed != 0) {
235 return 1;
236 } else {
237 return 0;
238 }
239}
240//_____________________________________________________________________________
241
242
243ClassImp(AliRICHRecHit)
244
245
246//_____________________________________________________________________________
247AliRICHRecHit::AliRICHRecHit(Int_t id, Float_t *rechit)
248{
249 //
250 // Creates a RICH rec. hit object
251 //
252 Theta = rechit[0];
253 Phi = rechit[1];
254 Omega = rechit[2];
255 fX = rechit[3];
256 fY = rechit[4];
257}