CMS 3D CMS Logo

DDTBH4Algo.cc
Go to the documentation of this file.
1 // File: DDTBH4Algo.cc
3 // Description: Position inside the mother according to (eta,phi)
5 
6 #include <cmath>
7 #include <algorithm>
8 
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
18  m_idNameSpace (""),
19  m_BLZBeg (0),
20  m_BLZEnd (0),
21  m_BLZPiv (0),
22  m_BLRadius (0),
23  m_VacName (""),
24  m_VacMat (""),
25  m_vecVacZBeg (),
26  m_vecVacZEnd (),
27  m_WinName (""),
28  m_vecWinMat (),
29  m_vecWinZBeg (),
30  m_vecWinThick(),
31  m_TrgMat (""),
32  m_HoleMat (""),
33  m_TrgVetoHoleRadius (0),
34  m_vecTrgName (),
35  m_vecTrgSide (),
36  m_vecTrgThick(),
37  m_vecTrgPhi (),
38  m_vecTrgXOff (),
39  m_vecTrgYOff (),
40  m_vecTrgZPiv (),
41  m_FibFibName (""),
42  m_FibCladName (""),
43  m_FibFibMat (""),
44  m_FibCladMat (""),
45  m_FibSide (0),
46  m_FibCladThick(0),
47  m_FibLength (0),
48  m_vecFibPhi (),
49  m_vecFibXOff (),
50  m_vecFibYOff (),
51  m_vecFibZPiv ()
52 
53 {
54  std::cout<< "creating an instance if DDTBH4Algo" << std::endl ;
55  LogDebug("EcalGeom") << "DDTBH4Algo test: Creating an instance";
56 }
57 
59 
60 
63  const CLHEP::HepRotation& r ) const
64 {
65  return DDrot( ddname( idNameSpace() + ":" + s ), new DDRotationMatrix( r.xx(), r.xy(), r.xz(), r.yx(), r.yy(), r.yz(), r.zx(), r.zy(), r.zz() ) ) ;
66 }
67 
68 
71 {
72  return DDMaterial( ddname( s ) ) ;
73 }
74 
75 DDName
77 {
78  const std::pair<std::string,std::string> temp ( DDSplit(s) ) ;
79  return DDName( temp.first,
80  temp.second ) ;
81 }
82 
83 
85  const DDVectorArguments& vArgs,
86  const DDMapArguments& mArgs,
87  const DDStringArguments& sArgs,
88  const DDStringVectorArguments& vsArgs )
89 {
91  m_BLZBeg = nArgs["BLZBeg"];
92  m_BLZEnd = nArgs["BLZEnd"];
93  m_BLZPiv = nArgs["BLZPiv"];
94  m_BLRadius = nArgs["BLRadius"];
95  m_VacName = sArgs["VacName"];
96  m_VacMat = sArgs["VacMat"];
97  m_vecVacZBeg = vArgs["VacZBeg"];
98  m_vecVacZEnd = vArgs["VacZEnd"];
99 
100  m_WinName = sArgs["WinName"];
101  m_vecWinMat = vsArgs["WinMat"];
102  m_vecWinZBeg = vArgs["WinZBeg"];
103  m_vecWinThick = vArgs["WinThick"];
104 
105  m_TrgMat = sArgs["TrgMat"];
106  m_HoleMat = sArgs["HoleMat"];
107  m_TrgVetoHoleRadius = nArgs["TrgVetoHoleRadius"];
108  m_vecTrgName = vsArgs["TrgName"];
109  m_vecTrgSide = vArgs["TrgSide"];
110  m_vecTrgThick = vArgs["TrgThick"];
111  m_vecTrgPhi = vArgs["TrgPhi"];
112  m_vecTrgXOff = vArgs["TrgXOff"];
113  m_vecTrgYOff = vArgs["TrgYOff"];
114  m_vecTrgZPiv = vArgs["TrgZPiv"];
115 
116  m_FibFibName = sArgs["FibFibName"];
117  m_FibCladName = sArgs["FibCladName"];
118  m_FibFibMat = sArgs["FibFibMat"];
119  m_FibCladMat = sArgs["FibCladMat"];
120  m_FibSide = nArgs["FibSide"];
121  m_FibCladThick= nArgs["FibCladThick"];
122  m_FibLength = nArgs["FibLength"];
123  m_vecFibPhi = vArgs["FibPhi"];
124  m_vecFibXOff = vArgs["FibXOff"];
125  m_vecFibYOff = vArgs["FibYOff"];
126  m_vecFibZPiv = vArgs["FibZPiv"];
127 }
128 
130 {
131  const unsigned int copyOne (1) ;
132 
133  const double halfZbl ( ( blZEnd() - blZBeg() )/2. ) ;
134  for( unsigned int i ( 0 ) ; i != vecVacZBeg().size() ; ++i )
135  {
136  DDName vacNameNm ( ddname( vacName() + std::to_string(i+1) ) ) ;
137  const double halfZvac ( ( vecVacZEnd()[i] - vecVacZBeg()[i] )/2. ) ;
138  DDSolid vTubeSolid ( DDSolidFactory::tubs( vacNameNm ,
139  halfZvac,
140  0,
141  blRadius(),
142  0*deg, 360*deg ) ) ;
143  const DDLogicalPart vacLog ( vacNameNm, vacMat(), vTubeSolid ) ;
144 
145  cpv.position( vacLog,
146  parent().name(),
147  1+i,
148  DDTranslation(0,0,
149  - halfZbl
150  + halfZvac
151  + vecVacZBeg()[i]
152  - blZBeg()),
153  DDRotation() ) ;
154  }
155 
156  for( unsigned int i ( 0 ) ; i != vecWinZBeg().size() ; ++i )
157  {
158  DDName wName ( ddname( winName() + std::to_string(i+1)) ) ;
159  DDSolid wTubeSolid ( DDSolidFactory::tubs( wName ,
160  vecWinThick()[i]/2.,
161  0,
162  blRadius(),
163  0*deg, 360*deg ) ) ;
164  const DDLogicalPart wLog ( wName, ddmat(vecWinMat()[i]), wTubeSolid ) ;
165 
166  const double off ( 0<vecWinZBeg()[i] ? vecWinZBeg()[i] :
167  fabs(vecWinZBeg()[i]) - vecWinThick()[i] ) ;
168 
169  cpv.position( wLog,
170  parent().name(),
171  1+i,
172  DDTranslation(0,0,
173  - halfZbl
174  + vecWinThick()[i]/2.
175  + off
176  - blZBeg() ),
177  DDRotation() ) ;
178  }
179 
180  for( unsigned int i ( 0 ) ; i != vecTrgName().size() ; ++i )
181  {
182  DDName tName ( ddname( vecTrgName()[i]) ) ;
183  DDSolid tSolid ( DDSolidFactory::box( tName ,
184  vecTrgSide()[ i]/2.,
185  vecTrgSide()[ i]/2.,
186  vecTrgThick()[i]/2. ) ) ;
187  const DDLogicalPart tLog ( tName, trgMat(), tSolid ) ;
188 
189  if( tName.name() == "VETO" )
190  {
191  DDName vName ( ddname( tName.name() + "Hole" ) ) ;
192  DDSolid vTubeSolid ( DDSolidFactory::tubs( vName ,
193  vecTrgThick()[i]/2.,
194  0,
196  0*deg, 360*deg ) ) ;
197  const DDLogicalPart vLog ( vName, holeMat(), vTubeSolid ) ;
198 
199  cpv.position( vLog,
200  tName,
201  copyOne,
202  DDTranslation(0,0,0),
203  DDRotation() ) ;
204  }
205 
206  cpv.position( tLog,
207  parent().name(),
208  copyOne,
210  vecTrgYOff()[i],
211  vecTrgZPiv()[i] - halfZbl + blZPiv() - blZBeg() ),
212  myrot( tName.name()+"Rot",
213  CLHEP::HepRotationZ( vecTrgPhi()[i]) ) ) ;
214  }
215 
216  DDName pName ( fibCladName() ) ;
217  const double planeWidth ( 32.5*fibSide() +
218  33.5*fibCladThick() ) ;
219  const double planeThick ( 2*fibSide() +
220  3*fibCladThick() ) ;
221  DDSolid pSolid ( DDSolidFactory::box( pName ,
222  planeWidth/2.,
223  fibLength()/2.,
224  planeThick/2. ) ) ;
225  const DDLogicalPart pLog ( pName, fibCladMat(), pSolid ) ;
226 
228  fibSide() /2.,
229  fibLength()/2.,
230  fibSide() /2.) ) ;
231 
232  const DDLogicalPart fLog ( fibFibName(), fibFibMat(), fSolid ) ;
233 
234  for( unsigned int j ( 0 ) ; j != 32 ; ++j )
235  {
236  const double xoff ( planeWidth/2. -
237  (1+ j)*fibCladThick() -
238  (1+ j)*fibSide() ) ;
239  const double zoff ( -planeThick/2 + fibCladThick() + fibSide()/2. ) ;
240  cpv.position( fLog,
241  pName,
242  1+j,
243  DDTranslation( xoff, 0, zoff ),
244  DDRotation() ) ;
245 
246  cpv.position( fLog,
247  pName,
248  33+j,
249  DDTranslation( xoff + (fibCladThick()+fibSide())/2.,0, -zoff),
250  DDRotation() ) ;
251  }
252  for( unsigned int i ( 0 ) ; i != vecFibZPiv().size() ; ++i )
253  {
254  cpv.position( pLog,
255  parent().name(),
256  1+i,
257  DDTranslation( vecFibXOff()[i] - 0.5*fibSide(),
258  vecFibYOff()[i],
259  vecFibZPiv()[i] - halfZbl + blZPiv() - blZBeg() ),
260  myrot( pName.name()+"Rot" + std::to_string(i),
261  CLHEP::HepRotationZ( vecFibPhi()[i]) ) ) ;
262  }
263 }
#define LogDebug(id)
const std::vector< double > & vecFibPhi() const
Definition: DDTBH4Algo.h:67
std::string m_idNameSpace
Definition: DDTBH4Algo.h:73
DDMaterial fibFibMat() const
Definition: DDTBH4Algo.h:62
std::string vacName() const
Definition: DDTBH4Algo.h:40
std::string m_HoleMat
Definition: DDTBH4Algo.h:89
std::vector< double > m_vecFibXOff
Definition: DDTBH4Algo.h:107
const std::vector< double > & vecFibYOff() const
Definition: DDTBH4Algo.h:69
const std::vector< double > & vecTrgXOff() const
Definition: DDTBH4Algo.h:56
std::string m_TrgMat
Definition: DDTBH4Algo.h:88
DDMaterial ddmat(const std::string &s) const
Definition: DDTBH4Algo.cc:70
DDMaterial holeMat() const
Definition: DDTBH4Algo.h:50
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
const std::vector< double > & vecWinZBeg() const
Definition: DDTBH4Algo.h:46
double fibCladThick() const
Definition: DDTBH4Algo.h:65
std::string m_FibCladMat
Definition: DDTBH4Algo.h:102
std::vector< double > m_vecWinThick
Definition: DDTBH4Algo.h:86
void position(const DDLogicalPart &self, const DDLogicalPart &parent, std::string copyno, const DDTranslation &trans, const DDRotation &rot, const DDDivision *div=NULL)
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:16
double fibLength() const
Definition: DDTBH4Algo.h:66
DDRotation myrot(const std::string &s, const CLHEP::HepRotation &r) const
Definition: DDTBH4Algo.cc:62
const std::vector< double > & vecVacZBeg() const
Definition: DDTBH4Algo.h:42
static std::string & ns()
std::vector< double > m_vecTrgYOff
Definition: DDTBH4Algo.h:96
double blZPiv() const
Definition: DDTBH4Algo.h:38
type of data representation of DDCompactView
Definition: DDCompactView.h:90
const std::vector< double > & vecTrgSide() const
Definition: DDTBH4Algo.h:53
DDMaterial vacMat() const
Definition: DDTBH4Algo.h:41
std::string m_VacName
Definition: DDTBH4Algo.h:79
virtual ~DDTBH4Algo()
Definition: DDTBH4Algo.cc:58
double m_FibLength
Definition: DDTBH4Algo.h:105
std::vector< double > m_vecTrgXOff
Definition: DDTBH4Algo.h:95
A DDSolid represents the shape of a part.
Definition: DDSolid.h:37
double m_TrgVetoHoleRadius
Definition: DDTBH4Algo.h:90
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DDTranslation
Definition: DDTranslation.h:7
Represents a uniquely identifyable rotation matrix.
Definition: DDTransform.h:64
double m_FibSide
Definition: DDTBH4Algo.h:103
DDMaterial fibCladMat() const
Definition: DDTBH4Algo.h:63
const std::vector< double > & vecWinThick() const
Definition: DDTBH4Algo.h:47
DDName fibFibName() const
Definition: DDTBH4Algo.h:60
double m_FibCladThick
Definition: DDTBH4Algo.h:104
double blRadius() const
Definition: DDTBH4Algo.h:39
const std::vector< double > & vecFibXOff() const
Definition: DDTBH4Algo.h:68
const std::vector< std::string > & vecWinMat() const
Definition: DDTBH4Algo.h:45
const std::vector< double > & vecTrgPhi() const
Definition: DDTBH4Algo.h:55
DDMaterial trgMat() const
Definition: DDTBH4Algo.h:49
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:92
const std::vector< double > & vecTrgZPiv() const
Definition: DDTBH4Algo.h:58
double m_BLZEnd
Definition: DDTBH4Algo.h:76
const std::vector< double > & vecFibZPiv() const
Definition: DDTBH4Algo.h:70
std::vector< double > m_vecWinZBeg
Definition: DDTBH4Algo.h:85
double blZBeg() const
Definition: DDTBH4Algo.h:36
static DDSolid tubs(const DDName &name, double zhalf, double rIn, double rOut, double startPhi, double deltaPhi)
Definition: DDSolid.cc:863
std::vector< double > m_vecFibZPiv
Definition: DDTBH4Algo.h:109
std::string m_FibCladName
Definition: DDTBH4Algo.h:100
std::vector< std::string > m_vecWinMat
Definition: DDTBH4Algo.h:84
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:705
double m_BLZPiv
Definition: DDTBH4Algo.h:77
std::vector< double > m_vecTrgThick
Definition: DDTBH4Algo.h:93
const std::string & idNameSpace() const
Definition: DDTBH4Algo.h:34
std::vector< double > m_vecVacZEnd
Definition: DDTBH4Algo.h:82
DDRotation DDrot(const DDName &name, DDRotationMatrix *rot)
Definition of a uniquely identifiable rotation matrix named by DDName name.
Definition: DDRotation.cc:90
std::vector< double > m_vecTrgSide
Definition: DDTBH4Algo.h:92
DDName ddname(const std::string &s) const
Definition: DDTBH4Algo.cc:76
std::string winName() const
Definition: DDTBH4Algo.h:44
std::vector< double > m_vecTrgPhi
Definition: DDTBH4Algo.h:94
void execute(DDCompactView &cpv)
Definition: DDTBH4Algo.cc:129
std::vector< double > m_vecFibPhi
Definition: DDTBH4Algo.h:106
std::vector< std::string > m_vecTrgName
Definition: DDTBH4Algo.h:91
std::string m_VacMat
Definition: DDTBH4Algo.h:80
std::vector< double > m_vecTrgZPiv
Definition: DDTBH4Algo.h:97
void initialize(const DDNumericArguments &nArgs, const DDVectorArguments &vArgs, const DDMapArguments &mArgs, const DDStringArguments &sArgs, const DDStringVectorArguments &vsArgs)
Definition: DDTBH4Algo.cc:84
const std::vector< double > & vecTrgThick() const
Definition: DDTBH4Algo.h:54
std::string m_FibFibMat
Definition: DDTBH4Algo.h:101
double m_BLZBeg
Definition: DDTBH4Algo.h:75
double blZEnd() const
Definition: DDTBH4Algo.h:37
std::vector< double > m_vecVacZBeg
Definition: DDTBH4Algo.h:81
double fibSide() const
Definition: DDTBH4Algo.h:64
const std::vector< std::string > & vecTrgName() const
Definition: DDTBH4Algo.h:52
double trgVetoHoleRadius() const
Definition: DDTBH4Algo.h:51
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:4
double m_BLRadius
Definition: DDTBH4Algo.h:78
const std::vector< double > & vecVacZEnd() const
Definition: DDTBH4Algo.h:43
std::vector< double > m_vecFibYOff
Definition: DDTBH4Algo.h:108
ROOT::Math::Rotation3D DDRotationMatrix
A DDRotationMatrix is currently implemented with a ROOT Rotation3D.
const std::vector< double > & vecTrgYOff() const
Definition: DDTBH4Algo.h:57
const std::string & name() const
Returns the name.
Definition: DDName.cc:90
DDName fibCladName() const
Definition: DDTBH4Algo.h:61
std::string m_WinName
Definition: DDTBH4Algo.h:83
std::string m_FibFibName
Definition: DDTBH4Algo.h:99