1 /**************************************************************************
2 * Copyright(c) 2007-2008, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 //************************************************************************
19 // Inner Traking System geometry v11
21 // Based on ROOT geometrical modeler
23 // B. Nilsen, L. Gaudichet
24 //************************************************************************
26 #include <TClonesArray.h>
27 #include <TGeoManager.h>
29 #include <TGeoVolume.h>
30 #include <TLorentzVector.h>
31 #include <TVirtualMC.h>
34 #include "AliITSCalibrationSDD.h"
35 #include "AliITSDetTypeSim.h"
36 #include "AliITShit.h"
37 #include "AliITSsegmentationSDD.h"
38 #include "AliITSsegmentationSPD.h"
39 #include "AliITSsegmentationSSD.h"
40 #include "AliITSv11.h"
41 #include "AliITSv11GeometrySDD.h"
42 #include "AliITSv11GeometrySPD.h"
43 #include "AliITSv11GeometrySSD.h"
44 #include "AliITSv11GeometrySupport.h"
48 #include "AliTrackReference.h"
52 //______________________________________________________________________
53 AliITSv11::AliITSv11() :
55 fMajorVersion(IsVersion()),
63 // Standard default constructor for the ITS version 11.
71 //______________________________________________________________________
72 AliITSv11::AliITSv11(const char *name, const char *title):
75 fMajorVersion(IsVersion()),
83 // Standard constructor for the ITS version 11.
85 fSDDgeom = new AliITSv11GeometrySDD(0);
89 fIdName = new TString[fIdN];
90 fIdName[0] = name; // removes warning message
93 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
94 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
97 fIdSens = new Int_t[fIdN];
98 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
99 // not needed, fByThick set to kTRUE in in the member initialization lis
102 //______________________________________________________________________
103 AliITSv11::AliITSv11(Int_t /* debugITS */,Int_t debugSPD,Int_t debugSDD,
104 Int_t debugSSD,Int_t debugSUP) :
105 AliITS("ITS","ITS geometry v11"),
107 fMajorVersion(IsVersion()),
115 // Standard default constructor for the ITS version 11.
118 fSPDgeom = new AliITSv11GeometrySPD(debugSPD);
119 fSDDgeom = new AliITSv11GeometrySDD(debugSDD);
120 fSDDgeom->SetDebug(debugSDD);
121 fSSDgeom = new AliITSv11GeometrySSD();
122 fSSDgeom->SetDebug(debugSSD);
123 fSupgeom = new AliITSv11GeometrySupport(debugSUP);
127 fIdName = new TString[fIdN];
128 fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
129 fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
130 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
131 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
132 fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
133 fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
134 fIdSens = new Int_t[fIdN];
135 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
136 // debugITS = (debugSPD && debugSSD && debugSUP && debugSDD); //remove temp. warnings
138 //______________________________________________________________________
139 AliITSv11::~AliITSv11() {
142 //______________________________________________________________________
143 void AliITSv11::CreateGeometry(){
145 // Create ROOT geometry
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$";
152 TGeoManager *geoManager = gGeoManager;
153 TGeoVolume *vALIC = geoManager->GetTopVolume();
155 TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
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);
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);
173 // fSPDgeom->CenteralSPD(vITS);
175 fSDDgeom->Layer3(vITS);
176 fSDDgeom->Layer4(vITS);
178 // fSupgeom->SPDCone(vITS);
179 // fSupgeom->SPDThermalSheald(vITS);
180 // fSupgeom->SDDCone(vITS);
181 // fSupgeom->SSDCone(vITS);
182 // fSupgeom->ServicesCableSupport(vITS);
185 //______________________________________________________________________
186 void AliITSv11::CreateMaterials(){
187 // Create Standard ITS Materials
197 fSPDgeom->AliITSv11Geometry::CreateDefaultMaterials();
198 // Detector specific material definistions
199 fSPDgeom->CreateMaterials();
200 fSDDgeom->CreateMaterials();
201 fSSDgeom->CreateMaterials();
202 fSupgeom->CreateMaterials();
205 //______________________________________________________________________
206 void AliITSv11::Init(){
208 // Initialise the ITS after it has been created.
211 //AliInfo(Form("Minor version %d",fMinorVersion));
213 UpdateInternalGeometry();
218 //______________________________________________________________________
219 void AliITSv11::SetDefaults(){
221 // Set response and segmentation models for SPD, SDD and SSD
224 // if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
225 // fDetTypeSim->SetITSgeom(GetITSgeom());
227 Warning("SetDefaults","Error fDetTypeSim not defined");
231 fDetTypeSim->ResetCalibrationArray();
232 fDetTypeSim->ResetSegmentation();
233 fDetTypeSim->SetDefaults();
236 Warning("SetDefaults",
237 "Only the four basic detector types are initialised!");
248 //______________________________________________________________________
249 void AliITSv11::DrawModule() const{
253 // //______________________________________________________________________
254 // void AliITSv11::StepManager(){
256 // // Called for every step in the ITS, then calles the AliITShit class
257 // // creator with the information to be recoreded about that hit.
260 // TLorentzVector position, momentum;
261 // static TLorentzVector position0;
262 // static Int_t stat0=0;
264 // if(!(this->IsActive())){
266 // } // end if !Active volume.
268 // if(!(gMC->TrackCharge())) return;
270 // id=gMC->CurrentVolID(copy);
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
282 // Int_t copy1,copy2;
284 // TClonesArray &lhits = *fHits;
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;
297 // // Fill hit structure.
298 // if(!(gMC->TrackCharge())) return;
300 // // Only entering charged tracks
301 // if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
303 // id = gMC->CurrentVolOffID(2,copy);
304 // //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
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]){
313 // id = gMC->CurrentVolOffID(2,copy);
314 // //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
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]){
323 // id = gMC->CurrentVolOffID(1,copy);
324 // //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
326 // id = gMC->CurrentVolOffID(2,copy);
327 // //ladder copy in the layer = 1<->14 (I004 < IT34)
329 // } else if(id == fIdSens[3]){
331 // id = gMC->CurrentVolOffID(1,copy);
332 // //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
334 // id = gMC->CurrentVolOffID(2,copy);
335 // //ladder copy in the layer = 1<->22 (I005 < IT34))
337 // }else if(id == fIdSens[4]){
339 // id = gMC->CurrentVolOffID(1,copy);
340 // //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
342 // id = gMC->CurrentVolOffID(2,copy);
343 // //ladder copy in the layer = 1<->34 (I565 < IT56)
345 // }else if(id == fIdSens[5]){
347 // id = gMC->CurrentVolOffID(1,copy);
348 // //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
350 // id = gMC->CurrentVolOffID(2,copy);
351 // //ladder copy in the layer = 1<->38 (I569 < IT56)
354 // return; // not an ITS volume?
355 // } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
357 // gMC->TrackPosition(position);
358 // gMC->TrackMomentum(momentum);
360 // if(gMC->IsTrackEntering()){
361 // position0 = position;
364 // } // end if IsEntering
365 // // Fill hit structure with this new hit.
367 // new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
368 // gMC->Edep(),gMC->TrackTime(),position,
369 // position0,momentum);
371 // position0 = position;
378 //______________________________________________________________________
379 void AliITSv11::StepManager(){
381 // Called for every step in the ITS, then calles the AliITShit class
382 // creator with the information to be recoreded about that hit.
385 TLorentzVector position, momentum;
386 static TLorentzVector position0;
387 static Int_t stat0=0;
389 if(!(this->IsActive())){
391 } // end if !Active volume.
393 if(!(gMC->TrackCharge())) return;
395 id=gMC->CurrentVolID(copy);
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())){
400 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
401 } // if Outer ITS mother Volume
406 TClonesArray &lhits = *fHits;
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;
419 // Fill hit structure.
420 if(!(gMC->TrackCharge())) return;
422 // Only entering charged tracks
423 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
425 id = gMC->CurrentVolOffID(2,copy);
426 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
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
434 } else if(id == fIdSens[1]){
436 id = gMC->CurrentVolOffID(2,copy);
437 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
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
445 } else if(id == fIdSens[2]){
447 id = gMC->CurrentVolOffID(1,copy);
448 //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
450 id = gMC->CurrentVolOffID(2,copy);
451 //ladder copy in the layer = 1<->14 (I004 < IT34)
454 } else if(id == fIdSens[3]){
456 id = gMC->CurrentVolOffID(1,copy);
457 //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
459 id = gMC->CurrentVolOffID(2,copy);
460 //ladder copy in the layer = 1<->22 (I005 < IT34))
463 }else if(id == fIdSens[4]){
465 id = gMC->CurrentVolOffID(1,copy);
466 //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
468 id = gMC->CurrentVolOffID(2,copy);
469 //ladder copy in the layer = 1<->34 (I565 < IT56)
472 }else if(id == fIdSens[5]){
474 id = gMC->CurrentVolOffID(1,copy);
475 //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
477 id = gMC->CurrentVolOffID(2,copy);
478 //ladder copy in the layer = 1<->38 (I569 < IT56)
481 return; // not an ITS volume?
482 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
484 gMC->TrackPosition(position);
485 gMC->TrackMomentum(momentum);
487 if(gMC->IsTrackEntering()){
488 position0 = position;
491 } // end if IsEntering
492 // Fill hit structure with this new hit.
494 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
495 gMC->Edep(),gMC->TrackTime(),position,
498 position0 = position;