]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSv11.cxx
Clean-up of geometry classes
[u/mrichter/AliRoot.git] / ITS / AliITSv11.cxx
CommitLineData
2b680d9b 1/**************************************************************************
effd7456 2 * Copyright(c) 2007-2008, ALICE Experiment at CERN, All rights reserved. *
2b680d9b 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
effd7456 16
b7943f00 17//************************************************************************
effd7456 18//
b7943f00 19// Inner Traking System geometry v11
20//
21// Based on ROOT geometrical modeler
b7943f00 22//
23// B. Nilsen, L. Gaudichet
24//************************************************************************
25
541f7ba6 26#include <TClonesArray.h>
7dd2cbe4 27#include <TGeoManager.h>
28#include <TGeoPcon.h>
29#include <TGeoVolume.h>
2b680d9b 30#include <TLorentzVector.h>
7dd2cbe4 31#include <TVirtualMC.h>
b7943f00 32
33#include "AliITS.h"
7dd2cbe4 34#include "AliITSCalibrationSDD.h"
531d6cdc 35#include "AliITSDetTypeSim.h"
b7943f00 36#include "AliITShit.h"
2b680d9b 37#include "AliITSsegmentationSDD.h"
b7943f00 38#include "AliITSsegmentationSPD.h"
39#include "AliITSsegmentationSSD.h"
108bd0fe 40#include "AliITSv11.h"
db486a6e 41#include "AliITSv11GeometrySDD.h"
7dd2cbe4 42#include "AliITSv11GeometrySPD.h"
54c9a3d9 43#include "AliITSv11GeometrySSD.h"
44#include "AliITSv11GeometrySupport.h"
7dd2cbe4 45#include "AliMC.h"
46#include "AliMagF.h"
47#include "AliRun.h"
48#include "AliTrackReference.h"
541f7ba6 49
b7943f00 50ClassImp(AliITSv11)
51
33ddec7d 52//______________________________________________________________________
012f0f4c 53AliITSv11::AliITSv11() :
012f0f4c 54fByThick(kTRUE),
55fMajorVersion(IsVersion()),
56fMinorVersion(0),
54c9a3d9 57fSPDgeom(),
012f0f4c 58fSDDgeom(0),
54c9a3d9 59fSSDgeom(),
60fSupgeom(),
012f0f4c 61fIgm(kv11)
33ddec7d 62{
b7943f00 63 // Standard default constructor for the ITS version 11.
f7315efc 64
531d6cdc 65 fIdN = 0;
66 fIdName = 0;
67 fIdSens = 0;
2b680d9b 68}
b7943f00 69
fa4639a3 70
71//______________________________________________________________________
012f0f4c 72AliITSv11::AliITSv11(const char *name, const char *title):
73AliITS("ITS", title),
012f0f4c 74fByThick(kTRUE),
75fMajorVersion(IsVersion()),
76fMinorVersion(0),
54c9a3d9 77fSPDgeom(),
012f0f4c 78fSDDgeom(0),
54c9a3d9 79fSSDgeom(),
80fSupgeom(),
012f0f4c 81fIgm(kv11)
33ddec7d 82{
fa4639a3 83 // Standard constructor for the ITS version 11.
84
531d6cdc 85 fSDDgeom = new AliITSv11GeometrySDD(0);
fa4639a3 86
87 Int_t i;
531d6cdc 88 fIdN = 6;
89 fIdName = new TString[fIdN];
90 fIdName[0] = name; // removes warning message
91 fIdName[0] = "ITS1";
92 fIdName[1] = "ITS2";
108bd0fe 93 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
94 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
531d6cdc 95 fIdName[4] = "ITS5";
96 fIdName[5] = "ITS6";
fa4639a3 97 fIdSens = new Int_t[fIdN];
531d6cdc 98 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
33ddec7d 99 // not needed, fByThick set to kTRUE in in the member initialization lis
531d6cdc 100
fa4639a3 101}
2b680d9b 102//______________________________________________________________________
112d72a8 103AliITSv11::AliITSv11(Int_t /* debugITS */,Int_t debugSPD,Int_t debugSDD,
b7943f00 104 Int_t debugSSD,Int_t debugSUP) :
012f0f4c 105AliITS("ITS","ITS geometry v11"),
012f0f4c 106fByThick(kTRUE),
107fMajorVersion(IsVersion()),
108fMinorVersion(0),
54c9a3d9 109fSPDgeom(),
012f0f4c 110fSDDgeom(0),
54c9a3d9 111fSSDgeom(),
112fSupgeom(),
012f0f4c 113fIgm(kv11)
114{
b7943f00 115 // Standard default constructor for the ITS version 11.
b7943f00 116
b7943f00 117
112d72a8 118 fSPDgeom = new AliITSv11GeometrySPD(debugSPD);
531d6cdc 119 fSDDgeom = new AliITSv11GeometrySDD(debugSDD);
120 fSDDgeom->SetDebug(debugSDD);
325d8c32 121 fSSDgeom = new AliITSv11GeometrySSD();
122 fSSDgeom->SetDebug(debugSSD);
112d72a8 123 fSupgeom = new AliITSv11GeometrySupport(debugSUP);
531d6cdc 124
125 Int_t i;
126 fIdN = 6;
127 fIdName = new TString[fIdN];
54c9a3d9 128 fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
129 fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
108bd0fe 130 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
131 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
54c9a3d9 132 fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
133 fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
531d6cdc 134 fIdSens = new Int_t[fIdN];
135 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
112d72a8 136 // debugITS = (debugSPD && debugSSD && debugSUP && debugSDD); //remove temp. warnings
162acd47 137}
dfefbaec 138//______________________________________________________________________
b7943f00 139AliITSv11::~AliITSv11() {
140 delete fSDDgeom;
2b680d9b 141}
142//______________________________________________________________________
aa9bc63b 143void AliITSv11::CreateGeometry(){
012f0f4c 144 //
145 // Create ROOT geometry
146 //
147 // These constant character strings are set by cvs during commit
148 // do not change them unless you know what you are doing!
149 const Char_t *cvsDate="$Date$";
150 const Char_t *cvsRevision="$Revision$";
151
152 TGeoManager *geoManager = gGeoManager;
153 TGeoVolume *vALIC = geoManager->GetTopVolume();
154
155 TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
156
157 // DefineSection(section number, Z, Rmin, Rmax).
158 const Double_t kcm = 1.0;
159 sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
160 sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
161
162 TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
163 TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
164 vITS->SetVisibility(kFALSE);
165 const Int_t length=100;
166 Char_t vstrng[length];
167 if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
168 fMinorVersion,cvsDate,cvsRevision))
169 vITS->SetTitle(vstrng);
170 //printf("Title set to %s\n",vstrng);
171 vALIC->AddNode(vITS,1,0);
b7943f00 172
173// fSPDgeom->CenteralSPD(vITS);
fa4639a3 174
b7943f00 175 fSDDgeom->Layer3(vITS);
176 fSDDgeom->Layer4(vITS);
fa4639a3 177
b7943f00 178// fSupgeom->SPDCone(vITS);
179// fSupgeom->SPDThermalSheald(vITS);
180// fSupgeom->SDDCone(vITS);
181// fSupgeom->SSDCone(vITS);
182// fSupgeom->ServicesCableSupport(vITS);
183
541f7ba6 184}
185//______________________________________________________________________
186void AliITSv11::CreateMaterials(){
54c9a3d9 187 // Create Standard ITS Materials
188 // Inputs:
189 // none.
190 // Outputs:
191 // none.
192 // Return:
193 // none.
531d6cdc 194
531d6cdc 195
54c9a3d9 196 //
197 fSPDgeom->AliITSv11Geometry::CreateDefaultMaterials();
198 // Detector specific material definistions
199 fSPDgeom->CreateMaterials();
200 fSDDgeom->CreateMaterials();
201 fSSDgeom->CreateMaterials();
202 fSupgeom->CreateMaterials();
dfefbaec 203}
b7943f00 204
dfefbaec 205//______________________________________________________________________
206void AliITSv11::Init(){
b7943f00 207 //
208 // Initialise the ITS after it has been created.
209 //
210
531d6cdc 211 //AliInfo(Form("Minor version %d",fMinorVersion));
212 //
012f0f4c 213 UpdateInternalGeometry();
214 AliITS::Init();
012f0f4c 215
dfefbaec 216}
b7943f00 217
dfefbaec 218//______________________________________________________________________
219void AliITSv11::SetDefaults(){
b7943f00 220 //
108bd0fe 221 // Set response and segmentation models for SPD, SDD and SSD
b7943f00 222 //
223
108bd0fe 224// if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
225// fDetTypeSim->SetITSgeom(GetITSgeom());
226 if(!fDetTypeSim) {
227 Warning("SetDefaults","Error fDetTypeSim not defined");
228 return;
229 }
531d6cdc 230
531d6cdc 231 fDetTypeSim->ResetCalibrationArray();
232 fDetTypeSim->ResetSegmentation();
233 fDetTypeSim->SetDefaults();
234
531d6cdc 235 if(fgkNTYPES>3){
236 Warning("SetDefaults",
237 "Only the four basic detector types are initialised!");
238 }// end if
239
240
241 return;
242}
b7943f00 243
244
108bd0fe 245
246
247
dfefbaec 248//______________________________________________________________________
b7943f00 249void AliITSv11::DrawModule() const{
250
dfefbaec 251}
b7943f00 252
108bd0fe 253// //______________________________________________________________________
254// void AliITSv11::StepManager(){
255// //
256// // Called for every step in the ITS, then calles the AliITShit class
257// // creator with the information to be recoreded about that hit.
258// //
259// Int_t copy, id;
260// TLorentzVector position, momentum;
261// static TLorentzVector position0;
262// static Int_t stat0=0;
263
264// if(!(this->IsActive())){
265// return;
266// } // end if !Active volume.
267
268// if(!(gMC->TrackCharge())) return;
269
270// id=gMC->CurrentVolID(copy);
271
272// Bool_t sensvol = kFALSE;
273// for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
274// if(sensvol && (gMC->IsTrackExiting())){
275// copy = fTrackReferences->GetEntriesFast();
276// TClonesArray &lTR = *fTrackReferences;
277// // Fill TrackReference structure with this new TrackReference.
278// new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
279// } // if Outer ITS mother Volume
280
281
282// Int_t copy1,copy2;
283// Int_t vol[5];
284// TClonesArray &lhits = *fHits;
285// //
286// // Track status
287// vol[3] = 0;
288// vol[4] = 0;
289// if(gMC->IsTrackInside()) vol[3] += 1;
290// if(gMC->IsTrackEntering()) vol[3] += 2;
291// if(gMC->IsTrackExiting()) vol[3] += 4;
292// if(gMC->IsTrackOut()) vol[3] += 8;
293// if(gMC->IsTrackDisappeared()) vol[3] += 16;
294// if(gMC->IsTrackStop()) vol[3] += 32;
295// if(gMC->IsTrackAlive()) vol[3] += 64;
296// //
297// // Fill hit structure.
298// if(!(gMC->TrackCharge())) return;
299// //
300// // Only entering charged tracks
301// if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
302// vol[0] = 1;
303// id = gMC->CurrentVolOffID(2,copy);
304// //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
305// vol[1] = copy;
306// gMC->CurrentVolOffID(3,copy1);
307// //ladder copy in the module = 1<->2 (I10A < I12A)
308// gMC->CurrentVolOffID(4,copy2);
309// //module copy in the layer = 1<->10 (I12A < IT12)
310// vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
311// } else if(id == fIdSens[1]){
312// vol[0] = 2;
313// id = gMC->CurrentVolOffID(2,copy);
314// //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
315// vol[1] = copy;
316// gMC->CurrentVolOffID(3,copy1);
317// //ladder copy in the module = 1<->4 (I20A < I12A)
318// gMC->CurrentVolOffID(4,copy2);
319// //module copy in the layer = 1<->10 (I12A < IT12)
320// vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
321// } else if(id == fIdSens[2]){
322// vol[0] = 3;
323// id = gMC->CurrentVolOffID(1,copy);
324// //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
325// vol[1] = copy;
326// id = gMC->CurrentVolOffID(2,copy);
327// //ladder copy in the layer = 1<->14 (I004 < IT34)
328// vol[2] = copy;
329// } else if(id == fIdSens[3]){
330// vol[0] = 4;
331// id = gMC->CurrentVolOffID(1,copy);
332// //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
333// vol[1] = copy;
334// id = gMC->CurrentVolOffID(2,copy);
335// //ladder copy in the layer = 1<->22 (I005 < IT34))
336// vol[2] = copy;
337// }else if(id == fIdSens[4]){
338// vol[0] = 5;
339// id = gMC->CurrentVolOffID(1,copy);
340// //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
341// vol[1] = copy;
342// id = gMC->CurrentVolOffID(2,copy);
343// //ladder copy in the layer = 1<->34 (I565 < IT56)
344// vol[2] = copy;
345// }else if(id == fIdSens[5]){
346// vol[0] = 6;
347// id = gMC->CurrentVolOffID(1,copy);
348// //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
349// vol[1] = copy;
350// id = gMC->CurrentVolOffID(2,copy);
351// //ladder copy in the layer = 1<->38 (I569 < IT56)
352// vol[2] = copy;
353// } else {
354// return; // not an ITS volume?
355// } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
356// //
357// gMC->TrackPosition(position);
358// gMC->TrackMomentum(momentum);
359// vol[4] = stat0;
360// if(gMC->IsTrackEntering()){
361// position0 = position;
362// stat0 = vol[3];
363// return;
364// } // end if IsEntering
365// // Fill hit structure with this new hit.
366
367// new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
368// gMC->Edep(),gMC->TrackTime(),position,
369// position0,momentum);
370
371// position0 = position;
372// stat0 = vol[3];
373
374// return;
375// }
376
377
dfefbaec 378//______________________________________________________________________
379void AliITSv11::StepManager(){
b7943f00 380 //
381 // Called for every step in the ITS, then calles the AliITShit class
382 // creator with the information to be recoreded about that hit.
383 //
531d6cdc 384 Int_t copy, id;
385 TLorentzVector position, momentum;
386 static TLorentzVector position0;
387 static Int_t stat0=0;
388
389 if(!(this->IsActive())){
390 return;
391 } // end if !Active volume.
392
393 if(!(gMC->TrackCharge())) return;
394
395 id=gMC->CurrentVolID(copy);
396
397 Bool_t sensvol = kFALSE;
398 for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
399 if(sensvol && (gMC->IsTrackExiting())){
e6add757 400 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
531d6cdc 401 } // if Outer ITS mother Volume
402
403
404 Int_t copy1,copy2;
405 Int_t vol[5];
406 TClonesArray &lhits = *fHits;
407 //
408 // Track status
409 vol[3] = 0;
410 vol[4] = 0;
411 if(gMC->IsTrackInside()) vol[3] += 1;
412 if(gMC->IsTrackEntering()) vol[3] += 2;
413 if(gMC->IsTrackExiting()) vol[3] += 4;
414 if(gMC->IsTrackOut()) vol[3] += 8;
415 if(gMC->IsTrackDisappeared()) vol[3] += 16;
416 if(gMC->IsTrackStop()) vol[3] += 32;
417 if(gMC->IsTrackAlive()) vol[3] += 64;
418 //
419 // Fill hit structure.
420 if(!(gMC->TrackCharge())) return;
108bd0fe 421
531d6cdc 422 // Only entering charged tracks
423 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
424 vol[0] = 1;
425 id = gMC->CurrentVolOffID(2,copy);
426 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
427 vol[1] = copy;
428 gMC->CurrentVolOffID(3,copy1);
429 //ladder copy in the module = 1<->2 (I10A < I12A)
430 gMC->CurrentVolOffID(4,copy2);
431 //module copy in the layer = 1<->10 (I12A < IT12)
432 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
108bd0fe 433
531d6cdc 434 } else if(id == fIdSens[1]){
435 vol[0] = 2;
436 id = gMC->CurrentVolOffID(2,copy);
437 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
438 vol[1] = copy;
439 gMC->CurrentVolOffID(3,copy1);
440 //ladder copy in the module = 1<->4 (I20A < I12A)
441 gMC->CurrentVolOffID(4,copy2);
442 //module copy in the layer = 1<->10 (I12A < IT12)
443 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
108bd0fe 444
531d6cdc 445 } else if(id == fIdSens[2]){
446 vol[0] = 3;
447 id = gMC->CurrentVolOffID(1,copy);
448 //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
449 vol[1] = copy;
450 id = gMC->CurrentVolOffID(2,copy);
451 //ladder copy in the layer = 1<->14 (I004 < IT34)
452 vol[2] = copy;
108bd0fe 453
531d6cdc 454 } else if(id == fIdSens[3]){
455 vol[0] = 4;
456 id = gMC->CurrentVolOffID(1,copy);
457 //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
458 vol[1] = copy;
459 id = gMC->CurrentVolOffID(2,copy);
460 //ladder copy in the layer = 1<->22 (I005 < IT34))
461 vol[2] = copy;
108bd0fe 462
531d6cdc 463 }else if(id == fIdSens[4]){
464 vol[0] = 5;
465 id = gMC->CurrentVolOffID(1,copy);
466 //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
467 vol[1] = copy;
468 id = gMC->CurrentVolOffID(2,copy);
469 //ladder copy in the layer = 1<->34 (I565 < IT56)
470 vol[2] = copy;
108bd0fe 471
531d6cdc 472 }else if(id == fIdSens[5]){
473 vol[0] = 6;
474 id = gMC->CurrentVolOffID(1,copy);
475 //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
476 vol[1] = copy;
477 id = gMC->CurrentVolOffID(2,copy);
478 //ladder copy in the layer = 1<->38 (I569 < IT56)
479 vol[2] = copy;
480 } else {
481 return; // not an ITS volume?
482 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
483 //
484 gMC->TrackPosition(position);
485 gMC->TrackMomentum(momentum);
486 vol[4] = stat0;
487 if(gMC->IsTrackEntering()){
488 position0 = position;
489 stat0 = vol[3];
490 return;
491 } // end if IsEntering
492 // Fill hit structure with this new hit.
b7943f00 493
531d6cdc 494 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
495 gMC->Edep(),gMC->TrackTime(),position,
496 position0,momentum);
b7943f00 497
b7943f00 498 position0 = position;
499 stat0 = vol[3];
531d6cdc 500
b7943f00 501 return;
531d6cdc 502}
108bd0fe 503