12#include "GaudiKernel/MsgStream.h"
13#include "GaudiKernel/Bootstrap.h"
14#include "GaudiKernel/ISvcLocator.h"
20#include "MucGeoCreateAlg/MucGeoMgr.h"
21#include "MucGeoCreateAlg/MucIdTransform.h"
28 m_CreateFlag = createFlag;
29 m_AlignFlag = alignFlag;
30 m_AlignFile = alignFile;
32 Gaudi::svcLocator() -> service(
"MessageSvc",
msgSvc);
41 delete []m_StripPlaneOffset;
46 delete m_MucStripPlane;
58 MsgStream log(
msgSvc,
"MucGeoMgr");
62 if( m_AlignFlag ==
true )
64 log << MSG::INFO <<
"MucGeoMgr::initOffset()" << endreq;
66 TFile* froot =
new TFile(m_AlignFile.c_str(),
"read");
67 if( froot->IsZombie() )
69 log << MSG:: ERROR <<
"Open alignment data error!" << endreq;
70 return StatusCode::FAILURE;
73 const char OFFSET_NAME[3][5] = {
"dx",
"dy",
"dz"};
75 double strpln_offset[3];
79 tr_Offset = (TTree*)froot->Get(
"Offset");
80 tr_Offset->SetBranchAddress(
"box_dx", &box_offset[0]);
81 tr_Offset->SetBranchAddress(
"box_dy", &box_offset[1]);
82 tr_Offset->SetBranchAddress(
"box_dz", &box_offset[2]);
83 tr_Offset->SetBranchAddress(
"strpln_dx", &strpln_offset[0]);
84 tr_Offset->SetBranchAddress(
"strpln_dy", &strpln_offset[1]);
85 tr_Offset->SetBranchAddress(
"strpln_dz", &strpln_offset[2]);
87 int part, segment, layer;
88 part = segment = layer = 0;
90 log << MSG::INFO <<
"------------------------- offset data--------------------------" << endreq;
91 log << MSG::INFO <<
"Part\tSegment\tLayer\tdx0\tdy0\tdz0\tdx1\tdy1\tdz1" << endreq;
92 for(
int i=0; i<BOX_MAX; i++)
94 m_IdTr->
SetBoxPos(i, &part, &segment, &layer);
95 tr_Offset->GetEntry(i);
97 log << MSG::INFO << part <<
"\t" << segment <<
"\t" << layer <<
"\t";
98 for(
int j=0; j<3; j++ )
100 log << MSG::INFO << box_offset[j] <<
"\t";
104 log << MSG::INFO << endreq <<
"Box offset P" << part <<
"S" << segment <<
"L" << layer
105 <<
"_" << OFFSET_NAME[j] <<
"\tout range!" << endreq;
106 box_offset[j] = B_X_MAX[j];
110 for(
int j=0; j<3; j++ )
112 log << MSG::INFO << strpln_offset[j] <<
"\t";
116 log << MSG::INFO << endreq <<
"Strip plane offset P" << part <<
"S" << segment <<
"L" << layer
117 <<
"_" << OFFSET_NAME[j] <<
"\tout range!" << endreq;
118 strpln_offset[j] = STR_OFFSET_MAX[j];
122 log << MSG::INFO << endreq;
126 log << MSG::INFO <<
"---------------------------------------------------------------" << endreq;
133 for(
int m=0; m<3; m++)
135 m_BoxOffset[i][j][k][m] = 0.0;
136 m_StripPlaneOffset[i][j][k][m] = 0.0;
140 return StatusCode::SUCCESS;
145 int outRangeFlag = 0;
154 if( layer == 0 ) layerFlag = 0;
155 else if( layer%2 == 1 ) layerFlag = 1;
158 if( B_X_MAX[layerFlag] - fabs(offset) >= 0.0 )
159 m_BoxOffset[part][segment][layer][axis] = offset;
163 m_BoxOffset[part][segment][layer][axis] = B_X_MAX[layerFlag] * MAX_FRACTION;
167 if( B_Y_MAX - fabs(offset) >= 0.0 )
168 m_BoxOffset[part][segment][layer][axis] = offset;
172 m_BoxOffset[part][segment][layer][axis] = B_Y_MAX * MAX_FRACTION;
176 if( B_Z_MAX - fabs(offset) >= 0.0 )
177 m_BoxOffset[part][segment][layer][axis] = offset;
181 m_BoxOffset[part][segment][layer][axis] = B_Z_MAX * MAX_FRACTION;
189 if( E_OFFSET_MAX[axis] - fabs(offset) >= 0.0 )
190 m_BoxOffset[part][segment][layer][axis] = offset;
194 m_BoxOffset[part][segment][layer][axis] = E_OFFSET_MAX[axis] * MAX_FRACTION;
198 if( outRangeFlag > 0 )
return false;
204 int outRangeFlag = 0;
206 if( STR_OFFSET_MAX[axis] - fabs(offset) >= 0.0 )
207 m_StripPlaneOffset[part][segment][layer][axis] = offset;
211 m_StripPlaneOffset[part][segment][layer][axis] = STR_OFFSET_MAX[axis] * MAX_FRACTION;
214 if( outRangeFlag > 0 )
return false;
224 MsgStream log(
msgSvc,
"MucGeoMgr");
230 for(
unsigned int i=m_CreateFlag.size(); i<
ENTITY_NUM; i++ )
236 if( m_CreateFlag[i] ==
'1' ) entity++;
237 log << MSG::INFO << entity <<
"\tentities should be created." << endreq << endreq;
239 if( m_CreateFlag[0] ==
'1' )
242 if( sc == StatusCode::SUCCESS )
243 log << MSG::INFO <<
"Create absorber successfully!" << endreq << endreq;
245 log << MSG::INFO <<
"Create absorber failure!" << endreq << endreq;
248 if( m_CreateFlag[1] ==
'1' )
251 if( sc == StatusCode::SUCCESS )
252 log << MSG::INFO <<
"Create gap successfully!" << endreq << endreq;
254 log << MSG::INFO <<
"Create gap failure!" << endreq << endreq;
257 if( m_CreateFlag[2] ==
'1' )
260 if( sc == StatusCode::SUCCESS )
261 log << MSG::INFO <<
"Create box successfully!" << endreq << endreq;
263 log << MSG::INFO <<
"Create box failure!" << endreq << endreq;
266 if( m_CreateFlag[3] ==
'1' )
269 if( sc == StatusCode::SUCCESS )
270 log << MSG::INFO <<
"Create strip_plane successfully!" << endreq << endreq;
272 log << MSG::INFO <<
"Create strip_plane failure!" << endreq << endreq;
275 if( m_CreateFlag[4] ==
'1' )
278 if( sc == StatusCode::SUCCESS )
279 log << MSG::INFO <<
"Create strip successfully!" << endreq << endreq;
281 log << MSG::INFO <<
"Create strip failure!" << endreq << endreq;
284 if( m_CreateFlag[5] ==
'1' )
287 if( sc == StatusCode::SUCCESS )
288 log << MSG::INFO <<
"Create RPC successfully!" << endreq << endreq;
290 log << MSG::INFO <<
"Create RPC failure!" << endreq << endreq;
293 if( m_CreateFlag[6] ==
'1' )
296 if( sc == StatusCode::SUCCESS )
297 log << MSG::INFO <<
"Create gas mixture successfully!" << endreq << endreq;
299 log << MSG::INFO <<
"Create gas mixture failure!" << endreq << endreq;
302 if( m_CreateFlag[7] ==
'1' )
305 if( sc == StatusCode::SUCCESS )
306 log << MSG::INFO <<
"Create bakelite successfully!" << endreq << endreq;
308 log << MSG::INFO <<
"Create bakelite failure!" << endreq << endreq;
311 if( m_CreateFlag[8] ==
'1' )
314 if( sc == StatusCode::SUCCESS )
315 log << MSG::INFO <<
"Create box cover successfully!" << endreq << endreq;
317 log << MSG::INFO <<
"Create box cover failure!" << endreq << endreq;
321 return StatusCode::SUCCESS;
327 MsgStream log(
msgSvc,
"MucGeoMgr");
331 return StatusCode::SUCCESS;
338 MsgStream log(
msgSvc,
"MucGeoMgr");
342 ofstream fEast(
"EastEndStripGeo.dat", ios::out);
343 ofstream fBarrel(
"BarrelStripGeo.dat", ios::out);
344 ofstream fWest(
"WestEndStripGeo.dat", ios::out);
346 if( fEast.bad() || fBarrel.bad() || fWest.bad() )
348 log << MSG::INFO <<
"Strip: create ouput file error!" << endl;
349 return StatusCode::FAILURE;
364 else if( j != B_TOP )
365 maxStrip = B_PHISTR_NUM;
367 maxStrip = B_TOPSTR_NUM;
369 for(
int n=0;
n<maxStrip;
n++ )
373 fBarrel << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
374 << aMucStrip->
GetType()-2 <<
"\t"
375 << aMucStrip->
GetL() <<
"\t"
376 << aMucStrip->
GetW() <<
"\t"
377 << aMucStrip->
GetH() <<
"\t"
393 for(
int n=0;
n<E_STR_NUM;
n++ )
397 fEast << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
398 << aMucStrip->
GetType() <<
"\t"
399 << aMucStrip->
GetL() <<
"\t"
400 << aMucStrip->
GetW() <<
"\t"
401 << aMucStrip->
GetH() <<
"\t"
417 for(
int n=0;
n<E_STR_NUM;
n++ )
421 fWest << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
422 << aMucStrip->
GetType() <<
"\t"
423 << aMucStrip->
GetL() <<
"\t"
424 << aMucStrip->
GetW() <<
"\t"
425 << aMucStrip->
GetH() <<
"\t"
442 log << MSG::INFO <<
"Online display strips created." << endreq;
444 return StatusCode::SUCCESS;
455 MsgStream log(
msgSvc,
"MucGeoMgr");
457 ofstream fOrigin(
"MucAbsorberOrigin.dat", ios::out);
458 ofstream fPanel(
"MucAbsorberPanel.dat", ios::out);
459 ofstream fPos(
"MucAbsorberPanelPos.dat", ios::out);
461 if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
463 log << MSG::INFO <<
"Absorber: create ouput file error!" << endreq;
464 return StatusCode::FAILURE;
466 fOrigin <<
"part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
467 fPanel <<
"part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
468 fPos <<
"part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
480 for(
int n=0;
n<B_AS_NUM;
n++ )
483 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
484 << aMucAbsorber->
GetW() <<
"\t"
485 << aMucAbsorber->
GetH() <<
"\t"
486 << aMucAbsorber->
GetL() <<
"\t"
494 fPanel << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
495 << aMucAbsorber->
GetWu() <<
"\t"
496 << aMucAbsorber->
GetWd() <<
"\t"
497 << aMucAbsorber->
GetH() <<
"\t"
498 << aMucAbsorber->
GetL() <<
"\t"
503 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
525 for(
int k=0; k<E_ASLAY_NUM; k++ )
527 for(
int n=-1;
n<E_PANEL_NUM;
n++ )
532 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
533 << aMucAbsorber->
GetW() <<
"\t"
534 << aMucAbsorber->
GetH() <<
"\t"
535 << aMucAbsorber->
GetL() <<
"\t"
549 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
550 << aMucAbsorber->
GetWu() <<
"\t"
551 << aMucAbsorber->
GetWd() <<
"\t"
552 << aMucAbsorber->
GetH() <<
"\t"
553 << aMucAbsorber->
GetL() <<
"\t"
559 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
582 log << MSG::INFO << totalObject <<
"\tabsorbers created." << endreq;
584 return StatusCode::SUCCESS;
591 MsgStream log(
msgSvc,
"MucGeoMgr");
593 ofstream fOrigin(
"MucGapOrigin.dat", ios::out);
594 ofstream fPanel(
"MucGapPanel.dat", ios::out);
595 ofstream fPos(
"MucGapPanelPos.dat", ios::out);
597 if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
599 log << MSG::INFO <<
"Gap: create ouput file error!" << endreq;
600 return StatusCode::FAILURE;
602 fOrigin <<
"part\tsegment\tlayer\tW\tH\tL\tBes_x\tBes_y\tBes_z\tRot_x\tRot_y\tRot_z" << endl;
603 fPanel <<
"part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
604 fPos <<
"part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
616 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
617 else { idMin = -1; idMax = 3; }
621 for(
int n=idMin;
n<idMax;
n++ )
625 if( j == B_TOP &&
n != -1 )
627 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
628 << aMucGap->
GetWu() <<
"\t"
629 << aMucGap->
GetWd() <<
"\t"
630 << aMucGap->
GetH() <<
"\t"
631 << aMucGap->
GetL() <<
"\t"
638 if( j !=B_TOP ||
n == -1 )
640 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
641 << aMucGap->
GetW() <<
"\t"
642 << aMucGap->
GetH() <<
"\t"
643 << aMucGap->
GetL() <<
"\t"
656 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
677 for(
int n=-1;
n<E_PANEL_NUM;
n++ )
683 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
684 << aMucGap->
GetW() <<
"\t"
685 << aMucGap->
GetH() <<
"\t"
686 << aMucGap->
GetL() <<
"\t"
699 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
700 << aMucGap->
GetWu() <<
"\t"
701 << aMucGap->
GetWd() <<
"\t"
702 << aMucGap->
GetH() <<
"\t"
703 << aMucGap->
GetL() <<
"\t"
709 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
732 log << MSG::INFO << totalObject <<
"\tgaps created." << endreq;
734 return StatusCode::SUCCESS;
741 MsgStream log(
msgSvc,
"MucGeoMgr");
744 ofstream fOrigin(
"MucBoxOrigin.dat", ios::out);
745 ofstream fPanel(
"MucBoxPanel.dat", ios::out);
746 ofstream fPos(
"MucBoxPanelPos.dat", ios::out);
748 if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
750 log << MSG::INFO <<
"Box: create ouput file error!" << endl;
751 return StatusCode::FAILURE;
753 fOrigin <<
"part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
754 fPanel <<
"part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
755 fPos <<
"part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
766 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
767 else { idMin = -1; idMax = 3; }
771 for(
int n=idMin;
n<idMax;
n++ )
775 if( j == B_TOP &&
n != -1 )
777 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
778 << aMucBox->
GetWu() <<
"\t"
779 << aMucBox->
GetWd() <<
"\t"
780 << aMucBox->
GetH() <<
"\t"
781 << aMucBox->
GetL() <<
"\t"
788 if( j !=B_TOP ||
n == -1 )
790 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
791 << aMucBox->
GetW() <<
"\t"
792 << aMucBox->
GetH() <<
"\t"
793 << aMucBox->
GetL() <<
"\t"
803 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
825 for(
int n=-1;
n<E_PANEL_NUM;
n++ )
830 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
831 << aMucBox->
GetW() <<
"\t"
832 << aMucBox->
GetH() <<
"\t"
833 << aMucBox->
GetL() <<
"\t"
844 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
845 << aMucBox->
GetWu() <<
"\t"
846 << aMucBox->
GetWd() <<
"\t"
847 << aMucBox->
GetH() <<
"\t"
848 << aMucBox->
GetL() <<
"\t"
856 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
882 ofstream fOrgAlign(
"MucBoxOriginAligned.dat", ios::out);
883 fOrgAlign <<
"part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
893 MucBox *aMucBox =
new MucBox( i, j, k, ((j==B_TOP)?-1:0) );
894 offset[0] =m_BoxOffset[i][j][k][0];
895 offset[1] =m_BoxOffset[i][j][k][1];
896 offset[2] =m_BoxOffset[i][j][k][2];
897 aMucBox->
SetAlignment( offset[0], offset[1], offset[2] );
899 fOrgAlign << i <<
"\t" << j <<
"\t" << k <<
"\t"
900 << aMucBox->
GetW() <<
"\t"
901 << aMucBox->
GetH() <<
"\t"
902 << aMucBox->
GetL() <<
"\t"
918 offset[0] =m_BoxOffset[i][j][k][0];
919 offset[1] =m_BoxOffset[i][j][k][1];
920 offset[2] =m_BoxOffset[i][j][k][2];
921 aMucBox->
SetAlignment( offset[0], offset[1], offset[2] );
923 fOrgAlign<< i <<
"\t" << j <<
"\t" << k <<
"\t"
924 << aMucBox->
GetW() <<
"\t"
925 << aMucBox->
GetH() <<
"\t"
926 << aMucBox->
GetL() <<
"\t"
941 log << MSG::INFO << totalObject <<
"\tboxes created." << endreq;
943 return StatusCode::SUCCESS;
951 MsgStream log(
msgSvc,
"MucGeoMgr");
954 ofstream fOrigin(
"MucStripPlaneOrigin.dat", ios::out);
955 ofstream fPanel(
"MucStripPlanePanel.dat", ios::out);
956 ofstream fPos(
"MucStripPlanePanelPos.dat", ios::out);
958 if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
960 log << MSG::INFO <<
"StripPlane: create ouput file error!" << endl;
961 return StatusCode::FAILURE;
963 fOrigin <<
"part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
964 fPanel <<
"part\tsegment\tlayer\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
965 fPos <<
"part\tsegment\tlayer\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
979 for(
int n=-1;
n<B_STR_PANEL_NUM;
n++ )
984 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
985 << aMucStripPlane->
GetW() <<
"\t"
986 << aMucStripPlane->
GetH() <<
"\t"
987 << aMucStripPlane->
GetL() <<
"\t"
992 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1008 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1009 << aMucStripPlane->
GetWu() <<
"\t"
1010 << aMucStripPlane->
GetWd() <<
"\t"
1011 << aMucStripPlane->
GetH() <<
"\t"
1012 << aMucStripPlane->
GetL() <<
"\t"
1018 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1036 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1037 << aMucStripPlane->
GetW() <<
"\t"
1038 << aMucStripPlane->
GetH() <<
"\t"
1039 << aMucStripPlane->
GetL() <<
"\t"
1044 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
"\t"
1067 for(
int n=-1;
n<E_PANEL_NUM;
n++ )
1072 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1073 << aMucStripPlane->
GetW() <<
"\t"
1074 << aMucStripPlane->
GetH() <<
"\t"
1075 << aMucStripPlane->
GetL() <<
"\t"
1081 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1097 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1098 << aMucStripPlane->
GetWu() <<
"\t"
1099 << aMucStripPlane->
GetWd() <<
"\t"
1100 << aMucStripPlane->
GetH() <<
"\t"
1101 << aMucStripPlane->
GetL() <<
"\t"
1107 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1134 ofstream fOrgAlign(
"MucStripPlaneOriginAligned.dat", ios::out);
1135 fOrgAlign <<
"part\tsegment\tlayer\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1146 offset[0] =m_StripPlaneOffset[i][j][k][0];
1147 offset[1] =m_StripPlaneOffset[i][j][k][1];
1148 offset[2] =m_StripPlaneOffset[i][j][k][2];
1149 aMucStripPlane->
SetAlignment( offset[0], offset[1], offset[2] );
1151 fOrgAlign << i <<
"\t" << j <<
"\t" << k <<
"\t"
1152 << aMucStripPlane->
GetW() <<
"\t"
1153 << aMucStripPlane->
GetH() <<
"\t"
1154 << aMucStripPlane->
GetL() <<
"\t"
1170 offset[0] =m_StripPlaneOffset[i][j][k][0];
1171 offset[1] =m_StripPlaneOffset[i][j][k][1];
1172 offset[2] =m_StripPlaneOffset[i][j][k][2];
1173 aMucStripPlane->
SetAlignment( offset[0], offset[1], offset[2] );
1175 fOrgAlign<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1176 << aMucStripPlane->
GetW() <<
"\t"
1177 << aMucStripPlane->
GetH() <<
"\t"
1178 << aMucStripPlane->
GetL() <<
"\t"
1193 log << MSG::INFO << totalObject <<
"\tstrip_planes created." << endreq;
1195 return StatusCode::SUCCESS;
1202 MsgStream log(
msgSvc,
"MucGeoMgr");
1205 ofstream fOrigin(
"MucStrip.dat", ios::out);
1206 ofstream fPos(
"MucStripPos.dat", ios::out);
1208 if( fOrigin.bad() || fPos.bad() )
1210 log << MSG::INFO <<
"Strip: create ouput file error!" << endl;
1211 return StatusCode::FAILURE;
1213 fOrigin <<
"part\tsegment\tlayer\tstrip\ttype\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
1214 fPos <<
"part\tsegment\tlayer\tstrip\ttype\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1216 int totalObject = 0;
1228 if( ( k+1 )%2 == 1 )
1230 else if( j != B_TOP )
1231 maxStrip = B_PHISTR_NUM;
1233 maxStrip = B_TOPSTR_NUM;
1235 for(
int n=0;
n<maxStrip;
n++ )
1239 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1240 << aMucStrip->
GetType() <<
"\t"
1241 << aMucStrip->
GetW() <<
"\t"
1242 << aMucStrip->
GetH() <<
"\t"
1243 << aMucStrip->
GetL() <<
"\t"
1252 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1253 << aMucStrip->
GetType() <<
"\t"
1277 for(
int n=0;
n<E_STR_NUM;
n++ )
1281 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1282 << aMucStrip->
GetType() <<
"\t"
1283 << aMucStrip->
GetW() <<
"\t"
1284 << aMucStrip->
GetH() <<
"\t"
1285 << aMucStrip->
GetL() <<
"\t"
1294 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1295 << aMucStrip->
GetType() <<
"\t"
1317 log << MSG::INFO << totalObject <<
"\tstrips created." << endreq;
1319 return StatusCode::SUCCESS;
1327 MsgStream log(
msgSvc,
"MucGeoMgr");
1331 ofstream fOrigin(
"MucRpc.dat", ios::out);
1332 ofstream fPos(
"MucRpcPos.dat", ios::out);
1334 if( fOrigin.bad() || fPos.bad() )
1336 log << MSG::INFO <<
"Rpc: create ouput file error!" << endl;
1337 return StatusCode::FAILURE;
1339 fOrigin <<
"part\tsegment\tlayer\tupDown\trpc\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
1340 fPos <<
"part\tsegment\tlayer\tupDown\trpc\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1342 int totalObject = 0;
1353 maxRpc = B_TOP_RPC_NUM;
1359 for(
int m=0; m<SL_NUM; m++ )
1361 for(
int n=0;
n<maxRpc;
n++ )
1365 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1366 << m <<
"\t" <<
n <<
"\t"
1367 << aMucRpc->
GetWu() <<
"\t"
1368 << aMucRpc->
GetWd() <<
"\t"
1369 << aMucRpc->
GetH() <<
"\t"
1370 << aMucRpc->
GetL() <<
"\t"
1379 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1380 << m <<
"\t" <<
n <<
"\t"
1405 for(
int m=0; m<SL_NUM; m++ )
1407 for(
int n=0;
n<E_RPC_NUM[m];
n++ )
1411 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1412 << m <<
"\t" <<
n <<
"\t"
1413 << aMucRpc->
GetWu() <<
"\t"
1414 << aMucRpc->
GetWd() <<
"\t"
1415 << aMucRpc->
GetH() <<
"\t"
1416 << aMucRpc->
GetL() <<
"\t"
1425 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1426 << m <<
"\t" <<
n <<
"\t"
1449 log << MSG::INFO << totalObject <<
"\t RPCs created." << endreq;
1451 return StatusCode::SUCCESS;
1458 MsgStream log(
msgSvc,
"MucGeoMgr");
1462 ofstream fOrigin(
"MucGas.dat", ios::out);
1463 ofstream fPos(
"MucGasPos.dat", ios::out);
1465 if( fOrigin.bad() || fPos.bad() )
1467 log << MSG::INFO <<
"Gas: create ouput file error!" << endl;
1468 return StatusCode::FAILURE;
1470 fOrigin <<
"part\tsegment\tlayer\tupDown\tgas\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
1471 fPos <<
"part\tsegment\tlayer\tupDown\tgas\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1473 int totalObject = 0;
1484 maxRpc = B_TOP_RPC_NUM;
1490 for(
int m=0; m<SL_NUM; m++ )
1492 for(
int n=0;
n<maxRpc;
n++ )
1496 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1497 << m <<
"\t" <<
n <<
"\t"
1498 << aMucGas->
GetWu() <<
"\t"
1499 << aMucGas->
GetWd() <<
"\t"
1500 << aMucGas->
GetH() <<
"\t"
1501 << aMucGas->
GetL() <<
"\t"
1510 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t" <<
n <<
"\t"
1535 for(
int m=0; m<SL_NUM; m++ )
1537 for(
int n=0;
n<E_RPC_NUM[m];
n++ )
1541 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1542 << m <<
"\t" <<
n <<
"\t"
1543 << aMucGas->
GetWu() <<
"\t"
1544 << aMucGas->
GetWd() <<
"\t"
1545 << aMucGas->
GetH() <<
"\t"
1546 << aMucGas->
GetL() <<
"\t"
1555 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1556 << m <<
"\t" <<
n <<
"\t"
1579 log << MSG::INFO << totalObject <<
"\tgases created." << endreq;
1581 return StatusCode::SUCCESS;
1588 MsgStream log(
msgSvc,
"MucGeoMgr");
1592 ofstream fOrigin(
"MucBakelite.dat", ios::out);
1593 ofstream fPos(
"MucBakelitePos.dat", ios::out);
1595 if( fOrigin.bad() || fPos.bad() )
1597 log << MSG::INFO <<
"Bakelite: create ouput file error!" << endl;
1598 return StatusCode::FAILURE;
1600 fOrigin <<
"part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
1601 <<
"Wu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z\tBes_x\tBes_y\tBes_z" << endl;
1602 fPos <<
"part\tsegment\tlayer\tupDown\trpcId\tBKLT\t"
1603 <<
"LBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1605 int totalObject = 0;
1616 maxRpc = B_TOP_RPC_NUM;
1622 for(
int m=0; m<SL_NUM; m++ )
1624 for(
int n=0;
n<maxRpc;
n++ )
1626 for(
int t=0;
t<BKLT_NUM;
t++)
1630 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1631 << m <<
"\t" <<
n <<
"\t" <<
t <<
"\t"
1632 << aMucBakelite->
GetWu() <<
"\t"
1633 << aMucBakelite->
GetWd() <<
"\t"
1634 << aMucBakelite->
GetH() <<
"\t"
1635 << aMucBakelite->
GetL() <<
"\t"
1644 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1645 << m <<
"\t" <<
n <<
"\t" <<
t <<
"\t"
1671 for(
int m=0; m<SL_NUM; m++ )
1673 for(
int n=0;
n<E_RPC_NUM[m];
n++ )
1675 for(
int t=0;
t<BKLT_NUM;
t++ )
1679 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1680 << m <<
"\t" <<
n <<
"\t" <<
t <<
"\t"
1681 << aMucBakelite->
GetWu() <<
"\t"
1682 << aMucBakelite->
GetWd() <<
"\t"
1683 << aMucBakelite->
GetH() <<
"\t"
1684 << aMucBakelite->
GetL() <<
"\t"
1693 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1694 << m <<
"\t" <<
n <<
"\t" <<
t <<
"\t"
1719 log << MSG::INFO << totalObject <<
"\tbakelites created." << endreq;
1721 return StatusCode::SUCCESS;
1728 MsgStream log(
msgSvc,
"MucGeoMgr");
1731 ofstream fOrigin(
"MucBoxCoverOrigin.dat", ios::out);
1732 ofstream fPanel(
"MucBoxCoverPanel.dat", ios::out);
1733 ofstream fPos(
"MucBoxCoverPanelPos.dat", ios::out);
1735 if( fOrigin.bad() || fPanel.bad() || fPos.bad() )
1737 log << MSG::INFO <<
"BoxCover: create ouput file error!" << endl;
1738 return StatusCode::FAILURE;
1740 fOrigin <<
"part\tsegment\tlayer\tU/D\tW\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1741 fPanel <<
"part\tsegment\tlayer\tU/D\tpanel\tWu\tWd\tH\tL\tLoc_x\tLoc_y\tLoc_z" << endl;
1742 fPos <<
"part\tsegment\tlayer\tU/D\tpanel\tLBes_x\tLBes_y\tLBes_z\tOBes_x\tOBes_y\tOBes_z\tLoc_x\tLoc_y\tLoc_z" << endl;
1744 int totalObject = 0;
1754 if( j != B_TOP ) { idMin = 0; idMax = B_GP_NUM; }
1755 else { idMin = -1; idMax = 3; }
1759 for(
int m=0; m<SL_NUM; m++ )
1761 for(
int n = idMin;
n<idMax;
n++ )
1764 if( j == B_TOP ||
n != -1 )
1766 fPanel << i <<
"\t" << j <<
"\t" << k <<
"\t"
1767 << m <<
"\t" <<
n <<
"\t"
1768 << aMucBoxCover->
GetW() <<
"\t"
1769 << aMucBoxCover->
GetW() <<
"\t"
1770 << aMucBoxCover->
GetH() <<
"\t"
1771 << aMucBoxCover->
GetL() <<
"\t"
1779 if( j != B_TOP ||
n == -1 )
1781 fOrigin << i <<
"\t" << j <<
"\t" << k <<
"\t"
1783 << aMucBoxCover->
GetW() <<
"\t"
1784 << aMucBoxCover->
GetH() <<
"\t"
1785 << aMucBoxCover->
GetL() <<
"\t"
1795 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1796 << m <<
"\t" <<
n <<
"\t"
1819 for(
int m=0; m<SL_NUM; m++ )
1821 for(
int n=-1;
n<E_PANEL_NUM;
n++ )
1826 fOrigin<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1828 << aMucBoxCover->
GetW() <<
"\t"
1829 << aMucBoxCover->
GetH() <<
"\t"
1830 << aMucBoxCover->
GetL() <<
"\t"
1840 fPanel<< i <<
"\t" << j <<
"\t" << k <<
"\t"
1841 << m <<
"\t" <<
n <<
"\t"
1842 << aMucBoxCover->
GetWu() <<
"\t"
1843 << aMucBoxCover->
GetWd() <<
"\t"
1844 << aMucBoxCover->
GetH() <<
"\t"
1845 << aMucBoxCover->
GetL() <<
"\t"
1853 fPos << i <<
"\t" << j <<
"\t" << k <<
"\t"
1854 << m <<
"\t" <<
n <<
"\t"
1877 log << MSG::INFO << totalObject <<
"\tbox_covers created." << endreq;
1879 return StatusCode::SUCCESS;
1888 if( m_MucAbsorber != NULL )
delete m_MucAbsorber;
1890 return ( m_MucAbsorber =
new MucAbsorber(part, segment, layer,
id) );
1895 if( m_MucGap != NULL )
delete m_MucGap;
1897 return ( m_MucGap =
new MucGap(part, segment, layer,
id) );
1902 if( m_MucBox != NULL )
delete m_MucBox;
1904 return ( m_MucBox =
new MucBox(part, segment, layer,
id) );
1909 if( m_MucStripPlane != NULL )
delete m_MucStripPlane;
1911 return ( m_MucStripPlane =
new MucStripPlane(part, segment, layer,
id) );
1916 if( m_MucStrip != NULL )
delete m_MucStrip;
1918 return ( m_MucStrip =
new MucStrip(part, segment, layer,
id) );
1923 if( m_MucRpc != NULL )
delete m_MucRpc;
1925 return ( m_MucRpc =
new MucRpc(part, segment, layer, upDown,
id) );
1930 if( m_MucGas != NULL )
delete m_MucGas;
1932 return ( m_MucGas =
new MucGas(part, segment, layer, upDown, rpcId,
id) );
1937 if( m_MucBakelite != NULL )
delete m_MucBakelite;
1939 return ( m_MucBakelite =
new MucBakelite(part, segment, layer, upDown, rpcId,
id) );
1944 if( m_MucBoxCover != NULL )
delete m_MucBoxCover;
1946 return ( m_MucBoxCover =
new MucBoxCover(part, segment, layer, upDown,
id) );
const unsigned int ENTITY_NUM
virtual void SetAlignment(double dx, double dy, double dz)
double GetObjRotToMot(int i)
double GetObjOrgInBes(int i)
double GetLocOrgInBes(int i)
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)
MucAbsorber * GetAbsorber(int part, int segment, int layer, int id)
MucStripPlane * GetStripPlane(int part, int segment, int layer, int id)
MucGeoMgr(const std::string createFlag, bool alignFlag, const std::string alignFile)
MucGas * GetGas(int part, int segment, int layer, int upDown, int rpcId, int id)
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)
MucBox * GetBox(int part, int segment, int layer, int id)
bool CheckBoxOffset(int part, int segment, int layer, int axis, double offset)
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)