#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TGeoMatrix.h>
+#include <TGeoPhysicalNode.h>
#include <TArrayD.h>
#include <TArrayF.h>
#include <TString.h>
#include <TTUBE.h>
#include <TGeoManager.h>
#include <TGeoVolume.h>
+#include <TVirtualMC.h>
#include "AliITS.h"
#include "AliITSDetTypeSim.h"
-#include "AliITSGeant3Geometry.h"
#include "AliITSgeom.h"
#include "AliITSgeomSDD.h"
#include "AliITSgeomSPD.h"
ClassImp(AliITSvPPRasymmFMD)
//______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD() {
+AliITSvPPRasymmFMD::AliITSvPPRasymmFMD():
+AliITS(), // Default AliITS Constructor
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fByThick(kTRUE), // Flag to use services materials by thickness
+ // ture, or mass false.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(2), // Minor version number
+fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),// file where detector transormation are define.
+fRead("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm.det"),//! file name to read .det file
+fWrite("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),//! file name to write .det file
+fDet1(200.0), // thickness of detector in SPD layer 1 [microns]
+fDet2(200.0), // thickness of detector in SPD layer 2 [microns]
+fChip1(150.0), // thickness of chip in SPD layer 1 [microns]
+fChip2(150.0), // thickness of chip in SPD layer 2 [microns]
+fRails(0), // flag to switch rails on (=1) and off (=0)
+fFluid(1), // flag to switch between water (=1)& freon (=0)
+fIDMother(0), //! ITS Mother Volume id.
+fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding
+ // and AliITSgeom init functions
+ {
// Standard default constructor for the ITS version 10.
// Inputs:
// none.
// none.
// Return:
// none.
+ fIgm.SetGeometryName("");
+}
+//______________________________________________________________________
+AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const Char_t *title):
+AliITS(title), // Standard AliITS Constructor
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fByThick(kTRUE), // Flag to use services materials by thickness
+ // ture, or mass false.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(2), // Minor version number
+fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),// file where detector transormation are define.
+fRead("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm.det"),//! file name to read .det file
+fWrite("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),//! file name to write .det file
+fDet1(200.0), // thickness of detector in SPD layer 1 [microns]
+fDet2(200.0), // thickness of detector in SPD layer 2 [microns]
+fChip1(150.0), // thickness of chip in SPD layer 1 [microns]
+fChip2(150.0), // thickness of chip in SPD layer 2 [microns]
+fRails(0), // flag to switch rails on (=1) and off (=0)
+fFluid(1), // flag to switch between water (=1)& freon (=0)
+fIDMother(0), //! ITS Mother Volume id.
+fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding
+ // and AliITSgeom init functions
+{
+ // Standard constructor for the ITS version 10.
+ // Inputs:
+ // const Char_t * title Arbitrary title
+ // 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 = kFALSE; // 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';
- strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
+ fIgm.SetDecoding(kFALSE);// Use Alice compliant naming/numbering system
+ fIgm.SetTiming(kFALSE);// default no timing
+ fIgm.SetSegGeom(kFALSE);// use AliITSgeomS?D classes instead
+ // of segmentation AliITSsegmentationS?D class
+ fIgm.SetGeometryName("ITS PPR aymmetric services with course"
+ " cables on cones");
+ // Set some AliITS class veriables.
+ 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;
}
//______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const char *name, const char *title)
- : AliITS("ITS", title){
+AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const char *name, const char *title):
+AliITS(name,title), // Extended AliITS Constructor
+fGeomDetOut(kFALSE), // Flag to write .det file out
+fGeomDetIn(kFALSE), // Flag to read .det file or directly from Geat.
+fByThick(kTRUE), // Flag to use services materials by thickness
+ // ture, or mass false.
+fMajorVersion(IsVersion()), // Major version number == IsVersion
+fMinorVersion(2), // Minor version number
+fEuclidGeomDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),// file where detector transormation are define.
+fRead("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm.det"),//! file name to read .det file
+fWrite("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"),//! file name to write .det file
+fDet1(200.0), // thickness of detector in SPD layer 1 [microns]
+fDet2(200.0), // thickness of detector in SPD layer 2 [microns]
+fChip1(150.0), // thickness of chip in SPD layer 1 [microns]
+fChip2(150.0), // thickness of chip in SPD layer 2 [microns]
+fRails(0), // flag to switch rails on (=1) and off (=0)
+fFluid(1), // flag to switch between water (=1)& freon (=0)
+fIDMother(0), //! ITS Mother Volume id.
+fIgm((AliITSVersion_t)fMajorVersion,fMinorVersion)//! Get access to decoding
+ // and AliITSgeom init functions
+{
// Standard constructor for the ITS version 10.
// Inputs:
// const char * name Ignored, set to "ITS"
// none.
// Return:
// none.
+
Int_t i;
+ fIgm.SetDecoding(kFALSE);// Use Alice compliant naming/numbering system
+ fIgm.SetTiming(kFALSE);// default no timing
+ fIgm.SetSegGeom(kFALSE);// use AliITSgeomS?D classes instead
+ // of segmentation AliITSsegmentationS?D class
+ fIgm.SetGeometryName("ITS PPR aymmetric services with course"
+ " cables on cones");
+ // Set some AliITS class veriables.
fIdN = 6;
fIdName = new TString[fIdN];
- fIdName[0] = name; // removes warning message
fIdName[0] = "ITS1";
fIdName[1] = "ITS2";
fIdName[2] = "ITS3";
fIdName[5] = "ITS6";
fIdSens = new Int_t[fIdN];
for(i=0;i<fIdN;i++) fIdSens[i] = 0;
- fMajorVersion = IsVersion();
- fMinorVersion = 2;
- fEuclidOut = kFALSE; // Don't write Euclide file
- fGeomDetOut = kFALSE; // Don't write .det file
- fGeomDetIn = kFALSE; // Read .det file
+
SetThicknessDet1();
SetThicknessDet2();
SetThicknessChip1();
SetThicknessChip2();
SetDensityServicesByThickness();
-
- fEuclidGeometry="$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.euc";
- strncpy(fEuclidGeomDet,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det",60);
- strncpy(fRead,fEuclidGeomDet,60);
- strncpy(fWrite,fEuclidGeomDet,60);
- strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
}
//______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const AliITSvPPRasymmFMD &source) :
- AliITS(source){
+AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const AliITSvPPRasymmFMD &source):
+AliITS(source.GetName(),source.GetTitle()),// Extended AliITS Constructor
+fGeomDetOut(source.GetWriteDet()),// Flag to write .det file out
+fGeomDetIn(source.GetReadDet()), // Flag to read .det file or directly
+ // from Geat.
+fByThick(source.IsDensityServicesByThickness()),// Flag to use services
+ // materials by thickness
+ // ture, or mass false.
+fMajorVersion(source.IsVersion()), // Major version number == IsVersion
+fMinorVersion(source.GetMinorVersion()),// Minor version number
+fEuclidGeomDet(source.GetEuclidFile()),// file where detector transormation
+ // are define.
+fRead(source.GetReadDetFileName()), //! file name to read .det file
+fWrite(source.GetWriteDetFileName()),//! file name to write .det file
+fDet1(source.GetThicknessDet1()),//thickness of detector in SPD layer 1[micron]
+fDet2(source.GetThicknessDet2()),//thickness of detector in SPD layer 2[micron]
+fChip1(source.GetThicknessChip1()),//thickness of chip in SPD layer 1 [microns]
+fChip2(source.GetThicknessChip2()),//thickness of chip in SPD layer 2 [microns]
+fRails(source.GetRails()), // flag to switch rails on (=1) and off (=0)
+fFluid(source.GetCoolingFluid()),// flag to switch between water (1)& freon (0)
+fIDMother(source.GetMotherID()), //! ITS Mother Volume id.
+fIgm(source.GetGeomInit())//! Get access to decoding
+ // and AliITSgeom init functions
+{
// Copy Constructor for ITS version 10. This function is not to be
// used. If any other instance of this function, other than "this" is
// passed, an error message is returned.
if(&source == this) return *this;
Warning("= operator","Not allowed to copy AliITSvPPRasymmFMD");
- return *this;
+ return *this; // return null pointer, copy not allowed.
}
//______________________________________________________________________
AliITSvPPRasymmFMD::~AliITSvPPRasymmFMD() {
// none.
}
//______________________________________________________________________
+void AliITSvPPRasymmFMD::AddAlignableVolumes() const
+{
+ //
+ // Creates entries for alignable volumes associating the symbolic volume
+ // name with the corresponding volume path.
+ //
+ // Records in the alignable entries the transformation matrices converting
+ // TGeo local coordinates (in the RS of alignable volumes) to the tracking
+ // system
+ // For this, this function has to run before the misalignment because we
+ // are using the ideal positions in the AliITSgeom object.
+
+ AliInfo("Add ITS alignable volumes");
+
+ if (!gGeoManager) {
+ AliFatal("TGeoManager doesn't exist !");
+ return;
+ }
+
+ if( !gGeoManager->SetAlignableEntry("ITS","ALIC_1/ITSV_1") )
+ AliFatal("Unable to set alignable entry!!");
+
+ Double_t al, *gtrans, rotMatrix[9];
+
+ TString strSPD = "ITS/SPD";
+ TString strSDD = "ITS/SDD";
+ TString strSSD = "ITS/SSD";
+ TString strStave = "/Stave";
+ TString strLadder = "/Ladder";
+ TString strSector = "/Sector";
+ TString strSensor = "/Sensor";
+ TString strEntryName1;
+ TString strEntryName2;
+ TString strEntryName3;
+
+ //===== SPD layer1 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_";
+ TString str1 = "/I10B_";
+ TString str2 = "/I107_";
+
+ TString sector;
+ TString stave;
+ TString module;
+
+ for(Int_t c1 = 1; c1<=10; c1++){
+
+ sector = str0;
+ sector += c1; // this is one full sector
+ strEntryName1 = strSPD;
+ strEntryName1 += 0;
+ strEntryName1 += strSector;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),sector.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),sector.Data());
+
+ for(Int_t c2 =1; c2<=2; c2++){
+
+ stave = sector;
+ stave += str1;
+ stave += c2;
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strStave;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),stave.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),stave.Data()); // this is a stave
+
+ for(Int_t c3 =1; c3<=4; c3++){
+
+ module = stave;
+ module += str2;
+ module += c3;
+ strEntryName3 = strEntryName2;
+ strEntryName3 += strLadder;
+ strEntryName3 += (c3-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),module.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName3.Data(),module.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName3.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]);
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ // Not taking into account the shift w.r.t. sensitive volume
+ // correction with fChip1*0.0001/2. is due to the fact
+ // that the alignable volume is not the sensitive volume
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) - fChip1*0.0001/2.);
+ matLtoT->SetDy(-fChip1*0.0001/2.);
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]= 0; rotMatrix[1]= 1; rotMatrix[2]= 0; // + rotation
+ rotMatrix[3]=-1; rotMatrix[4]= 0; rotMatrix[5]= 0; // ! flip in y for the SPD1 only
+ rotMatrix[6]= 0; rotMatrix[7]= 0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+ }
+
+ //===== SPD layer2 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT12_1/I12B_";
+ TString str1 = "/I20B_";
+ TString str2 = "/I1D7_";
+
+ TString sector;
+ TString stave;
+ TString module;
+
+ for(Int_t c1 = 1; c1<=10; c1++){
+
+ sector = str0;
+ sector += c1; // this is one full sector
+ strEntryName1 = strSPD;
+ strEntryName1 += 1;
+ strEntryName1 += strSector;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),sector.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),sector.Data());
+
+ for(Int_t c2 =1; c2<=4; c2++){
+
+ stave = sector;
+ stave += str1;
+ stave += c2;
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strStave;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),stave.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),stave.Data()); // this is a stave
+
+ for(Int_t c3 =1; c3<=4; c3++){
+
+ module = stave;
+ module += str2;
+ module += c3;
+ strEntryName3 = strEntryName2;
+ strEntryName3 += strLadder;
+ strEntryName3 += (c3-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName3.Data(),module.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName3.Data(),module.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName3.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]) + TMath::Pi();
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx(-gtrans[0]*TMath::Cos(al)-gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ //matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ // not taking into account the shift w.r.t. sensitive volume
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) + fChip2*0.0001/2.);
+ matLtoT->SetDy(-fChip2*0.0001/2.);
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]= 0; rotMatrix[1]= 1; rotMatrix[2]= 0; // + rotation
+ rotMatrix[3]= 1; rotMatrix[4]= 0; rotMatrix[5]= 0;
+ rotMatrix[6]= 0; rotMatrix[7]= 0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+ }
+
+ //===== SDD layer1 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_";
+ TString str1 = "/I302_";
+
+ TString ladder;
+ TString wafer;
+
+ for(Int_t c1 = 1; c1<=14; c1++){
+
+ ladder = str0;
+ ladder += c1; // the set of wafers from one ladder
+ strEntryName1 = strSDD;
+ strEntryName1 += 2;
+ strEntryName1 +=strLadder;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),ladder.Data());
+
+ for(Int_t c2 =1; c2<=6; c2++){
+
+ wafer = ladder;
+ wafer += str1;
+ wafer += c2; // one wafer
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strSensor;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),wafer.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName2.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]) + TMath::Pi();
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx(-gtrans[0]*TMath::Cos(al)-gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ matLtoT->SetDy( 0 );
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]=0; rotMatrix[1]=1; rotMatrix[2]=0; // + rotation
+ rotMatrix[3]=1; rotMatrix[4]=0; rotMatrix[5]=0;
+ rotMatrix[6]=0; rotMatrix[7]=0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+
+ //===== SDD layer2 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT34_1/I005_";
+ TString str1 = "/I402_";
+
+ TString ladder;
+ TString wafer;
+
+ for(Int_t c1 = 1; c1<=22; c1++){
+
+ ladder = str0;
+ ladder += c1; // the set of wafers from one ladder
+ strEntryName1 = strSDD;
+ strEntryName1 += 3;
+ strEntryName1 +=strLadder;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),ladder.Data());
+
+ for(Int_t c2 =1; c2<=8; c2++){
+
+ wafer = ladder;
+ wafer += str1;
+ wafer += c2; // one wafer
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strSensor;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),wafer.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName2.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]) + TMath::Pi();
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx(-gtrans[0]*TMath::Cos(al)-gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ matLtoT->SetDy( 0 );
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]=0; rotMatrix[1]=1; rotMatrix[2]=0; // + rotation
+ rotMatrix[3]=1; rotMatrix[4]=0; rotMatrix[5]=0;
+ rotMatrix[6]=0; rotMatrix[7]=0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+
+ //===== SSD layer1 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_";
+ TString str1 = "/I562_";
+
+ TString ladder;
+ TString wafer;
+
+ for(Int_t c1 = 1; c1<=34; c1++){
+
+ ladder = str0;
+ ladder += c1; // the set of wafers from one ladder
+ strEntryName1 = strSSD;
+ strEntryName1 += 4;
+ strEntryName1 +=strLadder;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),ladder.Data());
+
+ for(Int_t c2 = 1; c2<=22; c2++){
+
+ wafer = ladder;
+ wafer += str1;
+ wafer += c2; // one wafer
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strSensor;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),wafer.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName2.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]) + TMath::Pi();
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx(-gtrans[0]*TMath::Cos(al)-gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ matLtoT->SetDy( 0 );
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]=0; rotMatrix[1]=1; rotMatrix[2]=0; // + rotation
+ rotMatrix[3]=1; rotMatrix[4]=0; rotMatrix[5]=0;
+ rotMatrix[6]=0; rotMatrix[7]=0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+
+ //===== SSD layer2 =====
+ {
+ TString str0 = "ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_";
+ TString str1 = "/I566_";
+
+ TString ladder;
+ TString wafer;
+
+ for(Int_t c1 = 1; c1<=38; c1++){
+
+ ladder = str0;
+ ladder += c1; // the set of wafers from one ladder
+ strEntryName1 = strSSD;
+ strEntryName1 += 5;
+ strEntryName1 +=strLadder;
+ strEntryName1 += (c1-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName1.Data(),ladder.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName1.Data(),ladder.Data());
+
+ for(Int_t c2 = 1; c2<=25; c2++){
+
+ wafer = ladder;
+ wafer += str1;
+ wafer += c2; // one wafer
+ strEntryName2 = strEntryName1;
+ strEntryName2 += strSensor;
+ strEntryName2 += (c2-1);
+ if(!gGeoManager->SetAlignableEntry(strEntryName2.Data(),wafer.Data()))
+ AliFatal("Unable to set alignable entry!!");
+ //printf("%s == %s\n",strEntryName2.Data(),wafer.Data());
+
+ // Creates the TGeo Local to Tracking transformation matrix ...
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(strEntryName2.Data());
+ const char *path = alignableEntry->GetTitle();
+ if (!gGeoManager->cd(path))
+ AliFatal(Form("Volume path %s not valid!",path));
+ TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ gtrans = globMatrix->GetTranslation();
+ memcpy(&rotMatrix[0], globMatrix->GetRotationMatrix(), 9*sizeof(Double_t));
+ al = TMath::ATan2(rotMatrix[1],rotMatrix[0]) + TMath::Pi();
+ TGeoHMatrix *matLtoT = new TGeoHMatrix;
+ matLtoT->SetDx(-gtrans[0]*TMath::Cos(al)-gtrans[1]*TMath::Sin(al) ); // translation
+ al += TMath::Pi()/2;
+ // matLtoT->SetDy( gtrans[0]*TMath::Cos(al)+gtrans[1]*TMath::Sin(al) );
+ matLtoT->SetDy( 0 );
+ matLtoT->SetDz(-gtrans[2]);
+ rotMatrix[0]=0; rotMatrix[1]=1; rotMatrix[2]=0; // + rotation
+ rotMatrix[3]=1; rotMatrix[4]=0; rotMatrix[5]=0;
+ rotMatrix[6]=0; rotMatrix[7]=0; rotMatrix[8]=-1;
+ TGeoRotation rot;
+ rot.SetMatrix(rotMatrix);
+ matLtoT->MultiplyLeft(&rot);
+ TGeoHMatrix *matTtoL = new TGeoHMatrix(matLtoT->Inverse());
+ delete matLtoT;
+ alignableEntry->SetMatrix(matTtoL);
+ }
+ }
+ }
+}
+//______________________________________________________________________
void AliITSvPPRasymmFMD::BuildGeometry(){
// Geometry builder for the ITS version 10. Event Display geometry.
// Inputs:
Float_t dbus=300.; // total bus thickness on both layers (micron)
+ // 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$";
+
ddet1 = GetThicknessDet1();
ddet2 = GetThicknessDet2();
dchip1 = GetThicknessChip1();
}// end if
- AliInfo(Form("Detector thickness on layer 1 is set to %f microns",ddet1));
- AliInfo(Form("Chip thickness on layer 1 is set to %f microns",dchip1));
- AliInfo(Form("Detector thickness on layer 2 is set to %f microns",ddet2));
- AliInfo(Form("Chip thickness on layer 2 is set to %f microns",dchip2));
+ AliDebug(1,Form("Detector thickness on layer 1 is set to %f microns",ddet1));
+ AliDebug(1,Form("Chip thickness on layer 1 is set to %f microns",dchip1));
+ AliDebug(1,Form("Detector thickness on layer 2 is set to %f microns",ddet2));
+ AliDebug(1,Form("Chip thickness on layer 2 is set to %f microns",dchip2));
if(rails == 0 ) {
- AliInfo("Rails are out.");
+ AliDebug(1,"Rails are out.");
} else {
- AliInfo("Rails are in.");
+ AliDebug(1,"Rails are in.");
}// end if
ddet1 = ddet1*0.0001/2.; // conversion from tot length in um to half in cm
ztpc = 284.;
// --- Define ghost volume containing the whole ITS (including services)
// and fill it with air
- dgh[0] = 0.;
- dgh[1] = 360.;
- dgh[2] = 16.;
- dgh[3] = -ztpc-5.-0.1;
- dgh[4] = 46;
- dgh[5] = 85.;
- dgh[6] = -ztpc;
- dgh[7] = 46;
- dgh[8] = 85.;
- dgh[9] = -ztpc;
- dgh[10] = 46;
- dgh[11] = rlim+7.5;
- dgh[12] = -97.5;
- dgh[13] = 46;
- dgh[14] = rlim+7.5;
- dgh[15] = -zmax;
- dgh[16] = 46;
- dgh[17] = rlim+7.5;
- dgh[18] = -48;
- dgh[19] = 6;
- dgh[20] = rlim+7.5;
- dgh[21] = -28.6;
- dgh[22] = 6;
- dgh[23] = rlim+7.5;
- dgh[24] = -27.6;
- dgh[25] = 3.295;
- dgh[26] = rlim+7.5;
- dgh[27] = 27.6;
- dgh[28] = 3.295;
- dgh[29] = rlim+7.5;
- dgh[30] = 28.6;
- dgh[31] = 6;
- dgh[32] = rlim+7.5;
- dgh[33] = 48;
- dgh[34] = 6;
- dgh[35] = rlim+7.5;
- dgh[36] = zmax;
- dgh[37] = 46;
- dgh[38] = rlim+7.5;
- dgh[39] = 97.5;
- dgh[40] = 46;
- dgh[41] = rlim+7.5;
- dgh[42] = ztpc;
- dgh[43] = 62;
- dgh[44] = 62+4.;
- dgh[45] = ztpc;
- dgh[46] = 62;
- dgh[47] = 85.;
- dgh[48] = ztpc+4.+0.1;
- dgh[49] = 62.0;//62.4;
- dgh[50] = 85.;
- gMC->Gsvolu("ITSV", "PCON", idtmed[205], dgh, 51);
+// dgh[0] = 0.;
+// dgh[1] = 360.;
+// dgh[2] = 16.;
+// dgh[3] = -ztpc-5.-0.1;
+// dgh[4] = 46;
+// dgh[5] = 85.;
+// dgh[6] = -ztpc;
+// dgh[7] = 46;
+// dgh[8] = 85.;
+// dgh[9] = -ztpc;
+// dgh[10] = 46;
+// dgh[11] = rlim+7.5;
+// dgh[12] = -97.5;
+// dgh[13] = 46;
+// dgh[14] = rlim+7.5;
+// dgh[15] = -zmax;
+// dgh[16] = 46;
+// dgh[17] = rlim+7.5;
+// dgh[18] = -48;
+// dgh[19] = 6;
+// dgh[20] = rlim+7.5;
+// dgh[21] = -28.6;
+// dgh[22] = 6;
+// dgh[23] = rlim+7.5;
+// dgh[24] = -27.6;
+// dgh[25] = 3.295;
+// dgh[26] = rlim+7.5;
+// dgh[27] = 27.6;
+// dgh[28] = 3.295;
+// dgh[29] = rlim+7.5;
+// dgh[30] = 28.6;
+// dgh[31] = 6;
+// dgh[32] = rlim+7.5;
+// dgh[33] = 48;
+// dgh[34] = 6;
+// dgh[35] = rlim+7.5;
+// dgh[36] = zmax;
+// dgh[37] = 46;
+// dgh[38] = rlim+7.5;
+// dgh[39] = 97.5;
+// dgh[40] = 46;
+// dgh[41] = rlim+7.5;
+// dgh[42] = ztpc;
+// dgh[43] = 62;
+// dgh[44] = 62+4.;
+// dgh[45] = ztpc;
+// dgh[46] = 62;
+// dgh[47] = 85.;
+// dgh[48] = ztpc+4.+0.1;
+// dgh[49] = 62.0;//62.4;
+// dgh[50] = 85.;
+// gMC->Gsvolu("ITSV", "PCON", idtmed[205], dgh, 51);
+ TGeoVolumeAssembly *itsV = gGeoManager->MakeVolumeAssembly("ITSV");
+ const Int_t length=100;
+ Char_t vstrng[length];
+ if(fIgm.WriteVersionString(vstrng,length,(AliITSVersion_t)IsVersion(),
+ fMinorVersion,cvsDate,cvsRevision))
+ itsV->SetTitle(vstrng);
+
// --- Place the ghost volume in its mother volume (ALIC) and make it
// invisible
- // gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., 0, "ONLY");
- gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., idrotm[199], "MANY");
- //gMC->Gsatt("ITSV", "SEEN", 0);
+ // gMC->Gspos("ITSV", 1, "ALIC", 0., 0., 0., idrotm[199], "MANY");
+ TGeoVolume *alic = gGeoManager->GetVolume("ALIC");
+ if(alic==0) {
+ Error("CreateGeometry","alic=0");
+ return;
+ } // end if
+ // See idrotm[199] for angle definitions.
+ alic->AddNode(itsV,1,new TGeoRotation("", 90.,180., 90.,90., 180.,0.));
// --- Define ghost volume containing the six layers and fill it with air
gMC->Gspos("I116",1,"I113",0.0,0.0042,0.0,0,"ONLY");
gMC->Gspos("I111",1,"I113",-0.1318,-0.0008,0.0,idrotm[204],"ONLY");
gMC->Gspos("I112",1,"I113",-0.25,0.02,0.0,idrotm[203],"ONLY");
- gMC->Gspos("I106",1,"I107",0.0,-dchip1,-1.4,0,"ONLY");
- gMC->Gspos("I106",2,"I107",0.0,-dchip1,0.0,0,"ONLY");
- gMC->Gspos("I106",3,"I107",0.0,-dchip1,1.4,0,"ONLY");
- gMC->Gspos("I106",4,"I107",0.0,-dchip1,2.8,0,"ONLY");
- gMC->Gspos("I106",5,"I107",0.0,-dchip1,-2.8,0,"ONLY");
- gMC->Gspos("I101",1,"I107",0.0,ddet1,0.0,0,"ONLY");
- gMC->Gspos("I1D6",1,"I1D7",0.0,-dchip2,-1.4,0,"ONLY");
- gMC->Gspos("I1D6",2,"I1D7",0.0,-dchip2,0.0,0,"ONLY");
- gMC->Gspos("I1D6",3,"I1D7",0.0,-dchip2,1.4,0,"ONLY");
- gMC->Gspos("I1D6",4,"I1D7",0.0,-dchip2,2.8,0,"ONLY");
- gMC->Gspos("I1D6",5,"I1D7",0.0,-dchip2,-2.8,0,"ONLY");
- gMC->Gspos("I1D1",1,"I1D7",0.0,ddet2,0.0,0,"ONLY");
+ gMC->Gspos("I106",1,"I107",0.0,-ddet1,-1.4,0,"ONLY");
+ gMC->Gspos("I106",2,"I107",0.0,-ddet1,0.0,0,"ONLY");
+ gMC->Gspos("I106",3,"I107",0.0,-ddet1,1.4,0,"ONLY");
+ gMC->Gspos("I106",4,"I107",0.0,-ddet1,2.8,0,"ONLY");
+ gMC->Gspos("I106",5,"I107",0.0,-ddet1,-2.8,0,"ONLY");
+ gMC->Gspos("I101",1,"I107",0.0,dchip1,0.0,0,"ONLY");
+ gMC->Gspos("I1D6",1,"I1D7",0.0,-ddet2,-1.4,0,"ONLY");
+ gMC->Gspos("I1D6",2,"I1D7",0.0,-ddet2,0.0,0,"ONLY");
+ gMC->Gspos("I1D6",3,"I1D7",0.0,-ddet2,1.4,0,"ONLY");
+ gMC->Gspos("I1D6",4,"I1D7",0.0,-ddet2,2.8,0,"ONLY");
+ gMC->Gspos("I1D6",5,"I1D7",0.0,-ddet2,-2.8,0,"ONLY");
+ gMC->Gspos("I1D1",1,"I1D7",0.0,dchip2,0.0,0,"ONLY");
gMC->Gspos("I117",1,"I116",0.0,0.0,0.0,0,"ONLY");
gMC->Gspos("ITS1",1,"I101",0.0,0.0,0.0,0,"ONLY");
gMC->Gspos("ITS2",1,"I1D1",0.0,0.0,0.0,0,"ONLY");
// none.
const Int_t knlayers = 6;
const Int_t kndeep = 3;
- const AliITSDetector idet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
- const TString names[2][knlayers] = {
+ const AliITSDetector kidet[knlayers]={kSPD,kSPD,kSDD,kSDD,kSSD,kSSD};
+ const TString knames[2][knlayers] = {
{"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I10A_%d/I103_%d/I101_1/ITS1_1", // lay=1
"/ALIC_1/ITSV_1/ITSD_1/IT12_1/I12A_%d/I20A_%d/I1D3_%d/I1D1_1/ITS2_1", // lay=2
"/ALIC_1/ITSV_1/ITSD_1/IT34_1/I004_%d/I302_%d/ITS3_%d", // lay=3
"/ALIC_1/ITSV_1/ITSD_1/IT56_1/I565_%d/I562_%d/ITS5_%d", // lay=5
"/ALIC_1/ITSV_1/ITSD_1/IT56_1/I569_%d/I566_%d/ITS6_%d"}
};
- const Int_t itsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
+ const Int_t kitsGeomTreeCopys[knlayers][kndeep]= {{10, 2, 4},// lay=1
{10, 4, 4},// lay=2
{14, 6, 1},// lay=3
{22, 8, 1},// lay=4
mod = 0;
for(i=0;i<knlayers;i++){
k = 1;
- for(j=0;j<kndeep;j++) if(itsGeomTreeCopys[i][j]!=0)
- k *= TMath::Abs(itsGeomTreeCopys[i][j]);
+ for(j=0;j<kndeep;j++) if(kitsGeomTreeCopys[i][j]!=0)
+ k *= TMath::Abs(kitsGeomTreeCopys[i][j]);
mod += k;
} // end for i
SetITSgeom(geom);
mod = 0;
for(lay=1;lay<=knlayers;lay++){
- for(cp0=1;cp0<=itsGeomTreeCopys[lay-1][0];cp0++){
- for(cp1=1;cp1<=itsGeomTreeCopys[lay-1][1];cp1++){
- for(cp2=1;cp2<=itsGeomTreeCopys[lay-1][2];cp2++){
- path.Form(names[fMinorVersion-1][lay-1].Data(),
+ for(cp0=1;cp0<=kitsGeomTreeCopys[lay-1][0];cp0++){
+ for(cp1=1;cp1<=kitsGeomTreeCopys[lay-1][1];cp1++){
+ for(cp2=1;cp2<=kitsGeomTreeCopys[lay-1][2];cp2++){
+ path.Form(knames[fMinorVersion-1][lay-1].Data(),
cp0,cp1,cp2);
switch (lay){
case 1:{
gMC->GetShape(path.Data(),shapeName,shapePar);
shapeParF.Set(shapePar.GetSize());
for(i=0;i<shapePar.GetSize();i++) shapeParF[i]=shapePar[i];
- geom->CreateMatrix(mod,lay,lad,det,idet[lay-1],trans,rot);
+ geom->CreateMatrix(mod,lay,lad,det,kidet[lay-1],trans,rot);
geom->SetTrans(mod,materix.GetTranslation());
geom->SetRotMatrix(mod,materix.GetRotationMatrix());
geom->GetGeomMatrix(mod)->SetPath(path.Data());
// Return:
// none.
- AliInfo(Form("Init: Major version %d Minor version %d",fMajorVersion,
+ AliDebug(1,Form("Init: Major version %d Minor version %d",fMajorVersion,
fMinorVersion));
//
+ /* obsolete initialization of AliITSgeom from external "det" file
if(fRead[0]=='\0') strncpy(fRead,fEuclidGeomDet,60);
if(fWrite[0]=='\0') strncpy(fWrite,fEuclidGeomDet,60);
AliITSgeom* geom = new AliITSgeom();
SetITSgeom(geom);
if(fGeomDetIn) GetITSgeom()->ReadNewFile(fRead);
else this->InitAliITSgeom();
- if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
+ */
+ UpdateInternalGeometry();
AliITS::Init();
+ if(fGeomDetOut) GetITSgeom()->WriteNewFile(fWrite);
+
//
fIDMother = gMC->VolId("ITSV"); // ITS Mother Volume ID.
}
gMC->Gdhead(1111, "Inner Tracking System Version 1");
gMC->Gdman(17, 6, "MAN");
}
+/*
//______________________________________________________________________
void AliITSvPPRasymmFMD::StepManager(){
// Called for every step in the ITS, then calles the AliITShit class
return;
}
+
+*/
+//______________________________________________________________________
+void AliITSvPPRasymmFMD::StepManager(){
+ // Called for every step in the ITS, then calles the AliITShit class
+ // creator with the information to be recoreded about that hit.
+ // The value of the macro ALIITSPRINTGEOM if set to 1 will allow the
+ // printing of information to a file which can be used to create a .det
+ // file read in by the routine CreateGeometry(). If set to 0 or any other
+ // value except 1, the default behavior, then no such file is created nor
+ // it the extra variables and the like used in the printing allocated.
+ // Inputs:
+ // none.
+ // Outputs:
+ // none.
+ // Return:
+ // none.
+
+ if(!(this->IsActive())) return;
+ if(!(gMC->TrackCharge())) return;
+
+ Int_t copy, id,kk;
+ Bool_t sensvol = kFALSE;
+
+ id = gMC->CurrentVolID(copy);
+ for(kk=0;kk<fIdN;kk++)if(id == fIdSens[kk]){
+ sensvol=kTRUE;
+ break;
+ } // end for if
+ if(sensvol && (gMC->IsTrackExiting())){
+ copy = fTrackReferences->GetEntriesFast();
+ TClonesArray &lTR = *fTrackReferences;
+ // Fill TrackReference structure with this new TrackReference.
+ new(lTR[copy]) AliTrackReference(
+ gAlice->GetMCApp()->GetCurrentTrackNumber());
+ } // if Outer ITS mother Volume
+ //if(!sensvol) return; // not an ITS tracking volume;
+
+ static TLorentzVector position, momentum; // Saves on calls to construtors
+ static AliITShit hit;// Saves on calls to construtors
+ Int_t cpn0,cpn1,cpn2,status,mod;
+ //TClonesArray &lhits = *(GetDetTypeSim()->GetHits());
+ 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;
+ //
+ switch (kk){
+ case 0:case 1: // SPD
+ gMC->CurrentVolOffID(2,cpn2);
+ gMC->CurrentVolOffID(3,cpn1);
+ gMC->CurrentVolOffID(4,cpn0);
+ break;
+ case 2:case 3: // SDD
+ cpn2 = 1;
+ gMC->CurrentVolOffID(1,cpn1);
+ gMC->CurrentVolOffID(2,cpn0);
+ break;
+ case 4:case 5: // SSD
+ cpn2 = 1;
+ gMC->CurrentVolOffID(1,cpn1);
+ gMC->CurrentVolOffID(2,cpn0);
+ break;
+ default:
+ Error("StepManager","Unknown volume kk=%d",kk);
+ return; // not an ITS sensitive volume.
+ } //
+ fIgm.DecodeDetector(mod,kk+1,cpn0,cpn1,cpn2);
+ //Info("StepManager","lay=%d mod=%d cpn0=%d cpn1=%d cpn2=%d",kk+1,mod,cpn0,cpn1,cpn2);
+ Int_t lay,lad,det,cpy0,cpy1,cpy2;
+ fIgm.DecodeDetectorLayers(mod,lay,lad,det);
+ fIgm.RecodeDetector(mod,cpy0,cpy1,cpy2);
+// printf("gMC: kk=%d cpn0=%d cpn1=%d cpn2=%d -> mod=%d -> "
+// "lay=%d lad=%d det=%d -> cpn0=%d cpn1=%d cpn2=%d\n",
+// kk,cpn0,cpn1,cpn2,mod,lay,lad,det,cpy0,cpy1,cpy2);
+ //
+ // 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.
+ //Info("StepManager","Calling Copy Constructor");
+ new(lhits[fNhits++]) AliITShit(hit); // Use Copy Construtor.
+ // Save old position... for next hit.
+ hit.SetStartPosition(position);
+ hit.SetStartTime(gMC->TrackTime());
+ hit.SetStartStatus(status);
+ //
+ /*
+ Int_t idettype,ix,iz;
+ Float_t lx,lz;
+ 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
+ switch(idettype=(Int_t)GetITSgeom()->GetModuleType(mod)){
+ case kSPD:
+ AliITSsegmentationSPD *segspd = (AliITSsegmentationSPD *)GetSegmentationModelByModule(mod);
+ segspd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
+ segspd->DetToLocal(ix,iz,lx,lz);
+ break;
+ case kSDD:
+ AliITSsegmentationSDD *segsdd = (AliITSsegmentationSDD *)GetSegmentationModelByModule(mod);
+ segsdd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
+ segsdd->DetToLocal(ix,iz,lx,lz);
+ break;
+ case kSSD:
+ AliITSsegmentationSSD *segssd = (AliITSsegmentationSSD *)GetSegmentationModelByModule(mod);
+ segssd->LocalToDet((Float_t)l0[0],(Float_t)l0[2],ix,iz);
+ segssd->DetToLocal(ix,iz,lx,lz);
+ break;
+ default:
+ ix = iz = -1;
+ lx = lz = 0.0;
+ Warning("StepManager","Unknown module type id=%d mod=%d",
+ (Int_t)(GetITSgeom()->GetModuleType(mod)),mod);
+ } // end if
+ printf(" gMC: mod=%d g=%g %g %g %g -> "
+ "l=%g %g %g %g -> "
+ "g=%g %g %g %g -> "
+ "ix=%d iz=%d -> lx=%g lz=%g\n",
+ mod,g0[0],g0[1],g0[2],g0[3],
+ l0[0],l0[1],l0[2],l0[3],
+ g1[0],g1[1],g1[2],g1[3],ix,iz,lx,lz);
+ 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 -> "
+ "ix=%d iz=%d -> lx=%g lz=%g\n",
+ mod,g0[0],g0[1],g0[2],g0[3],
+ l0[0],l0[1],l0[2],l0[3],
+ g1[0],g1[1],g1[2],g1[3],ix,iz,lx,lz);
+ 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[1],g1[2],g1[3]);
+ printf("=====================\n");
+ //
+ */
+ return;
+}
+//______________________________________________________________________
+void AliITSvPPRasymmFMD::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 << " " << fByThick << " ";
+ *os << fMajorVersion << " " << fMinorVersion << " ";
+ *os << "\"" << fEuclidGeomDet.Data() << "\"" << " ";
+ *os << "\"" << fRead.Data() << "\"" << " ";
+ *os << "\"" << fWrite.Data() << "\"" << " ";
+ fmt = os->setf(ios::scientific); // set scientific floating point output
+ *os << fDet1 << " " << fDet2 << " " << fChip1 << " " << fChip2 << " ";
+ *os << fRails << " " << fFluid << " " << fIDMother;
+ os->flags(fmt); // reset back to old Formating.
+ return;
+}
+//______________________________________________________________________
+void AliITSvPPRasymmFMD::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 >> fByThick;
+ *is >> fMajorVersion >> fMinorVersion;
+ *is >> name;
+ fEuclidGeomDet = name;
+ *is >> name;
+ fRead = name;
+ *is >> name;
+ fWrite = name;
+ *is >> fDet1 >> fDet2 >> fChip1 >> fChip2;
+ *is >> fRails >> fFluid >> fIDMother;
+ fIgm.SetVersion((AliITSVersion_t)fMajorVersion,fMinorVersion);
+ fIgm.SetGeometryName("ITS PPR aymmetric services with course"
+ " cables on cones");
+}
+//______________________________________________________________________
+ostream &operator<<(ostream &os,const AliITSvPPRasymmFMD &s){
+ // Standard output streaming function
+ // Inputs:
+ // ostream &os output steam
+ // AliITSvPPRasymmFMD &s class to be streamed.
+ // Output:
+ // none.
+ // Return:
+ // ostream &os The stream pointer
+
+ s.PrintAscii(&os);
+ return os;
+}
+//______________________________________________________________________
+istream &operator>>(istream &is,AliITSvPPRasymmFMD &s){
+ // Standard inputput streaming function
+ // Inputs:
+ // istream &is input steam
+ // AliITSvPPRasymmFMD &s class to be streamed.
+ // Output:
+ // none.
+ // Return:
+ // ostream &os The stream pointer
+
+ s.ReadAscii(&is);
+ return is;
+}