CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
16 #include "CLHEP/Units/GlobalSystemOfUnits.h"
17 
19  m_idNameSpace (""),
20  m_BLZBeg (0),
21  m_BLZEnd (0),
22  m_BLZPiv (0),
23  m_BLRadius (0),
24  m_VacName (""),
25  m_VacMat (""),
26  m_vecVacZBeg (),
27  m_vecVacZEnd (),
28  m_WinName (""),
29  m_vecWinMat (),
30  m_vecWinZBeg (),
31  m_vecWinThick(),
32  m_TrgMat (""),
33  m_HoleMat (""),
34  m_TrgVetoHoleRadius (0),
35  m_vecTrgName (),
36  m_vecTrgSide (),
37  m_vecTrgThick(),
38  m_vecTrgPhi (),
39  m_vecTrgXOff (),
40  m_vecTrgYOff (),
41  m_vecTrgZPiv (),
42  m_FibFibName (""),
43  m_FibCladName (""),
44  m_FibFibMat (""),
45  m_FibCladMat (""),
46  m_FibSide (0),
47  m_FibCladThick(0),
48  m_FibLength (0),
49  m_vecFibPhi (),
50  m_vecFibXOff (),
51  m_vecFibYOff (),
52  m_vecFibZPiv ()
53 
54 {
55  std::cout<< "creating an instance if DDTBH4Algo" << std::endl ;
56  LogDebug("EcalGeom") << "DDTBH4Algo test: Creating an instance";
57 }
58 
60 
61 
64  const CLHEP::HepRotation& r ) const
65 {
66  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() ) ) ;
67 }
68 
69 
72 {
73  return DDMaterial( ddname( s ) ) ;
74 }
75 
76 DDName
78 {
79  const std::pair<std::string,std::string> temp ( DDSplit(s) ) ;
80  return DDName( temp.first,
81  temp.second ) ;
82 }
83 
84 
86  const DDVectorArguments& vArgs,
87  const DDMapArguments& mArgs,
88  const DDStringArguments& sArgs,
89  const DDStringVectorArguments& vsArgs )
90 {
92  m_BLZBeg = nArgs["BLZBeg"];
93  m_BLZEnd = nArgs["BLZEnd"];
94  m_BLZPiv = nArgs["BLZPiv"];
95  m_BLRadius = nArgs["BLRadius"];
96  m_VacName = sArgs["VacName"];
97  m_VacMat = sArgs["VacMat"];
98  m_vecVacZBeg = vArgs["VacZBeg"];
99  m_vecVacZEnd = vArgs["VacZEnd"];
100 
101  m_WinName = sArgs["WinName"];
102  m_vecWinMat = vsArgs["WinMat"];
103  m_vecWinZBeg = vArgs["WinZBeg"];
104  m_vecWinThick = vArgs["WinThick"];
105 
106  m_TrgMat = sArgs["TrgMat"];
107  m_HoleMat = sArgs["HoleMat"];
108  m_TrgVetoHoleRadius = nArgs["TrgVetoHoleRadius"];
109  m_vecTrgName = vsArgs["TrgName"];
110  m_vecTrgSide = vArgs["TrgSide"];
111  m_vecTrgThick = vArgs["TrgThick"];
112  m_vecTrgPhi = vArgs["TrgPhi"];
113  m_vecTrgXOff = vArgs["TrgXOff"];
114  m_vecTrgYOff = vArgs["TrgYOff"];
115  m_vecTrgZPiv = vArgs["TrgZPiv"];
116 
117  m_FibFibName = sArgs["FibFibName"];
118  m_FibCladName = sArgs["FibCladName"];
119  m_FibFibMat = sArgs["FibFibMat"];
120  m_FibCladMat = sArgs["FibCladMat"];
121  m_FibSide = nArgs["FibSide"];
122  m_FibCladThick= nArgs["FibCladThick"];
123  m_FibLength = nArgs["FibLength"];
124  m_vecFibPhi = vArgs["FibPhi"];
125  m_vecFibXOff = vArgs["FibXOff"];
126  m_vecFibYOff = vArgs["FibYOff"];
127  m_vecFibZPiv = vArgs["FibZPiv"];
128 }
129 
131 {
132  const unsigned int copyOne (1) ;
133 
134  const double halfZbl ( ( blZEnd() - blZBeg() )/2. ) ;
135  for( unsigned int i ( 0 ) ; i != vecVacZBeg().size() ; ++i )
136  {
137  DDName vacNameNm ( ddname( vacName() + int_to_string(i+1) ) ) ;
138  const double halfZvac ( ( vecVacZEnd()[i] - vecVacZBeg()[i] )/2. ) ;
139  DDSolid vTubeSolid ( DDSolidFactory::tubs( vacNameNm ,
140  halfZvac,
141  0,
142  blRadius(),
143  0*deg, 360*deg ) ) ;
144  const DDLogicalPart vacLog ( vacNameNm, vacMat(), vTubeSolid ) ;
145 
146  cpv.position( vacLog,
147  parent().name(),
148  1+i,
149  DDTranslation(0,0,
150  - halfZbl
151  + halfZvac
152  + vecVacZBeg()[i]
153  - blZBeg()),
154  DDRotation() ) ;
155  }
156 
157  for( unsigned int i ( 0 ) ; i != vecWinZBeg().size() ; ++i )
158  {
159  DDName wName ( ddname( winName() + int_to_string(i+1)) ) ;
160  DDSolid wTubeSolid ( DDSolidFactory::tubs( wName ,
161  vecWinThick()[i]/2.,
162  0,
163  blRadius(),
164  0*deg, 360*deg ) ) ;
165  const DDLogicalPart wLog ( wName, ddmat(vecWinMat()[i]), wTubeSolid ) ;
166 
167  const double off ( 0<vecWinZBeg()[i] ? vecWinZBeg()[i] :
168  fabs(vecWinZBeg()[i]) - vecWinThick()[i] ) ;
169 
170  cpv.position( wLog,
171  parent().name(),
172  1+i,
173  DDTranslation(0,0,
174  - halfZbl
175  + vecWinThick()[i]/2.
176  + off
177  - blZBeg() ),
178  DDRotation() ) ;
179  }
180 
181  for( unsigned int i ( 0 ) ; i != vecTrgName().size() ; ++i )
182  {
183  DDName tName ( ddname( vecTrgName()[i]) ) ;
184  DDSolid tSolid ( DDSolidFactory::box( tName ,
185  vecTrgSide()[ i]/2.,
186  vecTrgSide()[ i]/2.,
187  vecTrgThick()[i]/2. ) ) ;
188  const DDLogicalPart tLog ( tName, trgMat(), tSolid ) ;
189 
190  if( tName.name() == "VETO" )
191  {
192  DDName vName ( ddname( tName.name() + "Hole" ) ) ;
193  DDSolid vTubeSolid ( DDSolidFactory::tubs( vName ,
194  vecTrgThick()[i]/2.,
195  0,
197  0*deg, 360*deg ) ) ;
198  const DDLogicalPart vLog ( vName, holeMat(), vTubeSolid ) ;
199 
200  cpv.position( vLog,
201  tName,
202  copyOne,
203  DDTranslation(0,0,0),
204  DDRotation() ) ;
205  }
206 
207  cpv.position( tLog,
208  parent().name(),
209  copyOne,
211  vecTrgYOff()[i],
212  vecTrgZPiv()[i] - halfZbl + blZPiv() - blZBeg() ),
213  myrot( tName.name()+"Rot",
214  CLHEP::HepRotationZ( vecTrgPhi()[i]) ) ) ;
215  }
216 
217  DDName pName ( fibCladName() ) ;
218  const double planeWidth ( 32.5*fibSide() +
219  33.5*fibCladThick() ) ;
220  const double planeThick ( 2*fibSide() +
221  3*fibCladThick() ) ;
222  DDSolid pSolid ( DDSolidFactory::box( pName ,
223  planeWidth/2.,
224  fibLength()/2.,
225  planeThick/2. ) ) ;
226  const DDLogicalPart pLog ( pName, fibCladMat(), pSolid ) ;
227 
229  fibSide() /2.,
230  fibLength()/2.,
231  fibSide() /2.) ) ;
232 
233  const DDLogicalPart fLog ( fibFibName(), fibFibMat(), fSolid ) ;
234 
235  for( unsigned int j ( 0 ) ; j != 32 ; ++j )
236  {
237  const double xoff ( planeWidth/2. -
238  (1+ j)*fibCladThick() -
239  (1+ j)*fibSide() ) ;
240  const double zoff ( -planeThick/2 + fibCladThick() + fibSide()/2. ) ;
241  cpv.position( fLog,
242  pName,
243  1+j,
244  DDTranslation( xoff, 0, zoff ),
245  DDRotation() ) ;
246 
247  cpv.position( fLog,
248  pName,
249  33+j,
250  DDTranslation( xoff + (fibCladThick()+fibSide())/2.,0, -zoff),
251  DDRotation() ) ;
252  }
253  for( unsigned int i ( 0 ) ; i != vecFibZPiv().size() ; ++i )
254  {
255  cpv.position( pLog,
256  parent().name(),
257  1+i,
258  DDTranslation( vecFibXOff()[i] - 0.5*fibSide(),
259  vecFibYOff()[i],
260  vecFibZPiv()[i] - halfZbl + blZPiv() - blZBeg() ),
261  myrot( pName.name()+"Rot" + int_to_string(i),
262  CLHEP::HepRotationZ( vecFibPhi()[i]) ) ) ;
263  }
264 }
#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
int i
Definition: DBlmapReader.cc:9
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
list parent
Definition: dbtoconf.py:74
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:71
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:18
double fibLength() const
Definition: DDTBH4Algo.h:66
DDRotation myrot(const std::string &s, const CLHEP::HepRotation &r) const
Definition: DDTBH4Algo.cc:63
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:77
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:59
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:35
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:66
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
std::string int_to_string(const int &in)
Definition: DDutils.cc:16
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
int j
Definition: DBlmapReader.cc:9
A DDLogicalPart aggregates information concerning material, solid and sensitveness ...
Definition: DDLogicalPart.h:88
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:788
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:519
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:77
std::string winName() const
Definition: DDTBH4Algo.h:44
std::vector< double > m_vecTrgPhi
Definition: DDTBH4Algo.h:94
void execute(DDCompactView &cpv)
Definition: DDTBH4Algo.cc:130
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:85
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
tuple cout
Definition: gather_cfg.py:121
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:87
DDName fibCladName() const
Definition: DDTBH4Algo.h:61
std::string m_WinName
Definition: DDTBH4Algo.h:83
std::string m_FibFibName
Definition: DDTBH4Algo.h:99