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.4 2000/06/30 16:48:58 dibari
19 New function GenerateTresholds() for pedestal simulation.
21 Revision 1.3 2000/06/12 15:17:58 jbarbosa
24 Revision 1.2 2000/05/18 13:45:57 jbarbosa
25 Fixed feedback photon origin coordinates
27 Revision 1.1 2000/04/19 12:57:20 morsch
28 Newly structured and updated version (JB, AM)
33 #include "AliRICHChamber.h"
35 #include <TLorentzVector.h>
36 #include <TParticle.h>
39 ClassImp(AliRICHChamber)
41 AliRICHChamber::AliRICHChamber()
45 // Chamber object constructor
54 for(Int_t i=0; i<50; ++i) fIndexMap[i] = 0;
57 AliRICHChamber::AliRICHChamber(const AliRICHChamber& Chamber)
63 AliRICHResponse* AliRICHChamber::GetResponseModel()
66 // Get reference to response model
70 void AliRICHChamber::ResponseModel(AliRICHResponse* thisResponse)
72 // Configure response model
73 fResponse=thisResponse;
76 void AliRICHChamber::Init()
78 // Initialise chambers
79 fSegmentation->Init(this);
82 void AliRICHChamber::LocaltoGlobal(Float_t pos[3],Float_t Globalpos[3])
85 // Local coordinates to global coordinates transformation
88 fMatrix = fChamberMatrix->GetMatrix();
89 Globalpos[0]=pos[0]*fMatrix[0]+pos[1]*fMatrix[3]+pos[2]*fMatrix[6];
90 Globalpos[1]=pos[0]*fMatrix[1]+pos[1]*fMatrix[4]+pos[2]*fMatrix[7];
91 Globalpos[2]=pos[0]*fMatrix[2]+pos[1]*fMatrix[5]+pos[2]*fMatrix[8];
92 Globalpos[0]+=fChamberTrans[0];
93 Globalpos[1]+=fChamberTrans[1];
94 Globalpos[2]+=fChamberTrans[2];
97 void AliRICHChamber::GlobaltoLocal(Float_t pos[3],Float_t Localpos[3])
100 // Global coordinates to local coordinates transformation
102 Double_t *fMatrixOrig;
103 TMatrix fMatrixCopy(3,3);
104 fMatrixOrig = fChamberMatrix->GetMatrix();
105 for(Int_t i=0;i<3;i++)
107 for(Int_t j=0;j<3;j++)
108 fMatrixCopy(j,i)=fMatrixOrig[j+3*i];
110 fMatrixCopy.Invert();
111 //Int_t elements=fMatrixCopy.GetNoElements();
112 //printf("Elements:%d\n",elements);
113 //fMatrixOrig= (Double_t*) fMatrixCopy;
114 Localpos[0] = pos[0] - fChamberTrans[0];
115 Localpos[1] = pos[1] - fChamberTrans[1];
116 Localpos[2] = pos[2] - fChamberTrans[2];
117 //printf("r1:%f, r2:%f, r3:%f\n",Localpos[0],Localpos[1],Localpos[2]);
118 //printf("t1:%f t2:%f t3:%f\n",fChamberTrans[0],fChamberTrans[1],fChamberTrans[2]);
119 Localpos[0]=Localpos[0]*fMatrixCopy(0,0)+Localpos[1]*fMatrixCopy(0,1)+Localpos[2]*fMatrixCopy(0,2);
120 Localpos[1]=Localpos[0]*fMatrixCopy(1,0)+Localpos[1]*fMatrixCopy(1,1)+Localpos[2]*fMatrixCopy(1,2);
121 Localpos[2]=Localpos[0]*fMatrixCopy(2,0)+Localpos[1]*fMatrixCopy(2,1)+Localpos[2]*fMatrixCopy(2,2);
122 //Localpos[0]-=fChamberTrans[0];
123 //Localpos[1]-=fChamberTrans[1];
124 //Localpos[2]-=fChamberTrans[2];
128 void AliRICHChamber::DisIntegration(Float_t eloss, Float_t xhit, Float_t yhit,
129 Int_t& nnew,Float_t newclust[6][500],ResponseType res)
132 // Generates pad hits (simulated cluster)
133 // using the segmentation and the response model
140 // Width of the integration area
142 dx=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadX());
143 dy=(fResponse->SigmaIntegration())*(fResponse->ChargeSpreadY());
145 // Get pulse height from energy loss and generate feedback photons
149 // z-position of the wires relative to the RICH mother volume
150 // (2 mmm before CsI) old value: 6.076
151 local[1]=1.276 + fGeometry->GetGapThickness()/2 - .2;
152 //printf("AliRICHChamber feedback origin:%f",local[1]);
155 LocaltoGlobal(local,global);
160 qtot = fResponse->IntPH(eloss);
161 nFp = fResponse->FeedBackPhotons(global,qtot);
162 } else if (res==kCerenkov) {
163 qtot = fResponse->IntPH();
164 nFp = fResponse->FeedBackPhotons(global,qtot);
167 //printf("Feedbacks:%d\n",nFp);
172 Float_t qcheck=0, qp=0;
175 for (Int_t i=1; i<=fnsec; i++) {
177 for (fSegmentation->FirstPad(xhit, yhit, dx, dy);
178 fSegmentation->MorePads();
179 fSegmentation->NextPad())
181 qp= fResponse->IntXY(fSegmentation);
184 //printf("Qp:%f\n",qp);
189 // --- store signal information
190 newclust[0][nnew]=qtot;
191 newclust[1][nnew]=fSegmentation->Ix();
192 newclust[2][nnew]=fSegmentation->Iy();
193 newclust[3][nnew]=qp * qtot;
194 newclust[4][nnew]=fSegmentation->ISector();
195 newclust[5][nnew]=(Float_t) i;
197 //printf("Newcluster:%d\n",i);
200 } // Cathode plane loop
201 //if (fSegmentation->ISector()==2)
202 //printf("Nnew:%d\n\n\n\n",nnew);
206 AliRICHChamber& AliRICHChamber::operator=(const AliRICHChamber& rhs)
208 // Assignment operator
214 void AliRICHChamber::GenerateTresholds()
217 // Generates random treshold charges for all pads
219 //printf("Pads : %dx%d\n",fSegmentation->Npx(),fSegmentation->Npy());
221 Int_t nx = fSegmentation->Npx();
222 Int_t ny = fSegmentation->Npy();
226 //printf("Size:%d\n",size);
228 fTresh = new AliRICHTresholdMap(fSegmentation);
230 //printf("Generating tresholds...\n");
232 for(Int_t i=-nx/2;i<nx/2;i++)
234 for(Int_t j=-ny/2;j<ny/2;j++)
236 Int_t pedestal = (Int_t)(gRandom->Gaus(50, 10));
238 fTresh->SetHit(i,j,pedestal);
239 //printf("Pad %d %d has pedestal %d.\n",i,j,pedestal);