]>
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 | ||
803d1ab0 | 16 | /* $Id$ */ |
2e5f0f7b | 17 | |
18 | #include "AliRICHChamber.h" | |
237c933d | 19 | |
2e5f0f7b | 20 | #include <TLorentzVector.h> |
21 | #include <TParticle.h> | |
22 | #include <TRandom.h> | |
488e98ba | 23 | #include <TObjArray.h> |
24 | #include <TRotMatrix.h> | |
25 | #include <AliRICHTresholdMap.h> | |
a2f7eaf6 | 26 | #include <AliSegmentation.h> |
733b4fa4 | 27 | #include <AliRICHSegmentationV0.h> |
488e98ba | 28 | #include <AliRICHGeometry.h> |
29 | #include <AliRICHResponse.h> | |
2e5f0f7b | 30 | |
31 | ClassImp(AliRICHChamber) | |
32 | ||
33 | AliRICHChamber::AliRICHChamber() | |
34 | { | |
37387576 | 35 | // default ctor |
237c933d | 36 | |
2d857021 | 37 | fpRotMatrix = 0; |
2e5f0f7b | 38 | fSegmentation = 0; |
4faf338d | 39 | fResponse = 0; |
40 | fGeometry = 0; | |
edf34242 | 41 | fReconstruction = 0; |
4faf338d | 42 | fTresh = 0; |
43 | frMin = 0.1; | |
44 | frMax = 140; | |
ef42d733 | 45 | for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0; |
2e5f0f7b | 46 | } |
47 | ||
2e5f0f7b | 48 | void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3]) |
49 | { | |
237c933d | 50 | // Local coordinates to global coordinates transformation |
51 | ||
2d857021 | 52 | Double_t *pMatrix; |
53 | pMatrix = fpRotMatrix->GetMatrix(); | |
54 | Globalpos[0]=pos[0]*pMatrix[0]+pos[1]*pMatrix[3]+pos[2]*pMatrix[6]; | |
55 | Globalpos[1]=pos[0]*pMatrix[1]+pos[1]*pMatrix[4]+pos[2]*pMatrix[7]; | |
56 | Globalpos[2]=pos[0]*pMatrix[2]+pos[1]*pMatrix[5]+pos[2]*pMatrix[8]; | |
57 | Globalpos[0]+=fX; | |
58 | Globalpos[1]+=fY; | |
59 | Globalpos[2]+=fZ; | |
2e5f0f7b | 60 | } |
61 | ||
62 | void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3]) | |
63 | { | |
2d857021 | 64 | // |
237c933d | 65 | // Global coordinates to local coordinates transformation |
2d857021 | 66 | // |
67 | TMatrix matrixCopy(3,3); | |
68 | Double_t *pMatrixOrig = fpRotMatrix->GetMatrix(); | |
2e5f0f7b | 69 | for(Int_t i=0;i<3;i++) |
70 | { | |
71 | for(Int_t j=0;j<3;j++) | |
2d857021 | 72 | matrixCopy(j,i)=pMatrixOrig[j+3*i]; |
2e5f0f7b | 73 | } |
2d857021 | 74 | matrixCopy.Invert(); |
75 | Localpos[0] = pos[0] - fX; | |
76 | Localpos[1] = pos[1] - fY; | |
77 | Localpos[2] = pos[2] - fZ; | |
78 | Localpos[0]=Localpos[0]*matrixCopy(0,0)+Localpos[1]*matrixCopy(0,1)+Localpos[2]*matrixCopy(0,2); | |
79 | Localpos[1]=Localpos[0]*matrixCopy(1,0)+Localpos[1]*matrixCopy(1,1)+Localpos[2]*matrixCopy(1,2); | |
80 | Localpos[2]=Localpos[0]*matrixCopy(2,0)+Localpos[1]*matrixCopy(2,1)+Localpos[2]*matrixCopy(2,2); | |
2e5f0f7b | 81 | } |
82 | ||
2e5f0f7b | 83 | void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit, |
176a9917 | 84 | Int_t& nnew,Float_t newclust[5][500],ResponseType res) |
2e5f0f7b | 85 | { |
86 | // | |
87 | // Generates pad hits (simulated cluster) | |
88 | // using the segmentation and the response model | |
89 | ||
90 | Float_t dx, dy; | |
91 | Float_t local[3]; | |
92 | //Float_t source[3]; | |
93 | Float_t global[3]; | |
94 | // | |
95 | // Width of the integration area | |
96 | // | |
97 | dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX()); | |
98 | dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY()); | |
99 | // | |
100 | // Get pulse height from energy loss and generate feedback photons | |
101 | Float_t qtot=0; | |
102 | ||
103 | local[0]=xhit; | |
104 | // z-position of the wires relative to the RICH mother volume | |
105 | // (2 mmm before CsI) old value: 6.076 | |
64cdfc12 | 106 | local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2; |
2e5f0f7b | 107 | //printf("AliRICHChamber feedback origin:%f",local[1]); |
108 | local[2]=yhit; | |
109 | ||
110 | LocaltoGlobal(local,global); | |
111 | ||
237c933d | 112 | Int_t nFp=0; |
2e5f0f7b | 113 | |
733b4fa4 | 114 | |
115 | // To calculate wire sag, the origin of y-position must be the middle of the photcathode | |
116 | AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel(); | |
117 | Float_t newy; | |
118 | if (yhit>0) | |
119 | newy = yhit - segmentation->GetPadPlaneLength()/2; | |
120 | else | |
121 | newy = yhit + segmentation->GetPadPlaneLength()/2; | |
122 | ||
237c933d | 123 | if (res==kMip) { |
733b4fa4 | 124 | qtot = fResponse->IntPH(eloss, newy); |
237c933d | 125 | nFp = fResponse->FeedBackPhotons(global,qtot); |
b577b475 | 126 | //printf("feedbacks:%d\n",nFp); |
237c933d | 127 | } else if (res==kCerenkov) { |
733b4fa4 | 128 | qtot = fResponse->IntPH(newy); |
237c933d | 129 | nFp = fResponse->FeedBackPhotons(global,qtot); |
b577b475 | 130 | //printf("feedbacks:%d\n",nFp); |
2e5f0f7b | 131 | } |
132 | ||
237c933d | 133 | //printf("Feedbacks:%d\n",nFp); |
2e5f0f7b | 134 | |
135 | // | |
136 | // Loop Over Pads | |
137 | ||
138 | Float_t qcheck=0, qp=0; | |
139 | ||
140 | nnew=0; | |
f73582a8 | 141 | for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy); |
142 | fSegmentation->MorePads(); | |
143 | fSegmentation->NextPad()) | |
144 | { | |
145 | qp= fResponse->IntXY(fSegmentation); | |
146 | qp= TMath::Abs(qp); | |
147 | ||
733b4fa4 | 148 | //printf("Qp:%f Qtot %f\n",qp,qtot); |
f73582a8 | 149 | |
150 | if (qp > 1.e-4) { | |
151 | qcheck+=qp; | |
152 | // | |
153 | // --- store signal information | |
154 | newclust[0][nnew]=qp*qtot; | |
155 | newclust[1][nnew]=fSegmentation->Ix(); | |
156 | newclust[2][nnew]=fSegmentation->Iy(); | |
157 | newclust[3][nnew]=fSegmentation->ISector(); | |
158 | nnew++; | |
159 | //printf("Newcluster:%d\n",i); | |
160 | } | |
161 | } // Pad loop | |
2e5f0f7b | 162 | //if (fSegmentation->ISector()==2) |
163 | //printf("Nnew:%d\n\n\n\n",nnew); | |
164 | } | |
165 | ||
166 | ||
167 | ||
168 | ||
4faf338d | 169 | void AliRICHChamber::GenerateTresholds() |
170 | { | |
171 | ||
172 | // Generates random treshold charges for all pads | |
173 | ||
174 | //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy()); | |
175 | ||
176 | Int_t nx = fSegmentation->Npx(); | |
177 | Int_t ny = fSegmentation->Npy(); | |
178 | ||
179 | //Int_t size=nx*ny; | |
180 | ||
181 | //printf("Size:%d\n",size); | |
182 | ||
183 | fTresh = new AliRICHTresholdMap(fSegmentation); | |
184 | ||
185 | //printf("Generating tresholds...\n"); | |
186 | ||
187 | for(Int_t i=-nx/2;i<nx/2;i++) | |
188 | { | |
189 | for(Int_t j=-ny/2;j<ny/2;j++) | |
190 | { | |
191 | Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10)); | |
192 | //Int_t pedestal =0; | |
193 | fTresh->SetHit(i,j,pedestal); | |
194 | //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal); | |
195 | } | |
196 | } | |
197 | ||
198 | } |