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 "AliITSgeom.h"
37 #include "AliITShit.h"
38 #include "AliITSsegmentationSDD.h"
39 #include "AliITSsegmentationSPD.h"
40 #include "AliITSsegmentationSSD.h"
41 #include "AliITSv11.h"
42 #include "AliITSv11GeometrySDD.h"
43 #include "AliITSv11GeometrySPD.h"
44 #include "AliITSv11GeometrySSD.h"
45 #include "AliITSv11GeometrySupport.h"
49 #include "AliTrackReference.h"
53 //______________________________________________________________________
54 AliITSv11::AliITSv11() :
56 fMajorVersion(IsVersion()),
64 // Standard default constructor for the ITS version 11.
72 //______________________________________________________________________
73 AliITSv11::AliITSv11(const char *name, const char *title):
76 fMajorVersion(IsVersion()),
84 // Standard constructor for the ITS version 11.
86 fSDDgeom = new AliITSv11GeometrySDD(0);
90 fIdName = new TString[fIdN];
91 fIdName[0] = name; // removes warning message
94 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
95 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
98 fIdSens = new Int_t[fIdN];
99 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
100 // not needed, fByThick set to kTRUE in in the member initialization lis
103 //______________________________________________________________________
104 AliITSv11::AliITSv11(Int_t debugITS,Int_t debugSPD,Int_t debugSDD,
105 Int_t debugSSD,Int_t debugSUP) :
106 AliITS("ITS","ITS geometry v11"),
108 fMajorVersion(IsVersion()),
116 // Standard default constructor for the ITS version 11.
119 // fSPDgeom = new AliITSv11GeometrySPD(debugSPD);
120 fSDDgeom = new AliITSv11GeometrySDD(debugSDD);
121 fSDDgeom->SetDebug(debugSDD);
122 // fSupgeom = new AliITSv11GeometrySupport(debugSUP);
126 fIdName = new TString[fIdN];
127 fIdName[0] = fSPDgeom->GetSenstiveVolumeName1();
128 fIdName[1] = fSPDgeom->GetSenstiveVolumeName2();
129 fIdName[2] = fSDDgeom->GetSenstiveVolumeName3();
130 fIdName[3] = fSDDgeom->GetSenstiveVolumeName4();
131 fIdName[4] = fSSDgeom->GetSenstiveVolumeName5();
132 fIdName[5] = fSSDgeom->GetSenstiveVolumeName6();
133 fIdSens = new Int_t[fIdN];
134 for(i=0;i<fIdN;i++) fIdSens[i] = 0;
135 debugITS = (debugSPD && debugSSD && debugSUP && debugSDD); //remove temp. warnings
137 //______________________________________________________________________
138 AliITSv11::~AliITSv11() {
141 //______________________________________________________________________
142 void AliITSv11::CreateGeometry(){
144 // Create ROOT geometry
146 // These constant character strings are set by cvs during commit
147 // do not change them unless you know what you are doing!
148 const Char_t *cvsDate="$Date$";
149 const Char_t *cvsRevision="$Revision$";
151 TGeoManager *geoManager = gGeoManager;
152 TGeoVolume *vALIC = geoManager->GetTopVolume();
154 TGeoPcon *sITS = new TGeoPcon("ITS Top Volume",0.0,360.0,2);
156 // DefineSection(section number, Z, Rmin, Rmax).
157 const Double_t kcm = 1.0;
158 sITS->DefineSection(0,-300.0*kcm,0.01*kcm,50.0*kcm);
159 sITS->DefineSection(1,+300.0*kcm,0.01*kcm,50.0*kcm);
161 TGeoMedium *air = gGeoManager->GetMedium("ITS_AIR$");
162 TGeoVolume *vITS = new TGeoVolume("ITSV",sITS,air);
163 vITS->SetVisibility(kFALSE);
164 const Int_t length=100;
165 Char_t vstrng[length];
166 if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
167 fMinorVersion,cvsDate,cvsRevision))
168 vITS->SetTitle(vstrng);
169 //printf("Title set to %s\n",vstrng);
170 vALIC->AddNode(vITS,1,0);
172 // fSPDgeom->CenteralSPD(vITS);
174 fSDDgeom->Layer3(vITS);
175 fSDDgeom->Layer4(vITS);
177 // fSupgeom->SPDCone(vITS);
178 // fSupgeom->SPDThermalSheald(vITS);
179 // fSupgeom->SDDCone(vITS);
180 // fSupgeom->SSDCone(vITS);
181 // fSupgeom->ServicesCableSupport(vITS);
184 //______________________________________________________________________
185 void AliITSv11::CreateMaterials(){
186 // Create Standard ITS Materials
196 fSPDgeom->AliITSv11Geometry::CreateDefaultMaterials();
197 // Detector specific material definistions
198 fSPDgeom->CreateMaterials();
199 fSDDgeom->CreateMaterials();
200 fSSDgeom->CreateMaterials();
201 fSupgeom->CreateMaterials();
204 //______________________________________________________________________
205 void AliITSv11::InitAliITSgeom(){
207 // Fill fITSgeom with the 3 sub-detector geometries
210 if (gGeoManager) gGeoManager->Export("geometry.root");
212 const Int_t knlayers = 6;
213 const Int_t kndeep = 3;
214 const AliITSDetector kidet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
215 const TString knames[knlayers] = {
216 "AliITSv11:spd missing", // lay=1
217 "AliITSv11:spd missing", // lay=2
218 "/ALIC_1/ITSV_1/ITSsddLayer3_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=3
219 "/ALIC_1/ITSV_1/ITSsddLayer4_1/ITSsddLadd_%d/ITSsddSensor_%d/ITSsddWafer_%d", // lay=4
220 "AliITSv11:ssd missing", // lay=5
221 "AliITSv11:ssd missing" // lay=6
224 const Int_t kitsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
230 Int_t nlad[knlayers],ndet[knlayers];
231 Int_t mod,lay,lad=0,det=0,i,j,k,cp0,cp1,cp2;
232 TString path,shapeName;
234 Double_t trans[3]={3*0.0},rot[10]={9*0.0,1.0};
237 Bool_t shapeDefined[3]={kFALSE,kFALSE,kFALSE};
239 AliDebug(1,"Reading Geometry transformation directly from Modler.");
241 for(i=0;i<knlayers;i++){
243 for(j=0;j<kndeep;j++) if(kitsGeomTreeCopys[i][j]!=0)
244 k *= TMath::Abs(kitsGeomTreeCopys[i][j]);
249 nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
250 ndet[0]= 4;ndet[1]= 4;ndet[2]= 6;ndet[3]= 8;ndet[4]=22;ndet[5]=25;
251 AliITSgeom* geom = new AliITSgeom(0,6,nlad,ndet,mod);
254 for(lay=1;lay<=knlayers;lay++){
256 for(cp0=0; cp0<kitsGeomTreeCopys[lay-1][0]; cp0++){
257 for(cp1=0; cp1<kitsGeomTreeCopys[lay-1][1]; cp1++){
258 for(cp2=1; cp2<=kitsGeomTreeCopys[lay-1][2]; cp2++){
260 path.Form(knames[lay-1].Data(),
271 case 3: case 4: case 5: case 6:{
276 //AliInfo(Form("path=%s lay=%d lad=%d det=%d",
277 // path.Data(),lay,lad,det));
278 gMC->GetTransformation(path.Data(),materix);
279 gMC->GetShape(path.Data(),shapeName,shapePar);
280 shapeParF.Set(shapePar.GetSize());
281 for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i];
282 geom->CreateMatrix(mod,lay,lad,det,kidet[lay-1],trans,rot);
283 geom->SetTrans(mod,materix.GetTranslation());
284 geom->SetRotMatrix(mod,materix.GetRotationMatrix());
285 geom->GetGeomMatrix(mod)->SetPath(path.Data());
288 if(!shapeDefined[kSPD]){
289 geom->ReSetShape(kSPD,new AliITSgeomSPD425Short(
290 shapeParF.GetSize(),shapeParF.GetArray()));
291 shapeDefined[kSPD] = kTRUE;
294 if(!shapeDefined[kSDD]){
295 geom->ReSetShape(kSDD,new AliITSgeomSDD256(
296 shapeParF.GetSize(),shapeParF.GetArray()));
297 shapeDefined[kSDD] = kTRUE;
300 if(!shapeDefined[kSSD]){
301 geom->ReSetShape(kSSD,new AliITSgeomSSD75and275(
302 shapeParF.GetSize(),shapeParF.GetArray()));
303 shapeDefined[kSSD] = kTRUE;
314 // fSDDgeom->ExportSensorGeometry(GetITSgeom(), +3, 0); //SDD
317 //______________________________________________________________________
318 void AliITSv11::Init(){
320 // Initialise the ITS after it has been created.
323 //AliInfo(Form("Minor version %d",fMinorVersion));
325 UpdateInternalGeometry();
330 if(GetITSgeom()!=0) SetITSgeom(0x0);
331 AliITSgeom* geom = new AliITSgeom();
338 //______________________________________________________________________
339 void AliITSv11::SetDefaults(){
341 // Set response and segmentation models for SPD, SDD and SSD
344 // if(!fDetTypeSim) fDetTypeSim = new AliITSDetTypeSim();
345 // fDetTypeSim->SetITSgeom(GetITSgeom());
347 Warning("SetDefaults","Error fDetTypeSim not defined");
351 fDetTypeSim->ResetCalibrationArray();
352 fDetTypeSim->ResetSegmentation();
353 fDetTypeSim->SetDefaults();
356 Warning("SetDefaults",
357 "Only the four basic detector types are initialised!");
368 //______________________________________________________________________
369 void AliITSv11::DrawModule() const{
373 // //______________________________________________________________________
374 // void AliITSv11::StepManager(){
376 // // Called for every step in the ITS, then calles the AliITShit class
377 // // creator with the information to be recoreded about that hit.
380 // TLorentzVector position, momentum;
381 // static TLorentzVector position0;
382 // static Int_t stat0=0;
384 // if(!(this->IsActive())){
386 // } // end if !Active volume.
388 // if(!(gMC->TrackCharge())) return;
390 // id=gMC->CurrentVolID(copy);
392 // Bool_t sensvol = kFALSE;
393 // for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
394 // if(sensvol && (gMC->IsTrackExiting())){
395 // copy = fTrackReferences->GetEntriesFast();
396 // TClonesArray &lTR = *fTrackReferences;
397 // // Fill TrackReference structure with this new TrackReference.
398 // new(lTR[copy]) AliTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber());
399 // } // if Outer ITS mother Volume
402 // Int_t copy1,copy2;
404 // TClonesArray &lhits = *fHits;
409 // if(gMC->IsTrackInside()) vol[3] += 1;
410 // if(gMC->IsTrackEntering()) vol[3] += 2;
411 // if(gMC->IsTrackExiting()) vol[3] += 4;
412 // if(gMC->IsTrackOut()) vol[3] += 8;
413 // if(gMC->IsTrackDisappeared()) vol[3] += 16;
414 // if(gMC->IsTrackStop()) vol[3] += 32;
415 // if(gMC->IsTrackAlive()) vol[3] += 64;
417 // // Fill hit structure.
418 // if(!(gMC->TrackCharge())) return;
420 // // Only entering charged tracks
421 // if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
423 // id = gMC->CurrentVolOffID(2,copy);
424 // //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
426 // gMC->CurrentVolOffID(3,copy1);
427 // //ladder copy in the module = 1<->2 (I10A < I12A)
428 // gMC->CurrentVolOffID(4,copy2);
429 // //module copy in the layer = 1<->10 (I12A < IT12)
430 // vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
431 // } else if(id == fIdSens[1]){
433 // id = gMC->CurrentVolOffID(2,copy);
434 // //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
436 // gMC->CurrentVolOffID(3,copy1);
437 // //ladder copy in the module = 1<->4 (I20A < I12A)
438 // gMC->CurrentVolOffID(4,copy2);
439 // //module copy in the layer = 1<->10 (I12A < IT12)
440 // vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
441 // } else if(id == fIdSens[2]){
443 // id = gMC->CurrentVolOffID(1,copy);
444 // //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
446 // id = gMC->CurrentVolOffID(2,copy);
447 // //ladder copy in the layer = 1<->14 (I004 < IT34)
449 // } else if(id == fIdSens[3]){
451 // id = gMC->CurrentVolOffID(1,copy);
452 // //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
454 // id = gMC->CurrentVolOffID(2,copy);
455 // //ladder copy in the layer = 1<->22 (I005 < IT34))
457 // }else if(id == fIdSens[4]){
459 // id = gMC->CurrentVolOffID(1,copy);
460 // //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
462 // id = gMC->CurrentVolOffID(2,copy);
463 // //ladder copy in the layer = 1<->34 (I565 < IT56)
465 // }else if(id == fIdSens[5]){
467 // id = gMC->CurrentVolOffID(1,copy);
468 // //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
470 // id = gMC->CurrentVolOffID(2,copy);
471 // //ladder copy in the layer = 1<->38 (I569 < IT56)
474 // return; // not an ITS volume?
475 // } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
477 // gMC->TrackPosition(position);
478 // gMC->TrackMomentum(momentum);
480 // if(gMC->IsTrackEntering()){
481 // position0 = position;
484 // } // end if IsEntering
485 // // Fill hit structure with this new hit.
487 // new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
488 // gMC->Edep(),gMC->TrackTime(),position,
489 // position0,momentum);
491 // position0 = position;
498 //______________________________________________________________________
499 void AliITSv11::StepManager(){
501 // Called for every step in the ITS, then calles the AliITShit class
502 // creator with the information to be recoreded about that hit.
505 TLorentzVector position, momentum;
506 static TLorentzVector position0;
507 static Int_t stat0=0;
509 if(!(this->IsActive())){
511 } // end if !Active volume.
513 if(!(gMC->TrackCharge())) return;
515 id=gMC->CurrentVolID(copy);
517 Bool_t sensvol = kFALSE;
518 for(Int_t kk=0;kk<6;kk++)if(id == fIdSens[kk])sensvol=kTRUE;
519 if(sensvol && (gMC->IsTrackExiting())){
520 AddTrackReference(gAlice->GetMCApp()->GetCurrentTrackNumber(), AliTrackReference::kITS);
521 } // if Outer ITS mother Volume
526 TClonesArray &lhits = *fHits;
531 if(gMC->IsTrackInside()) vol[3] += 1;
532 if(gMC->IsTrackEntering()) vol[3] += 2;
533 if(gMC->IsTrackExiting()) vol[3] += 4;
534 if(gMC->IsTrackOut()) vol[3] += 8;
535 if(gMC->IsTrackDisappeared()) vol[3] += 16;
536 if(gMC->IsTrackStop()) vol[3] += 32;
537 if(gMC->IsTrackAlive()) vol[3] += 64;
539 // Fill hit structure.
540 if(!(gMC->TrackCharge())) return;
542 // Only entering charged tracks
543 if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
545 id = gMC->CurrentVolOffID(2,copy);
546 //detector copy in the ladder = 1<->4 (ITS1 < I101 < I103 < I10A)
548 gMC->CurrentVolOffID(3,copy1);
549 //ladder copy in the module = 1<->2 (I10A < I12A)
550 gMC->CurrentVolOffID(4,copy2);
551 //module copy in the layer = 1<->10 (I12A < IT12)
552 vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
554 } else if(id == fIdSens[1]){
556 id = gMC->CurrentVolOffID(2,copy);
557 //detector copy in the ladder = 1<->4 (ITS2 < I1D1 < I1D3 < I20A)
559 gMC->CurrentVolOffID(3,copy1);
560 //ladder copy in the module = 1<->4 (I20A < I12A)
561 gMC->CurrentVolOffID(4,copy2);
562 //module copy in the layer = 1<->10 (I12A < IT12)
563 vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
565 } else if(id == fIdSens[2]){
567 id = gMC->CurrentVolOffID(1,copy);
568 //detector copy in the ladder = 1<->6 (ITS3 < I302 < I004)
570 id = gMC->CurrentVolOffID(2,copy);
571 //ladder copy in the layer = 1<->14 (I004 < IT34)
574 } else if(id == fIdSens[3]){
576 id = gMC->CurrentVolOffID(1,copy);
577 //detector copy in the ladder = 1<->8 (ITS4 < I402 < I005)
579 id = gMC->CurrentVolOffID(2,copy);
580 //ladder copy in the layer = 1<->22 (I005 < IT34))
583 }else if(id == fIdSens[4]){
585 id = gMC->CurrentVolOffID(1,copy);
586 //detector copy in the ladder = 1<->22 (ITS5 < I562 < I565)
588 id = gMC->CurrentVolOffID(2,copy);
589 //ladder copy in the layer = 1<->34 (I565 < IT56)
592 }else if(id == fIdSens[5]){
594 id = gMC->CurrentVolOffID(1,copy);
595 //detector copy in the ladder = 1<->25 (ITS6 < I566 < I569)
597 id = gMC->CurrentVolOffID(2,copy);
598 //ladder copy in the layer = 1<->38 (I569 < IT56)
601 return; // not an ITS volume?
602 } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
604 gMC->TrackPosition(position);
605 gMC->TrackMomentum(momentum);
607 if(gMC->IsTrackEntering()){
608 position0 = position;
611 } // end if IsEntering
612 // Fill hit structure with this new hit.
614 new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->GetMCApp()->GetCurrentTrackNumber(),vol,
615 gMC->Edep(),gMC->TrackTime(),position,
618 position0 = position;