CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DDHCalTBCableAlgo Class Reference

#include <DDHCalTBCableAlgo.h>

Inheritance diagram for DDHCalTBCableAlgo:

Public Member Functions

 DDHCalTBCableAlgo ()
 
void execute (DDCompactView &cpv) override
 
void initialize (const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs) override
 
 ~DDHCalTBCableAlgo () override
 

Private Attributes

std::string absMat
 
double gap2
 
std::string genMat
 
std::string idName
 
std::string idNameSpace
 
double length1
 
double length2
 
int nhalf
 
int nsectors
 
int nsectortot
 
double rin
 
std::vector< double > rmax
 
std::string rotns
 
std::vector< double > theta
 
double thick
 
double width1
 
double width2
 
std::vector< double > zoff
 

Detailed Description

Definition at line 10 of file DDHCalTBCableAlgo.h.

Constructor & Destructor Documentation

DDHCalTBCableAlgo::DDHCalTBCableAlgo ( )

Definition at line 21 of file DDHCalTBCableAlgo.cc.

References LogDebug.

21  : theta(0),rmax(0),zoff(0) {
22  LogDebug("HCalGeom") << "DDHCalTBCableAlgo info: Creating an instance";
23 }
#define LogDebug(id)
std::vector< double > theta
std::vector< double > rmax
std::vector< double > zoff
DDHCalTBCableAlgo::~DDHCalTBCableAlgo ( )
override

Definition at line 25 of file DDHCalTBCableAlgo.cc.

25 {}

Member Function Documentation

void DDHCalTBCableAlgo::execute ( DDCompactView cpv)
override

Definition at line 71 of file DDHCalTBCableAlgo.cc.

References absMat, alpha, DDSolidFactory::box(), funct::cos(), DDBase< N, C >::ddname(), DDrot(), DDSplit(), PVValHelper::dy, PVValHelper::dz, plotBeamSpotDB::first, gap2, genMat, mps_fire::i, idName, idNameSpace, cuy::ii, length1, length2, LogDebug, dataset::name, DDBase< N, C >::name(), nhalf, nsectors, nsectortot, class-composition::parent, phi, pi, DDSolidFactory::polyhedra(), DDCompactView::position(), diffTwoXMLs::r1, diffTwoXMLs::r2, rin, rmax, makeMuonMisalignmentScenario::rot, idealTransformation::rotation, rotns, edm::second(), funct::sin(), funct::tan(), theta, thick, DDSolidFactory::trap(), width1, width2, and zoff.

