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