Transition to NewIO
[u/mrichter/AliRoot.git] / RICH / AliRICHv1.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 /* $Id$ */
17
18
19 //////////////////////////////////////////////////////////
20 //  Manager and hits classes for set: RICH full version //
21 //////////////////////////////////////////////////////////
22
23 #include "Riostream.h"
24
25 #include <TNode.h> 
26 #include <TParticle.h> 
27 #include <TRandom.h> 
28 #include <TTUBE.h>
29 #include <TVirtualMC.h>
30
31 #include "AliConst.h" 
32 #include "AliPDG.h" 
33 #include "AliRICHGeometry.h"
34 #include "AliRICHHit.h"
35 #include "AliRICHResponse.h"
36 #include "AliRICHResponseV0.h"
37 #include "AliRICHSegmentationV1.h"
38 #include "AliRICHv1.h"
39 #include "AliRun.h"
40
41 ClassImp(AliRICHv1)
42     
43 //___________________________________________
44 AliRICHv1::AliRICHv1()
45 {
46
47 // Default constructor fo AliRICHvv1 (full version)
48
49     //fChambers = 0;
50 }
51
52 //___________________________________________
53 AliRICHv1::AliRICHv1(const char *name, const char *title)
54     : AliRICH(name,title)
55 {
56
57 // Full version of RICH with hits and diagnostics
58
59   // Version 0
60 // Default Segmentation, no hits
61     AliRICHSegmentationV1* segmentation = new AliRICHSegmentationV1;
62 //
63 //  Segmentation parameters
64     segmentation->SetPadSize(0.84,0.80);
65     segmentation->SetDAnod(0.84/2);
66 //
67 //  Geometry parameters
68     AliRICHGeometry* geometry = new AliRICHGeometry;
69     geometry->SetGapThickness(8);
70     geometry->SetProximityGapThickness(.4);
71     geometry->SetQuartzLength(133);
72     geometry->SetQuartzWidth(127.9);
73     geometry->SetQuartzThickness(.5);
74     geometry->SetOuterFreonLength(133);
75     geometry->SetOuterFreonWidth(41.3);
76     geometry->SetInnerFreonLength(133);
77     geometry->SetInnerFreonWidth(41.3);
78     geometry->SetFreonThickness(1.5);
79 //
80 //  Response parameters
81     AliRICHResponseV0*  response   = new AliRICHResponseV0;
82     response->SetSigmaIntegration(5.);
83     response->SetChargeSlope(27.);
84     response->SetChargeSpread(0.18, 0.18);
85     response->SetMaxAdc(4096);
86     response->SetAlphaFeedback(0.036);
87     response->SetEIonisation(26.e-9);
88     response->SetSqrtKx3(0.77459667);
89     response->SetKx2(0.962);
90     response->SetKx4(0.379);
91     response->SetSqrtKy3(0.77459667);
92     response->SetKy2(0.962);
93     response->SetKy4(0.379);
94     response->SetPitch(0.25);
95     response->SetWireSag(1);                     // 1->On, 0->Off
96     response->SetVoltage(2150);                  // Should only be 2000, 2050, 2100 or 2150
97
98 //
99 //    AliRICH *RICH = (AliRICH *) gAlice->GetDetector("RICH"); 
100     
101     fCkovNumber=0;
102     fFreonProd=0;
103     Int_t i=0;
104     
105     fChambers = new TObjArray(kNCH);
106     for (i=0; i<kNCH; i++) {
107       
108       //PH      (*fChambers)[i] = new AliRICHChamber();  
109       fChambers->AddAt(new AliRICHChamber(), i);  
110       
111     }
112   
113     for (i=0; i<kNCH; i++) {
114       SetGeometryModel(i,geometry);
115       SetSegmentationModel(i, segmentation);
116       SetResponseModel(i, response);
117       SetDebugLevel(0);
118     }
119
120
121 }
122
123 void AliRICHv1::Init()
124 {
125
126   if(fDebug) {
127     printf("%s: *********************************** RICH_INIT ***********************************\n",ClassName());
128     printf("%s: *                                                                               *\n",ClassName());
129     printf("%s: *                        AliRICHv1 Full version started                         *\n",ClassName());
130     printf("%s: *                                                                               *\n",ClassName());
131   }
132
133   
134   AliSegmentation*  segmentation;
135   AliRICHGeometry*  geometry;
136   AliRICHResponse*  response;
137
138
139     // 
140     // Initialize Tracking Chambers
141     //
142     for (Int_t i=0; i<kNCH; i++) {
143         //printf ("i:%d",i);
144       //PH      ( (AliRICHChamber*) (*fChambers)[i])->Init(i);  
145         ( (AliRICHChamber*)fChambers->At(i))->Init(i);  
146     }  
147     
148     //
149     // Set the chamber (sensitive region) GEANT identifier
150     
151     //PH    ((AliRICHChamber*)(*fChambers)[0])->SetGid(1);  
152     //PH    ((AliRICHChamber*)(*fChambers)[1])->SetGid(2);  
153     //PH    ((AliRICHChamber*)(*fChambers)[2])->SetGid(3);  
154     //PH    ((AliRICHChamber*)(*fChambers)[3])->SetGid(4);  
155     //PH    ((AliRICHChamber*)(*fChambers)[4])->SetGid(5);  
156     //PH    ((AliRICHChamber*)(*fChambers)[5])->SetGid(6);  
157     //PH    ((AliRICHChamber*)(*fChambers)[6])->SetGid(7); 
158
159     ((AliRICHChamber*)fChambers->At(0))->SetGid(1);  
160     ((AliRICHChamber*)fChambers->At(1))->SetGid(2);  
161     ((AliRICHChamber*)fChambers->At(2))->SetGid(3);  
162     ((AliRICHChamber*)fChambers->At(3))->SetGid(4);  
163     ((AliRICHChamber*)fChambers->At(4))->SetGid(5);  
164     ((AliRICHChamber*)fChambers->At(5))->SetGid(6);  
165     ((AliRICHChamber*)fChambers->At(6))->SetGid(7);  
166
167
168     segmentation=Chamber(0).GetSegmentationModel(0);
169     geometry=Chamber(0).GetGeometryModel();
170     response=Chamber(0).GetResponseModel();
171     
172     Float_t offset       = 490 + 1.276 - geometry->GetGapThickness()/2;        //distance from center of mother volume to methane
173     Float_t deltaphi     = 19.5;                                               //phi angle between center of chambers - z direction
174     Float_t deltatheta   = 20;                                                 //theta angle between center of chambers - x direction
175     Float_t cosphi       = TMath::Cos(deltaphi*TMath::Pi()/180);
176     Float_t sinphi       = TMath::Sin(deltaphi*TMath::Pi()/180);
177     Float_t costheta     = TMath::Cos(deltatheta*TMath::Pi()/180);
178     Float_t sintheta     = TMath::Sin(deltatheta*TMath::Pi()/180);
179
180     Float_t pos1[3]={0.                , offset*cosphi         , offset*sinphi};
181     Float_t pos2[3]={offset*sintheta   , offset*costheta       , 0. };
182     Float_t pos3[3]={0.                , offset                , 0.};
183     Float_t pos4[3]={-offset*sintheta  , offset*costheta       , 0.};
184     Float_t pos5[3]={offset*sinphi     , offset*costheta*cosphi, -offset*sinphi};
185     Float_t pos6[3]={0.                , offset*cosphi         , -offset*sinphi};
186     Float_t pos7[3]={ -offset*sinphi   , offset*costheta*cosphi, -offset*sinphi};
187
188     Chamber(0).SetChamberTransform(pos1[0],pos1[1],pos1[2],new TRotMatrix("rot993","rot993",90., 0.               , 90. - deltaphi, 90.             , deltaphi, -90.           ));
189     Chamber(1).SetChamberTransform(pos2[0],pos2[1],pos2[2],new TRotMatrix("rot994","rot994",90., -deltatheta      , 90.           , 90.- deltatheta , 0.      , 0.             ));
190     Chamber(2).SetChamberTransform(pos3[0],pos3[1],pos3[2],new TRotMatrix("rot995","rot995",90., 0.               , 90.           , 90.             , 0.      , 0.             ));
191     Chamber(3).SetChamberTransform(pos4[0],pos4[1],pos4[2],new TRotMatrix("rot996","rot996",90.,  deltatheta      , 90.           , 90 + deltatheta , 0.      , 0.             ));
192     Chamber(4).SetChamberTransform(pos5[0],pos5[1],pos5[2],new TRotMatrix("rot997","rot997",90., 360. - deltatheta, 108.2         , 90.- deltatheta ,18.2     , 90 - deltatheta));
193     Chamber(5).SetChamberTransform(pos6[0],pos6[1],pos6[2],new TRotMatrix("rot998","rot998",90., 0.               , 90 + deltaphi , 90.             , deltaphi, 90.            ));
194     Chamber(6).SetChamberTransform(pos7[0],pos7[1],pos7[2],new TRotMatrix("rot999","rot999",90., deltatheta       , 108.2         , 90.+ deltatheta ,18.2     , 90 + deltatheta));   
195      
196     if(fDebug) {
197       printf("%s: *                            Pads            : %3dx%3d                          *\n",
198              ClassName(),segmentation->Npx(),segmentation->Npy());
199       printf("%s: *                            Pad size        : %5.2f x%5.2f mm2                 *\n",
200              ClassName(),segmentation->Dpx(),segmentation->Dpy()); 
201       printf("%s: *                            Gap Thickness   : %5.1f cm                         *\n",
202              ClassName(),geometry->GetGapThickness());
203       printf("%s: *                            Radiator Width  : %5.1f cm                         *\n",
204              ClassName(),geometry->GetQuartzWidth());
205       printf("%s: *                            Radiator Length : %5.1f cm                         *\n",
206              ClassName(),geometry->GetQuartzLength());
207       printf("%s: *                            Freon Thickness : %5.1f cm                         *\n",
208              ClassName(),geometry->GetFreonThickness());
209       printf("%s: *                            Charge Slope    : %5.1f ADC                        *\n",
210              ClassName(),response->ChargeSlope());
211       printf("%s: *                            Feedback Prob.  : %5.2f %%                          *\n",
212              ClassName(),response->AlphaFeedback()*100);
213       printf("%s: *                            Debug Level     : %3d                              *\n",
214              ClassName(),GetDebugLevel());
215       printf("%s: *                                                                               *\n",
216              ClassName());
217       printf("%s: *********************************************************************************\n",
218              ClassName());
219     }
220 }
221
222
223
224
225
226
227
228