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