BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeoMgr.cxx
Go to the documentation of this file.
1//------------------------------------------------------------------------------|
2// [File ]: MucGeoMgr.cxx |
3// [Brief ]: MUC geometry created manager class |
4// [Author]: Xie Yuguang, <ygxie@mail.ihep.ac.cn> |
5// [Date ]: Mar 28, 2006 |
6//------------------------------------------------------------------------------|
7
8#include <fstream>
9#include <iostream>
10#include <string>
11
12#include "GaudiKernel/Bootstrap.h"
13#include "GaudiKernel/ISvcLocator.h"
14#include "GaudiKernel/MsgStream.h"
15
16#include "TFile.h"
17#include "TH1F.h"
18#include "TTree.h"
19
22
23using namespace std;
24
25// Constructor
26MucGeoMgr::MucGeoMgr( const std::string createFlag, bool alignFlag,
27 const std::string alignFile ) {
28 m_CreateFlag = createFlag;
29 m_AlignFlag = alignFlag;
30 m_AlignFile = alignFile;
31
32 Gaudi::svcLocator()->service( "MessageSvc", msgSvc );
33
34 InitOffset();
35}
36
37// Destructor
39 delete[] m_BoxOffset;
40 delete[] m_StripPlaneOffset;
41
42 delete m_MucAbsorber;
43 delete m_MucGap;
44 delete m_MucBox;
45 delete m_MucStripPlane;
46 delete m_MucStrip;
47 delete m_MucRpc;
48 delete m_MucGas;
49 delete m_MucBakelite;
50 delete m_MucBoxCover;
51}
52
53//========================================= Alignment
54//initialization==================================================
55// Offset init
57 MsgStream log( msgSvc, "MucGeoMgr" );
58
59 m_IdTr = new MucIdTransform();
60
61 if ( m_AlignFlag == true )
62 {
63 log << MSG::INFO << "MucGeoMgr::initOffset()" << endmsg;
64
65 TFile* froot = new TFile( m_AlignFile.c_str(), "read" );
66 if ( froot->IsZombie() )
67 {
68 log << MSG::ERROR << "Open alignment data error!" << endmsg;
69 return StatusCode::FAILURE;
70 }
71
72 const char OFFSET_NAME[3][5] = { "dx", "dy", "dz" };
73 double box_offset[3];
74 double strpln_offset[3];
75
76 TTree* tr_Offset;
77
78 tr_Offset = (TTree*)froot->Get( "Offset" );
79 tr_Offset->SetBranchAddress( "box_dx", &box_offset[0] );
80 tr_Offset->SetBranchAddress( "box_dy", &box_offset[1] );
81 tr_Offset->SetBranchAddress( "box_dz", &box_offset[2] );
82 tr_Offset->SetBranchAddress( "strpln_dx", &strpln_offset[0] );
83 tr_Offset->SetBranchAddress( "strpln_dy", &strpln_offset[1] );
84 tr_Offset->SetBranchAddress( "strpln_dz", &strpln_offset[2] );
85
86 int part, segment, layer;
87 part = segment = layer = 0;
88
89 log << MSG::INFO << "------------------------- offset data--------------------------"
90 << endmsg;
91 log << MSG::INFO << "Part\tSegment\tLayer\tdx0\tdy0\tdz0\tdx1\tdy1\tdz1" << endmsg;
92 for ( int i = 0; i < BOX_MAX; i++ )
93 {
94 m_IdTr->SetBoxPos( i, &part, &segment, &layer );
95 tr_Offset->GetEntry( i );
96
97 log << MSG::INFO << part << "\t" << segment << "\t" << layer << "\t";
98 for ( int j = 0; j < 3; j++ )
99 {
100 log << MSG::INFO << box_offset[j] << "\t";
101 if ( !CheckBoxOffset( part, segment, layer, j, box_offset[j] ) )
102 {
103 log << MSG::INFO << endmsg << "Box offset P" << part << "S" << segment << "L"
104 << layer << "_" << OFFSET_NAME[j] << "\tout range!" << endmsg;
105 box_offset[j] = B_X_MAX[j];
106 }
107 }
108
109 for ( int j = 0; j < 3; j++ )
110 {
111 log << MSG::INFO << strpln_offset[j] << "\t";
112 if ( !CheckStripPlaneOffset( part, segment, layer, j, strpln_offset[j] ) )
113 {
114 log << MSG::INFO << endmsg << "Strip plane offset P" << part << "S" << segment << "L"
115 << layer << "_" << OFFSET_NAME[j] << "\tout range!" << endmsg;
116 strpln_offset[j] = STR_OFFSET_MAX[j];
117 }
118 }
119
120 log << MSG::INFO << endmsg;
121 } // end box
122
123 froot->Close();
124 log << MSG::INFO << "---------------------------------------------------------------"
125 << endmsg;
126 } // end alignflag
127 else
128 {
129 for ( int i = 0; i < PART_MAX; i++ )
130 for ( int j = 0; j < B_SEG_NUM; j++ )
131 for ( int k = 0; k < B_LAY_NUM; k++ )
132 for ( int m = 0; m < 3; m++ )
133 {
134 m_BoxOffset[i][j][k][m] = 0.0;
135 m_StripPlaneOffset[i][j][k][m] = 0.0;
136 }
137 }
138
139 return StatusCode::SUCCESS;
140}
141
142bool MucGeoMgr::CheckBoxOffset( int part, int segment, int layer, int axis, double offset ) {
143 int outRangeFlag = 0;
144
145 if ( part == BRID )
146 {
147 switch ( axis )
148 {
149 case 0: // x
150 int layerFlag;
151 if ( layer == 0 ) layerFlag = 0;
152 else if ( layer % 2 == 1 ) layerFlag = 1;
153 else layerFlag = 2;
154
155 if ( B_X_MAX[layerFlag] - fabs( offset ) >= 0.0 ) // |offset|<=B_X_MAX
156 m_BoxOffset[part][segment][layer][axis] = offset;
157 else
158 {
159 outRangeFlag++;
160 m_BoxOffset[part][segment][layer][axis] = B_X_MAX[layerFlag] * MAX_FRACTION;
161 }
162 break;
163 case 1: // y
164 if ( B_Y_MAX - fabs( offset ) >= 0.0 ) // |offset|<=B_Y_MAX
165 m_BoxOffset[part][segment][layer][axis] = offset;
166 else
167 {
168 outRangeFlag++;
169 m_BoxOffset[part][segment][layer][axis] = B_Y_MAX * MAX_FRACTION;
170 }
171 break;
172 case 2: // z
173 if ( B_Z_MAX - fabs( offset ) >= 0.0 ) // |offset|<=B_Y_MAX
174 m_BoxOffset[part][segment][layer][axis] = offset;
175 else
176 {
177 outRangeFlag++;
178 m_BoxOffset[part][segment][layer][axis] = B_Z_MAX * MAX_FRACTION;
179 }
180 break;
181 default:;
182 }
183 } // End barrel
184 else
185 {
186 if ( E_OFFSET_MAX[axis] - fabs( offset ) >= 0.0 ) // |offset|<=B_Y_MAX
187 m_BoxOffset[part][segment][layer][axis] = offset;
188 else
189 {
190 outRangeFlag++;
191 m_BoxOffset[part][segment][layer][axis] = E_OFFSET_MAX[axis] * MAX_FRACTION;
192 }
193 }
194
195 if ( outRangeFlag > 0 ) return false;
196 else return true;
197}
198
199bool MucGeoMgr::CheckStripPlaneOffset( int part, int segment, int layer, int axis,
200 double offset ) {
201 int outRangeFlag = 0;
202
203 if ( STR_OFFSET_MAX[axis] - fabs( offset ) >= 0.0 ) // |offset|<=STR_OFFSET_MAX
204 m_StripPlaneOffset[part][segment][layer][axis] = offset;
205 else
206 {
207 outRangeFlag++;
208 m_StripPlaneOffset[part][segment][layer][axis] = STR_OFFSET_MAX[axis] * MAX_FRACTION;
209 }
210
211 if ( outRangeFlag > 0 ) return false;
212 else return true;
213}
214
215//====================================== Geometry entities creating
216//methods=============================================
217//
218//------------------------------------------Total data of all entities
219//-------------------------------------------------
221 MsgStream log( msgSvc, "MucGeoMgr" );
222
223 StatusCode sc;
224
225 if ( m_CreateFlag.size() < ENTITY_NUM )
226 {
227 for ( unsigned int i = m_CreateFlag.size(); i < ENTITY_NUM; i++ ) m_CreateFlag += '0';
228 }
229
230 int entity = 0;
231 for ( unsigned int i = 0; i < ENTITY_NUM; i++ )
232 if ( m_CreateFlag[i] == '1' ) entity++;
233 log << MSG::INFO << entity << "\tentities should be created." << endmsg << endmsg;
234
235 if ( m_CreateFlag[0] == '1' )
236 {
237 sc = CreateAbsorber();
238 if ( sc == StatusCode::SUCCESS )
239 log << MSG::INFO << "Create absorber successfully!" << endmsg << endmsg;
240 else log << MSG::INFO << "Create absorber failure!" << endmsg << endmsg;
241 }
242
243 if ( m_CreateFlag[1] == '1' )
244 {
245 sc = CreateGap();
246 if ( sc == StatusCode::SUCCESS )
247 log << MSG::INFO << "Create gap successfully!" << endmsg << endmsg;
248 else log << MSG::INFO << "Create gap failure!" << endmsg << endmsg;
249 }
250
251 if ( m_CreateFlag[2] == '1' )
252 {
253 sc = CreateBox();
254 if ( sc == StatusCode::SUCCESS )
255 log << MSG::INFO << "Create box successfully!" << endmsg << endmsg;
256 else log << MSG::INFO << "Create box failure!" << endmsg << endmsg;
257 }
258
259 if ( m_CreateFlag[3] == '1' )
260 {
261 sc = CreateStripPlane();
262 if ( sc == StatusCode::SUCCESS )
263 log << MSG::INFO << "Create strip_plane successfully!" << endmsg << endmsg;
264 else log << MSG::INFO << "Create strip_plane failure!" << endmsg << endmsg;
265 }
266
267 if ( m_CreateFlag[4] == '1' )
268 {
269 sc = CreateStrip();
270 if ( sc == StatusCode::SUCCESS )
271 log << MSG::INFO << "Create strip successfully!" << endmsg << endmsg;
272 else log << MSG::INFO << "Create strip failure!" << endmsg << endmsg;
273 }
274
275 if ( m_CreateFlag[5] == '1' )
276 {
277 sc = CreateRpc();
278 if ( sc == StatusCode::SUCCESS )
279 log << MSG::INFO << "Create RPC successfully!" << endmsg << endmsg;
280 else log << MSG::INFO << "Create RPC failure!" << endmsg << endmsg;
281 }
282
283 if ( m_CreateFlag[6] == '1' )
284 {
285 sc = CreateGas();
286 if ( sc == StatusCode::SUCCESS )
287 log << MSG::INFO << "Create gas mixture successfully!" << endmsg << endmsg;
288 else log << MSG::INFO << "Create gas mixture failure!" << endmsg << endmsg;
289 }
290
291 if ( m_CreateFlag[7] == '1' )
292 {
293 sc = CreateBakelite();
294 if ( sc == StatusCode::SUCCESS )
295 log << MSG::INFO << "Create bakelite successfully!" << endmsg << endmsg;
296 else log << MSG::INFO << "Create bakelite failure!" << endmsg << endmsg;
297 }
298
299 if ( m_CreateFlag[8] == '1' )
300 {
301 sc = CreateBoxCover();
302 if ( sc == StatusCode::SUCCESS )
303 log << MSG::INFO << "Create box cover successfully!" << endmsg << endmsg;
304 else log << MSG::INFO << "Create box cover failure!" << endmsg << endmsg;
305 }
306
307 return StatusCode::SUCCESS;
308}
309
310//------------------------------------ROOT
311//geometry-----------------------------------------------
313 MsgStream log( msgSvc, "MucGeoMgr" );
314 // StatusCode sc;
315
316 return StatusCode::SUCCESS;
317}
318
319//------------------------------------Strip geometry for online
320//display----------------------------
322 MsgStream log( msgSvc, "MucGeoMgr" );
323 // StatusCode sc;
324
325 //-------------------------- ideal geometry----------------------
326 ofstream fEast( "EastEndStripGeo.dat", ios::out );
327 ofstream fBarrel( "BarrelStripGeo.dat", ios::out );
328 ofstream fWest( "WestEndStripGeo.dat", ios::out );
329
330 if ( fEast.bad() || fBarrel.bad() || fWest.bad() )
331 {
332 log << MSG::INFO << "Strip: create ouput file error!" << endl;
333 return StatusCode::FAILURE;
334 }
335
336 for ( int i = 0; i < PART_MAX; i++ )
337 {
338 if ( i == BRID )
339 {
340 for ( int j = 0; j < B_SEG_NUM; j++ )
341 {
342 for ( int k = 0; k < B_LAY_NUM; k++ )
343 {
344 // Set maximum strip
345 int maxStrip;
346 if ( ( k + 1 ) % 2 == 1 ) maxStrip = B_ZSTR_NUM; // odd layer
347 else if ( j != B_TOP ) maxStrip = B_PHISTR_NUM; // even layer not top segment
348 else maxStrip = B_TOPSTR_NUM; // even layer top segment
349
350 for ( int n = 0; n < maxStrip; n++ )
351 {
352 MucStrip* aMucStrip = new MucStrip( i, j, k, n );
353 fBarrel << i << "\t" << j << "\t" << k << "\t" << n << "\t"
354 << aMucStrip->GetType() - 2 << "\t" << aMucStrip->GetL() << "\t"
355 << aMucStrip->GetW() << "\t" << aMucStrip->GetH() << "\t"
356 << aMucStrip->GetObjOrgInBes( 1 ) << "\t" << aMucStrip->GetObjOrgInBes( 2 )
357 << "\t" << aMucStrip->GetObjOrgInBes( 3 ) << "\t" << endl;
358 // delete aMucStrip;
359 } // strip
360 } // layer
361 } // segment
362 } // barrel
363 else if ( i == EEID )
364 {
365 for ( int j = 0; j < E_SEG_NUM; j++ )
366 {
367 for ( int k = 0; k < E_LAY_NUM; k++ )
368 {
369 for ( int n = 0; n < E_STR_NUM; n++ )
370 {
371 MucStrip* aMucStrip = new MucStrip( i, j, k, n );
372 fEast << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
373 << "\t" << aMucStrip->GetL() << "\t" << aMucStrip->GetW() << "\t"
374 << aMucStrip->GetH() << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
375 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
376 << "\t" << endl;
377 // delete aMucStrip;
378 } // strip
379 } // layer
380 } // segment
381 } // east endcap
382 else
383 {
384 for ( int j = 0; j < E_SEG_NUM; j++ )
385 {
386 for ( int k = 0; k < E_LAY_NUM; k++ )
387 {
388 for ( int n = 0; n < E_STR_NUM; n++ )
389 {
390 MucStrip* aMucStrip = new MucStrip( i, j, k, n );
391 fWest << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
392 << "\t" << aMucStrip->GetL() << "\t" << aMucStrip->GetW() << "\t"
393 << aMucStrip->GetH() << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
394 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
395 << "\t" << endl;
396 // delete aMucStrip;
397 } // strip
398 } // layer
399 } // segment
400 } // west endcap
401
402 } // part
403
404 fEast.close();
405 fBarrel.close();
406 fWest.close();
407
408 log << MSG::INFO << "Online display strips created." << endmsg;
409 return StatusCode::SUCCESS;
410}
411
412///////////////////////////////////////////////////////////////////////////////////////////////
413// Sub funtions //
414///////////////////////////////////////////////////////////////////////////////////////////////
415//------------------MucAbsorber-------------
416// No alignment
418 MsgStream log( msgSvc, "MucGeoMgr" );
419
420 ofstream fOrigin( "MucAbsorberOrigin.dat", ios::out );
421 ofstream fPanel( "MucAbsorberPanel.dat", ios::out );
422 ofstream fPos( "MucAbsorberPanelPos.dat", ios::out );
423
424 if ( fOrigin.bad() || fPanel.bad() || fPos.bad() )
425 {
426 log << MSG::INFO << "Absorber: create ouput file error!" << endmsg;
427 return StatusCode::FAILURE;
428 }
429 fOrigin << "part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
430 fPanel << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
431 fPos << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_"
432 "x\tLoc_y\tLoc_z"
433 << endl;
434
435 int totalObject = 0;
436
437 for ( int i = 0; i < PART_MAX; i++ )
438 {
439 if ( i == BRID )
440 {
441 for ( int j = 0; j < B_SEG_NUM; j++ )
442 {
443 for ( int k = 0; k < B_LAY_NUM; k++ )
444 {
445 for ( int n = 0; n < B_AS_NUM; n++ )
446 {
447 MucAbsorber* aMucAbsorber = new MucAbsorber( i, j, k, n );
448 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucAbsorber->GetW() << "\t"
449 << aMucAbsorber->GetH() << "\t" << aMucAbsorber->GetL() << "\t"
450 << aMucAbsorber->GetLocOrgInBes( 1 ) << "\t"
451 << aMucAbsorber->GetLocOrgInBes( 2 ) << "\t"
452 << aMucAbsorber->GetLocOrgInBes( 3 ) << "\t"
453 << aMucAbsorber->GetObjRotToMot( 1 ) << "\t"
454 << aMucAbsorber->GetObjRotToMot( 2 ) << "\t"
455 << aMucAbsorber->GetObjRotToMot( 3 ) << "\t" << endl;
456 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucAbsorber->GetWu()
457 << "\t" << aMucAbsorber->GetWd() << "\t" << aMucAbsorber->GetH() << "\t"
458 << aMucAbsorber->GetL() << "\t" << aMucAbsorber->GetObjOrgInLoc( 1 ) << "\t"
459 << aMucAbsorber->GetObjOrgInLoc( 2 ) << "\t"
460 << aMucAbsorber->GetObjOrgInLoc( 3 ) << "\t" << endl;
461 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
462 << aMucAbsorber->GetLocOrgInBes( 1 ) << "\t"
463 << aMucAbsorber->GetLocOrgInBes( 2 ) << "\t"
464 << aMucAbsorber->GetLocOrgInBes( 3 ) << "\t"
465 << aMucAbsorber->GetObjOrgInBes( 1 ) << "\t"
466 << aMucAbsorber->GetObjOrgInBes( 2 ) << "\t"
467 << aMucAbsorber->GetObjOrgInBes( 3 ) << "\t"
468 << aMucAbsorber->GetObjOrgInLoc( 1 ) << "\t"
469 << aMucAbsorber->GetObjOrgInLoc( 2 ) << "\t"
470 << aMucAbsorber->GetObjOrgInLoc( 3 ) << "\t" << endl;
471
472 totalObject++;
473 // delete aMucAbsorber;
474 } // panel
475 } // layer
476 } // segment
477 } // barrel
478 else
479 {
480 for ( int j = 0; j < E_SEG_NUM; j++ )
481 {
482 for ( int k = 0; k < E_ASLAY_NUM; k++ )
483 {
484 for ( int n = -1; n < E_PANEL_NUM; n++ )
485 {
486 MucAbsorber* aMucAbsorber = new MucAbsorber( i, j, k, n );
487 if ( n == -1 )
488 {
489 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucAbsorber->GetW() << "\t"
490 << aMucAbsorber->GetH() << "\t" << aMucAbsorber->GetL() << "\t"
491 << aMucAbsorber->GetLocOrgInBes( 1 ) << "\t"
492 << aMucAbsorber->GetLocOrgInBes( 2 ) << "\t"
493 << aMucAbsorber->GetLocOrgInBes( 3 ) << "\t"
494 << aMucAbsorber->GetObjRotToMot( 1 ) << "\t"
495 << aMucAbsorber->GetObjRotToMot( 2 ) << "\t"
496 << aMucAbsorber->GetObjRotToMot( 3 ) << "\t" << endl;
497
498 totalObject++;
499 // delete aMucAbsorber;
500 }
501 else
502 {
503 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t"
504 << aMucAbsorber->GetWu() << "\t" << aMucAbsorber->GetWd() << "\t"
505 << aMucAbsorber->GetH() << "\t" << aMucAbsorber->GetL() << "\t"
506 << aMucAbsorber->GetObjOrgInLoc( 1 ) << "\t"
507 << aMucAbsorber->GetObjOrgInLoc( 2 ) << "\t"
508 << aMucAbsorber->GetObjOrgInLoc( 3 ) << "\t" << endl;
509
510 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
511 << aMucAbsorber->GetLocOrgInBes( 1 ) << "\t"
512 << aMucAbsorber->GetLocOrgInBes( 2 ) << "\t"
513 << aMucAbsorber->GetLocOrgInBes( 3 ) << "\t"
514 << aMucAbsorber->GetObjOrgInBes( 1 ) << "\t"
515 << aMucAbsorber->GetObjOrgInBes( 2 ) << "\t"
516 << aMucAbsorber->GetObjOrgInBes( 3 ) << "\t"
517 << aMucAbsorber->GetObjOrgInLoc( 1 ) << "\t"
518 << aMucAbsorber->GetObjOrgInLoc( 2 ) << "\t"
519 << aMucAbsorber->GetObjOrgInLoc( 3 ) << "\t" << endl;
520 // delete aMucAbsorber;
521 }
522 } // panel
523 } // layer
524 } // segment
525 } // endcap
526 } // part
527
528 fOrigin.close();
529 fPanel.close();
530 fPos.close();
531
532 log << MSG::INFO << totalObject << "\tabsorbers created." << endmsg;
533
534 return StatusCode::SUCCESS;
535} // MucAbsorber
536
537//------------------MucGap-------------
538// No alignment
540 MsgStream log( msgSvc, "MucGeoMgr" );
541
542 ofstream fOrigin( "MucGapOrigin.dat", ios::out );
543 ofstream fPanel( "MucGapPanel.dat", ios::out );
544 ofstream fPos( "MucGapPanelPos.dat", ios::out );
545
546 if ( fOrigin.bad() || fPanel.bad() || fPos.bad() )
547 {
548 log << MSG::INFO << "Gap: create ouput file error!" << endmsg;
549 return StatusCode::FAILURE;
550 }
551 fOrigin << "part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
552 fPanel << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
553 fPos << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_"
554 "x\tLoc_y\tLoc_z"
555 << endl;
556
557 int totalObject = 0;
558
559 for ( int i = 0; i < PART_MAX; i++ )
560 {
561 if ( i == BRID )
562 {
563 for ( int j = 0; j < B_SEG_NUM; j++ )
564 {
565 // set panel number
566 int idMin, idMax;
567 if ( j != B_TOP )
568 {
569 idMin = 0;
570 idMax = B_GP_NUM;
571 }
572 else
573 {
574 idMin = -1;
575 idMax = 3;
576 }
577
578 for ( int k = 0; k < B_LAY_NUM; k++ )
579 {
580 for ( int n = idMin; n < idMax; n++ )
581 {
582 MucGap* aMucGap = new MucGap( i, j, k, n );
583 if ( j == B_TOP && n != -1 ) // barrel top segment panels
584 {
585 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucGap->GetWu()
586 << "\t" << aMucGap->GetWd() << "\t" << aMucGap->GetH() << "\t"
587 << aMucGap->GetL() << "\t" << aMucGap->GetObjOrgInLoc( 1 ) << "\t"
588 << aMucGap->GetObjOrgInLoc( 2 ) << "\t" << aMucGap->GetObjOrgInLoc( 3 )
589 << "\t" << endl;
590 }
591
592 if ( j != B_TOP || n == -1 )
593 {
594 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucGap->GetW() << "\t"
595 << aMucGap->GetH() << "\t" << aMucGap->GetL() << "\t"
596 << aMucGap->GetLocOrgInBes( 1 ) << "\t" << aMucGap->GetLocOrgInBes( 2 )
597 << "\t" << aMucGap->GetLocOrgInBes( 3 ) << "\t"
598 << aMucGap->GetObjRotToMot( 1 ) << "\t" << aMucGap->GetObjRotToMot( 2 )
599 << "\t" << aMucGap->GetObjRotToMot( 3 ) << "\t" << endl;
600
601 totalObject++;
602 // delete aMucGap;
603 }
604
605 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
606 << aMucGap->GetLocOrgInBes( 1 ) << "\t" << aMucGap->GetLocOrgInBes( 2 )
607 << "\t" << aMucGap->GetLocOrgInBes( 3 ) << "\t"
608 << aMucGap->GetObjOrgInBes( 1 ) << "\t" << aMucGap->GetObjOrgInBes( 2 )
609 << "\t" << aMucGap->GetObjOrgInBes( 3 ) << "\t"
610 << aMucGap->GetObjOrgInLoc( 1 ) << "\t" << aMucGap->GetObjOrgInLoc( 2 )
611 << "\t" << aMucGap->GetObjOrgInLoc( 3 ) << "\t" << endl;
612 } // panel
613 } // layer
614 } // segment
615 } // barrel
616 else
617 {
618 for ( int j = 0; j < E_SEG_NUM; j++ )
619 {
620 for ( int k = 0; k < E_LAY_NUM; k++ )
621 {
622 for ( int n = -1; n < E_PANEL_NUM; n++ )
623 {
624 MucGap* aMucGap = new MucGap( i, j, k, n );
625 if ( n == -1 )
626 {
627 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucGap->GetW() << "\t"
628 << aMucGap->GetH() << "\t" << aMucGap->GetL() << "\t"
629 << aMucGap->GetLocOrgInBes( 1 ) << "\t" << aMucGap->GetLocOrgInBes( 2 )
630 << "\t" << aMucGap->GetLocOrgInBes( 3 ) << "\t"
631 << aMucGap->GetObjRotToMot( 1 ) << "\t" << aMucGap->GetObjRotToMot( 2 )
632 << "\t" << aMucGap->GetObjRotToMot( 3 ) << "\t" << endl;
633
634 totalObject++;
635 }
636 else
637 {
638 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucGap->GetWu()
639 << "\t" << aMucGap->GetWd() << "\t" << aMucGap->GetH() << "\t"
640 << aMucGap->GetL() << "\t" << aMucGap->GetObjOrgInLoc( 1 ) << "\t"
641 << aMucGap->GetObjOrgInLoc( 2 ) << "\t" << aMucGap->GetObjOrgInLoc( 3 )
642 << "\t" << endl;
643
644 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
645 << aMucGap->GetLocOrgInBes( 1 ) << "\t" << aMucGap->GetLocOrgInBes( 2 )
646 << "\t" << aMucGap->GetLocOrgInBes( 3 ) << "\t"
647 << aMucGap->GetObjOrgInBes( 1 ) << "\t" << aMucGap->GetObjOrgInBes( 2 )
648 << "\t" << aMucGap->GetObjOrgInBes( 3 ) << "\t"
649 << aMucGap->GetObjOrgInLoc( 1 ) << "\t" << aMucGap->GetObjOrgInLoc( 2 )
650 << "\t" << aMucGap->GetObjOrgInLoc( 3 ) << "\t" << endl;
651 // delete aMucGap;
652 }
653 } // panel
654 } // layer
655 } // segment
656 } // endcap
657 } // for
658
659 fOrigin.close();
660 fPanel.close();
661 fPos.close();
662
663 log << MSG::INFO << totalObject << "\tgaps created." << endmsg;
664 return StatusCode::SUCCESS;
665
666} // MucGap
667
668//------------------MucBox-------------
669// Alignment
671 MsgStream log( msgSvc, "MucGeoMgr" );
672
673 //-------------------------- ideal geometry----------------------
674 ofstream fOrigin( "MucBoxOrigin.dat", ios::out );
675 ofstream fPanel( "MucBoxPanel.dat", ios::out );
676 ofstream fPos( "MucBoxPanelPos.dat", ios::out );
677
678 if ( fOrigin.bad() || fPanel.bad() || fPos.bad() )
679 {
680 log << MSG::INFO << "Box: create ouput file error!" << endl;
681 return StatusCode::FAILURE;
682 }
683 fOrigin << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
684 fPanel << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
685 fPos << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_"
686 "x\tLoc_y\tLoc_z"
687 << endl;
688
689 int totalObject = 0;
690 for ( int i = 0; i < PART_MAX; i++ )
691 {
692 if ( i == BRID )
693 {
694 for ( int j = 0; j < B_SEG_NUM; j++ )
695 {
696 // set panel number
697 int idMin, idMax;
698 if ( j != B_TOP )
699 {
700 idMin = 0;
701 idMax = B_GP_NUM;
702 }
703 else
704 {
705 idMin = -1;
706 idMax = 3;
707 }
708
709 for ( int k = 0; k < B_LAY_NUM; k++ )
710 {
711 for ( int n = idMin; n < idMax; n++ )
712 {
713 MucBox* aMucBox = new MucBox( i, j, k, n );
714 if ( j == B_TOP && n != -1 ) // barrel top segment panels
715 {
716 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucBox->GetWu()
717 << "\t" << aMucBox->GetWd() << "\t" << aMucBox->GetH() << "\t"
718 << aMucBox->GetL() << "\t" << aMucBox->GetObjOrgInLoc( 1 ) << "\t"
719 << aMucBox->GetObjOrgInLoc( 2 ) << "\t" << aMucBox->GetObjOrgInLoc( 3 )
720 << "\t" << endl;
721 }
722
723 if ( j != B_TOP || n == -1 ) // box
724 {
725 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucBox->GetW() << "\t"
726 << aMucBox->GetH() << "\t" << aMucBox->GetL() << "\t"
727 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
728 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
729
730 totalObject++;
731 // delete aMucBox;
732 }
733
734 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
735 << aMucBox->GetLocOrgInBes( 1 ) << "\t" << aMucBox->GetLocOrgInBes( 2 )
736 << "\t" << aMucBox->GetLocOrgInBes( 3 ) << "\t"
737 << aMucBox->GetObjOrgInBes( 1 ) << "\t" << aMucBox->GetObjOrgInBes( 2 )
738 << "\t" << aMucBox->GetObjOrgInBes( 3 ) << "\t"
739 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
740 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
741 // delete aMucBox;
742 } // panel
743 } // layer
744 } // segment
745 } // barrel
746 else
747 {
748 for ( int j = 0; j < E_SEG_NUM; j++ )
749 {
750 for ( int k = 0; k < E_LAY_NUM; k++ )
751 {
752 for ( int n = -1; n < E_PANEL_NUM; n++ )
753 {
754 MucBox* aMucBox = new MucBox( i, j, k, n );
755 if ( n == -1 )
756 {
757 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucBox->GetW() << "\t"
758 << aMucBox->GetH() << "\t" << aMucBox->GetL() << "\t"
759 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
760 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
761
762 totalObject++;
763 // delete aMucBox;
764 }
765 else
766 {
767 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucBox->GetWu()
768 << "\t" << aMucBox->GetWd() << "\t" << aMucBox->GetH() << "\t"
769 << aMucBox->GetL() << "\t" << aMucBox->GetObjOrgInLoc( 1 ) << "\t"
770 << aMucBox->GetObjOrgInLoc( 2 ) << "\t" << aMucBox->GetObjOrgInLoc( 3 )
771 << "\t" << endl;
772 // delete aMucBox;
773 }
774
775 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
776 << aMucBox->GetLocOrgInBes( 1 ) << "\t" << aMucBox->GetLocOrgInBes( 2 )
777 << "\t" << aMucBox->GetLocOrgInBes( 3 ) << "\t"
778 << aMucBox->GetObjOrgInBes( 1 ) << "\t" << aMucBox->GetObjOrgInBes( 2 )
779 << "\t" << aMucBox->GetObjOrgInBes( 3 ) << "\t"
780 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
781 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
782 // delete aMucBox;
783 }
784 } // layer
785 } // segment
786 } // endcap
787 } // for
788
789 fOrigin.close();
790 fPanel.close();
791 fPos.close();
792
793 //-----------------------------real geometry-------------------------
794 if ( m_AlignFlag )
795 {
796 ofstream fOrgAlign( "MucBoxOriginAligned.dat", ios::out );
797 fOrgAlign << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
798 double offset[3];
799 for ( int i = 0; i < PART_MAX; i++ )
800 {
801 if ( i == BRID )
802 {
803 for ( int j = 0; j < B_SEG_NUM; j++ )
804 {
805 for ( int k = 0; k < B_LAY_NUM; k++ )
806 {
807 MucBox* aMucBox = new MucBox( i, j, k, ( ( j == B_TOP ) ? -1 : 0 ) );
808 offset[0] = m_BoxOffset[i][j][k][0];
809 offset[1] = m_BoxOffset[i][j][k][1];
810 offset[2] = m_BoxOffset[i][j][k][2];
811 aMucBox->SetAlignment( offset[0], offset[1], offset[2] );
812
813 fOrgAlign << i << "\t" << j << "\t" << k << "\t" << aMucBox->GetW() << "\t"
814 << aMucBox->GetH() << "\t" << aMucBox->GetL() << "\t"
815 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
816 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
817 // delete aMucBox;
818 } // layer
819 } // segment
820 } // barrel
821 else
822 {
823 for ( int j = 0; j < E_SEG_NUM; j++ )
824 {
825 for ( int k = 0; k < E_LAY_NUM; k++ )
826 {
827 MucBox* aMucBox = new MucBox( i, j, k, -1 );
828 offset[0] = m_BoxOffset[i][j][k][0];
829 offset[1] = m_BoxOffset[i][j][k][1];
830 offset[2] = m_BoxOffset[i][j][k][2];
831 aMucBox->SetAlignment( offset[0], offset[1], offset[2] );
832
833 fOrgAlign << i << "\t" << j << "\t" << k << "\t" << aMucBox->GetW() << "\t"
834 << aMucBox->GetH() << "\t" << aMucBox->GetL() << "\t"
835 << aMucBox->GetObjOrgInLoc( 1 ) << "\t" << aMucBox->GetObjOrgInLoc( 2 )
836 << "\t" << aMucBox->GetObjOrgInLoc( 3 ) << "\t" << endl;
837 // delete aMucBox;
838 } // layer
839 } // segment
840 } // endcap
841 } // part
842
843 fOrgAlign.close();
844 } // End align
845
846 log << MSG::INFO << totalObject << "\tboxes created." << endmsg;
847 return StatusCode::SUCCESS;
848
849} // MucBox
850
851//------------------MucStripPlane-------------
852// Alignment
854 MsgStream log( msgSvc, "MucGeoMgr" );
855
856 //-------------------------- ideal geometry----------------------
857 ofstream fOrigin( "MucStripPlaneOrigin.dat", ios::out );
858 ofstream fPanel( "MucStripPlanePanel.dat", ios::out );
859 ofstream fPos( "MucStripPlanePanelPos.dat", ios::out );
860
861 if ( fOrigin.bad() || fPanel.bad() || fPos.bad() )
862 {
863 log << MSG::INFO << "StripPlane: create ouput file error!" << endl;
864 return StatusCode::FAILURE;
865 }
866 fOrigin << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
867 fPanel << "part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
868 fPos << "part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_"
869 "x\tLoc_y\tLoc_z"
870 << endl;
871
872 int totalObject = 0;
873
874 for ( int i = 0; i < PART_MAX; i++ )
875 {
876 if ( i == BRID )
877 {
878 for ( int j = 0; j < B_SEG_NUM; j++ )
879 {
880 for ( int k = 0; k < B_LAY_NUM; k++ )
881 {
882 if ( j == B_TOP )
883 {
884 for ( int n = -1; n < B_STR_PANEL_NUM; n++ )
885 {
886 MucStripPlane* aMucStripPlane = new MucStripPlane( i, j, k, n );
887 if ( n == -1 )
888 {
889 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucStripPlane->GetW()
890 << "\t" << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL()
891 << "\t" << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
892 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
893 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
894 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
895 << aMucStripPlane->GetLocOrgInBes( 1 ) << "\t"
896 << aMucStripPlane->GetLocOrgInBes( 2 ) << "\t"
897 << aMucStripPlane->GetLocOrgInBes( 3 ) << "\t"
898 << aMucStripPlane->GetObjOrgInBes( 1 ) << "\t"
899 << aMucStripPlane->GetObjOrgInBes( 2 ) << "\t"
900 << aMucStripPlane->GetObjOrgInBes( 3 ) << "\t"
901 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
902 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
903 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
904 totalObject++;
905 // delete aMucStripPlane;
906 }
907 else
908 {
909 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t"
910 << aMucStripPlane->GetWu() << "\t" << aMucStripPlane->GetWd() << "\t"
911 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
912 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
913 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
914 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
915
916 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
917 << aMucStripPlane->GetLocOrgInBes( 1 ) << "\t"
918 << aMucStripPlane->GetLocOrgInBes( 2 ) << "\t"
919 << aMucStripPlane->GetLocOrgInBes( 3 ) << "\t"
920 << aMucStripPlane->GetObjOrgInBes( 1 ) << "\t"
921 << aMucStripPlane->GetObjOrgInBes( 2 ) << "\t"
922 << aMucStripPlane->GetObjOrgInBes( 3 ) << "\t"
923 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
924 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
925 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
926 // delete aMucStripPlane;
927 }
928 } // for
929 } // B_TOP
930 else
931 {
932 MucStripPlane* aMucStripPlane = new MucStripPlane( i, j, k, 0 );
933 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucStripPlane->GetW() << "\t"
934 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
935 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
936 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
937 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
938 fPos << i << "\t" << j << "\t" << k << "\t"
939 << "\t" << aMucStripPlane->GetLocOrgInBes( 1 ) << "\t"
940 << aMucStripPlane->GetLocOrgInBes( 2 ) << "\t"
941 << aMucStripPlane->GetLocOrgInBes( 3 ) << "\t"
942 << aMucStripPlane->GetObjOrgInBes( 1 ) << "\t"
943 << aMucStripPlane->GetObjOrgInBes( 2 ) << "\t"
944 << aMucStripPlane->GetObjOrgInBes( 3 ) << "\t"
945 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
946 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
947 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
948 totalObject++;
949 // delete aMucStripPlane;
950 }
951 } // layer
952 } // segment
953 } // barrel
954 else
955 {
956 for ( int j = 0; j < E_SEG_NUM; j++ )
957 {
958 for ( int k = 0; k < E_LAY_NUM; k++ )
959 {
960 for ( int n = -1; n < E_PANEL_NUM; n++ )
961 {
962 MucStripPlane* aMucStripPlane = new MucStripPlane( i, j, k, n );
963 if ( n == -1 )
964 {
965 fOrigin << i << "\t" << j << "\t" << k << "\t" << aMucStripPlane->GetW() << "\t"
966 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
967 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
968 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
969 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
970
971 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
972 << aMucStripPlane->GetLocOrgInBes( 1 ) << "\t"
973 << aMucStripPlane->GetLocOrgInBes( 2 ) << "\t"
974 << aMucStripPlane->GetLocOrgInBes( 3 ) << "\t"
975 << aMucStripPlane->GetObjOrgInBes( 1 ) << "\t"
976 << aMucStripPlane->GetObjOrgInBes( 2 ) << "\t"
977 << aMucStripPlane->GetObjOrgInBes( 3 ) << "\t"
978 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
979 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
980 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
981 totalObject++;
982 // delete aMucStripPlane;
983 }
984 else
985 {
986 fPanel << i << "\t" << j << "\t" << k << "\t" << n << "\t"
987 << aMucStripPlane->GetWu() << "\t" << aMucStripPlane->GetWd() << "\t"
988 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
989 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
990 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
991 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
992
993 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
994 << aMucStripPlane->GetLocOrgInBes( 1 ) << "\t"
995 << aMucStripPlane->GetLocOrgInBes( 2 ) << "\t"
996 << aMucStripPlane->GetLocOrgInBes( 3 ) << "\t"
997 << aMucStripPlane->GetObjOrgInBes( 1 ) << "\t"
998 << aMucStripPlane->GetObjOrgInBes( 2 ) << "\t"
999 << aMucStripPlane->GetObjOrgInBes( 3 ) << "\t"
1000 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
1001 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
1002 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
1003 // delete aMucStripPlane;
1004 }
1005 }
1006 } // layer
1007 } // segment
1008 } // endcap
1009 } // part
1010
1011 fOrigin.close();
1012 fPanel.close();
1013 fPos.close();
1014
1015 //-----------------------------real geometry-------------------------
1016 if ( m_AlignFlag )
1017 {
1018 ofstream fOrgAlign( "MucStripPlaneOriginAligned.dat", ios::out );
1019 fOrgAlign << "part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1020 double offset[3];
1021 for ( int i = 0; i < PART_MAX; i++ )
1022 {
1023 if ( i == BRID )
1024 {
1025 for ( int j = 0; j < B_SEG_NUM; j++ )
1026 {
1027 for ( int k = 0; k < B_LAY_NUM; k++ )
1028 {
1029 MucStripPlane* aMucStripPlane = new MucStripPlane( i, j, k, 0 );
1030 offset[0] = m_StripPlaneOffset[i][j][k][0];
1031 offset[1] = m_StripPlaneOffset[i][j][k][1];
1032 offset[2] = m_StripPlaneOffset[i][j][k][2];
1033 aMucStripPlane->SetAlignment( offset[0], offset[1], offset[2] );
1034
1035 fOrgAlign << i << "\t" << j << "\t" << k << "\t" << aMucStripPlane->GetW() << "\t"
1036 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
1037 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
1038 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
1039 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
1040 // delete aMucStripPlane;
1041 } // layer
1042 } // segment
1043 } // barrel
1044 else
1045 {
1046 for ( int j = 0; j < E_SEG_NUM; j++ )
1047 {
1048 for ( int k = 0; k < E_LAY_NUM; k++ )
1049 {
1050 MucStripPlane* aMucStripPlane = new MucStripPlane( i, j, k, -1 );
1051 offset[0] = m_StripPlaneOffset[i][j][k][0];
1052 offset[1] = m_StripPlaneOffset[i][j][k][1];
1053 offset[2] = m_StripPlaneOffset[i][j][k][2];
1054 aMucStripPlane->SetAlignment( offset[0], offset[1], offset[2] );
1055
1056 fOrgAlign << i << "\t" << j << "\t" << k << "\t" << aMucStripPlane->GetW() << "\t"
1057 << aMucStripPlane->GetH() << "\t" << aMucStripPlane->GetL() << "\t"
1058 << aMucStripPlane->GetObjOrgInLoc( 1 ) << "\t"
1059 << aMucStripPlane->GetObjOrgInLoc( 2 ) << "\t"
1060 << aMucStripPlane->GetObjOrgInLoc( 3 ) << "\t" << endl;
1061 // delete aMucStripPlane;
1062 } // layer
1063 } // segment
1064 } // endcap
1065 } // for
1066
1067 fOrgAlign.close();
1068 } // if
1069
1070 log << MSG::INFO << totalObject << "\tstrip_planes created." << endmsg;
1071 return StatusCode::SUCCESS;
1072
1073} // MucStripPlane
1074
1075//------------------MucStrip------------------
1077 MsgStream log( msgSvc, "MucGeoMgr" );
1078
1079 //-------------------------- ideal geometry----------------------
1080 ofstream fOrigin( "MucStrip.dat", ios::out );
1081 ofstream fPos( "MucStripPos.dat", ios::out );
1082
1083 if ( fOrigin.bad() || fPos.bad() )
1084 {
1085 log << MSG::INFO << "Strip: create ouput file error!" << endl;
1086 return StatusCode::FAILURE;
1087 }
1088 fOrigin
1089 << "part\tsegment\tlayer\tstrip\ttype\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z"
1090 << endl;
1091 fPos << "part\tsegment\tlayer\tstrip\ttype\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_"
1092 "z\tLoc_x\tLoc_y\tLoc_z"
1093 << endl;
1094
1095 int totalObject = 0;
1096
1097 for ( int i = 0; i < PART_MAX; i++ )
1098 {
1099 if ( i == BRID )
1100 {
1101 for ( int j = 0; j < B_SEG_NUM; j++ )
1102 {
1103 for ( int k = 0; k < B_LAY_NUM; k++ )
1104 {
1105 // Set maximum strip
1106 int maxStrip;
1107 if ( ( k + 1 ) % 2 == 1 ) maxStrip = B_ZSTR_NUM; // odd layer
1108 else if ( j != B_TOP ) maxStrip = B_PHISTR_NUM; // even layer not top segment
1109 else maxStrip = B_TOPSTR_NUM; // even layer top segment
1110
1111 for ( int n = 0; n < maxStrip; n++ )
1112 {
1113 MucStrip* aMucStrip = new MucStrip( i, j, k, n );
1114 fOrigin << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
1115 << "\t" << aMucStrip->GetW() << "\t" << aMucStrip->GetH() << "\t"
1116 << aMucStrip->GetL() << "\t" << aMucStrip->GetObjOrgInLoc( 1 ) << "\t"
1117 << aMucStrip->GetObjOrgInLoc( 2 ) << "\t" << aMucStrip->GetObjOrgInLoc( 3 )
1118 << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
1119 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
1120 << "\t" << endl;
1121
1122 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
1123 << "\t" << aMucStrip->GetLocOrgInBes( 1 ) << "\t"
1124 << aMucStrip->GetLocOrgInBes( 2 ) << "\t" << aMucStrip->GetLocOrgInBes( 3 )
1125 << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
1126 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
1127 << "\t" << aMucStrip->GetObjOrgInLoc( 1 ) << "\t"
1128 << aMucStrip->GetObjOrgInLoc( 2 ) << "\t" << aMucStrip->GetObjOrgInLoc( 3 )
1129 << "\t" << endl;
1130
1131 totalObject++;
1132 // delete aMucStrip;
1133 } // for
1134 } // layer
1135 } // segment
1136 } // barrel
1137 else
1138 {
1139 for ( int j = 0; j < E_SEG_NUM; j++ )
1140 {
1141 for ( int k = 0; k < E_LAY_NUM; k++ )
1142 {
1143 for ( int n = 0; n < E_STR_NUM; n++ )
1144 {
1145 MucStrip* aMucStrip = new MucStrip( i, j, k, n );
1146 fOrigin << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
1147 << "\t" << aMucStrip->GetW() << "\t" << aMucStrip->GetH() << "\t"
1148 << aMucStrip->GetL() << "\t" << aMucStrip->GetObjOrgInLoc( 1 ) << "\t"
1149 << aMucStrip->GetObjOrgInLoc( 2 ) << "\t" << aMucStrip->GetObjOrgInLoc( 3 )
1150 << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
1151 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
1152 << "\t" << endl;
1153
1154 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t" << aMucStrip->GetType()
1155 << "\t" << aMucStrip->GetLocOrgInBes( 1 ) << "\t"
1156 << aMucStrip->GetLocOrgInBes( 2 ) << "\t" << aMucStrip->GetLocOrgInBes( 3 )
1157 << "\t" << aMucStrip->GetObjOrgInBes( 1 ) << "\t"
1158 << aMucStrip->GetObjOrgInBes( 2 ) << "\t" << aMucStrip->GetObjOrgInBes( 3 )
1159 << "\t" << aMucStrip->GetObjOrgInLoc( 1 ) << "\t"
1160 << aMucStrip->GetObjOrgInLoc( 2 ) << "\t" << aMucStrip->GetObjOrgInLoc( 3 )
1161 << "\t" << endl;
1162 totalObject++;
1163 // delete aMucStrip;
1164 } // for
1165 } // layer
1166 } // segment
1167 } // endcap
1168 } // for
1169
1170 fOrigin.close();
1171 fPos.close();
1172
1173 log << MSG::INFO << totalObject << "\tstrips created." << endmsg;
1174 return StatusCode::SUCCESS;
1175
1176} // MucStrip
1177
1178//------------------MucRpc--------------------
1180 MsgStream log( msgSvc, "MucGeoMgr" );
1181
1182 //-------------------------- ideal geometry----------------------
1183 ofstream fOrigin( "MucRpc.dat", ios::out );
1184 ofstream fPos( "MucRpcPos.dat", ios::out );
1185
1186 if ( fOrigin.bad() || fPos.bad() )
1187 {
1188 log << MSG::INFO << "Rpc: create ouput file error!" << endl;
1189 return StatusCode::FAILURE;
1190 }
1191 fOrigin << "part\tsegment\tlayer\tupDown\trpc\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_"
1192 "x\tBes_y\tBes_z"
1193 << endl;
1194 fPos << "part\tsegment\tlayer\tupDown\trpc\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_"
1195 "z\tLoc_x\tLoc_y\tLoc_z"
1196 << endl;
1197
1198 int totalObject = 0;
1199
1200 for ( int i = 0; i < PART_MAX; i++ )
1201 {
1202 if ( i == BRID )
1203 {
1204 for ( int j = 0; j < B_SEG_NUM; j++ )
1205 {
1206 // Set maximum rpc
1207 int maxRpc;
1208 if ( j == B_TOP ) maxRpc = B_TOP_RPC_NUM; // top segment
1209 else maxRpc = B_RPC_NUM; // not top segment
1210
1211 for ( int k = 0; k < B_LAY_NUM; k++ )
1212 {
1213 for ( int m = 0; m < SL_NUM; m++ )
1214 {
1215 for ( int n = 0; n < maxRpc; n++ )
1216 {
1217 MucRpc* aMucRpc = new MucRpc( i, j, k, m, n );
1218 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1219 << aMucRpc->GetWu() << "\t" << aMucRpc->GetWd() << "\t"
1220 << aMucRpc->GetH() << "\t" << aMucRpc->GetL() << "\t"
1221 << aMucRpc->GetObjOrgInLoc( 1 ) << "\t" << aMucRpc->GetObjOrgInLoc( 2 )
1222 << "\t" << aMucRpc->GetObjOrgInLoc( 3 ) << "\t"
1223 << aMucRpc->GetObjOrgInBes( 1 ) << "\t" << aMucRpc->GetObjOrgInBes( 2 )
1224 << "\t" << aMucRpc->GetObjOrgInBes( 3 ) << "\t" << endl;
1225
1226 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1227 << aMucRpc->GetLocOrgInBes( 1 ) << "\t" << aMucRpc->GetLocOrgInBes( 2 )
1228 << "\t" << aMucRpc->GetLocOrgInBes( 3 ) << "\t"
1229 << aMucRpc->GetObjOrgInBes( 1 ) << "\t" << aMucRpc->GetObjOrgInBes( 2 )
1230 << "\t" << aMucRpc->GetObjOrgInBes( 3 ) << "\t"
1231 << aMucRpc->GetObjOrgInLoc( 1 ) << "\t" << aMucRpc->GetObjOrgInLoc( 2 )
1232 << "\t" << aMucRpc->GetObjOrgInLoc( 3 ) << "\t" << endl;
1233
1234 totalObject++;
1235 // delete aMucRpc;
1236 } // for
1237 } // super layer
1238 } // layer
1239 } // segment
1240 } // barrel
1241 else
1242 {
1243 for ( int j = 0; j < E_SEG_NUM; j++ )
1244 {
1245 for ( int k = 0; k < E_LAY_NUM; k++ )
1246 {
1247 for ( int m = 0; m < SL_NUM; m++ )
1248 {
1249 for ( int n = 0; n < E_RPC_NUM[m]; n++ )
1250 {
1251 MucRpc* aMucRpc = new MucRpc( i, j, k, m, n );
1252 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1253 << aMucRpc->GetWu() << "\t" << aMucRpc->GetWd() << "\t"
1254 << aMucRpc->GetH() << "\t" << aMucRpc->GetL() << "\t"
1255 << aMucRpc->GetObjOrgInLoc( 1 ) << "\t" << aMucRpc->GetObjOrgInLoc( 2 )
1256 << "\t" << aMucRpc->GetObjOrgInLoc( 3 ) << "\t"
1257 << aMucRpc->GetObjOrgInBes( 1 ) << "\t" << aMucRpc->GetObjOrgInBes( 2 )
1258 << "\t" << aMucRpc->GetObjOrgInBes( 3 ) << "\t" << endl;
1259
1260 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1261 << aMucRpc->GetLocOrgInBes( 1 ) << "\t" << aMucRpc->GetLocOrgInBes( 2 )
1262 << "\t" << aMucRpc->GetLocOrgInBes( 3 ) << "\t"
1263 << aMucRpc->GetObjOrgInBes( 1 ) << "\t" << aMucRpc->GetObjOrgInBes( 2 )
1264 << "\t" << aMucRpc->GetObjOrgInBes( 3 ) << "\t"
1265 << aMucRpc->GetObjOrgInLoc( 1 ) << "\t" << aMucRpc->GetObjOrgInLoc( 2 )
1266 << "\t" << aMucRpc->GetObjOrgInLoc( 3 ) << "\t" << endl;
1267 totalObject++;
1268 // delete aMucRpc;
1269 } // for
1270 } // super layer
1271 } // layer
1272 } // segment
1273 } // endcap
1274 } // for, part
1275
1276 fOrigin.close();
1277 fPos.close();
1278
1279 log << MSG::INFO << totalObject << "\t RPCs created." << endmsg;
1280 return StatusCode::SUCCESS;
1281
1282} // MucRpc
1283
1284//------------------MucGas--------------------
1286 MsgStream log( msgSvc, "MucGeoMgr" );
1287
1288 //-------------------------- ideal geometry----------------------
1289 ofstream fOrigin( "MucGas.dat", ios::out );
1290 ofstream fPos( "MucGasPos.dat", ios::out );
1291
1292 if ( fOrigin.bad() || fPos.bad() )
1293 {
1294 log << MSG::INFO << "Gas: create ouput file error!" << endl;
1295 return StatusCode::FAILURE;
1296 }
1297 fOrigin << "part\tsegment\tlayer\tupDown\tgas\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_"
1298 "x\tBes_y\tBes_z"
1299 << endl;
1300 fPos << "part\tsegment\tlayer\tupDown\tgas\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_"
1301 "z\tLoc_x\tLoc_y\tLoc_z"
1302 << endl;
1303
1304 int totalObject = 0;
1305
1306 for ( int i = 0; i < PART_MAX; i++ )
1307 {
1308 if ( i == BRID )
1309 {
1310 for ( int j = 0; j < B_SEG_NUM; j++ )
1311 {
1312 // Set maximum gas
1313 int maxRpc;
1314 if ( j == B_TOP ) maxRpc = B_TOP_RPC_NUM; // top segment
1315 else maxRpc = B_RPC_NUM; // not top segment
1316
1317 for ( int k = 0; k < B_LAY_NUM; k++ )
1318 {
1319 for ( int m = 0; m < SL_NUM; m++ )
1320 {
1321 for ( int n = 0; n < maxRpc; n++ )
1322 {
1323 MucGas* aMucGas = new MucGas( i, j, k, m, n, 0 );
1324 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1325 << aMucGas->GetWu() << "\t" << aMucGas->GetWd() << "\t"
1326 << aMucGas->GetH() << "\t" << aMucGas->GetL() << "\t"
1327 << aMucGas->GetObjOrgInLoc( 1 ) << "\t" << aMucGas->GetObjOrgInLoc( 2 )
1328 << "\t" << aMucGas->GetObjOrgInLoc( 3 ) << "\t"
1329 << aMucGas->GetObjOrgInBes( 1 ) << "\t" << aMucGas->GetObjOrgInBes( 2 )
1330 << "\t" << aMucGas->GetObjOrgInBes( 3 ) << "\t" << endl;
1331
1332 fPos << i << "\t" << j << "\t" << k << "\t" << n << "\t"
1333 << aMucGas->GetLocOrgInBes( 1 ) << "\t" << aMucGas->GetLocOrgInBes( 2 )
1334 << "\t" << aMucGas->GetLocOrgInBes( 3 ) << "\t"
1335 << aMucGas->GetObjOrgInBes( 1 ) << "\t" << aMucGas->GetObjOrgInBes( 2 )
1336 << "\t" << aMucGas->GetObjOrgInBes( 3 ) << "\t"
1337 << aMucGas->GetObjOrgInLoc( 1 ) << "\t" << aMucGas->GetObjOrgInLoc( 2 )
1338 << "\t" << aMucGas->GetObjOrgInLoc( 3 ) << "\t" << endl;
1339
1340 totalObject++;
1341 // delete aMucGas;
1342 } // for
1343 } // super layer
1344 } // layer
1345 } // segment
1346 } // barrel
1347 else
1348 {
1349 for ( int j = 0; j < E_SEG_NUM; j++ )
1350 {
1351 for ( int k = 0; k < E_LAY_NUM; k++ )
1352 {
1353 for ( int m = 0; m < SL_NUM; m++ )
1354 {
1355 for ( int n = 0; n < E_RPC_NUM[m]; n++ )
1356 {
1357 MucGas* aMucGas = new MucGas( i, j, k, m, n, 0 );
1358 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1359 << aMucGas->GetWu() << "\t" << aMucGas->GetWd() << "\t"
1360 << aMucGas->GetH() << "\t" << aMucGas->GetL() << "\t"
1361 << aMucGas->GetObjOrgInLoc( 1 ) << "\t" << aMucGas->GetObjOrgInLoc( 2 )
1362 << "\t" << aMucGas->GetObjOrgInLoc( 3 ) << "\t"
1363 << aMucGas->GetObjOrgInBes( 1 ) << "\t" << aMucGas->GetObjOrgInBes( 2 )
1364 << "\t" << aMucGas->GetObjOrgInBes( 3 ) << "\t" << endl;
1365
1366 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1367 << aMucGas->GetLocOrgInBes( 1 ) << "\t" << aMucGas->GetLocOrgInBes( 2 )
1368 << "\t" << aMucGas->GetLocOrgInBes( 3 ) << "\t"
1369 << aMucGas->GetObjOrgInBes( 1 ) << "\t" << aMucGas->GetObjOrgInBes( 2 )
1370 << "\t" << aMucGas->GetObjOrgInBes( 3 ) << "\t"
1371 << aMucGas->GetObjOrgInLoc( 1 ) << "\t" << aMucGas->GetObjOrgInLoc( 2 )
1372 << "\t" << aMucGas->GetObjOrgInLoc( 3 ) << "\t" << endl;
1373 totalObject++;
1374 // delete aMucGas;
1375 } // for
1376 } // super layer
1377 } // layer
1378 } // segment
1379 } // endcap
1380 } // for, part
1381
1382 fOrigin.close();
1383 fPos.close();
1384
1385 log << MSG::INFO << totalObject << "\tgases created." << endmsg;
1386 return StatusCode::SUCCESS;
1387
1388} // MucGas
1389
1390//------------------MucBakelite---------------
1392 MsgStream log( msgSvc, "MucGeoMgr" );
1393
1394 //-------------------------- ideal geometry----------------------
1395 ofstream fOrigin( "MucBakelite.dat", ios::out );
1396 ofstream fPos( "MucBakelitePos.dat", ios::out );
1397
1398 if ( fOrigin.bad() || fPos.bad() )
1399 {
1400 log << MSG::INFO << "Bakelite: create ouput file error!" << endl;
1401 return StatusCode::FAILURE;
1402 }
1403 fOrigin << "part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
1404 << "Wu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
1405 fPos << "part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
1406 << "LBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1407
1408 int totalObject = 0;
1409
1410 for ( int i = 0; i < PART_MAX; i++ )
1411 {
1412 if ( i == BRID )
1413 {
1414 for ( int j = 0; j < B_SEG_NUM; j++ )
1415 {
1416 // Set maximum rpc number
1417 int maxRpc;
1418 if ( j == B_TOP ) maxRpc = B_TOP_RPC_NUM; // top segment
1419 else maxRpc = B_RPC_NUM; // not top segment
1420
1421 for ( int k = 0; k < B_LAY_NUM; k++ )
1422 {
1423 for ( int m = 0; m < SL_NUM; m++ )
1424 {
1425 for ( int n = 0; n < maxRpc; n++ )
1426 {
1427 for ( int t = 0; t < BKLT_NUM; t++ )
1428 {
1429 MucBakelite* aMucBakelite = new MucBakelite( i, j, k, m, n, t );
1430 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t" << t
1431 << "\t" << aMucBakelite->GetWu() << "\t" << aMucBakelite->GetWd()
1432 << "\t" << aMucBakelite->GetH() << "\t" << aMucBakelite->GetL() << "\t"
1433 << aMucBakelite->GetObjOrgInLoc( 1 ) << "\t"
1434 << aMucBakelite->GetObjOrgInLoc( 2 ) << "\t"
1435 << aMucBakelite->GetObjOrgInLoc( 3 ) << "\t"
1436 << aMucBakelite->GetObjOrgInBes( 1 ) << "\t"
1437 << aMucBakelite->GetObjOrgInBes( 2 ) << "\t"
1438 << aMucBakelite->GetObjOrgInBes( 3 ) << "\t" << endl;
1439
1440 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t" << t
1441 << "\t" << aMucBakelite->GetLocOrgInBes( 1 ) << "\t"
1442 << aMucBakelite->GetLocOrgInBes( 2 ) << "\t"
1443 << aMucBakelite->GetLocOrgInBes( 3 ) << "\t"
1444 << aMucBakelite->GetObjOrgInBes( 1 ) << "\t"
1445 << aMucBakelite->GetObjOrgInBes( 2 ) << "\t"
1446 << aMucBakelite->GetObjOrgInBes( 3 ) << "\t"
1447 << aMucBakelite->GetObjOrgInLoc( 1 ) << "\t"
1448 << aMucBakelite->GetObjOrgInLoc( 2 ) << "\t"
1449 << aMucBakelite->GetObjOrgInLoc( 3 ) << "\t" << endl;
1450
1451 totalObject++;
1452 // delete aMucBakelite;
1453 } // bakelite
1454 } // rpc
1455 } // super layer
1456 } // layer
1457 } // segment
1458 } // barrel
1459 else
1460 {
1461 for ( int j = 0; j < E_SEG_NUM; j++ )
1462 {
1463 for ( int k = 0; k < E_LAY_NUM; k++ )
1464 {
1465 for ( int m = 0; m < SL_NUM; m++ )
1466 {
1467 for ( int n = 0; n < E_RPC_NUM[m]; n++ )
1468 {
1469 for ( int t = 0; t < BKLT_NUM; t++ )
1470 {
1471 MucBakelite* aMucBakelite = new MucBakelite( i, j, k, m, n, t );
1472 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t" << t
1473 << "\t" << aMucBakelite->GetWu() << "\t" << aMucBakelite->GetWd()
1474 << "\t" << aMucBakelite->GetH() << "\t" << aMucBakelite->GetL() << "\t"
1475 << aMucBakelite->GetObjOrgInLoc( 1 ) << "\t"
1476 << aMucBakelite->GetObjOrgInLoc( 2 ) << "\t"
1477 << aMucBakelite->GetObjOrgInLoc( 3 ) << "\t"
1478 << aMucBakelite->GetObjOrgInBes( 1 ) << "\t"
1479 << aMucBakelite->GetObjOrgInBes( 2 ) << "\t"
1480 << aMucBakelite->GetObjOrgInBes( 3 ) << "\t" << endl;
1481
1482 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t" << t
1483 << "\t" << aMucBakelite->GetLocOrgInBes( 1 ) << "\t"
1484 << aMucBakelite->GetLocOrgInBes( 2 ) << "\t"
1485 << aMucBakelite->GetLocOrgInBes( 3 ) << "\t"
1486 << aMucBakelite->GetObjOrgInBes( 1 ) << "\t"
1487 << aMucBakelite->GetObjOrgInBes( 2 ) << "\t"
1488 << aMucBakelite->GetObjOrgInBes( 3 ) << "\t"
1489 << aMucBakelite->GetObjOrgInLoc( 1 ) << "\t"
1490 << aMucBakelite->GetObjOrgInLoc( 2 ) << "\t"
1491 << aMucBakelite->GetObjOrgInLoc( 3 ) << "\t" << endl;
1492
1493 totalObject++;
1494 // delete aMucBakelite;
1495 } // bakelite
1496 } // rpc
1497 } // super layer
1498 } // layer
1499 } // segment
1500 } // endcap
1501 } // for, part
1502
1503 fOrigin.close();
1504 fPos.close();
1505
1506 log << MSG::INFO << totalObject << "\tbakelites created." << endmsg;
1507 return StatusCode::SUCCESS;
1508
1509} // MucBakelite
1510
1511//------------------MucBoxCover---------------
1513 MsgStream log( msgSvc, "MucGeoMgr" );
1514
1515 //-------------------------- ideal geometry----------------------
1516 ofstream fOrigin( "MucBoxCoverOrigin.dat", ios::out );
1517 ofstream fPanel( "MucBoxCoverPanel.dat", ios::out );
1518 ofstream fPos( "MucBoxCoverPanelPos.dat", ios::out );
1519
1520 if ( fOrigin.bad() || fPanel.bad() || fPos.bad() )
1521 {
1522 log << MSG::INFO << "BoxCover: create ouput file error!" << endl;
1523 return StatusCode::FAILURE;
1524 }
1525 fOrigin << "part\tsegment\tlayer\tU/D\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1526 fPanel << "part\tsegment\tlayer\tU/D\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1527 fPos << "part\tsegment\tlayer\tU/"
1528 "D\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z"
1529 << endl;
1530
1531 int totalObject = 0;
1532
1533 for ( int i = 0; i < PART_MAX; i++ )
1534 {
1535 if ( i == BRID )
1536 {
1537 for ( int j = 0; j < B_SEG_NUM; j++ )
1538 {
1539 // set panel number
1540 int idMin, idMax;
1541 if ( j != B_TOP )
1542 {
1543 idMin = 0;
1544 idMax = B_GP_NUM;
1545 }
1546 else
1547 {
1548 idMin = -1;
1549 idMax = 3;
1550 }
1551
1552 for ( int k = 0; k < B_LAY_NUM; k++ )
1553 {
1554 for ( int m = 0; m < SL_NUM; m++ )
1555 {
1556 for ( int n = idMin; n < idMax; n++ )
1557 {
1558 MucBoxCover* aMucBoxCover = new MucBoxCover( i, j, k, m, n );
1559 if ( j == B_TOP || n != -1 ) // barrel top segment panels
1560 {
1561 fPanel << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1562 << aMucBoxCover->GetW() << "\t" << aMucBoxCover->GetW() << "\t"
1563 << aMucBoxCover->GetH() << "\t" << aMucBoxCover->GetL() << "\t"
1564 << aMucBoxCover->GetObjOrgInLoc( 1 ) << "\t"
1565 << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1566 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1567 // delete aMucBoxCover;
1568 }
1569
1570 if ( j != B_TOP || n == -1 ) // box cover
1571 {
1572 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t"
1573 << aMucBoxCover->GetW() << "\t" << aMucBoxCover->GetH() << "\t"
1574 << aMucBoxCover->GetL() << "\t" << aMucBoxCover->GetObjOrgInLoc( 1 )
1575 << "\t" << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1576 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1577
1578 totalObject++;
1579 // delete aMucBoxCover;
1580 }
1581
1582 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1583 << aMucBoxCover->GetLocOrgInBes( 1 ) << "\t"
1584 << aMucBoxCover->GetLocOrgInBes( 2 ) << "\t"
1585 << aMucBoxCover->GetLocOrgInBes( 3 ) << "\t"
1586 << aMucBoxCover->GetObjOrgInBes( 1 ) << "\t"
1587 << aMucBoxCover->GetObjOrgInBes( 2 ) << "\t"
1588 << aMucBoxCover->GetObjOrgInBes( 3 ) << "\t"
1589 << aMucBoxCover->GetObjOrgInLoc( 1 ) << "\t"
1590 << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1591 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1592 // delete aMucBoxCover;
1593 } // panel
1594 } // super layer
1595 } // layer
1596 } // segment
1597 } // barrel
1598 else
1599 {
1600 for ( int j = 0; j < E_SEG_NUM; j++ )
1601 {
1602 for ( int k = 0; k < E_LAY_NUM; k++ )
1603 {
1604 for ( int m = 0; m < SL_NUM; m++ )
1605 {
1606 for ( int n = -1; n < E_PANEL_NUM; n++ )
1607 {
1608 MucBoxCover* aMucBoxCover = new MucBoxCover( i, j, k, m, n );
1609 if ( n == -1 )
1610 {
1611 fOrigin << i << "\t" << j << "\t" << k << "\t" << m << "\t"
1612 << aMucBoxCover->GetW() << "\t" << aMucBoxCover->GetH() << "\t"
1613 << aMucBoxCover->GetL() << "\t" << aMucBoxCover->GetObjOrgInLoc( 1 )
1614 << "\t" << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1615 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1616 totalObject++;
1617 // delete aMucBoxCover;
1618 }
1619 else
1620 {
1621 fPanel << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1622 << aMucBoxCover->GetWu() << "\t" << aMucBoxCover->GetWd() << "\t"
1623 << aMucBoxCover->GetH() << "\t" << aMucBoxCover->GetL() << "\t"
1624 << aMucBoxCover->GetObjOrgInLoc( 1 ) << "\t"
1625 << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1626 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1627 // delete aMucBoxCover;
1628 }
1629
1630 fPos << i << "\t" << j << "\t" << k << "\t" << m << "\t" << n << "\t"
1631 << aMucBoxCover->GetLocOrgInBes( 1 ) << "\t"
1632 << aMucBoxCover->GetLocOrgInBes( 2 ) << "\t"
1633 << aMucBoxCover->GetLocOrgInBes( 3 ) << "\t"
1634 << aMucBoxCover->GetObjOrgInBes( 1 ) << "\t"
1635 << aMucBoxCover->GetObjOrgInBes( 2 ) << "\t"
1636 << aMucBoxCover->GetObjOrgInBes( 3 ) << "\t"
1637 << aMucBoxCover->GetObjOrgInLoc( 1 ) << "\t"
1638 << aMucBoxCover->GetObjOrgInLoc( 2 ) << "\t"
1639 << aMucBoxCover->GetObjOrgInLoc( 3 ) << "\t" << endl;
1640 // delete aMucBoxCover;
1641 } // panel
1642 } // super layer
1643 } // layer
1644 } // segment
1645 } // endcap
1646 } // for
1647
1648 fOrigin.close();
1649 fPanel.close();
1650 fPos.close();
1651
1652 log << MSG::INFO << totalObject << "\tbox_covers created." << endmsg;
1653 return StatusCode::SUCCESS;
1654
1655} // MucBoxCover
1656
1657//=================================== Geometry entities getting
1658//methods====================================
1659MucAbsorber* MucGeoMgr::GetAbsorber( int part, int segment, int layer, int id ) {
1660 if ( m_MucAbsorber != NULL ) delete m_MucAbsorber;
1661 return ( m_MucAbsorber = new MucAbsorber( part, segment, layer, id ) );
1662}
1663
1664MucGap* MucGeoMgr::GetGap( int part, int segment, int layer, int id ) {
1665 if ( m_MucGap != NULL ) delete m_MucGap;
1666 return ( m_MucGap = new MucGap( part, segment, layer, id ) );
1667}
1668
1669MucBox* MucGeoMgr::GetBox( int part, int segment, int layer, int id ) {
1670 if ( m_MucBox != NULL ) delete m_MucBox;
1671 return ( m_MucBox = new MucBox( part, segment, layer, id ) );
1672}
1673
1674MucStripPlane* MucGeoMgr::GetStripPlane( int part, int segment, int layer, int id ) {
1675 if ( m_MucStripPlane != NULL ) delete m_MucStripPlane;
1676 return ( m_MucStripPlane = new MucStripPlane( part, segment, layer, id ) );
1677}
1678
1679MucStrip* MucGeoMgr::GetStrip( int part, int segment, int layer, int id ) {
1680 if ( m_MucStrip != NULL ) delete m_MucStrip;
1681 return ( m_MucStrip = new MucStrip( part, segment, layer, id ) );
1682}
1683
1684MucRpc* MucGeoMgr::GetRpc( int part, int segment, int layer, int upDown, int id ) {
1685 if ( m_MucRpc != NULL ) delete m_MucRpc;
1686 return ( m_MucRpc = new MucRpc( part, segment, layer, upDown, id ) );
1687}
1688
1689MucGas* MucGeoMgr::GetGas( int part, int segment, int layer, int upDown, int rpcId, int id ) {
1690 if ( m_MucGas != NULL ) delete m_MucGas;
1691 return ( m_MucGas = new MucGas( part, segment, layer, upDown, rpcId, id ) );
1692}
1693
1694MucBakelite* MucGeoMgr::GetBakelite( int part, int segment, int layer, int upDown, int rpcId,
1695 int id ) {
1696 if ( m_MucBakelite != NULL ) delete m_MucBakelite;
1697 return ( m_MucBakelite = new MucBakelite( part, segment, layer, upDown, rpcId, id ) );
1698}
1699
1700MucBoxCover* MucGeoMgr::GetBoxCover( int part, int segment, int layer, int upDown, int id ) {
1701 if ( m_MucBoxCover != NULL ) delete m_MucBoxCover;
1702 return ( m_MucBoxCover = new MucBoxCover( part, segment, layer, upDown, id ) );
1703}
1704
1705// END
const Int_t n
const unsigned int ENTITY_NUM
Definition MucGeoMgr.h:44
virtual void SetAlignment(double dx, double dy, double dz)
Definition MucBox.cxx:369
double GetWu()
double GetW()
double GetObjRotToMot(int i)
double GetObjOrgInBes(int i)
double GetLocOrgInBes(int i)
double GetWd()
double GetH()
double GetL()
double GetObjOrgInLoc(int i)
bool CheckStripPlaneOffset(int part, int segment, int layer, int axis, double offset)
MucGap * GetGap(int part, int segment, int layer, int id)
StatusCode CreateRpc()
MucAbsorber * GetAbsorber(int part, int segment, int layer, int id)
StatusCode CreateGas()
MucStripPlane * GetStripPlane(int part, int segment, int layer, int id)
MucGeoMgr(const std::string createFlag, bool alignFlag, const std::string alignFile)
Definition MucGeoMgr.cxx:26
MucGas * GetGas(int part, int segment, int layer, int upDown, int rpcId, int id)
StatusCode InitOffset()
Definition MucGeoMgr.cxx:56
IMessageSvc * msgSvc
Definition MucGeoMgr.h:65
StatusCode CreateGap()
StatusCode CreateAbsorber()
StatusCode CreateOnlineStripGeo()
StatusCode CreateBoxCover()
MucBoxCover * GetBoxCover(int part, int segment, int layer, int upDown, int id)
MucBakelite * GetBakelite(int part, int segment, int layer, int upDown, int rpcId, int id)
StatusCode CreateBakelite()
StatusCode CreateStripPlane()
MucStrip * GetStrip(int part, int segment, int layer, int id)
StatusCode CreateStrip()
MucBox * GetBox(int part, int segment, int layer, int id)
bool CheckBoxOffset(int part, int segment, int layer, int axis, double offset)
StatusCode CreateBox()
StatusCode CreateEntities()
StatusCode CreateRootGeo()
MucRpc * GetRpc(int part, int segment, int layer, int upDown, int id)
virtual void SetAlignment(double dx, double dy, double dz)
int GetType()
Definition MucStrip.cxx:84
int t()
Definition t.c:1