]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FIT/AliFITv0.cxx
nano config for LHC10hx
[u/mrichter/AliRoot.git] / FIT / AliFITv0.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: AliT0v1.cxx 50646 2011-07-18 14:40:16Z alla $ */
17
18 /////////////////////////////////////////////////////////////////////
19 //                                                                 //
20 // T0 ( T-zero) detector  version 1                             //
21 //
22 //Begin Html       
23 /*
24 <img src="gif/AliT0v1Class.gif">
25 */
26 //End Html
27 //                                                                  //
28 //                                                                  //
29 //////////////////////////////////////////////////////////////////////
30
31 #include <Riostream.h>
32 #include <stdlib.h>
33
34 #include "TGeoCompositeShape.h"
35 #include "TGeoManager.h"
36 #include "TGeoMatrix.h"
37 #include "TGeoVolume.h"
38 #include "TGeoTube.h"
39 #include "TGeoBBox.h"
40 #include "TGeoNode.h"
41
42
43 #include <TGeoGlobalMagField.h>
44 #include <TGraph.h>
45 #include <TLorentzVector.h>
46 #include <TMath.h>
47 #include <TVirtualMC.h>
48 #include <TString.h>
49
50 #include "AliLog.h"
51 #include "AliMagF.h"
52 #include "AliRun.h"
53
54 #include "AliFITHits.h"
55 #include "AliFITv0.h"
56
57 #include "AliMC.h"
58 #include "AliCDBLocal.h"
59 #include "AliCDBStorage.h"
60 #include "AliCDBManager.h"
61 #include "AliCDBEntry.h"
62 #include "AliTrackReference.h"
63
64 ClassImp(AliFITv0)
65
66
67 //--------------------------------------------------------------------
68 AliFITv0::AliFITv0():  AliFIT(),
69                      fIdSens1(0)
70
71 {
72   //
73   // Standart constructor for T0 Detector version 0
74 }
75 //--------------------------------------------------------------------
76 AliFITv0::AliFITv0(const char *name, const char *title):
77   AliFIT(name,title),
78   fIdSens1(0)
79 {
80   //
81   // Standart constructor for T0 Detector version 0
82   //
83   printf("@@@@@@@@@@@@@@@ AliFITv0::AliFITv0 \n");
84   fIshunt = 2; 
85 }
86 //_____________________________________________________________________________
87
88 AliFITv0::~AliFITv0() 
89 {
90   // desctructor  
91 }
92
93 //-------------------------------------------------------------------------
94 void AliFITv0::CreateGeometry()
95 {
96   //
97   // Create the geometry of FIT Detector version 1 full geometry
98   //
99   // begin Html
100   //
101
102   printf("@@@@@@@@@@@ AliFITv0::CreateGeometry\n");
103   Int_t *idtmed = fIdtmed->GetArray();
104   /*
105   TGeoMedium* kMedAir = gGeoManager->GetMedium("T0_AIR");
106   TGeoMedium* kMedMCPGlass = gGeoManager->GetMedium("T0_glass");
107   TGeoMedium* kMedOptGlass = gGeoManager->GetMedium("T0_OpticalGlass");
108   TGeoMedium* kMedOptGlassCathode = gGeoManager->GetMedium("T0_OpticalGlassCathode");
109   */
110   Float_t zdetC = 80;
111   Float_t zdetA = 373.;
112   Int_t idrotm[999];
113   Double_t x,y,z;
114   Float_t pstart[3] = {6, 20 ,2.6};
115   Float_t pinstart[3] = {3,3,2.55};
116   Float_t  pmcp[3] = {2.95, 2.95, 1.5}; //MCP
117   Float_t ptop[3] = {1.324, 1.324, 1.};//cherenkov radiator
118   Float_t preg[3] = {1.324, 1.324, 0.05};//photcathode 
119  
120   AliMatrix(idrotm[901], 90., 0., 90., 90., 180., 0.);
121   
122   //-------------------------------------------------------------------
123   //  T0 volume 
124   //-------------------------------------------------------------------
125   
126   Float_t x1[20] = {9,  9, 15 ,15 , 9,  
127                     3, -3,  3, -3, -9, 
128                     -9, -9, -15, -15, -9, 
129                     -3, 3, -3, 3, 9}; 
130   
131   Float_t y1[20] = {3.2, -3.2, 3.2, -3.2, -9.2, 
132                     -9, -9, -15, -15, -9.2,
133                     -3.2, 3.2, -3.2, 3.2, 9.2,
134                     9, 9, 15, 15, 9.2};
135   
136   
137   //mother tube
138    gMC->Gsvolu("0STR","TUBE",idtmed[kAir],pstart,18);
139    gMC->Gspos("0STR",1,"ALIC",0.,0.,-zdetC-pstart[2],idrotm[901],"ONLY");
140    gMC->Gspos("0STR",2,"ALIC",0.,0.,zdetA+pstart[2],0,"ONLY");
141    
142    //T0 interior
143    gMC->Gsvolu("0INS","BOX",idtmed[kAir],pinstart,3);
144     z=-pstart[2]+pinstart[2];
145    for (Int_t is=0; is<20; is++) {
146      gMC->Gspos ("0INS", is + 1, "0STR", x1[is], y1[is], z, 0, "ONLY");
147      gMC->Gspos ("0INS", is + 21, "0STR", x1[is], y1[is], z, 0, "ONLY");
148      printf(" 0INS is %i x %f y %f z %f \n",is, x1[is],y1[is], z);
149    }
150    // 
151   x=y=0;
152   // Entry window (glass)
153   gMC->Gsvolu("0TOP","BOX",idtmed[kAir],ptop,3); //glass
154   gMC->Gsvolu ("0REG", "BOX", idtmed[kSensAir], preg, 3); 
155   gMC->Gsvolu("0MCP","BOX",idtmed[kGlass],pmcp,3); //glass
156   Int_t ntops=0;
157   Float_t xin=0, yin=0;
158   for (Int_t ix=0; ix<4; ix++) {
159     xin = - pinstart[0] + 0.35 + (ix+0.5)*2*ptop[0] ;
160     for (Int_t iy=0; iy<4; iy++) {
161       z = - pinstart[2]+ptop[2];
162       yin = - pinstart[1] + 0.35 + (iy+0.5)*2*ptop[1];
163       ntops++;
164       gMC->Gspos("0TOP",ntops,"0INS",xin,yin,z,0,"ONLY");
165      //   printf(" 0TOP  full x %f y %f z %f \n", xin, yin, z);
166       z = -pinstart[2] + 2 * ptop[2] + preg[2];
167       gMC->Gspos ("0REG",ntops, "0INS", xin, yin, z, 0, "ONLY");
168       printf(" GEOGEO  %i %i %i %f %f %f %f %f %f", ntops, ix, iy,
169              xin,yin,x1[ntops],y1[ntops],x1[ntops]+xin,y1[ntops]+yin);
170     }
171   }
172   
173  // MCP
174  //  TGeoVolume* mcp =  gGeoManager->MakeBox("0MCP",kMedMCPGlass, 2.95, 2.95, 1.5);  
175    z=-pinstart[2] + 2*ptop[2] + 2*preg[2] + pmcp[2];
176    gMC->Gspos("0MCP",1,"0INS",0,0,z,0,"ONLY");
177     
178 }    
179 //------------------------------------------------------------------------
180 void AliFITv0::AddAlignableVolumes() const
181 {
182   //
183   // Create entries for alignable volumes associating the symbolic volume
184   // name with the corresponding volume path. Needs to be syncronized with
185   // eventual changes in the geometry.
186   //
187   printf("@@@@@@@@@@@@@@@AliFITv0::AddAlignableVolumes()\n");
188   TString volPath;
189   TString symName, sn;
190   TString vpAalign = "/ALIC_1/0STR_1";
191   TString vpCalign = "/ALIC_1/0STR_2";
192   for (Int_t imod=0; imod<2; imod++)  {
193     if (imod==0) {volPath  = vpCalign; symName="/ALIC_1/0STR_1"; }
194     if (imod==1) {volPath  = vpAalign; symName="/ALIC_1/0STR_2"; }
195     
196     AliDebug(2,"--------------------------------------------");
197     AliDebug(2,Form("volPath=%s\n",volPath.Data()));
198     AliDebug(2,Form("symName=%s\n",symName.Data()));
199     AliDebug(2,"--------------------------------------------");
200     if(!gGeoManager->SetAlignableEntry(symName.Data(),volPath.Data()))
201       AliFatal(Form("Alignable entry %s not created. Volume path %s not valid",
202 symName.Data(),volPath.Data()));
203   }
204 }   
205 //------------------------------------------------------------------------
206 void AliFITv0::CreateMaterials()
207 {
208
209   printf("@@@@@@@@@@@@AliFITv0::CreateMaterials\n"); 
210    Int_t isxfld   = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
211    Float_t sxmgmx = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
212    //   Float_t a,z,d,radl,absl,buf[1];
213    // Int_t nbuf;
214 // AIR
215                                                                                 
216    Float_t aAir[4]={12.0107,14.0067,15.9994,39.948};
217    Float_t zAir[4]={6.,7.,8.,18.};
218    Float_t wAir[4]={0.000124,0.755267,0.231781,0.012827};
219    Float_t dAir = 1.20479E-3;
220    Float_t dAir1 = 1.20479E-11;
221                                                                                
222  // PMT glass SiO2
223    Float_t aglass[2]={28.0855,15.9994};
224    Float_t zglass[2]={14.,8.};
225    Float_t wglass[2]={1.,2.};
226    Float_t dglass=2.65;
227
228     
229 //*** Definition Of avaible T0 materials ***
230    AliMixture(1, "Vacuum$", aAir, zAir, dAir1,4,wAir);
231    AliMixture(2, "Air$", aAir, zAir, dAir,4,wAir);
232    AliMixture( 4, "PMT glass   $",aglass,zglass,dglass,-2,wglass);
233    
234    AliMedium(1, "FIT_Air$", 2, 0, isxfld, sxmgmx, 10., .1, 1., .003, .003);
235    AliMedium(22, "FIT_AirSens$", 2, 1, isxfld, sxmgmx, 10., .1, 1., .003, .003);
236    AliMedium(3, "FIT_Vacuum$", 1, 0, isxfld, sxmgmx, 10., .01, .1, .003, .003);
237    AliMedium(6, "Glass$", 4, 1, isxfld, sxmgmx, 10., .01, .1, .003, .003);
238     
239    AliDebugClass(1,": ++++++++++++++Medium set++++++++++");
240    
241    
242 }
243
244
245 //-------------------------------------------------------------------
246 void AliFITv0::Init()
247 {
248   // Initialises version 0 of the Forward Multiplicity Detector
249   //
250   AliFIT::Init();
251   fIdSens1=gMC->VolId("0REG");
252   
253   AliDebug(1,Form("%s: *** FIT version 0 initialized ***\n",ClassName()));
254 }
255
256 //-------------------------------------------------------------------
257
258 void AliFITv0::StepManager()
259 {
260   //
261   // Called for every step in the T0 Detector
262   //
263   Int_t id,copy,copy1;
264   static Float_t hits[6];
265   static Int_t vol[3];
266   TLorentzVector pos;
267   TLorentzVector mom;
268   
269   //   TClonesArray &lhits = *fHits;
270   
271   if(!gMC->IsTrackAlive()) return; // particle has disappeared
272   
273   id=gMC->CurrentVolID(copy);  
274   // Check the sensetive volume
275   if(id==fIdSens1 ) { 
276     if(gMC->IsTrackEntering()) {
277       gMC->CurrentVolOffID(1,copy1);
278       vol[1] = copy1;
279       vol[0]=copy;
280       gMC->TrackPosition(pos);
281       hits[0] = pos[0];
282       hits[1] = pos[1];
283       hits[2] = pos[2];
284       if(pos[2]<0) vol[2] = 0;
285       else vol[2] = 1 ;
286       printf(" volumes pmt %i mcp %i side %i x %f y %f z %f\n",  vol[0], vol[1],  vol[2], hits[0], hits[1], hits[2] );
287       
288       Float_t etot=gMC->Etot();
289       hits[3]=etot;
290       Int_t iPart= gMC->TrackPid();
291       Int_t partID=gMC->IdFromPDG(iPart);
292       hits[4]=partID;
293       Float_t ttime=gMC->TrackTime();
294       hits[5]=ttime*1e12;
295       AddHit(gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,hits);
296       // Create a track reference at the exit of photocatode
297     }
298     
299     //charge particle 
300     if ( gMC->TrackCharge() )
301       AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kFIT);
302   } //sensitive
303
304 }
305