X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDgeometry.cxx;h=fd1efea67fda53bd18eebd0ffb969a6552323a74;hb=a85a36c47163a32b060cec819db8cb6cd7edb85f;hp=b1548d185256f193b264876df12c6444a010d98a;hpb=afb9f880312237d28a62d69aa7934a065018b502;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDgeometry.cxx b/TRD/AliTRDgeometry.cxx index b1548d18525..fd1efea67fd 100644 --- a/TRD/AliTRDgeometry.cxx +++ b/TRD/AliTRDgeometry.cxx @@ -21,7 +21,6 @@ // // /////////////////////////////////////////////////////////////////////////////// - #include #include #include @@ -29,14 +28,14 @@ #include "AliLog.h" #include "AliRunLoader.h" #include "AliAlignObj.h" -#include "AliAlignObjAngles.h" +#include "AliAlignObjParams.h" #include "AliRun.h" #include "AliTRD.h" #include "AliTRDcalibDB.h" -#include "AliTRDCommonParam.h" #include "AliTRDgeometry.h" #include "AliTRDpadPlane.h" +#include "AliTRDSimParam.h" ClassImp(AliTRDgeometry) @@ -45,20 +44,28 @@ ClassImp(AliTRDgeometry) // // The geometry constants // - const Int_t AliTRDgeometry::fgkNsect = kNsect; - const Int_t AliTRDgeometry::fgkNplan = kNplan; - const Int_t AliTRDgeometry::fgkNcham = kNcham; + const Int_t AliTRDgeometry::fgkNsector = kNsector; + const Int_t AliTRDgeometry::fgkNlayer = kNlayer; + const Int_t AliTRDgeometry::fgkNstack = kNstack; const Int_t AliTRDgeometry::fgkNdet = kNdet; // // Dimensions of the detector // - // Parameter of the BTRD mother volumes + // Total length of the TRD mother volume + const Float_t AliTRDgeometry::fgkTlength = 751.0; + + // Parameter of the super module mother volumes const Float_t AliTRDgeometry::fgkSheight = 77.9; const Float_t AliTRDgeometry::fgkSwidth1 = 94.881; const Float_t AliTRDgeometry::fgkSwidth2 = 122.353; - const Float_t AliTRDgeometry::fgkSlength = 751.0; + const Float_t AliTRDgeometry::fgkSlength = 702.0; + + // Length of the additional space in front of the supermodule + // used for services + const Float_t AliTRDgeometry::fgkFlength = (AliTRDgeometry::fgkTlength + - AliTRDgeometry::fgkSlength) / 2.0; // The super module side plates const Float_t AliTRDgeometry::fgkSMpltT = 0.2; @@ -161,10 +168,8 @@ ClassImp(AliTRDgeometry) //_____________________________________________________________________________ AliTRDgeometry::AliTRDgeometry() :AliGeometry() - ,fMatrixArray(0) - ,fMatrixCorrectionArray(0) - ,fMatrixGeo(0) - + ,fClusterMatrixArray(0) + ,fPadPlaneArray(0) { // // AliTRDgeometry default constructor @@ -177,9 +182,8 @@ AliTRDgeometry::AliTRDgeometry() //_____________________________________________________________________________ AliTRDgeometry::AliTRDgeometry(const AliTRDgeometry &g) :AliGeometry(g) - ,fMatrixArray(g.fMatrixArray) - ,fMatrixCorrectionArray(g.fMatrixCorrectionArray) - ,fMatrixGeo(g.fMatrixGeo) + ,fClusterMatrixArray(0) + ,fPadPlaneArray(0) { // // AliTRDgeometry copy constructor @@ -196,14 +200,16 @@ AliTRDgeometry::~AliTRDgeometry() // AliTRDgeometry destructor // - if (fMatrixArray) { - delete fMatrixArray; - fMatrixArray = 0; + if (fClusterMatrixArray) { + fClusterMatrixArray->Delete(); + delete fClusterMatrixArray; + fClusterMatrixArray = 0; } - if (fMatrixCorrectionArray) { - delete fMatrixCorrectionArray; - fMatrixCorrectionArray = 0; + if (fPadPlaneArray) { + fPadPlaneArray->Delete(); + delete fPadPlaneArray; + fPadPlaneArray = 0; } } @@ -230,9 +236,9 @@ void AliTRDgeometry::Init() // Initializes the geometry parameter // - Int_t icham; - Int_t iplan; - Int_t isect; + Int_t istack; + Int_t ilayer; + Int_t isector; // The outer width of the chambers fCwidth[0] = 90.4; @@ -244,40 +250,276 @@ void AliTRDgeometry::Init() // The outer lengths of the chambers // Includes the spacings between the chambers! - Float_t length[kNplan][kNcham] = { { 124.0, 124.0, 110.0, 124.0, 124.0 } - , { 124.0, 124.0, 110.0, 124.0, 124.0 } - , { 131.0, 131.0, 110.0, 131.0, 131.0 } - , { 138.0, 138.0, 110.0, 138.0, 138.0 } - , { 145.0, 145.0, 110.0, 145.0, 145.0 } - , { 147.0, 147.0, 110.0, 147.0, 147.0 } }; - - for (icham = 0; icham < kNcham; icham++) { - for (iplan = 0; iplan < kNplan; iplan++) { - fClength[iplan][icham] = length[iplan][icham]; + Float_t length[kNlayer][kNstack] = { { 124.0, 124.0, 110.0, 124.0, 124.0 } + , { 124.0, 124.0, 110.0, 124.0, 124.0 } + , { 131.0, 131.0, 110.0, 131.0, 131.0 } + , { 138.0, 138.0, 110.0, 138.0, 138.0 } + , { 145.0, 145.0, 110.0, 145.0, 145.0 } + , { 147.0, 147.0, 110.0, 147.0, 147.0 } }; + + for (istack = 0; istack < kNstack; istack++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + fClength[ilayer][istack] = length[ilayer][istack]; } } // The rotation matrix elements Float_t phi = 0.0; - for (isect = 0; isect < fgkNsect; isect++) { - phi = 2.0 * TMath::Pi() / (Float_t) fgkNsect * ((Float_t) isect + 0.5); - fRotA11[isect] = TMath::Cos(phi); - fRotA12[isect] = TMath::Sin(phi); - fRotA21[isect] = TMath::Sin(phi); - fRotA22[isect] = TMath::Cos(phi); - phi = -1.0 * phi; - fRotB11[isect] = TMath::Cos(phi); - fRotB12[isect] = TMath::Sin(phi); - fRotB21[isect] = TMath::Sin(phi); - fRotB22[isect] = TMath::Cos(phi); + for (isector = 0; isector < fgkNsector; isector++) { + phi = 2.0 * TMath::Pi() / (Float_t) fgkNsector * ((Float_t) isector + 0.5); + fRotB11[isector] = TMath::Cos(phi); + fRotB12[isector] = TMath::Sin(phi); + fRotB21[isector] = TMath::Sin(phi); + fRotB22[isector] = TMath::Cos(phi); } - for (isect = 0; isect < fgkNsect; isect++) { - SetSMstatus(isect,1); + // Initialize the SM status + for (isector = 0; isector < fgkNsector; isector++) { + SetSMstatus(isector,1); } } +//_____________________________________________________________________________ +void AliTRDgeometry::CreatePadPlaneArray() +{ + // + // Creates the array of AliTRDpadPlane objects + // + + if (fPadPlaneArray) { + fPadPlaneArray->Delete(); + delete fPadPlaneArray; + } + + fPadPlaneArray = new TObjArray(fgkNlayer * fgkNstack); + for (Int_t ilayer = 0; ilayer < fgkNlayer; ilayer++) { + for (Int_t istack = 0; istack < fgkNstack; istack++) { + Int_t ipp = GetDetectorSec(ilayer,istack); + fPadPlaneArray->AddAt(CreatePadPlane(ilayer,istack),ipp); + } + } + +} + +//_____________________________________________________________________________ +AliTRDpadPlane *AliTRDgeometry::CreatePadPlane(Int_t ilayer, Int_t istack) +{ + // + // Creates an AliTRDpadPlane object + // + + AliTRDpadPlane *padPlane = new AliTRDpadPlane(); + + padPlane->SetLayer(ilayer); + padPlane->SetStack(istack); + + padPlane->SetRowSpacing(0.0); + padPlane->SetColSpacing(0.0); + + padPlane->SetLengthRim(1.0); + padPlane->SetWidthRim(0.5); + + padPlane->SetNcols(144); + + // + // The pad plane parameter + // + switch (ilayer) { + case 0: + if (istack == 2) { + // L0C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(92.2); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.515); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.635); + padPlane->SetTiltingAngle(2.0); + } + else { + // L0C1 type + padPlane->SetNrows(16); + padPlane->SetLength(122.0); + padPlane->SetWidth(92.2); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.515); + padPlane->SetLengthIPad(7.5); + padPlane->SetWidthIPad(0.635); + padPlane->SetTiltingAngle(2.0); + } + break; + case 1: + if (istack == 2) { + // L1C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(96.6); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.585); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.665); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L1C1 type + padPlane->SetNrows(16); + padPlane->SetLength(122.0); + padPlane->SetWidth(96.6); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.585); + padPlane->SetLengthIPad(7.5); + padPlane->SetWidthIPad(0.665); + padPlane->SetTiltingAngle(-2.0); + } + break; + case 2: + if (istack == 2) { + // L2C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(101.1); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.705); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.695); + padPlane->SetTiltingAngle(2.0); + } + else { + // L2C1 type + padPlane->SetNrows(16); + padPlane->SetLength(129.0); + padPlane->SetWidth(101.1); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.705); + padPlane->SetLengthIPad(8.0); + padPlane->SetWidthIPad(0.695); + padPlane->SetTiltingAngle(2.0); + } + break; + case 3: + if (istack == 2) { + // L3C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(105.5); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.775); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.725); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L3C1 type + padPlane->SetNrows(16); + padPlane->SetLength(136.0); + padPlane->SetWidth(105.5); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.775); + padPlane->SetLengthIPad(8.5); + padPlane->SetWidthIPad(0.725); + padPlane->SetTiltingAngle(-2.0); + } + break; + case 4: + if (istack == 2) { + // L4C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(109.9); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.845); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.755); + padPlane->SetTiltingAngle(2.0); + } + else { + // L4C1 type + padPlane->SetNrows(16); + padPlane->SetLength(143.0); + padPlane->SetWidth(109.9); + padPlane->SetLengthOPad(7.5); + padPlane->SetWidthOPad(0.845); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.755); + padPlane->SetTiltingAngle(2.0); + } + break; + case 5: + if (istack == 2) { + // L5C0 type + padPlane->SetNrows(12); + padPlane->SetLength(108.0); + padPlane->SetWidth(114.4); + padPlane->SetLengthOPad(8.0); + padPlane->SetWidthOPad(0.965); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.785); + padPlane->SetTiltingAngle(-2.0); + } + else { + // L5C1 type + padPlane->SetNrows(16); + padPlane->SetLength(145.0); + padPlane->SetWidth(114.4); + padPlane->SetLengthOPad(8.5); + padPlane->SetWidthOPad(0.965); + padPlane->SetLengthIPad(9.0); + padPlane->SetWidthIPad(0.785); + padPlane->SetTiltingAngle(-2.0); + } + break; + }; + + // + // The positions of the borders of the pads + // + // Row direction + // + Double_t row = fClength[ilayer][istack] / 2.0 + - fgkRpadW + - padPlane->GetLengthRim(); + for (Int_t ir = 0; ir < padPlane->GetNrows(); ir++) { + padPlane->SetPadRow(ir,row); + row -= padPlane->GetRowSpacing(); + if (ir == 0) { + row -= padPlane->GetLengthOPad(); + } + else { + row -= padPlane->GetLengthIPad(); + } + } + // + // Column direction + // + Double_t col = - fCwidth[ilayer] / 2.0 + - fgkCroW + + padPlane->GetWidthRim(); + for (Int_t ic = 0; ic < padPlane->GetNcols(); ic++) { + padPlane->SetPadCol(ic,col); + col += padPlane->GetColSpacing(); + if (ic == 0) { + col += padPlane->GetWidthOPad(); + } + else { + col += padPlane->GetWidthIPad(); + } + } + // Calculate the offset to translate from the local ROC system into + // the local supermodule system, which is used for clusters + Double_t rowTmp = fClength[ilayer][0] + + fClength[ilayer][1] + + fClength[ilayer][2] / 2.0; + for (Int_t jstack = 0; jstack < istack; jstack++) { + rowTmp -= fClength[ilayer][jstack]; + } + padPlane->SetPadRowSMOffset(rowTmp - fClength[ilayer][istack]/2.0); + + return padPlane; + +} + //_____________________________________________________________________________ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) { @@ -336,21 +578,31 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) Char_t cTagV[6]; Char_t cTagM[5]; - // The TRD mother volume for one sector (Air), full length in z-direction + AliTRDSimParam *simParam = AliTRDSimParam::Instance(); + + // There are three TRD volumes for the supermodules in order to accomodate + // the different arrangements in front of PHOS + // UTR1: Default supermodule + // UTR2: Supermodule in front of PHOS with double carbon cover + // UTR3: As UTR2, but w/o middle stack + // + // The mother volume for one sector (Air), full length in z-direction // Provides material for side plates of super module parTrd[0] = fgkSwidth1/2.0; parTrd[1] = fgkSwidth2/2.0; parTrd[2] = fgkSlength/2.0; parTrd[3] = fgkSheight/2.0; gMC->Gsvolu("UTR1","TRD1",idtmed[1302-1],parTrd,kNparTrd); - + gMC->Gsvolu("UTR2","TRD1",idtmed[1302-1],parTrd,kNparTrd); + gMC->Gsvolu("UTR3","TRD1",idtmed[1302-1],parTrd,kNparTrd); // The outer aluminum plates of the super module (Al) parTrd[0] = fgkSwidth1/2.0; parTrd[1] = fgkSwidth2/2.0; parTrd[2] = fgkSlength/2.0; parTrd[3] = fgkSheight/2.0; gMC->Gsvolu("UTS1","TRD1",idtmed[1301-1],parTrd,kNparTrd); - + gMC->Gsvolu("UTS2","TRD1",idtmed[1301-1],parTrd,kNparTrd); + gMC->Gsvolu("UTS3","TRD1",idtmed[1301-1],parTrd,kNparTrd); // The inner part of the TRD mother volume for one sector (Air), // full length in z-direction parTrd[0] = fgkSwidth1/2.0 - fgkSMpltT; @@ -358,17 +610,28 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) parTrd[2] = fgkSlength/2.0; parTrd[3] = fgkSheight/2.0 - fgkSMpltT; gMC->Gsvolu("UTI1","TRD1",idtmed[1302-1],parTrd,kNparTrd); + gMC->Gsvolu("UTI2","TRD1",idtmed[1302-1],parTrd,kNparTrd); + gMC->Gsvolu("UTI3","TRD1",idtmed[1302-1],parTrd,kNparTrd); + + // The inner part of the TRD mother volume for services in front + // of the supermodules (Air), + parTrd[0] = fgkSwidth1/2.0; + parTrd[1] = fgkSwidth2/2.0; + parTrd[2] = fgkFlength/2.0; + parTrd[3] = fgkSheight/2.0; + gMC->Gsvolu("UTF1","TRD1",idtmed[1302-1],parTrd,kNparTrd); + gMC->Gsvolu("UTF2","TRD1",idtmed[1302-1],parTrd,kNparTrd); - for (Int_t icham = 0; icham < kNcham; icham++) { - for (Int_t iplan = 0; iplan < kNplan; iplan++) { + for (Int_t istack = 0; istack < kNstack; istack++) { + for (Int_t ilayer = 0; ilayer < kNlayer; ilayer++) { - Int_t iDet = GetDetectorSec(iplan,icham); + Int_t iDet = GetDetectorSec(ilayer,istack); // The lower part of the readout chambers (drift volume + radiator) // The aluminum frames sprintf(cTagV,"UA%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0; + parCha[0] = fCwidth[ilayer]/2.0; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0; parCha[2] = fgkCraH/2.0 + fgkCdrH/2.0; fChamberUAboxd[iDet][0] = parCha[0]; fChamberUAboxd[iDet][1] = parCha[1]; @@ -376,38 +639,38 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha); // The additional aluminum on the frames // This part has not the correct postion but is just supposed to - // represent the missing material. The correct from of the L-shaped + // represent the missing material. The correct form of the L-shaped // profile would not fit into the alignable volume. sprintf(cTagV,"UZ%02d",iDet); parCha[0] = fgkCroW/2.0; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0; parCha[2] = fgkCalW/2.0; fChamberUAboxd[iDet][0] = fChamberUAboxd[iDet][0] + fgkCroW; gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha); // The Wacosit frames sprintf(cTagV,"UB%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 - fgkCalT; + parCha[0] = fCwidth[ilayer]/2.0 - fgkCalT; parCha[1] = -1.0; parCha[2] = -1.0; gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha); // The glue around the radiator sprintf(cTagV,"UX%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT; + parCha[0] = fCwidth[ilayer]/2.0 - fgkCalT - fgkCclsT; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0 - fgkCclfT; parCha[2] = fgkCraH/2.0; gMC->Gsvolu(cTagV,"BOX ",idtmed[1311-1],parCha,kNparCha); // The inner part of radiator (air) sprintf(cTagV,"UC%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT - fgkCglT; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT - fgkCglT; + parCha[0] = fCwidth[ilayer]/2.0 - fgkCalT - fgkCclsT - fgkCglT; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0 - fgkCclfT - fgkCglT; parCha[2] = -1.0; gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha); // The upper part of the readout chambers (amplification volume) // The Wacosit frames sprintf(cTagV,"UD%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 + fgkCroW; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0; + parCha[0] = fCwidth[ilayer]/2.0 + fgkCroW; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0; parCha[2] = fgkCamH/2.0; fChamberUDboxd[iDet][0] = parCha[0]; fChamberUDboxd[iDet][1] = parCha[1]; @@ -415,16 +678,16 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) gMC->Gsvolu(cTagV,"BOX ",idtmed[1307-1],parCha,kNparCha); // The inner part of the Wacosit frame (air) sprintf(cTagV,"UE%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 + fgkCroW - fgkCcuT; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCcuT; + parCha[0] = fCwidth[ilayer]/2.0 + fgkCroW - fgkCcuT; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0 - fgkCcuT; parCha[2] = -1.; gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha); // The support structure (pad plane, back panel, readout boards) // The aluminum frames sprintf(cTagV,"UF%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 + fgkCroW; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0; + parCha[0] = fCwidth[ilayer]/2.0 + fgkCroW; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0; parCha[2] = fgkCroH/2.0; fChamberUFboxd[iDet][0] = parCha[0]; fChamberUFboxd[iDet][1] = parCha[1]; @@ -432,8 +695,8 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parCha,kNparCha); // The inner part of the aluminum frames sprintf(cTagV,"UG%02d",iDet); - parCha[0] = fCwidth[iplan]/2.0 + fgkCroW - fgkCauT; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCauT; + parCha[0] = fCwidth[ilayer]/2.0 + fgkCroW - fgkCauT; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0 - fgkCauT; parCha[2] = -1.0; gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parCha,kNparCha); @@ -445,8 +708,8 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) sprintf(cTagV,"UH%02d",iDet); gMC->Gsvolu(cTagV,"BOX ",idtmed[1315-1],parCha,kNparCha); // Xe/Isobutane layer (drift volume) - parCha[0] = fCwidth[iplan]/2.0 - fgkCalT - fgkCclsT; - parCha[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0 - fgkCclfT; + parCha[0] = fCwidth[ilayer]/2.0 - fgkCalT - fgkCclsT; + parCha[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0 - fgkCclfT; parCha[2] = fgkDrThick/2.0; sprintf(cTagV,"UJ%02d",iDet); gMC->Gsvolu(cTagV,"BOX ",idtmed[1309-1],parCha,kNparCha); @@ -587,13 +850,13 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) // Position the frames of the chambers in the TRD mother volume xpos = 0.0; - ypos = fClength[iplan][0] + fClength[iplan][1] + fClength[iplan][2]/2.0; - for (Int_t ic = 0; ic < icham; ic++) { - ypos -= fClength[iplan][ic]; + ypos = fClength[ilayer][0] + fClength[ilayer][1] + fClength[ilayer][2]/2.0; + for (Int_t ic = 0; ic < istack; ic++) { + ypos -= fClength[ilayer][ic]; } - ypos -= fClength[iplan][icham]/2.0; - zpos = fgkVrocsm + fgkSMpltT + fgkCraH/2.0 + fgkCdrH/2.0 - fgkSheight/2.0 - + iplan * (fgkCH + fgkVspace); + ypos -= fClength[ilayer][istack]/2.0; + zpos = fgkVrocsm + fgkSMpltT + fgkCraH/2.0 + fgkCdrH/2.0 - fgkSheight/2.0 + + ilayer * (fgkCH + fgkVspace); // The lower aluminum frame, radiator + drift region sprintf(cTagV,"UA%02d",iDet); fChamberUAorig[iDet][0] = xpos; @@ -621,9 +884,9 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) // Create the volumes of the services CreateServices(idtmed); - for (Int_t icham = 0; icham < kNcham; icham++) { - for (Int_t iplan = 0; iplan < kNplan; iplan++) { - GroupChamber(iplan,icham,idtmed); + for (Int_t istack = 0; istack < kNstack; istack++) { + for (Int_t ilayer = 0; ilayer < kNlayer; ilayer++) { + GroupChamber(ilayer,istack,idtmed); } } @@ -631,21 +894,53 @@ void AliTRDgeometry::CreateGeometry(Int_t *idtmed) ypos = 0.0; zpos = 0.0; gMC->Gspos("UTI1",1,"UTS1",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTI2",1,"UTS2",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTI3",1,"UTS3",xpos,ypos,zpos,0,"ONLY"); xpos = 0.0; ypos = 0.0; zpos = 0.0; gMC->Gspos("UTS1",1,"UTR1",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTS2",1,"UTR2",xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTS3",1,"UTR3",xpos,ypos,zpos,0,"ONLY"); // Put the TRD volumes into the space frame mother volumes // if enabled via status flag xpos = 0.0; ypos = 0.0; zpos = 0.0; - for (Int_t isect = 0; isect < kNsect; isect++) { - if (fSMstatus[isect]) { - sprintf(cTagV,"BTRD%d",isect); - gMC->Gspos("UTR1",1,cTagV,xpos,ypos,zpos,0,"ONLY"); + for (Int_t isector = 0; isector < kNsector; isector++) { + if (fSMstatus[isector]) { + sprintf(cTagV,"BTRD%d",isector); + switch (isector) { + case 13: + case 14: + case 15: + // Double carbon, w/o middle stack + gMC->Gspos("UTR3",1,cTagV,xpos,ypos,zpos,0,"ONLY"); + break; + case 11: + case 12: + // Double carbon, all stacks + gMC->Gspos("UTR2",1,cTagV,xpos,ypos,zpos,0,"ONLY"); + break; + default: + // Standard supermodule + gMC->Gspos("UTR1",1,cTagV,xpos,ypos,zpos,0,"ONLY"); + }; + } + } + + // Put the TRD volumes into the space frame mother volumes + // if enabled via status flag + xpos = 0.0; + ypos = 0.5*fgkSlength + 0.5*fgkFlength; + zpos = 0.0; + for (Int_t isector = 0; isector < kNsector; isector++) { + if (fSMstatus[isector]) { + sprintf(cTagV,"BTRD%d",isector); + gMC->Gspos("UTF1",1,cTagV,xpos, ypos,zpos,0,"ONLY"); + gMC->Gspos("UTF2",1,cTagV,xpos,-ypos,zpos,0,"ONLY"); } } @@ -665,7 +960,7 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) // USLx Long corner ledges (Al) // - Int_t iplan = 0; + Int_t ilayer = 0; Float_t xpos = 0.0; Float_t ypos = 0.0; @@ -674,13 +969,103 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) Char_t cTagV[5]; Char_t cTagM[5]; + const Int_t kNparTRD = 4; + Float_t parTRD[kNparTRD]; + const Int_t kNparBOX = 3; + Float_t parBOX[kNparBOX]; + const Int_t kNparTRP = 11; + Float_t parTRP[kNparTRP]; + // The rotation matrices - const Int_t kNmatrix = 4; + const Int_t kNmatrix = 6; Int_t matrix[kNmatrix]; gMC->Matrix(matrix[0], 100.0, 0.0, 90.0, 90.0, 10.0, 0.0); gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0); gMC->Matrix(matrix[2], 90.0, 0.0, 0.0, 0.0, 90.0, 90.0); gMC->Matrix(matrix[3], 90.0, 180.0, 0.0, 180.0, 90.0, 90.0); + gMC->Matrix(matrix[4], 170.0, 0.0, 80.0, 0.0, 90.0, 90.0); + gMC->Matrix(matrix[5], 170.0, 180.0, 80.0, 180.0, 90.0, 90.0); + gMC->Matrix(matrix[6], 180.0, 180.0, 90.0, 180.0, 90.0, 90.0); + + // + // The carbon inserts in the top/bottom aluminum plates + // + + const Int_t kNparCrb = 3; + Float_t parCrb[kNparCrb]; + parCrb[0] = 0.0; + parCrb[1] = 0.0; + parCrb[2] = 0.0; + gMC->Gsvolu("USCR","BOX ",idtmed[1307-1],parCrb,0); + // Bottom 1 (all sectors) + parCrb[0] = 77.49/2.0; + parCrb[1] = 104.60/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 0.0; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR", 1,"UTS1", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 2,"UTS2", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 3,"UTS3", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + // Bottom 2 (all sectors) + parCrb[0] = 77.49/2.0; + parCrb[1] = 55.80/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 85.6; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR", 4,"UTS1", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 5,"UTS2", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 6,"UTS3", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 7,"UTS1", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 8,"UTS2", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR", 9,"UTS3", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + // Bottom 3 (all sectors) + parCrb[0] = 77.49/2.0; + parCrb[1] = 56.00/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 148.5; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR",10,"UTS1", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",11,"UTS2", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",12,"UTS3", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",13,"UTS1", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",14,"UTS2", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",15,"UTS3", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + // Bottom 4 (all sectors) + parCrb[0] = 77.49/2.0; + parCrb[1] = 118.00/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 240.5; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR",16,"UTS1", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",17,"UTS2", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",18,"UTS3", xpos, ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",19,"UTS1", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",20,"UTS2", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",21,"UTS3", xpos,-ypos, zpos,0,"ONLY",parCrb,kNparCrb); + // Top 1 (only in front of PHOS) + parCrb[0] = 111.48/2.0; + parCrb[1] = 105.00/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 0.0; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR",22,"UTS2", xpos, ypos,-zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",23,"UTS3", xpos, ypos,-zpos,0,"ONLY",parCrb,kNparCrb); + // Top 2 (only in front of PHOS) + parCrb[0] = 111.48/2.0; + parCrb[1] = 56.00/2.0; + parCrb[2] = fgkSMpltT/2.0; + xpos = 0.0; + ypos = 85.5; + zpos = fgkSMpltT/2.0 - fgkSheight/2.0; + gMC->Gsposp("USCR",24,"UTS2", xpos, ypos,-zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",25,"UTS3", xpos, ypos,-zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",26,"UTS2", xpos,-ypos,-zpos,0,"ONLY",parCrb,kNparCrb); + gMC->Gsposp("USCR",27,"UTS3", xpos,-ypos,-zpos,0,"ONLY",parCrb,kNparCrb); // // The chamber support rails @@ -699,14 +1084,18 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) xpos = 0.0; ypos = 0.0; zpos = 0.0; - for (iplan = 0; iplan < kNplan; iplan++) { - xpos = fCwidth[iplan]/2.0 + kSRLwid/2.0 + kSRLdst; + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + xpos = fCwidth[ilayer]/2.0 + kSRLwid/2.0 + kSRLdst; ypos = 0.0; zpos = fgkVrocsm + fgkSMpltT + fgkCraH + fgkCdrH + fgkCamH - fgkSheight/2.0 - + iplan * (fgkCH + fgkVspace); - gMC->Gspos("USRL",iplan+1 ,"UTI1", xpos,ypos,zpos,0,"ONLY"); - gMC->Gspos("USRL",iplan+1+ kNplan,"UTI1",-xpos,ypos,zpos,0,"ONLY"); + + ilayer * (fgkCH + fgkVspace); + gMC->Gspos("USRL",ilayer+1 ,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("USRL",ilayer+1+ kNlayer,"UTI1",-xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("USRL",ilayer+1+2*kNlayer,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("USRL",ilayer+1+3*kNlayer,"UTI2",-xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("USRL",ilayer+1+4*kNlayer,"UTI3", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("USRL",ilayer+1+5*kNlayer,"UTI3",-xpos,ypos,zpos,0,"ONLY"); } // @@ -729,25 +1118,25 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) xpos = 0.0; ypos = 0.0; zpos = 0.0; - for (iplan = 0; iplan < kNplan; iplan++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { // The aluminum of the cross bars - parSCB[0] = fCwidth[iplan]/2.0 + kSRLdst/2.0; - sprintf(cTagV,"USF%01d",iplan); + parSCB[0] = fCwidth[ilayer]/2.0 + kSRLdst/2.0; + sprintf(cTagV,"USF%01d",ilayer); gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCB,kNparSCB); // The empty regions in the cross bars Float_t thkSCB = kSCBthk; - if (iplan < 2) { + if (ilayer < 2) { thkSCB *= 1.5; } parSCI[2] = parSCB[2] - thkSCB; parSCI[0] = parSCB[0]/4.0 - kSCBthk; - sprintf(cTagV,"USI%01d",iplan); + sprintf(cTagV,"USI%01d",ilayer); gMC->Gsvolu(cTagV,"BOX ",idtmed[1302-1],parSCI,kNparSCI); - sprintf(cTagV,"USI%01d",iplan); - sprintf(cTagM,"USF%01d",iplan); + sprintf(cTagV,"USI%01d",ilayer); + sprintf(cTagM,"USF%01d",ilayer); ypos = 0.0; zpos = 0.0; xpos = parSCI[0] + thkSCB/2.0; @@ -759,28 +1148,20 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) xpos = - 3.0 * parSCI[0] - 1.5 * thkSCB; gMC->Gspos(cTagV,4,cTagM,xpos,ypos,zpos,0,"ONLY"); - sprintf(cTagV,"USF%01d",iplan); + sprintf(cTagV,"USF%01d",ilayer); xpos = 0.0; zpos = fgkVrocsm + fgkSMpltT + parSCB[2] - fgkSheight/2.0 - + iplan * (fgkCH + fgkVspace); - - ypos = fgkSlength/2.0 - kSCBwid/2.0; - gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY"); - - ypos = fClength[iplan][2]/2.0 + fClength[iplan][1]; - gMC->Gspos(cTagV,2,"UTI1", xpos,ypos,zpos,0,"ONLY"); - - ypos = fClength[iplan][2]/2.0; - gMC->Gspos(cTagV,3,"UTI1", xpos,ypos,zpos,0,"ONLY"); + + ilayer * (fgkCH + fgkVspace); - ypos = - fClength[iplan][2]/2.0; - gMC->Gspos(cTagV,4,"UTI1", xpos,ypos,zpos,0,"ONLY"); + ypos = fClength[ilayer][2]/2.0 + fClength[ilayer][1]; + gMC->Gspos(cTagV, 1,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV, 3,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV, 5,"UTI3", xpos,ypos,zpos,0,"ONLY"); - ypos = - fClength[iplan][2]/2.0 - fClength[iplan][1]; - gMC->Gspos(cTagV,5,"UTI1", xpos,ypos,zpos,0,"ONLY"); - - ypos = - fgkSlength/2.0 + kSCBwid/2.0; - gMC->Gspos(cTagV,6,"UTI1", xpos,ypos,zpos,0,"ONLY"); + ypos = - fClength[ilayer][2]/2.0 - fClength[ilayer][1]; + gMC->Gspos(cTagV, 2,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV, 4,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV, 6,"UTI3", xpos,ypos,zpos,0,"ONLY"); } @@ -791,25 +1172,307 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) const Int_t kNparSCH = 3; Float_t parSCH[kNparSCH]; - for (iplan = 1; iplan < kNplan-1; iplan++) { + for (ilayer = 1; ilayer < kNlayer-1; ilayer++) { - parSCH[0] = fCwidth[iplan]/2.0; - parSCH[1] = (fClength[iplan+1][2]/2.0 + fClength[iplan+1][1] - - fClength[iplan ][2]/2.0 - fClength[iplan ][1])/2.0; + parSCH[0] = fCwidth[ilayer]/2.0; + parSCH[1] = (fClength[ilayer+1][2]/2.0 + fClength[ilayer+1][1] + - fClength[ilayer ][2]/2.0 - fClength[ilayer ][1])/2.0; parSCH[2] = kSCHhgt/2.0; - sprintf(cTagV,"USH%01d",iplan); + sprintf(cTagV,"USH%01d",ilayer); gMC->Gsvolu(cTagV,"BOX ",idtmed[1301-1],parSCH,kNparSCH); xpos = 0.0; - ypos = fClength[iplan][2]/2.0 + fClength[iplan][1] + parSCH[1]; + ypos = fClength[ilayer][2]/2.0 + fClength[ilayer][1] + parSCH[1]; zpos = fgkVrocsm + fgkSMpltT - kSCHhgt/2.0 - fgkSheight/2.0 - + (iplan+1) * (fgkCH + fgkVspace); + + (ilayer+1) * (fgkCH + fgkVspace); gMC->Gspos(cTagV,1,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV,3,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV,5,"UTI3", xpos,ypos,zpos,0,"ONLY"); ypos = -ypos; gMC->Gspos(cTagV,2,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV,4,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos(cTagV,6,"UTI3", xpos,ypos,zpos,0,"ONLY"); } + // + // The aymmetric flat frame in the middle + // + + // The envelope volume (aluminum) + parTRD[0] = 87.60/2.0; + parTRD[1] = 114.00/2.0; + parTRD[2] = 1.20/2.0; + parTRD[3] = 71.30/2.0; + gMC->Gsvolu("USDB","TRD1",idtmed[1301-1],parTRD,kNparTRD); + // Empty spaces (air) + parTRP[ 0] = 1.20/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 27.00/2.0; + parTRP[ 4] = 50.60/2.0; + parTRP[ 5] = 5.00/2.0; + parTRP[ 6] = 3.5; + parTRP[ 7] = 27.00/2.0; + parTRP[ 8] = 50.60/2.0; + parTRP[ 9] = 5.00/2.0; + parTRP[10] = 3.5; + gMC->Gsvolu("USD1","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = 18.0; + ypos = 0.0; + zpos = 27.00/2.0 - 71.3/2.0; + gMC->Gspos("USD1",1,"USDB", xpos, ypos, zpos,matrix[2],"ONLY"); + // Empty spaces (air) + parTRP[ 0] = 1.20/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 33.00/2.0; + parTRP[ 4] = 5.00/2.0; + parTRP[ 5] = 62.10/2.0; + parTRP[ 6] = 3.5; + parTRP[ 7] = 33.00/2.0; + parTRP[ 8] = 5.00/2.0; + parTRP[ 9] = 62.10/2.0; + parTRP[10] = 3.5; + gMC->Gsvolu("USD2","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = 21.0; + ypos = 0.0; + zpos = 71.3/2.0 - 33.0/2.0; + gMC->Gspos("USD2",1,"USDB", xpos, ypos, zpos,matrix[2],"ONLY"); + // Empty spaces (air) + parBOX[ 0] = 22.50/2.0; + parBOX[ 1] = 1.20/2.0; + parBOX[ 2] = 70.50/2.0; + gMC->Gsvolu("USD3","BOX ",idtmed[1302-1],parBOX,kNparBOX); + xpos = -25.75; + ypos = 0.0; + zpos = 0.4; + gMC->Gspos("USD3",1,"USDB", xpos, ypos, zpos, 0,"ONLY"); + // Empty spaces (air) + parTRP[ 0] = 1.20/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 25.50/2.0; + parTRP[ 4] = 5.00/2.0; + parTRP[ 5] = 65.00/2.0; + parTRP[ 6] = -1.0; + parTRP[ 7] = 25.50/2.0; + parTRP[ 8] = 5.00/2.0; + parTRP[ 9] = 65.00/2.0; + parTRP[10] = -1.0; + gMC->Gsvolu("USD4","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = 2.0; + ypos = 0.0; + zpos = -1.6; + gMC->Gspos("USD4",1,"USDB", xpos, ypos, zpos,matrix[6],"ONLY"); + // Empty spaces (air) + parTRP[ 0] = 1.20/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 23.50/2.0; + parTRP[ 4] = 63.50/2.0; + parTRP[ 5] = 5.00/2.0; + parTRP[ 6] = 16.0; + parTRP[ 7] = 23.50/2.0; + parTRP[ 8] = 63.50/2.0; + parTRP[ 9] = 5.00/2.0; + parTRP[10] = 16.0; + gMC->Gsvolu("USD5","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = 36.5; + ypos = 0.0; + zpos = -1.5; + gMC->Gspos("USD5",1,"USDB", xpos, ypos, zpos,matrix[5],"ONLY"); + // Empty spaces (air) + parTRP[ 0] = 1.20/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 70.50/2.0; + parTRP[ 4] = 4.50/2.0; + parTRP[ 5] = 16.50/2.0; + parTRP[ 6] = -5.0; + parTRP[ 7] = 70.50/2.0; + parTRP[ 8] = 4.50/2.0; + parTRP[ 9] = 16.50/2.0; + parTRP[10] = -5.0; + gMC->Gsvolu("USD6","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = -43.7; + ypos = 0.0; + zpos = 0.4; + gMC->Gspos("USD6",1,"USDB", xpos, ypos, zpos,matrix[2],"ONLY"); + xpos = 0.0; + ypos = fClength[5][2]/2.0; + zpos = 0.04; + gMC->Gspos("USDB",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USDB",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USDB",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USDB",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USDB",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USDB",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Upper bar (aluminum) + parBOX[0] = 95.00/2.0; + parBOX[1] = 1.20/2.0; + parBOX[2] = 3.00/2.0; + gMC->Gsvolu("USD7","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 3.00/2.0; + gMC->Gspos("USD7",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD7",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD7",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD7",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD7",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD7",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Lower bar (aluminum) + parBOX[0] = 90.22/2.0; + parBOX[1] = 1.20/2.0; + parBOX[2] = 1.74/2.0; + gMC->Gsvolu("USD8","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0 - 0.1; + zpos = -fgkSheight/2.0 + fgkSMpltT + 2.27; + gMC->Gspos("USD8",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD8",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD8",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD8",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD8",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD8",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Lower bar (aluminum) + parBOX[0] = 82.60/2.0; + parBOX[1] = 1.20/2.0; + parBOX[2] = 1.40/2.0; + gMC->Gsvolu("USD9","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0; + zpos = -fgkSheight/2.0 + fgkSMpltT + 1.40/2.0; + gMC->Gspos("USD9",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD9",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD9",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD9",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD9",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USD9",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Front sheet (aluminum) + parTRP[ 0] = 0.10/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 74.50/2.0; + parTRP[ 4] = 31.70/2.0; + parTRP[ 5] = 44.00/2.0; + parTRP[ 6] = -5.0; + parTRP[ 7] = 74.50/2.0; + parTRP[ 8] = 31.70/2.0; + parTRP[ 9] = 44.00/2.0; + parTRP[10] = -5.0; + gMC->Gsvolu("USDF","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = -32.0; + ypos = fClength[5][2]/2.0 + 1.20/2.0 + 0.10/2.0; + zpos = 0.0; + gMC->Gspos("USDF",1,"UTI1", xpos, ypos, zpos,matrix[2],"ONLY"); + gMC->Gspos("USDF",2,"UTI1", xpos,-ypos, zpos,matrix[2],"ONLY"); + gMC->Gspos("USDF",3,"UTI2", xpos, ypos, zpos,matrix[2],"ONLY"); + gMC->Gspos("USDF",4,"UTI2", xpos,-ypos, zpos,matrix[2],"ONLY"); + gMC->Gspos("USDF",5,"UTI3", xpos, ypos, zpos,matrix[2],"ONLY"); + gMC->Gspos("USDF",6,"UTI3", xpos,-ypos, zpos,matrix[2],"ONLY"); + + // + // The flat frame in front of the chambers + // + + // The envelope volume (aluminum) + parTRD[0] = 90.00/2.0; + parTRD[1] = 114.00/2.0; + parTRD[2] = 1.50/2.0; + parTRD[3] = 70.30/2.0; + gMC->Gsvolu("USCB","TRD1",idtmed[1301-1],parTRD,kNparTRD); + // Empty spaces (air) + parTRD[0] = 87.00/2.0; + parTRD[1] = 10.00/2.0; + parTRD[2] = 1.50/2.0; + parTRD[3] = 26.35/2.0; + gMC->Gsvolu("USC1","TRD1",idtmed[1302-1],parTRD,kNparTRD); + xpos = 0.0; + ypos = 0.0; + zpos = 26.35/2.0 - 70.3/2.0; + gMC->Gspos("USC1",1,"USCB",xpos,ypos,zpos,0,"ONLY"); + // Empty spaces (air) + parTRD[0] = 10.00/2.0; + parTRD[1] = 111.00/2.0; + parTRD[2] = 1.50/2.0; + parTRD[3] = 35.05/2.0; + gMC->Gsvolu("USC2","TRD1",idtmed[1302-1],parTRD,kNparTRD); + xpos = 0.0; + ypos = 0.0; + zpos = 70.3/2.0 - 35.05/2.0; + gMC->Gspos("USC2",1,"USCB",xpos,ypos,zpos,0,"ONLY"); + // Empty spaces (air) + parTRP[ 0] = 1.50/2.0; + parTRP[ 1] = 0.0; + parTRP[ 2] = 0.0; + parTRP[ 3] = 37.60/2.0; + parTRP[ 4] = 63.90/2.0; + parTRP[ 5] = 8.86/2.0; + parTRP[ 6] = 16.0; + parTRP[ 7] = 37.60/2.0; + parTRP[ 8] = 63.90/2.0; + parTRP[ 9] = 8.86/2.0; + parTRP[10] = 16.0; + gMC->Gsvolu("USC3","TRAP",idtmed[1302-1],parTRP,kNparTRP); + xpos = -30.5; + ypos = 0.0; + zpos = -2.0; + gMC->Gspos("USC3",1,"USCB", xpos, ypos, zpos,matrix[4],"ONLY"); + gMC->Gspos("USC3",2,"USCB",-xpos, ypos, zpos,matrix[5],"ONLY"); + xpos = 0.0; + ypos = fClength[5][2]/2.0 + fClength[5][1] + fClength[5][0]; + zpos = 0.0; + gMC->Gspos("USCB",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USCB",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USCB",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USCB",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USCB",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USCB",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Upper bar (aluminum) + parBOX[0] = 95.00/2.0; + parBOX[1] = 1.50/2.0; + parBOX[2] = 3.00/2.0; + gMC->Gsvolu("USC4","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0 + fClength[5][1] + fClength[5][0]; + zpos = fgkSheight/2.0 - fgkSMpltT - 3.00/2.0; + gMC->Gspos("USC4",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC4",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC4",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC4",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC4",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC4",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Lower bar (aluminum) + parBOX[0] = 90.22/2.0; + parBOX[1] = 1.50/2.0; + parBOX[2] = 2.00/2.0; + gMC->Gsvolu("USC5","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0 + fClength[5][1] + fClength[5][0]; + zpos = -fgkSheight/2.0 + fgkSMpltT + 2.60; + gMC->Gspos("USC5",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC5",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC5",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC5",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC5",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC5",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // Lower bar (aluminum) + parBOX[0] = 82.60/2.0; + parBOX[1] = 1.50/2.0; + parBOX[2] = 1.60/2.0; + gMC->Gsvolu("USC6","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = fClength[5][2]/2.0 + fClength[5][1] + fClength[5][0]; + zpos = -fgkSheight/2.0 + fgkSMpltT + 1.60/2.0; + gMC->Gspos("USC6",1,"UTI1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC6",2,"UTI1", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC6",3,"UTI2", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC6",4,"UTI2", xpos,-ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC6",5,"UTI3", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("USC6",6,"UTI3", xpos,-ypos, zpos, 0,"ONLY"); + // // The long corner ledges // @@ -829,7 +1492,7 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) // Position of the corner ledges const Float_t kSCLposxUa = 0.7; const Float_t kSCLposxUb = 3.3; - const Float_t kSCLposzUa = 1.6; + const Float_t kSCLposzUa = 1.65; const Float_t kSCLposzUb = 0.3; // Vertical parSCL[0] = kSCLthkUa /2.0; @@ -851,8 +1514,12 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) ypos = 0.0; zpos = fgkSheight/2.0 - fgkSMpltT - kSCLposzUb; gMC->Gspos("USL2",1,"UTI1", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL2",3,"UTI2", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL2",5,"UTI3", xpos,ypos,zpos, 0,"ONLY"); xpos = -xpos; gMC->Gspos("USL2",2,"UTI1", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL2",4,"UTI2", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL2",6,"UTI3", xpos,ypos,zpos, 0,"ONLY"); // Lower ledges // Thickness of the corner ledges @@ -862,8 +1529,8 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) const Float_t kSCLwidLa = 8.5; const Float_t kSCLwidLb = 3.3; // Position of the corner ledges - const Float_t kSCLposxLa = 0.0; - const Float_t kSCLposxLb = 2.6; + const Float_t kSCLposxLa = 0.15; + const Float_t kSCLposxLb = 2.7; const Float_t kSCLposzLa = -4.25; const Float_t kSCLposzLb = -0.5; // Vertical @@ -884,8 +1551,12 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) ypos = 0.0; zpos = - fgkSheight/2.0 + fgkSMpltT - kSCLposzLa; gMC->Gspos("USL3",1,"UTI1", xpos,ypos,zpos,matrix[2],"ONLY"); + gMC->Gspos("USL3",3,"UTI2", xpos,ypos,zpos,matrix[2],"ONLY"); + gMC->Gspos("USL3",5,"UTI3", xpos,ypos,zpos,matrix[2],"ONLY"); xpos = -xpos; gMC->Gspos("USL3",2,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY"); + gMC->Gspos("USL3",4,"UTI2", xpos,ypos,zpos,matrix[3],"ONLY"); + gMC->Gspos("USL3",6,"UTI3", xpos,ypos,zpos,matrix[3],"ONLY"); // Horizontal parSCL[0] = kSCLwidLb /2.0; parSCL[1] = fgkSlength/2.0; @@ -895,8 +1566,65 @@ void AliTRDgeometry::CreateFrame(Int_t *idtmed) ypos = 0.0; zpos = - fgkSheight/2.0 + fgkSMpltT - kSCLposzLb; gMC->Gspos("USL4",1,"UTI1", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL4",3,"UTI2", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL4",5,"UTI3", xpos,ypos,zpos, 0,"ONLY"); xpos = -xpos; gMC->Gspos("USL4",2,"UTI1", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL4",4,"UTI2", xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("USL4",6,"UTI3", xpos,ypos,zpos, 0,"ONLY"); + + // + // Aluminum plates in the front part of the super modules + // + + const Int_t kNparTrd = 4; + Float_t parTrd[kNparTrd]; + parTrd[0] = fgkSwidth1/2.0 - 2.5; + parTrd[1] = fgkSwidth2/2.0 - 2.5; + parTrd[2] = fgkSMpltT /2.0; + parTrd[3] = fgkSheight/2.0 - 1.0; + gMC->Gsvolu("UTA1","TRD1",idtmed[1301-1],parTrd,kNparTrd); + xpos = 0.0; + ypos = fgkSMpltT/2.0 - fgkFlength/2.0; + zpos = -0.5; + gMC->Gspos("UTA1",1,"UTF1",xpos, ypos,zpos, 0,"ONLY"); + gMC->Gspos("UTA1",2,"UTF2",xpos,-ypos,zpos, 0,"ONLY"); + + const Int_t kNparPlt = 3; + Float_t parPlt[kNparPlt]; + parPlt[0] = 0.0; + parPlt[1] = 0.0; + parPlt[2] = 0.0; + gMC->Gsvolu("UTA2","BOX ",idtmed[1301-1],parPlt,0); + xpos = 0.0; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT/2.0; + parPlt[0] = fgkSwidth2/2.0 - 0.2; + parPlt[1] = fgkFlength/2.0; + parPlt[2] = fgkSMpltT /2.0; + gMC->Gsposp("UTA2",1,"UTF2",xpos,ypos,zpos + , 0,"ONLY",parPlt,kNparPlt); + xpos = (fgkSwidth1 + fgkSwidth2)/4.0 - fgkSMpltT/2.0 - 0.0016; + ypos = 0.0; + zpos = 0.0; + parPlt[0] = fgkSMpltT /2.0; + parPlt[1] = fgkFlength/2.0; + parPlt[2] = fgkSheight/2.0; + gMC->Gsposp("UTA2",2,"UTF2", xpos,ypos,zpos + ,matrix[0],"ONLY",parPlt,kNparPlt); + gMC->Gsposp("UTA2",3,"UTF2",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPlt,kNparPlt); + + // Additional aluminum bar + parBOX[0] = 80.0/2.0; + parBOX[1] = 1.0/2.0; + parBOX[2] = 10.0/2.0; + gMC->Gsvolu("UTA3","BOX ",idtmed[1301-1],parBOX,kNparBOX); + xpos = 0.0; + ypos = 1.0/2.0 + fgkSMpltT - fgkFlength/2.0; + zpos = fgkSheight/2.0 - 1.5 - 10.0/2.0; + gMC->Gspos("UTA3",1,"UTF1", xpos, ypos, zpos, 0,"ONLY"); + gMC->Gspos("UTA3",2,"UTF2", xpos,-ypos, zpos, 0,"ONLY"); } @@ -908,18 +1636,19 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) // // Names of the TRD services volumina // - // UTCL Cooling arterias (Al) - // UTCW Cooling arterias (Water) + // UTC1 Cooling arterias (Al) + // UTC2 Cooling arterias (Water) // UUxx Volumes for the services at the chambers (Air) - // UTPW Power bars (Cu) + // UTP1 Power bars (Cu) // UTCP Cooling pipes (Fe) // UTCH Cooling pipes (Water) // UTPL Power lines (Cu) // UMCM Readout MCMs (G10/Cu/Si) + // UTGD Gas distribution box (V2A) // - Int_t iplan = 0; - Int_t icham = 0; + Int_t ilayer = 0; + Int_t istack = 0; Float_t xpos = 0.0; Float_t ypos = 0.0; @@ -927,19 +1656,33 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) Char_t cTagV[5]; + const Int_t kNparBox = 3; + Float_t parBox[kNparBox]; + + const Int_t kNparTube = 3; + Float_t parTube[kNparTube]; + + // Services inside the baby frame + const Float_t kBBMdz = 223.0; + const Float_t kBBSdz = 8.5; + + // Services inside the back frame + const Float_t kBFMdz = 118.0; + const Float_t kBFSdz = 8.5; + // The rotation matrices - const Int_t kNmatrix = 4; + const Int_t kNmatrix = 10; Int_t matrix[kNmatrix]; - gMC->Matrix(matrix[0], 100.0, 0.0, 90.0, 90.0, 10.0, 0.0); - gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0); + gMC->Matrix(matrix[0], 100.0, 0.0, 90.0, 90.0, 10.0, 0.0); // rotation around y-axis + gMC->Matrix(matrix[1], 80.0, 0.0, 90.0, 90.0, 10.0, 180.0); // rotation around y-axis gMC->Matrix(matrix[2], 0.0, 0.0, 90.0, 90.0, 90.0, 0.0); gMC->Matrix(matrix[3], 180.0, 0.0, 90.0, 90.0, 90.0, 180.0); - - AliTRDCommonParam *commonParam = AliTRDCommonParam::Instance(); - if (!commonParam) { - AliError("Could not get common parameters\n"); - return; - } + gMC->Matrix(matrix[4], 90.0, 0.0, 0.0, 0.0, 90.0, 90.0); + gMC->Matrix(matrix[5], 100.0, 0.0, 90.0, 270.0, 10.0, 0.0); + gMC->Matrix(matrix[6], 80.0, 0.0, 90.0, 270.0, 10.0, 180.0); + gMC->Matrix(matrix[7], 90.0, 10.0, 90.0, 100.0, 0.0, 0.0); // rotation around z-axis + gMC->Matrix(matrix[8], 90.0, 350.0, 90.0, 80.0, 0.0, 0.0); // rotation around z-axis + gMC->Matrix(matrix[9], 90.0, 90.0, 90.0, 180.0, 0.0, 0.0); // rotation around z-axis // // The cooling arterias @@ -956,37 +1699,156 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) const Float_t kCOLthk = 0.1; const Int_t kNparCOL = 3; Float_t parCOL[kNparCOL]; - parCOL[0] = kCOLwid /2.0; - parCOL[1] = fgkSlength/2.0; - parCOL[2] = kCOLhgt /2.0; - gMC->Gsvolu("UTCL","BOX ",idtmed[1308-1],parCOL,kNparCOL); - parCOL[0] -= kCOLthk; - parCOL[1] = fgkSlength/2.0; - parCOL[2] -= kCOLthk; - gMC->Gsvolu("UTCW","BOX ",idtmed[1314-1],parCOL,kNparCOL); + parCOL[0] = 0.0; + parCOL[1] = 0.0; + parCOL[2] = 0.0; + gMC->Gsvolu("UTC1","BOX ",idtmed[1308-1],parCOL,0); + gMC->Gsvolu("UTC3","BOX ",idtmed[1308-1],parCOL,0); + parCOL[0] = kCOLwid/2.0 - kCOLthk; + parCOL[1] = -1.0; + parCOL[2] = kCOLhgt/2.0 - kCOLthk; + gMC->Gsvolu("UTC2","BOX ",idtmed[1314-1],parCOL,kNparCOL); + gMC->Gsvolu("UTC4","BOX ",idtmed[1314-1],parCOL,kNparCOL); xpos = 0.0; ypos = 0.0; zpos = 0.0; - gMC->Gspos("UTCW",1,"UTCL", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTC2",1,"UTC1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTC4",1,"UTC3", xpos,ypos,zpos,0,"ONLY"); + + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // Along the chambers + xpos = fCwidth[ilayer]/2.0 + kCOLwid/2.0 + kCOLposx; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz + + ilayer * (fgkCH + fgkVspace); + parCOL[0] = kCOLwid /2.0; + parCOL[1] = fgkSlength/2.0; + parCOL[2] = kCOLhgt /2.0; + gMC->Gsposp("UTC1",ilayer ,"UTI1", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",ilayer+ kNlayer,"UTI1",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",ilayer+6*kNlayer,"UTI2", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",ilayer+7*kNlayer,"UTI2",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",ilayer+8*kNlayer ,"UTI3", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",ilayer+9*kNlayer,"UTI3",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); + + // Front of supermodules + xpos = fCwidth[ilayer]/2.0 + kCOLwid/2.0 + kCOLposx; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz + + ilayer * (fgkCH + fgkVspace); + parCOL[0] = kCOLwid /2.0; + parCOL[1] = fgkFlength/2.0; + parCOL[2] = kCOLhgt /2.0; + gMC->Gsposp("UTC3",ilayer+2*kNlayer,"UTF1", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",ilayer+3*kNlayer,"UTF1",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",ilayer+4*kNlayer,"UTF2", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",ilayer+5*kNlayer,"UTF2",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); - for (iplan = 1; iplan < kNplan; iplan++) { + } - xpos = fCwidth[iplan]/2.0 + kCOLwid/2.0 + kCOLposx; - ypos = 0.0; - zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz - + iplan * (fgkCH + fgkVspace); - gMC->Gspos("UTCL",iplan ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY"); - gMC->Gspos("UTCL",iplan+kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY"); + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // In baby frame + xpos = fCwidth[ilayer]/2.0 + kCOLwid/2.0 - 1.04; + ypos = kBBSdz/2.0 - kBBMdz/2.0; + zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz + + ilayer * (fgkCH + fgkVspace); + parCOL[0] = kCOLwid/2.0; + parCOL[1] = kBBSdz /2.0; + parCOL[2] = kCOLhgt/2.0; + gMC->Gsposp("UTC3",ilayer+6*kNlayer,"BBTRD", xpos, ypos, zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",ilayer+7*kNlayer,"BBTRD",-xpos, ypos, zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); + + } + + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // In back frame + xpos = fCwidth[ilayer]/2.0 + kCOLwid/2.0 + kCOLposx; + ypos = -kBFSdz/2.0 + kBFMdz/2.0; + zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + kCOLposz + + ilayer * (fgkCH + fgkVspace); + parCOL[0] = kCOLwid/2.0; + parCOL[1] = kBFSdz /2.0; + parCOL[2] = kCOLhgt/2.0; + gMC->Gsposp("UTC3",ilayer+6*kNlayer,"BFTRD", xpos,ypos,zpos + ,matrix[0],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",ilayer+7*kNlayer,"BFTRD",-xpos,ypos,zpos + ,matrix[1],"ONLY",parCOL,kNparCOL); } // The upper most layer (reaching into TOF acceptance) - xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 1.3; - ypos = 0.0; - zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0; - gMC->Gspos("UTCL",6 ,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY"); - gMC->Gspos("UTCL",6+kNplan,"UTI1",-xpos,ypos,zpos,matrix[3],"ONLY"); + // Along the chambers + xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 1.3; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0; + parCOL[0] = kCOLwid /2.0; + parCOL[1] = fgkSlength/2.0; + parCOL[2] = kCOLhgt /2.0; + gMC->Gsposp("UTC1",6 ,"UTI1", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",6+ kNlayer,"UTI1",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",6+6*kNlayer,"UTI2", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",6+7*kNlayer,"UTI2",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",6+8*kNlayer,"UTI3", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC1",6+9*kNlayer,"UTI3",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + // Front of supermodules + xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 1.3; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0; + parCOL[0] = kCOLwid /2.0; + parCOL[1] = fgkFlength/2.0; + parCOL[2] = kCOLhgt /2.0; + gMC->Gsposp("UTC3",6+2*kNlayer,"UTF1", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",6+3*kNlayer,"UTF1",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",6+4*kNlayer,"UTF2", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",6+5*kNlayer,"UTF2",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + // In baby frame + xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 3.1; + ypos = kBBSdz/2.0 - kBBMdz/2.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0; + parCOL[0] = kCOLwid/2.0; + parCOL[1] = kBBSdz /2.0; + parCOL[2] = kCOLhgt/2.0; + gMC->Gsposp("UTC3",6+6*kNlayer,"BBTRD", xpos, ypos, zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",6+7*kNlayer,"BBTRD",-xpos, ypos, zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + // In back frame + xpos = fCwidth[5]/2.0 - kCOLhgt/2.0 - 1.3; + ypos = -kBFSdz/2.0 + kBFMdz/2.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.4 - kCOLwid/2.0; + parCOL[0] = kCOLwid/2.0; + parCOL[1] = kBFSdz /2.0; + parCOL[2] = kCOLhgt/2.0; + gMC->Gsposp("UTC3",6+6*kNlayer,"BFTRD", xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); + gMC->Gsposp("UTC3",6+7*kNlayer,"BFTRD",-xpos,ypos,zpos + ,matrix[3],"ONLY",parCOL,kNparCOL); // // The power bars @@ -998,28 +1860,171 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) const Float_t kPWRposz = 1.9; const Int_t kNparPWR = 3; Float_t parPWR[kNparPWR]; - parPWR[0] = kPWRwid /2.0; - parPWR[1] = fgkSlength/2.0; - parPWR[2] = kPWRhgt /2.0; - gMC->Gsvolu("UTPW","BOX ",idtmed[1325-1],parPWR,kNparPWR); + parPWR[0] = 0.0; + parPWR[1] = 0.0; + parPWR[2] = 0.0; + gMC->Gsvolu("UTP1","BOX ",idtmed[1325-1],parPWR,0); + gMC->Gsvolu("UTP3","BOX ",idtmed[1325-1],parPWR,0); - for (iplan = 1; iplan < kNplan; iplan++) { - - xpos = fCwidth[iplan]/2.0 + kPWRwid/2.0 + kPWRposx; - ypos = 0.0; - zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz - + iplan * (fgkCH + fgkVspace); - gMC->Gspos("UTPW",iplan ,"UTI1", xpos,ypos,zpos,matrix[0],"ONLY"); - gMC->Gspos("UTPW",iplan+kNplan,"UTI1",-xpos,ypos,zpos,matrix[1],"ONLY"); + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // Along the chambers + xpos = fCwidth[ilayer]/2.0 + kPWRwid/2.0 + kPWRposx; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz + + ilayer * (fgkCH + fgkVspace); + parPWR[0] = kPWRwid /2.0; + parPWR[1] = fgkSlength/2.0; + parPWR[2] = kPWRhgt /2.0; + gMC->Gsposp("UTP1",ilayer ,"UTI1", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",ilayer+ kNlayer,"UTI1",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",ilayer+6*kNlayer,"UTI2", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",ilayer+7*kNlayer,"UTI2",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",ilayer+8*kNlayer,"UTI3", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",ilayer+9*kNlayer,"UTI3",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + + // Front of supermodule + xpos = fCwidth[ilayer]/2.0 + kPWRwid/2.0 + kPWRposx; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz + + ilayer * (fgkCH + fgkVspace); + parPWR[0] = kPWRwid /2.0; + parPWR[1] = fgkFlength/2.0; + parPWR[2] = kPWRhgt /2.0; + gMC->Gsposp("UTP3",ilayer+2*kNlayer,"UTF1", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",ilayer+3*kNlayer,"UTF1",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",ilayer+4*kNlayer,"UTF2", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",ilayer+5*kNlayer,"UTF2",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); } - // The upper most layer (reaching into TOF acceptance) - xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 1.3; + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // In baby frame + xpos = fCwidth[ilayer]/2.0 + kPWRwid/2.0; + ypos = kBBSdz/2.0 - kBBMdz/2.0; + zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz + + ilayer * (fgkCH + fgkVspace); + parPWR[0] = kPWRwid/2.0; + parPWR[1] = kBBSdz /2.0; + parPWR[2] = kPWRhgt/2.0; + gMC->Gsposp("UTP3",ilayer+6*kNlayer,"BBTRD", xpos, ypos, zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",ilayer+7*kNlayer,"BBTRD",-xpos, ypos, zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + + } + + for (ilayer = 1; ilayer < kNlayer; ilayer++) { + + // In back frame + xpos = fCwidth[ilayer]/2.0 + kPWRwid/2.0 + kPWRposx; + ypos = -kBFSdz/2.0 + kBFMdz/2.0; + zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz + + ilayer * (fgkCH + fgkVspace); + parPWR[0] = kPWRwid/2.0; + parPWR[1] = kBFSdz /2.0; + parPWR[2] = kPWRhgt/2.0; + gMC->Gsposp("UTP3",ilayer+8*kNlayer,"BFTRD", xpos,ypos,zpos + ,matrix[0],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",ilayer+9*kNlayer,"BFTRD",-xpos,ypos,zpos + ,matrix[1],"ONLY",parPWR,kNparPWR); + + } + + // The upper most layer + // Along the chambers + xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 1.3; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0; + parPWR[0] = kPWRwid /2.0; + parPWR[1] = fgkSlength/2.0; + parPWR[2] = kPWRhgt /2.0; + gMC->Gsposp("UTP1",6 ,"UTI1", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",6+ kNlayer,"UTI1",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",6+6*kNlayer,"UTI2", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",6+7*kNlayer,"UTI2",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",6+8*kNlayer,"UTI3", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP1",6+9*kNlayer,"UTI3",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + // Front of supermodules + xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 1.3; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0; + parPWR[0] = kPWRwid /2.0; + parPWR[1] = fgkFlength/2.0; + parPWR[2] = kPWRhgt /2.0; + gMC->Gsposp("UTP3",6+2*kNlayer,"UTF1", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",6+3*kNlayer,"UTF1",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",6+4*kNlayer,"UTF2", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",6+5*kNlayer,"UTF2",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + // In baby frame + xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 3.0; + ypos = kBBSdz/2.0 - kBBMdz/2.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0; + parPWR[0] = kPWRwid/2.0; + parPWR[1] = kBBSdz /2.0; + parPWR[2] = kPWRhgt/2.0; + gMC->Gsposp("UTP3",6+6*kNlayer,"BBTRD", xpos, ypos, zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",6+7*kNlayer,"BBTRD",-xpos, ypos, zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + // In back frame + xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 1.3; + ypos = -kBFSdz/2.0 + kBFMdz/2.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0; + parPWR[0] = kPWRwid/2.0; + parPWR[1] = kBFSdz /2.0; + parPWR[2] = kPWRhgt/2.0; + gMC->Gsposp("UTP3",6+8*kNlayer,"BFTRD", xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + gMC->Gsposp("UTP3",6+9*kNlayer,"BFTRD",-xpos,ypos,zpos + ,matrix[3],"ONLY",parPWR,kNparPWR); + + // + // The gas tubes connecting the chambers in the super modules with holes + // Material: Stainless steel + // + + parTube[0] = 0.0; + parTube[1] = 2.2/2.0; + parTube[2] = fClength[5][2]/2.0 - fgkHspace/2.0; + gMC->Gsvolu("UTG1","TUBE",idtmed[1308-1],parTube,kNparTube); + parTube[0] = 0.0; + parTube[1] = 2.1/2.0; + parTube[2] = fClength[5][2]/2.0 - fgkHspace/2.0; + gMC->Gsvolu("UTG2","TUBE",idtmed[1309-1],parTube,kNparTube); + xpos = 0.0; ypos = 0.0; - zpos = fgkSheight/2.0 - fgkSMpltT - 0.6 - kPWRwid/2.0; - gMC->Gspos("UTPW",6 ,"UTI1", xpos,ypos,zpos,matrix[3],"ONLY"); - gMC->Gspos("UTPW",6+kNplan,"UTI1",-xpos,ypos,zpos,matrix[3],"ONLY"); + zpos = 0.0; + gMC->Gspos("UTG2",1,"UTG1",xpos,ypos,zpos,0,"ONLY"); + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + xpos = fCwidth[ilayer]/2.0 + kCOLwid/2.0 - 1.5; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kCOLhgt/2.0 - fgkSheight/2.0 + 5.0 + + ilayer * (fgkCH + fgkVspace); + gMC->Gspos("UTG1",1+ilayer,"UTI3", xpos, ypos, zpos,matrix[4],"ONLY"); + gMC->Gspos("UTG1",7+ilayer,"UTI3",-xpos, ypos, zpos,matrix[4],"ONLY"); + } // // The volumes for the services at the chambers @@ -1028,28 +2033,28 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) const Int_t kNparServ = 3; Float_t parServ[kNparServ]; - for (icham = 0; icham < kNcham; icham++) { - for (iplan = 0; iplan < kNplan; iplan++) { + for (istack = 0; istack < kNstack; istack++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { - Int_t iDet = GetDetectorSec(iplan,icham); + Int_t iDet = GetDetectorSec(ilayer,istack); sprintf(cTagV,"UU%02d",iDet); - parServ[0] = fCwidth[iplan] /2.0; - parServ[1] = fClength[iplan][icham]/2.0 - fgkHspace/2.0; - parServ[2] = fgkVspace /2.0 - 0.742/2.0; + parServ[0] = fCwidth[ilayer] /2.0; + parServ[1] = fClength[ilayer][istack]/2.0 - fgkHspace/2.0; + parServ[2] = fgkVspace /2.0 - 0.742/2.0; fChamberUUboxd[iDet][0] = parServ[0]; fChamberUUboxd[iDet][1] = parServ[1]; fChamberUUboxd[iDet][2] = parServ[2]; gMC->Gsvolu(cTagV,"BOX",idtmed[1302-1],parServ,kNparServ); xpos = 0.0; - ypos = fClength[iplan][0] + fClength[iplan][1] + fClength[iplan][2]/2.0; - for (Int_t ic = 0; ic < icham; ic++) { - ypos -= fClength[iplan][ic]; + ypos = fClength[ilayer][0] + fClength[ilayer][1] + fClength[ilayer][2]/2.0; + for (Int_t ic = 0; ic < istack; ic++) { + ypos -= fClength[ilayer][ic]; } - ypos -= fClength[iplan][icham]/2.0; - zpos = fgkVrocsm + fgkSMpltT + fgkCH + fgkVspace/2.0 - fgkSheight/2.0 - + iplan * (fgkCH + fgkVspace); + ypos -= fClength[ilayer][istack]/2.0; + zpos = fgkVrocsm + fgkSMpltT + fgkCH + fgkVspace/2.0 - fgkSheight/2.0 + + ilayer * (fgkCH + fgkVspace); zpos -= 0.742/2.0; fChamberUUorig[iDet][0] = xpos; fChamberUUorig[iDet][1] = ypos; @@ -1062,17 +2067,15 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) // The cooling pipes inside the service volumes // - const Int_t kNparTube = 3; - Float_t parTube[kNparTube]; // The cooling pipes - parTube[0] = 0.0; - parTube[1] = 0.0; - parTube[2] = 0.0; + parTube[0] = 0.0; + parTube[1] = 0.0; + parTube[2] = 0.0; gMC->Gsvolu("UTCP","TUBE",idtmed[1324-1],parTube,0); // The cooling water parTube[0] = 0.0; parTube[1] = 0.2/2.0; - parTube[2] = -1.; + parTube[2] = -1.0; gMC->Gsvolu("UTCH","TUBE",idtmed[1314-1],parTube,kNparTube); // Water inside the cooling pipe xpos = 0.0; @@ -1081,26 +2084,25 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) gMC->Gspos("UTCH",1,"UTCP",xpos,ypos,zpos,0,"ONLY"); // Position the cooling pipes in the mother volume - const Int_t kNpar = 3; - Float_t par[kNpar]; - for (icham = 0; icham < kNcham; icham++) { - for (iplan = 0; iplan < kNplan; iplan++) { - Int_t iDet = GetDetectorSec(iplan,icham); - Int_t iCopy = GetDetector(iplan,icham,0) * 100; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); - Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) + for (istack = 0; istack < kNstack; istack++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + Int_t iDet = GetDetectorSec(ilayer,istack); + Int_t iCopy = GetDetector(ilayer,istack,0) * 100; + Int_t nMCMrow = GetRowMax(ilayer,istack,0); + Float_t ySize = (GetChamberLength(ilayer,istack) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); sprintf(cTagV,"UU%02d",iDet); for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) { xpos = 0.0; ypos = (0.5 + iMCMrow) * ySize - 1.9 - - fClength[iplan][icham]/2.0 + fgkHspace/2.0; + - fClength[ilayer][istack]/2.0 + fgkHspace/2.0; zpos = 0.0 + 0.742/2.0; - par[0] = 0.0; - par[1] = 0.3/2.0; // Thickness of the cooling pipes - par[2] = fCwidth[iplan]/2.0; + // The cooling pipes + parTube[0] = 0.0; + parTube[1] = 0.3/2.0; // Thickness of the cooling pipes + parTube[2] = fCwidth[ilayer]/2.0; gMC->Gsposp("UTCP",iCopy+iMCMrow,cTagV,xpos,ypos,zpos - ,matrix[2],"ONLY",par,kNpar); + ,matrix[2],"ONLY",parTube,kNparTube); } } } @@ -1116,24 +2118,24 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) gMC->Gsvolu("UTPL","TUBE",idtmed[1305-1],parTube,0); // Position the power lines in the mother volume - for (icham = 0; icham < kNcham; icham++) { - for (iplan = 0; iplan < kNplan; iplan++) { - Int_t iDet = GetDetectorSec(iplan,icham); - Int_t iCopy = GetDetector(iplan,icham,0) * 100; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); - Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) + for (istack = 0; istack < kNstack; istack++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + Int_t iDet = GetDetectorSec(ilayer,istack); + Int_t iCopy = GetDetector(ilayer,istack,0) * 100; + Int_t nMCMrow = GetRowMax(ilayer,istack,0); + Float_t ySize = (GetChamberLength(ilayer,istack) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); sprintf(cTagV,"UU%02d",iDet); for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) { - xpos = 0.0; - ypos = (0.5 + iMCMrow) * ySize - 1.0 - - fClength[iplan][icham]/2.0 + fgkHspace/2.0; - zpos = -0.4 + 0.742/2.0; - par[0] = 0.0; - par[1] = 0.2/2.0; // Thickness of the power lines - par[2] = fCwidth[iplan]/2.0; + xpos = 0.0; + ypos = (0.5 + iMCMrow) * ySize - 1.0 + - fClength[ilayer][istack]/2.0 + fgkHspace/2.0; + zpos = -0.4 + 0.742/2.0; + parTube[0] = 0.0; + parTube[1] = 0.2/2.0; // Thickness of the power lines + parTube[2] = fCwidth[ilayer]/2.0; gMC->Gsposp("UTPL",iCopy+iMCMrow,cTagV,xpos,ypos,zpos - ,matrix[2],"ONLY",par,kNpar); + ,matrix[2],"ONLY",parTube,kNparTube); } } } @@ -1145,11 +2147,11 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) const Float_t kMCMx = 3.0; const Float_t kMCMy = 3.0; const Float_t kMCMz = 0.3; - + const Float_t kMCMpcTh = 0.1; - const Float_t kMCMcuTh = 0.0215; - const Float_t kMCMsiTh = 0.003; - const Float_t kMCMcoTh = 0.1549; + const Float_t kMCMcuTh = 0.0025; + const Float_t kMCMsiTh = 0.03; + const Float_t kMCMcoTh = 0.04; // The mother volume for the MCMs (air) const Int_t kNparMCM = 3; @@ -1193,39 +2195,278 @@ void AliTRDgeometry::CreateServices(Int_t *idtmed) gMC->Gspos("UMC4",1,"UMCM",xpos,ypos,zpos,0,"ONLY"); // Position the MCMs in the mother volume - for (icham = 0; icham < kNcham; icham++) { - for (iplan = 0; iplan < kNplan; iplan++) { - Int_t iDet = GetDetectorSec(iplan,icham); - Int_t iCopy = GetDetector(iplan,icham,0) * 1000; - Int_t nMCMrow = commonParam->GetRowMax(iplan,icham,0); - Float_t ySize = (GetChamberLength(iplan,icham) - 2.0*fgkRpadW) + for (istack = 0; istack < kNstack; istack++) { + for (ilayer = 0; ilayer < kNlayer; ilayer++) { + Int_t iDet = GetDetectorSec(ilayer,istack); + Int_t iCopy = GetDetector(ilayer,istack,0) * 1000; + Int_t nMCMrow = GetRowMax(ilayer,istack,0); + Float_t ySize = (GetChamberLength(ilayer,istack) - 2.0*fgkRpadW) / ((Float_t) nMCMrow); Int_t nMCMcol = 8; - Float_t xSize = (GetChamberWidth(iplan) - 2.0*fgkCpadW) - / ((Float_t) nMCMcol); + Float_t xSize = (GetChamberWidth(ilayer) - 2.0*fgkCpadW) + / ((Float_t) nMCMcol + 6); // Introduce 6 gaps + Int_t iMCM[8] = { 1, 2, 3, 5, 8, 9, 10, 12 }; // 0..7 MCM + 6 gap structure sprintf(cTagV,"UU%02d",iDet); for (Int_t iMCMrow = 0; iMCMrow < nMCMrow; iMCMrow++) { for (Int_t iMCMcol = 0; iMCMcol < nMCMcol; iMCMcol++) { - xpos = (0.5 + iMCMcol) * xSize + 1.0 - - fCwidth[iplan]/2.0; - ypos = (0.5 + iMCMrow) * ySize + 1.0 - - fClength[iplan][icham]/2.0 + fgkHspace/2.0; - zpos = -0.4 + 0.742/2.0; - par[0] = 0.0; - par[1] = 0.2/2.0; // Thickness of the power lines - par[2] = fCwidth[iplan]/2.0; + xpos = (0.5 + iMCM[iMCMcol]) * xSize + 1.0 + - fCwidth[ilayer]/2.0; + ypos = (0.5 + iMCMrow) * ySize + 1.0 + - fClength[ilayer][istack]/2.0 + fgkHspace/2.0; + zpos = -0.4 + 0.742/2.0; gMC->Gspos("UMCM",iCopy+iMCMrow*10+iMCMcol,cTagV ,xpos,ypos,zpos,0,"ONLY"); - } + } } } } + // + // Services in front of the super module + // + + // Gas in-/outlet pipes (INOX) + parTube[0] = 0.0; + parTube[1] = 0.0; + parTube[2] = 0.0; + gMC->Gsvolu("UTG3","TUBE",idtmed[1308-1],parTube,0); + // The gas inside the in-/outlet pipes (Xe) + parTube[0] = 0.0; + parTube[1] = 1.2/2.0; + parTube[2] = -1.0; + gMC->Gsvolu("UTG4","TUBE",idtmed[1309-1],parTube,kNparTube); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTG4",1,"UTG3",xpos,ypos,zpos,0,"ONLY"); + for (ilayer = 0; ilayer < kNlayer-1; ilayer++) { + xpos = 0.0; + ypos = fClength[ilayer][2]/2.0 + + fClength[ilayer][1] + + fClength[ilayer][0]; + zpos = 9.0 - fgkSheight/2.0 + + ilayer * (fgkCH + fgkVspace); + parTube[0] = 0.0; + parTube[1] = 1.5/2.0; + parTube[2] = fCwidth[ilayer]/2.0 - 2.5; + gMC->Gsposp("UTG3",ilayer+1 ,"UTI1", xpos, ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + gMC->Gsposp("UTG3",ilayer+1+1*kNlayer,"UTI1", xpos,-ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + gMC->Gsposp("UTG3",ilayer+1+2*kNlayer,"UTI2", xpos, ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + gMC->Gsposp("UTG3",ilayer+1+3*kNlayer,"UTI2", xpos,-ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + gMC->Gsposp("UTG3",ilayer+1+4*kNlayer,"UTI3", xpos, ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + gMC->Gsposp("UTG3",ilayer+1+5*kNlayer,"UTI3", xpos,-ypos, zpos + ,matrix[2],"ONLY",parTube,kNparTube); + } + + // Gas distribution box + parBox[0] = 14.50/2.0; + parBox[1] = 4.52/2.0; + parBox[2] = 5.00/2.0; + gMC->Gsvolu("UTGD","BOX ",idtmed[1308-1],parBox,kNparBox); + parBox[0] = 14.50/2.0; + parBox[1] = 4.00/2.0; + parBox[2] = 4.40/2.0; + gMC->Gsvolu("UTGI","BOX ",idtmed[1309-1],parBox,kNparBox); + parTube[0] = 0.0; + parTube[1] = 4.0/2.0; + parTube[2] = 8.0/2.0; + gMC->Gsvolu("UTGT","TUBE",idtmed[1308-1],parTube,kNparTube); + parTube[0] = 0.0; + parTube[1] = 3.4/2.0; + parTube[2] = 8.0/2.0; + gMC->Gsvolu("UTGG","TUBE",idtmed[1309-1],parTube,kNparTube); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTGI",1,"UTGD",xpos,ypos,zpos, 0,"ONLY"); + gMC->Gspos("UTGG",1,"UTGT",xpos,ypos,zpos, 0,"ONLY"); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTGD",1,"UTF1",xpos,ypos,zpos, 0,"ONLY"); + xpos = -3.0; + ypos = 0.0; + zpos = 6.5; + gMC->Gspos("UTGT",1,"UTF1",xpos,ypos,zpos, 0,"ONLY"); + xpos = -11.25; + ypos = 0.0; + zpos = 0.5; + gMC->Gspos("UTGT",3,"UTF1",xpos,ypos,zpos,matrix[2],"ONLY"); + xpos = 11.25; + ypos = 0.0; + zpos = 0.5; + gMC->Gspos("UTGT",5,"UTF1",xpos,ypos,zpos,matrix[2],"ONLY"); + + // Cooling manifolds + parBox[0] = 5.0/2.0; + parBox[1] = 23.0/2.0; + parBox[2] = 70.0/2.0; + gMC->Gsvolu("UTCM","BOX ",idtmed[1302-1],parBox,kNparBox); + parBox[0] = 5.0/2.0; + parBox[1] = 5.0/2.0; + parBox[2] = 70.0/2.0; + gMC->Gsvolu("UTCA","BOX ",idtmed[1308-1],parBox,kNparBox); + parBox[0] = 5.0/2.0 - 0.3; + parBox[1] = 5.0/2.0 - 0.3; + parBox[2] = 70.0/2.0 - 0.3; + gMC->Gsvolu("UTCW","BOX ",idtmed[1314-1],parBox,kNparBox); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTCW",1,"UTCA", xpos, ypos, zpos, 0,"ONLY"); + xpos = 0.0; + ypos = 5.0/2.0 - 23.0/2.0; + zpos = 0.0; + gMC->Gspos("UTCA",1,"UTCM", xpos, ypos, zpos, 0,"ONLY"); + parTube[0] = 0.0; + parTube[1] = 3.0/2.0; + parTube[2] = 18.0/2.0; + gMC->Gsvolu("UTCO","TUBE",idtmed[1308-1],parTube,kNparTube); + parTube[0] = 0.0; + parTube[1] = 3.0/2.0 - 0.3; + parTube[2] = 18.0/2.0; + gMC->Gsvolu("UTCL","TUBE",idtmed[1314-1],parTube,kNparTube); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTCL",1,"UTCO", xpos, ypos, zpos, 0,"ONLY"); + xpos = 0.0; + ypos = 2.5; + zpos = -70.0/2.0 + 7.0; + gMC->Gspos("UTCO",1,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",2,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",3,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",4,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",5,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",6,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",7,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + zpos += 7.0; + gMC->Gspos("UTCO",8,"UTCM", xpos, ypos, zpos,matrix[4],"ONLY"); + + xpos = 40.0; + ypos = fgkFlength/2.0 - 23.0/2.0; + zpos = 0.0; + gMC->Gspos("UTCM",1,"UTF1", xpos, ypos, zpos,matrix[0],"ONLY"); + gMC->Gspos("UTCM",2,"UTF1",-xpos, ypos, zpos,matrix[1],"ONLY"); + gMC->Gspos("UTCM",3,"UTF2", xpos,-ypos, zpos,matrix[5],"ONLY"); + gMC->Gspos("UTCM",4,"UTF2",-xpos,-ypos, zpos,matrix[6],"ONLY"); + + // Power connection boards (Cu) + parBox[0] = 0.5/2.0; + parBox[1] = 15.0/2.0; + parBox[2] = 7.0/2.0; + gMC->Gsvolu("UTPC","BOX ",idtmed[1325-1],parBox,kNparBox); + for (ilayer = 0; ilayer < kNlayer-1; ilayer++) { + xpos = fCwidth[ilayer]/2.0 + kPWRwid/2.0; + ypos = 0.0; + zpos = fgkVrocsm + fgkSMpltT + kPWRhgt/2.0 - fgkSheight/2.0 + kPWRposz + + (ilayer+1) * (fgkCH + fgkVspace); + gMC->Gspos("UTPC",ilayer ,"UTF1", xpos,ypos,zpos,matrix[0],"ONLY"); + gMC->Gspos("UTPC",ilayer+kNlayer,"UTF1",-xpos,ypos,zpos,matrix[1],"ONLY"); + } + xpos = fCwidth[5]/2.0 + kPWRhgt/2.0 - 2.0; + ypos = 0.0; + zpos = fgkSheight/2.0 - fgkSMpltT - 2.0; + gMC->Gspos("UTPC",5 ,"UTF1", xpos,ypos,zpos,matrix[3],"ONLY"); + gMC->Gspos("UTPC",5+kNlayer,"UTF1",-xpos,ypos,zpos,matrix[3],"ONLY"); + + // Power connection panel (Al) + parBox[0] = 60.0/2.0; + parBox[1] = 10.0/2.0; + parBox[2] = 3.0/2.0; + gMC->Gsvolu("UTPP","BOX ",idtmed[1301-1],parBox,kNparBox); + xpos = 0.0; + ypos = 0.0; + zpos = 18.0; + gMC->Gspos("UTPP",1,"UTF1", xpos,ypos,zpos,0,"ONLY"); + + // + // Electronics boxes + // + + // Casing (INOX) + parBox[0] = 60.0/2.0; + parBox[1] = 10.0/2.0; + parBox[2] = 6.0/2.0; + gMC->Gsvolu("UTE1","BOX ",idtmed[1308-1],parBox,kNparBox); + // Interior (air) + parBox[0] = parBox[0] - 0.5; + parBox[1] = parBox[1] - 0.5; + parBox[2] = parBox[2] - 0.5; + gMC->Gsvolu("UTE2","BOX ",idtmed[1302-1],parBox,kNparBox); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTE2",1,"UTE1",xpos,ypos,zpos,0,"ONLY"); + xpos = 0.0; + ypos = fgkSlength/2.0 - 10.0/2.0 - 3.0; + zpos = -fgkSheight/2.0 + 6.0/2.0 + 1.0; + gMC->Gspos("UTE1",1,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE1",2,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE1",3,"UTI3", xpos,ypos,zpos,0,"ONLY"); + + // Casing (INOX) + parBox[0] = 50.0/2.0; + parBox[1] = 15.0/2.0; + parBox[2] = 20.0/2.0; + gMC->Gsvolu("UTE3","BOX ",idtmed[1308-1],parBox,kNparBox); + // Interior (air) + parBox[0] = parBox[0] - 0.5; + parBox[1] = parBox[1] - 0.5; + parBox[2] = parBox[2] - 0.5; + gMC->Gsvolu("UTE4","BOX ",idtmed[1302-1],parBox,kNparBox); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTE4",1,"UTE3",xpos,ypos,zpos,0,"ONLY"); + xpos = 0.0; + ypos = -fgkSlength/2.0 + 15.0/2.0 + 3.0; + zpos = -fgkSheight/2.0 + 20.0/2.0 + 1.0; + gMC->Gspos("UTE3",1,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE3",2,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE3",3,"UTI3", xpos,ypos,zpos,0,"ONLY"); + + // Casing (INOX) + parBox[0] = 20.0/2.0; + parBox[1] = 7.0/2.0; + parBox[2] = 20.0/2.0; + gMC->Gsvolu("UTE5","BOX ",idtmed[1308-1],parBox,kNparBox); + // Interior (air) + parBox[0] = parBox[0] - 0.5; + parBox[1] = parBox[1] - 0.5; + parBox[2] = parBox[2] - 0.5; + gMC->Gsvolu("UTE6","BOX ",idtmed[1302-1],parBox,kNparBox); + xpos = 0.0; + ypos = 0.0; + zpos = 0.0; + gMC->Gspos("UTE6",1,"UTE5",xpos,ypos,zpos,0,"ONLY"); + xpos = 20.0; + ypos = -fgkSlength/2.0 + 7.0/2.0 + 3.0; + zpos = 0.0; + gMC->Gspos("UTE5",1,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE5",2,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE5",3,"UTI3", xpos,ypos,zpos,0,"ONLY"); + xpos = -xpos; + gMC->Gspos("UTE5",4,"UTI1", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE5",5,"UTI2", xpos,ypos,zpos,0,"ONLY"); + gMC->Gspos("UTE5",6,"UTI3", xpos,ypos,zpos,0,"ONLY"); + } //_____________________________________________________________________________ -void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed) +void AliTRDgeometry::GroupChamber(Int_t ilayer, Int_t istack, Int_t *idtmed) { // // Group volumes UA, UD, UF, UU in a single chamber (Air) @@ -1235,7 +2476,7 @@ void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed) const Int_t kNparCha = 3; - Int_t iDet = GetDetectorSec(iplan,icham); + Int_t iDet = GetDetectorSec(ilayer,istack); Float_t xyzMin[3]; Float_t xyzMax[3]; @@ -1318,287 +2559,248 @@ void AliTRDgeometry::GroupChamber(Int_t iplan, Int_t icham, Int_t *idtmed) ,xyzOrig[1] ,xyzOrig[2] ,0,"ONLY"); + gMC->Gspos(cTagV,1,"UTI2" + ,xyzOrig[0] + ,xyzOrig[1] + ,xyzOrig[2] + ,0,"ONLY"); + if (istack != 2) { + // W/o middle stack + gMC->Gspos(cTagV,1,"UTI3" + ,xyzOrig[0] + ,xyzOrig[1] + ,xyzOrig[2] + ,0,"ONLY"); + } } //_____________________________________________________________________________ -Bool_t AliTRDgeometry::Rotate(Int_t d, Double_t *pos, Double_t *rot) const +Bool_t AliTRDgeometry::RotateBack(Int_t det, Double_t *loc, Double_t *glb) const { // - // Rotates all chambers in the position of sector 0 and transforms - // the coordinates in the ALICE restframe into the - // corresponding local frame . + // Rotates a chambers to transform the corresponding local frame + // coordinates into the coordinates of the ALICE restframe . // - Int_t sector = GetSector(d); + Int_t sector = GetSector(det); - rot[0] = pos[0] * fRotA11[sector] + pos[1] * fRotA12[sector]; - rot[1] = -pos[0] * fRotA21[sector] + pos[1] * fRotA22[sector]; - rot[2] = pos[2]; + glb[0] = loc[0] * fRotB11[sector] - loc[1] * fRotB12[sector]; + glb[1] = loc[0] * fRotB21[sector] + loc[1] * fRotB22[sector]; + glb[2] = loc[2]; return kTRUE; } //_____________________________________________________________________________ -Bool_t AliTRDgeometry::RotateBack(Int_t d, Double_t *rot, Double_t *pos) const +Int_t AliTRDgeometry::GetDetectorSec(Int_t layer, Int_t stack) { // - // Rotates a chambers from the position of sector 0 into its - // original position and transforms the corresponding local frame - // coordinates into the coordinates of the ALICE restframe . + // Convert plane / stack into detector number for one single sector // - Int_t sector = GetSector(d); - - pos[0] = rot[0] * fRotB11[sector] + rot[1] * fRotB12[sector]; - pos[1] = -rot[0] * fRotB21[sector] + rot[1] * fRotB22[sector]; - pos[2] = rot[2]; - - return kTRUE; + return (layer + stack * fgkNlayer); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetDetectorSec(Int_t p, Int_t c) +Int_t AliTRDgeometry::GetDetector(Int_t layer, Int_t stack, Int_t sector) { // - // Convert plane / chamber into detector number for one single sector + // Convert layer / stack / sector into detector number // - return (p + c * fgkNplan); + return (layer + stack * fgkNlayer + sector * fgkNlayer * fgkNstack); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetDetector(Int_t p, Int_t c, Int_t s) +Int_t AliTRDgeometry::GetLayer(Int_t det) { // - // Convert plane / chamber / sector into detector number + // Reconstruct the layer number from the detector number // - return (p + c * fgkNplan + s * fgkNplan * fgkNcham); + return ((Int_t) (det % fgkNlayer)); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetPlane(Int_t d) const +Int_t AliTRDgeometry::GetStack(Int_t det) const { // - // Reconstruct the plane number from the detector number + // Reconstruct the stack number from the detector number // - return ((Int_t) (d % fgkNplan)); + return ((Int_t) (det % (fgkNlayer * fgkNstack)) / fgkNlayer); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetChamber(Int_t d) const +Int_t AliTRDgeometry::GetStack(Double_t z, Int_t layer) { // - // Reconstruct the chamber number from the detector number + // Reconstruct the chamber number from the z position and layer number + // + // The return function has to be protected for positiveness !! // - return ((Int_t) (d % (fgkNplan * fgkNcham)) / fgkNplan); + if ((layer < 0) || + (layer >= fgkNlayer)) return -1; + + Int_t istck = fgkNstack; + Double_t zmin; + Double_t zmax; + + do { + istck--; + if (istck < 0) break; + AliTRDpadPlane *pp = GetPadPlane(layer,istck); + zmax = pp->GetRow0(); + Int_t nrows = pp->GetNrows(); + zmin = zmax - 2 * pp->GetLengthOPad() + - (nrows-2) * pp->GetLengthIPad() + - (nrows-1) * pp->GetRowSpacing(); + } while((z < zmin) || (z > zmax)); + + return istck; } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetSector(Int_t d) const +Int_t AliTRDgeometry::GetSector(Int_t det) const { // // Reconstruct the sector number from the detector number // - return ((Int_t) (d / (fgkNplan * fgkNcham))); - -} - -//_____________________________________________________________________________ -Int_t AliTRDgeometry::GetPadRowFromMCM(Int_t irob, Int_t imcm) const -{ - - // return on which row this mcm sits + return ((Int_t) (det / (fgkNlayer * fgkNstack))); - return fgkMCMrow*(irob/2) + imcm/fgkMCMrow; - -; } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetPadColFromADC(Int_t irob, Int_t imcm, Int_t iadc) const +AliTRDpadPlane *AliTRDgeometry::GetPadPlane(Int_t layer, Int_t stack) { // - // return which pad is connected to this adc channel. - // - // ADC channels 2 to 19 are connected directly to a pad via PASA. - // ADC channels 0, 1 and 20 are not connected to the PASA on this MCM. - // So the mapping (for MCM 0 on ROB 0 at least) is - // - // ADC channel : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 - // Pad : x x 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 x - // Func. returns: 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 -1 - // - // Here we assume that 21 ADC channels are transmitted. Maybe it will only be - // 18 later on!!! + // Returns the pad plane for a given plane and stack number // - // This function maps also correctly the channels that cross from MCM to MCM - // (ADC channels 0, 1, 20). - // - - return (17-(iadc-2)) + (imcm%fgkMCMrow)*fgkPadmax + GetRobSide(irob)*fgkColmax/2; - -} - -//_____________________________________________________________________________ -Int_t AliTRDgeometry::GetMCMfromPad(Int_t irow, Int_t icol) const -{ - // return on which mcm this pad is - - if ( irow < 0 || icol < 0 || irow > fgkRowmaxC1 || icol > fgkColmax ) return -1; + if (!fPadPlaneArray) { + CreatePadPlaneArray(); + } - return (icol%(fgkColmax/2))/fgkPadmax + fgkMCMrow*(irow%fgkMCMrow); + Int_t ipp = GetDetectorSec(layer,stack); + return ((AliTRDpadPlane *) fPadPlaneArray->At(ipp)); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetROBfromPad(Int_t irow, Int_t icol) const +Int_t AliTRDgeometry::GetRowMax(Int_t layer, Int_t stack, Int_t /*sector*/) { + // + // Returns the number of rows on the pad plane + // - // return on which rob this pad is - - return (irow/fgkMCMrow)*2 + GetColSide(icol); + return GetPadPlane(layer,stack)->GetNrows(); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetRobSide(Int_t irob) const +Int_t AliTRDgeometry::GetColMax(Int_t layer) { + // + // Returns the number of rows on the pad plane + // - // return on which side this rob sits (A side = 0, B side = 1) - - if ( irob < 0 || irob >= fgkROBmaxC1 ) return -1; - - return irob%2; + return GetPadPlane(layer,0)->GetNcols(); } //_____________________________________________________________________________ -Int_t AliTRDgeometry::GetColSide(Int_t icol) const +Double_t AliTRDgeometry::GetRow0(Int_t layer, Int_t stack, Int_t /*sector*/) { + // + // Returns the position of the border of the first pad in a row + // - // return on which side this column sits (A side = 0, B side = 1) - - if ( icol < 0 || icol >= fgkColmax ) return -1; - - return icol/(fgkColmax/2); + return GetPadPlane(layer,stack)->GetRow0(); } //_____________________________________________________________________________ -AliTRDgeometry *AliTRDgeometry::GetGeometry(AliRunLoader *runLoader) +Double_t AliTRDgeometry::GetCol0(Int_t layer) { // - // Load the geometry from the galice file + // Returns the position of the border of the first pad in a column // - if (!runLoader) { - runLoader = AliRunLoader::GetRunLoader(); - } - if (!runLoader) { - AliErrorGeneral("AliTRDgeometry::GetGeometry","No run loader"); - return NULL; - } - - TDirectory *saveDir = gDirectory; - runLoader->CdGAFile(); - - // Try from the galice.root file - AliTRDgeometry *geom = (AliTRDgeometry *) gDirectory->Get("TRDgeometry"); - - if (!geom) { - // If it is not in the file, try to get it from the run loader - AliTRD *trd = (AliTRD *) runLoader->GetAliRun()->GetDetector("TRD"); - geom = trd->GetGeometry(); - } - if (!geom) { - AliErrorGeneral("AliTRDgeometry::GetGeometry","Geometry not found"); - return NULL; - } - - saveDir->cd(); - return geom; + return GetPadPlane(layer,0)->GetCol0(); } //_____________________________________________________________________________ -Bool_t AliTRDgeometry::ReadGeoMatrices() +Bool_t AliTRDgeometry::CreateClusterMatrixArray() { // - // Read the geo matrices from the current gGeoManager for each TRD detector - // - // This fill three arrays of TGeoHMatrix, ordered by detector numbers - // for fast access: - // fMatrixArray: Used for transformation local <-> global ??? - // fMatrixCorrectionArray: Used for transformation local <-> tracking system - // fMatrixGeo: Alignable objects + // Create the matrices to transform cluster coordinates from the + // local chamber system to the tracking coordinate system // if (!gGeoManager) { return kFALSE; } - fMatrixArray = new TObjArray(kNdet); - fMatrixCorrectionArray = new TObjArray(kNdet); - fMatrixGeo = new TObjArray(kNdet); + fClusterMatrixArray = new TObjArray(kNdet); + AliAlignObjParams o; + + for (Int_t iLayer = AliGeomManager::kTRD1; iLayer <= AliGeomManager::kTRD6; iLayer++) { + for (Int_t iModule = 0; iModule < AliGeomManager::LayerSize(iLayer); iModule++) { + + Int_t isector = iModule/Nstack(); + Int_t istack = iModule%Nstack(); + Int_t iLayerTRD = iLayer - AliGeomManager::kTRD1; + Int_t lid = GetDetector(iLayerTRD,istack,isector); - for (Int_t iLayer = AliAlignObj::kTRD1; iLayer <= AliAlignObj::kTRD6; iLayer++) { - for (Int_t iModule = 0; iModule < AliAlignObj::LayerSize(iLayer); iModule++) { + // Taking holes into account + if (((isector == 13) || (isector == 14) || (isector == 15)) && + (istack == 2)) continue; - // Find the path to the different alignable objects (ROCs) - UShort_t volid = AliAlignObj::LayerToVolUID(iLayer,iModule); - const char *symname = AliAlignObj::SymName(volid); + UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iModule); + const char *symname = AliGeomManager::SymName(volid); TGeoPNEntry *pne = gGeoManager->GetAlignableEntry(symname); const char *path = symname; if (pne) { path = pne->GetTitle(); } + else { + continue; + } + if (!strstr(path,"ALIC")) { + AliDebug(1,Form("Not a valid path: %s\n",path)); + continue; + } if (!gGeoManager->cd(path)) { - return kFALSE; + AliError(Form("Cannot go to path: %s\n",path)); + continue; } - - // Get the geo matrix of the current alignable object - // and add it to the corresponding list - TGeoHMatrix *matrix = gGeoManager->GetCurrentMatrix(); - Int_t iplane = iLayer - AliAlignObj::kTRD1; - Int_t isector = iModule / Ncham(); - Int_t ichamber = iModule % Ncham(); - Int_t idet = GetDetector(iplane,ichamber,isector); - fMatrixGeo->AddAt(new TGeoHMatrix(* matrix),idet); - - // Construct the geo matrix for the local <-> global transformation - // and add it to the corresponding list. - // In addition to the original geo matrix also a rotation of the - // kind z-x-y to x-y--z is applied. - TGeoRotation rotMatrixA; - rotMatrixA.RotateY(90); - rotMatrixA.RotateX(90); - TGeoHMatrix matrixGlobal(rotMatrixA.Inverse()); - matrixGlobal.MultiplyLeft(matrix); - fMatrixArray->AddAt(new TGeoHMatrix(matrixGlobal),idet); - - // Construct the geo matrix for the cluster transformation - // and add it to the corresponding list. - // In addition to the original geo matrix also a rotation of the - // kind x-y--z to z-x-y and a rotation by the sector angle is applied. + TGeoHMatrix *m = gGeoManager->GetCurrentMatrix(); + + TGeoRotation mchange; + mchange.RotateY(90); + mchange.RotateX(90); + + // + // Cluster transformation matrix + // + TGeoHMatrix rotMatrix(mchange.Inverse()); + rotMatrix.MultiplyLeft(m); Double_t sectorAngle = 20.0 * (isector % 18) + 10.0; - TGeoHMatrix rotMatrixB(rotMatrixA.Inverse()); - rotMatrixB.MultiplyLeft(matrix); - TGeoHMatrix rotSector; + TGeoHMatrix rotSector; rotSector.RotateZ(sectorAngle); - rotMatrixB.MultiplyLeft(&rotSector); - fMatrixCorrectionArray->AddAt(new TGeoHMatrix(rotMatrixB),idet); + rotMatrix.MultiplyLeft(&rotSector.Inverse()); + + fClusterMatrixArray->AddAt(new TGeoHMatrix(rotMatrix),lid); } } @@ -1607,3 +2809,22 @@ Bool_t AliTRDgeometry::ReadGeoMatrices() } +//_____________________________________________________________________________ +Bool_t AliTRDgeometry::ChamberInGeometry(Int_t det) +{ + // + // Checks whether the given detector is part of the current geometry + // + + if (!fClusterMatrixArray) { + CreateClusterMatrixArray(); + } + + if (!GetClusterMatrix(det)) { + return kFALSE; + } + else { + return kTRUE; + } + +}