Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 //Writed by Andrei Barashkou JINR(Russia,Dubna) 2007.
002 #include "MuonGeoModel/SaddleTubsBuilder.h"
003 #include "AthenaKernel/getMessageSvc.h"
004 
005 #include "RDBAccessSvc/IRDBRecord.h"
006 #include "RDBAccessSvc/IRDBRecordset.h"
007 #include "RDBAccessSvc/IRDBAccessSvc.h"
008 
009 #include "MuonGeoModel/ArrayFunction.h"
010 
011 #include "GeoModelKernel/GeoBox.h"
012 #include "GeoModelKernel/GeoTube.h"
013 #include "GeoModelKernel/GeoTubs.h"
014 #include "GeoModelKernel/GeoPcon.h"  
015 #include "GeoModelKernel/GeoTrd.h"
016 #include "GeoModelKernel/GeoTrap.h"
017 #include "GeoModelKernel/GeoPara.h"
018 #include "GeoModelKernel/GeoPgon.h"
019 #include "GeoModelKernel/GeoSimplePolygonBrep.h"
020 #include "GeoModelKernel/GeoMaterial.h"
021 #include "GeoModelKernel/GeoLogVol.h"
022 #include "GeoModelKernel/GeoPhysVol.h"
023 #include "GeoModelKernel/GeoFullPhysVol.h"
024 #include "GeoModelKernel/GeoTransform.h"
025 #include "GeoModelKernel/GeoAlignableTransform.h"
026 #include "GeoModelKernel/GeoNameTag.h"
027 #include "GeoModelKernel/GeoShapeShift.h"
028 #include "GeoModelKernel/GeoShapeUnion.h"
029 #include "GeoModelKernel/GeoShapeSubtraction.h"
030 #include "GeoModelKernel/GeoSerialTransformer.h" 
031 #include "GeoModelKernel/GeoIdentifierTag.h"
032 #include "GeoModelSvc/StoredMaterialManager.h"
033 
034 #include "StoreGate/StoreGateSvc.h"
035 #include "CLHEP/GenericFunctions/Variable.hh"
036 
037 #include <stdexcept>
038 #include <vector>
039 #include <iomanip>  
040 
041 #include <sstream>
042 typedef std::stringstream  my_sstream;
043 typedef std::ostringstream my_osstream;
044 
045 using namespace Genfun;
046 using namespace GeoXF;
047 
048 namespace MuonGM {
049 SaddleTubsBuilder::SaddleTubsBuilder( StoreGateSvc  *pDetStore,
050                                     IRDBAccessSvc *pRDBAccess, 
051                                     std::string    geoTag,
052                                     std::string    geoNode )    :
053     m_pRDBAccess(pRDBAccess), 
054     m_pDetStore (pDetStore)
055 {
056 
057   _unavailableData = false;
058 //   m_Saddletuvp     = pRDBAccess->getRecordset("SADDLETUVP","SADDLETUVP-00");
059 //   m_Saddletuvs     = pRDBAccess->getRecordset("SADDLETUVS","SADDLETUVS-00");
060 //   m_Saddletuvn     = pRDBAccess->getRecordset("SADDLETUVN","SADDLETUVN-00");
061 // //  m_Fbrvsbo   = pRDBAccess->getRecordset("FBRVSBO","FBRVSBO-TEST-00");
062 // //  m_Fbovstu   = pRDBAccess->getRecordset("FBOVSTU","FBOVSTU-TEST-00");
063 // //  m_Fbrvsbr   = pRDBAccess->getRecordset("FBRVSBR","FBRVSBR-TEST-00");
064 // //  m_Feboxes   = pRDBAccess->getRecordset("FEBOXES","FEBOXES-TEST-00");
065 // //  m_Fetubes   = pRDBAccess->getRecordset("FETUBES","FETUBES-TEST-00");
066 // //  m_Febreps   = pRDBAccess->getRecordset("FEBREPS","FEBREPS-TEST-00");
067 // //  m_Febrepsxy = pRDBAccess->getRecordset("FEBREPSXY","FEBREPSXY-TEST-00");
068 //   m_Saddle     = pRDBAccess->getRecordset("SADDLE","SADDLE-00");
069 
070   m_Saddletuvp     = pRDBAccess->getRecordset("SADDLETUVP", geoTag, geoNode);
071   m_Saddletuvs     = pRDBAccess->getRecordset("SADDLETUVS",geoTag, geoNode);
072   m_Saddletuvn     = pRDBAccess->getRecordset("SADDLETUVN",geoTag, geoNode);
073 //  m_Fbrvsbo   = pRDBAccess->getRecordset("FBRVSBO","FBRVSBO-TEST-00");
074 //  m_Fbovstu   = pRDBAccess->getRecordset("FBOVSTU","FBOVSTU-TEST-00");
075 //  m_Fbrvsbr   = pRDBAccess->getRecordset("FBRVSBR","FBRVSBR-TEST-00");
076 //  m_Feboxes   = pRDBAccess->getRecordset("FEBOXES","FEBOXES-TEST-00");
077 //  m_Fetubes   = pRDBAccess->getRecordset("FETUBES","FETUBES-TEST-00");
078 //  m_Febreps   = pRDBAccess->getRecordset("FEBREPS","FEBREPS-TEST-00");
079 //  m_Febrepsxy = pRDBAccess->getRecordset("FEBREPSXY","FEBREPSXY-TEST-00");
080   m_Saddle     = pRDBAccess->getRecordset("SADDLE",geoTag, geoNode);
081   if (m_Saddle->size()*m_Saddletuvn->size()*m_Saddletuvs->size()*m_Saddletuvp->size() == 0) _unavailableData=true;
082 
083   std::string Iron = "Iron";
084   
085   std::string Aluminium = "Alum";
086 
087   MsgStream log( Athena::getMessageSvc(), "MuGM:SaddleTubsBuilder" );
088   if (!_unavailableData) log << MSG::INFO << "All data fetched with tag <" << geoTag << ">" << endreq;
089   else log << MSG::INFO << "No data found with tag <" << geoTag << ">" << endreq;
090 }
091 
092 void SaddleTubsBuilder::buildSaddleTubs( GeoPhysVol* container ) 
093 {
094 
095   const StoredMaterialManager*  theMaterialManager;
096   if ( StatusCode::SUCCESS != m_pDetStore->retrieve( theMaterialManager, "MATERIALS" ) ) 
097   {
098     return;
099   } 
100   int n = 0; //need for position of volumes
101   int f = 0; //for tube subtraction
102   int g = 0; //for box subtraction
103 //  double tolerance = 0.5 * mm;
104   
105   int Numtubs   = (int)(*m_Saddle)[0]->getFloat("SADL_NUMTUBES");
106   
107   double  Xposb[100];
108   double  Yposb[100];
109   double  Zposb[100];
110   double Xposgl[100];
111   double Yposgl[100];
112   double Zposgl[100];
113   double   Rotx[100];
114   double   Roty[100];
115   double   Rotz[100];
116   for (int k = 0; k < Numtubs; k++)
117   {
118 //  data from TUVN  
119     int NumVol    = (int)(*m_Saddletuvn)[k]->getFloat("NUMVOL");
120     int Numembo   = (int)(*m_Saddletuvn)[k]->getFloat("NUMEMBO");
121     int Numemtu   = (int)(*m_Saddletuvn)[k]->getFloat("NUMEMTU");
122     //int Numembr         = (int)(*m_Saddletuvn)[k]->getFloat("NUMEMBR");
123     int SymX      = (int)(*m_Saddletuvn)[k]->getFloat("SYMX");
124     int SymY      = (int)(*m_Saddletuvn)[k]->getFloat("SYMY");
125     int SymZ      = (int)(*m_Saddletuvn)[k]->getFloat("SYMZ");
126     
127 //  data from TUVS
128     float Rmin       = (*m_Saddletuvs)[k]->getFloat("RMIN") * mm;
129     float Rmax       = (*m_Saddletuvs)[k]->getFloat("RMAX") * mm;
130     float Dz         = (*m_Saddletuvs)[k]->getFloat("DZ") * mm;  
131     float AlphaStart = (*m_Saddletuvs)[k]->getFloat("ALPHASTART") * mm;
132     float Alpha      = (*m_Saddletuvs)[k]->getFloat("ALPHA") * mm;  
133     
134 //    const std::string ExFName            = getName(*m_Efbrvebp->"VOLNAME"); 
135 //    const std::string feetMaterial  = getMaterial(*m_Efbrven, "MATERIAL");
136     const std::string saddleMaterial = getMaterial( "Iron" );
137 // //ispul'zui kol-vo ob'emov i vinisi za predeli zikla ->v nachalo
138 //     double Xposb[NumVol + n];
139 //     double Yposb[NumVol + n];
140 //     double Zposb[NumVol + n];
141 //     double Xposgl[NumVol + n];
142 //     double Yposgl[NumVol + n];
143 //     double Zposgl[NumVol + n];
144 //     double Rotx[NumVol + n];
145 //     double Roty[NumVol + n];
146 //     double Rotz[NumVol +n];
147 //std::cout <<" m: "<<m <<std::endl;
148 //creating box volume
149 //-------------------  
150   GeoTubs* Tubs = new GeoTubs(Rmin , Rmax, Dz/2, AlphaStart * M_PI/180, Alpha * M_PI/180);
151 //-------------------  
152   
153   const GeoShape* sTubs = &( *Tubs );
154 
155   //GeoTube* EmptyTube[Numemtu+f]; HepTransform3D trlEmptyTube[Numemtu+f];
156   //GeoBox* EmptyBox[Numembo+g]; HepTransform3D trlEmptyBox[Numembo+g];
157   //GeoTube* EmptyTube[100]; HepTransform3D trlEmptyTube[100];
158   //GeoBox* EmptyBox[100]; HepTransform3D trlEmptyBox[100];
159 /*
160 //tubes for subtraction
161   for (int i = f; i < Numemtu + f; i++)
162   {
163   int Whichtube       = (*m_Saddletuvstu)[i]->getFloat("WHICHTUBE");
164   double Rminetube    = (*m_Saddleetubes)[Whichtube]->getFloat("RMIN") * mm;
165   double Rmaxetube    = (*m_Saddleetubes)[Whichtube]->getFloat("RMAX") * mm;
166   double DZetube      = (*m_Saddleetubes)[Whichtube]->getFloat("DZ") * mm;
167   double Alphastart   = (*m_Saddleetubes)[Whichtube]->getFloat("Alphastart") * deg;
168   double Alpha        = (*m_Saddleetubes)[Whichtube]->getFloat("Alpha") * deg;
169   double Xposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("XPOS") * mm;
170   double Yposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("YPOS") * mm;
171   double Zposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ZPOS") * mm;
172   double RotXetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTX") * deg;
173   double RotYetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTY") * deg;
174   double RotZetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTZ") * deg;
175                        
176   EmptyTube[i] = new GeoTube(Rminetube, Rmaxetube, DZetube);
177             
178   trlEmptyTube[i] = HepTranslate3D(Xposetube, Yposetube, Zposetube) * HepRotateY3D(RotYetube)
179                                   * HepRotateZ3D(RotZetube) * HepRotateX3D(RotXetube);
180 
181     sTubs = &( sTubs->subtract( (*EmptyTube[i]) << trlEmptyTube[i] ) );
182   }
183 */  
184 f = f + Numemtu;
185   
186 //boxes for subtraction
187 /*  for (int i = g; i < Numembo + g; i++)
188   {
189   int WhichBox          = (*m_Saddletuvsbo)[i]->getFloat("WHICHBOX");
190   double DXembox        = (*m_Saddleeboxes)[WhichBox]->getFloat("DX") * mm;
191   double DYembox        = (*m_Saddleeboxes)[WhichBox]->getFloat("DY") * mm;
192   double DZembox        = (*m_Saddleeboxes)[WhichBox]->getFloat("DZ") * mm;
193   double Xposembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("XPOS") * mm;
194   double Yposembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("YPOS") * mm;
195   double Zposembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ZPOS") * mm;
196   double RotXembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTX") * deg;
197   double RotYembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTY") * deg;
198   double RotZembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTZ") * deg;
199   
200   EmptyBox[i] = new GeoBox(DXembox/2, DYembox/2, DZembox/2);
201   
202   trlEmptyBox[i] = HepTranslate3D(Xposembox, Yposembox, Zposembox) * HepRotateZ3D(RotZembox)
203                                 * HepRotateY3D(RotYembox) * HepRotateX3D(RotXembox);
204 
205     sBox = &( sBox->subtract( (*EmptyBox[i]) << trlEmptyBox[i] ) );
206   }
207 */  
208 g = g + Numembo;  
209   
210     for (int j = n; j < NumVol + n; j++)
211       {
212         Zposgl[j] = (*m_Saddletuvp)[j]->getFloat("ZPOSGL") * mm;
213         Xposgl[j] = (*m_Saddletuvp)[j]->getFloat("XPOSGL") * mm;
214         Yposgl[j] = (*m_Saddletuvp)[j]->getFloat("YPOSGL") * mm;
215         Zposb[j]  = (*m_Saddletuvp)[j]->getFloat("ZPOSB") * mm;
216         Xposb[j]  = (*m_Saddletuvp)[j]->getFloat("XPOSB") * mm;
217         Yposb[j]  = (*m_Saddletuvp)[j]->getFloat("YPOSB") * mm;
218         Rotx[j]   = (*m_Saddletuvp)[j]->getFloat("ROTX") * deg;
219         Roty[j]   = (*m_Saddletuvp)[j]->getFloat("ROTY") * deg;
220         Rotz[j]   = (*m_Saddletuvp)[j]->getFloat("ROTZ") * deg;
221 
222 //Xposgl[0]=Xposgl[1]=Xposgl[2]=Xposgl[3]=Yposgl[0]=Yposgl[1]=Yposgl[2]=Yposgl[3]=0;
223 
224 
225     HepTransform3D trlTubs = /*HepTranslate3D(0., 0., 0.) */ HepRotateY3D(Roty[j])
226                                             * HepRotateZ3D(Rotz[j]) * HepRotateX3D(Rotx[j]);
227     
228     const GeoShape& posTubsPlate = ( *sTubs << trlTubs );
229     
230   GeoLogVol*  lTubsPlate = new GeoLogVol( "SaddleTubs",
231                                             &posTubsPlate,
232                                           theMaterialManager->getMaterial(saddleMaterial) );
233   GeoPhysVol* pTubsPlate = new GeoPhysVol(lTubsPlate);
234 
235 
236 //  std::cout<<" SaddleTubsBuilder constructor2 "<<std::endl;
237   //-----------------------------------------------------------------------------------------------------       
238   //  const int nXpos = SymX + 1.;
239   int nXpos = SymX + 1;
240   int nYpos = SymY + 1;
241   int nZpos = SymZ + 1;
242 
243   //  double  rotAngleX[nXpos], xPosBrepPlate[nXpos], rotAngleY[nYpos], yPosBrepPlate[nYpos], rotAngleZ[nZpos], zPosBrepPlate[nZpos];
244 
245   double rotAngleX[2] = { 0, M_PI }; double xPosTubsPlate[2] = {Xposgl[j]+Xposb[j], -Xposgl[j]-Xposb[j]};
246   double rotAngleY[2] = { 0, M_PI }; double yPosTubsPlate[2] = {Yposgl[j]+Yposb[j], -Yposgl[j]-Yposb[j]};
247   double rotAngleZ[2] = { 0, M_PI }; double zPosTubsPlate[2] = {Zposgl[j]+Zposb[j], -Zposgl[j]-Zposb[j]};
248   const int nAllpos = nXpos * nYpos * nZpos;
249 //   double zPosTubsAux[nAllpos], xPosTubsAux[nAllpos], yPosTubsAux[nAllpos], 
250 //   rotAngleTubsAuxX[nAllpos], rotAngleTubsAuxY[nAllpos], rotAngleTubsAuxZ[nAllpos];
251   double zPosTubsAux[100], xPosTubsAux[100], yPosTubsAux[100], 
252       rotAngleTubsAuxX[100], rotAngleTubsAuxY[100], rotAngleTubsAuxZ[100];
253 
254   for ( int w = 0; w < nAllpos; w++ )
255   {
256      int ww = w % (nAllpos / nZpos),
257          ss = w / (nAllpos / nXpos),
258          ee = w / (nAllpos / nYpos);
259      //std::cout <<" ww: "<<ww <<std::endl;
260      //std::cout <<" ss: "<<ss <<std::endl;
261      //std::cout <<" ee: "<<ee <<std::endl;
262      zPosTubsAux[w]     = zPosTubsPlate[ww];
263 //          std::cout <<" ZPosTubsAux: "<<zPosTubsAux[w] <<std::endl;
264      xPosTubsAux[w]     = xPosTubsPlate[ss];
265 //          std::cout <<" XPosTubsAux: "<<xPosTubsAux[w] <<std::endl;
266      yPosTubsAux[w]     = yPosTubsPlate[ee];
267 //          std::cout <<" YPosTubsAux: "<<yPosTubsAux[w] <<std::endl;
268      rotAngleTubsAuxX[w] = rotAngleX[ss];
269 //          std::cout <<" rotAngleTubsAuxX: "<<rotAngleTubsAuxX[w] <<std::endl;
270      rotAngleTubsAuxY[w] = rotAngleY[ee];
271 //          std::cout <<" rotAngleTubsAuxY: "<<rotAngleTubsAuxY[w] <<std::endl;
272      rotAngleTubsAuxZ[w] = rotAngleZ[ss];
273 //          std::cout <<" rotAngleTubsAuxZ: "<<rotAngleTubsAuxZ[w] <<std::endl;
274   }
275 
276  GENFUNCTION fTubsRotX = ArrayFunction( rotAngleTubsAuxX, rotAngleTubsAuxX + nAllpos );
277  GENFUNCTION fTubsTrlX = ArrayFunction( xPosTubsAux, xPosTubsAux + nAllpos );// + nXpos * NumVol );
278  GENFUNCTION fTubsRotY = ArrayFunction( rotAngleTubsAuxY, rotAngleTubsAuxY + nAllpos );
279  GENFUNCTION fTubsTrlY = ArrayFunction( yPosTubsAux, yPosTubsAux + nAllpos );
280  GENFUNCTION fTubsRotZ = ArrayFunction( rotAngleTubsAuxZ, rotAngleTubsAuxZ +  nAllpos );
281  GENFUNCTION fTubsTrlZ = ArrayFunction( zPosTubsAux, zPosTubsAux +  nAllpos );
282 
283  TRANSFUNCTION XFTubsPlate   = Pow( HepTranslateX3D(1.0), fTubsTrlX ) *
284                                Pow( HepTranslateY3D(1.0), fTubsTrlY ) *                           
285                                Pow( HepTranslateZ3D(1.0), fTubsTrlZ ) * 
286                                Pow( HepRotateX3D(1.0), fTubsRotX ) *
287                                Pow( HepRotateY3D(1.0), fTubsRotY ) *
288                                Pow( HepRotateZ3D(1.0), fTubsRotZ );
289 
290 GeoSerialTransformer* sxTubsPlate = new GeoSerialTransformer( pTubsPlate,
291                                                               &XFTubsPlate,
292                                                               nAllpos );
293 
294 
295 container->add(sxTubsPlate);
296       }
297       
298 n = n + NumVol;      
299 NumVol = 0;
300 //std::cout<<" TEto konez progi sd"<<std::endl;
301   }
302 }
303     
304 std::string SaddleTubsBuilder::getMaterial( std::string materialName ) 
305 {
306   MsgStream log(Athena::getMessageSvc(), "MuonGeoModel");
307   if ( materialName == "Alum" )
308   {
309     return "std::Aluminium";
310   }
311   else if ( materialName == "Iron" )  
312   {
313     return "std::Iron";
314   }  
315   else if ( materialName == "Fe50"  ||  materialName == "Al67" )   
316   {
317     return "toro::" + materialName;
318   }
319   else 
320   {
321    log  <<  " SaddleTubsBuilder::getMaterial: material "  <<  materialName  
322         <<  " not defined! "
323         <<  " Take Aluminium instead."
324         <<  endreq;
325    return "std::Aluminium";           
326   }  
327 }  
328 
329 } // namespace MuonGM
330 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!