Warning, file /DD4hep/examples/DDCMS/src/plugins/DDTOBRadCableAlgo.cpp was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include "DD4hep/DetFactoryHelper.h"
0020 #include "DDCMS/DDCMSPlugins.h"
0021
0022 using namespace std;
0023 using namespace dd4hep;
0024 using namespace dd4hep::cms;
0025
0026 static long algorithm(Detector& ,
0027 ParsingContext& ctxt,
0028 xml_h e,
0029 SensitiveDetector& )
0030 {
0031 Namespace ns(ctxt, e, true);
0032 AlgoArguments args(ctxt, e);
0033 double diskDz = args.dble("DiskDz");
0034 double rMax = args.dble("RMax");
0035 double cableT = args.dble("CableT");
0036 vector<double> rodRin = args.vecDble("RodRin");
0037 vector<double> rodRout = args.vecDble("RodRout");
0038 vector<string> cableM = args.vecStr("CableMaterial");
0039 double connW = args.dble("ConnW");
0040 double connT = args.dble("ConnT");
0041 vector<string> connM = args.vecStr("ConnMaterial");
0042 vector<double> coolR1 = args.vecDble("CoolR1");
0043 vector<double> coolR2 = args.vecDble("CoolR2");
0044 double coolRin = args.dble("CoolRin");
0045 double coolRout1 = args.dble("CoolRout1");
0046 double coolRout2 = args.dble("CoolRout2");
0047 double coolStartPhi1 = args.dble("CoolStartPhi1");
0048 double coolDeltaPhi1 = args.dble("CoolDeltaPhi1");
0049 double coolStartPhi2 = args.dble("CoolStartPhi2");
0050 double coolDeltaPhi2 = args.dble("CoolDeltaPhi2");
0051 string coolM1 = args.str("CoolMaterial1");
0052 string coolM2 = args.str("CoolMaterial2");
0053 vector<string> names = args.vecStr("RingName");
0054
0055 string parentName = args.parentName();
0056 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Parent " << parentName << " NameSpace " << ns.name;
0057 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Disk Half width " << diskDz
0058 << "\tRMax " << rMax << "\tCable Thickness " << cableT
0059 << "\tRadii of disk position and cable materials:";
0060 for (int i=0; i<(int)(rodRin.size()); i++)
0061 LogDebug("TOBGeom") << "\t[" << i << "]\tRin = " << rodRin[i]
0062 << "\tRout = " << rodRout[i] << " " << cableM[i];
0063 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Connector Width = "
0064 << connW << "\tThickness = " << connT
0065 << "\tMaterials: ";
0066 for (int i=0; i<(int)(connM.size()); i++)
0067 LogDebug("TOBGeom") << "\tconnM[" << i << "] = " << connM[i];
0068 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cool Manifold Torus Rin = " << coolRin
0069 << " Rout = " << coolRout1
0070 << "\t Phi start = " << coolStartPhi1 << " Phi Range = " << coolDeltaPhi1
0071 << "\t Material = " << coolM1
0072 << "\t Radial positions:";
0073 for (int i=0; i<(int)(coolR1.size()); i++)
0074 LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR1[i];
0075 for (int i=0; i<(int)(coolR2.size()); i++)
0076 LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR2[i];
0077 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: Cooling Fluid Torus Rin = " << coolRin
0078 << " Rout = " << coolRout2
0079 << "\t Phi start = " << coolStartPhi2 << " Phi Range = " << coolDeltaPhi2
0080 << "\t Material = " << coolM2
0081 << "\t Radial positions:";
0082 for (int i=0; i<(int)(coolR1.size()); i++)
0083 LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR1[i];
0084 for (int i=0; i<(int)(coolR2.size()); i++)
0085 LogDebug("TOBGeom") << "\t[" << i <<"]\tR = " << coolR2[i];
0086 for (int i=0; i<(int)(names.size()); i++)
0087 LogDebug("TOBGeom") << "DDTOBRadCableAlgo debug: names[" << i << "] = " << names[i];
0088
0089 Volume disk = ns.volume(parentName);
0090
0091 for (int i=0; i<(int)(names.size()); i++) {
0092 Solid solid;
0093 string name;
0094 double dz, rin, rout;
0095
0096
0097 name = "TOBCoolingManifold" + names[i] + "a";
0098 dz = coolRout1;
0099 solid = ns.addSolid(name,Torus(coolRin,coolRout1,coolR1[i],coolStartPhi1,coolDeltaPhi1));
0100 LogDebug("TOBGeom") << name << " Torus made of "
0101 << coolM1 << " from " << coolStartPhi1/CLHEP::deg
0102 << " to " << (coolStartPhi1+coolDeltaPhi1)/CLHEP::deg
0103 << " with Rin " << coolRin << " Rout " << coolRout1
0104 << " R torus " << coolR1[i];
0105 Volume coolManifoldLogic_a = ns.addVolume(Volume(name,solid,ns.material(coolM1)));
0106 Position r1(0, 0, (dz-diskDz));
0107 disk.placeVolume(coolManifoldLogic_a,i+1,r1);
0108 LogDebug("TOBGeom") << name << " number " << i+1
0109 << " positioned in " << disk.name() << " at " << r1
0110 << " with no rotation";
0111
0112
0113 name = "TOBCoolingManifoldFluid" + names[i] + "a";
0114 solid = ns.addSolid(name,Torus(coolRin,coolRout2,coolR1[i],coolStartPhi2,coolDeltaPhi2));
0115 LogDebug("TOBGeom") << name << " Torus made of "
0116 << coolM2 << " from " << coolStartPhi2/CLHEP::deg
0117 << " to " << (coolStartPhi2+coolDeltaPhi2)/CLHEP::deg
0118 << " with Rin " << coolRin << " Rout " << coolRout2
0119 << " R torus " << coolR1[i];
0120 Volume coolManifoldFluidLogic_a = ns.addVolume(Volume(name,solid,ns.material(coolM2)));
0121 disk.placeVolume(coolManifoldFluidLogic_a,i+1);
0122 LogDebug("TOBGeom") << name << " number " << i+1
0123 << " positioned in " << coolM2
0124 << " with no translation and no rotation";
0125
0126 name = "TOBCoolingManifold" + names[i] + "r";
0127 dz = coolRout1;
0128 solid = ns.addSolid(name,Torus(coolRin,coolRout1,coolR2[i],coolStartPhi1,coolDeltaPhi1));
0129 LogDebug("TOBGeom") << name << " Torus made of "
0130 << coolM1 << " from " << coolStartPhi1/CLHEP::deg
0131 << " to " << (coolStartPhi1+coolDeltaPhi1)/CLHEP::deg
0132 << " with Rin " << coolRin << " Rout " << coolRout1
0133 << " R torus " << coolR2[i];
0134 Volume coolManifoldLogic_r = ns.addVolume(Volume(name,solid,ns.material(coolM1)));
0135 r1 = Position(0, 0, (dz-diskDz));
0136 disk.placeVolume(coolManifoldLogic_r, i+1, r1);
0137 LogDebug("TOBGeom") << name << " number " << i+1
0138 << " positioned in " << disk.name() << " at " << r1
0139 << " with no rotation";
0140
0141
0142 name = "TOBCoolingManifoldFluid" + names[i] + "r";
0143 solid = ns.addSolid(name,Torus(coolRin,coolRout2,coolR2[i],coolStartPhi2,coolDeltaPhi2));
0144 LogDebug("TOBGeom") << name << " Torus made of "
0145 << coolM2 << " from " << coolStartPhi2/CLHEP::deg
0146 << " to " << (coolStartPhi2+coolDeltaPhi2)/CLHEP::deg
0147 << " with Rin " << coolRin << " Rout " << coolRout2
0148 << " R torus " << coolR2[i];
0149 Volume coolManifoldFluidLogic_r = ns.addVolume(Volume(name, solid, ns.material(coolM2)));
0150 disk.placeVolume(coolManifoldFluidLogic_r,i+1);
0151 LogDebug("TOBGeom") << name << " number " << i+1
0152 << " positioned in " << coolM2
0153 << " with no translation and no rotation";
0154
0155
0156 name = "TOBConn" + names[i];
0157 dz = 0.5*connT;
0158 rin = 0.5*(rodRin[i]+rodRout[i])-0.5*connW;
0159 rout = 0.5*(rodRin[i]+rodRout[i])+0.5*connW;
0160 solid = ns.addSolid(name,Tube(rin, rout, dz));
0161 LogDebug("TOBGeom") << name << " Tubs made of "
0162 << connM[i] << " from 0 to " << CLHEP::twopi/CLHEP::deg
0163 << " with Rin " << rin << " Rout " << rout
0164 << " ZHalf " << dz;
0165 Volume connLogic = ns.addVolume(Volume(name, solid, ns.material(connM[i])));
0166 Position r2(0, 0, (dz-diskDz));
0167 disk.placeVolume(connLogic,i+1,r2);
0168 LogDebug("TOBGeom") << name << " number " << i+1
0169 << " positioned in " << disk.name() << " at " << r2
0170 << " with no rotation";
0171
0172
0173 name = "TOBRadServices" + names[i];
0174 rin = 0.5*(rodRin[i]+rodRout[i]);
0175 rout = ( i+1 == (int)(names.size()) ? rMax : 0.5*(rodRin[i+1]+rodRout[i+1]));
0176 vector<double> pgonZ;
0177 pgonZ.emplace_back(-0.5*cableT);
0178 pgonZ.emplace_back(cableT*(rin/rMax-0.5));
0179 pgonZ.emplace_back(0.5*cableT);
0180 vector<double> pgonRmin;
0181 pgonRmin.emplace_back(rin);
0182 pgonRmin.emplace_back(rin);
0183 pgonRmin.emplace_back(rin);
0184 vector<double> pgonRmax;
0185 pgonRmax.emplace_back(rout);
0186 pgonRmax.emplace_back(rout);
0187 pgonRmax.emplace_back(rout);
0188 solid = ns.addSolid(name,Polycone(0, CLHEP::twopi, pgonRmin, pgonRmax, pgonZ));
0189 LogDebug("TOBGeom") << name <<" Polycone made of "
0190 << cableM[i] << " from 0 to "
0191 << CLHEP::twopi/CLHEP::deg << " and with "
0192 << pgonZ.size() << " sections";
0193 for (int ii = 0; ii < (int)(pgonZ.size()); ii++)
0194 LogDebug("TOBGeom") << "\t[" << ii << "]\tZ = " << pgonZ[ii]
0195 << "\tRmin = " << pgonRmin[ii] << "\tRmax = " << pgonRmax[ii];
0196 Volume cableLogic = ns.addVolume(Volume(name, solid, ns.material(cableM[i])));
0197 Position r3(0, 0, (diskDz-(i+0.5)*cableT));
0198 disk.placeVolume(cableLogic, i+1, r3);
0199 LogDebug("TOBGeom") << name << " number " <<i+1
0200 << " positioned in " << disk.name() << " at " << r3
0201 << " with no rotation";
0202 }
0203 LogDebug("TOBGeom") << "<<== End of DDTOBRadCableAlgo construction ...";
0204 return 1;
0205 }
0206
0207
0208 DECLARE_DDCMS_DETELEMENT(DDCMS_track_DDTOBRadCableAlgo,algorithm)
0209