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 Revision 1.7 2000/10/03 21:44:09 morsch
19 Use AliSegmentation and AliHit abstract base classes.
21 Revision 1.6 2000/10/02 15:44:37 jbarbosa
22 Fixed forward declarations.
24 Revision 1.5 2000/07/13 16:19:45 fca
25 Mainly coding conventions + some small bug fixes
27 Revision 1.4 2000/06/30 16:48:58 dibari
28 New function GenerateTresholds() for pedestal simulation.
30 Revision 1.3 2000/06/12 15:17:58 jbarbosa
33 Revision 1.2 2000/05/18 13:45:57 jbarbosa
34 Fixed feedback photon origin coordinates
36 Revision 1.1 2000/04/19 12:57:20 morsch
37 Newly structured and updated version (JB, AM)
42 #include "AliRICHChamber.h"
44 #include <TLorentzVector.h>
45 #include <TParticle.h>
47 #include <TObjArray.h>
48 #include <TRotMatrix.h>
49 #include <AliRICHTresholdMap.h>
50 #include <AliSegmentation.h>
51 #include <AliRICHGeometry.h>
52 #include <AliRICHResponse.h>
54 ClassImp(AliRICHChamber)
56 AliRICHChamber::AliRICHChamber()
60 // Chamber object constructor
69 for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
72 AliRICHChamber::AliRICHChamber(const AliRICHChamber& Chamber)
78 AliRICHResponse* AliRICHChamber::GetResponseModel()
81 // Get reference to response model
85 void AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
87 // Configure response model
88 fResponse=thisResponse;
91 void AliRICHChamber::Init(Int_t id)
93 // Initialise chambers
94 fSegmentation->Init(id);
97 void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
100 // Local coordinates to global coordinates transformation
103 fMatrix = fChamberMatrix->GetMatrix();
104 Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
105 Globalpos[1]=pos[0]*fMatrix[1]+pos[1]*fMatrix[4]+pos[2]*fMatrix[7];
106 Globalpos[2]=pos[0]*fMatrix[2]+pos[1]*fMatrix[5]+pos[2]*fMatrix[8];
107 Globalpos[0]+=fChamberTrans[0];
108 Globalpos[1]+=fChamberTrans[1];
109 Globalpos[2]+=fChamberTrans[2];
112 void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
115 // Global coordinates to local coordinates transformation
117 Double_t *fMatrixOrig;
118 TMatrix fMatrixCopy(3,3);
119 fMatrixOrig = fChamberMatrix->GetMatrix();
120 for(Int_t i=0;i<3;i++)
122 for(Int_t j=0;j<3;j++)
123 fMatrixCopy(j,i)=fMatrixOrig[j+3*i];
125 fMatrixCopy.Invert();
126 //Int_t elements=fMatrixCopy.GetNoElements();
127 //printf("Elements:%d\n",elements);
128 //fMatrixOrig= (Double_t*) fMatrixCopy;
129 Localpos[0] = pos[0] - fChamberTrans[0];
130 Localpos[1] = pos[1] - fChamberTrans[1];
131 Localpos[2] = pos[2] - fChamberTrans[2];
132 //printf("r1:%f, r2:%f, r3:%f\n",Localpos[0],Localpos[1],Localpos[2]);
133 //printf("t1:%f t2:%f t3:%f\n",fChamberTrans[0],fChamberTrans[1],fChamberTrans[2]);
134 Localpos[0]=Localpos[0]*fMatrixCopy(0,0)+Localpos[1]*fMatrixCopy(0,1)+Localpos[2]*fMatrixCopy(0,2);
135 Localpos[1]=Localpos[0]*fMatrixCopy(1,0)+Localpos[1]*fMatrixCopy(1,1)+Localpos[2]*fMatrixCopy(1,2);
136 Localpos[2]=Localpos[0]*fMatrixCopy(2,0)+Localpos[1]*fMatrixCopy(2,1)+Localpos[2]*fMatrixCopy(2,2);
137 //Localpos[0]-=fChamberTrans[0];
138 //Localpos[1]-=fChamberTrans[1];
139 //Localpos[2]-=fChamberTrans[2];
143 void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
144 Int_t& nnew,Float_t newclust[5][500],ResponseType res)
147 // Generates pad hits (simulated cluster)
148 // using the segmentation and the response model
155 // Width of the integration area
157 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
158 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
160 // Get pulse height from energy loss and generate feedback photons
164 // z-position of the wires relative to the RICH mother volume
165 // (2 mmm before CsI) old value: 6.076
166 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
167 //printf("AliRICHChamber feedback origin:%f",local[1]);
170 LocaltoGlobal(local,global);
175 qtot = fResponse->IntPH(eloss);
176 nFp = fResponse->FeedBackPhotons(global,qtot);
177 } else if (res==kCerenkov) {
178 qtot = fResponse->IntPH();
179 nFp = fResponse->FeedBackPhotons(global,qtot);
182 //printf("Feedbacks:%d\n",nFp);
187 Float_t qcheck=0, qp=0;
190 for (Int_t i=1; i<=fnsec; i++) {
192 for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
193 fSegmentation->MorePads();
194 fSegmentation->NextPad())
196 qp= fResponse->IntXY(fSegmentation);
199 //printf("Qp:%f\n",qp);
204 // --- store signal information
205 newclust[0][nnew]=qp*qtot;
206 newclust[1][nnew]=fSegmentation->Ix();
207 newclust[2][nnew]=fSegmentation->Iy();
208 newclust[3][nnew]=fSegmentation->ISector();
210 //printf("Newcluster:%d\n",i);
213 } // Cathode plane loop
214 //if (fSegmentation->ISector()==2)
215 //printf("Nnew:%d\n\n\n\n",nnew);
219 AliRICHChamber& AliRICHChamber::operator=(const AliRICHChamber& rhs)
221 // Assignment operator
227 void AliRICHChamber::GenerateTresholds()
230 // Generates random treshold charges for all pads
232 //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy());
234 Int_t nx = fSegmentation->Npx();
235 Int_t ny = fSegmentation->Npy();
239 //printf("Size:%d\n",size);
241 fTresh = new AliRICHTresholdMap(fSegmentation);
243 //printf("Generating tresholds...\n");
245 for(Int_t i=-nx/2;i<nx/2;i++)
247 for(Int_t j=-ny/2;j<ny/2;j++)
249 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
251 fTresh->SetHit(i,j,pedestal);
252 //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal);