1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliRICHChamber.h"
19 #include "AliRICHConst.h" //for r2d
20 #include "AliRICHParam.h"
22 #include <TRotMatrix.h>
23 #include "AliRICHTresholdMap.h"
24 #include "AliSegmentation.h"
25 #include "AliRICHSegmentationV0.h"
26 #include "AliRICHGeometry.h"
27 #include "AliRICHResponse.h"
29 ClassImp(AliRICHChamber)
30 //______________________________________________________________________________
31 AliRICHChamber::AliRICHChamber()
43 for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
45 //______________________________________________________________________________
46 AliRICHChamber::AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam)
47 {//named ctor. Defines all geometry parameters for the given module.
51 SetCenter(0,pParam->Offset(),0);//put to 2 position
54 RotateX(pParam->AngleYZ());
55 fName="RICHc0";fTitle="RICH chamber 0";
58 RotateZ(pParam->AngleXY());
59 fName="RICHc1";fTitle="RICH chamber 1";
62 fName="RICHc2";fTitle="RICH chamber 2";
65 RotateZ(-pParam->AngleXY());
66 fName="RICHc3";fTitle="RICH chamber 3";
69 RotateX(-pParam->AngleYZ()); //ÐÏÒÑÄÏË ×ÁÖÅÎ, ÐÏ×ÏÒÏÔ ÎÅ ËÏÍÕÔÁÔÉ×ÅÎ
70 RotateZ( pParam->AngleXY());
71 fName="RICHc4";fTitle="RICH chamber 4";
74 RotateX(-pParam->AngleYZ());
75 fName="RICHc5";fTitle="RICH chamber 5";
78 RotateX(-pParam->AngleYZ());
79 RotateZ(-pParam->AngleXY());
80 fName="RICHc6";fTitle="RICH chamber 6";
83 Fatal("named ctor","Wrong chamber number %i, check muster class ctor",iModuleN);
85 RotateZ(pParam->AngleRot());//apply common rotation
86 new TRotMatrix("rot"+fName,"rot"+fName, Rot().ThetaX()*r2d, Rot().PhiX()*r2d,
87 Rot().ThetaY()*r2d, Rot().PhiY()*r2d,
88 Rot().ThetaZ()*r2d, Rot().PhiZ()*r2d);
91 //______________________________________________________________________________
93 void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
94 {//Local coordinates to global coordinates transformation
97 pMatrix = fpRotMatrix->GetMatrix();
98 Globalpos[0]=pos[0]*pMatrix[0]+pos[1]*pMatrix[3]+pos[2]*pMatrix[6];
99 Globalpos[1]=pos[0]*pMatrix[1]+pos[1]*pMatrix[4]+pos[2]*pMatrix[7];
100 Globalpos[2]=pos[0]*pMatrix[2]+pos[1]*pMatrix[5]+pos[2]*pMatrix[8];
106 void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
107 {// Global coordinates to local coordinates transformation
108 TMatrix matrixCopy(3,3);
109 Double_t *pMatrixOrig = fpRotMatrix->GetMatrix();
110 for(Int_t i=0;i<3;i++)
112 for(Int_t j=0;j<3;j++)
113 matrixCopy(j,i)=pMatrixOrig[j+3*i];
116 Localpos[0] = pos[0] - fX;
117 Localpos[1] = pos[1] - fY;
118 Localpos[2] = pos[2] - fZ;
119 Localpos[0]=Localpos[0]*matrixCopy(0,0)+Localpos[1]*matrixCopy(0,1)+Localpos[2]*matrixCopy(0,2);
120 Localpos[1]=Localpos[0]*matrixCopy(1,0)+Localpos[1]*matrixCopy(1,1)+Localpos[2]*matrixCopy(1,2);
121 Localpos[2]=Localpos[0]*matrixCopy(2,0)+Localpos[1]*matrixCopy(2,1)+Localpos[2]*matrixCopy(2,2);
124 void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
125 Int_t& nnew,Float_t newclust[5][500],ResponseType res)
127 // Generates pad hits (simulated cluster)
128 // using the segmentation and the response model
135 // Width of the integration area
137 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
138 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
140 // Get pulse height from energy loss and generate feedback photons
144 // z-position of the wires relative to the RICH mother volume
145 // (2 mmm before CsI) old value: 6.076
146 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
147 //printf("AliRICHChamber feedback origin:%f",local[1]);
150 LocaltoGlobal(local,global);
155 // To calculate wire sag, the origin of y-position must be the middle of the photcathode
156 AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
159 newy = yhit - segmentation->GetPadPlaneLength()/2;
161 newy = yhit + segmentation->GetPadPlaneLength()/2;
164 qtot = fResponse->IntPH(eloss, newy);
165 nFp = fResponse->FeedBackPhotons(global,qtot);
166 //printf("feedbacks:%d\n",nFp);
167 } else if (res==kCerenkov) {
168 qtot = fResponse->IntPH(newy);
169 nFp = fResponse->FeedBackPhotons(global,qtot);
170 //printf("feedbacks:%d\n",nFp);
173 //printf("Feedbacks:%d\n",nFp);
178 Float_t qcheck=0, qp=0;
181 for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
182 fSegmentation->MorePads();
183 fSegmentation->NextPad())
185 qp= fResponse->IntXY(fSegmentation);
188 //printf("Qp:%f Qtot %f\n",qp,qtot);
193 // --- store signal information
194 newclust[0][nnew]=qp*qtot;
195 newclust[1][nnew]=fSegmentation->Ix();
196 newclust[2][nnew]=fSegmentation->Iy();
197 newclust[3][nnew]=fSegmentation->ISector();
199 //printf("Newcluster:%d\n",i);
202 }//void AliRICHChamber::DisIntegration(...
203 //______________________________________________________________________________
204 void AliRICHChamber::GenerateTresholds()
205 {//Generates random treshold charges for all pads
206 Int_t nx = fSegmentation->Npx();
207 Int_t ny = fSegmentation->Npy();
209 fTresh = new AliRICHTresholdMap(fSegmentation);
210 for(Int_t i=-nx/2;i<nx/2;i++){
211 for(Int_t j=-ny/2;j<ny/2;j++){
212 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
213 fTresh->SetHit(i,j,pedestal);
216 }//void AliRICHChamber::GenerateTresholds()
217 //______________________________________________________________________________
218 void AliRICHChamber::Print(Option_t *) const
220 Info(fName.Data(),"r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f",
221 Rho(), Theta()*r2d,Phi()*r2d , X(), Y(), Z());
222 }//void AliRICHChamber::Print(Option_t *option)const