]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSvSPD02.cxx
Update of the QA code of the SDD: 1) SDD Checker: added protection in case only a...
[u/mrichter/AliRoot.git] / ITS / AliITSvSPD02.cxx
CommitLineData
6078cf56 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
88cb7938 16/* $Id$ */
48232831 17
6078cf56 18#include <TClonesArray.h>
f7a1cc68 19#include <TGeoGlobalMagField.h>
20#include <TGeoManager.h>
3be5c40b 21#include <TGeoMatrix.h>
f7a1cc68 22#include <TLorentzVector.h>
3be5c40b 23#include <TVirtualMC.h>
6078cf56 24
25#include "AliRun.h"
26#include "AliMagF.h"
6078cf56 27#include "AliTrackReference.h"
3be5c40b 28
6078cf56 29#include "AliITShit.h"
30#include "AliITS.h"
31#include "AliITSvSPD02.h"
32#include "AliITSgeom.h"
33#include "AliITSgeomSPD.h"
7d62fb64 34#include "AliITSDetTypeSim.h"
fcf95fc7 35#include "AliITSCalibrationSPD.h"
6078cf56 36#include "AliITSsegmentationSPD.h"
5bfe44ce 37#include "AliITSsimulationSPD.h"
5d12ce38 38#include "AliMC.h"
6078cf56 39
7d62fb64 40
78b50563 41///////////////////////////////////////////////////////////////////////
42// Step manager and
43// geometry class
44// for the ITS
45// SPD test beam
46// geometry of summer 2002
47//
48///////////////////////////////////////////////////////////////////////
6078cf56 49ClassImp(AliITSvSPD02)
50
51//______________________________________________________________________
aacedc3e 52AliITSvSPD02::AliITSvSPD02():
53AliITS(),
012f0f4c 54fMajorVersion((Int_t)kvSPD02),
aacedc3e 55fMinorVersion(2),
56fGeomNumber(2002),
aacedc3e 57fDet1(300.0),
58fDet2(300.0),
59fChip1(300.0),
012f0f4c 60fChip2(300.0),
61fIDMother(0),
62fIgm(kvSPD02){
6078cf56 63 ////////////////////////////////////////////////////////////////////////
64 // Standard default constructor for the ITS SPD test beam 2002 version 1.
65 // Inputs:
66 // none.
67 // Outputs:
68 // none.
69 // Return:
70 // A default created class.
71 ////////////////////////////////////////////////////////////////////////
6078cf56 72}
73//______________________________________________________________________
aacedc3e 74AliITSvSPD02::AliITSvSPD02(const char *title,Int_t gn) : AliITS("ITS", title),
aacedc3e 75fMajorVersion(1),
76fMinorVersion(2),
77fGeomNumber(2002),
aacedc3e 78fDet1(300.0),
79fDet2(300.0),
80fChip1(300.0),
012f0f4c 81fChip2(300.0),
82fIDMother(0),
83fIgm(kvSPD02){
6078cf56 84 ////////////////////////////////////////////////////////////////////////
85 // Standard constructor for the ITS SPD testbeam 2002 version 1.
86 // Inputs:
87 // const char *title title for this ITS geometry.
a421d869 88 // Int_t gn Geometry version number (year) default 2002.
6078cf56 89 // Outputs:
90 // none.
91 // Return:
92 // A standard created class.
93 ////////////////////////////////////////////////////////////////////////
94 Int_t i;
95
a421d869 96 fGeomNumber = gn;
6078cf56 97 fIdN = 2;
98 fIdName = new TString[fIdN];
99 fIdName[0] = "IMBS";
100 fIdName[1] = "ITST";
101 fIdSens = new Int_t[fIdN];
102 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
6078cf56 103 SetThicknessDet1();
104 SetThicknessDet2();
105 SetThicknessChip1();
106 SetThicknessChip2();
107
6078cf56 108}
109//______________________________________________________________________
6078cf56 110AliITSvSPD02::~AliITSvSPD02() {
111 ////////////////////////////////////////////////////////////////////////
112 // Standard destructor for the ITS SPD test beam 2002 version 1.
113 // Inputs:
114 // none.
115 // Outputs:
116 // none.
117 // Return:
118 // none.
119 ////////////////////////////////////////////////////////////////////////
120}
121//______________________________________________________________________
6078cf56 122void AliITSvSPD02::CreateGeometry(){
123 ////////////////////////////////////////////////////////////////////////
124 // This routine defines and Creates the geometry for version 1 of the ITS.
125 // ALIC ALICE Mother Volume
126 // |- ITSV ITS Mother Volume
127 // |- IDET Detector under Test
128 // | |- ITS0 SPD Si Chip
129 // | | |- ITST SPD Sensitivve Volume
130 // | |- IPC0 *5 Readout chip
131 // |- ITEL *4 SPD Telescope
132 // |- IMB0 SPD Si Chip
133 // | |- IMBS SPD Sensitive volume
134 // |- ICMB Chip MiniBus.
135 // Inputs:
136 // none.
137 // Outputs:
138 // none.
139 // Return:
140 // none.
141 ////////////////////////////////////////////////////////////////////////
a421d869 142
143 switch (fGeomNumber){
144 case 2002:
145 CreateGeometry2002();
146 break;
147 default:
148 CreateGeometry2002();
149 break;
150 } // end switch
151}
152//______________________________________________________________________
153void AliITSvSPD02::CreateGeometry2002(){
154 ////////////////////////////////////////////////////////////////////////
155 // This routine defines and Creates the geometry for version 1 of the ITS.
156 // ALIC ALICE Mother Volume
157 // |- ITSV ITS Mother Volume
158 // |- IDET Detector under Test
159 // | |- ITS0 SPD Si Chip
160 // | | |- ITST SPD Sensitivve Volume
161 // | |- IPC0 *5 Readout chip
162 // |- ITEL *4 SPD Telescope
163 // |- IMB0 SPD Si Chip
164 // | |- IMBS SPD Sensitive volume
165 // |- ICMB Chip MiniBus.
012f0f4c 166 //
167 // ITEL ITEL IDET ITEL ITEL
168 // Z-> -38 -36 02 36.5 38.5
169 // | | | | |
170 // cpn1 1 2 1 3 4
a421d869 171 // Inputs:
172 // none.
173 // Outputs:
174 // none.
175 // Return:
176 // none.
177 ////////////////////////////////////////////////////////////////////////
6078cf56 178 Float_t data[49];
179 // Define media off-set
180 Int_t *idtmed = fIdtmed->GetArray()+1; // array of media indexes
181 Int_t idrotm[4]; // Array of rotation matrix indexes
182 Float_t ddettest=200.0E-4,ddettelescope=300.0E-4;
183 Float_t dchipMiniBus=750.0E-4,dchiptest=300.0E-4;
184 Float_t yposition= 0.0;
012f0f4c 185 // These constant character strings are set by cvs during commit
186 // do not change them unless you know what you are doing!
187 const Char_t *cvsDate="$Date$";
188 const Char_t *cvsRevision="$Revision$";
6078cf56 189
462482c0 190 if(gMC==0) return;
6078cf56 191 // Define Rotation-reflextion Matrixes needed
192 // 0 is the unit matrix
193 AliMatrix(idrotm[0], 90.0,0.0, 0.0,0.0, 90.0,270.0);
012f0f4c 194 /*
6078cf56 195 data[0] = 10.0;
196 data[1] = 50.0;
197 data[2] = 100.0;
198 gMC->Gsvolu("ITSV","BOX",idtmed[0],data,3);
199 gMC->Gspos("ITSV",1,"ALIC",0.0,0.0,0.0,0,"ONLY");
012f0f4c 200 */
201 TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
202 const Int_t length=100;
203 Char_t vstrng[length];
204 if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
205 fMinorVersion,cvsDate,cvsRevision))
206 itsV->SetTitle(vstrng);
207 else Error("CreateGeometry","Error writing/setting version string");
208 TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
209 if(alic==0) {
210 Error("CreateGeometry","alic=0");
211 return;
212 } // end if
213 // See idrotm[199] for angle definitions.
214 alic->AddNode(itsV,1,0);
6078cf56 215
216 //cout << "idtmed[0]=" << idtmed[0]<<endl;
217 //cout << "idtmed[1]=" << idtmed[1]<<endl;
218 Float_t detMiniBusX,detMiniBusY,detMiniBusZ;
219 // SPD part of telescope (MiniBuS)
220 data[0] = detMiniBusX = 0.705;
221 data[1] = detMiniBusY = 0.5*ddettelescope;
222 data[2] = detMiniBusZ = 3.536;
223 gMC->Gsvolu("IMB0", "BOX ", idtmed[1], data, 3); // contains detector
224 data[0] = 0.64;
225 data[1] = 0.5*ddettelescope;
226 data[2] = 3.48;
227 gMC->Gsvolu("IMBS","BOX ",idtmed[1],data,3); // sensitive detecor volulme
228 gMC->Gspos("IMBS",1,"IMB0",0.0,0.0,0.0,0,"ONLY"); // place IMBS inside
229 // IMB0 with no translation and unit rotation matrix.
230 Float_t chipMiniBusX,chipMiniBusY,chipMiniBusZ;
231 data[0] = chipMiniBusX = 0.793;
232 data[1] = chipMiniBusY = 0.5*dchipMiniBus;
233 data[2] = chipMiniBusZ = 0.68;
234 gMC->Gsvolu("ICMB","BOX ",idtmed[1],data, 3); // chip Minibus
235 data[0] = TMath::Max(detMiniBusX,chipMiniBusX);
236 data[1] = detMiniBusY+chipMiniBusY;
237 data[2] = TMath::Max(detMiniBusZ,chipMiniBusZ);
238 gMC->Gsvolu("ITEL","BOX ",idtmed[0],data,3);
239 gMC->Gspos("IMB0",1,"ITEL",0.0,data[1]-detMiniBusY,0.0,0,"ONLY");
240 gMC->Gspos("ICMB",1,"ITEL",0.0,-data[1]+chipMiniBusY,0.0,0,"ONLY");
241
242 // SPD under test
243 Float_t spdX,spdY,spdZ,spdchipX,spdchipY,spdchipZ;
244 data[0] = spdX = 0.705;
245 data[1] = spdY = 0.5*ddettest;
246 data[2] = spdZ = 3.536;
247 gMC->Gsvolu("ITS0", "BOX ", idtmed[1], data, 3); // contains detector
248 data[0] = 0.64;
249 data[1] = 0.5*ddettest;
250 data[2] = 3.48;
251 gMC->Gsvolu("ITST","BOX ",idtmed[1],data,3);// sensitive detecor volume
252 gMC->Gspos("ITST",1,"ITS0",0.0,0.0,0.0,0,"ONLY"); // place ITST inside
253 // ITS0 with no translation and unit rotation matrix.
254 data[0] = spdchipX = 0.793;
255 data[1] = spdchipY = 0.5*dchiptest;
256 data[2] = spdchipZ = 0.68;
257 gMC->Gsvolu("IPC0", "BOX ", idtmed[1],data,3); // chip under test
258 data[0] = TMath::Max(spdchipX,spdX);
259 data[1] = spdY+spdchipY;
260 data[2] = TMath::Max(spdchipZ,spdZ);
261 gMC->Gsvolu("IDET","BOX ",idtmed[0],data,3);
262 gMC->Gspos("ITS0",1,"IDET",0.0,data[1]-spdY,0.0,0,"ONLY");
263 for(Int_t i=-2;i<3;i++) gMC->Gspos("IPC0",i+3,"IDET",0.0,-data[1]+spdchipY,
264 i*2.*spdchipZ+i*0.25*(spdZ-5.*spdchipZ),0,"ONLY");
265
266 // Positions detectors, Beam Axis Z, X to the right, Y up to the sky.
267 Float_t p00X,p00Y,p00Z,p01X,p01Y,p01Z,p10X,p10Y,p10Z,p11X,p11Y,p11Z;
268 p00X = 0.0;
269 p00Y = 0.0;
270 p00Z = -38.0;
271 gMC->Gspos("ITEL",1,"ITSV",p00X,p00Y,p00Z,idrotm[0],"ONLY");
272 p01X = 0.0;
273 p01Y = 0.0;
274 p01Z = p00Z+2.0;
275 gMC->Gspos("ITEL",2,"ITSV",p01X,p01Y,p01Z,idrotm[0],"ONLY");
276 Float_t pdetX,pdetY,pdetZ;
277 pdetX = 0.0;
278 pdetY = 0.0+yposition;
279 pdetZ = p01Z+38.0;
280 gMC->Gspos("IDET",1,"ITSV",pdetX,pdetY,pdetZ,idrotm[0],"ONLY");
281 p10X = 0.0;
282 p10Y = 0.0;
283 p10Z = pdetZ + 34.5;
284 gMC->Gspos("ITEL",3,"ITSV",p10X,p10Y,p10Z,idrotm[0],"ONLY");
285 p11X = 0.0;
286 p11Y = 0.0;
287 p11Z = p10Z+2.0;
288 gMC->Gspos("ITEL",4,"ITSV",p11X,p11Y,p11Z,idrotm[0],"ONLY");
289}
290//______________________________________________________________________
291void AliITSvSPD02::CreateMaterials(){
292 ////////////////////////////////////////////////////////////////////////
a421d869 293 //
294 // Create ITS SPD test beam materials
295 // This function defines the default materials used in the Geant
296 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
297 // AliITSvSPD02.
298 // In general it is automatically replaced by
023ae34b 299 // the CreateMaterials routine defined in AliITSv?. Should the function
a421d869 300 // CreateMaterials not exist for the geometry version you are using this
301 // one is used. See the definition found in AliITSv5 or the other routine
302 // for a complete definition.
303 //
304 // Inputs:
305 // none.
306 // Outputs:
307 // none.
308 // Return:
309 // none.
310 /////////////////////////////////////////////////////////////////////////
311
312 switch (fGeomNumber){
313 case 2002:
314 CreateMaterials2002();
315 break;
316 default:
317 CreateMaterials2002();
318 break;
319 } // end switch
320}
321//______________________________________________________________________
322void AliITSvSPD02::CreateMaterials2002(){
323 ////////////////////////////////////////////////////////////////////////
6078cf56 324 //
325 // Create ITS SPD test beam materials
326 // This function defines the default materials used in the Geant
327 // Monte Carlo simulations for the geometries AliITSv1, AliITSv3,
328 // AliITSvSPD02.
329 // In general it is automatically replaced by
023ae34b 330 // the CreateMaterials routine defined in AliITSv?. Should the function
6078cf56 331 // CreateMaterials not exist for the geometry version you are using this
332 // one is used. See the definition found in AliITSv5 or the other routine
333 // for a complete definition.
334 //
335 // Inputs:
336 // none.
337 // Outputs:
338 // none.
339 // Return:
340 // none.
341 /////////////////////////////////////////////////////////////////////////
342 Float_t tmaxfdSi = 0.1; // Degree
343 Float_t stemaxSi = 0.0075; // cm
344 Float_t deemaxSi = 0.1; // Fraction of particle's energy 0<deemax<=1
345 Float_t epsilSi = 1.0E-4;//
346 Float_t stminSi = 0.0; // cm "Default value used"
347
348 Float_t tmaxfdAir = 0.1; // Degree
349 Float_t stemaxAir = .10000E+01; // cm
350 Float_t deemaxAir = 0.1; // Fraction of particle's energy 0<deemax<=1
351 Float_t epsilAir = 1.0E-4;//
352 Float_t stminAir = 0.0; // cm "Default value used"
f7a1cc68 353 Int_t ifield = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Integ();
354 Float_t fieldm = ((AliMagF*)TGeoGlobalMagField::Instance()->GetField())->Max();
6078cf56 355
356 AliMaterial(1,"AIR$",0.14610E+02,0.73000E+01,0.12050E-02,
aacedc3e 357 0.30423E+05,0.99900E+03);
6078cf56 358 AliMedium(1,"AIR$",1,0,ifield,fieldm,tmaxfdAir,stemaxAir,deemaxAir,
aacedc3e 359 epsilAir,stminAir);
6078cf56 360
361 AliMaterial(2,"SI$",0.28086E+02,0.14000E+02,0.23300E+01,
aacedc3e 362 0.93600E+01,0.99900E+03);
6078cf56 363 AliMedium(2,"SI$",2,0,ifield,fieldm,tmaxfdSi,stemaxSi,deemaxSi,
aacedc3e 364 epsilSi,stminSi);
6078cf56 365}
366//______________________________________________________________________
6078cf56 367void AliITSvSPD02::Init(){
6078cf56 368 // Initialise the ITS after it has been created.
369 // Inputs:
012f0f4c 370 // none.
6078cf56 371 // Outputs:
012f0f4c 372 // none.
6078cf56 373 // Return:
012f0f4c 374 // none.
6078cf56 375
012f0f4c 376 AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
377 fMinorVersion));
378 //
379 UpdateInternalGeometry();
6078cf56 380 AliITS::Init();
012f0f4c 381
382 //
383 fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
aacedc3e 384
6078cf56 385}
012f0f4c 386/*
6078cf56 387//______________________________________________________________________
388void AliITSvSPD02::SetDefaults(){
389 // sets the default segmentation, response, digit and raw cluster classes
390 // Inputs:
391 // none.
392 // Outputs:
393 // none.
394 // Return:
395 // none.
396 const Float_t kconv = 1.0e+04; // convert cm to microns
397
398 Info("SetDefaults","Setting up only SPD detector");
399
7d62fb64 400 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
401 fDetTypeSim->SetITSgeom(GetITSgeom());
6078cf56 402 AliITSgeomSPD *s0;
403 Int_t i;
404 Float_t bx[256],bz[280];
fcf95fc7 405 fDetTypeSim->ResetCalibrationArray();
7d62fb64 406 fDetTypeSim->ResetSegmentation();
407
6078cf56 408 //SPD
88cb7938 409 // Get shape info. Do it this way for now.
7d62fb64 410 s0 = (AliITSgeomSPD*) GetITSgeom()->GetShape(kSPD);
fcf95fc7 411 AliITSCalibration *resp0=new AliITSCalibrationSPD();
3a7c3e6d 412 resp0->SetTemperature();
413 resp0->SetDistanceOverVoltage();
fcf95fc7 414 SetCalibrationModel(0,resp0);
3a7c3e6d 415
023ae34b 416 AliITSsegmentationSPD *seg0=new AliITSsegmentationSPD();
6078cf56 417 seg0->SetDetSize(s0->GetDx()*2.*kconv, // base this on AliITSgeomSPD
418 s0->GetDz()*2.*kconv, // for now.
419 s0->GetDy()*2.*kconv); // x,z,y full width in microns.
420 seg0->SetNPads(256,160);// Number of Bins in x and z
421 for(i=000;i<256;i++) bx[i] = 50.0; // in x all are 50 microns.
422 for(i=000;i<160;i++) bz[i] = 425.0; // most are 425 microns except below
423 for(i=160;i<280;i++) bz[i] = 0.0; // Outside of detector.
424 bz[ 31] = bz[ 32] = 625.0; // first chip boundry
425 bz[ 63] = bz[ 64] = 625.0; // first chip boundry
426 bz[ 95] = bz[ 96] = 625.0; // first chip boundry
427 bz[127] = bz[128] = 625.0; // first chip boundry
428 bz[160] = 425.0; // Set so that there is no zero pixel size for fNz.
429 seg0->SetBinSize(bx,bz); // Based on AliITSgeomSPD for now.
430 SetSegmentationModel(kSPD,seg0);
431 // set digit and raw cluster classes to be used
fcf95fc7 432 const char *kData0=(fDetTypeSim->GetCalibrationModel(0))->DataType();
7d62fb64 433 if (strstr(kData0,"real")) fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigit");
434 else fDetTypeSim->SetDigitClassName(kSPD,"AliITSdigitSPD");
aacedc3e 435// SetSimulationModel(kSPD,new AliITSsimulationSPDdubna(seg0,resp0));
6078cf56 436// iDetType->ReconstructionModel(new AliITSClusterFinderSPD());
7d62fb64 437
48232831 438
012f0f4c 439// SetResponseModel(kSDD,new AliITSCalibrationSDD());
440// SetSegmentationModel(kSDD,new AliITSsegmentationSDD());
441// DetType(kSDD)->ClassNames("AliITSdigitSDD","AliITSRawClusterSDD");
442
443// SetResponseModel(kSSD,new AliITSCalibrationSSD());
444// SetSegmentationModel(kSSD,new AliITSsegmentationSSD());
445// DetType(kSSD)->ClassNames("AliITSdigitSSD","AliITSRawClusterSSD");
446
7d62fb64 447 if(fgkNTYPES>3){
6078cf56 448 Warning("SetDefaults",
449 "Only the four basic detector types are initialised!");
450 }// end if
451 return;
452}
453//______________________________________________________________________
12e7c97c 454void AliITSvSPD02::SetDefaultSimulation(){
455 // sets the default simulation.
456 // Inputs:
457 // none.
458 // Outputs:
459 // none.
460 // Return:
461 // none.
462
7d62fb64 463 if(GetITSgeom()==0){
464 Warning("SetDefaultSimulation","ITS geometry is null!");
465 return;
466 }
467
468 if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
469 AliITSsimulation *sim;
8ba39da9 470 //AliITSsegmentation *seg;
fcf95fc7 471 //AliITSCalibration *res;
3a7c3e6d 472 if(fDetTypeSim){
473 sim = fDetTypeSim->GetSimulationModel(kSPD);
474 if (!sim) {
8ba39da9 475 //seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD);
fcf95fc7 476 //res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSPD());
5bfe44ce 477 sim = new AliITSsimulationSPD(fDetTypeSim);
3a7c3e6d 478 SetSimulationModel(kSPD,sim);
479 }else{ // simulation exists, make sure it is set up properly.
fcf95fc7 480 sim->SetCalibrationModel(GetITSgeom()->GetStartSPD(),(AliITSCalibration*)fDetTypeSim->GetCalibrationModel(GetITSgeom()->GetStartSPD()));
8ba39da9 481 sim->SetSegmentationModel(kSPD,(AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSPD));
3a7c3e6d 482 sim->Init();
483 } // end if
484 } // end if iDetType
012f0f4c 485
486// if(fDetTypeSim){
487// sim = fDetTypeSim->GetSimulationModel(kSDD);
488// if (!sim) {
489// seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD);
490// res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD());
491// sim = new AliITSsimulationSDD(seg,res);
492// SetSimulationModel(kSDD,sim);
493// }else{ // simulation exists, make sure it is set up properly.
494// sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSDD()));
495// sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSDD));
496// sim->Init();
497// } //end if
498// } // end if iDetType
499// if(fDetTypeSim){
500// sim = fDetTypeSim->GetSimulationModel(kSSD);
501// if (!sim) {
502// seg = (AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD);
503// res = (AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD());
504// sim = new AliITSsimulationSSD(seg,res);
505// SetSimulationModel(kSSD,sim);
506// }else{ // simulation exists, make sure it is set up properly.
507// sim->SetResponseModel((AliITSCalibration*)fDetTypeSim->GetResponseModel(GetITSgeom()->GetStartSSD()));
508// sim->SetSegmentationModel((AliITSsegmentation*)fDetTypeSim->GetSegmentationModel(kSSD));
509// sim->Init();
510// } // end if
511// } //
12e7c97c 512}
012f0f4c 513*/
12e7c97c 514//______________________________________________________________________
78b50563 515void AliITSvSPD02::DrawModule() const {
6078cf56 516 ////////////////////////////////////////////////////////////////////////
517 // Draw a shaded view of the ITS SPD test beam version 1.
518 // Inputs:
519 // none.
520 // Outputs:
521 // none.
522 // Return:
523 // none.
524 ////////////////////////////////////////////////////////////////////////
525 // Set everything unseen
526 gMC->Gsatt("*", "seen", -1);
527 // Set ALIC mother visible
528 gMC->Gsatt("ALIC","SEEN",0);
529 // Set ALIC ITS visible
530 gMC->Gsatt("ITSV","SEEN",0);
531 // Set ALIC Telescopes visible
532 gMC->Gsatt("ITEL","SEEN",0);
533 // Set ALIC detetcor visible
534 gMC->Gsatt("IDET","SEEN",0);
535 // Set Detector chip mother visible and drawn
536 gMC->Gsatt("IPC0","SEEN",1);
537 // Set Detector mother visible and drawn
538 gMC->Gsatt("ITS0","SEEN",1);
539 // Set minibus chip mother visible and drawn
540 gMC->Gsatt("ICMB","SEEN",1);
541 // Set minibus mother visible and drawn
542 gMC->Gsatt("IMB0","SEEN",1);
543}
544//______________________________________________________________________
545void AliITSvSPD02::StepManager(){
546 ////////////////////////////////////////////////////////////////////////
547 // Called for every step in the ITS SPD test beam, then calles the
548 // AliITShit class creator with the information to be recoreded about
549 // that hit.
550 // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
551 // printing of information to a file which can be used to create a .det
552 // file read in by the routine CreateGeometry(). If set to 0 or any other
553 // value except 1, the default behavior, then no such file is created nor
554 // it the extra variables and the like used in the printing allocated.
555 // Inputs:
556 // none.
557 // Outputs:
558 // none.
559 // Return:
560 // none.
561 ////////////////////////////////////////////////////////////////////////
012f0f4c 562
6078cf56 563 if(!(this->IsActive())){
aacedc3e 564 return;
6078cf56 565 } // end if !Active volume.
012f0f4c 566 if(!(gMC->TrackCharge())) return;
567
568 Int_t cpy0=0,cpy1=0,id,mod,ncpys,status;
569 TLorentzVector position, momentum;
570 static AliITShit hit;// Saves on calls to construtors
571 //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
572 TClonesArray &lhits = *(Hits());
6078cf56 573 //
574 // Track status
012f0f4c 575 // Track status
576 status = 0;
577 if(gMC->IsTrackInside()) status += 1;
578 if(gMC->IsTrackEntering()) status += 2;
579 if(gMC->IsTrackExiting()) status += 4;
580 if(gMC->IsTrackOut()) status += 8;
581 if(gMC->IsTrackDisappeared()) status += 16;
582 if(gMC->IsTrackStop()) status += 32;
583 if(gMC->IsTrackAlive()) status += 64;
6078cf56 584 //
585 // Fill hit structure.
012f0f4c 586 id = gMC->CurrentVolID(cpy0);
587 if(id==fIdSens[0]){ // Volume name "IMBS". Det=1, ladder=1
588 ncpys = 4;
48232831 589 } else if(id == fIdSens[1]){ // Volume name "ITST"
012f0f4c 590 ncpys = 1;
6078cf56 591 } else return; // end if
012f0f4c 592 id = gMC->CurrentVolOffID(2,cpy1);
593 fIgm.DecodeDetector(mod,ncpys,cpy0,cpy1,0);
594 //
595 // Fill hit structure.
6078cf56 596 //
012f0f4c 597 hit.SetModule(mod);
598 hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
6078cf56 599 gMC->TrackPosition(position);
600 gMC->TrackMomentum(momentum);
012f0f4c 601 hit.SetPosition(position);
602 hit.SetTime(gMC->TrackTime());
603 hit.SetMomentum(momentum);
604 hit.SetStatus(status);
605 hit.SetEdep(gMC->Edep());
606 hit.SetShunt(GetIshunt());
6078cf56 607 if(gMC->IsTrackEntering()){
012f0f4c 608 hit.SetStartPosition(position);
609 hit.SetStartTime(gMC->TrackTime());
610 hit.SetStartStatus(status);
611 return; // don't save entering hit.
6078cf56 612 } // end if IsEntering
012f0f4c 613 // Fill hit structure with this new hit.
614 //Info("StepManager","Calling Copy Constructor");
615 new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
616 // Save old position... for next hit.
617 hit.SetStartPosition(position);
618 hit.SetStartTime(gMC->TrackTime());
619 hit.SetStartStatus(status);
6078cf56 620 return;
621}
622