71  {
72 
73  LogDebug("HCalGeom") << "==>> Constructing DDHCalTBCableAlgo...";
74  unsigned int i=0;
75 
76  double alpha = CLHEP::pi/nsectors;
77  double dphi = nsectortot*CLHEP::twopi/nsectors;
78 
79  double zstep0 = zoff[1]+rmax[1]*tan(theta[1])+(rin-rmax[1])*tan(theta[2]);
80  double zstep1 = zstep0+thick/cos(theta[2]);
81  double zstep2 = zoff[3];
82 
83  double rstep0 = rin + (zstep2-zstep1)/tan(theta[2]);
84  double rstep1 = rin + (zstep1-zstep0)/tan(theta[2]);
85 
86  vector<double> pgonZ;
87  pgonZ.emplace_back(zstep0);
88  pgonZ.emplace_back(zstep1);
89  pgonZ.emplace_back(zstep2);
90  pgonZ.emplace_back(zstep2+thick/cos(theta[2]));
91 
92  vector<double> pgonRmin;
93  pgonRmin.emplace_back(rin);
94  pgonRmin.emplace_back(rin);
95  pgonRmin.emplace_back(rstep0);
96  pgonRmin.emplace_back(rmax[2]);
97 
98  vector<double> pgonRmax;
99  pgonRmax.emplace_back(rin);
100  pgonRmax.emplace_back(rstep1);
101  pgonRmax.emplace_back(rmax[2]);
102  pgonRmax.emplace_back(rmax[2]);
103 
104  string name("Null");
105  DDSolid solid;
107  nsectortot, -alpha, dphi, pgonZ,
108  pgonRmin, pgonRmax);
109  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: "
110  << DDName(idName,idNameSpace) << " Polyhedra made of "
111  << genMat << " with " << nsectortot << " sectors from "
112  << -alpha/CLHEP::deg << " to "
113  << (-alpha+dphi)/CLHEP::deg << " and with "
114  << pgonZ.size() << " sections";
115  for (i = 0; i <pgonZ.size(); i++)
116  LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = "
117  << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
118 
120  DDMaterial matter(matname);
121  DDLogicalPart genlogic(solid.ddname(), matter, solid);
122 
123  DDName parentName = parent().name();
124  DDTranslation r0(0.0, 0.0, 0.0);
125  DDRotation rot;
126  cpv.position(DDName(idName, idNameSpace), parentName, 1, r0, rot);
127  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: "
128  << DDName(idName,idNameSpace) << " number 1 positioned "
129  << "in " << parentName << " at " << r0 << " with "<<rot;
130 
131  if (nhalf != 1) {
132  rot = DDRotation(DDName("180D", rotns));
133  cpv.position(DDName(idName, idNameSpace), parentName, 2, r0, rot);
134  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: "
135  << DDName(idName,idNameSpace) <<" number 2 positioned"
136  << "in " << parentName << " at " << r0 << " with "
137  << rot;
138  }
139 
140  //Construct sector (from -alpha to +alpha)
141  name = idName + "Module";
142  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: "
143  << DDName(name,idNameSpace) << " Polyhedra made of "
144  << genMat << " with 1 sector from " <<-alpha/CLHEP::deg
145  << " to " << alpha/CLHEP::deg << " and with "
146  << pgonZ.size() << " sections";
147  for (i = 0; i < pgonZ.size(); i++)
148  LogDebug("HCalGeom") << "\t\tZ = " << pgonZ[i] << "\tRmin = "
149  << pgonRmin[i] << "\tRmax = " << pgonRmax[i];
151  1, -alpha, 2*alpha, pgonZ,
152  pgonRmin, pgonRmax);
153  DDLogicalPart seclogic(solid.ddname(), matter, solid);
154 
155  for (int ii=0; ii<nsectortot; ii++) {
156  double phi = ii*2*alpha;
157  double phideg = phi/CLHEP::deg;
158 
160  string rotstr("NULL");
161  if (phideg != 0) {
162  rotstr = "R";
163  if (phideg < 100) rotstr = "R0";
164  rotstr = rotstr + std::to_string(phideg);
165  rotation = DDRotation(DDName(rotstr, rotns));
166  if (!rotation) {
167  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new "
168  << "rotation " << rotstr << "\t90," << phideg
169  << ", 90, " << (phideg+90) << ", 0, 0";
170  rotation = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg,
171  phideg*CLHEP::deg, 90*CLHEP::deg,
172  (90+phideg)*CLHEP::deg, 0*CLHEP::deg, 0*CLHEP::deg);
173  }
174  }
175 
176  cpv.position(seclogic, genlogic, ii+1, DDTranslation(0.0, 0.0, 0.0), rotation);
177  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << seclogic.name()
178  << " number " << ii+1 << " positioned in "
179  << genlogic.name() << " at (0,0,0) with " << rotation;
180  }
181 
182  //Now a trapezoid of air
183  double rinl = pgonRmin[0] + thick * sin(theta[2]);
184  double routl = pgonRmax[2] - thick * sin(theta[2]);
185  double dx1 = rinl * tan(alpha);
186  double dx2 = 0.90 * routl * tan(alpha);
187  double dy = 0.50 * thick;
188  double dz = 0.50 * (routl -rinl);
189  name = idName + "Trap";
190  solid = DDSolidFactory::trap(DDName(name, idNameSpace), dz, 0, 0, dy, dx1,
191  dx1, 0, dy, dx2, dx2, 0);
192  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name()
193  <<" Trap made of " << genMat << " of dimensions " << dz
194  << ", 0, 0, " << dy << ", " << dx1 << ", " << dx1
195  << ", 0, " << dy << ", " << dx2 << ", " << dx2 <<", 0";
196  DDLogicalPart glog(solid.ddname(), matter, solid);
197 
198  string rotstr = name;
199  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation: "
200  << rotstr << "\t90, 270, " << (180-theta[2]/CLHEP::deg)
201  << ", 0, " << (90-theta[2]/CLHEP::deg) << ", 0";
202  rot = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg, 270*CLHEP::deg,
203  180*CLHEP::deg-theta[2], 0, 90*CLHEP::deg-theta[2], 0);
204  DDTranslation r1(0.5*(rinl+routl), 0, 0.5*(pgonZ[1]+pgonZ[2]));
205  cpv.position(glog, seclogic, 1, r1, rot);
206  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << glog.name()
207  << " number 1 positioned in " << seclogic.name()
208  << " at " << r1 << " with " << rot;
209 
210  //Now the cable of type 1
211  name = idName + "Cable1";
212  double phi = atan((dx2-dx1)/(2*dz));
213  double xmid = 0.5*(dx1+dx2)-1.0;
215  0.5*thick, 0.5*length1);
216  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name()
217  << " Box made of " << absMat << " of dimension "
218  << 0.5*width1 << ", " << 0.5*thick << ", "
219  << 0.5*length1;
220  DDName absname(DDSplit(absMat).first, DDSplit(absMat).second);
221  DDMaterial absmatter(absname);
222  DDLogicalPart cablog1(solid.ddname(), absmatter, solid);
223 
224  rotstr = idName + "Left";
225  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation "
226  << rotstr << "\t" << (90+phi/CLHEP::deg) << "," << 0
227  << "," << 90 << "," << 90 << "," << phi/CLHEP::deg
228  << "," << 0;
229  DDRotation rot2 = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg+phi, 0.0,
230  90*CLHEP::deg, 90*CLHEP::deg, phi, 0.0);
231  DDTranslation r2((xmid-0.5*width1*cos(phi)), 0, 0);
232  cpv.position(cablog1, glog, 1, r2, rot2);
233  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog1.name()
234  << " number 1 positioned in " << glog.name() << " at "
235  << r2 << " with " << rot2;
236 
237  rotstr = idName + "Right";
238  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: Creating a new rotation "
239  << rotstr << "\t" << (90-phi/CLHEP::deg)
240  << ", 0, 90, 90, " << -phi/CLHEP::deg << ", 0";
241  DDRotation rot3 = DDrot(DDName(rotstr, idNameSpace), 90*CLHEP::deg-phi,
242  0*CLHEP::deg, 90*CLHEP::deg, 90*CLHEP::deg,
243  -phi, 0*CLHEP::deg);
244  DDTranslation r3(-(xmid-0.5*width1*cos(phi)), 0, 0);
245  cpv.position(cablog1, glog, 2, r3, rot3);
246  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog1.name()
247  << " number 2 positioned in " << glog.name() << " at "
248  << r3 << " with " << rot3;
249 
250  //Now the cable of type 2
251  name = idName + "Cable2";
253  0.5*thick, 0.5*length2);
254  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << solid.name()
255  << " Box made of " << absMat << " of dimension "
256  << 0.5*width2 << ", " << 0.5*thick << ", "<<0.5*length2;
257  DDLogicalPart cablog2(solid.ddname(), absmatter, solid);
258 
259  double xpos = 0.5*(width2+gap2);
260  cpv.position(cablog2, glog, 1, DDTranslation(xpos, 0.0, 0.0), DDRotation());
261  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog2.name()
262  << " number 1 positioned in " << glog.name() << " at ("
263  << xpos << ", 0, 0) with no rotation";
264  cpv.position(cablog2, glog, 2, DDTranslation(-xpos, 0.0, 0.0), DDRotation());
265  LogDebug("HCalGeom") << "DDHCalTBCableAlgo test: " << cablog2.name()
266  << " number 2 positioned in " << glog.name() << " at ("
267  <<-xpos << ", 0, 0) with no rotation";
268 
269  LogDebug("HCalGeom") << "<<== End of DDHCalTBCableAlgo construction ...";
270 }
#define LogDebug(id)
std::vector< double > theta
float alpha
Definition: AMPTWrapper.h:95
std::vector< double > rmax
const N & name() const
Definition: DDBase.h:78
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
A DDSolid represents the shape of a part.
Definition: DDSolid.h:38
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
const Double_t pi
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:67
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
static DDSolid trap(const DDName &name, double pDz, double pTheta, double pPhi, double pDy1, double pDx1, double pDx2, double pAlp1, double pDy2, double pDx3, double pDx4, double pAlp2)
Definition: DDSolid.cc:917
static DDSolid box(const DDName &name, double xHalf, double yHalf, double zHalf)
Creates a box with side length 2*xHalf, 2*yHalf, 2*zHalf.
Definition: DDSolid.cc:819
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
ii
Definition: cuy.py:588
void position(const DDLogicalPart &self, const DDLogicalPart &parent, const std::string &copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=0)
std::vector< double > zoff
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
std::string idNameSpace
static DDSolid polyhedra(const DDName &name, int sides, double startPhi, double deltaPhi, const std::vector< double > &z, const std::vector< double > &rmin, const std::vector< double > &rmax)
Creates a polyhedra (refere to Geant3 or Geant4 documentation)
Definition: DDSolid.cc:846
const N & ddname() const
Definition: DDBase.h:80
void DDHCalTBCableAlgo::initialize ( const DDNumericArguments nArgs,
const DDVectorArguments vArgs,
const DDMapArguments mArgs,
const DDStringArguments sArgs,
const DDStringVectorArguments vsArgs 
)
override

