CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Geometry/HcalAlgo/plugins/DDHCalBarrelAlgo.cc

Go to the documentation of this file.
00001 
00002 // File: DDHCalBarrelAlgo.cc
00003 //   adapted from CCal(G4)HcalBarrel.cc
00004 // Description: Geometry factory class for Hcal Barrel
00006 
00007 #include <cmath>
00008 #include <algorithm>
00009 
00010 namespace std{} using namespace std;
00011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00012 #include "DetectorDescription/Base/interface/DDutils.h"
00013 #include "DetectorDescription/Core/interface/DDLogicalPart.h"
00014 #include "DetectorDescription/Core/interface/DDSolid.h"
00015 #include "DetectorDescription/Core/interface/DDMaterial.h"
00016 #include "DetectorDescription/Core/interface/DDCurrentNamespace.h"
00017 #include "DetectorDescription/Core/interface/DDSplit.h"
00018 #include "Geometry/HcalAlgo/plugins/DDHCalBarrelAlgo.h"
00019 #include "CLHEP/Units/GlobalPhysicalConstants.h"
00020 #include "CLHEP/Units/GlobalSystemOfUnits.h"
00021 
00022 DDHCalBarrelAlgo::DDHCalBarrelAlgo():
00023   theta(0),rmax(0),zoff(0),ttheta(0),layerId(0),layerLabel(0),layerMat(0),
00024   layerWidth(0),layerD1(0),layerD2(0),layerAlpha(0),layerT1(0),layerT2(0),
00025   layerAbsorb(0),layerGap(0),absorbName(0),absorbMat(0),absorbD(0),absorbT(0),
00026   midName(0),midMat(0),midW(0),midT(0),sideMat(0),sideD(0),sideT(0),
00027   sideAbsName(0),sideAbsMat(0),sideAbsW(0),detType(0),detdP1(0),detdP2(0),
00028   detT11(0),detT12(0),detTsc(0),detT21(0),detT22(0),detWidth1(0),detWidth2(0),
00029   detPosY(0) {
00030   LogDebug("HCalGeom") << "DDHCalBarrelAlgo info: Creating an instance";
00031 }
00032 
00033 DDHCalBarrelAlgo::~DDHCalBarrelAlgo() {}
00034 
00035 
00036 void DDHCalBarrelAlgo::initialize(const DDNumericArguments & nArgs,
00037                                   const DDVectorArguments & vArgs,
00038                                   const DDMapArguments & ,
00039                                   const DDStringArguments & sArgs,
00040                                   const DDStringVectorArguments & vsArgs) {
00041 
00042   genMaterial = sArgs["MaterialName"];
00043   nsectors    = int (nArgs["NSector"]);
00044   nsectortot  = int (nArgs["NSectorTot"]);
00045   nhalf       = int (nArgs["NHalf"]);
00046   rin         = nArgs["RIn"];
00047   rout        = nArgs["ROut"];
00048   rzones      = int (nArgs["RZones"]);
00049   rotHalf     = sArgs["RotHalf"];
00050   rotns       = sArgs["RotNameSpace"];
00051 
00052   theta       = vArgs["Theta"];
00053   rmax        = vArgs["RMax"];
00054   zoff        = vArgs["ZOff"];
00055   int i = 0;
00056   for (i = 0; i < rzones; i++) {
00057     ttheta.push_back(tan(theta[i])); //*deg already done in XML
00058   }
00059   if (rzones > 3)
00060     rmax[2] = (zoff[3] - zoff[2]) / ttheta[2];
00061 
00062   LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: General material " 
00063                        << genMaterial << "\tSectors " << nsectors << ", " 
00064                        << nsectortot <<"\tHalves "      << nhalf 
00065                        << "\tRotation matrix " << rotns << ":" << rotHalf 
00066                        << "\n\t\t" << rin << "\t" << rout << "\t" << rzones;
00067   for (i = 0; i < rzones; i++) {
00068     LogDebug("HCalGeom") << "\tTheta[" << i << "] = " << theta[i] << "\trmax["
00069                          << i << "] = " << rmax[i] << "\tzoff[" << i << "] = "
00070                          << zoff[i];
00071   }
00073   //Layers
00074   nLayers = int(nArgs["NLayers"]);
00075   LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: Layer\t" << nLayers;
00076   layerId     = dbl_to_int (vArgs["Id"]);
00077   layerLabel  = vsArgs["LayerLabel"];
00078   layerMat    = vsArgs["LayerMat"];
00079   layerWidth  = vArgs["LayerWidth"];
00080   layerD1     = vArgs["D1"];
00081   layerD2     = vArgs["D2"];
00082   layerAlpha  = vArgs["Alpha2"]; 
00083   layerT1     = vArgs["T1"];
00084   layerT2     = vArgs["T2"];
00085   layerAbsorb = dbl_to_int(vArgs["AbsL"]);
00086   layerGap    = vArgs["Gap"];
00087   for (i = 0; i < nLayers; i++) {
00088     LogDebug("HCalGeom") << layerLabel[i] << "\t" << layerId[i] << "\t" 
00089                          << layerMat[i] << "\t" << layerWidth[i] << "\t" 
00090                          << layerD1[i] << "\t" << layerD2[i]  << "\t" 
00091                          << layerAlpha[i] << "\t" << layerT1[i] << "\t"
00092                          << layerT2[i] << "\t" << layerAbsorb[i] << "\t" 
00093                          << layerGap[i];
00094   }
00095   
00097   //Absorber Layers and middle part
00098   absorbName  = vsArgs["AbsorbName"];
00099   absorbMat   = vsArgs["AbsorbMat"];
00100   absorbD     = vArgs["AbsorbD"];
00101   absorbT     = vArgs["AbsorbT"];
00102   nAbsorber   = absorbName.size();
00103   for (i = 0; i < nAbsorber; i++) {
00104     LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: " << absorbName[i]
00105                          <<" Material " <<  absorbMat[i] << " d " << absorbD[i]
00106                          << " t " <<absorbT[i];
00107   }
00108   middleMat   = sArgs["MiddleMat"];
00109   middleD     = nArgs["MiddleD"];
00110   middleW     = nArgs["MiddleW"];
00111   LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: Middle material " 
00112                        << middleMat << " d " << middleD << " w " << middleW;
00113   midName     = vsArgs["MidAbsName"];
00114   midMat      = vsArgs["MidAbsMat"];
00115   midW        = vArgs["MidAbsW"];
00116   midT        = vArgs["MidAbsT"];
00117   nMidAbs     = midName.size();
00118   for (i = 0; i < nMidAbs; i++) {
00119     LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: " << midName[i]
00120                          << " Material " <<  midMat[i] << " W " << midW[i]
00121                          << " T " << midT[i];
00122   }
00123 
00124   //Absorber layers in the side part
00125   sideMat     = vsArgs["SideMat"];
00126   sideD       = vArgs["SideD"];
00127   sideT       = vArgs["SideT"];
00128   int nSide   = sideMat.size();
00129   for (int i = 0; i < nSide; i++) {
00130     LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: Side material " 
00131                          << sideMat[i] << " d " << sideD[i] << " t "
00132                          << sideT[i];
00133   }
00134   sideAbsName = vsArgs["SideAbsName"];
00135   sideAbsMat  = vsArgs["SideAbsMat"];
00136   sideAbsW    = vArgs["SideAbsW"];
00137   nSideAbs    = sideAbsName.size();
00138   for (i = 0; i < nSideAbs; i++) {
00139     LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: " << sideAbsName[i]
00140                          <<" Material " <<  sideAbsMat[i] << " W "
00141                          << sideAbsW[i];
00142   }
00143 
00145   // Detectors
00146 
00147   detMat   = sArgs["DetMat"];
00148   detRot   = sArgs["DetRot"];
00149   detMatPl = sArgs["DetMatPl"];
00150   detMatSc = sArgs["DetMatSc"];
00151   LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: Detector (" <<  nLayers 
00152                        << ") Rotation matrix " << rotns << ":" << detRot
00153                        << "\n\t\t" << detMat << "\t" << detMatPl  << "\t"
00154                        << detMatSc;
00155 
00156   detType   = dbl_to_int(vArgs["DetType"]);
00157   detdP1    = vArgs["DetdP1"];
00158   detdP2    = vArgs["DetdP2"];
00159   detT11    = vArgs["DetT11"];
00160   detT12    = vArgs["DetT12"];
00161   detTsc    = vArgs["DetTsc"];
00162   detT21    = vArgs["DetT21"];
00163   detT22    = vArgs["DetT22"];
00164   detWidth1 = vArgs["DetWidth1"];
00165   detWidth2 = vArgs["DetWidth2"];
00166   detPosY   = dbl_to_int(vArgs["DetPosY"]);
00167   for (i = 0; i < nLayers; i ++) {
00168     LogDebug("HCalGeom") << i+1 << "\t" << detType[i] << "\t" << detdP1[i]
00169                          << ", "  << detdP2[i] << "\t" << detT11[i] << ", " 
00170                          << detT12[i] << "\t" << detTsc[i] << "\t" << detT21[i]
00171                          <<", " << detT22[i] << "\t" << detWidth1[i] << "\t" 
00172                          << detWidth2[i] << "\t" << detPosY[i];
00173   }
00174 
00175   //  idName = parentName.name();
00176   idName      = sArgs["MotherName"];
00177   idNameSpace = DDCurrentNamespace::ns();
00178   idOffset = int (nArgs["IdOffset"]); 
00179   DDName parentName = parent().name(); 
00180   LogDebug("HCalGeom") << "DDHCalBarrelAlgo debug: Parent " << parentName
00181                        <<" idName " << idName << " NameSpace " << idNameSpace
00182                        << " Offset " << idOffset;
00183 }
00184 
00186 // DDHCalBarrelAlgo methods...
00188 
00189 void DDHCalBarrelAlgo::execute(DDCompactView& cpv) {
00190 
00191   LogDebug("HCalGeom") << "==>> Constructing DDHCalBarrelAlgo...";
00192   constructGeneralVolume(cpv);
00193   LogDebug("HCalGeom") << "<<== End of DDHCalBarrelAlgo construction ...";
00194 }
00195 
00196 //----------------------start here for DDD work!!! ---------------
00197 
00198 void DDHCalBarrelAlgo::constructGeneralVolume(DDCompactView& cpv) {
00199   
00200   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: General volume...";
00201   unsigned int i=0;
00202 
00203   DDRotation rot = DDRotation();
00204 
00205   double alpha = CLHEP::pi/getNsectors();
00206   double dphi  = getNsectortot()*CLHEP::twopi/getNsectors();
00207   int nsec, ntot=15;
00208   if (getNhalf() == 1)
00209     nsec = 8;
00210   else
00211     nsec = 15;
00212   int nf = ntot - nsec;
00213 
00214   //Calculate zmin... see HCalBarrel.hh picture. For polyhedra
00215   //Rmin and Rmax are distances to vertex
00216   double zmax   = getZoff(3);
00217   double zstep5 = getZoff(4);
00218   double zstep4 =(getZoff(1) + getRmax(1)*getTanTheta(1));
00219   if ((getZoff(2)+getRmax(1)*getTanTheta(2)) > zstep4)
00220     zstep4 = (getZoff(2)+getRmax(1)*getTanTheta(2));
00221   double zstep3 =(getZoff(1) + getRmax(0)*getTanTheta(1));
00222   double zstep2 =(getZoff(0) + getRmax(0)*getTanTheta(0));
00223   double zstep1 =(getZoff(0) + getRin()  *getTanTheta(0));
00224   double rout   = getRout();
00225   double rout1  = getRmax(3);
00226   double rin    = getRin();
00227   double rmid1  = getRmax(0);
00228   double rmid2  = getRmax(1);
00229   double rmid3  =(getZoff(4) - getZoff(2))/getTanTheta(2);
00230   double rmid4  = getRmax(2);
00231 
00232   vector<double> pgonZ;
00233   pgonZ.push_back( -zmax); 
00234   pgonZ.push_back( -zstep5); 
00235   pgonZ.push_back( -zstep5); 
00236   pgonZ.push_back( -zstep4); 
00237   pgonZ.push_back( -zstep3); 
00238   pgonZ.push_back( -zstep2); 
00239   pgonZ.push_back( -zstep1); 
00240   pgonZ.push_back(       0); 
00241   pgonZ.push_back(  zstep1); 
00242   pgonZ.push_back(  zstep2); 
00243   pgonZ.push_back(  zstep3); 
00244   pgonZ.push_back(  zstep4); 
00245   pgonZ.push_back(  zstep5); 
00246   pgonZ.push_back(  zstep5); 
00247   pgonZ.push_back(    zmax);
00248 
00249   vector<double> pgonRmin;
00250   pgonRmin.push_back(   rmid4); 
00251   pgonRmin.push_back(   rmid3); 
00252   pgonRmin.push_back(   rmid3); 
00253   pgonRmin.push_back(   rmid2); 
00254   pgonRmin.push_back(   rmid1); 
00255   pgonRmin.push_back(   rmid1); 
00256   pgonRmin.push_back(     rin); 
00257   pgonRmin.push_back(     rin); 
00258   pgonRmin.push_back(     rin); 
00259   pgonRmin.push_back(   rmid1); 
00260   pgonRmin.push_back(   rmid1); 
00261   pgonRmin.push_back(   rmid2); 
00262   pgonRmin.push_back(   rmid3); 
00263   pgonRmin.push_back(   rmid3); 
00264   pgonRmin.push_back(   rmid4);
00265 
00266   vector<double> pgonRmax;
00267   pgonRmax.push_back(   rout1); 
00268   pgonRmax.push_back(   rout1); 
00269   pgonRmax.push_back(    rout); 
00270   pgonRmax.push_back(    rout); 
00271   pgonRmax.push_back(    rout); 
00272   pgonRmax.push_back(    rout); 
00273   pgonRmax.push_back(    rout); 
00274   pgonRmax.push_back(    rout); 
00275   pgonRmax.push_back(    rout); 
00276   pgonRmax.push_back(    rout); 
00277   pgonRmax.push_back(    rout); 
00278   pgonRmax.push_back(    rout); 
00279   pgonRmax.push_back(    rout); 
00280   pgonRmax.push_back(   rout1);
00281   pgonRmax.push_back(   rout1);
00282 
00283   vector<double> pgonZHalf;
00284   pgonZHalf.push_back(       0); 
00285   pgonZHalf.push_back(  zstep1); 
00286   pgonZHalf.push_back(  zstep2); 
00287   pgonZHalf.push_back(  zstep3); 
00288   pgonZHalf.push_back(  zstep4); 
00289   pgonZHalf.push_back(  zstep5); 
00290   pgonZHalf.push_back(  zstep5); 
00291   pgonZHalf.push_back(    zmax);
00292 
00293   vector<double> pgonRminHalf;
00294   pgonRminHalf.push_back(     rin); 
00295   pgonRminHalf.push_back(     rin); 
00296   pgonRminHalf.push_back(   rmid1); 
00297   pgonRminHalf.push_back(   rmid1); 
00298   pgonRminHalf.push_back(   rmid2); 
00299   pgonRminHalf.push_back(   rmid3); 
00300   pgonRminHalf.push_back(   rmid3); 
00301   pgonRminHalf.push_back(   rmid4);
00302 
00303   vector<double> pgonRmaxHalf;
00304   pgonRmaxHalf.push_back(    rout); 
00305   pgonRmaxHalf.push_back(    rout); 
00306   pgonRmaxHalf.push_back(    rout); 
00307   pgonRmaxHalf.push_back(    rout); 
00308   pgonRmaxHalf.push_back(    rout); 
00309   pgonRmaxHalf.push_back(    rout); 
00310   pgonRmaxHalf.push_back(   rout1);
00311   pgonRmaxHalf.push_back(   rout1);
00312 
00313   string name("Null");
00314   DDSolid solid;
00315   if (nf == 0) { 
00316     solid = DDSolidFactory::polyhedra(DDName(idName, idNameSpace),
00317                                       getNsectortot(), -alpha, dphi, pgonZ, 
00318                                       pgonRmin, pgonRmax);
00319     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: "
00320                          << DDName(idName, idNameSpace) <<" Polyhedra made of "
00321                          << getGenMaterial() << " with " << getNsectortot()
00322                          << " sectors from " << -alpha/CLHEP::deg <<" to "
00323                          << (-alpha+dphi)/CLHEP::deg << " and with " << nsec
00324                          << " sections ";
00325     for (i = 0; i <pgonZ.size(); i++) {
00326       LogDebug("HCalGeom") << "\t" << "\tZ = " << pgonZ[i] << "\tRmin = " 
00327                            << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
00328     }
00329   } else {
00330     solid = DDSolidFactory::polyhedra(DDName(idName, idNameSpace),
00331                                       getNsectortot(), -alpha, dphi, pgonZHalf,
00332                                       pgonRminHalf, pgonRmaxHalf);
00333     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " 
00334                          << DDName(idName, idNameSpace) <<" Polyhedra made of "
00335                          << getGenMaterial() << " with " << getNsectortot()
00336                          << " sectors from " << -alpha/CLHEP::deg << " to " 
00337                          << (-alpha+dphi)/CLHEP::deg << " and with " << nsec 
00338                          << " sections ";
00339     for (i = 0; i < pgonZHalf.size(); i++) {
00340       LogDebug("HCalGeom") << "\t" << "\tZ = " << pgonZHalf[i] << "\tRmin = "
00341                            << pgonRminHalf[i] << "\tRmax = " <<pgonRmaxHalf[i];
00342     }
00343   }  
00344   
00345 
00346   DDName matname(DDSplit(getGenMaterial()).first, DDSplit(getGenMaterial()).second);
00347   DDMaterial matter(matname);
00348   DDLogicalPart genlogic(DDName(idName, idNameSpace), matter, solid);
00349 
00350   DDName parentName = parent().name(); 
00351   DDTranslation r0(0,0,0);
00352   cpv.position(DDName(idName, idNameSpace), parentName, 1, r0, rot);
00353   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " 
00354                        << DDName(idName, idNameSpace) << " number 1 positioned"
00355                        << " in " << parentName << " at " << r0 <<" with "<<rot;
00356 
00357   //Forward and backwards halfs
00358   name = idName + "Half";
00359   nf   = (ntot+1)/2;
00360   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << DDName(name,idNameSpace)
00361                        << " Polyhedra made of " << getGenMaterial() << " with "
00362                        << getNsectortot() << " sectors from " 
00363                        << -alpha/CLHEP::deg << " to " 
00364                        << (-alpha+dphi)/CLHEP::deg << " and with " << nf
00365                        << " sections "; 
00366   for (i = 0; i < pgonZHalf.size(); i++) {
00367     LogDebug("HCalGeom") << "\t" << "\tZ = " << pgonZHalf[i] << "\tRmin = "
00368                          << pgonRminHalf[i] << "\tRmax = " << pgonRmaxHalf[i];
00369   }
00370 
00371   solid =   DDSolidFactory::polyhedra(DDName(name, idNameSpace),
00372                                       getNsectortot(), -alpha, dphi, pgonZHalf,
00373                                       pgonRminHalf, pgonRmaxHalf);
00374   DDLogicalPart genlogich(DDName(name, idNameSpace), matter, solid);
00375 
00376   cpv.position(genlogich, genlogic, 1, r0, rot);
00377   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: "  << genlogich.name() 
00378                        << " number 1 positioned in " << genlogic.name() 
00379                        << " at " << r0 << " with " << rot;
00380 
00381   if (getNhalf() != 1) {
00382     rot = DDRotation(DDName(rotHalf, rotns));
00383    cpv.position(genlogich, genlogic, 2, r0, rot);
00384     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test:  " << genlogich.name()
00385                          << " number 2 positioned in " << genlogic.name()
00386                          << " at " << r0 << " with " << rot;
00387   } //end if (getNhalf...
00388   
00389   //Construct sector (from -alpha to +alpha)
00390   name = idName + "Module";
00391   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << DDName(name,idNameSpace)
00392                        << " Polyhedra made of " << getGenMaterial() 
00393                        << " with 1 sector from " << -alpha/CLHEP::deg << " to "
00394                        << alpha/CLHEP::deg << " and with " << nf <<" sections";
00395   for (i = 0; i < pgonZHalf.size(); i++) {
00396     LogDebug("HCalGeom") << "\t" << "\tZ = " << pgonZHalf[i] << "\tRmin = " 
00397                          << pgonRminHalf[i] << "\tRmax = " << pgonRmaxHalf[i];
00398   }
00399 
00400   solid =   DDSolidFactory::polyhedra(DDName(name, idNameSpace),
00401                                       1, -alpha, 2*alpha, pgonZHalf,
00402                                       pgonRminHalf, pgonRmaxHalf);
00403   DDLogicalPart seclogic(DDName(name, idNameSpace), matter, solid);
00404   
00405   for (int ii=0; ii<getNsectortot(); ii++) {
00406     double phi    = ii*2*alpha;
00407     double phideg = phi/CLHEP::deg;
00408     
00409     DDRotation rotation;
00410     string rotstr("NULL");
00411     if (phideg != 0) {
00412       rotstr = "R"; 
00413       if (phideg < 100) rotstr = "R0"; 
00414       rotstr = rotstr + dbl_to_string(phideg);
00415       rotation = DDRotation(DDName(rotstr, rotns)); 
00416       if (!rotation) {
00417         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: Creating a new rotat"
00418                              << "ion " << rotstr << "\t" << 90 << "," << phideg
00419                              << ","  << 90 << "," << (phideg+90) << ", 0, 0";
00420         rotation = DDrot(DDName(rotstr, rotns), 90*CLHEP::deg, 
00421                          phideg*CLHEP::deg, 90*CLHEP::deg, 
00422                          (90+phideg)*CLHEP::deg, 0*CLHEP::deg,  0*CLHEP::deg);
00423       } //if !rotation
00424     } //if phideg!=0
00425   
00426    cpv.position(seclogic, genlogich, ii+1, r0, rotation);
00427     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << seclogic.name() 
00428                          << " number " << ii+1 << " positioned in " 
00429                          << genlogich.name() << " at " << r0 << " with "
00430                          << rotation;
00431   }
00432   
00433   //Construct the things inside the sector
00434   constructInsideSector(seclogic, cpv);
00435 }
00436 
00437 
00438 void DDHCalBarrelAlgo::constructInsideSector(DDLogicalPart sector, DDCompactView& cpv) {
00439   
00440   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: Layers (" << getNLayers()
00441                        << ") ...";
00442 
00443   double alpha = CLHEP::pi/getNsectors();
00444   double rin   = getRin();
00445   for (int i = 0; i < getNLayers(); i++) {
00446     string  name   = idName + getLayerLabel(i);
00447     DDName matname(DDSplit(getLayerMaterial(i)).first, 
00448                    DDSplit(getLayerMaterial(i)).second); //idNameSpace);
00449     DDMaterial matter(matname);
00450 
00451     double width = getLayerWidth(i);
00452     double rout  = rin + width;
00453 
00454     int    in = 0, out = 0;
00455     for (int j = 0; j < getRzones()-1; j++) {
00456       if (rin >= getRmax(j)) in = j+1;
00457       if (rout>  getRmax(j)) out= j+1;
00458     }
00459     double zout  = getZoff(in) + rin*getTanTheta(in);
00460 
00462     //vertical walls are allowed in SolidPolyhedra
00463     double deltaz = 0;
00464     int    nsec=2;
00465     vector<double> pgonZ, pgonRmin, pgonRmax;
00466     // index 0
00467     pgonZ.push_back(0);
00468     pgonRmin.push_back(rin); 
00469     pgonRmax.push_back(rout);
00470     // index 1
00471     pgonZ.push_back(zout);  
00472     pgonRmin.push_back(rin); 
00473     pgonRmax.push_back(rout);
00474     if (in == out) {
00475       if (in <= 3) {
00476         //index 2
00477         pgonZ.push_back(getZoff(in) + rout*getTanTheta(in));
00478         pgonRmin.push_back(pgonRmax[1]);
00479         pgonRmax.push_back(pgonRmax[1]);
00480         nsec++;
00481       }
00482     } else {
00483       if (in == 3) {
00484         //redo index 1, add index 2
00485         pgonZ[1]    =(getZoff(out) + getRmax(out)*getTanTheta(out));
00486         pgonZ.push_back(pgonZ[1] + deltaz);
00487         pgonRmin.push_back(pgonRmin[1]); 
00488         pgonRmax.push_back(getRmax(in));
00489         //index 3 
00490         pgonZ.push_back(getZoff(in) + getRmax(in)*getTanTheta(in));
00491         pgonRmin.push_back(pgonRmin[2]); 
00492         pgonRmax.push_back(pgonRmax[2]);
00493         nsec       += 2;
00494       } else {
00495         //index 2
00496         pgonZ.push_back(getZoff(in) + getRmax(in)*getTanTheta(in));
00497         pgonRmin.push_back(getRmax(in)); 
00498         pgonRmax.push_back(pgonRmax[1]); 
00499         nsec++;
00500         if (in == 0) {
00501           pgonZ.push_back(getZoff(out) + getRmax(in)*getTanTheta(out));
00502           pgonRmin.push_back(pgonRmin[2]); 
00503           pgonRmax.push_back(pgonRmax[2]);
00504           nsec++;
00505         }
00506         if (in <= 1) {
00507           pgonZ.push_back(getZoff(out) + rout*getTanTheta(out));
00508           pgonRmin.push_back(rout);
00509           pgonRmax.push_back(rout);
00510           nsec++;
00511         }
00512       }
00513     }
00514     //Solid & volume
00515     DDSolid solid;
00516     double  alpha1 = alpha;
00517     if (getLayerGap(i)>1.e-6) {
00518       double rmid  = 0.5*(rin+rout);
00519       double width = rmid*tan(alpha) - getLayerGap(i);
00520       alpha1 = atan(width/rmid);
00521       LogDebug("HCalGeom") << "\t" << "Alpha_1 modified from " 
00522                            << alpha/CLHEP::deg << " to " << alpha1/CLHEP::deg 
00523                            << " Rmid " << rmid << " Reduced width " << width;
00524     }
00525     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << name << " (Layer " 
00526                          << i << ") Polyhedra made of " << getLayerMaterial(i)
00527                          << " with 1 sector from " << -alpha1/CLHEP::deg 
00528                          << " to " << alpha1/CLHEP::deg << " and with " 
00529                          << nsec << " sections";
00530     for (unsigned int k=0; k<pgonZ.size(); k++) {
00531       LogDebug("HCalGeom") << "\t" << "\t" << pgonZ[k] << "\t" << pgonRmin[k]
00532                            << "\t" << pgonRmax[k];
00533     }    
00534     solid = DDSolidFactory::polyhedra(DDName(name, idNameSpace), 
00535                                       1, -alpha1, 2*alpha1,
00536                                       pgonZ, pgonRmin, pgonRmax);
00537     DDLogicalPart glog(DDName(name, idNameSpace), matter, solid);
00538 
00539    cpv.position(glog, sector, getLayerId(i), DDTranslation(0.0, 0.0, 0.0), 
00540            DDRotation());
00541     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00542                          << " number " << getLayerId(i) << " positioned in " 
00543                          << sector.name() << " at (0,0,0) with no rotation";
00544 
00545     constructInsideLayers(glog, getLayerLabel(i), getLayerId(i), 
00546                           getLayerAbsorb(i), rin,  getLayerD1(i), alpha1, 
00547                           getLayerD2(i), getLayerAlpha(i), getLayerT1(i),
00548                           getLayerT2(i), cpv);
00549     rin = rout;
00550   }
00551   
00552 }
00553 
00554 void DDHCalBarrelAlgo::constructInsideLayers(DDLogicalPart laylog,
00555                                              string nm, int id, int nAbs, 
00556                                              double rin, double d1, 
00557                                              double alpha1, double d2, 
00558                                              double alpha2, double t1,
00559                                              double t2, DDCompactView& cpv) {
00560   
00561   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: \t\tInside layer " << id 
00562                        << "...";
00563 
00565   //Pointers to the Rotation Matrices and to the Materials
00566   DDRotation rot(DDName(detRot, rotns));
00567 
00568   string nam0 = nm + "In";
00569   string name = idName + nam0;
00570   DDName matName(DDSplit(getDetMat()).first, DDSplit(getDetMat()).second);
00571   DDMaterial matter (matName);
00572 
00573   DDSolid        solid;
00574   DDLogicalPart  glog, mother;
00575   double         rsi, dx, dy, dz, x, y;
00576   int            i, in;
00577   //Two lower volumes
00578   if (alpha1 > 0) {
00579     rsi = rin + d1;
00580     in  = 0;
00581     for (i = 0; i < getRzones()-1; i++) {
00582       if (rsi >= getRmax(i)) in = i+1;
00583     }
00584     dx = 0.5*t1;
00585     dy = 0.5*rsi*(tan(alpha1)-tan(alpha2));
00586     dz = 0.5*(getZoff(in) + rsi*getTanTheta(in));
00587     x  = rsi + dx;
00588     y  = 0.5*rsi*(tan(alpha1)+tan(alpha2));
00589     DDTranslation r11(x, y, dz);
00590     DDTranslation r12(x, -y, dz);
00591 
00592     solid = DDSolidFactory::box(DDName(name+"1", idNameSpace), dx, dy, dz);
00593     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00594                          <<" Box made of " << getDetMat() << " of dimensions "
00595                          << dx << ", " << dy << ", " << dz;
00596     glog = DDLogicalPart(solid.ddname(), matter, solid);
00597 
00598     if (nAbs != 0) {
00599       mother = constructSideLayer(laylog, name, nAbs, rin, alpha1, cpv);
00600     } else {
00601       mother = laylog;
00602     }
00603     cpv.position(glog, mother, idOffset+1, r11, DDRotation());
00604     cpv.position(glog, mother, idOffset+2, r12, rot);
00605     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00606                          << " Number " << idOffset+1 << " positioned in " 
00607                          << mother.name() << " at " << r11 
00608                          << " with no rotation\n"
00609                          << "DDHCalBarrelAlgo test: " << glog.name() 
00610                          << " Number " << idOffset+2 << " positioned in " 
00611                          << mother.name() << " at " << r12 << " with " << rot;
00612 
00613     //Constructin the plastics and scintillators inside
00614     constructInsideDetectors(glog, nam0+"1", id, dx, dy, dz, 1, cpv);
00615   }
00616 
00617   //Upper volume
00618   rsi = rin + d2;
00619   in  = 0;
00620   for (i = 0; i < getRzones()-1; i++) {
00621     if (rsi >= getRmax(i)) in = i+1;
00622   }
00623   dx  = 0.5*t2;
00624   dy  = 0.5*rsi*tan(alpha2);
00625   dz  = 0.5*(getZoff(in) + rsi*getTanTheta(in));
00626   x   = rsi + dx;
00627   DDTranslation r21(x, dy, dz);
00628   DDTranslation r22(x, -dy, dz);
00629   
00630   solid = DDSolidFactory::box(DDName(name+"2", idNameSpace), dx, dy, dz);
00631   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00632                        << " Box made of " << getDetMat() << " of dimensions "
00633                        << dx << ", " << dy << ", " << dz;
00634   glog = DDLogicalPart(solid.ddname(), matter, solid);
00635 
00636   if (nAbs < 0) {
00637     mother = constructMidLayer(laylog, name, rin, alpha1, cpv);
00638   } else {
00639     mother = laylog;
00640   }
00641  cpv.position(glog, mother, idOffset+3, r21, DDRotation());
00642  cpv.position(glog, mother, idOffset+4, r22, rot);
00643   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() <<" Number "
00644                        << idOffset+3 << " positioned in " << mother.name() 
00645                        << " at " << r21 << " with no rotation\n"
00646                        << "DDHCalBarrelAlgo test: " << glog.name() <<" Number "
00647                        << idOffset+4 << " positioned in " << mother.name()
00648                        << " at " << r22 << " with " << rot;
00649 
00650   //Constructin the plastics and scintillators inside
00651   constructInsideDetectors(glog, nam0+"2", id, dx, dy, dz, 2, cpv);
00652 }
00653 
00654 DDLogicalPart DDHCalBarrelAlgo::constructSideLayer(DDLogicalPart laylog,
00655                                                    string nm, int nAbs, 
00656                                                    double rin, double alpha,
00657                                                    DDCompactView& cpv) {
00658 
00659   //Extra absorber layer
00660   int k = abs(nAbs) - 1;
00661   string namek = nm + "Side";
00662   double rsi   = rin + getSideD(k);
00663   int    in  = 0;
00664   for (int i = 0; i < getRzones()-1; i++) {
00665     if (rsi >= getRmax(i)) in = i+1;
00666   }
00667   vector<double> pgonZ, pgonRmin, pgonRmax;
00668   // index 0
00669   pgonZ.push_back(0.0);     
00670   pgonRmin.push_back(rsi); 
00671   pgonRmax.push_back(rsi+getSideT(k));
00672   // index 1
00673   pgonZ.push_back(getZoff(in) + rsi*getTanTheta(in));  
00674   pgonRmin.push_back(rsi); 
00675   pgonRmax.push_back(pgonRmax[0]);
00676   // index 2
00677   pgonZ.push_back(getZoff(in) + pgonRmax[0]*getTanTheta(in));
00678   pgonRmin.push_back(pgonRmax[1]);
00679   pgonRmax.push_back(pgonRmax[1]);
00680   DDSolid solid = DDSolidFactory::polyhedra(DDName(namek, idNameSpace), 1, 
00681                                             -alpha, 2*alpha, pgonZ, pgonRmin, 
00682                                             pgonRmax);
00683   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00684                        << " Polyhedra made of " << getSideMat(k) 
00685                        << " with 1 sector from " << -alpha/CLHEP::deg
00686                        << " to " << alpha/CLHEP::deg << " and with "
00687                        << pgonZ.size() << " sections";
00688   for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00689     LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00690                          << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00691   }
00692 
00693   DDName matName(DDSplit(getSideMat(k)).first, DDSplit(getSideMat(k)).second);
00694   DDMaterial matter(matName);
00695   DDLogicalPart glog = DDLogicalPart(solid.ddname(), matter, solid);
00696 
00697   cpv.position(glog, laylog, 1, DDTranslation(), DDRotation());
00698   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00699                        << " Number 1 positioned in " << laylog.name()
00700                        << " at (0,0,0) with no rotation";
00701 
00702   if (nAbs < 0) {
00703     DDLogicalPart mother = glog;
00704     double rmid  = pgonRmax[0];
00705     for (int i = 0; i < getSideAbsorber(); i++) {
00706       double alpha1 = atan(getSideAbsW(i)/rmid);  
00707       if (alpha1 > 0) {
00708         string name   = namek + getSideAbsName(i);
00709         solid = DDSolidFactory::polyhedra(DDName(name, idNameSpace), 1, 
00710                                           -alpha1, 2*alpha1, pgonZ, pgonRmin, 
00711                                           pgonRmax);
00712         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00713                              << " Polyhedra made of " << getSideAbsMat(i) 
00714                              << " with 1 sector from " << -alpha1/CLHEP::deg
00715                              << " to " << alpha1/CLHEP::deg << " and with "
00716                              << pgonZ.size() << " sections";
00717         for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00718           LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00719                                << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00720         }
00721 
00722         DDName matName(DDSplit(getSideAbsMat(i)).first, 
00723                        DDSplit(getSideAbsMat(i)).second);
00724         DDMaterial matter(matName);
00725         DDLogicalPart log = DDLogicalPart(solid.ddname(), matter, solid);
00726 
00727         cpv.position(log, mother, 1, DDTranslation(), DDRotation());
00728         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << log.name() 
00729                              << " Number 1 positioned in " << mother.name()
00730                              << " at (0,0,0) with no rotation";
00731         mother = log;
00732       }
00733     }
00734   }
00735   return glog;
00736 }
00737 
00738 DDLogicalPart DDHCalBarrelAlgo::constructMidLayer(DDLogicalPart laylog,
00739                                                   string nm, double rin, 
00740                                                   double alpha, DDCompactView& cpv) {
00741 
00742   DDSolid       solid;
00743   DDLogicalPart log, glog;
00744   string name = nm + "Mid";
00745   for (int k=0; k < getAbsorberN(); k++) {
00746     string namek = name + getAbsorbName(k);
00747     double rsi   = rin + getAbsorbD(k);
00748     int    in  = 0;
00749     for (int i = 0; i < getRzones()-1; i++) {
00750       if (rsi >= getRmax(i)) in = i+1;
00751     }
00752     vector<double> pgonZ, pgonRmin, pgonRmax;
00753     // index 0
00754     pgonZ.push_back(0.0);     
00755     pgonRmin.push_back(rsi); 
00756     pgonRmax.push_back(rsi+getAbsorbT(k));
00757     // index 1
00758     pgonZ.push_back(getZoff(in) + rsi*getTanTheta(in));  
00759     pgonRmin.push_back(rsi); 
00760     pgonRmax.push_back(pgonRmax[0]);
00761     // index 2
00762     pgonZ.push_back(getZoff(in) + pgonRmax[0]*getTanTheta(in));
00763     pgonRmin.push_back(pgonRmax[1]);
00764     pgonRmax.push_back(pgonRmax[1]);
00765     solid = DDSolidFactory::polyhedra(DDName(namek, idNameSpace), 1, -alpha, 
00766                                       2*alpha, pgonZ, pgonRmin, pgonRmax);
00767     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00768                          << " Polyhedra made of " << getAbsorbMat(k) 
00769                          << " with 1 sector from " << -alpha/CLHEP::deg
00770                          << " to " << alpha/CLHEP::deg << " and with "
00771                          << pgonZ.size() << " sections";
00772     for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00773       LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00774                            << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00775     }
00776 
00777     DDName matName(DDSplit(getAbsorbMat(k)).first, DDSplit(getAbsorbMat(k)).second);
00778     DDMaterial matter(matName);
00779     log = DDLogicalPart(solid.ddname(), matter, solid);
00780 
00781     cpv.position(log, laylog, 1, DDTranslation(), DDRotation());
00782     LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << log.name() 
00783                          << " Number 1 positioned in " << laylog.name()
00784                          << " at (0,0,0) with no rotation";
00785     
00786     if (k==0) {
00787       double rmin   = pgonRmin[0];
00788       double rmax   = pgonRmax[0];
00789       DDLogicalPart mother = log;
00790       for (int i=0; i<1; i++) {
00791         double alpha1 = atan(getMidAbsW(i)/rmin);
00792         string namek  = name + getMidAbsName(i);
00793         solid = DDSolidFactory::polyhedra(DDName(namek, idNameSpace), 1, 
00794                                           -alpha1, 2*alpha1, pgonZ, pgonRmin, 
00795                                           pgonRmax);
00796         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00797                              << " Polyhedra made of " << getMidAbsMat(i) 
00798                              << " with 1 sector from " << -alpha1/CLHEP::deg
00799                            << " to " << alpha1/CLHEP::deg << " and with "
00800                              << pgonZ.size() << " sections";
00801         for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00802           LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00803                                << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00804         }
00805 
00806         DDName matNam1(DDSplit(getMidAbsMat(i)).first, 
00807                        DDSplit(getMidAbsMat(i)).second);
00808         DDMaterial matter1(matNam1);
00809         log = DDLogicalPart(solid.ddname(), matter1, solid);
00810 
00811         cpv.position(log, mother, 1, DDTranslation(), DDRotation());
00812         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << log.name() 
00813                              << " Number 1 positioned in " << mother.name()
00814                              << " at (0,0,0) with no rotation";
00815         mother = log;
00816       }
00817 
00818       // Now the layer with detectors
00819       double rmid = rmin + getMiddleD();
00820       pgonRmin[0] = rmid; pgonRmax[0] = rmax;
00821       pgonRmin[1] = rmid; pgonRmax[1] = rmax; pgonZ[1] = getZoff(in) + rmid*getTanTheta(in);
00822       pgonRmin[2] = rmax; pgonRmax[2] = rmax; pgonZ[2] = getZoff(in) + rmax*getTanTheta(in);
00823       double alpha1 = atan(getMiddleW()/rmin);
00824       solid = DDSolidFactory::polyhedra(DDName(name, idNameSpace), 1, 
00825                                         -alpha1, 2*alpha1, pgonZ, pgonRmin, 
00826                                         pgonRmax);
00827       LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00828                            << " Polyhedra made of " << getMiddleMat() 
00829                            << " with 1 sector from " << -alpha1/CLHEP::deg
00830                            << " to " << alpha1/CLHEP::deg << " and with "
00831                            << pgonZ.size() << " sections";
00832       for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00833         LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00834                              << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00835       }
00836 
00837       DDName matNam1(DDSplit(getMiddleMat()).first, 
00838                      DDSplit(getMiddleMat()).second);
00839       DDMaterial matter1(matNam1);
00840       glog = DDLogicalPart(solid.ddname(), matter1, solid);
00841 
00842       cpv.position(glog, mother, 1, DDTranslation(), DDRotation());
00843       LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00844                            << " Number 1 positioned in " << mother.name()
00845                            << " at (0,0,0) with no rotation";
00846 
00847       // Now the remaining absorber layers
00848       for (int i = 1; i < getMidAbsorber(); i++) {
00849         namek  = name + getMidAbsName(i);
00850         rmid   = rmin + getMidAbsT(i);
00851         pgonRmin[0] = rmin; pgonRmax[0] = rmid;
00852         pgonRmin[1] = rmin; pgonRmax[1] = rmid; pgonZ[1] = getZoff(in) + rmin*getTanTheta(in);
00853         pgonRmin[2] = rmid; pgonRmax[2] = rmid; pgonZ[2] = getZoff(in) + rmid*getTanTheta(in);
00854         alpha1 = atan(getMidAbsW(i)/rmin);
00855         solid = DDSolidFactory::polyhedra(DDName(namek, idNameSpace), 1, 
00856                                           -alpha1, 2*alpha1, pgonZ, pgonRmin, 
00857                                           pgonRmax);
00858         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00859                              << " Polyhedra made of " << getMidAbsMat(i) 
00860                              << " with 1 sector from " << -alpha1/CLHEP::deg
00861                              << " to " << alpha1/CLHEP::deg << " and with "
00862                              << pgonZ.size() << " sections";
00863         for (unsigned int ii=0; ii<pgonZ.size(); ii++) {
00864           LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[ii] << "\tRmin = " 
00865                                << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00866         }
00867 
00868         DDName matName2(DDSplit(getMidAbsMat(i)).first, 
00869                         DDSplit(getMidAbsMat(i)).second);
00870         DDMaterial matter2(matName2);
00871         log = DDLogicalPart(solid.ddname(), matter2, solid);
00872 
00873         cpv.position(log, mother, i, DDTranslation(), DDRotation());
00874         LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << log.name() 
00875                              << " Number " << i << " positioned in " 
00876                              << mother.name() << " at (0,0,0) with no "
00877                              << "rotation";
00878         mother = log;
00879       }
00880     }
00881   }
00882   return glog;
00883 }
00884  
00885 void DDHCalBarrelAlgo::constructInsideDetectors(DDLogicalPart detector,
00886                                                 string name, int id, double dx,
00887                                                 double dy, double dz,
00888                                                 int type, DDCompactView& cpv) {
00889 
00890   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: \t\tInside detector " << id 
00891                        << "...";
00892   
00893   DDName plmatname(DDSplit(getDetMatPl()).first, DDSplit(getDetMatPl()).second);
00894   DDMaterial plmatter(plmatname);
00895   DDName scmatname(DDSplit(getDetMatSc()).first, DDSplit(getDetMatSc()).second);
00896   DDMaterial scmatter(scmatname);
00897   
00898   string plname = detector.name().name()+"Plastic_";
00899   string scname = idName+"Scintillator"+name;
00900   
00901   id--;
00902   DDSolid solid;
00903   DDLogicalPart glog;
00904   double  wid, y=0;
00905   double  dx1, dx2, shiftX;
00906 
00907   if (type == 1) {
00908     wid = 0.5*getDetWidth1(id);
00909     if (getDetPosY(id)>0) y =-dy+wid;
00910     dx1    = 0.5*getDetT11(id);
00911     dx2    = 0.5*getDetT21(id);
00912     shiftX = getDetdP1(id);
00913   } else {
00914     wid = 0.5*getDetWidth2(id);
00915     dx1    = 0.5*getDetT12(id);
00916     dx2    = 0.5*getDetT22(id);
00917     shiftX = getDetdP2(id);
00918   }
00919 
00920   solid = DDSolidFactory::box(DDName(plname+"1", idNameSpace), dx1, wid, dz);
00921   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00922                        << " Box made of " << getDetMatPl() << " of dimensions "
00923                        << dx1 <<", " << wid << ", "  << dz;
00924   glog = DDLogicalPart(solid.ddname(), plmatter, solid); 
00925 
00926   double x = shiftX + dx1 - dx;
00927   cpv.position(glog, detector, 1, DDTranslation(x,y,0), DDRotation());
00928   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00929                        << " Number 1 positioned in " << detector.name() 
00930                        << " at (" << x << "," << y << ",0) with no rotation";
00931 
00932   solid = DDSolidFactory::box(DDName(scname, idNameSpace), 
00933                               0.5*getDetTsc(id), wid, dz);
00934   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00935                        << " Box made of " << getDetMatSc() << " of dimensions "
00936                        << 0.5*getDetTsc(id) << ", " << wid << ", " << dz;
00937   glog = DDLogicalPart(solid.ddname(), scmatter, solid);
00938 
00939   x += dx1 + 0.5*getDetTsc(id);
00940   int copyNo = id*10 + getDetType(id);
00941   cpv.position(glog, detector, copyNo, DDTranslation(x, y, 0), DDRotation());
00942   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() <<" Number "
00943                        << copyNo << " positioned in " << detector.name() 
00944                        << " at (" << x << "," << y  << ",0) with no rotation";
00945 
00946   solid = DDSolidFactory::box(DDName(plname+"2", idNameSpace), dx2, wid, dz);
00947   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << solid.name() 
00948                        << " Box made of " << getDetMatPl() << " of dimensions "
00949                        << dx2 <<", " << wid << ", "  << dz;
00950   glog = DDLogicalPart(solid.ddname(), plmatter, solid);
00951 
00952   x+=0.5*getDetTsc(id) + dx2;
00953  cpv.position(glog, detector, 1, DDTranslation(x, y, 0), DDRotation());
00954   LogDebug("HCalGeom") << "DDHCalBarrelAlgo test: " << glog.name() 
00955                        << " Number 1 positioned in " << detector.name() 
00956                        << " at (" << x << "," << y << ",0) with no rotation";
00957 
00958 }