* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.6 2001/02/09 00:05:31 nilsen
-Added fMajor/MinorVersion variables and made other changes to better make
-use of the new code changes in AliITSgeom related classes.
-
-Revision 1.5 2001/01/30 09:23:14 hristov
-Streamers removed (R.Brun)
-
-Revision 1.4 2001/01/18 06:25:09 barbera
-ITS geometry using test Euclid files
-
-Revision 1.1.2.8 2000/10/05 20:28:18 nilsen
-Now using root generated streamer function.
-
-Revision 1.1.2.7 2000/07/31 13:51:22 barbera
-Updated from the release
-
-Revision 1.2 2000/07/10 16:07:19 fca
-Release version of ITS code
-
-Revision 1.1.2.2 2000/03/02 21:53:36 nilsen
-to make it compatable with the changes in AliRun/AliModule.
-
-Revision 1.1.2.1 2000/01/12 20:19:03 nilsen
- The changes made with this latest inclusion of code is very large.
-Many of the new files were added just in December when P. Cerello added his
-SDD simulations to the distrobutions. Also added are some file of P. Skowronski
-for SSD cluster finding and ghost RecPoints. None of this "new" code has been
-proporly tested. Other code new to this cvs repository is explained in the
-ITS Off-line web page. In general the changes are too large to give a resonable
-discription of them but probably should be taken as the starting point for
-the developement branch (ITS-working).
- B. S. Nilsen
-
-Revision 1.13 1999/10/16 19:49:00 BSN
-$Name$
-$Author$
-$Id$
-*/
+/* $Id$ */
///////////////////////////////////////////////////////////////////////////////
// //
// Created October 16 1999. //
// //
///////////////////////////////////////////////////////////////////////////////
+
+#include <Riostream.h>
#include <stdio.h>
#include <stdlib.h>
-#include <TMath.h>
-#include <TGeometry.h>
-#include <TNode.h>
-#include <TTUBE.h>
-#include <TFile.h> // only required for Tracking function?
-#include <TCanvas.h>
-#include <TObjArray.h>
-#include <TObjString.h>
-#include <TClonesArray.h>
#include <TLorentzVector.h>
-#include <TBRIK.h>
+#include <TMath.h>
#include <TSystem.h>
+#include <TGeometry.h>
+#include <TVirtualMC.h>
+#include <TGeoMatrix.h>
+#include <TGeoManager.h>
+#include <TGeoMaterial.h>
+#include <TGeoMedium.h>
+#include <TGeoBBox.h>
+#include <TGeoVolume.h>
-#include "AliMC.h"
#include "AliRun.h"
-#include "../TGeant3/TGeant3.h"
-#include "AliITSGeant3Geometry.h"
-#include "AliITShit.h"
-#include "AliITS.h"
-#include "AliITSvtest.h"
+#include "AliMC.h"
+#include "AliMagF.h"
#include "AliITSgeom.h"
-#include "AliITSgeomSPD.h"
#include "AliITSgeomSDD.h"
+#include "AliITSgeomSPD.h"
#include "AliITSgeomSSD.h"
+#include "AliITShit.h"
+#include "AliITSvtest.h"
ClassImp(AliITSvtest)
+
+const Double_t AliITSvtest::fgkmicron = 1.0E-4;
+const Double_t AliITSvtest::fgkmm = 0.10;
+const Double_t AliITSvtest::fgkcm = 1.00;
+const Double_t AliITSvtest::fgkDegree = 1.0;
+const Double_t AliITSvtest::fgkRadian = 180./3.14159265358979323846;
+const Double_t AliITSvtest::fgkgcm3 = 1.0; // assume default is g/cm^3
+const Double_t AliITSvtest::fgkCelsius = 1.0; // Assume default is C
+const Double_t AliITSvtest::fgkPascal = 1.0E-3; // Assume kPascal
+const Double_t AliITSvtest::fgkKPascal = 1.0; // Asume kPascal
+const Double_t AliITSvtest::fgkeV = 1.0E-9; // GeV default
+const Double_t AliITSvtest::fgkKeV = 1.0e-6; // GeV default
+const Double_t AliITSvtest::fgkMeV = 1.0e-3; // GeV default
+const Double_t AliITSvtest::fgkGeV = 1.0; // GeV default
+
//_____________________________________________________________________________
-AliITSvtest::AliITSvtest() {
- // Standard constructor for the ITS
+AliITSvtest::AliITSvtest() :
+AliITS(), // Base Class
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(-1), // Minor version number
+fEuclidGeomDet(), // file where detector transormation are define.
+fRead(), //! file name to read .det file
+fWrite(), //! file name to write .det file
+fIgm() //! Geometry initilization object
+{
+ // Default constructor for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+}
+//_____________________________________________________________________________
+AliITSvtest::AliITSvtest(const Char_t *title,Int_t version) :
+AliITS("ITS",title), // Base Class
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(version), // Minor version number
+fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_test.det"),// file where detector transormation are define.
+fRead("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to read .det file
+fWrite("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to write .det file
+fIgm() //! Geometry initilization object
+{
+ // Default constructor for the ITS. version=1 reads Euclide file for
+ // geometry. version=2 use's internal geometry
+ // Inputs:
+ // Char_t *title Geomety title
+ // Int_t version Minor version number to use.
+ // =-1 Not defined
+ // = 1 read Euclid geometry
+ // = 2 use internal geometry minor verion 2.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
Int_t i;
- fIdN = 0;
- fIdName = 0;
- fIdSens = 0;
- fEuclidOut = kFALSE; // Don't write Euclide file
- fGeomDetOut = kFALSE; // Don't write .det file
- fGeomDetIn = kTRUE; // Read .det file
- fMajorVersion = IsVersion();
- fMinorVersion = -1;
- for(i=0;i<60;i++) fRead[i] = '\0';
- for(i=0;i<60;i++) fWrite[i] = '\0';
- for(i=0;i<60;i++) fEuclidGeomDet[i] = '\0';
-}
-//____________________________________________________________________________
-AliITSvtest::AliITSvtest(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-// Copy Constructor for ITS test version.
-////////////////////////////////////////////////////////////////////////
- if(&source == this) return;
- Warning("Copy Constructor","Not allowed to copy AliITSvtest");
- return;
-}
-//_____________________________________________________________________________
-AliITSvtest& AliITSvtest::operator=(const AliITSvtest &source){
-////////////////////////////////////////////////////////////////////////
-// Assignment operator for the ITS version 1.
-////////////////////////////////////////////////////////////////////////
- if(&source == this) return *this;
- Warning("= operator","Not allowed to copy AliITSvtest");
- return *this;
+ fIdN = 6;
+ fIdName = new TString[fIdN];
+ fIdName[0] = "ITS1";
+ fIdName[1] = "ITS2";
+ fIdName[2] = "ITS3";
+ fIdName[3] = "ITS4";
+ fIdName[4] = "ITS5";
+ fIdName[5] = "ITS6";
+ fIdSens = new Int_t[fIdN];
+ for(i=0;i<fIdN;i++) fIdSens[i] = 0;
}
//_____________________________________________________________________________
AliITSvtest::~AliITSvtest() {
// Standard destructor for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
}
//_____________________________________________________________________________
AliITSvtest::AliITSvtest(const char *fileeuc,const char *filetme,
- const char *name, const char *title)
- : AliITS(name, title){
- //
+ const char *name, const char *title) :
+AliITS(name, title), // Base Class
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(1), // Minor version number
+fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_test.det"),// file where detector transormation are define.
+fRead("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to read .det file
+fWrite("$ALICE_ROOT/ITS/ITSgeometry_test.det"),//! file name to write .det file
+fIgm() //! Geometry initilization object
+{
// Standard constructor for the ITS
- //
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t i;
+
fIdN = 6;
fIdName = new TString[fIdN];
fIdName[0] = "ITS1";
fIdName[4] = "ITS5";
fIdName[5] = "ITS6";
fIdSens = new Int_t[fIdN];
- for (Int_t i=0;i<fIdN;i++) fIdSens[i] = 0;
- fMajorVersion = IsVersion();
- fMinorVersion = 1;
- fEuclidOut = kFALSE; // Don't write Euclide file
- fGeomDetOut = kFALSE; // Don't write .det file
- fGeomDetIn = kTRUE; // Read .det file
+ for(i=0;i<fIdN;i++) fIdSens[i] = 0;
fEuclidMaterial = filetme;
fEuclidGeometry = fileeuc;
- strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_PPR.det",60);
- strncpy(fRead,fEuclidGeomDet,60);
- strncpy(fWrite,fEuclidGeomDet,60);
-// The .det file for the geometry must have the same name as fileeuc with
-// .euc replaced by .det.
+ // The .det file for the geometry must have the same name as
+ // fileeuc with .euc replaced by .det.
}
-
-
//_____________________________________________________________________________
void AliITSvtest::CreateMaterials(){
- //
- // Read materials for the ITS
- //
+ // Read materials for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+
+ switch(GetMinorVersion()){
+ case 1:
+ CreateMaterialsEuclid();
+ break;
+ case 2:
+ CreateMaterials2();
+ break;
+ default:
+ Warning("CreateMaterials","No CreateMaterials for minor version=%d",
+ GetMinorVersion());
+ break;
+ } // end switch
+ return;
+}
+//_____________________________________________________________________________
+void AliITSvtest::CreateMaterialsEuclid(){
+ // Read materials for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
char *filtmp;
-//
- filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
-// FILE *file = fopen(fEuclidMaterial.Data(),"r");
- FILE *file = fopen(filtmp,"r");
- if(file) {
- fclose(file);
-// ReadEuclidMedia(fEuclidMaterial.Data(),this);
- ReadEuclidMedia(filtmp);
- } else {
- Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
-// fEuclidMaterial.Data());
- filtmp);
- exit(1);
- } // end if(file)
+
+ filtmp = gSystem->ExpandPathName(fEuclidMaterial.Data());
+ // FILE *file = fopen(fEuclidMaterial.Data(),"r");
+ FILE *file = fopen(filtmp,"r");
+ if(file) {
+ fclose(file);
+ // ReadEuclidMedia(fEuclidMaterial.Data(),this);
+ ReadEuclidMedia(filtmp);
+ } else {
+ Error("CreateMaterials"," THE MEDIA FILE %s DOES NOT EXIST !",
+ // fEuclidMaterial.Data());
+ filtmp);
+ exit(1);
+ } // end if(file)
}
+//_____________________________________________________________________________
+void AliITSvtest::CreateMaterials2(){
+ // Read materials for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ //TGeoManager *mgr = gGeoManager;
+ TGeoMaterial *si,*n2;
+ TGeoMedium *sims,*simn,*simN2;
+ Double_t params[8];
+ Int_t ifield = gAlice->Field()->Integ();
+ Double_t fieldm = gAlice->Field()->Max(); // [kilogauss]
+ params[0] = 1.0; // sensitive volume flag
+ params[1] = (Double_t)ifield; // magnetic field type
+ params[2] = fieldm; // magnetic field stregth
+ params[3] = 0.1*fgkDegree; // tmaxfd Theta max deviation over step
+ params[4] = 0.0075*fgkcm; // maximum step size
+ params[5] = 0.1; // Maximum fractional energy loss over a step
+ params[6] = 1.0E-4*fgkcm; // tracking precision
+ params[7] = 0.0*fgkcm; // Minimum step (=0 compute automatically)
+ // must always be =0!
+
+ si = new TGeoMaterial("SI",28.86,14.0,2.33*fgkgcm3,
+ TGeoMaterial::kMatStateSolid,25.0*fgkCelsius,
+ 0.0*fgkPascal);
+ sims = new TGeoMedium("ITSsensitiveSi",4,si,params);
+ params[0] = 0.0; // non sesitive.
+ simn = new TGeoMedium("ITSnonsensitiveSi",5,si,params);
+ //
+ n2 = new TGeoMaterial("Nitrogen Gas",14.00674,7.0,1.250E-3*fgkgcm3,
+ TGeoMaterial::kMatStateGas,25.0*fgkCelsius,
+ 101325.0*fgkPascal);
+ simN2 = new TGeoMedium("ITSN2",6,n2,params);
+ //
+ if(sims==0 || simn==0 || simN2==0)
+ Error("CreateMaterial","Error getting medium ITSsensitiveSi=%p"
+ " ITSnonsensitiveSi=%p ITSN2=%p",sims,simn,simN2);
+}
//_____________________________________________________________________________
void AliITSvtest::CreateGeometry(){
-//////////////////////////////////////////////////////////////////////
-////////////////////////////////////////////////////////////////////////
-// Read geometry for the ITS
-//
+ // Read geometry for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+
+ switch(GetMinorVersion()){
+ case 1:
+ CreateGeometryEuclid();
+ break;
+ case 2:
+ CreateGeometry2();
+ break;
+ default:
+ Warning("CreateGeometry","No CreateMaterials for minor version=%d",
+ GetMinorVersion());
+ break;
+ } // end switch
+ return;
+}
+//_____________________________________________________________________________
+void AliITSvtest::CreateGeometryEuclid(){
+ // Read geometry for the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
char topvol[5];
char *filtmp;
-//
- filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
- FILE *file = fopen(filtmp,"r");
- delete [] filtmp;
- if(file) {
- fclose(file);
- printf("Ready to read Euclid geometry file\n");
- ReadEuclid(fEuclidGeometry.Data(),topvol);
- printf("Read in euclid geometries\n");
- } else {
- Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
- fEuclidGeometry.Data());
- exit(1);
- } // end if(file)
- //
- //---Place the ITS ghost volume ITSV in its mother volume (ALIC) and make it
- // invisible
- //
- gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
- //
- //---Outputs the geometry tree in the EUCLID/CAD format
-
+
+ filtmp = gSystem->ExpandPathName(fEuclidGeometry.Data());
+ FILE *file = fopen(filtmp,"r");
+ delete [] filtmp;
+ if(file) {
+ fclose(file);
+ printf("Ready to read Euclid geometry file\n");
+ ReadEuclid(fEuclidGeometry.Data(),topvol);
+ printf("Read in euclid geometries\n");
+ } else {
+ Error("CreateGeometry"," THE GEOM FILE %s DOES NOT EXIST !",
+ fEuclidGeometry.Data());
+ exit(1);
+ } // end if(file)
+ //
+ //---Place the ITS logical volume ITSV in its mother volume (ALIC)
+ // and make it invisible
+ //
+ gMC->Gspos("ITSV",1,"ALIC",0,0,0,0,"ONLY");
+ //
+ //---Outputs the geometry tree in the EUCLID/CAD format
+
if (fEuclidOut) {
- gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
+ gMC->WriteEuclid("ITSgeometry", "ITSV", 1, 5);
} // end if (fEuclidOut)
cout <<"finished with euclid geometrys"<< endl;
}
-//______________________________________________________________________
-void AliITSvtest::InitAliITSgeom(){
-// Based on the geometry tree defined in Geant 3.21, this
-// routine initilizes the Class AliITSgeom from the Geant 3.21 ITS geometry
-// sturture.
- if(!((TGeant3*)gMC)) {
- Error("InitAliITSgeom",
- "Wrong Monte Carlo. InitAliITSgeom uses TGeant3 calls");
- return;
- } // end if
- cout << "Reading Geometry transformation directly from Geant 3." << endl;
- const Int_t nlayers = 6;
- const Int_t ndeep = 9;
- Int_t itsGeomTreeNames[nlayers][ndeep],lnam[20],lnum[20];
- Int_t nlad[nlayers],ndet[nlayers];
- Double_t t[3],r[10];
- Float_t par[20],att[20];
- Int_t npar,natt,idshape,imat,imed;
- AliITSGeant3Geometry *ig = new AliITSGeant3Geometry();
- Int_t mod,lay,lad,det,i,j,k;
- char *names[nlayers][ndeep] = {
- {"ALIC","ITSV","ITSD","IT12","I12B","I10B","I107","I101","ITS1"}, // lay=1
- {"ALIC","ITSV","ITSD","IT12","I12B","I20B","I1D7","I1D1","ITS2"}, // lay=2
- {"ALIC","ITSV","ITSD","IT34","I004","I302","ITS3"," "," "}, // lay=3
- {"ALIC","ITSV","ITSD","IT34","I005","I402","ITS4"," "," "}, // lay=4
- {"ALIC","ITSV","ITSD","IT56","I565","I562","ITS5"," "," "}, // lay=5
- {"ALIC","ITSV","ITSD","IT56","I569","I566","ITS6"," "," "}};// lay=6
- Int_t itsGeomTreeCopys[nlayers][ndeep] = {{1,1,1,1,10, 2, 4, 1, 1},// lay=1
- {1,1,1,1,10, 4, 4, 1, 1},// lay=2
- {1,1,1,1,14, 6, 1, 0, 0},// lay=3
- {1,1,1,1,22, 8, 1, 0, 0},// lay=4
- {1,1,1,1,34,22, 1, 0, 0},// lay=5
- {1,1,1,1,38,25, 1, 0, 0}};//lay=6
+//_____________________________________________________________________________
+void AliITSvtest::CreateGeometry2(){
+ // Test geometry verion 2.
+ // /ALIC_1/ITSV_1/ITSspd1_1/ITS1_1/ lay=1
+ // /ALIC_1/ITSV_1/ITSspd2_1/ITS2_1/ lay=2
+ // /ALIC_1/ITSV_1/ITSsdd1_1/ITS3_1/ lay=3
+ // /ALIC_1/ITSV_1/ITSsdd2_1/ITS4_1/ lay=4
+ // /ALIC_1/ITSV_1/ITSssd1_1/ITS5_1/ lay=5
+ // /ALIC_1/ITSV_1/ITSssd2_1/ITS6_1/ Lay=6
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ // These constant character strings are set by cvs during commit
+ // do not change them unless you know what you are doing!
+ const Char_t *cvsDate="$Date$";
+ const Char_t *cvsRevision="$Revision$";
+ const Double_t ksensitiveSPD[3]={0.6*fgkcm,0.01*fgkcm,3.5*fgkcm};
+ const Double_t ksensitiveSDD[3]={3.5085*fgkcm,0.01499*fgkcm,3.7485*fgkcm};
+ const Double_t ksensitiveSSD[3]={3.75*fgkcm,0.0150*fgkcm,2.1*fgkcm};
+ const Double_t kwaferSPD[3]={0.7*fgkcm,0.01*fgkcm,3.6*fgkcm};
+ const Double_t kwaferSDD[3]={3.61*fgkcm,0.0150*fgkcm,4.38*fgkcm};
+ const Double_t kwaferSSD[3]={3.85*fgkcm,0.0150*fgkcm,2.2*fgkcm};
+ TGeoManager *mgr = gGeoManager;
+ TGeoVolume *vALIC=0;
+ TGeoMedium *sensitiveSi=0,*bulckSi=0,*n2=0;
+ TGeoBBox *sITS,*sSPD,*sSDD,*sSSD;
+ TGeoBBox *sITS1,*sITS2,*sITS3,*sITS4,*sITS5,*sITS6;
+ TGeoVolume *vITS,*vSPD1,*vSPD2,*vSDD1,*vSDD2,*vSSD1,*vSSD2;
+ TGeoVolume *vITS1,*vITS2,*vITS3,*vITS4,*vITS5,*vITS6;
- // Sorry, but this is not very pritty code. It should be replaced
- // at some point with a version that can search through the geometry
- // tree its self.
- cout << "Reading Geometry informaton from Geant3 common blocks" << endl;
- for(i=0;i<20;i++) lnam[i] = lnum[i] = 0;
- for(i=0;i<nlayers;i++)for(j=0;j<ndeep;j++)
- itsGeomTreeNames[i][j] = ig->StringToInt(names[i][j]);
- mod = 0;
- for(i=0;i<nlayers;i++){
- k = 1;
- for(j=0;j<ndeep;j++) if(itsGeomTreeCopys[i][j]!=0)
- k *= TMath::Abs(itsGeomTreeCopys[i][j]);
- mod += k;
- } // end for i
+ vALIC = mgr->GetTopVolume();
+ if(vALIC==0) {
+ vALIC = mgr->GetVolume("ALIC");
+ if(vALIC==0) {
+ Error("CreateGeometry2","vALIC=0");
+ return;
+ }// end if
+ } // end if
+ //sensitiveSi = mgr->GetMedium("ITSsensitiveSi");
+ sensitiveSi = mgr->GetMedium(4);
+ //bulckSi = mgr->GetMedium("ITSnonesensitiveSi");
+ bulckSi = mgr->GetMedium(5);
+ //n2 = mgr->GetMedium("ITSN2");
+ n2 = mgr->GetMedium(6);
+ if(sensitiveSi==0 || bulckSi==0 || n2==0){
+ Error("CreateGeometry2","Error getting medium sensitiveSi=%p"
+ " bulckSi=%p n2=%p",sensitiveSi,bulckSi,n2);
+ TList *lmed = mgr->GetListOfMedia();
+ TIter next(lmed);
+ while(TGeoMedium *med = (TGeoMedium*) next())
+ med->Inspect();
+ } //
+ sITS1 = new TGeoBBox((Double_t*)ksensitiveSPD);
+ vITS1 = new TGeoVolume("ITS1",sITS1,sensitiveSi);
+ sITS2 = new TGeoBBox((Double_t*)ksensitiveSPD);
+ vITS2 = new TGeoVolume("ITS2",sITS2,sensitiveSi);
+ sSPD = new TGeoBBox((Double_t*)kwaferSPD);
+ vSPD1 = new TGeoVolume("ITSspd1",sSPD,bulckSi);
+ vSPD2 = new TGeoVolume("ITSspd2",sSPD,bulckSi);
+ vSPD1->AddNode(vITS1,1,0); // one copy no translation/rotation
+ vSPD2->AddNode(vITS2,1,0); // one copy no translation/rotation
+ //
+ sITS3 = new TGeoBBox((Double_t*)ksensitiveSDD);
+ vITS3 = new TGeoVolume("ITS3",sITS3,sensitiveSi);
+ sITS4 = new TGeoBBox((Double_t*)ksensitiveSDD);
+ vITS4 = new TGeoVolume("ITS4",sITS4,sensitiveSi);
+ sSDD = new TGeoBBox((Double_t*)kwaferSDD);
+ vSDD1 = new TGeoVolume("ITSsdd1",sSDD,bulckSi);
+ vSDD2 = new TGeoVolume("ITSsdd2",sSDD,bulckSi);
+ vSDD1->AddNode(vITS3,1,0); // one copy no translation/rotation
+ vSDD2->AddNode(vITS4,1,0); // one copy no translation/rotation
+ //
+ sITS5 = new TGeoBBox((Double_t*)ksensitiveSSD);
+ vITS5 = new TGeoVolume("ITS5",sITS5,sensitiveSi);
+ sITS6 = new TGeoBBox((Double_t*)ksensitiveSSD);
+ vITS6 = new TGeoVolume("ITS6",sITS6,sensitiveSi);
+ sSSD = new TGeoBBox((Double_t*)kwaferSSD);
+ vSSD1 = new TGeoVolume("ITSssd1",sSSD,bulckSi);
+ vSSD2 = new TGeoVolume("ITSssd2",sSSD,bulckSi);
+ vSSD1->AddNode(vITS5,1,0); // one copy no translation/rotation
+ vSSD2->AddNode(vITS6,1,0); // one copy no translation/rotation
+ //
+ sITS = new TGeoBBox(100.0,100.,100.0);
+ vITS = new TGeoVolume("ITSV",sITS,n2); // one copy of vacume ITSV
+ const Int_t length=100;
+ Char_t vstrng[length];
+ if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
+ fMinorVersion,cvsDate,cvsRevision))
+ vITS->SetTitle(vstrng);
+ else Error("CreateGeometry2","Error writing/setting version string");
- if(fITSgeom!=0) delete fITSgeom;
- nlad[0]=20;nlad[1]=40;nlad[2]=14;nlad[3]=22;nlad[4]=34;nlad[5]=38;
- ndet[0]=4;ndet[1]=4;ndet[2]=6;ndet[3]=8;ndet[4]=22;ndet[5]=25;
- fITSgeom = new AliITSgeom(0,6,nlad,ndet,mod);
- mod = -1;
- for(lay=1;lay<=nlayers;lay++){
- for(j=0;j<ndeep;j++) lnam[j] = itsGeomTreeNames[lay-1][j];
- for(j=0;j<ndeep;j++) lnum[j] = itsGeomTreeCopys[lay-1][j];
- switch (lay){
- case 1: case 2: // layers 1 and 2 are a bit special
- lad = 0;
- for(j=1;j<=itsGeomTreeCopys[lay-1][4];j++){
- lnum[4] = j;
- for(k=1;k<=itsGeomTreeCopys[lay-1][5];k++){
- lad++;
- lnum[5] = k;
- for(det=1;det<=itsGeomTreeCopys[lay-1][6];det++){
- lnum[6] = det;
- mod++;
- ig->GetGeometry(ndeep,lnam,lnum,t,r,idshape,npar,natt,
- par,att,imat,imed);
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSPD,t,r);
- if(!(fITSgeom->IsShapeDefined((Int_t)kSPD)))
- if(fMinorVersion==1){
- fITSgeom->ReSetShape(kSPD,
- new AliITSgeomSPD425Short());
- } else if(fMinorVersion==2)
- fITSgeom->ReSetShape(kSPD,
- new AliITSgeomSPD425Short());
- } // end for det
- } // end for k
- } // end for j
- break;
- case 3: case 4: case 5: case 6: // layers 3-6
- lnum[6] = 1;
- for(lad=1;lad<=itsGeomTreeCopys[lay-1][4];lad++){
- lnum[4] = lad;
- for(det=1;det<=itsGeomTreeCopys[lay-1][5];det++){
- lnum[5] = det;
- mod++;
- ig->GetGeometry(7,lnam,lnum,t,r,idshape,npar,natt,
- par,att,imat,imed);
- switch (lay){
- case 3: case 4:
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSDD,t,r);
- if(!(fITSgeom->IsShapeDefined(kSDD)))
- fITSgeom->ReSetShape(kSDD,new AliITSgeomSDD256());
- break;
- case 5:
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSSD,t,r);
- if(!(fITSgeom->IsShapeDefined(kSSD)))
- fITSgeom->ReSetShape(kSSD,new AliITSgeomSSD275and75());
- break;
- case 6:
- fITSgeom->CreatMatrix(mod,lay,lad,det,kSSDp,t,r);
- if(!(fITSgeom->IsShapeDefined(kSSDp)))
- fITSgeom->ReSetShape(kSSDp,new AliITSgeomSSD75and275());
- break;
- } // end switch
- } // end for det
- } // end for lad
- break;
- } // end switch
- } // end for lay
+ vALIC->AddNode(vITS,1,0);// one copy no translation/rotation
+ //
+ TGeoTranslation *t1,*t2,*t3,*t4,*t5,*t6;
+ TGeoRotation *r1,*r2,*r3,*r4,*r5,*r6;
+ TGeoCombiTrans *tr1,*tr2,*tr3,*tr4,*tr5,*tr6;
+ t1 = new TGeoTranslation( +4.0,+0.0,+0.0); // "perfect" location
+ r1 = new TGeoRotation("",90.0,0.0,0.0); // "perfect" location
+ tr1= new TGeoCombiTrans(*t1,*r1);// "perfect" location
+ t2 = new TGeoTranslation( +7.0,+0.2,-0.5);
+ r2 = new TGeoRotation("",-91.0,10.0,-5.0);
+ tr2= new TGeoCombiTrans(*t2,*r2);
+ t3 = new TGeoTranslation(+14.9,-0.6,+0.1);
+ r3 = new TGeoRotation("",93.0,-7.0,5.0);
+ tr3= new TGeoCombiTrans(*t3,*r3);
+ t4 = new TGeoTranslation(+23.8,+0.3,-0.2);
+ r4 = new TGeoRotation("",91.0,10.0,-5.0);
+ tr4= new TGeoCombiTrans(*t4,*r4);
+ t5 = new TGeoTranslation(+39.1,+0.1,+0.4);
+ r5 = new TGeoRotation("",88.0,1.0,5.0);
+ tr5= new TGeoCombiTrans(*t5,*r5);
+ t6 = new TGeoTranslation(+43.6,-0.5,+0.2);
+ r6 = new TGeoRotation("",92.0,0.0,-5.0);
+ tr6= new TGeoCombiTrans(*t6,*r6);
+ //
+ vITS->AddNode(vSPD1,1,tr1);
+ vITS->AddNode(vSPD2,1,tr2);
+ vITS->AddNode(vSDD1,1,tr3);
+ vITS->AddNode(vSDD2,1,tr4);
+ vITS->AddNode(vSSD1,1,tr5);
+ vITS->AddNode(vSSD2,1,tr6);
+ //
return;
}
//_____________________________________________________________________________
void AliITSvtest::Init(){
-////////////////////////////////////////////////////////////////////////
-// Initialise the ITS after it has been created.
-////////////////////////////////////////////////////////////////////////
+ // Initialise the ITS after it has been created.
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
Int_t i;
cout << endl;
for(i=0;i<29;i++) cout << "*";cout << " ITSvtest_Init ";
for(i=0;i<28;i++) cout << "*";cout << endl;
-//
- if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
- if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
- if(fITSgeom!=0) delete fITSgeom;
- fITSgeom = new AliITSgeom();
- if(fGeomDetIn) fITSgeom->ReadNewFile(fRead);
- if(!fGeomDetIn) this->InitAliITSgeom();
- if(fGeomDetOut) fITSgeom->WriteNewFile(fWrite);
+
+ switch(GetMinorVersion()){
+ case 1:
+ InitEuclid();
+ break;
+ case 2:
+ Init2();
+ break;
+ default:
+ break;
+ } // end switch
+ UpdateInternalGeometry();
AliITS::Init();
-//
+ if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite.Data());
+
for(i=0;i<72;i++) cout << "*";
cout << endl;
}
//_____________________________________________________________________________
+void AliITSvtest::InitEuclid(){
+ // Initialise the ITS after it has been created. Euclid version
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+}
+//_____________________________________________________________________________
+void AliITSvtest::Init2(){
+ // Initialise the ITS after it has been created. Geometry 2 verion
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Int_t i,n=3,imed[3];
+ TGeoManager *mgr = gGeoManager;
+ if(mgr==0) Error("Init2","mgr=0");
+ TGeoMedium *sensitiveSi = mgr->GetMedium("ITSsensitiveSi");
+ TGeoMedium *bulckSi = mgr->GetMedium("ITSnonsensitiveSi");
+ TGeoMedium *n2 = mgr->GetMedium("ITSN2");
+
+ if(sensitiveSi==0) Error("Init2","sensitiveSi=0");
+ if(bulckSi==0) Error("Init2","bulckSi=0");
+ if(n2==0) Error("Init2","n2=0");
+ imed[0] = sensitiveSi->GetId();
+ imed[1] = bulckSi->GetId();
+ imed[2] = n2->GetId();
+ for(i=0;i<n;i++){
+ if(imed[i]<=0){
+ Error("Init2","GetId failed for imed[i=%d]=%d",i,imed[i]);
+ return;
+ } // end if
+ gMC->Gstpar(imed[i],"CUTGAM",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"CUTELE",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"CUTNEU",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"CUTHAD",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"CUTMUO",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"BCUTE",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"BCUTM",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"DCUTE",30.0*fgkKeV);
+ gMC->Gstpar(imed[i],"DCUTM",30.0*fgkKeV);
+ //gMC->Gstpar(imed[i],"PPCUTM",);
+ //gMC->Gstpar(imed[i],"PAIR",);
+ //gMC->Gstpar(imed[i],"COMPT",);
+ //gMC->Gstpar(imed[i],"PHOT",);
+ //gMC->Gstpar(imed[i],"PFIS",);
+ gMC->Gstpar(imed[i],"DRAY",1);
+ //gMC->Gstpar(imed[i],"ANNI",);
+ //gMC->Gstpar(imed[i],"BREM",);
+ //gMC->Gstpar(imed[i],"HADR",);
+ //gMC->Gstpar(imed[i],"MUNU",);
+ //gMC->Gstpar(imed[i],"DCAY",);
+ gMC->Gstpar(imed[i],"LOSS",1);
+ //gMC->Gstpar(imed[i],"MULS",);
+ //gMC->Gstpar(imed[i],"GHCOR1",);
+ //gMC->Gstpar(imed[i],"BIRK1",);
+ //gMC->Gstpar(imed[i],"BRIK2",);
+ //gMC->Gstpar(imed[i],"BRIK3",);
+ //gMC->Gstpar(imed[i],"LABS",);
+ //gMC->Gstpar(imed[i],"SYNC",);
+ //gMC->Gstpar(imed[i],"STRA",);
+ } // end for i
+ return;
+}
+//_____________________________________________________________________________
void AliITSvtest::StepManager(){
- //
- // Called for every step in the ITS
- //
- Int_t copy, id;
- Int_t copy1,copy2;
- Float_t hits[8];
- Int_t vol[4];
- TLorentzVector position, momentum;
- TClonesArray &lhits = *fHits;
- //
- // Track status
- vol[3] = 0;
- if(gMC->IsTrackInside()) vol[3] += 1;
- if(gMC->IsTrackEntering()) vol[3] += 2;
- if(gMC->IsTrackExiting()) vol[3] += 4;
- if(gMC->IsTrackOut()) vol[3] += 8;
- if(gMC->IsTrackDisappeared()) vol[3] += 16;
- if(gMC->IsTrackStop()) vol[3] += 32;
- if(gMC->IsTrackAlive()) vol[3] += 64;
- //
- // Fill hit structure.
- if(!(gMC->TrackCharge())) return;
- //
- // Only entering charged tracks
- if((id = gMC->CurrentVolID(copy)) == fIdSens[0]) {
- vol[0] = 1;
- id = gMC->CurrentVolOffID(0,copy);
- //detector copy in the ladder = 1<->4 (ITS1)
- vol[1] = copy;
- gMC->CurrentVolOffID(1,copy1);
- //ladder copy in the module = 1<->2 (I186)
- gMC->CurrentVolOffID(2,copy2);
- //module copy in the layer = 1<->10 (I132)
- vol[2] = copy1+(copy2-1)*2;//# of ladders in one module = 2
- } else if(id == fIdSens[1]){
- vol[0] = 2;
- id = gMC->CurrentVolOffID(0,copy);
- //detector copy in the ladder = 1<->4 (ITS2)
- vol[1] = copy;
- gMC->CurrentVolOffID(1,copy1);
- //ladder copy in the module = 1<->4 (I131)
- gMC->CurrentVolOffID(2,copy2);
- //module copy in the layer = 1<->10 (I132)
- vol[2] = copy1+(copy2-1)*4;//# of ladders in one module = 4
- } else if(id == fIdSens[2]){
- vol[0] = 3;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->5 (ITS3 is inside I314)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->12 (I316)
- vol[2] = copy;
- } else if(id == fIdSens[3]){
- vol[0] = 4;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->8 (ITS4 is inside I414)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->22 (I417)
- vol[2] = copy;
- }else if(id == fIdSens[4]){
- vol[0] = 5;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->23 (ITS5 is inside I562)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->34 (I565)
- vol[2] = copy;
- }else if(id == fIdSens[5]){
- vol[0] = 6;
- id = gMC->CurrentVolOffID(1,copy);
- //detector copy in the ladder = 1<->26 (ITS6 is inside I566)
- vol[1] = copy;
- id = gMC->CurrentVolOffID(2,copy);
- //ladder copy in the layer = 1<->38 (I569)
- vol[2] = copy;
- } else {
- return; // not an ITS volume?
- } // end if/else if (gMC->CurentVolID(copy) == fIdSens[i])
-//
- gMC->TrackPosition(position);
- gMC->TrackMomentum(momentum);
- hits[0]=position[0];
- hits[1]=position[1];
- hits[2]=position[2];
- hits[3]=momentum[0];
- hits[4]=momentum[1];
- hits[5]=momentum[2];
- hits[6]=gMC->Edep();
- hits[7]=gMC->TrackTime();
- // Fill hit structure with this new hit.
- new(lhits[fNhits++]) AliITShit(fIshunt,gAlice->CurrentTrack(),vol,hits);
+ // Called for every step in the ITS
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ //
+ // Fill hit structure.
+ static TLorentzVector position, momentum; // Saves on calls to construtors
+ static AliITShit hit; // Saves on calls to construtors
+ Int_t cpn0,cpn1,cpn2,status,lay,mod,id;
+
+ if(!(gMC->TrackCharge())) return;
+ if(!(this->IsActive())) return;
+ TClonesArray &lhits = *(Hits());
+ // Track status
+ status = 0;
+ if(gMC->IsTrackInside()) status += 1;
+ if(gMC->IsTrackEntering()) status += 2;
+ if(gMC->IsTrackExiting()) status += 4;
+ if(gMC->IsTrackOut()) status += 8;
+ if(gMC->IsTrackDisappeared()) status += 16;
+ if(gMC->IsTrackStop()) status += 32;
+ if(gMC->IsTrackAlive()) status += 64;
+ // Only entering charged tracks
+ id = gMC->CurrentVolID(cpn0);
+ for(lay=0;lay<6;lay++) if(id == fIdSens[lay]) break;
+ lay++;
+ if(lay>6) return; // not in detector
+ cpn0=cpn1=cpn2=1;
+ fIgm.DecodeDetector(mod,lay,cpn0,cpn1,cpn2);
+ // Fill hit structure.
+ hit.SetModule(mod);
+ hit.SetTrack(gAlice->GetMCApp()->GetCurrentTrackNumber());
+ gMC->TrackPosition(position);
+ gMC->TrackMomentum(momentum);
+ hit.SetPosition(position);
+ hit.SetTime(gMC->TrackTime());
+ hit.SetMomentum(momentum);
+ hit.SetStatus(status);
+ hit.SetEdep(gMC->Edep());
+ hit.SetShunt(GetIshunt());
+ if(gMC->IsTrackEntering()){
+ hit.SetStartPosition(position);
+ hit.SetStartTime(gMC->TrackTime());
+ hit.SetStartStatus(status);
+ return; // don't save entering hit.
+ } // end if IsEntering
+ // Fill hit structure with this new hit.
+ new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
+ // Save old position... for next hit.
+ hit.SetStartPosition(position);
+ hit.SetStartTime(gMC->TrackTime());
+ hit.SetStartStatus(status);
+ //
+ Double_t g0[4],l0[4],g1[4];
+ position.GetXYZT(g0);
+ gMC->Gmtod(g0,l0,1); // flag=1 convert coordiantes
+ gMC->Gdtom(l0,g1,1); // flag=1 convert coordinates
+ printf(" gMC: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
+ mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
+ GetITSgeom()->GtoL(mod,g0,l0);
+ GetITSgeom()->LtoG(mod,l0,g1);
+ printf("ITSgeom: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
+ mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
+ TGeoNode *cur = gGeoManager->GetCurrentNode();
+ cur->MasterToLocal(g0,l0);
+ cur->LocalToMaster(l0,g1);
+ printf(" TGeo: mod=%d g=%g %g %g %g -> l= %g %g %g %g ->g=%g %g %g %g\n",
+ mod,g0[0],g0[1],g0[2],g0[3],l0[0],l0[1],l0[2],l0[3],g1[0],g1[2],g1[2],g1[3]);
+ printf("=====================\n");
+ //
+
return;
}
+//______________________________________________________________________
+void AliITSvtest::PrintAscii(ostream *os)const{
+ // Print out class data values in Ascii Form to output stream
+ // Inputs:
+ // ostream *os Output stream where Ascii data is to be writen
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+#if defined __GNUC__
+#if __GNUC__ > 2
+ ios::fmtflags fmt;
+#else
+ Int_t fmt;
+#endif
+#else
+#if defined __ICC || defined __ECC || defined __xlC__
+ ios::fmtflags fmt;
+#else
+ Int_t fmt;
+#endif
+#endif
+
+ *os << fGeomDetOut << " " << fGeomDetIn << " ";
+ *os << fMajorVersion << " " << fMinorVersion << " ";
+ *os << "\"" << fEuclidGeomDet.Data() << "\"" << " ";
+ *os << "\"" << fRead.Data() << "\"" << " ";
+ *os << "\"" << fWrite.Data() << "\"" << " ";
+ fmt = os->setf(ios::scientific); // set scientific floating point output
+ os->flags(fmt); // reset back to old Formating.
+ return;
+}
+//______________________________________________________________________
+void AliITSvtest::ReadAscii(istream *is){
+ // Read in class data values in Ascii Form to output stream
+ // Inputs:
+ // istream *is Input stream where Ascii data is to be read in from
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+ Char_t name[120];
+
+ *is >> fGeomDetOut >> fGeomDetIn ;
+ *is >> fMajorVersion >> fMinorVersion;
+ *is >> name;
+ fEuclidGeomDet = name;
+ *is >> name;
+ fRead = name;
+ *is >> name;
+ fWrite = name;
+ fIgm.SetVersion((AliITSVersion_t)fMajorVersion,fMinorVersion);
+ fIgm.SetGeometryName("ITS test geometry");
+}
+//______________________________________________________________________
+ostream &operator<<(ostream &os,const AliITSvtest &s){
+ // Standard output streaming function
+ // Inputs:
+ // ostream &os output steam
+ // AliITSvtest &s class to be streamed.
+ // Output:
+ // none.
+ // Return:
+ // ostream &os The stream pointer
+
+ s.PrintAscii(&os);
+ return os;
+}
+//______________________________________________________________________
+istream &operator>>(istream &is,AliITSvtest &s){
+ // Standard inputput streaming function
+ // Inputs:
+ // istream &is input steam
+ // AliITSvtest &s class to be streamed.
+ // Output:
+ // none.
+ // Return:
+ // ostream &os The stream pointer
+ s.ReadAscii(&is);
+ return is;
+}