Definition at line 28 of file DDHCalTBCableAlgo.cc.

References absMat, gap2, genMat, mps_fire::i, idName, idNameSpace, createfilelist::int, length1, length2, LogDebug, nhalf, DDCurrentNamespace::ns(), nsectors, nsectortot, class-composition::parent, rin, rmax, rotns, theta, thick, width1, width2, and zoff.

32  {
33 
34  genMat = sArgs["MaterialName"];
35  nsectors = int (nArgs["NSector"]);
36  nsectortot = int (nArgs["NSectorTot"]);
37  nhalf = int (nArgs["NHalf"]);
38  rin = nArgs["RIn"];
39  theta = vArgs["Theta"];
40  rmax = vArgs["RMax"];
41  zoff = vArgs["ZOff"];
42 
43  absMat = sArgs["AbsMatName"];
44  thick = nArgs["Thickness"];
45  width1 = nArgs["Width1"];
46  length1 = nArgs["Length1"];
47  width2 = nArgs["Width2"];
48  length2 = nArgs["Length2"];
49  gap2 = nArgs["Gap2"];
50 
51  LogDebug("HCalGeom") << "DDHCalTBCableAlgo debug: General material "
52  << genMat << "\tSectors " << nsectors << ", "
53  << nsectortot << "\tHalves " << nhalf << "\tRin " <<rin;
54  for (unsigned int i = 0; i < theta.size(); i++)
55  LogDebug("HCalGeom") << "\t" << i << " Theta " << theta[i] << " rmax "
56  << rmax[i] << " zoff " << zoff[i];
57  LogDebug("HCalGeom") << "\tCable mockup made of " << absMat << "\tThick "
58  << thick << "\tLength and width " << length1 << ", "
59  << width1 <<" and " << length2 << ", " << width2
60  << " Gap " << gap2;
61 
62  idName = sArgs["MotherName"];
64  rotns = sArgs["RotNameSpace"];
65  DDName parentName = parent().name();
66  LogDebug("HCalGeom") << "DDHCalTBCableAlgo debug: Parent " << parentName
67  << " idName " << idName << " NameSpace " << idNameSpace
68  << " for solids etc. and " << rotns << " for rotations";
69 }
#define LogDebug(id)
std::vector< double > theta
std::vector< double > rmax
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static std::string & ns()
std::vector< double > zoff
std::string idNameSpace

Member Data Documentation

std::string DDHCalTBCableAlgo::absMat
private

Definition at line 34 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::gap2
private

Definition at line 38 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::genMat
private

Definition at line 26 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idName
private

Definition at line 40 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::idNameSpace
private

Definition at line 41 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length1
private

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::length2
private

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nhalf
private

Definition at line 29 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectors
private

Definition at line 27 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

int DDHCalTBCableAlgo::nsectortot
private

Definition at line 28 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::rin
private

Definition at line 30 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::rmax
private

Definition at line 32 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::string DDHCalTBCableAlgo::rotns
private

Definition at line 42 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::theta
private

Definition at line 31 of file DDHCalTBCableAlgo.h.

Referenced by execute(), initialize(), and Tau.Tau::zImpact().

double DDHCalTBCableAlgo::thick
private

Definition at line 35 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width1
private

Definition at line 36 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

double DDHCalTBCableAlgo::width2
private

Definition at line 37 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().

std::vector<double> DDHCalTBCableAlgo::zoff
private

Definition at line 33 of file DDHCalTBCableAlgo.h.

Referenced by execute(), and initialize().