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