/* History of cvs commits:
*
* $Log$
+ * Revision 1.94 2007/10/18 08:40:02 kharlov
+ * Misalignment-related bug fixed
+ *
+ * Revision 1.93 2007/10/06 22:24:40 kharlov
+ * Bug in strip unit geometry is corrected
+ *
* Revision 1.92 2007/07/04 16:38:19 policheh
* Tracking2LocalCS matrices corrected for CPV.
*
#include <TVirtualMC.h>
#include <TGeoPhysicalNode.h>
#include <TGeoManager.h>
+#include <TGeoMatrix.h>
#include <TVector3.h>
// --- Standard library ---
#include "AliPHOSv0.h"
#include "AliRun.h"
#include "AliLog.h"
+#include "AliGeomManager.h"
ClassImp(AliPHOSv0)
this->CreateGeometryforSupport() ;
// --- Position PHOS mdules in ALICE setup ---
-
Int_t idrotm[99] ;
Int_t iXYZ,iAngle;
- for (Int_t iModule = 0; iModule < geom->GetNModules(); iModule++ ) {
-
+ char im[5] ;
+ Bool_t anyModuleCreated=0 ;
+ for (Int_t iModule = 0; iModule < 5 ; iModule++ ) {
+ sprintf(im,"%d",iModule+1) ;
+ if(strstr(GetTitle(),im)==0 && strcmp(GetTitle(),"IHEP")!=0 && strcmp(GetTitle(),"noCPV")!=0)
+ continue ;
+ anyModuleCreated=1 ;
Float_t angle[3][2];
for (iXYZ=0; iXYZ<3; iXYZ++)
for (iAngle=0; iAngle<2; iAngle++)
gMC->Gspos("PHOS", iModule+1, "ALIC", pos[0], pos[1], pos[2],
idrotm[iModule], "ONLY") ;
}
-
+ if(!anyModuleCreated)
+ AliError("No one PHOS module was created") ;
}
//____________________________________________________________________________
gMC->Gspos("PBE1", isup, "PCA1", x, 0.0, 0.0, 0, "ONLY") ;
}
- z = -warmthermo[2] + cbox[2] ;
+ z = -warmthermo[2] + cbox[2];
gMC->Gspos("PCA1", 1, "PWTI", 0.0, 0.0, z, 0, "ONLY") ;
gMC->Gsvolu("PCA2", "BOX ", idtmed[718], emcg->GetTCables2HalfSize(), 3) ;
gMC->Gspos("PFG1", 2, "PWTI", posit[0], -posit[1], posit[2], 0, "ONLY") ;
gMC->Gsvolu("PFG2", "BOX ", idtmed[717], emcg->GetFGupZHalfSize(), 3) ;
- posit = emcg->GetFGupZPosition() ;
+ posit = emcg->GetFGupZPosition();
gMC->Gspos("PFG2", 1, "PWTI", posit[0], posit[1], posit[2], 0, "ONLY") ;
gMC->Gspos("PFG2", 2, "PWTI", -posit[0], posit[1], posit[2], 0, "ONLY") ;
// Alignable modules
// Volume path /ALIC_1/PHOS_<i> => symbolic name /PHOS/Module<i>, <i>=1,2,3,4,5
-
+
+ AliGeomManager::ELayerID idPHOS1 = AliGeomManager::kPHOS1;
+ AliGeomManager::ELayerID idPHOS2 = AliGeomManager::kPHOS2;
+ Int_t modUID, modnum = 0;
TString physModulePath="/ALIC_1/PHOS_";
TString symbModuleName="PHOS/Module";
Int_t nModules = GetGeometry()->GetNModules();
+ char im[5] ;
for(Int_t iModule=1; iModule<=nModules; iModule++){
+ sprintf(im,"%d",iModule) ;
+ if(strstr(GetTitle(),im)==0 && strcmp(GetTitle(),"IHEP")!=0 && strcmp(GetTitle(),"noCPV")!=0)
+ continue ;
+ modUID = AliGeomManager::LayerToVolUID(idPHOS1,modnum++);
volpath = physModulePath;
volpath += iModule;
- volpath += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1";
-
+ // volpath += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1";
+
+ // Check the volume path if not all 5 modules exist
+ if (!gGeoManager->CheckPath(volpath.Data())) {
+ AliError(Form("Volume path %s not valid!",volpath.Data()));
+ continue;
+ }
+
symname = symbModuleName;
symname += iModule;
- gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+ if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
+ continue ;
+// AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
// Creates the Tracking to Local transformation matrix for PHOS modules
- TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
- const char *path = alignableEntry->GetTitle();
- if (!gGeoManager->cd(path))
- AliFatal(Form("Volume path %s not valid!",path));
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
Float_t angle = GetGeometry()->GetPHOSAngle(iModule);
- TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
TGeoHMatrix *matTtoL = new TGeoHMatrix;
matTtoL->RotateZ(-90.+angle);
//Aligning of CPV should be done for volume PCPV_1
symbModuleName="PHOS/Module";
+ modnum=0;
for(Int_t iModule=1; iModule<=nModules; iModule++){
+ if(strstr(GetTitle(),"noCPV"))
+ continue ;
+ sprintf(im,"%d",iModule) ;
+ if(strstr(GetTitle(),im)==0 && strcmp(GetTitle(),"IHEP")!=0)
+ continue ;
+ modUID = AliGeomManager::LayerToVolUID(idPHOS2,modnum++);
volpath = physModulePath;
volpath += iModule;
volpath += "/PCPV_1";
symname = symbModuleName;
symname += iModule;
symname += "/CPV";
- gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data());
+ if(!gGeoManager->SetAlignableEntry(symname.Data(),volpath.Data(),modUID))
+ AliFatal(Form("Alignable entry %s not created. Volume path %s not valid", symname.Data(),volpath.Data()));
// Creates the TGeo Local to Tracking transformation matrix ...
- TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntry(symname.Data()) ;
- const char *path = alignableEntry->GetTitle();
- if (!gGeoManager->cd(path))
- AliFatal(Form("Volume path %s not valid!",path));
+ TGeoPNEntry *alignableEntry = gGeoManager->GetAlignableEntryByUID(modUID) ;
Float_t angle = GetGeometry()->GetPHOSAngle(iModule);
- TGeoHMatrix* globMatrix = gGeoManager->GetCurrentMatrix();
+ TGeoHMatrix* globMatrix = alignableEntry->GetGlobalOrig();
TGeoHMatrix *matTtoL = new TGeoHMatrix;
matTtoL->RotateZ(-90.+angle);
TString fullSymbStripName(100);
for(Int_t module = 1; module <= nModules; ++module){
+
+ sprintf(im,"%d",module) ;
+ if(strstr(GetTitle(),im)==0 && strcmp(GetTitle(),"IHEP")!=0 && strcmp(GetTitle(),"noCPV")!=0)
+ continue ;
+
+ volpath = physModulePath;
+ volpath += module;
+ // Check the volume path if not all 5 modules exist
+ if (!gGeoManager->CheckPath(volpath.Data())) {
+ AliError(Form("Volume path %s does not exist",volpath.Data())) ;
+ continue;
+ }
+
partialPhysStripName = physModulePath;
partialPhysStripName += module;
partialPhysStripName += "/PEMC_1/PCOL_1/PTIO_1/PCOR_1/PAGA_1/PTII_1/PSTR_";