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