X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSGeometry.cxx;h=302456a0f8daeea5e19e55cd3e6234bd2b4f3208;hb=94256c234ed702deab6d41d77254f94e75752e65;hp=d7739d994f146ca832e1d4f9e970296cefcb456a;hpb=eb92d8663ef142b67884a1752e3d5c14220d73a2;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSGeometry.cxx b/PHOS/AliPHOSGeometry.cxx index d7739d994f1..302456a0f8d 100644 --- a/PHOS/AliPHOSGeometry.cxx +++ b/PHOS/AliPHOSGeometry.cxx @@ -17,28 +17,36 @@ //_________________________________________________________________________ // Geometry class for PHOS : singleton -// The EMC modules are parametrized so that any configuration can be easily implemented -// The title is used to identify the type of CPV used. +// PHOS consists of the electromagnetic calorimeter (EMCA) +// and a charged particle veto either in the Subatech's version (PPSD) +// or in the IHEP's one (CPV). +// The EMCA/PPSD/CPV modules are parametrized so that any configuration +// can be easily implemented +// The title is used to identify the version of CPV used. // -//*-- Author: Yves Schutz (SUBATECH) +//*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC "KI" & SUBATECH) // --- ROOT system --- #include "TVector3.h" #include "TRotation.h" +#include "TFolder.h" +#include "TROOT.h" // --- Standard library --- -#include +#include // --- AliRoot header files --- #include "AliPHOSGeometry.h" -#include "AliPHOSPpsdRecPoint.h" +#include "AliPHOSEMCAGeometry.h" +#include "AliPHOSRecPoint.h" #include "AliConst.h" ClassImp(AliPHOSGeometry) ; +// these initialisations are needed for a singleton AliPHOSGeometry * AliPHOSGeometry::fgGeom = 0 ; Bool_t AliPHOSGeometry::fgInit = kFALSE ; @@ -49,51 +57,69 @@ AliPHOSGeometry::~AliPHOSGeometry(void) if (fRotMatrixArray) fRotMatrixArray->Delete() ; if (fRotMatrixArray) delete fRotMatrixArray ; - if (fPHOSAngle ) delete fPHOSAngle ; -// if (fGeometryEMCA ) detete fGeometryEMCA; -// if (fGeometryCPV ) detete fGeometryCPV ; + if (fPHOSAngle ) delete[] fPHOSAngle ; } - //____________________________________________________________________________ void AliPHOSGeometry::Init(void) { - // Initializes the PHOS parameters - - cout << "PHOS geometry setup: parameters for option " << fName << " " << fTitle << endl ; - if ( ((strcmp( fName, "default" )) == 0) || - ((strcmp( fName, "GPS2" )) == 0) || - ((strcmp( fName, "IHEP" )) == 0) ) { - fgInit = kTRUE ; - fGeometryEMCA = new AliPHOSEMCAGeometry(); - if ( ((strcmp( fName, "GPS2" )) == 0) ) fGeometryCPV = new AliPHOSPPSDGeometry(); - if ( ((strcmp( fName, "IHEP" )) == 0) ) fGeometryCPV = new AliPHOSCPVGeometry (); - fNModules = 5; - fPHOSAngle = new Float_t[fNModules] ; - Int_t index ; - for ( index = 0; index < fNModules; index++ ) - fPHOSAngle[index] = 0.0 ; // Module position angles are set in CreateGeometry() - - this->SetPHOSAngles() ; - fRotMatrixArray = new TObjArray(fNModules) ; + // Initializes the PHOS parameters : + // IHEP is the Protvino CPV (cathode pad chambers) + // GPS2 is the Subatech Pre-Shower (two micromegas sandwiching a passive lead converter) + // MIXT 4 PHOS modules withe the IHEP CPV and one PHOS module with the Subatech Pre-Shower + + TString test(GetName()) ; + if (test != "IHEP" && test != "GPS2" && test != "MIXT") { + Fatal("Init", "%s is not a known geometry (choose among IHEP, GPS2 and MIXT)", test.Data() ) ; } - else { - fgInit = kFALSE ; - cout << "PHOS Geometry setup: option not defined " << fName << endl ; - } + + fgInit = kTRUE ; + + fNModules = 5; + fAngle = 20; + + fGeometryEMCA = new AliPHOSEMCAGeometry(); + + fGeometryCPV = new AliPHOSCPVGeometry (); + + fGeometrySUPP = new AliPHOSSupportGeometry(); + + fPHOSAngle = new Float_t[fNModules] ; + + Float_t * emcParams = fGeometryEMCA->GetEMCParams() ; + + fPHOSParams[0] = TMath::Max((Double_t)fGeometryCPV->GetCPVBoxSize(0)/2., + (Double_t)(emcParams[0]*(fGeometryCPV->GetCPVBoxSize(1)+emcParams[3]) - + emcParams[1]* fGeometryCPV->GetCPVBoxSize(1))/emcParams[3] ) ; + fPHOSParams[1] = emcParams[1] ; + fPHOSParams[2] = TMath::Max((Double_t)emcParams[2], (Double_t)fGeometryCPV->GetCPVBoxSize(2)/2.); + fPHOSParams[3] = emcParams[3] + fGeometryCPV->GetCPVBoxSize(1)/2. ; + + fIPtoUpperCPVsurface = fGeometryEMCA->GetIPtoOuterCoverDistance() - fGeometryCPV->GetCPVBoxSize(1) ; + + Int_t index ; + for ( index = 0; index < fNModules; index++ ) + fPHOSAngle[index] = 0.0 ; // Module position angles are set in CreateGeometry() + + this->SetPHOSAngles() ; + fRotMatrixArray = new TObjArray(fNModules) ; + } //____________________________________________________________________________ AliPHOSGeometry * AliPHOSGeometry::GetInstance() { - // Returns the pointer of the unique instance - return (AliPHOSGeometry *) fgGeom ; + // Returns the pointer of the unique instance; singleton specific + + return static_cast( fgGeom ) ; } //____________________________________________________________________________ AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t* title) { // Returns the pointer of the unique instance + // Creates it with the specified options (name, title) if it does not exist yet + AliPHOSGeometry * rv = 0 ; if ( fgGeom == 0 ) { if ( strcmp(name,"") == 0 ) @@ -110,10 +136,8 @@ AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t } } else { - if ( strcmp(fgGeom->GetName(), name) != 0 ) { - cout << "AliPHOSGeometry : current geometry is " << fgGeom->GetName() << endl - << " you cannot call " << name << endl ; - } + if ( strcmp(fgGeom->GetName(), name) != 0 ) + ::Error("GetInstance", "Current geometry is %s. You cannot call %s", fgGeom->GetName(), name) ; else rv = (AliPHOSGeometry *) fgGeom ; } @@ -123,69 +147,63 @@ AliPHOSGeometry * AliPHOSGeometry::GetInstance(const Text_t* name, const Text_t //____________________________________________________________________________ void AliPHOSGeometry::SetPHOSAngles() { - // Calculates the position in ALICE of the PHOS modules + // Calculates the position of the PHOS modules in ALICE global coordinate system Double_t const kRADDEG = 180.0 / kPI ; - Float_t pphi = TMath::ATan( GetOuterBoxSize(0) / ( 2.0 * GetIPtoOuterCoverDistance() ) ) ; + Float_t pphi = 2 * TMath::ATan( GetOuterBoxSize(0) / ( 2.0 * GetIPtoUpperCPVsurface() ) ) ; pphi *= kRADDEG ; + if (pphi > fAngle){ + Error("SetPHOSAngles", "PHOS modules overlap!\n pphi = %f fAngle = %f", pphi, fAngle); + + } + pphi = fAngle; for( Int_t i = 1; i <= fNModules ; i++ ) { - Float_t angle = pphi * 2 * ( i - fNModules / 2.0 - 0.5 ) ; + Float_t angle = pphi * ( i - fNModules / 2.0 - 0.5 ) ; fPHOSAngle[i-1] = - angle ; } } //____________________________________________________________________________ -Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid) +Bool_t AliPHOSGeometry::AbsToRelNumbering(const Int_t AbsId, Int_t * relid) const { // Converts the absolute numbering into the following array/ // relid[0] = PHOS Module number 1:fNModules // relid[1] = 0 if PbW04 - // = PPSD Module number 1:fNumberOfModulesPhi*fNumberOfModulesZ*2 (2->up and bottom level) - // relid[2] = Row number inside a PHOS or PPSD module - // relid[3] = Column number inside a PHOS or PPSD module + // = -1 if CPV + // relid[2] = Row number inside a PHOS module + // relid[3] = Column number inside a PHOS module Bool_t rv = kTRUE ; Float_t id = AbsId ; - Int_t phosmodulenumber = (Int_t)TMath:: Ceil( id / ( GetNPhi() * GetNZ() ) ) ; + Int_t phosmodulenumber = (Int_t)TMath:: Ceil( id / GetNCristalsInModule() ) ; - if ( phosmodulenumber > GetNModules() ) { // it is a PPSD or CPV pad - - if ( strcmp(fName,"GPS2") == 0 ) { - id -= GetNPhi() * GetNZ() * GetNModules() ; - Float_t tempo = 2 * GetNumberOfModulesPhi() * GetNumberOfModulesZ() * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; - relid[0] = (Int_t)TMath::Ceil( id / tempo ) ; - id -= ( relid[0] - 1 ) * tempo ; - relid[1] = (Int_t)TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ; - id -= ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; - relid[2] = (Int_t)TMath::Ceil( id / GetNumberOfPadsPhi() ) ; - relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsPhi() ) ; - } - else if ( strcmp(fName,"IHEP") == 0 ) { - id -= GetNPhi() * GetNZ() * GetNModules() ; - relid[0] = (Int_t) TMath::Ceil( id / ( GetNumberOfPadsPhi() * GetNumberOfPadsZ() ) ) ; - relid[1] = 1 ; - id -= ( relid[0] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() ; - relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfPadsZ() ) ; - relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfPadsZ() ) ; - } + if ( phosmodulenumber > GetNModules() ) { // it is a CPV pad + + id -= GetNPhi() * GetNZ() * GetNModules() ; + Float_t nCPV = GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() ; + relid[0] = (Int_t) TMath::Ceil( id / nCPV ) ; + relid[1] = -1 ; + id -= ( relid[0] - 1 ) * nCPV ; + relid[2] = (Int_t) TMath::Ceil( id / GetNumberOfCPVPadsZ() ) ; + relid[3] = (Int_t) ( id - ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() ) ; } - else { // its a PW04 crystal + else { // it is a PW04 crystal relid[0] = phosmodulenumber ; relid[1] = 0 ; id -= ( phosmodulenumber - 1 ) * GetNPhi() * GetNZ() ; - relid[2] = (Int_t)TMath::Ceil( id / GetNPhi() ) ; - relid[3] = (Int_t)( id - ( relid[2] - 1 ) * GetNPhi() ) ; + relid[2] = (Int_t)TMath::Ceil( id / GetNZ() ) ; + relid[3] = (Int_t)( id - ( relid[2] - 1 ) * GetNZ() ) ; } return rv ; } //____________________________________________________________________________ -void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) +void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t & tM, Double_t & pm, Double_t & pM, Option_t * opt) const { - // calculates the angular coverage in theta and phi of a EMC module + // calculates the angular coverage in theta and phi of one EMC (=PHOS) module Double_t conv ; if ( opt == Radian() ) @@ -193,22 +211,22 @@ void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t else if ( opt == Degre() ) conv = 180. / TMath::Pi() ; else { - cout << " AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; + Warning("EmcModuleCoverage", "%s unknown option; result in radian", opt) ; conv = 1. ; } - Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ; - Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() - + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; - - Double_t angle = TMath::ATan( GetCrystalSize(0)*GetNPhi() / (2 * y0) ) ; - phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 230 and 310 deg.) + Float_t phi = GetPHOSAngle(mod) * (TMath::Pi() / 180.) ; + Float_t y0 = GetIPtoCrystalSurface() ; + Float_t x0 = GetCellStep()*GetNPhi() ; + Float_t z0 = GetCellStep()*GetNZ(); + Double_t angle = TMath::ATan( x0 / y0 / 2 ) ; + phi = phi + 1.5 * TMath::Pi() ; // to follow the convention of the particle generator(PHOS is between 220 and 320 deg.) Double_t max = phi - angle ; Double_t min = phi + angle ; pM = TMath::Max(max, min) * conv ; pm = TMath::Min(max, min) * conv ; - angle = TMath::ATan( GetCrystalSize(2)*GetNZ() / (2 * y0) ) ; + angle = TMath::ATan( z0 / y0 / 2 ) ; max = TMath::Pi() / 2. + angle ; // to follow the convention of the particle generator(PHOS is at 90 deg.) min = TMath::Pi() / 2. - angle ; tM = TMath::Max(max, min) * conv ; @@ -217,9 +235,9 @@ void AliPHOSGeometry::EmcModuleCoverage(const Int_t mod, Double_t & tm, Double_t } //____________________________________________________________________________ -void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) +void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t * opt) const { - // calculates the angular coverage in theta and phi of a single crystal in a EMC module + // calculates the angular coverage in theta and phi of a single crystal in a EMC(=PHOS) module Double_t conv ; if ( opt == Radian() ) @@ -227,12 +245,11 @@ void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t else if ( opt == Degre() ) conv = 180. / TMath::Pi() ; else { - cout << " AliPHOSGeometry::EmcXtalCoverage : " << opt << " unknown option; result in radian " << endl ; + Warning("EmcXtalCoverage", "%s unknown option; result in radian", opt) ; conv = 1. ; } - Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() - + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; + Float_t y0 = GetIPtoCrystalSurface() ; theta = 2 * TMath::ATan( GetCrystalSize(2) / (2 * y0) ) * conv ; phi = 2 * TMath::ATan( GetCrystalSize(0) / (2 * y0) ) * conv ; } @@ -241,7 +258,7 @@ void AliPHOSGeometry::EmcXtalCoverage(Double_t & theta, Double_t & phi, Option_t //____________________________________________________________________________ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TMatrix & gmat) const { - // Calculates the ALICE global coordinates of a RecPoint and the error matrix + // Calculates the coordinates of a RecPoint and the error matrix in the ALICE global coordinate system AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; TVector3 localposition ; @@ -250,21 +267,12 @@ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TM if ( tmpPHOS->IsEmc() ) // it is a EMC crystal - { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + - GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; + { gpos.SetY( - GetIPtoCrystalSurface()) ; } else - { // it is a PPSD pad - AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; - if (tmpPpsd->GetUp() ) // it is an upper module - { - gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - - GetLeadToMicro2Gap() - GetLeadConverterThickness() - - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; - } - else // it is a lower module - gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; + { // it is a CPV + gpos.SetY(- GetIPtoUpperCPVsurface() ) ; } Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; @@ -282,7 +290,7 @@ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos, TM //____________________________________________________________________________ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) const { - // Calculates the ALICE global coordinates of a RecPoint + // Calculates the coordinates of a RecPoint in the ALICE global coordinate system AliPHOSRecPoint * tmpPHOS = (AliPHOSRecPoint *) RecPoint ; TVector3 localposition ; @@ -290,20 +298,11 @@ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) co if ( tmpPHOS->IsEmc() ) // it is a EMC crystal - { gpos.SetY( -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() + - GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ) ; + { gpos.SetY( - GetIPtoCrystalSurface() ) ; } else - { // it is a PPSD pad - AliPHOSPpsdRecPoint * tmpPpsd = (AliPHOSPpsdRecPoint *) RecPoint ; - if (tmpPpsd->GetUp() ) // it is an upper module - { - gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - - GetLeadToMicro2Gap() - GetLeadConverterThickness() - - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0 ) ) ; - } - else // it is a lower module - gpos.SetY(-( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ) ; + { // it is a CPV + gpos.SetY(- GetIPtoUpperCPVsurface() ) ; } Float_t phi = GetPHOSAngle( tmpPHOS->GetPHOSMod()) ; @@ -318,10 +317,10 @@ void AliPHOSGeometry::GetGlobal(const AliRecPoint* RecPoint, TVector3 & gpos) co } //____________________________________________________________________________ -void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) +void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_t & ModuleNumber, Double_t & z, Double_t & x) const { - // calculates the impact coordinates of a neutral particle - // emitted in direction theta and phi in ALICE + // calculates the impact coordinates on PHOS of a neutral particle + // emitted in the direction theta and phi in the ALICE global coordinate system // searches for the PHOS EMC module ModuleNumber = 0 ; @@ -335,8 +334,7 @@ void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_ } if ( ModuleNumber != 0 ) { Float_t phi0 = GetPHOSAngle(ModuleNumber) * (TMath::Pi() / 180.) + 1.5 * TMath::Pi() ; - Float_t y0 = GetIPtoOuterCoverDistance() + GetUpperPlateThickness() - + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness() ; + Float_t y0 = GetIPtoCrystalSurface() ; Double_t angle = phi - phi0; x = y0 * TMath::Tan(angle) ; angle = theta - TMath::Pi() / 2 ; @@ -344,38 +342,39 @@ void AliPHOSGeometry::ImpactOnEmc(const Double_t theta, const Double_t phi, Int_ } } +Bool_t AliPHOSGeometry::Impact(const TParticle * particle) const +{ + Bool_t In=kFALSE; + Int_t ModuleNumber=0; + Double_t z,x; + ImpactOnEmc(particle->Theta(),particle->Phi(),ModuleNumber,z,x); + if(ModuleNumber) In=kTRUE; + else In=kFALSE; + return In; +} + //____________________________________________________________________________ -Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) +Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) const { // Converts the relative numbering into the absolute numbering - // AbsId = 1 to fNModules * fNPhi * fNZ -> PbWO4 - // AbsId = N(total PHOS crystals) + - // 1 to fNModules * 2 * (fNumberOfModulesPhi * fNumberOfModulesZ) * fNumberOfPadsPhi * fNumberOfPadsZ -> PPSD - // AbsId = N(total PHOS crystals) + - // 1:fNModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ -> CPV + // EMCA crystals: + // AbsId = from 1 to fNModules * fNPhi * fNZ + // CPV pad: + // AbsId = from N(total PHOS crystals) + 1 + // to NCPVModules * fNumberOfCPVPadsPhi * fNumberOfCPVPadsZ Bool_t rv = kTRUE ; - - if ( relid[1] > 0 ) { // it is a PPSD pad - AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from PPSD pads - + ( relid[0] - 1 ) * GetNumberOfModulesPhi() * GetNumberOfModulesZ() // the pads offset of PHOS modules - * GetNumberOfPadsPhi() * GetNumberOfPadsZ() * 2 - + ( relid[1] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PPSD modules - + ( relid[2] - 1 ) * GetNumberOfPadsPhi() // the pads offset of a PPSD row - + relid[3] ; // the column number - } - - else if ( relid[1] == 0 ) { // it is a Phos crystal + + if ( relid[1] == 0 ) { // it is a Phos crystal AbsId = - ( relid[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules - + ( relid[2] - 1 ) * GetNPhi() // the offset of a xtal row - + relid[3] ; // the column number + ( relid[0] - 1 ) * GetNPhi() * GetNZ() // the offset of PHOS modules + + ( relid[2] - 1 ) * GetNZ() // the offset along phi + + relid[3] ; // the offset along z } - - else if ( relid[1] == -1 ) { // it is a CPV pad - AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from CPV pads - + ( relid[0] - 1 ) * GetNumberOfPadsPhi() * GetNumberOfPadsZ() // the pads offset of PHOS modules - + ( relid[2] - 1 ) * GetNumberOfPadsZ() // the pads offset of a CPV row + else { // it is a CPV pad + AbsId = GetNPhi() * GetNZ() * GetNModules() // the offset to separate EMCA crystals from CPV pads + + ( relid[0] - 1 ) * GetNumberOfCPVPadsPhi() * GetNumberOfCPVPadsZ() // the pads offset of PHOS modules + + ( relid[2] - 1 ) * GetNumberOfCPVPadsZ() // the pads offset of a CPV row + relid[3] ; // the column number } @@ -383,89 +382,77 @@ Bool_t AliPHOSGeometry::RelToAbsNumbering(const Int_t * relid, Int_t & AbsId) } //____________________________________________________________________________ +void AliPHOSGeometry::RelPosToAbsId(const Int_t module , const Double_t x, const Double_t z, Int_t & AbsId)const{ + // Converts local PHOS-module (x, z) coordinates to absId -void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) -{ - // Converts the absolute numbering into the global ALICE coordinates + if(!module){ + AbsId = 0 ; + return ; + } - if (id > 0) { - Int_t relid[4] ; - - AbsToRelNumbering(id , relid) ; - - Int_t phosmodule = relid[0] ; - - Float_t y0 = 0 ; - - if ( relid[1] == 0 ) // it is a PbW04 crystal - { y0 = -(GetIPtoOuterCoverDistance() + GetUpperPlateThickness() - + GetSecondUpperPlateThickness() + GetUpperCoolingPlateThickness()) ; - } - if ( relid[1] > 0 ) { // its a PPSD pad - if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) // its an bottom module - { - y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() / 2.0) ; - } - else // its an upper module - y0 = -( GetIPtoOuterCoverDistance() - GetMicromegas2Thickness() - GetLeadToMicro2Gap() - - GetLeadConverterThickness() - GetMicro1ToLeadGap() - GetMicromegas1Thickness() / 2.0) ; - } + relid[0] = module ; + relid[1] = 0 ; + relid[2] = static_cast(TMath::Ceil(GetNPhi()/2.+ x/GetCellStep())); + relid[3] = static_cast(TMath::Ceil(GetNZ()/2. - z/GetCellStep())) ; - Float_t x, z ; - RelPosInModule(relid, x, z) ; + RelToAbsNumbering(relid,AbsId) ; - pos.SetX(x) ; - pos.SetZ(z) ; - pos.SetY( TMath::Sqrt(x*x + z*z + y0*y0) ) ; - - - - Float_t phi = GetPHOSAngle( phosmodule) ; - Double_t const kRADDEG = 180.0 / kPI ; - Float_t rphi = phi / kRADDEG ; - - TRotation rot ; - rot.RotateZ(-rphi) ; // a rotation around Z by angle - - TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame +} +//____________________________________________________________________________ +void AliPHOSGeometry::RelPosInAlice(const Int_t id, TVector3 & pos ) const +{ + // Converts the absolute numbering into the global ALICE coordinate system - pos.Transform(rot) ; // rotate the baby - } - else { - pos.SetX(0.); - pos.SetY(0.); - pos.SetZ(0.); - } + + Int_t relid[4] ; + + AbsToRelNumbering(id , relid) ; + + Int_t phosmodule = relid[0] ; + + Float_t y0 = 0 ; + + if ( relid[1] == 0 ) // it is a PbW04 crystal + y0 = - GetIPtoCrystalSurface() ; + else + y0 = - GetIPtoUpperCPVsurface() ; + + Float_t x, z ; + RelPosInModule(relid, x, z) ; + + pos.SetX(x) ; + pos.SetZ(z) ; + pos.SetY(y0) ; + + Float_t phi = GetPHOSAngle( phosmodule) ; + Double_t const kRADDEG = 180.0 / kPI ; + Float_t rphi = phi / kRADDEG ; + + TRotation rot ; + rot.RotateZ(-rphi) ; // a rotation around Z by angle + + TRotation dummy = rot.Invert() ; // to transform from original frame to rotate frame + + pos.Transform(rot) ; // rotate the baby } //____________________________________________________________________________ -void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z) +void AliPHOSGeometry::RelPosInModule(const Int_t * relid, Float_t & x, Float_t & z) const { // Converts the relative numbering into the local PHOS-module (x, z) coordinates // Note: sign of z differs from that in the previous version (Yu.Kharlov, 12 Oct 2000) - Int_t ppsdmodule ; - Int_t row = relid[2] ; //offset along x axiz - Int_t column = relid[3] ; //offset along z axiz + Int_t row = relid[2] ; //offset along x axis + Int_t column = relid[3] ; //offset along z axis - Float_t padsizeZ = GetPadSizeZ(); - Float_t padsizeX = GetPadSizePhi(); - - if ( relid[1] == 0 ) { // its a PbW04 crystal - x = - ( GetNPhi()/2. - row + 0.5 ) * GetCrystalSize(0) ; // position ox Xtal with respect - z = ( GetNZ() /2. - column + 0.5 ) * GetCrystalSize(2) ; // of center of PHOS module + + if ( relid[1] == 0 ) { // its a PbW04 crystal + x = - ( GetNPhi()/2. - row + 0.5 ) * GetCellStep() ; // position of Xtal with respect + z = ( GetNZ() /2. - column + 0.5 ) * GetCellStep() ; // of center of PHOS module } else { - if ( relid[1] > GetNumberOfModulesPhi() * GetNumberOfModulesZ() ) - ppsdmodule = relid[1]-GetNumberOfModulesPhi() * GetNumberOfModulesZ(); - else - ppsdmodule = relid[1] ; - Int_t modrow = 1+(Int_t)TMath::Ceil( (Float_t)ppsdmodule / GetNumberOfModulesPhi()-1. ) ; - Int_t modcol = ppsdmodule - ( modrow - 1 ) * GetNumberOfModulesPhi() ; - Float_t x0 = ( GetNumberOfModulesPhi() / 2. - modrow + 0.5 ) * GetPPSDModuleSize(0) ; - Float_t z0 = ( GetNumberOfModulesZ() / 2. - modcol + 0.5 ) * GetPPSDModuleSize(2) ; - x = - ( GetNumberOfPadsPhi()/2. - row - 0.5 ) * padsizeX + x0 ; // position of pad with respect - z = ( GetNumberOfPadsZ() /2. - column - 0.5 ) * padsizeZ - z0 ; // of center of PHOS module + x = - ( GetNumberOfCPVPadsPhi()/2. - row - 0.5 ) * GetPadSizePhi() ; // position of pad with respect + z = ( GetNumberOfCPVPadsZ() /2. - column - 0.5 ) * GetPadSizeZ() ; // of center of PHOS module } }