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