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()-pParam->GapThickness()/2,0);//put to up position
54 RotateX(-pParam->AngleYZ()); //ÐÏÒÑÄÏË ×ÁÖÅÎ, ÐÏ×ÏÒÏÔ ÎÅ ËÏÍÕÔÁÔÉ×ÅÎ
55 RotateZ(-pParam->AngleXY());
56 fName="RICHc1";fTitle="RICH chamber 1";
59 RotateZ(-pParam->AngleXY());
60 fName="RICHc2";fTitle="RICH chamber 2";
63 RotateX(-pParam->AngleYZ());
64 fName="RICHc3";fTitle="RICH chamber 3";
67 fName="RICHc4";fTitle="RICH chamber 4"; //no turns
70 RotateX(pParam->AngleYZ());
71 fName="RICHc5";fTitle="RICH chamber 5";
74 RotateZ(pParam->AngleXY());
75 fName="RICHc6";fTitle="RICH chamber 6";
78 RotateX(pParam->AngleYZ());
79 RotateZ(pParam->AngleXY());
80 fName="RICHc7";fTitle="RICH chamber 7";
83 Fatal("named ctor","Wrong chamber number %i, check muster class ctor",iModuleN);
85 RotateZ(pParam->AngleRot());//apply common rotation
86 fpRotMatrix=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& iNpads,Float_t cluster[5][500],ResponseType res)
126 {//Generates pad hits (simulated cluster) using the segmentation and the response model
130 // Width of the integration area
131 Float_t dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
132 Float_t dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
133 // Get pulse height from energy loss and generate feedback photons
136 //z-position of the wires relative to the RICH mother volume (2 mm before CsI) old value: 6.076 ???????
137 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
140 LocaltoGlobal(local,global);
144 //To calculate wire sag, the origin of y-position must be the middle of the photcathode
145 AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
148 newy = yhit - segmentation->GetPadPlaneLength()/2;
150 newy = yhit + segmentation->GetPadPlaneLength()/2;
153 qtot = fResponse->IntPH(eloss, newy);
154 nFp = fResponse->FeedBackPhotons(global,qtot);
155 }else if(res==kCerenkov){
156 qtot = fResponse->IntPH(newy);
157 nFp = fResponse->FeedBackPhotons(global,qtot);
162 Float_t qcheck=0, qp=0;
165 for(fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
166 fSegmentation->MorePads();
167 fSegmentation->NextPad()) {
168 qp= fResponse->IntXY(fSegmentation);
172 cluster[0][iNpads]=qp*qtot;// --- store signal information
173 cluster[1][iNpads]=fSegmentation->Ix();
174 cluster[2][iNpads]=fSegmentation->Iy();
175 cluster[3][iNpads]=fSegmentation->ISector();
179 }//void AliRICHChamber::DisIntegration(...
180 //______________________________________________________________________________
181 void AliRICHChamber::GenerateTresholds()
182 {//Generates random treshold charges for all pads
183 Int_t nx = fSegmentation->Npx();
184 Int_t ny = fSegmentation->Npy();
186 fTresh = new AliRICHTresholdMap(fSegmentation);
187 for(Int_t i=-nx/2;i<nx/2;i++){
188 for(Int_t j=-ny/2;j<ny/2;j++){
189 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
190 fTresh->SetHit(i,j,pedestal);
193 }//void AliRICHChamber::GenerateTresholds()
194 //______________________________________________________________________________
195 void AliRICHChamber::Print(Option_t *) const
197 Info(fName.Data(),"r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f\n %5.2f,%5.2f %5.2f,%5.2f %5.2f,%5.2f",
198 Rho(), Theta()*r2d,Phi()*r2d , X(), Y(), Z(),
199 ThetaXd(),PhiXd(),ThetaYd(),PhiYd(),ThetaZd(),PhiZd());
200 }//void AliRICHChamber::Print(Option_t *option)const