AliRoot Core  da88d91 (da88d91)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMFT.cxx
Go to the documentation of this file.
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 //
18 // Main class of the ALICE Muon Forward Tracker
19 //
20 // Contact author: antonio.uras@cern.ch
21 //
22 //====================================================================================================================================================
23 
24 #include "AliLog.h"
25 #include "AliCodeTimer.h"
26 #include "TFile.h"
27 #include "TGeoManager.h"
28 #include "TGeoVolume.h"
29 #include "TGeoMatrix.h"
30 #include "TVirtualMC.h"
31 #include "TClonesArray.h"
32 #include "TGeoGlobalMagField.h"
33 #include "AliRun.h"
34 #include "AliLoader.h"
35 #include "AliDetector.h"
36 #include "AliMC.h"
37 #include "AliMagF.h"
38 #include "AliMFT.h"
39 #include "AliMFTHit.h"
40 #include "AliMFTDigit.h"
41 #include "AliMFTCluster.h"
42 #include "AliTrackReference.h"
43 #include "AliMFTSegmentation.h"
44 #include "AliMFTDigitizer.h"
45 #include "AliMFTPlane.h"
46 #include "AliMFTConstants.h"
47 #include "TString.h"
48 #include "TObjArray.h"
49 #include "AliMFTGeometry.h"
50 
52 
53 //====================================================================================================================================================
54 
55 AliMFT::AliMFT():
56 AliDetector(),
57 fVersion(1),
58 fNPlanes(0),
59 fSDigitsPerPlane(0),
60 fDigitsPerPlane(0),
61 fRecPointsPerPlane(0),
62 fSideDigits(0),
63 fSegmentation(0),
64 fNameGeomFile(0),
65 fChargeDispersion(25.e-4),
66 fSingleStepForChargeDispersion(0),
67 fNStepForChargeDispersion(4),
68 fDensitySupportOverSi(0.036),
69 fFileNameForUnderyingEvent(0),
70 fFileNameForPileUpEvents(0),
71 fNPileUpEvents(0),
72 fUnderlyingEventID(-1),
73 fGeomTGeo(0)
74 {
75 
76  // default constructor
77 
78  for (Int_t iPileUp=0; iPileUp<AliMFTConstants::fNMaxPileUpEvents; iPileUp++) fPileUpEventsIDs[iPileUp] = -1;
79 
80 
81 }
82 
83 //====================================================================================================================================================
84 
85 AliMFT::AliMFT(const Char_t *name, const Char_t *title):
86 AliDetector(name, title),
87 fVersion(1),
88 fNPlanes(0),
89 fSDigitsPerPlane(0),
90 fDigitsPerPlane(0),
91 fRecPointsPerPlane(0),
92 fSideDigits(0),
93 fSegmentation(0),
94 fNameGeomFile(0),
95 fChargeDispersion(25.e-4),
96 fSingleStepForChargeDispersion(0),
97 fNStepForChargeDispersion(4),
98 fDensitySupportOverSi(0.036),
99 fFileNameForUnderyingEvent(0),
100 fFileNameForPileUpEvents(0),
101 fNPileUpEvents(0),
102 fUnderlyingEventID(-1),
103 fGeomTGeo(0)
104 {
105 
106  for (Int_t iPileUp=0; iPileUp<AliMFTConstants::fNMaxPileUpEvents; iPileUp++) fPileUpEventsIDs[iPileUp] = -1;
107 
108  fNameGeomFile = "AliMFTGeometry.root";
109 
110  SetGeometry();
111 
112 }
113 
114 //====================================================================================================================================================
115 
116 AliMFT::AliMFT(const Char_t *name, const Char_t *title, Char_t *nameGeomFile):
117 AliDetector(name, title),
118 fVersion(1),
119 fNPlanes(0),
120 fSDigitsPerPlane(0),
121 fDigitsPerPlane(0),
122 fRecPointsPerPlane(0),
123 fSideDigits(0),
124 fSegmentation(0),
125 fNameGeomFile(0),
126 fChargeDispersion(25.e-4),
127 fSingleStepForChargeDispersion(0),
128 fNStepForChargeDispersion(4),
129 fDensitySupportOverSi(0.036),
130 fFileNameForUnderyingEvent(0),
131 fFileNameForPileUpEvents(0),
132 fNPileUpEvents(0),
133 fUnderlyingEventID(-1)
134 {
135 
136  for (Int_t iPileUp=0; iPileUp<AliMFTConstants::fNMaxPileUpEvents; iPileUp++) fPileUpEventsIDs[iPileUp] = -1;
137 
138  fNameGeomFile = nameGeomFile;
139 
140  SetGeometry();
141 
142 }
143 
144 //====================================================================================================================================================
145 
147 
148  if (fSDigitsPerPlane) { fSDigitsPerPlane->Delete(); delete fSDigitsPerPlane; }
149  if (fDigitsPerPlane) { fDigitsPerPlane->Delete(); delete fDigitsPerPlane; }
150  if (fRecPointsPerPlane) { fRecPointsPerPlane->Delete(); delete fRecPointsPerPlane; }
151 
152  delete fGeomTGeo;
153 
154 }
155 
156 //====================================================================================================================================================
157 
158 void AliMFT::Init() {
159 
160  fGeomTGeo = new AliMFTGeomTGeo();
161 
162 }
163 
164 //====================================================================================================================================================
165 
167 
169 
170 
171  // Definition of MFT materials - to be updated to the most recent values
172 
173  AliDebug(1,"Start MFT materials");
174 
175 
176  // data from PDG booklet 2002 density [gr/cm^3] rad len [cm] abs len [cm]
177  Float_t aSi = 28.085 , zSi = 14. , dSi = 2.329 , radSi = 21.82/dSi , absSi = 108.4/dSi ; // Silicon
178  Float_t aCarb = 12.01 , zCarb = 6. , dCarb = 2.265 , radCarb = 18.8 , absCarb = 49.9 ; // Carbon
179  Float_t aAlu = 26.98 , zAlu = 13. , dAlu = 2.70 , radAlu = 8.897 , absAlu = 39.70 ; // Aluminum
180  Float_t aBe = 9.012182 , zBe = 4. , dBe = 1.85 , radBe = 65.19/dBe , absBe = 77.8/dBe ; // Beryllium
181  Float_t aCu = 63.546 , zCu = 29. , dCu = 8.96 , radCu = 1.436 , absCu = 15.32 ; // Copper
182 
183  // Air mixture
184  const Int_t nAir = 4;
185  Float_t aAir[nAir] = {12, 14, 16, 36} , zAir[nAir] = {6, 7, 8, 18} , wAir[nAir]={0.000124, 0.755267, 0.231781, 0.012827} , dAir=0.00120479, dAirVacuum=0.00120479e-4;
186 
187  // Water mixture
188  const Int_t nWater = 2;
189  Float_t aWater[nWater] = {1.00794, 15.9994} , zWater[nWater] = {1, 8} , wWater[nWater] = {0.111894, 0.888106} , dWater=1.;
190 
191  // SiO2 mixture
192  const Int_t nSiO2 = 2;
193  Float_t aSiO2[nSiO2] = {15.9994, 28.0855} , zSiO2[nSiO2] = {8., 14.} , wSiO2[nSiO2] = {0.532565, 0.467435} , dSiO2 = 2.20;
194 
195  // Inox mixture
196  const Int_t nInox = 9;
197  Float_t aInox[nInox] = {12.0107, 54.9380, 28.0855, 30.9738, 32.0660, 58.6928, 51.9961, 95.9400, 55.8450} ;
198  Float_t zInox[nInox] = { 6, 25, 14, 15, 16, 28, 24, 42, 26 } ;
199  Float_t wInox[nInox] = {0.0003, 0.02, 0.01, 0.00045, 0.0003, 0.12, 0.17, 0.025, 0.65395} ;
200  Float_t dInox = 8.03;
201 
202  // Kapton polyimide film (from SPD AliITSv11.cxx) and http://physics.nist.gov/cgi-bin/Star/compos.pl?matno=179
203  Float_t aKapton[4]={1.00794,12.0107, 14.010,15.9994};
204  Float_t zKapton[4]={1.,6.,7.,8.};
205  Float_t wKapton[4]={0.026362,0.69113,0.07327,0.209235};
206  Float_t dKapton = 1.42;
207 
208  //--- EPOXY --- C18 H19 O3 from ITS AliITSv11.cxx
209  Float_t aEpoxy[3] = {15.9994, 1.00794, 12.0107} ;
210  Float_t zEpoxy[3] = { 8., 1., 6.} ;
211  Float_t wEpoxy[3] = { 3., 19., 18.} ;
212  Float_t dEpoxy = 1.23; // 1.8 very high value from ITS! ou 1.23 from eccobond 45 lv datasheet
213 
214  //--- Silicone SE4445 Dow Corning
215  // Si, Al, O, C, H
216  Float_t aSE4445[5] = {28.0855, 26.981538, 15.9994, 12.0107, 1.00794} ;
217  Float_t zSE4445[5] = { 14., 13., 8., 6., 1.} ;
218  Float_t wSE4445[5] = { 5.531, 45.222, 43.351, 4.717, 1.172} ;
219  Float_t dSE4445 = 2.36; //from LBNL file, priv. comm.
220 
221  //--- CARBON FIBER CM55J --- from ITS AliITSv11.cxx
222  Float_t aCM55J[4]={12.0107,14.0067,15.9994,1.00794};
223  Float_t zCM55J[4]={6.,7.,8.,1.};
224  Float_t wCM55J[4]={0.908508078,0.010387573,0.055957585,0.025146765};
225  Float_t dCM55J = 1.33; // new value for MFT, from J.M. Buhour infos
226 
227  // Rohacell mixture
228  const Int_t nRohacell = 3;
229  Float_t aRohacell[nRohacell] = {1.00794, 12.0107, 15.9994};
230  Float_t zRohacell[nRohacell] = {1., 6., 8.};
231  Float_t wRohacell[nRohacell] = {0.0858, 0.5964, 0.3178};
232  Float_t dRohacell = 0.032; // 0.032 g/cm3 rohacell 31, 0.075 g/cm3 rohacell 71;
233 
234  // Polyimide pipe mixture
235  const Int_t nPolyimide = 4;
236  Float_t aPolyimide[nPolyimide] = {1.00794, 12.0107, 14.0067, 15.9994};
237  Float_t zPolyimide[nPolyimide] = {1, 6, 7, 8};
238  Float_t wPolyimide[nPolyimide] = {0.00942, 0.56089, 0.13082, 0.29887};
239  Float_t dPolyimide = 1.4;
240 
241  // PEEK mixture (Polyether Ether Ketone)
242  const Int_t nPEEK = 3;
243  Float_t aPEEK[nPEEK] = {1.00794, 12.0107, 15.9994} ;
244  Float_t zPEEK[nPEEK] = {1, 6, 8} ;
245  Float_t wPEEK[nPEEK] = {0.06713, 0.40001, 0.53285} ;
246  Float_t dPEEK = 1.32;
247 
248  // (Printed Circuit Board), material type FR4
249  const Int_t nFR4 = 5;
250  Float_t aFR4[nFR4] = {1.00794, 12.0107, 15.9994, 28.0855, 79.904} ;
251  Float_t zFR4[nFR4] = {1, 6, 8, 14, 35} ;
252  Float_t wFR4[nFR4] = {0.0684428, 0.278042,0.405633, 0.180774, 0.0671091} ;
253  Float_t dFR4 = 1.7; //Density FR4= 1.7 Cu=8.96
254 
255 
256  //======================== From ITS code ===================================
257  //X7R capacitors - updated from F.Tosello's web page - M.S. 18 Oct 10
258  // 58.6928 --> innner electrodes (mainly Ni)
259  // 63.5460 --> terminaisons (Cu)
260  // 118.710 --> terminaisons (Sn)
261  // 137.327 Ba, 47.867 Ti, 15.9994 O (mainly BaTiO3)
262  Float_t aX7R[6]={137.327,47.867,15.9994,58.6928,63.5460,118.710};
263  Float_t zX7R[6]={56.,22.,8.,28.,29.,50.};
264  Float_t wX7R[6]={0.524732,0.176736,0.179282,0.079750,0.019750,0.019750};
265  Float_t dX7R = 6.07914;
266 
267  //X7R weld, i.e. Sn 60% Pb 40% (from F.Tosello's web page - M.S. 15 Oct 10)
268 
269  Float_t aX7Rweld[2]={118.71 , 207.20};
270  Float_t zX7Rweld[2]={ 50. , 82. };
271  Float_t wX7Rweld[2]={ 0.60 , 0.40};
272  Float_t dX7Rweld = 8.52358;
273  //==========================================================================
274 
275  Int_t matId = 0; // tmp material id number
276  Int_t unsens = 0, sens=1; // sensitive or unsensitive medium
277  Int_t itgfld = 3; // type of field intergration 0 no field -1 user in guswim 1 Runge Kutta 2 helix 3 const field along z
278  Float_t maxfld = 5.; // max field value
279 
280  Float_t tmaxfd = -10.0; // max deflection angle due to magnetic field in one step
281  Float_t stemax = 0.001; // max step allowed [cm]
282  Float_t deemax = -0.2; // maximum fractional energy loss in one step 0<deemax<=1
283  Float_t epsil = 0.001; // tracking precision [cm]
284  Float_t stmin = -0.001; // minimum step due to continuous processes [cm] (negative value: choose it automatically)
285 
286  Float_t tmaxfdSi = 0.1; // max deflection angle due to magnetic field in one step
287  Float_t stemaxSi = 5.0e-4; // maximum step allowed [cm]
288  Float_t deemaxSi = 0.1; // maximum fractional energy loss in one step 0<deemax<=1
289  Float_t epsilSi = 0.5e-4; // tracking precision [cm]
290  Float_t stminSi = -0.001; // minimum step due to continuous processes [cm] (negative value: choose it automatically)
291 
292  Int_t fieldType = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ(); // Field type
293  Double_t maxField = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max(); // Field max.
294 
295  AliMixture(kAir,"Air$", aAir, zAir, dAir, nAir, wAir);
296  AliMedium(kAir, "Air$", kAir, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
297  //
298  // Vacuum
299  AliMixture(kVacuum, "Vacuum$", aAir, zAir, dAirVacuum, nAir, wAir);
300  AliMedium(kVacuum, "Vacuum$", kVacuum, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
301 
302  AliMaterial(++matId, "Si$", aSi, zSi, dSi, radSi, absSi);
303  AliMedium(kSi, "Si$", matId, sens, fieldType, maxField, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
304 
305  AliMaterial(++matId, "Readout$", aSi, zSi, dSi, radSi, absSi);
306  AliMedium(kReadout, "Readout$", matId, unsens, fieldType, maxField, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
307 
308  AliMaterial(++matId, "Support$", aSi, zSi, dSi*fDensitySupportOverSi, radSi/fDensitySupportOverSi, absSi/fDensitySupportOverSi);
309  AliMedium(kSupport, "Support$", matId, unsens, fieldType, maxField, tmaxfdSi, stemaxSi, deemaxSi, epsilSi, stminSi);
310 
311  Double_t maxBending = 0; // Max Angle
312  Double_t maxStepSize = 0.001; // Max step size
313  Double_t maxEnergyLoss = 1; // Max Delta E
314  Double_t precision = 0.001; // Precision
315  Double_t minStepSize = 0.001; // Minimum step size
316  // Carbon
317  aCarb = 12.011;
318  zCarb = 6.;
319  dCarb = 2.265;
320  radCarb = 18.8;
321  absCarb = 999;
322  maxBending = 10;
323  maxStepSize = .01;
324  precision = .003;
325  minStepSize = .003;
326  AliMaterial(matId, "Carbon$", aCarb, zCarb, dCarb, radCarb, absCarb);
327  AliMedium(kCarbon, "Carbon$", matId,0,fieldType,maxField,maxBending,
328  maxStepSize,maxEnergyLoss,precision,minStepSize);
329 
330  // AliMaterial(++matId, "Carbon$", aCarb, zCarb, dCarb, radCarb, absCarb );
331 // AliMedium(kCarbon, "Carbon$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
332 
333  AliMaterial(++matId, "Be$", aBe, zBe, dBe, radBe, absBe );
334  AliMedium(kBe, "Be$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
335 
336  AliMaterial(++matId, "Alu$", aAlu, zAlu, dAlu, radAlu, absAlu);
337  AliMedium(kAlu, "Alu$", matId, unsens, fieldType, maxField, tmaxfd, stemax, deemax, epsil, stmin);
338 
339 
340  AliMixture(++matId, "Water$", aWater, zWater, dWater, nWater, wWater);
341  AliMedium(kWater, "Water$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
342 
343  AliMixture(++matId, "SiO2$", aSiO2, zSiO2, dSiO2, nSiO2, wSiO2);
344  AliMedium(kSiO2, "SiO2$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
345 
346  AliMixture(++matId, "Inox$", aInox, zInox, dInox, nInox, wInox);
347  AliMedium(kInox, "Inox$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
348 
349  AliMixture(++matId, "Kapton$", aKapton, zKapton, dKapton, 4, wKapton);
350  AliMedium(kKapton,"Kapton$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
351 
352  AliMixture(++matId, "Epoxy$", aEpoxy, zEpoxy, dEpoxy, -3, wEpoxy);
353  AliMedium(kEpoxy,"Epoxy$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
354 
355  AliMixture(++matId, "SE4445$", aSE4445, zSE4445, dSE4445, -5, wSE4445);
356  AliMedium(kSE4445,"SE4445$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
357 
358  AliMixture(++matId,"CarbonFiber$",aCM55J,zCM55J,dCM55J,4,wCM55J);
359  AliMedium(kCarbonEpoxy,"CarbonFiber$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
360 
361  AliMixture(++matId, "Rohacell", aRohacell, zRohacell, dRohacell, nRohacell, wRohacell);
362  AliMedium(kRohacell, "Rohacell", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
363 
364  AliMixture(++matId, "Polyimide", aPolyimide, zPolyimide, dPolyimide, nPolyimide, wPolyimide);
365  AliMedium(kPolyimide, "Polyimide", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
366 
367  AliMixture(++matId, "PEEK$", aPEEK, zPEEK, dPEEK, nPEEK, wPEEK);
368  AliMedium(kPEEK, "PEEK$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
369 
370  AliMixture(++matId, "FR4$", aFR4, zFR4, dFR4, nFR4, wFR4);
371  AliMedium(kFR4, "FR4$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
372 
373  AliMaterial(++matId, "Cu$", aCu, zCu, dCu, radCu, absCu);
374  AliMedium(kCu, "Cu$", matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
375 
376  AliMixture(++matId, "X7Rcapacitors$",aX7R,zX7R,dX7R,6,wX7R);
377  AliMedium(kX7R, "X7Rcapacitors$",matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
378 
379  AliMixture(++matId, "X7Rweld$",aX7Rweld,zX7Rweld,dX7Rweld,2,wX7Rweld);
380  AliMedium(kX7Rw, "X7Rweld$",matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
381 
382  // Carbon fleece from AliITSSUv2.cxx
383  AliMaterial(++matId,"CarbonFleece$",12.0107,6,0.4,radCarb,absCarb); // 999,999); why 999???
384  AliMedium(kCarbonFleece, "CarbonFleece$",matId, unsens, itgfld, maxfld, tmaxfd, stemax, deemax, epsil, stmin);
385 
386 
387  AliDebug(1,"End MFT materials");
388 
389 }
390 
391 //====================================================================================================================================================
392 
394 
395  // Creates detailed geometry simulation (currently GEANT volumes tree)
396 
397  if(!TVirtualMC::GetMC()->IsRootGeometrySupported()) return;
398 
400 
401  mftGeom->Build();
402 
404 
405  Init();
406 
407 }
408 
409 //====================================================================================================================================================
410 
412 
413  // Create entries for alignable volumes associating the symbolic volume
414  // name with the corresponding volume path. Needs to be syncronized with
415  // eventual changes in the geometry.
416 
417  TString sysName = "MFT";
418  TString volPath = "/ALIC_1/MFT_0";
419 
420  if (!gGeoManager->SetAlignableEntry(sysName.Data(),volPath.Data())) {
421  AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", sysName.Data(), volPath.Data()));
422  }
423 
424 }
425 
426 //====================================================================================================================================================
427 
429 
430  // If MFT is not active do nothing
431  if (!(this->IsActive())) return;
432 
434  AliMFTSegmentation * seg = mftGeo->GetSegmentation();
435  if (!seg) AliFatal("No segmentation available");
436 
437  TVirtualMC* mc = fMC;
438 
439  Double_t absQ = TMath::Abs(mc->TrackCharge());
440  if (absQ <= 0) return;
441 
442  Int_t copy;
443  // Check if hit is into a MFT sensor volume
444  if(mc->CurrentVolID(copy) != mftGeo->GetSensorVolumeID() ) return;
445  // Get The Sensor Unique ID
446  int chipId=-1,ladderId=-1,diskId=-1,halfId=-1,level=0;
447  mc->CurrentVolOffID(++level,chipId);
448  mc->CurrentVolOffID(++level,ladderId);
449  mc->CurrentVolOffID(++level,diskId);
450  mc->CurrentVolOffID(++level,halfId);
451  Int_t detElemID = mftGeo->GetObjectID(AliMFTGeometry::kSensorType,halfId,diskId,ladderId,chipId);
452  AliDebug(1,Form("Found hit into half = %d; disk = %d; ladder = %d; chip = %d",halfId,diskId,ladderId,chipId));
453 
454  if (mc->IsTrackExiting()) {
455  AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kMFT);
456  }
457 
458  static TLorentzVector position, momentum;
459  static AliMFTHit hit;
460 
461  Int_t status = 0;
462 
463  // Track status
464  if (mc->IsTrackInside()) status += 0x1<<0;
465  if (mc->IsTrackEntering()) status += 0x1<<1;
466  if (mc->IsTrackExiting()) status += 0x1<<2;
467  if (mc->IsTrackOut()) status += 0x1<<3;
468  if (mc->IsTrackDisappeared()) status += 0x1<<4;
469  if (mc->IsTrackStop()) status += 0x1<<5;
470  if (mc->IsTrackAlive()) status += 0x1<<6;
471 
472  // ---------- Fill hit structure
473 
474  hit.SetDetElemID(detElemID);
475  hit.SetPlane(diskId);
476  hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
477 
478  mc->TrackPosition(position);
479  mc->TrackMomentum(momentum);
480 
481  AliDebug(1, Form(" %s Hit #%06d (x=%f, y=%f, z=%f) belongs to track %02d",
482  mc->CurrentVolName(), fNhits, position.X(), position.Y(), position.Z(), gAlice->GetMCApp()->GetCurrentTrackNumber()));
483 
484  hit.SetPosition(position);
485  hit.SetTOF(mc->TrackTime());
486  hit.SetMomentum(momentum);
487  hit.SetStatus(status);
488  hit.SetEloss(mc->Edep());
489  // hit.SetShunt(GetIshunt());
490  // if (mc->IsTrackEntering()) {
491  // hit.SetStartPosition(position);
492  // hit.SetStartTime(mc->TrackTime());
493  // hit.SetStartStatus(status);
494  // return; // don't save entering hit.
495  // }
496 
497  // Fill hit structure with this new hit.
498  new ((*fHits)[fNhits++]) AliMFTHit(hit);
499 
500  // Save old position... for next hit.
501  // hit.SetStartPosition(position);
502  // hit.SetStartTime(mc->TrackTime());
503  // hit.SetStartStatus(status);
504 
505  return;
506 
507 }
508 
509 
510 //====================================================================================================================================================
511 
513 
514  // Interface method invoked from AliSimulation to create a list of sdigits corresponding to list of hits. Every hit generates one sdigit.
515  AliCodeTimerAuto("",0);
516 
517  AliDebug(1, "Start Hits2SDigits.");
518 
520  AliMFTSegmentation * seg = mftGeo->GetSegmentation();
521  if (!seg) AliFatal("No segmentation available");
522 
523  if (!fLoader->TreeH()) fLoader->LoadHits();
524 
525  if (!fLoader->TreeS()) {
526 
527  for (Int_t iEvt=0;iEvt<fLoader->GetRunLoader()->GetNumberOfEvents(); iEvt++) {
528 
529  fLoader->GetRunLoader()->GetEvent(iEvt);
530  fLoader->MakeTree("S");
531  MakeBranch("S");
532  SetTreeAddress();
533 
534  AliDebug(1, Form("Event %03d: fLoader->TreeH()->GetEntries() = %2d", iEvt, Int_t(fLoader->TreeH()->GetEntries())));
535 
536  for (Int_t iTrack=0; iTrack<fLoader->TreeH()->GetEntries(); iTrack++) {
537  fLoader->TreeH()->GetEntry(iTrack);
538  Hits2SDigitsLocal(Hits(), GetSDigitsList(), iTrack); // convert these hits to a list of sdigits
539  }
540 
541  fLoader->TreeS()->Fill();
542  fLoader->WriteSDigits("OVERWRITE");
543  ResetSDigits();
544 
545  }
546  }
547 
548  fLoader->UnloadHits();
549  fLoader->UnloadSDigits();
550 
551  AliDebug(1,"Stop Hits2SDigits.");
552 
553 }
554 
555 //====================================================================================================================================================
556 
557 void AliMFT::Hits2SDigitsLocal(TClonesArray *hits, const TObjArray *pSDig, Int_t track) {
558 
559  // Add sdigits of these hits to the list
560 
561  AliDebug(1, "Entering Hits2SDigitsLocal");
562 
563  TClonesArray *pSDigList[AliMFTConstants::kNDisks];
564  for (Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) pSDigList[iPlane] = NULL;
565  for (Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) {
566  pSDigList[iPlane] = (TClonesArray*) (*pSDig)[iPlane];
567  AliDebug(1,Form("Entries of pSDigList %3d; plane: %02d,",pSDigList[iPlane]->GetEntries(),iPlane));
568  if (!track && pSDigList[iPlane]->GetEntries()!=0) AliErrorClass("Some of sdigits lists is not empty");
569  }
570 
571  for (Int_t iHit=0; iHit<hits->GetEntries(); iHit++) {
572 
573  AliMFTHit *hit = (AliMFTHit*) hits->At(iHit);
574 
575 // AliDebug(1,Form("\n--- New hit x,y,z %f %f %f ",hit->X(), hit->Y(), hit->Z()));
576 
577  // Creating "main digit"
578 
579  AliMFTDigit *mainSDigit = new AliMFTDigit();
580  mainSDigit->SetEloss(hit->GetEloss());
581  mainSDigit->SetDetElemID(hit->GetDetElemID());
582  mainSDigit->SetPlane(hit->GetPlane());
583  mainSDigit->AddMCLabel(hit->GetTrack());
584  Int_t xPixel = -1;
585  Int_t yPixel = -1;
587 
588  AliDebug(2,Form("Hit at x,y,z = %f %f %f ",hit->X(), hit->Y(), hit->Z()));
589  if(mftGeom->Hit2PixelID(hit->X(), hit->Y(), hit->Z(), mainSDigit->GetDetElemID(), xPixel, yPixel)){
590  mainSDigit->SetPixID(xPixel, yPixel, 0);
592  Double_t xCenter, yCenter, zCenter;
593  mftGeom->GetPixelCenter( xPixel, yPixel, mainSDigit->GetDetElemID(), xCenter, yCenter, zCenter );
594  mainSDigit->SetPixCenter(xCenter, yCenter, zCenter );
595  new ((*fSideDigits)[fSideDigits->GetEntries()]) AliMFTDigit(*mainSDigit);
596  AliDebug(2, Form("Created new sdigit (%f, %f, %f) from hit (%f, %f, %f)",
597  mainSDigit->GetPixelCenterX(), mainSDigit->GetPixelCenterY(), mainSDigit->GetPixelCenterZ(), hit->X(), hit->Y(), hit->Z()));
598  } else
599  AliDebug(1,Form("Hit outside active area : hit x,y,z = %f ; %f ; %f --> Pixel %d ; %d ",hit->X(), hit->Y(), hit->Z(),xPixel,yPixel));
600 
601 
602 
603 
604  // creating "side digits" to simulate the effect of charge dispersion
605 
606  Double_t pi4 = TMath::Pi()/4.;
607  for (Int_t iStep=0; iStep<fNStepForChargeDispersion; iStep++) {
608  Double_t shift = (iStep+1) * fSingleStepForChargeDispersion;
609  for (Int_t iAngle=0; iAngle<8; iAngle++) {
610  Double_t shiftX = shift*TMath::Cos(iAngle*pi4);
611  Double_t shiftY = shift*TMath::Sin(iAngle*pi4);
612  if (mftGeom->Hit2PixelID(hit->X()+shiftX, hit->Y()+shiftY, hit->Z(), mainSDigit->GetDetElemID(), xPixel, yPixel) ){
613  Bool_t digitExists = kFALSE;
614  for (Int_t iSideDigit=0; iSideDigit<fSideDigits->GetEntries(); iSideDigit++) {
615  if (xPixel==((AliMFTDigit*) fSideDigits->At(iSideDigit))->GetPixelX() &&
616  yPixel==((AliMFTDigit*) fSideDigits->At(iSideDigit))->GetPixelY() &&
617  mainSDigit->GetDetElemID() == ((AliMFTDigit*) fSideDigits->At(iSideDigit))->GetDetElemID()) {
618  digitExists = kTRUE;
619  break;
620  }
621  }
622  if (!digitExists) {
623  AliMFTDigit *sideSDigit = new AliMFTDigit();
624  sideSDigit->SetEloss(0.);
625  sideSDigit->SetDetElemID(hit->GetDetElemID());
626  sideSDigit->SetPlane(hit->GetPlane());
627  sideSDigit->AddMCLabel(hit->GetTrack());
628  sideSDigit->SetPixID(xPixel, yPixel, 0);
630  Double_t xCenter, yCenter, zCenter;
631  mftGeom->GetPixelCenter( xPixel, yPixel, mainSDigit->GetDetElemID(), xCenter, yCenter, zCenter );
632  mainSDigit->SetPixCenter(xCenter, yCenter, zCenter );
633  new ((*fSideDigits)[fSideDigits->GetEntries()]) AliMFTDigit(*sideSDigit);
634  }
635  }
636  }
637  }
638 
639 
640  // -------- checking which pixels switched on have their diode actually within the charge dispersion radius
641 
642  for (Int_t iSDigit=0; iSDigit<fSideDigits->GetEntries(); iSDigit++) {
643  AliMFTDigit *mySDig = (AliMFTDigit*) (fSideDigits->At(iSDigit));
644  Double_t distance = TMath::Sqrt(TMath::Power(mySDig->GetPixelCenterX()-hit->X(),2) + TMath::Power(mySDig->GetPixelCenterY()-hit->Y(),2));
645  if (distance<fChargeDispersion) {
646  AliDebug(1,Form("Created new side sdigit (%f, %f, %f) from hit (%f, %f, %f)",
647  mySDig->GetPixelCenterX(), mySDig->GetPixelCenterY(), mySDig->GetPixelCenterZ(), hit->X(), hit->Y(), hit->Z()));
648  new ((*pSDigList[mySDig->GetPlane()])[pSDigList[mySDig->GetPlane()]->GetEntries()]) AliMFTDigit(*mySDig);
649  }
650  }
651 
652  fSideDigits->Delete();
653 
654  }
655 
656  AliDebug(1,"Exiting Hits2SDigitsLocal");
657 
658 }
659 
660 //====================================================================================================================================================
661 
662 void AliMFT::MakeBranch(Option_t *option) {
663 
664  // Create Tree branches
665  AliDebug(1, Form("Start with option= %s.",option));
666 
667  const Int_t kBufSize = 4000;
668 
669  const Char_t *cH = strstr(option,"H");
670  const Char_t *cD = strstr(option,"D");
671  const Char_t *cS = strstr(option,"S");
672 
673  if (cH && fLoader->TreeH()) {
674  CreateHits();
675  MakeBranchInTree(fLoader->TreeH(), "MFT", &fHits, kBufSize, 0);
676  }
677 
678  if (cS && fLoader->TreeS()) {
679  CreateSDigits();
680  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) MakeBranchInTree(fLoader->TreeS(),
681  Form("Plane_%02d",iPlane),
682  &((*fSDigitsPerPlane)[iPlane]),
683  kBufSize, 0);
684  }
685 
686  if (cD && fLoader->TreeD()) {
687  CreateDigits();
688  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) MakeBranchInTree(fLoader->TreeD(),
689  Form("Plane_%02d",iPlane),
690  &((*fDigitsPerPlane)[iPlane]),
691  kBufSize, 0);
692  }
693 
694  AliDebug(1,"Stop.");
695 
696 }
697 
698 //====================================================================================================================================================
699 
701 
702 
703  //Set branch address for the Hits and Digits Tree.
704  AliDebug(1, "Start.");
705 
706  AliDebug(1, Form("AliMFT::SetTreeAddress Hits fLoader->TreeH() = %p\n", fLoader->TreeH()));
707  if (fLoader->TreeH() && fLoader->TreeH()->GetBranch("MFT")) {
708  CreateHits();
709  fLoader->TreeH()->SetBranchAddress("MFT", &fHits);
710  }
711 
712  AliDebug(1, Form("AliMFT::SetTreeAddress SDigits fLoader->TreeS() = %p\n", fLoader->TreeS()));
713  if (fLoader->TreeS() && fLoader->TreeS()->GetBranch("Plane_00")) {
714  CreateSDigits();
715  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) {
716  fLoader->TreeS()->SetBranchAddress(Form("Plane_%02d",iPlane), &((*fSDigitsPerPlane)[iPlane]));
717  }
718  }
719 
720  AliDebug(1, Form("AliMFT::SetTreeAddress Digits fLoader->TreeD() = %p\n", fLoader->TreeD()));
721  if (fLoader->TreeD() && fLoader->TreeD()->GetBranch("Plane_00")) {
722  CreateDigits();
723  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) {
724  fLoader->TreeD()->SetBranchAddress(Form("Plane_%02d",iPlane), &((*fDigitsPerPlane)[iPlane]));
725  }
726  }
727 
728  AliDebug(1, Form("AliMFT::SetTreeAddress RecPoints fLoader->TreeR() = %p\n", fLoader->TreeR()));
729  if (fLoader->TreeR() && fLoader->TreeR()->GetBranch("Plane_00")) {
730  CreateRecPoints();
731  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) {
732  fLoader->TreeR()->SetBranchAddress(Form("Plane_%02d",iPlane), &((*fRecPointsPerPlane)[iPlane]));
733  }
734  }
735 
736  AliDebug(1,"Stop.");
737 
738 }
739 
740 //====================================================================================================================================================
741 
743 
744  // AliInfo("AliMFT::SetGeometry\n");
745  //
746  // fSegmentation = new AliMFTSegmentation(fNameGeomFile.Data());
747  //
748  // fNPlanes = fSegmentation->GetNPlanes();
749 
751 
752 }
753 
754 //====================================================================================================================================================
755 
757 
758  // create array of hits
759 
760  AliDebug(1, "AliMFT::CreateHits()");
761 
762  if (fHits) return;
763  fHits = new TClonesArray("AliMFTHit");
764 
765 }
766 
767 //====================================================================================================================================================
768 
770 
771  // create sdigits list
772 
773  AliDebug(1, "AliMFT::CreateSDigits()");
774 
775  if (fSDigitsPerPlane) return;
777  for (Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) fSDigitsPerPlane->AddAt(new TClonesArray("AliMFTDigit"), iPlane);
778 
779  fSideDigits = new TClonesArray("AliMFTDigit");
780 
781 }
782 
783 //====================================================================================================================================================
784 
786 
787  // create digits list
788 
789  AliDebug(1, "AliMFT::CreateDigits()");
790 
791  if (fDigitsPerPlane) return;
793  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) fDigitsPerPlane->AddAt(new TClonesArray("AliMFTDigit"), iPlane);
794 
795 }
796 
797 //====================================================================================================================================================
798 
800 
801  // create recPoints list
802 
803  AliDebug(1, "AliMFT::CreateRecPoints()");
804 
805  if (fRecPointsPerPlane) return;
807  for(Int_t iPlane=0; iPlane<AliMFTConstants::kNDisks; iPlane++) fRecPointsPerPlane->AddAt(new TClonesArray("AliMFTCluster"), iPlane);
808 
809 }
810 
811 //====================================================================================================================================================
Double_t fDensitySupportOverSi
Definition: AliMFT.h:140
Bool_t Hit2PixelID(Double_t xHit, Double_t yHit, Double_t zHit, Int_t detElemID, Int_t &xPixel, Int_t &yPixel) const
Returns the pixel ID corresponding to a hit at (x,y,z) in the ALICE global frame. ...
Double_t fSingleStepForChargeDispersion
Definition: AliMFT.h:137
static const Double_t kYPixelPitch
Pixel pitch along Y.
void CreateMaterials()
Definition: AliMFT.cxx:166
Int_t GetDetElemID() const
Definition: AliMFTDigit.h:53
TObjArray * GetSDigitsList() const
Definition: AliMFT.h:70
#define TObjArray
Definition: AliMFT.h:42
void SetDetElemID(Int_t detElemID)
Definition: AliMFTDigit.h:31
void SetTreeAddress()
Definition: AliMFT.cxx:700
void SetEloss(Double_t sig)
Definition: AliMFTDigit.h:43
virtual Int_t GetPlane() const
Definition: AliMFTHit.h:44
void AddAlignableVolumes()
Definition: AliMFT.cxx:411
void StepManager()
Definition: AliMFT.cxx:428
void ResetSDigits()
Definition: AliMFT.h:79
virtual void SetDetElemID(Int_t detElemID)
Definition: AliMFTHit.h:36
void Hits2SDigitsLocal(TClonesArray *hits, const TObjArray *pSDig, Int_t track)
Definition: AliMFT.cxx:557
AliTPCfastTrack * track
UInt_t GetObjectID(ObjectTypes type, Int_t half=0, Int_t disk=0, Int_t ladder=0, Int_t chip=0) const
Returns the object Unique ID.
Double_t fChargeDispersion
Definition: AliMFT.h:136
static const Double_t kSensorThickness
CMOS Sensor Thickness.
TString fNameGeomFile
Definition: AliMFT.h:134
ClassImp(AliMFT) AliMFT
Definition: AliMFT.cxx:51
AliMFTSegmentation * GetSegmentation() const
Returns pointer to the segmentation.
static const Double_t kXPixelPitch
Pixel pitch along X.
Short_t fPileUpEventsIDs[AliMFTConstants::fNMaxPileUpEvents]
Definition: AliMFT.h:143
void CreateDigits()
Definition: AliMFT.cxx:785
void GetPixelCenter(Int_t xPixel, Int_t yPixel, Int_t detElemID, Double_t &xCenter, Double_t &yCenter, Double_t &zCenter) const
Returns the center of the pixel position in the ALICE global frame.
void Build()
Builf both the Virtual segmentation and the real volumes Real part is delegates to AliMFTGeometryBuil...
Double_t GetPixelCenterX() const
Definition: AliMFTDigit.h:57
virtual void Init()
Definition: AliMFT.cxx:158
virtual void SetPlane(Int_t plane)
Definition: AliMFTHit.h:35
Double_t GetPixelCenterY() const
Definition: AliMFTDigit.h:58
void SetPixWidth(Double_t pixelWidthX, Double_t pixelWidthY, Double_t pixelWidthZ)
Definition: AliMFTDigit.h:38
Int_t fNStepForChargeDispersion
Definition: AliMFT.h:138
void SetPlane(Int_t plane)
Definition: AliMFTDigit.h:30
virtual void SetTOF(Double_t time)
Definition: AliMFTHit.h:38
virtual void SetEloss(Double_t energy)
Definition: AliMFTHit.h:40
static AliMFTGeometry * Instance()
Retuns MFT Geometry singleton object.
void CreateHits()
Definition: AliMFT.cxx:756
virtual void SetPosition(TLorentzVector &x)
Definition: AliMFTHit.h:37
void CreateSDigits()
Definition: AliMFT.cxx:769
void AddMCLabel(Int_t label)
Definition: AliMFTDigit.cxx:61
TClonesArray * fSideDigits
Definition: AliMFT.h:130
TObjArray * fDigitsPerPlane
Definition: AliMFT.h:128
Int_t fNPlanes
Definition: AliMFT.h:125
void SetPixCenter(Double_t pixelCenterX, Double_t pixelCenterY, Double_t pixelCenterZ)
Definition: AliMFTDigit.h:33
AliRun * gAlice
Double_t GetPixelCenterZ() const
Definition: AliMFTDigit.h:59
virtual void SetStatus(Int_t status)
Definition: AliMFTHit.h:39
void CreateRecPoints()
Definition: AliMFT.cxx:799
virtual Double_t GetEloss() const
Definition: AliMFTHit.h:46
Class for the virtual segmentation of the ALICE Muon Forward Tracker.
static const Int_t fNMaxPileUpEvents
TObjArray * fSDigitsPerPlane
Definition: AliMFT.h:127
AliMFTGeomTGeo * fGeomTGeo
Definition: AliMFT.h:145
void Hits2SDigits()
Definition: AliMFT.cxx:512
void SetGeometry()
Definition: AliMFT.cxx:742
Int_t GetPlane() const
Definition: AliMFTDigit.h:52
static const Int_t kNDisks
Number of Disk.
virtual ~AliMFT()
Definition: AliMFT.cxx:146
void SetPixID(Int_t pixelX, Int_t pixelY, Int_t pixelZ)
Definition: AliMFTDigit.h:32
void MakeBranch(Option_t *option="")
Definition: AliMFT.cxx:662
virtual void SetMomentum(TLorentzVector &p)
Definition: AliMFTHit.h:41
virtual Int_t GetDetElemID() const
Definition: AliMFTHit.h:45
Class Handling both Virutal Segmentation and Real Volumes.
Int_t GetSensorVolumeID() const
Returns TGeo ID of the volume describing the sensors.
void CreateGeometry()
Definition: AliMFT.cxx:393
return kTRUE
Definition: AliFMDv1.cxx:97
TObjArray * fRecPointsPerPlane
Definition: AliMFT.h:129