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