CMS 3D CMS Logo

DDPixBarStackTrigLayerAlgo.cc
Go to the documentation of this file.
1 // File: DDPixBarStackTrigLayerAlgo.cc
3 // Description: Make one stack trig layer of pixel barrel detector
5 
6 #include <cmath>
7 #include <algorithm>
8 
16 #include "CLHEP/Units/PhysicalConstants.h"
17 #include "CLHEP/Units/SystemOfUnits.h"
18 
19 
21  LogDebug("PixelGeom") <<"DDPixBarStackTrigLayerAlgo info: Creating an instance";
22 }
23 
25 
27  const DDVectorArguments & vArgs,
28  const DDMapArguments & ,
29  const DDStringArguments & sArgs,
30  const DDStringVectorArguments & vsArgs) {
31 
33 
34  genMat = sArgs["GeneralMaterial"];
35  number = int(nArgs["Ladders"]);
36 
37  layerDz = nArgs["LayerDz"];
38  layerR = nArgs["LayerR"];
39 
40  ladder = vsArgs["LadderName"];
41  ladderWidth = vArgs["LadderWidth"];
42  ladderThick = vArgs["LadderThick"];
43  LogDebug("PixelGeom") << " in stacktrig algo: number = " << number
44  << " layerDz = " << layerDz
45  << " layerR = " << layerR << std::endl;
46 }
47 
49 
50  DDName mother = parent().name();
51  std::string idName = DDSplit(mother).first;
52 
53  double dphi = CLHEP::twopi/number;
54 
55  // Firstly Create Solid volumon for Stack Trig layer.
56  double rtmi = cos(0.5*dphi)*layerR- ladderThick[0] ; //fix me here for temporary test.
57  double rtmx = layerR ;
59  rtmi, rtmx, 0, CLHEP::twopi);
60  LogDebug("PixelGeom") << "DDPixBarLayerAlgo test: "
61  << DDName(idName, idNameSpace) << " Tubs made of "
62  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
63  << " with Rin " << rtmi << " Rout " << rtmx
64  << " ZHalf " << 0.5*layerDz;
65  // Create Logical volume for Stack Trig Layer
67  DDMaterial matter(matname);
68  DDLogicalPart layer(solid.ddname(), matter, solid);
69  // Note, How to place this stack Trig layer will be defined in data/stacktriglayer0.xml
70 
71  DDName ladderFull(DDSplit(ladder[0]).first, DDSplit(ladder[0]).second);
72 
73  int copy=1, iup=-1;
74  double phi0 = 90*CLHEP::deg;
75  for (int i=0; i<number; i++) {
76 
77  double phi = phi0 + i*dphi;
78  double phix, phiy, rrr ;
79  std::string rots;
80  // Create Translation for each Ladder.
81  DDTranslation tran;
83  iup =-iup;
84  rrr = rtmi+ 0.5* ladderThick[0];
85  tran = DDTranslation(rrr*cos(phi), rrr*sin(phi), 0);
86  rots = idName + std::to_string(copy);
87  if (iup > 0) phix = phi-90*CLHEP::deg;
88  else phix = phi+90*CLHEP::deg;
89  phiy = phix+90.*CLHEP::deg;
90 
91  LogDebug("PixelGeom") << "DDPixBarStackTrigLayerAlgo test: Creating a new "
92  << "rotation: " << rots << "\t90., " << phix/CLHEP::deg
93  << ", 90.," << phiy/CLHEP::deg << ", 0, 0";
94 
95  //Create Rotation for each Ladder.
96  rot = DDrot(DDName(rots,idNameSpace), 90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.);
97 
98  //Place each Ladder into this Stack Trig Layer
99  cpv.position (ladderFull, layer, copy, tran, rot);
100 
101  LogDebug("PixelGeom") << "DDPixBarStackTrigLayerAlgo test: " << ladderFull
102  << " number " << copy << " positioned in "
103  << layer.name() << " at " << tran << " with "
104  << rot;
105  copy++;
106 
107  }
108 }
#define LogDebug(id)
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
static std::string & ns()
type of data representation of DDCompactView
Definition: DDCompactView.h:90
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
U second(std::pair< T, U > const &p)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:863
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::vector< std::string > ladder
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
const N & ddname() const
Definition: DDBase.h:80