00001
00002
00003
00005
00006 #include <cmath>
00007 #include <algorithm>
00008
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "DetectorDescription/Base/interface/DDdebug.h"
00011 #include "DetectorDescription/Base/interface/DDutils.h"
00012 #include "DetectorDescription/Core/interface/DDPosPart.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/MTCCTrackerCommonData/interface/DDTIBRadCableAlgo_MTCC.h"
00019 #include "CLHEP/Units/PhysicalConstants.h"
00020 #include "CLHEP/Units/SystemOfUnits.h"
00021
00022 DDTIBRadCableAlgo_MTCC::DDTIBRadCableAlgo_MTCC(): layRin(0),cableMat(0),strucMat(0), layers(0) {
00023 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC info: Creating an instance";
00024 }
00025
00026 DDTIBRadCableAlgo_MTCC::~DDTIBRadCableAlgo_MTCC() {}
00027
00028 void DDTIBRadCableAlgo_MTCC::initialize(const DDNumericArguments & nArgs,
00029 const DDVectorArguments & vArgs,
00030 const DDMapArguments & ,
00031 const DDStringArguments & sArgs,
00032 const DDStringVectorArguments & vsArgs) {
00033
00034 idNameSpace = DDCurrentNamespace::ns();
00035 unsigned int i;
00036 DDName parentName = parent().name();
00037 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Parent " << parentName
00038 << " NameSpace " << idNameSpace;
00039
00040 rMin = nArgs["RMin"];
00041 rMax = nArgs["RMax"];
00042 layRin = vArgs["RadiusLo"];
00043 deltaR = nArgs["DeltaR"];
00044 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Disk Rmin " << rMin
00045 << "\tRMax " << rMax << "\tSeparation of layers "
00046 << deltaR <<" with " << layRin.size() <<" layers at R =";
00047 for (i = 0; i < layRin.size(); i++)
00048 LogDebug("TIBGeom") << " " << i << " : " << layRin[i];
00049
00050 cylinderT = nArgs["CylinderThick"];
00051 supportT = nArgs["SupportThick"];
00052 supportDR = nArgs["SupportDR"];
00053 supportMat = sArgs["SupportMaterial"];
00054 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: SupportCylinder "
00055 << "Thickness " << cylinderT << "\tSupportDisk "
00056 << "Thickness " << supportT << "\tExtra width along R "
00057 << supportDR << "\tMaterial: " << supportMat;
00058
00059 cableT = nArgs["CableThick"];
00060 cableMat = vsArgs["CableMaterial"];
00061 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: Cable Thickness "
00062 << cableT << " with materials: ";
00063 for (i = 0; i < cableMat.size(); i++)
00064 LogDebug("TIBGeom") << " " << i << " : " << cableMat[i];
00065
00066 strucMat = vsArgs["StructureMaterial"];
00067 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << strucMat.size()
00068 << " materials for open structure:";
00069 for (i=0; i<strucMat.size(); i++)
00070 LogDebug("TIBGeom") << " " << i << " : " << strucMat[i];
00071
00072 layers = vArgs["Layers"];
00073 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC debug: " << layers.size()
00074 << " layers:";
00075 for (i=0; i<layers.size(); i++)
00076 LogDebug("TIBGeom") << " " << i << " : " << layers[i];
00077
00078 }
00079
00080 void DDTIBRadCableAlgo_MTCC::execute() {
00081
00082 LogDebug("TIBGeom") << "==>> Constructing DDTIBRadCableAlgo_MTCC...";
00083 DDName diskName = parent().name();
00084
00085 DDSolid solid;
00086 std::string name;
00087 double rin, rout;
00088
00089
00090 DDName suppName(DDSplit(supportMat).first, DDSplit(supportMat).second);
00091 DDMaterial suppMatter(suppName);
00092 double diskDz = 0.5 * (supportT + cableT*layRin.size());
00093 double dz = 0.5*supportT;
00094
00095 for (unsigned int i=0; i<layRin.size(); i++) {
00096
00097
00098 bool empty=true;
00099 for(unsigned int j=0; j<layers.size(); j++) {
00100 if(i+1==(unsigned int)layers[j]) {
00101 empty=false;
00102 }
00103 }
00104
00105 if(!empty) {
00106
00107 name = "TIBSupportSideDisk" + dbl_to_string(i);
00108 rin = layRin[i]+0.5*(deltaR-cylinderT)-supportDR;
00109 rout = layRin[i]+0.5*(deltaR+cylinderT)+supportDR;
00110 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
00111 rout, 0, twopi);
00112 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00113 << DDName(name, idNameSpace) << " Tubs made of "
00114 << supportMat << " from 0 to " << twopi/deg
00115 << " with Rin " << rin << " Rout " << rout
00116 << " ZHalf " << dz;
00117 DDLogicalPart suppLogic(DDName(name, idNameSpace), suppMatter, solid);
00118
00119 DDTranslation r1(0, 0, (dz-diskDz));
00120 DDpos(DDName(name,idNameSpace), diskName, i+1, r1, DDRotation());
00121 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00122 << DDName(name,idNameSpace) << " number " << i+1
00123 << " positioned in " << diskName << " at " << r1
00124 << " with no rotation";
00125
00126
00127 name = "TIBOpenZone" + dbl_to_string(i);
00128 rout = rin;
00129 if (i == 0) rin = rMin;
00130 else rin = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
00131 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
00132 rout, 0, twopi);
00133 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00134 << DDName(name, idNameSpace) << " Tubs made of "
00135 << strucMat[i] << " from 0 to " << twopi/deg
00136 << " with Rin " << rin << " Rout " << rout
00137 << " ZHalf " << dz;
00138 DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
00139 DDMaterial strucMatter(strucName);
00140 DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
00141
00142 DDTranslation r2(0, 0, (dz-diskDz));
00143 DDpos(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
00144 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00145 << DDName(name,idNameSpace) << " number " << i+1
00146 << " positioned in " << diskName
00147 << " at " << r2 << " with no rotation";
00148
00149
00150 name = "TIBRadCable" + dbl_to_string(i);
00151 double rv = layRin[i]+0.5*deltaR;
00152 std::vector<double> pgonZ;
00153 pgonZ.push_back(-0.5*cableT);
00154 pgonZ.push_back(cableT*(rv/rMax-0.5));
00155 pgonZ.push_back(0.5*cableT);
00156 std::vector<double> pgonRmin;
00157 pgonRmin.push_back(rv);
00158 pgonRmin.push_back(rv);
00159 pgonRmin.push_back(rv);
00160 std::vector<double> pgonRmax;
00161 pgonRmax.push_back(rMax);
00162 pgonRmax.push_back(rMax);
00163 pgonRmax.push_back(rv);
00164 solid = DDSolidFactory::polycone(DDName(name, idNameSpace), 0, twopi,
00165 pgonZ, pgonRmin, pgonRmax);
00166 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00167 << DDName(name, idNameSpace)
00168 << " Polycone made of " << cableMat[i]
00169 << " from 0 to " << twopi/deg << " and with "
00170 << pgonZ.size() << " sections";
00171 for (unsigned int ii = 0; ii <pgonZ.size(); ii++)
00172 LogDebug("TIBGeom") << "\t" << "\tZ = " << pgonZ[ii] << "\tRmin = "
00173 << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
00174 DDName cableName(DDSplit(cableMat[i]).first, DDSplit(cableMat[i]).second);
00175 LogDebug("TIBGeom") << " material cableName " << i << " " << cableName;
00176 DDMaterial cableMatter(cableName);
00177 DDLogicalPart cableLogic(DDName(name, idNameSpace), cableMatter, solid);
00178
00179 DDTranslation r3(0, 0, (diskDz-(i+0.5)*cableT));
00180 DDpos(DDName(name,idNameSpace), diskName, i+1, r3, DDRotation());
00181 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00182 << DDName(name,idNameSpace) << " number " << i+1
00183 << " positioned in " << diskName << " at "
00184 << r3 << " with no rotation";
00185
00186 }
00187
00188
00189
00190 empty=true;
00191 for(unsigned int j=0; j<layers.size(); j++) {
00192 if(i+1==(unsigned int)layers[j]) {
00193 empty=false;
00194 }
00195 }
00196
00197 if(!empty) {
00198
00199 unsigned int i = layRin.size();
00200 rin = layRin[i-1]+0.5*(deltaR+cylinderT)+supportDR;
00201 rout = rMax;
00202 name = "TIBOpenZone" + dbl_to_string(i);
00203 solid = DDSolidFactory::tubs(DDName(name, idNameSpace), dz, rin,
00204 rout, 0, twopi);
00205 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00206 << DDName(name, idNameSpace) << " Tubs made of "
00207 << strucMat[i] << " from 0 to " << twopi/deg
00208 << " with Rin " << rin << " Rout " << rout
00209 << " ZHalf " << dz;
00210 DDName strucName(DDSplit(strucMat[i]).first, DDSplit(strucMat[i]).second);
00211 DDMaterial strucMatter(strucName);
00212 DDLogicalPart strucLogic(DDName(name, idNameSpace), strucMatter, solid);
00213
00214 DDTranslation r2(0, 0, (dz-diskDz));
00215 DDpos(DDName(name,idNameSpace), diskName, i+1, r2, DDRotation());
00216 LogDebug("TIBGeom") << "DDTIBRadCableAlgo_MTCC test: "
00217 << DDName(name,idNameSpace) << " number " << i+1
00218 << " positioned in " << diskName
00219 << " at " << r2 << " with no rotation";
00220 }
00221 }
00222 LogDebug("TIBGeom") << "<<== End of DDTIBRadCableAlgo_MTCC construction ...";
00223
00224 }