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/SaddleBoxesBuilder.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 SaddleBoxesBuilder::SaddleBoxesBuilder( 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     
059   // get tables according to MuonSpectrometer tag !!!!!!!!!!!!!!!!!!!!!!!! 
060   //m_Saddlebovp     = pRDBAccess->getRecordset("SADDLEBOVP","SADDLEBOVP-00");
061   //m_Saddlebovs     = pRDBAccess->getRecordset("SADDLEBOVS","SADDLEBOVS-00");
062   //m_Saddlebovn     = pRDBAccess->getRecordset("SADDLEBOVN","SADDLEBOVN-00");
063   // //  m_Fbrvsbo   = pRDBAccess->getRecordset("FBRVSBO","FBRVSBO-TEST-00");
064   // //  m_Fbovstu   = pRDBAccess->getRecordset("FBOVSTU","FBOVSTU-TEST-00");
065   // //  m_Fbrvsbr   = pRDBAccess->getRecordset("FBRVSBR","FBRVSBR-TEST-00");
066   // //  m_Feboxes   = pRDBAccess->getRecordset("FEBOXES","FEBOXES-TEST-00");
067   // //  m_Fetubes   = pRDBAccess->getRecordset("FETUBES","FETUBES-TEST-00");
068   // //  m_Febreps   = pRDBAccess->getRecordset("FEBREPS","FEBREPS-TEST-00");
069   // //  m_Febrepsxy = pRDBAccess->getRecordset("FEBREPSXY","FEBREPSXY-TEST-00");
070   //   m_Saddle     = pRDBAccess->getRecordset("SADDLE","SADDLE-00");
071 
072   m_Saddlebovp     = pRDBAccess->getRecordset("SADDLEBOVP", geoTag, geoNode);
073   m_Saddlebovs     = pRDBAccess->getRecordset("SADDLEBOVS", geoTag, geoNode);
074   m_Saddlebovn     = pRDBAccess->getRecordset("SADDLEBOVN", geoTag, geoNode);
075   //  m_Fbrvsbo   = pRDBAccess->getRecordset("FBRVSBO","FBRVSBO-TEST-00");
076   //  m_Fbovstu   = pRDBAccess->getRecordset("FBOVSTU","FBOVSTU-TEST-00");
077   //  m_Fbrvsbr   = pRDBAccess->getRecordset("FBRVSBR","FBRVSBR-TEST-00");
078   //  m_Feboxes   = pRDBAccess->getRecordset("FEBOXES","FEBOXES-TEST-00");
079   //  m_Fetubes   = pRDBAccess->getRecordset("FETUBES","FETUBES-TEST-00");
080   //  m_Febreps   = pRDBAccess->getRecordset("FEBREPS","FEBREPS-TEST-00");
081   //  m_Febrepsxy = pRDBAccess->getRecordset("FEBREPSXY","FEBREPSXY-TEST-00");
082   m_Saddle     = pRDBAccess->getRecordset("SADDLE", geoTag, geoNode);
083   if (m_Saddle->size()*m_Saddlebovp->size()*m_Saddlebovs->size()*m_Saddlebovn->size() == 0)
084     _unavailableData = true;
085   
086   
087   std::string Iron = "Iron";
088   
089   std::string Aluminium = "Alum";
090 
091   MsgStream log( Athena::getMessageSvc(), "MuGM:SaddleBoxesBuilder" );
092   if (!_unavailableData) log << MSG::INFO << "All data fetched with tag <" << geoTag << ">" << endreq;
093   else log << MSG::INFO << "No data found with tag <" << geoTag << ">" << endreq;
094 }
095 
096 void SaddleBoxesBuilder::buildSaddleBoxes( GeoPhysVol* container ) 
097 {
098   //std::cout<<" SaddleBoxBuilder constructor1 "<<std::endl;
099     
100   const StoredMaterialManager*  theMaterialManager;
101   if ( StatusCode::SUCCESS != m_pDetStore->retrieve( theMaterialManager, "MATERIALS" ) ) 
102   {
103     return;
104   } 
105   int n = 0; //need for position of volumes
106   int f = 0; //for tube subtraction
107   int g = 0; //for box subtraction
108   //  double tolerance = 0.5 * mm;
109   
110   int Numboxes  = (int)(*m_Saddle)[0]->getFloat("SADL_NUMBOXES");
111   
112   double  Xposb[100];
113   double  Yposb[100];
114   double  Zposb[100];
115   double Xposgl[100];
116   double Yposgl[100];
117   double Zposgl[100];
118   double   Rotx[100];
119   double   Roty[100];
120   double   Rotz[100];
121   for (int k = 0; k < Numboxes; k++)
122   {
123     //  data from FBOVN  
124     int NumVol    = (int)(*m_Saddlebovn)[k]->getFloat("NUMVOL");
125     int Numembo   = (int)(*m_Saddlebovn)[k]->getFloat("NUMEMBO");
126     int Numemtu   = (int)(*m_Saddlebovn)[k]->getFloat("NUMEMTU");
127     //int Numembr         = (int)(*m_Saddlebovn)[k]->getFloat("NUMEMBR");
128     int SymX      = (int)(*m_Saddlebovn)[k]->getFloat("SYMX");
129     int SymY      = (int)(*m_Saddlebovn)[k]->getFloat("SYMY");
130     int SymZ      = (int)(*m_Saddlebovn)[k]->getFloat("SYMZ");
131     
132     //  data from FBOVS
133     float Dx        = (*m_Saddlebovs)[k]->getFloat("DX") * mm;
134     float Dy      = (*m_Saddlebovs)[k]->getFloat("DY") * mm;
135     float Dz      = (*m_Saddlebovs)[k]->getFloat("DZ") * mm;
136     //std::cout<<" k = "<<k+1<<" out of Numboxes = "<<Numboxes<<" NumVol = "<<NumVol<<std::endl;
137     
138     //    const std::string ExFName        = getName(*m_Efbrvebp->"VOLNAME"); 
139     //    const std::string feetMaterial  = getMaterial(*m_Efbrven, "MATERIAL");
140     const std::string saddleMaterial = getMaterial( "Iron" );
141     //ispul'zui kol-vo ob'emov i vinisi za predeli zikla ->v nachalo
142     //         double Xposb[NumVol + n];
143     //         double Yposb[NumVol + n];
144     //         double Zposb[NumVol + n];
145     //         double Xposgl[NumVol + n];
146     //         double Yposgl[NumVol + n];
147     //         double Zposgl[NumVol + n];
148     //         double Rotx[NumVol + n];
149     //         double Roty[NumVol + n];
150     //         double Rotz[NumVol +n];
151     //std::cout <<" m: "<<m <<std::endl;
152     //creating box volume
153     //-------------------  
154     GeoBox* Box = new GeoBox(Dx/2 , Dy/2, Dz/2);
155     //-------------------  
156   
157     const GeoShape* sBox = &( *Box );
158 
159     //         GeoTube* EmptyTube[Numemtu+f]; HepTransform3D trlEmptyTube[Numemtu+f];
160     //         GeoBox* EmptyBox[Numembo+g]; HepTransform3D trlEmptyBox[Numembo+g];
161 
162     //tubes for subtraction
163     /*  for (int i = f; i < Numemtu + f; i++)
164         {
165         int Whichtube       = (*m_Saddlebovstu)[i]->getFloat("WHICHTUBE");
166         double Rminetube    = (*m_Saddleetubes)[Whichtube]->getFloat("RMIN") * mm;
167         double Rmaxetube    = (*m_Saddleetubes)[Whichtube]->getFloat("RMAX") * mm;
168         double DZetube      = (*m_Saddleetubes)[Whichtube]->getFloat("DZ") * mm;
169         double Alphastart   = (*m_Saddleetubes)[Whichtube]->getFloat("Alphastart") * deg;
170         double Alpha        = (*m_Saddleetubes)[Whichtube]->getFloat("Alpha") * deg;
171         double Xposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("XPOS") * mm;
172         double Yposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("YPOS") * mm;
173         double Zposetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ZPOS") * mm;
174         double RotXetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTX") * deg;
175         double RotYetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTY") * deg;
176         double RotZetube    = (*m_Saddleetubes)[Whichtube]->getFloat("ROTZ") * deg;
177                        
178         EmptyTube[i] = new GeoTube(Rminetube, Rmaxetube, DZetube);
179             
180         trlEmptyTube[i] = HepTranslate3D(Xposetube, Yposetube, Zposetube) * HepRotateY3D(RotYetube)
181         * HepRotateZ3D(RotZetube) * HepRotateX3D(RotXetube);
182 
183         sBox = &( sBox->subtract( (*EmptyTube[i]) << trlEmptyTube[i] ) );
184         }
185     */  
186     f = f + Numemtu;
187   
188     //boxes for subtraction
189     /*  for (int i = g; i < Numembo + g; i++)
190         {
191         int WhichBox            = (*m_Saddlebovsbo)[i]->getFloat("WHICHBOX");
192         double DXembox  = (*m_Saddleeboxes)[WhichBox]->getFloat("DX") * mm;
193         double DYembox        = (*m_Saddleeboxes)[WhichBox]->getFloat("DY") * mm;
194         double DZembox        = (*m_Saddleeboxes)[WhichBox]->getFloat("DZ") * mm;
195         double Xposembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("XPOS") * mm;
196         double Yposembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("YPOS") * mm;
197         double Zposembox      = (*m_Saddeleboxes)[WhichBox]->getFloat("ZPOS") * mm;
198         double RotXembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTX") * deg;
199         double RotYembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTY") * deg;
200         double RotZembox      = (*m_Saddleeboxes)[WhichBox]->getFloat("ROTZ") * deg;
201   
202         EmptyBox[i] = new GeoBox(DXembox/2, DYembox/2, DZembox/2);
203   
204         trlEmptyBox[i] = HepTranslate3D(Xposembox, Yposembox, Zposembox) * HepRotateZ3D(RotZembox)
205         * HepRotateY3D(RotYembox) * HepRotateX3D(RotXembox);
206 
207         sBox = &( sBox->subtract( (*EmptyBox[i]) << trlEmptyBox[i] ) );
208         }
209     */  
210     g = g + Numembo;  
211   
212     for (int j = n; j < NumVol + n; j++)
213     {
214       //std::cout<<"j = "<<j+1<<" out of numvol "<<NumVol+n<<" starting j = n = "<<n<<std::endl;
215       Zposgl[j] = (*m_Saddlebovp)[j]->getFloat("ZPOSGL") * mm;
216       Xposgl[j] = (*m_Saddlebovp)[j]->getFloat("XPOSGL") * mm;
217       Yposgl[j] = (*m_Saddlebovp)[j]->getFloat("YPOSGL") * mm;
218       Zposb[j]  = (*m_Saddlebovp)[j]->getFloat("ZPOSB") * mm;
219       Xposb[j]  = (*m_Saddlebovp)[j]->getFloat("XPOSB") * mm;
220       Yposb[j]  = (*m_Saddlebovp)[j]->getFloat("YPOSB") * mm;
221       Rotx[j]   = (*m_Saddlebovp)[j]->getFloat("ROTX") * deg;
222       Roty[j]   = (*m_Saddlebovp)[j]->getFloat("ROTY") * deg;
223       Rotz[j]   = (*m_Saddlebovp)[j]->getFloat("ROTZ") * deg;
224 
225       //std::cout<<"variables read "<<std::endl;
226         
227       HepTransform3D trlBox = HepTranslate3D(Xposb[j], Yposb[j], 0.) * HepRotateY3D(Roty[j])
228                               * HepRotateZ3D(Rotz[j]) * HepRotateX3D(Rotx[j]);
229     
230       const GeoShape& posBoxPlate = ( *sBox << trlBox );
231     
232       GeoLogVol*  lBoxPlate = new GeoLogVol( "SaddleBoxes",
233                                              &posBoxPlate,
234                                              theMaterialManager->getMaterial(saddleMaterial) );
235       GeoPhysVol* pBoxPlate = new GeoPhysVol(lBoxPlate);
236 
237 
238       //  std::cout<<" SaddleBoxBuilder constructor2 "<<std::endl;
239       //-----------------------------------------------------------------------------------------------------   
240       //  const int nXpos = SymX + 1.;
241       int nXpos = SymX + 1;
242       int nYpos = SymY + 1;
243       int nZpos = SymZ + 1;
244       //std::cout<<"Here nXpos, nYpos, nZpos = "<<nXpos<<" "<<nYpos<<" "<<nZpos<<std::endl;
245 
246       double rotAngleX[2] = { 0, M_PI }; 
247       double xPosBoxPlate[2] = {Xposgl[j], -Xposgl[j]};
248       double rotAngleY[2] = { 0, M_PI }; 
249       double yPosBoxPlate[2] = {Yposgl[j], -Yposgl[j]};
250       double rotAngleZ[2] = { 0, M_PI }; double zPosBoxPlate[2] = {(Zposgl[j] + Zposb[j]), -(Zposgl[j] + Zposb[j])};
251 
252       const int nAllpos = nXpos * nYpos * nZpos;
253       //std::cout<<"nAllpos = "<<nAllpos<<std::endl;
254             
255       //double zPosAux[nAllpos], xPosAux[nAllpos], yPosAux[nAllpos], rotAngleAuxX[nAllpos], rotAngleAuxY[nAllpos], rotAngleAuxZ[nAllpos];
256       double zPosAux[100], xPosAux[100], yPosAux[100], rotAngleAuxX[100], rotAngleAuxY[100], rotAngleAuxZ[100];
257 
258       for ( int w = 0; w < nAllpos; w++ )
259       {
260         //std::cout<<" w = "<<w<<std::endl;
261         int ww = w % (nAllpos / nZpos),
262             ss = w / (nAllpos / nXpos),
263             ee = w / (nAllpos / nYpos);
264         //std::cout <<" ww: "<<ww <<std::endl;
265         //std::cout <<" ss: "<<ss <<std::endl;
266         //std::cout <<" ee: "<<ee <<std::endl;
267         //std::cout<<" ww, ss, ee = "<<ww<<" "<<ss<<" "<<ee<<std::endl;
268         zPosAux[w]     = zPosBoxPlate[ww];
269         //          std::cout <<" ZPosAux: "<<zPosAux[w] <<std::endl;
270         xPosAux[w]     = xPosBoxPlate[ss];
271         //std::cout <<" XPosAux: "<<xPosAux[w] <<std::endl;
272         yPosAux[w]     = yPosBoxPlate[ee];
273         //std::cout <<" YPosAux: "<<yPosAux[w] <<std::endl;
274         rotAngleAuxX[w] = rotAngleX[ss];
275         //          std::cout <<" rotAngleAuxX: "<<rotAngleAuxX[w] <<std::endl;
276         rotAngleAuxY[w] = rotAngleY[ee];
277         //          std::cout <<" rotAngleAuxY: "<<rotAngleAuxY[w] <<std::endl;
278         rotAngleAuxZ[w] = rotAngleZ[ss];
279         //          std::cout <<" rotAngleAuxZ: "<<rotAngleAuxZ[w] <<std::endl;
280       }
281 
282       GENFUNCTION fRotX = ArrayFunction( rotAngleAuxX, rotAngleAuxX + nAllpos );
283       GENFUNCTION fTrlX = ArrayFunction( xPosAux, xPosAux + nAllpos );// + nXpos * NumVol );
284       GENFUNCTION fRotY = ArrayFunction( rotAngleAuxY, rotAngleAuxY );
285       GENFUNCTION fTrlY = ArrayFunction( yPosAux, yPosAux + nAllpos );
286       GENFUNCTION fRotZ = ArrayFunction( rotAngleAuxZ, rotAngleAuxZ +  nAllpos );
287       GENFUNCTION fTrlZ = ArrayFunction( zPosAux, zPosAux +  nAllpos );
288 
289       TRANSFUNCTION XFBoxPlate   = Pow( HepTranslateX3D(1.0), fTrlX ) *
290                                    Pow( HepTranslateY3D(1.0), fTrlY ) *                           
291                                    Pow( HepTranslateZ3D(1.0), fTrlZ ) * 
292                                    Pow( HepRotateX3D(1.0), fRotX ) *
293                                    Pow( HepRotateY3D(1.0), fRotY ) *
294                                    Pow( HepRotateZ3D(1.0), fRotZ );
295 
296       //std::cout<<"Do we come here ??? "<<std::endl;
297       GeoSerialTransformer* sxBoxPlate = new GeoSerialTransformer( pBoxPlate,
298                                                                    &XFBoxPlate,
299                                                                    nAllpos );
300 
301 
302       container->add(sxBoxPlate);
303       //std::cout<<"Do we come there ??? "<<std::endl;
304     }
305       
306     n = n + NumVol;      
307     NumVol = 0;
308     //std::cout<<" TEto konez progi sd"<<std::endl;
309   }
310 }
311     
312 std::string SaddleBoxesBuilder::getMaterial( std::string materialName ) 
313 {
314   MsgStream log(Athena::getMessageSvc(), "MuonGeoModel");
315   if ( materialName == "Alum" )
316   {
317     return "std::Aluminium";
318   }
319   else if ( materialName == "Iron" )  
320   {
321     return "std::Iron";
322   }  
323   else if ( materialName == "Fe50"  ||  materialName == "Al67" )   
324   {
325     return "toro::" + materialName;
326   }
327   else 
328   {
329     log  <<  " SaddleBoxesBuilder::getMaterial: material "  <<  materialName  
330          <<  " not defined! "
331          <<  " Take Aluminium instead."
332          <<  endreq;
333     return "std::Aluminium";           
334   }  
335 }  
336 
337 } // namespace MuonGM
338 

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!