]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHChamber.cxx
RICH segmentation pure virtual interface.
[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$
18*/
19
20
21#include "AliRICHChamber.h"
22#include "AliRun.h"
23#include <TLorentzVector.h>
24#include <TParticle.h>
25#include <TRandom.h>
26
27ClassImp(AliRICHChamber)
28
29AliRICHChamber::AliRICHChamber()
30{
31 fSegmentation = 0;
32 fResponse= 0;
33 fGeometry= 0;
34 frMin=0.1;
35 frMax=140;
36 fnsec=1;
37}
38
39//
40// Get reference to response model
41AliRICHResponse* AliRICHChamber::GetResponseModel()
42{
43 return fResponse;
44}
45
46// Configure response model
47void AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
48{
49 fResponse=thisResponse;
50}
51
52void AliRICHChamber::Init()
53{
54 fSegmentation->Init(this);
55}
56
57void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
58{
59
60 Double_t *fMatrix;
61 fMatrix = fChamberMatrix->GetMatrix();
62 Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
63 Globalpos[1]=pos[0]*fMatrix[1]+pos[1]*fMatrix[4]+pos[2]*fMatrix[7];
64 Globalpos[2]=pos[0]*fMatrix[2]+pos[1]*fMatrix[5]+pos[2]*fMatrix[8];
65 Globalpos[0]+=fChamberTrans[0];
66 Globalpos[1]+=fChamberTrans[1];
67 Globalpos[2]+=fChamberTrans[2];
68}
69
70void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
71{
72
73 Double_t *fMatrixOrig;
74 TMatrix fMatrixCopy(3,3);
75 fMatrixOrig = fChamberMatrix->GetMatrix();
76 for(Int_t i=0;i<3;i++)
77 {
78 for(Int_t j=0;j<3;j++)
79 fMatrixCopy(j,i)=fMatrixOrig[j+3*i];
80 }
81 fMatrixCopy.Invert();
82 //Int_t elements=fMatrixCopy.GetNoElements();
83 //printf("Elements:%d\n",elements);
84 //fMatrixOrig= (Double_t*) fMatrixCopy;
85 Localpos[0] = pos[0] - fChamberTrans[0];
86 Localpos[1] = pos[1] - fChamberTrans[1];
87 Localpos[2] = pos[2] - fChamberTrans[2];
88 //printf("r1:%f, r2:%f, r3:%f\n",Localpos[0],Localpos[1],Localpos[2]);
89 //printf("t1:%f t2:%f t3:%f\n",fChamberTrans[0],fChamberTrans[1],fChamberTrans[2]);
90 Localpos[0]=Localpos[0]*fMatrixCopy(0,0)+Localpos[1]*fMatrixCopy(0,1)+Localpos[2]*fMatrixCopy(0,2);
91 Localpos[1]=Localpos[0]*fMatrixCopy(1,0)+Localpos[1]*fMatrixCopy(1,1)+Localpos[2]*fMatrixCopy(1,2);
92 Localpos[2]=Localpos[0]*fMatrixCopy(2,0)+Localpos[1]*fMatrixCopy(2,1)+Localpos[2]*fMatrixCopy(2,2);
93 //Localpos[0]-=fChamberTrans[0];
94 //Localpos[1]-=fChamberTrans[1];
95 //Localpos[2]-=fChamberTrans[2];
96}
97
98
99void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
100 Int_t& nnew,Float_t newclust[6][500],Response_t res)
101{
102//
103// Generates pad hits (simulated cluster)
104// using the segmentation and the response model
105
106 Float_t dx, dy;
107 Float_t local[3];
108 //Float_t source[3];
109 Float_t global[3];
110 //
111 // Width of the integration area
112 //
113 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
114 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
115 //
116 // Get pulse height from energy loss and generate feedback photons
117 Float_t qtot=0;
118
119 local[0]=xhit;
120 // z-position of the wires relative to the RICH mother volume
121 // (2 mmm before CsI) old value: 6.076
122 local[1]=1.276 + fGeometry->GetGapThickness()/2 + fGeometry->GetProximityGapThickness() - .39;
123 //printf("AliRICHChamber feedback origin:%f",local[1]);
124 local[2]=yhit;
125
126 LocaltoGlobal(local,global);
127
128 Int_t Nfp=0;
129
130 if (res==mip) {
131 qtot = fResponse->IntPH(eloss);
132 Nfp = fResponse->FeedBackPhotons(global,qtot);
133 } else if (res==cerenkov) {
134 qtot = fResponse->IntPH();
135 Nfp = fResponse->FeedBackPhotons(global,qtot);
136 }
137
138 //printf("Feedbacks:%d\n",Nfp);
139
140 //
141 // Loop Over Pads
142
143 Float_t qcheck=0, qp=0;
144
145 nnew=0;
146 for (Int_t i=1; i<=fnsec; i++) {
147 qcheck=0;
148 for (fSegmentation->FirstPad(xhit, yhit, dx, dy);
149 fSegmentation->MorePads();
150 fSegmentation->NextPad())
151 {
152 qp= fResponse->IntXY(fSegmentation);
153 qp= TMath::Abs(qp);
154
155 //printf("Qp:%f\n",qp);
156
157 if (qp > 1.e-4) {
158 qcheck+=qp;
159 //
160 // --- store signal information
161 newclust[0][nnew]=qtot;
162 newclust[1][nnew]=fSegmentation->Ix();
163 newclust[2][nnew]=fSegmentation->Iy();
164 newclust[3][nnew]=qp * qtot;
165 newclust[4][nnew]=fSegmentation->ISector();
166 newclust[5][nnew]=(Float_t) i;
167 nnew++;
168 //printf("Newcluster:%d\n",i);
169 }
170 } // Pad loop
171 } // Cathode plane loop
172 //if (fSegmentation->ISector()==2)
173 //printf("Nnew:%d\n\n\n\n",nnew);
174}
175
176
177
178