Increment the version number
[u/mrichter/AliRoot.git] / RICH / AliRICHChamber.cxx
CommitLineData
2e5f0f7b 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$
37387576 18 Revision 1.13 2001/11/06 18:29:36 dibari
19 minor correcttion of Taligent rules
20
2d857021 21 Revision 1.12 2001/09/07 08:38:10 hristov
22 Pointers initialised to 0 in the default constructors
23
edf34242 24 Revision 1.11 2001/05/10 12:35:39 jbarbosa
25 Update.
26
b577b475 27 Revision 1.10 2001/02/23 17:21:17 jbarbosa
28 Re-definition of IntPH() to accomodate for wire sag effect.
29
733b4fa4 30 Revision 1.9 2001/02/13 20:15:34 jbarbosa
31 Removed fNsec (number of cathodes - obsolete) related loops and calls.
32
f73582a8 33 Revision 1.8 2000/12/18 17:45:43 jbarbosa
34 Cleaned up PadHits object.
35
176a9917 36 Revision 1.7 2000/10/03 21:44:09 morsch
37 Use AliSegmentation and AliHit abstract base classes.
38
a2f7eaf6 39 Revision 1.6 2000/10/02 15:44:37 jbarbosa
40 Fixed forward declarations.
41
488e98ba 42 Revision 1.5 2000/07/13 16:19:45 fca
43 Mainly coding conventions + some small bug fixes
44
ef42d733 45 Revision 1.4 2000/06/30 16:48:58 dibari
46 New function GenerateTresholds() for pedestal simulation.
47
4faf338d 48 Revision 1.3 2000/06/12 15:17:58 jbarbosa
49 Cleaned up version.
50
237c933d 51 Revision 1.2 2000/05/18 13:45:57 jbarbosa
52 Fixed feedback photon origin coordinates
53
64cdfc12 54 Revision 1.1 2000/04/19 12:57:20 morsch
55 Newly structured and updated version (JB, AM)
56
2e5f0f7b 57*/
58
59
60#include "AliRICHChamber.h"
237c933d 61
2e5f0f7b 62#include <TLorentzVector.h>
63#include <TParticle.h>
64#include <TRandom.h>
488e98ba 65#include <TObjArray.h>
66#include <TRotMatrix.h>
67#include <AliRICHTresholdMap.h>
a2f7eaf6 68#include <AliSegmentation.h>
733b4fa4 69#include <AliRICHSegmentationV0.h>
488e98ba 70#include <AliRICHGeometry.h>
71#include <AliRICHResponse.h>
2e5f0f7b 72
73ClassImp(AliRICHChamber)
74
75AliRICHChamber::AliRICHChamber()
76{
37387576 77// default ctor
237c933d 78
2d857021 79 fpRotMatrix = 0;
2e5f0f7b 80 fSegmentation = 0;
4faf338d 81 fResponse = 0;
82 fGeometry = 0;
edf34242 83 fReconstruction = 0;
4faf338d 84 fTresh = 0;
85 frMin = 0.1;
86 frMax = 140;
ef42d733 87 for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
2e5f0f7b 88}
89
2e5f0f7b 90void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
91{
237c933d 92// Local coordinates to global coordinates transformation
93
2d857021 94 Double_t *pMatrix;
95 pMatrix = fpRotMatrix->GetMatrix();
96 Globalpos[0]=pos[0]*pMatrix[0]+pos[1]*pMatrix[3]+pos[2]*pMatrix[6];
97 Globalpos[1]=pos[0]*pMatrix[1]+pos[1]*pMatrix[4]+pos[2]*pMatrix[7];
98 Globalpos[2]=pos[0]*pMatrix[2]+pos[1]*pMatrix[5]+pos[2]*pMatrix[8];
99 Globalpos[0]+=fX;
100 Globalpos[1]+=fY;
101 Globalpos[2]+=fZ;
2e5f0f7b 102}
103
104void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
105{
2d857021 106//
237c933d 107// Global coordinates to local coordinates transformation
2d857021 108//
109 TMatrix matrixCopy(3,3);
110 Double_t *pMatrixOrig = fpRotMatrix->GetMatrix();
2e5f0f7b 111 for(Int_t i=0;i<3;i++)
112 {
113 for(Int_t j=0;j<3;j++)
2d857021 114 matrixCopy(j,i)=pMatrixOrig[j+3*i];
2e5f0f7b 115 }
2d857021 116 matrixCopy.Invert();
117 Localpos[0] = pos[0] - fX;
118 Localpos[1] = pos[1] - fY;
119 Localpos[2] = pos[2] - fZ;
120 Localpos[0]=Localpos[0]*matrixCopy(0,0)+Localpos[1]*matrixCopy(0,1)+Localpos[2]*matrixCopy(0,2);
121 Localpos[1]=Localpos[0]*matrixCopy(1,0)+Localpos[1]*matrixCopy(1,1)+Localpos[2]*matrixCopy(1,2);
122 Localpos[2]=Localpos[0]*matrixCopy(2,0)+Localpos[1]*matrixCopy(2,1)+Localpos[2]*matrixCopy(2,2);
2e5f0f7b 123}
124
2e5f0f7b 125void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
176a9917 126 Int_t& nnew,Float_t newclust[5][500],ResponseType res)
2e5f0f7b 127{
128//
129// Generates pad hits (simulated cluster)
130// using the segmentation and the response model
131
132 Float_t dx, dy;
133 Float_t local[3];
134 //Float_t source[3];
135 Float_t global[3];
136 //
137 // Width of the integration area
138 //
139 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
140 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
141 //
142 // Get pulse height from energy loss and generate feedback photons
143 Float_t qtot=0;
144
145 local[0]=xhit;
146 // z-position of the wires relative to the RICH mother volume
147 // (2 mmm before CsI) old value: 6.076
64cdfc12 148 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
2e5f0f7b 149 //printf("AliRICHChamber feedback origin:%f",local[1]);
150 local[2]=yhit;
151
152 LocaltoGlobal(local,global);
153
237c933d 154 Int_t nFp=0;
2e5f0f7b 155
733b4fa4 156
157 // To calculate wire sag, the origin of y-position must be the middle of the photcathode
158 AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
159 Float_t newy;
160 if (yhit>0)
161 newy = yhit - segmentation->GetPadPlaneLength()/2;
162 else
163 newy = yhit + segmentation->GetPadPlaneLength()/2;
164
237c933d 165 if (res==kMip) {
733b4fa4 166 qtot = fResponse->IntPH(eloss, newy);
237c933d 167 nFp = fResponse->FeedBackPhotons(global,qtot);
b577b475 168 //printf("feedbacks:%d\n",nFp);
237c933d 169 } else if (res==kCerenkov) {
733b4fa4 170 qtot = fResponse->IntPH(newy);
237c933d 171 nFp = fResponse->FeedBackPhotons(global,qtot);
b577b475 172 //printf("feedbacks:%d\n",nFp);
2e5f0f7b 173 }
174
237c933d 175 //printf("Feedbacks:%d\n",nFp);
2e5f0f7b 176
177 //
178 // Loop Over Pads
179
180 Float_t qcheck=0, qp=0;
181
182 nnew=0;
f73582a8 183 for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
184 fSegmentation->MorePads();
185 fSegmentation->NextPad())
186 {
187 qp= fResponse->IntXY(fSegmentation);
188 qp= TMath::Abs(qp);
189
733b4fa4 190 //printf("Qp:%f Qtot %f\n",qp,qtot);
f73582a8 191
192 if (qp > 1.e-4) {
193 qcheck+=qp;
194 //
195 // --- store signal information
196 newclust[0][nnew]=qp*qtot;
197 newclust[1][nnew]=fSegmentation->Ix();
198 newclust[2][nnew]=fSegmentation->Iy();
199 newclust[3][nnew]=fSegmentation->ISector();
200 nnew++;
201 //printf("Newcluster:%d\n",i);
202 }
203 } // Pad loop
2e5f0f7b 204 //if (fSegmentation->ISector()==2)
205 //printf("Nnew:%d\n\n\n\n",nnew);
206}
207
208
209
210
4faf338d 211void AliRICHChamber::GenerateTresholds()
212{
213
214// Generates random treshold charges for all pads
215
216 //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy());
217
218 Int_t nx = fSegmentation->Npx();
219 Int_t ny = fSegmentation->Npy();
220
221 //Int_t size=nx*ny;
222
223 //printf("Size:%d\n",size);
224
225 fTresh = new AliRICHTresholdMap(fSegmentation);
226
227 //printf("Generating tresholds...\n");
228
229 for(Int_t i=-nx/2;i<nx/2;i++)
230 {
231 for(Int_t j=-ny/2;j<ny/2;j++)
232 {
233 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
234 //Int_t pedestal =0;
235 fTresh->SetHit(i,j,pedestal);
236 //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal);
237 }
238 }
239
240}