CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
17 #include "CLHEP/Units/PhysicalConstants.h"
18 #include "CLHEP/Units/SystemOfUnits.h"
19 
20 
22  LogDebug("PixelGeom") <<"DDPixBarStackTrigLayerAlgo info: Creating an instance";
23 }
24 
26 
28  const DDVectorArguments & vArgs,
29  const DDMapArguments & ,
30  const DDStringArguments & sArgs,
31  const DDStringVectorArguments & vsArgs) {
32 
34 
35  genMat = sArgs["GeneralMaterial"];
36  number = int(nArgs["Ladders"]);
37 
38  layerDz = nArgs["LayerDz"];
39  layerR = nArgs["LayerR"];
40 
41  ladder = vsArgs["LadderName"];
42  ladderWidth = vArgs["LadderWidth"];
43  ladderThick = vArgs["LadderThick"];
44  LogDebug("PixelGeom") << " in stacktrig algo: number = " << number
45  << " layerDz = " << layerDz
46  << " layerR = " << layerR << std::endl;
47 }
48 
50 
51  DDName mother = parent().name();
52  std::string idName = DDSplit(mother).first;
53 
54  double dphi = CLHEP::twopi/number;
55 
56  // Firstly Create Solid volumon for Stack Trig layer.
57  double rtmi = cos(0.5*dphi)*layerR- ladderThick[0] ; //fix me here for temporary test.
58  double rtmx = layerR ;
60  rtmi, rtmx, 0, CLHEP::twopi);
61  LogDebug("PixelGeom") << "DDPixBarLayerAlgo test: "
62  << DDName(idName, idNameSpace) << " Tubs made of "
63  << genMat << " from 0 to " << CLHEP::twopi/CLHEP::deg
64  << " with Rin " << rtmi << " Rout " << rtmx
65  << " ZHalf " << 0.5*layerDz;
66  // Create Logical volume for Stack Trig Layer
68  DDMaterial matter(matname);
69  DDLogicalPart layer(solid.ddname(), matter, solid);
70  // Note, How to place this stack Trig layer will be defined in data/stacktriglayer0.xml
71 
72  DDName ladderFull(DDSplit(ladder[0]).first, DDSplit(ladder[0]).second);
73 
74  int copy=1, iup=-1;
75  double phi0 = 90*CLHEP::deg;
76  for (int i=0; i<number; i++) {
77 
78  double phi = phi0 + i*dphi;
79  double phix, phiy, rrr ;
80  std::string rots;
81  // Create Translation for each Ladder.
82  DDTranslation tran;
84  iup =-iup;
85  rrr = rtmi+ 0.5* ladderThick[0];
86  tran = DDTranslation(rrr*cos(phi), rrr*sin(phi), 0);
87  rots = idName + dbl_to_string(copy);
88  if (iup > 0) phix = phi-90*CLHEP::deg;
89  else phix = phi+90*CLHEP::deg;
90  phiy = phix+90.*CLHEP::deg;
91 
92  LogDebug("PixelGeom") << "DDPixBarStackTrigLayerAlgo test: Creating a new "
93  << "rotation: " << rots << "\t90., " << phix/CLHEP::deg
94  << ", 90.," << phiy/CLHEP::deg << ", 0, 0";
95 
96  //Create Rotation for each Ladder.
97  rot = DDrot(DDName(rots,idNameSpace), 90*CLHEP::deg, phix, 90*CLHEP::deg, phiy, 0.,0.);
98 
99  //Place each Ladder into this Stack Trig Layer
100  cpv.position (ladderFull, layer, copy, tran, rot);
101 
102  LogDebug("PixelGeom") << "DDPixBarStackTrigLayerAlgo test: " << ladderFull
103  << " number " << copy << " positioned in "
104  << layer.name() << " at " << tran << " with "
105  << rot;
106  copy++;
107 
108  }
109 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
list parent
Definition: dbtoconf.py:74
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:18
static std::string & ns()
std::string dbl_to_string(const double &in)
Converts only the integer part of a double to a string.
Definition: DDutils.cc:12
type of data representation of DDCompactView
Definition: DDCompactView.h:76
A DDSolid represents the shape of a part.
Definition: DDSolid.h:35
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:66
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:88
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:788
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