4c039060 |
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 | **************************************************************************/ |
b9a2d5e4 |
15 | ///////////////////////////////////////////////////////////////////// |
16 | // // |
17 | // Forward Multiplicity detector based on Silicon version 0 // |
18 | // |
19 | //Begin Html |
fe4da5cc |
20 | /* |
b9a2d5e4 |
21 | <img src="gif/AliFMDv0Class.gif"> |
fe4da5cc |
22 | */ |
b9a2d5e4 |
23 | //End Html |
24 | // // |
25 | // // |
26 | ////////////////////////////////////////////////////////////////////// |
27 | |
28 | #include <TMath.h> |
29 | #include <TGeometry.h> |
30 | #include <TTUBE.h> |
31 | #include <TFile.h> |
32 | #include <TTree.h> |
33 | #include <TNode.h> |
34 | #include <TClonesArray.h> |
35 | #include <TLorentzVector.h> |
36 | #include <TDirectory.h> |
fe4da5cc |
37 | #include "AliFMDv1.h" |
b9a2d5e4 |
38 | #include "AliRun.h" |
fe4da5cc |
39 | #include "AliMC.h" |
b9a2d5e4 |
40 | #include <iostream.h> |
41 | #include <fstream.h> |
94de3818 |
42 | #include "AliMagF.h" |
b9a2d5e4 |
43 | #include "AliFMDhit.h" |
44 | #include "AliFMDdigit.h" |
f707b5c1 |
45 | #include <stdlib.h> |
b9a2d5e4 |
46 | //#include "TGeant3.h" |
47 | //class TGeant3; |
fe4da5cc |
48 | ClassImp(AliFMDv1) |
b9a2d5e4 |
49 | |
50 | //-------------------------------------------------------------------- |
51 | AliFMDv1::AliFMDv1(const char *name, const char *title): |
52 | AliFMD(name,title) |
fe4da5cc |
53 | { |
54 | // |
b9a2d5e4 |
55 | // Standart constructor for Forward Multiplicity Detector version 0 |
fe4da5cc |
56 | // |
b9a2d5e4 |
57 | fIdSens1=0; |
58 | // setBufferSize(128000); |
fe4da5cc |
59 | } |
b9a2d5e4 |
60 | //------------------------------------------------------------------------- |
fe4da5cc |
61 | void AliFMDv1::CreateGeometry() |
62 | { |
b9a2d5e4 |
63 | // |
64 | // Create the geometry of Forward Multiplicity Detector version 0 |
fe4da5cc |
65 | // |
b9a2d5e4 |
66 | //Detector consists of 6 volumes: |
67 | // 1st covered pseudorapidity interval from 3.3 to 2.0 |
68 | // and placed on 65cm in Z-direction; |
69 | // 2nd - from 2.0 to 1.6 and Z=85 cm; |
70 | // 3d - the same pseudorapidity interval as the 1st |
71 | // but on the other side from the interaction point z=-65cm; |
72 | // 4th - simmetricaly with the 2nd : |
73 | // pseudorapidity from 2.0 to 1.6, Z=-85cm |
74 | // 5th - from 3.6 to 4.7, Z=-270cm |
75 | // 6th - from 4.5 to 5.5 , Z=-630cm. |
76 | // Each part has 400mkm Si (sensetive area, detector itself), |
77 | // 0.75cm of plastic simulated electronics material, |
78 | // Al support ring 2cm thickness and 1cm width placed on |
79 | // the outer radius of each Si disk; |
80 | // |
81 | // begin Html |
fe4da5cc |
82 | /* |
b9a2d5e4 |
83 | <img src="gif/AliFMDv0.gif"> |
84 | */ |
85 | // |
0d630091 |
86 | |
b9a2d5e4 |
87 | Int_t *idtmed = fIdtmed->GetArray(); |
88 | |
89 | Int_t ifmd; |
90 | Int_t idrotm[999]; |
91 | Float_t zfmd,par[3]; |
92 | char name[5]; |
93 | |
94 | Float_t rin[6], rout[6],zpos; |
dc8af42e |
95 | Float_t etain[6]= {3.3, 2.0, 3.3, 2.0, 4.5, 5.5}; |
96 | Float_t etaout[6]={2.0, 1.6, 2.0, 1.6, 3.3, 4.5}; |
97 | // Float_t z[6]={64., 85., -64., -85., -270., -630}; |
98 | Float_t z[6]={64., 85., -64., -85., -240., -630}; |
b9a2d5e4 |
99 | Float_t zDet=0.04; |
100 | Float_t zElectronic=0.75; |
101 | Float_t zSupport=1.; |
102 | Float_t zFMD=3.; |
103 | //------------------------------------------------------------------- |
104 | // FMD |
105 | //------------------------------------------------------------------ |
106 | |
107 | AliMatrix(idrotm[901], 90, 0, 90, 90, 180, 0); |
108 | |
109 | gMC->Gsvolu("GFSI","TUBE", idtmed[1], par, 0); |
110 | gMC->Gsvolu("GEL ","TUBE", idtmed[4], par, 0); |
111 | gMC->Gsvolu("GSUP","TUBE", idtmed[2], par, 0); |
112 | |
dc8af42e |
113 | for (ifmd =0; ifmd < 5; ifmd++){ |
b9a2d5e4 |
114 | |
115 | sprintf(name,"FMD%d",ifmd); |
0422d7f8 |
116 | if (fDebug) |
117 | printf("%s: %s",ClassName(),name); |
b9a2d5e4 |
118 | |
119 | zfmd=TMath::Abs(z[ifmd]); |
0422d7f8 |
120 | if (fDebug) printf("zfmd %f z[ifmd] %f",zfmd,z[ifmd]); |
b9a2d5e4 |
121 | AliFMD::Eta2Radius(etain[ifmd],zfmd,&rin[ifmd]); |
122 | AliFMD::Eta2Radius(etaout[ifmd],zfmd,&rout[ifmd]); |
123 | |
124 | par[0]=rin[ifmd]; // pipe size |
125 | par[1]=rout[ifmd]; |
126 | par[2]=zFMD/2; |
127 | gMC->Gsvolu(name,"TUBE", idtmed[3], par, 3); |
128 | |
0422d7f8 |
129 | if (fDebug) printf ("rin %f rout %f ZFMD %f\n",par[0],par[1],z[ifmd]); |
b9a2d5e4 |
130 | if (z[ifmd] < 0){ |
131 | gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],0, "ONLY");} |
132 | else { |
133 | gMC->Gspos(name,1,"ALIC",0,0,z[ifmd],idrotm[901], "ONLY");} |
134 | //Silicon detector |
135 | par[2]=zDet/2; |
136 | zpos=zFMD/2 -par[2]; |
137 | gMC->Gsposp("GFSI",ifmd+1,name,0,0,zpos,0, "ONLY",par,3); |
138 | |
139 | //Plastic slice for electronics |
140 | par[2]=zElectronic/2; |
141 | zpos=zpos-zDet/2-par[2]; |
142 | gMC->Gsposp("GEL ",ifmd+1,name,0,0,zpos,0, "ONLY",par,3); |
143 | |
144 | //Simple Al support |
145 | par[1]=rout[ifmd]; |
146 | par[0]=rout[ifmd]-2; |
147 | par[2]=zSupport/2; |
148 | zpos=zpos-zElectronic/2-par[2]; |
149 | gMC->Gsposp("GSUP",ifmd+1,name,0,0,zpos,0, "ONLY",par,3); |
150 | |
151 | |
152 | } |
153 | |
154 | //Silicon |
155 | |
156 | |
157 | gMC->Gsdvn("GSEC", "GFSI", 16, 2); |
158 | gMC->Gsdvn("GRIN", "GSEC", 128, 1); |
159 | /* |
160 | for (Int_t i=0; i<16; i++){ |
161 | sprintf(ring,"GR%d",i); |
162 | printf(ring); |
163 | gMC->Gsdvn(ring, "GSEC", 128, 1); |
164 | } |
165 | */ |
166 | |
167 | } |
168 | //------------------------------------------------------------------------ |
169 | void AliFMDv1::CreateMaterials() |
170 | { |
171 | Int_t isxfld = gAlice->Field()->Integ(); |
172 | Float_t sxmgmx = gAlice->Field()->Max(); |
173 | |
174 | // Plastic CH |
175 | Float_t aPlastic[2]={1.01,12.01}; |
176 | Float_t zPlastic[2]={1,6}; |
177 | Float_t wPlastic[2]={1,1}; |
178 | Float_t denPlastic=1.03; |
179 | // |
180 | |
181 | //*** Definition Of avaible FMD materials *** |
182 | AliMaterial(0, "Si chip$", 28.0855,14.,2.33,9.36,999); |
183 | AliMaterial(1, "Al supprt$", 26.980,13.,2.70,8.9,999); |
184 | AliMaterial(2, "FMD Air$", 14.61, 7.3, .001205, 30423.,999); |
185 | AliMixture( 5, "Plastic$",aPlastic,zPlastic,denPlastic,-2,wPlastic); |
186 | |
0d630091 |
187 | |
b9a2d5e4 |
188 | //** |
189 | AliMedium(1, "Si chip$", 0, 1, isxfld, sxmgmx, 1., .001, 1., .001, .001); |
190 | AliMedium(2, "Al support$", 1, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001); |
191 | AliMedium(3, "FMD air$", 2, 0, isxfld, sxmgmx, 1., .001, 1., .001, .001); |
192 | AliMedium(4, "Plastic$", 5, 0,isxfld, sxmgmx, 10., .01, 1., .003, .003); |
193 | |
0d630091 |
194 | |
0d630091 |
195 | |
fe4da5cc |
196 | } |
b9a2d5e4 |
197 | //--------------------------------------------------------------------- |
198 | void AliFMDv1::DrawDetector() |
fe4da5cc |
199 | { |
b9a2d5e4 |
200 | // |
201 | // Draw a shaded view of the Forward multiplicity detector version 0 |
202 | // |
203 | |
204 | AliMC* pMC = AliMC::GetMC(); |
205 | |
206 | //Set ALIC mother transparent |
207 | pMC->Gsatt("ALIC","SEEN",0); |
208 | // |
209 | //Set volumes visible |
210 | gMC->Gsatt("FMD0","SEEN",1); |
211 | gMC->Gsatt("FMD1","SEEN",1); |
212 | gMC->Gsatt("FMD2","SEEN",1); |
213 | gMC->Gsatt("FMD3","SEEN",1); |
214 | gMC->Gsatt("FMD4","SEEN",1); |
215 | gMC->Gsatt("FMD5","SEEN",1); |
216 | |
217 | // |
218 | gMC->Gdopt("hide","on"); |
219 | gMC->Gdopt("shad","on"); |
220 | gMC->SetClipBox("."); |
221 | gMC->SetClipBox("*",0,1000,-1000,1000,-1000,1000); |
222 | gMC->DefaultRange(); |
223 | gMC->Gdraw("alic",40,30,0,12,9.5,.2,0.2); |
224 | gMC->Gdhead(1111,"Forward multiplicity detector"); |
225 | gMC->Gdopt("hide","off"); |
226 | } |
227 | //------------------------------------------------------------------- |
228 | void AliFMDv1::Init() |
229 | { |
230 | // Initialises version 0 of the Forward Multiplicity Detector |
231 | // |
0422d7f8 |
232 | AliMC* gMC=AliMC::GetMC(); |
233 | AliFMD::Init(); |
234 | fIdSens1=gMC->VolId("GRIN"); |
235 | if (fDebug) printf("*** FMD version 1 initialized ***\n"); |
fe4da5cc |
236 | } |
237 | |
b9a2d5e4 |
238 | //------------------------------------------------------------------- |
239 | |
240 | void AliFMDv1::StepManager() |
fe4da5cc |
241 | { |
242 | // |
b9a2d5e4 |
243 | // Called for every step in the Forward Multiplicity Detector |
fe4da5cc |
244 | // |
b9a2d5e4 |
245 | Int_t id,copy,copy1,copy2; |
246 | static Float_t hits[9]; |
247 | static Int_t vol[3]; |
248 | static Float_t de; |
249 | TLorentzVector pos; |
250 | TLorentzVector mom; |
fe4da5cc |
251 | |
0d630091 |
252 | |
b9a2d5e4 |
253 | TClonesArray &lhits = *fHits; |
254 | AliMC* gMC=AliMC::GetMC(); |
255 | if(!gMC->IsTrackAlive()) return; // particle has disappeared |
0d630091 |
256 | |
b9a2d5e4 |
257 | Float_t charge = gMC->TrackCharge(); |
258 | if(TMath::Abs(charge)<=0.) return; //take only charged particles |
259 | |
260 | // printf(" in StepManeger \n"); |
261 | id=gMC->CurrentVolID(copy); |
fe4da5cc |
262 | |
b9a2d5e4 |
263 | // Check the sensetive volume |
264 | if(id==fIdSens1) |
265 | { |
266 | if(gMC->IsTrackEntering()) |
267 | { |
268 | // ((TGeant3*)gMC)->Gpcxyz(); |
269 | vol[2]=copy; |
270 | gMC->CurrentVolOffID(1,copy1); |
271 | vol[1]=copy1; |
272 | gMC->CurrentVolOffID(2,copy2); |
273 | vol[0]=copy2; |
dc8af42e |
274 | // printf("vol0 %d vol1 %d vol2 %d\n",vol[0],vol[1],vol[2]); |
b9a2d5e4 |
275 | gMC->TrackPosition(pos); |
276 | hits[0]=pos[0]; |
277 | hits[1]=pos[1]; |
278 | hits[2]=pos[2]; |
dc8af42e |
279 | // printf(" Zpos %f \n",hits[2]); |
b9a2d5e4 |
280 | gMC->TrackMomentum(mom); |
281 | hits[3]=mom[0]; |
282 | hits[4]=mom[1]; |
283 | hits[5]=mom[2]; |
284 | |
285 | Int_t iPart= gMC->TrackPid(); |
286 | Int_t partId=gMC->IdFromPDG(iPart); |
287 | hits[7]=partId; |
288 | hits[8]=1e9*gMC->TrackTime(); |
289 | de=0.; |
290 | // for(i=0; i<9; i++) printf(" hits %f \n",hits[i]); |
291 | } |
292 | if(gMC->IsTrackInside()){ |
293 | de=de+1000.*gMC->Edep(); |
294 | } |
295 | |
296 | if(gMC->IsTrackExiting() |
297 | ||gMC->IsTrackDisappeared()|| |
298 | gMC->IsTrackStop()) |
299 | { |
300 | hits[6]=de+1000.*gMC->Edep(); |
301 | new(lhits[fNhits++]) AliFMDhit(fIshunt,gAlice->CurrentTrack(),vol,hits); |
302 | } // IsTrackExiting() |
303 | } |
304 | } |
dc8af42e |
305 | //-------------------------------------------------------------------------- |
306 | |
307 | void AliFMDv1::Response( Float_t Edep) |
308 | { |
309 | Float_t I=1.664*0.04*2.33/22400; // = 0.69e-6; |
310 | Float_t chargeOnly=Edep/I; |
311 | //Add noise ~500electrons |
312 | Int_t charge=500; |
313 | if (Edep>0) |
314 | charge=Int_t(gRandom->Gaus(chargeOnly,500)); |
315 | } |
b9a2d5e4 |
316 | |
317 | |
318 | |
319 | |
fe4da5cc |
320 | |
0d630091 |
321 | |