]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHChamber.cxx
Some rule violations fixed
[u/mrichter/AliRoot.git] / RICH / AliRICHChamber.cxx
CommitLineData
53fd478b 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// **************************************************************************
2e5f0f7b 15
2e5f0f7b 16#include "AliRICHChamber.h"
853634d3 17#include "AliRICHParam.h"
853634d3 18#include "AliSegmentation.h"
19#include "AliRICHSegmentationV0.h"
20#include "AliRICHGeometry.h"
21#include "AliRICHResponse.h"
53fd478b 22#include <TRotMatrix.h>
2e5f0f7b 23
24ClassImp(AliRICHChamber)
853634d3 25//______________________________________________________________________________
2e5f0f7b 26AliRICHChamber::AliRICHChamber()
53fd478b 27{
28//default ctor
853634d3 29 fpParam=0;
30 fpRotMatrix=0;
31
2e5f0f7b 32 fSegmentation = 0;
4faf338d 33 fResponse = 0;
34 fGeometry = 0;
2e5f0f7b 35}
853634d3 36//______________________________________________________________________________
37AliRICHChamber::AliRICHChamber(Int_t iModuleN,AliRICHParam *pParam)
53fd478b 38{
39//main ctor. Defines all geometry parameters for the given module.
c64f7552 40 SetToZenith();//put to up position
853634d3 41 switch(iModuleN){
853634d3 42 case 1:
0ffe413c 43 RotateX(-pParam->AngleYZ());
3ea9cb08 44 RotateZ(-pParam->AngleXY());
853634d3 45 fName="RICHc1";fTitle="RICH chamber 1";
46 break;
47 case 2:
3ea9cb08 48 RotateZ(-pParam->AngleXY());
853634d3 49 fName="RICHc2";fTitle="RICH chamber 2";
50 break;
51 case 3:
3ea9cb08 52 RotateX(-pParam->AngleYZ());
853634d3 53 fName="RICHc3";fTitle="RICH chamber 3";
54 break;
3ea9cb08 55 case 4:
56 fName="RICHc4";fTitle="RICH chamber 4"; //no turns
853634d3 57 break;
58 case 5:
3ea9cb08 59 RotateX(pParam->AngleYZ());
853634d3 60 fName="RICHc5";fTitle="RICH chamber 5";
61 break;
62 case 6:
3ea9cb08 63 RotateZ(pParam->AngleXY());
853634d3 64 fName="RICHc6";fTitle="RICH chamber 6";
65 break;
3ea9cb08 66 case 7:
67 RotateX(pParam->AngleYZ());
68 RotateZ(pParam->AngleXY());
69 fName="RICHc7";fTitle="RICH chamber 7";
70 break;
853634d3 71 default:
c64f7552 72 Fatal("named ctor","Wrong chamber number %i, check CreateChamber ctor",iModuleN);
853634d3 73 }//switch(iModuleN)
74 RotateZ(pParam->AngleRot());//apply common rotation
53fd478b 75 fpRotMatrix=new TRotMatrix("rot"+fName,"rot"+fName, Rot().ThetaX()*TMath::RadToDeg(), Rot().PhiX()*TMath::RadToDeg(),
76 Rot().ThetaY()*TMath::RadToDeg(), Rot().PhiY()*TMath::RadToDeg(),
77 Rot().ThetaZ()*TMath::RadToDeg(), Rot().PhiZ()*TMath::RadToDeg());
853634d3 78 fpParam=pParam;
c60862bf 79 fX=fCenterV3.X();fY=fCenterV3.Y();fZ=fCenterV3.Z();
1f63a0be 80
81 fSegmentation = 0; fResponse = 0; fGeometry = 0;
853634d3 82}
83//______________________________________________________________________________
2e5f0f7b 84
0ffe413c 85void AliRICHChamber::LocaltoGlobal(Float_t local[3],Float_t global[3])
53fd478b 86{
87//Local coordinates to global coordinates transformation
237c933d 88
2d857021 89 Double_t *pMatrix;
90 pMatrix = fpRotMatrix->GetMatrix();
0ffe413c 91 global[0]=local[0]*pMatrix[0]+local[1]*pMatrix[3]+local[2]*pMatrix[6];
92 global[1]=local[0]*pMatrix[1]+local[1]*pMatrix[4]+local[2]*pMatrix[7];
93 global[2]=local[0]*pMatrix[2]+local[1]*pMatrix[5]+local[2]*pMatrix[8];
94 global[0]+=fX;
95 global[1]+=fY;
96 global[2]+=fZ;
2e5f0f7b 97}
98
0ffe413c 99void AliRICHChamber::GlobaltoLocal(Float_t global[3],Float_t local[3])
53fd478b 100{
101// Global coordinates to local coordinates transformation
2d857021 102 TMatrix matrixCopy(3,3);
103 Double_t *pMatrixOrig = fpRotMatrix->GetMatrix();
2e5f0f7b 104 for(Int_t i=0;i<3;i++)
105 {
106 for(Int_t j=0;j<3;j++)
2d857021 107 matrixCopy(j,i)=pMatrixOrig[j+3*i];
2e5f0f7b 108 }
2d857021 109 matrixCopy.Invert();
0ffe413c 110 local[0] = global[0] - fX;
111 local[1] = global[1] - fY;
112 local[2] = global[2] - fZ;
113 local[0]=local[0]*matrixCopy(0,0)+local[1]*matrixCopy(0,1)+local[2]*matrixCopy(0,2);
114 local[1]=local[0]*matrixCopy(1,0)+local[1]*matrixCopy(1,1)+local[2]*matrixCopy(1,2);
115 local[2]=local[0]*matrixCopy(2,0)+local[1]*matrixCopy(2,1)+local[2]*matrixCopy(2,2);
2e5f0f7b 116}
117
2e5f0f7b 118void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
3ea9cb08 119 Int_t& iNpads,Float_t cluster[5][500],ResponseType res)
53fd478b 120{
121//Generates pad hits (simulated cluster) using the segmentation and the response model
0ffe413c 122
123 Float_t local[3],global[3];
3ea9cb08 124// Width of the integration area
125 Float_t dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
126 Float_t dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
127// Get pulse height from energy loss and generate feedback photons
128 Float_t qtot=0;
129 local[0]=xhit;
130//z-position of the wires relative to the RICH mother volume (2 mm before CsI) old value: 6.076 ???????
131 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
132 local[2]=yhit;
2e5f0f7b 133
3ea9cb08 134 LocaltoGlobal(local,global);
2e5f0f7b 135
0ffe413c 136
137
3ea9cb08 138//To calculate wire sag, the origin of y-position must be the middle of the photcathode
139 AliRICHSegmentationV0* segmentation = (AliRICHSegmentationV0*) GetSegmentationModel();
140 Float_t newy;
141 if (yhit>0)
142 newy = yhit - segmentation->GetPadPlaneLength()/2;
143 else
144 newy = yhit + segmentation->GetPadPlaneLength()/2;
0ffe413c 145
3ea9cb08 146 if(res==kMip){
147 qtot = fResponse->IntPH(eloss, newy);
0ffe413c 148 fResponse->FeedBackPhotons(global,qtot);
149 }else if(res==kPhoton){
3ea9cb08 150 qtot = fResponse->IntPH(newy);
0ffe413c 151 fResponse->FeedBackPhotons(global,qtot);
3ea9cb08 152 }
2e5f0f7b 153
2e5f0f7b 154 // Loop Over Pads
0ffe413c 155
3ea9cb08 156 Float_t qcheck=0, qp=0;
0ffe413c 157
3ea9cb08 158 iNpads=0;
c712cb2f 159 for(fSegmentation->FirstPad(xhit, yhit, 0, dx, dy); fSegmentation->MorePads(); fSegmentation->NextPad()) {
3ea9cb08 160 qp= fResponse->IntXY(fSegmentation);
161 qp= TMath::Abs(qp);
162 if(qp >1.e-4){
163 qcheck+=qp;
164 cluster[0][iNpads]=qp*qtot;// --- store signal information
165 cluster[1][iNpads]=fSegmentation->Ix();
166 cluster[2][iNpads]=fSegmentation->Iy();
167 cluster[3][iNpads]=fSegmentation->ISector();
0ffe413c 168 iNpads++;
3ea9cb08 169 }
170 }//pad loop
53fd478b 171}//DisIntegration(...
0ffe413c 172//__________________________________________________________________________________________________
cc23c5c6 173void AliRICHChamber::Print(Option_t *) const
853634d3 174{
53fd478b 175//debug printout method
0ffe413c 176 printf("%s r=%8.3f theta=%5.1f phi=%5.1f x=%8.3f y=%8.3f z=%8.3f %6.2f,%6.2f %6.2f,%6.2f %6.2f,%6.2f\n",fName.Data(),
177 Rho(), ThetaD(),PhiD(), X(), Y(), Z(),
3ea9cb08 178 ThetaXd(),PhiXd(),ThetaYd(),PhiYd(),ThetaZd(),PhiZd());
53fd478b 179}//Print()
0ffe413c 180//__________________________________________________________________________________________________