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