#include <TGeometry.h>
#include <TLorentzVector.h>
#include <TGeoMatrix.h>
+#include <TGeoPhysicalNode.h>
#include <TArrayD.h>
#include <TArrayF.h>
#include <TString.h>
strncpy(fRead,"$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det",60);
}
//______________________________________________________________________
-AliITSvPPRasymmFMD::AliITSvPPRasymmFMD(const AliITSvPPRasymmFMD &source) :
- AliITS(source),
- fGeomDetOut(kFALSE),
- fGeomDetIn(kFALSE),
- fByThick(kTRUE),
- fMajorVersion(IsVersion()),
- fMinorVersion(2),
- fDet1(0),
- fDet2(0),
- fChip1(0),
- fChip2(0),
- fRails(0),
- fFluid(0),
- fIDMother(0) {
- // 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.
- // Inputs:
- // const AliITSvPPRasymmFMD &source This class
- // Outputs:
- // none.
- // Return:
- // an error message
-
- if(&source == this) return;
- Warning("Copy Constructor","Not allowed to copy AliITSvPPRasymmFMD");
- return;
-}
-//______________________________________________________________________
-AliITSvPPRasymmFMD& AliITSvPPRasymmFMD::operator=(const AliITSvPPRasymmFMD
- &source){
- // Assignment operator for the 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.
- // Inputs:
- // const AliITSvPPRasymmFMD &source This class
- // Outputs:
- // none.
- // Return:
- // an error message
-
- if(&source == this) return *this;
- Warning("= operator","Not allowed to copy AliITSvPPRasymmFMD");
- return *this;
-}
-//______________________________________________________________________
AliITSvPPRasymmFMD::~AliITSvPPRasymmFMD() {
// Standard destructor for the ITS version 10.
// Inputs:
// Return:
// none.
}
-
//______________________________________________________________________
void AliITSvPPRasymmFMD::AddAlignableVolumes() const
{
//
- // Create entries for alignable volumes associating the symbolic volume
+ // 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) {
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";
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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
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);
}
}
}
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.
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");
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.
}