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.6 2000/10/02 15:44:37 jbarbosa
19 Fixed forward declarations.
21 Revision 1.5 2000/07/13 16:19:45 fca
22 Mainly coding conventions + some small bug fixes
24 Revision 1.4 2000/06/30 16:48:58 dibari
25 New function GenerateTresholds() for pedestal simulation.
27 Revision 1.3 2000/06/12 15:17:58 jbarbosa
30 Revision 1.2 2000/05/18 13:45:57 jbarbosa
31 Fixed feedback photon origin coordinates
33 Revision 1.1 2000/04/19 12:57:20 morsch
34 Newly structured and updated version (JB, AM)
39 #include "AliRICHChamber.h"
41 #include <TLorentzVector.h>
42 #include <TParticle.h>
44 #include <TObjArray.h>
45 #include <TRotMatrix.h>
46 #include <AliRICHTresholdMap.h>
47 #include <AliSegmentation.h>
48 #include <AliRICHGeometry.h>
49 #include <AliRICHResponse.h>
51 ClassImp(AliRICHChamber)
53 AliRICHChamber::AliRICHChamber()
57 // Chamber object constructor
66 for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
69 AliRICHChamber::AliRICHChamber(const AliRICHChamber& Chamber)
75 AliRICHResponse* AliRICHChamber::GetResponseModel()
78 // Get reference to response model
82 void AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
84 // Configure response model
85 fResponse=thisResponse;
88 void AliRICHChamber::Init(Int_t id)
90 // Initialise chambers
91 fSegmentation->Init(id);
94 void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
97 // Local coordinates to global coordinates transformation
100 fMatrix = fChamberMatrix->GetMatrix();
101 Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
102 Globalpos[1]=pos[0]*fMatrix[1]+pos[1]*fMatrix[4]+pos[2]*fMatrix[7];
103 Globalpos[2]=pos[0]*fMatrix[2]+pos[1]*fMatrix[5]+pos[2]*fMatrix[8];
104 Globalpos[0]+=fChamberTrans[0];
105 Globalpos[1]+=fChamberTrans[1];
106 Globalpos[2]+=fChamberTrans[2];
109 void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
112 // Global coordinates to local coordinates transformation
114 Double_t *fMatrixOrig;
115 TMatrix fMatrixCopy(3,3);
116 fMatrixOrig = fChamberMatrix->GetMatrix();
117 for(Int_t i=0;i<3;i++)
119 for(Int_t j=0;j<3;j++)
120 fMatrixCopy(j,i)=fMatrixOrig[j+3*i];
122 fMatrixCopy.Invert();
123 //Int_t elements=fMatrixCopy.GetNoElements();
124 //printf("Elements:%d\n",elements);
125 //fMatrixOrig= (Double_t*) fMatrixCopy;
126 Localpos[0] = pos[0] - fChamberTrans[0];
127 Localpos[1] = pos[1] - fChamberTrans[1];
128 Localpos[2] = pos[2] - fChamberTrans[2];
129 //printf("r1:%f, r2:%f, r3:%f\n",Localpos[0],Localpos[1],Localpos[2]);
130 //printf("t1:%f t2:%f t3:%f\n",fChamberTrans[0],fChamberTrans[1],fChamberTrans[2]);
131 Localpos[0]=Localpos[0]*fMatrixCopy(0,0)+Localpos[1]*fMatrixCopy(0,1)+Localpos[2]*fMatrixCopy(0,2);
132 Localpos[1]=Localpos[0]*fMatrixCopy(1,0)+Localpos[1]*fMatrixCopy(1,1)+Localpos[2]*fMatrixCopy(1,2);
133 Localpos[2]=Localpos[0]*fMatrixCopy(2,0)+Localpos[1]*fMatrixCopy(2,1)+Localpos[2]*fMatrixCopy(2,2);
134 //Localpos[0]-=fChamberTrans[0];
135 //Localpos[1]-=fChamberTrans[1];
136 //Localpos[2]-=fChamberTrans[2];
140 void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
141 Int_t& nnew,Float_t newclust[6][500],ResponseType res)
144 // Generates pad hits (simulated cluster)
145 // using the segmentation and the response model
152 // Width of the integration area
154 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
155 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
157 // Get pulse height from energy loss and generate feedback photons
161 // z-position of the wires relative to the RICH mother volume
162 // (2 mmm before CsI) old value: 6.076
163 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
164 //printf("AliRICHChamber feedback origin:%f",local[1]);
167 LocaltoGlobal(local,global);
172 qtot = fResponse->IntPH(eloss);
173 nFp = fResponse->FeedBackPhotons(global,qtot);
174 } else if (res==kCerenkov) {
175 qtot = fResponse->IntPH();
176 nFp = fResponse->FeedBackPhotons(global,qtot);
179 //printf("Feedbacks:%d\n",nFp);
184 Float_t qcheck=0, qp=0;
187 for (Int_t i=1; i<=fnsec; i++) {
189 for (fSegmentation->FirstPad(xhit, yhit, 0, dx, dy);
190 fSegmentation->MorePads();
191 fSegmentation->NextPad())
193 qp= fResponse->IntXY(fSegmentation);
196 //printf("Qp:%f\n",qp);
201 // --- store signal information
202 newclust[0][nnew]=qtot;
203 newclust[1][nnew]=fSegmentation->Ix();
204 newclust[2][nnew]=fSegmentation->Iy();
205 newclust[3][nnew]=qp * qtot;
206 newclust[4][nnew]=fSegmentation->ISector();
207 newclust[5][nnew]=(Float_t) i;
209 //printf("Newcluster:%d\n",i);
212 } // Cathode plane loop
213 //if (fSegmentation->ISector()==2)
214 //printf("Nnew:%d\n\n\n\n",nnew);
218 AliRICHChamber& AliRICHChamber::operator=(const AliRICHChamber& rhs)
220 // Assignment operator
226 void AliRICHChamber::GenerateTresholds()
229 // Generates random treshold charges for all pads
231 //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy());
233 Int_t nx = fSegmentation->Npx();
234 Int_t ny = fSegmentation->Npy();
238 //printf("Size:%d\n",size);
240 fTresh = new AliRICHTresholdMap(fSegmentation);
242 //printf("Generating tresholds...\n");
244 for(Int_t i=-nx/2;i<nx/2;i++)
246 for(Int_t j=-ny/2;j<ny/2;j++)
248 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
250 fTresh->SetHit(i,j,pedestal);
251 //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal);