/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/TrkExtAlg/TrkExtAlg-00-00-64/src/ExtBesEmcConstruction.cxx

Go to the documentation of this file.
00001 #include "TrkExtAlg/ExtBesEmcConstruction.h"
00002 
00003 #include "G4ThreeVector.hh"
00004 #include "G4PVPlacement.hh"
00005 #include "G4LogicalVolume.hh"
00006 #include "G4VPhysicalVolume.hh"
00007 
00008 //For code construction --------------------
00009 #include "G4ReflectionFactory.hh"
00010 
00011 //#include "BesEmcConstruction.hh"
00012 //#include "BesEmcDetectorMessenger.hh"
00013 #include "TrkExtAlg/ExtBesEmcGeometry.h"
00014 #include "TrkExtAlg/ExtBesCrystalParameterisation.h"
00015 #include "TrkExtAlg/ExtBesEmcEndGeometry.h"
00016 //#include "ReadBoostRoot.hh"
00017 
00018 //#include "BesEmcSD.hh"
00019 #include "G4IrregBox.hh"
00020 #include "G4Box.hh"
00021 #include "G4Transform3D.hh"
00022 #include "G4Tubs.hh"
00023 #include "G4Cons.hh"
00024 #include "G4Trap.hh"
00025 #include "G4UnionSolid.hh"
00026 #include "G4SubtractionSolid.hh"
00027 #include "G4Polyhedra.hh"
00028 //#include "G4LogicalVolume.hh"
00029 //#include "G4VPhysicalVolume.hh"
00030 #include "G4Material.hh"
00031 //#include "G4PVPlacement.hh"
00032 #include "G4PVParameterised.hh"
00033 #include "G4PVReplica.hh"
00034 #include "globals.hh"
00035 #include "G4UniformMagField.hh"
00036 #include "G4FieldManager.hh"
00037 #include "G4TransportationManager.hh"
00038 #include "G4SDManager.hh"
00039 #include "G4RunManager.hh"
00040 #include "G4VisAttributes.hh"
00041 #include "G4Color.hh"
00042 
00043 #include "G4ios.hh"
00044 //--------------------------------------------
00045 #include "G4Geo/EmcG4Geo.h"
00046 
00047 
00048 ExtBesEmcConstruction* ExtBesEmcConstruction::fBesEmcConstruction=0;
00049 
00050 ExtBesEmcConstruction::ExtBesEmcConstruction()
00051    :verboseLevel(0),
00052    solidEMC(0),logicEMC(0),physiEMC(0),
00053    solidBSCPhi(0),logicBSCPhi(0),physiBSCPhi(0),
00054    solidBSCTheta(0),logicBSCTheta(0),physiBSCTheta(0),
00055    solidBSCCrystal(0),logicBSCCrystal(0),physiBSCCrystal(0),
00056    magField(0),detectorMessenger(0),
00057    besEMCSD(0),crystalParam(0) 
00058 {
00059         if(!fBesEmcConstruction) fBesEmcConstruction=this;
00060         
00061         startID           = 1;
00062         phiNbCrystals     = 0;
00063         thetaNbCrystals   = 0;
00064         besEMCGeometry = new ExtBesEmcGeometry();
00065         emcEnd = new ExtBesEmcEndGeometry();    
00066 }
00067 
00068 ExtBesEmcConstruction::~ExtBesEmcConstruction() 
00069 {
00070   if(crystalParam) delete crystalParam;
00071   if(besEMCGeometry) delete besEMCGeometry;
00072   if(emcEnd) delete emcEnd;
00073 }
00074 
00075 void ExtBesEmcConstruction::Construct(G4LogicalVolume* logicBes)
00076 {
00077   /*
00078         G4String GeometryPath = getenv("SIMUTILROOT");
00079         GeometryPath+="/dat/Emc.gdml";
00080         
00081         m_config.SetURI(GeometryPath);
00082         m_config.SetSetupName( "Emc" );
00083         m_config.SetSetupVersion( "1.0" );
00084         m_config.SetType( "G4" );
00085         m_sxp.Configure(&m_config);
00086         m_sxp.Initialize();
00087 
00088         //construct Emc
00089         m_sxp.Run();
00090 
00091         logicalEmc = FindLogicalVolume("logicalEmc");
00092         physicalEmc = new G4PVPlacement(0,G4ThreeVector(0.0 ,0.0 ,0.0),logicalEmc, "BSC",logicBes, false, 0);
00093 
00094         m_sxp.Finalize();
00095   */
00096 
00097 //new version of geometry construction from gdml  
00098   logicEMC = EmcG4Geo::Instance()->GetTopVolume();
00099   if(logicEMC) physiEMC = new G4PVPlacement(0,G4ThreeVector(0.0 ,0.0 ,0.0),logicEMC, "physicalEMC",logicBes, false, 0);
00100 
00101   
00102 //geometry construction by code
00103 /*
00104   besEMCGeometry->ComputeEMCParameters();
00105   emcEnd->ComputeParameters();
00106   DefineMaterials();
00107   phiNbCrystals     = (*besEMCGeometry).BSCNbPhi;
00108     thetaNbCrystals   = (*besEMCGeometry).BSCNbTheta*2;
00109     //
00110     //BSC
00111     //
00112     //G4cout << "Acquired " << G4Material::GetMaterial("Air") << G4endl;
00113         
00114     solidBSC = new G4Tubs("BSC",
00115       (*besEMCGeometry).TaperRingRmin1,
00116       (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness+(*besEMCGeometry).SPBarThickness1,
00117       (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz,
00118                         0.*deg,
00119                         360.*deg);
00120 
00121     solidESC = new G4Tubs("ESC",(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,(*emcEnd).WorldDz/2,0.*deg,360.*deg);
00122 
00123     solidEMC = new G4UnionSolid("EMC",
00124         solidBSC,
00125         solidESC,
00126         0,
00127         G4ThreeVector(0,0,(*emcEnd).WorldZPosition));
00128 
00129     solidEMC = new G4UnionSolid("EMC",
00130         solidEMC,
00131         solidESC,
00132         0,
00133         G4ThreeVector(0,0,-(*emcEnd).WorldZPosition));
00134     
00135     logicEMC = new G4LogicalVolume(solidEMC,
00136                          G4Material::GetMaterial("Air"),
00137                          "EMC");
00138     
00139     physiEMC = new G4PVPlacement(0,
00140         0,
00141         logicEMC,
00142         "EMC",
00143         logicBes,
00144         false,
00145         0);
00146 
00147     //  G4RotationMatrix *rotateMatrixBSC;
00148     //  rotateMatrixBSC = new G4RotationMatrix();
00149     //  G4ThreeVector newAxisX=G4ThreeVector(1.,0,0);
00150     //  G4ThreeVector newAxisY=G4ThreeVector(0,-1.,0);
00151     //  G4ThreeVector newAxisZ=G4ThreeVector(0,0,-1.);
00152     //  rotateMatrixBSC->rotateAxes(newAxisX,newAxisY,newAxisZ);
00153     //  rotateMatrixBSC->rotateX(180.*deg);
00154     //  physiBSC = new G4PVPlacement(rotateMatrixBSC,
00155     //                 G4ThreeVector(0,0,-BSCDz/2.),
00156     //                 "BSC",
00157     //                 logicBSC,
00158     //                 logicEMC,
00159     //                 false,
00160     //                 1);
00161     //
00162     // Phi Cell
00163     solidBSCPhiTub = new G4Tubs(
00164                            "BSCPhiTub",
00165                            (*besEMCGeometry).BSCRmin,
00166                            (*besEMCGeometry).BSCPhiRmax,
00167                            (*besEMCGeometry).BSCDz,
00168                            360.*deg-(*besEMCGeometry).BSCPhiDphi,
00169                            (*besEMCGeometry).BSCPhiDphi);
00170     solidConsPhi = new G4Cons("consPhi",
00171          (*besEMCGeometry).BSCRmin1,
00172          (*besEMCGeometry).BSCRmax1,
00173          (*besEMCGeometry).BSCRmin2,
00174          (*besEMCGeometry).BSCRmax2,
00175          (*besEMCGeometry).BSCDz1/2,
00176          0.*deg,
00177          360.*deg);
00178     solidBSCPhi1 = new G4SubtractionSolid("BSCPhi1",
00179          solidBSCPhiTub,
00180          solidConsPhi,
00181          0,
00182          G4ThreeVector(0,0,(*besEMCGeometry).BSCDz-(*besEMCGeometry).BSCDz1/2));
00183     solidConsPhi = new G4Cons("consPhi",
00184          (*besEMCGeometry).BSCRmin2,
00185          (*besEMCGeometry).BSCRmax2,
00186          (*besEMCGeometry).BSCRmin1,
00187          (*besEMCGeometry).BSCRmax1,
00188          (*besEMCGeometry).BSCDz1/2,
00189          0.*deg,
00190          360.*deg);
00191     solidBSCPhi = new G4SubtractionSolid("BSCPhi",
00192          solidBSCPhi1,
00193          solidConsPhi,
00194          0,
00195          G4ThreeVector(0,0,(*besEMCGeometry).BSCDz1/2-(*besEMCGeometry).BSCDz));
00196   
00197     logicBSCPhi = new G4LogicalVolume(solidBSCPhi,
00198                                     G4Material::GetMaterial("Air"),
00199                                     "BSCPhi");
00200 
00201     //new geometry by Fu Chengdong
00202     G4RotationMatrix *rotateMatrix[200];
00203     G4double oOp,ox,oy,oz;  
00204     G4int i;
00205     G4double delta = 0*deg;
00206     G4ThreeVector axis = G4ThreeVector(0,0,0);
00207     oOp=(*besEMCGeometry).BSCRmin/sin(0.5*(*besEMCGeometry).BSCPhiDphi+90*deg)
00208       *sin((*besEMCGeometry).BSCAngleRotat);
00209     G4double ll=(*besEMCGeometry).BSCCryLength;
00210     G4double rr=(*besEMCGeometry).BSCRmin;
00211     G4double oj=sqrt(ll*ll+rr*rr-2*ll*rr*cos(180.*deg-(*besEMCGeometry).BSCAngleRotat));
00212     G4double oij=90.*deg-(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat;
00213     G4double doj=asin(sin(180.*deg-(*besEMCGeometry).BSCAngleRotat)/oj*ll);
00214     G4double ioj=(*besEMCGeometry).BSCPhiDphi/2.+doj;
00215     G4double ij=oj/sin(oij)*sin(ioj);
00216     G4double dOp=rr/sin(90.*deg-(*besEMCGeometry).BSCPhiDphi/2.)
00217       *sin(90.*deg+(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat);
00218     G4double cOp=rr/sin(90.*deg+(*besEMCGeometry).BSCPhiDphi/2.)
00219       *sin(90.*deg-(*besEMCGeometry).BSCPhiDphi/2.-(*besEMCGeometry).BSCAngleRotat);
00220     G4double ch=(dOp+ll)/cos((*besEMCGeometry).BSCPhiDphi)-cOp;
00221     G4double hi=(dOp+ll)*tan((*besEMCGeometry).BSCPhiDphi)-ij;
00222     G4double oh=sqrt(ch*ch+rr*rr-2*ch*rr*cos(180*deg-(*besEMCGeometry).BSCAngleRotat));
00223     G4double hoi=asin(sin(180*deg-oij)/oh*hi);
00224     G4double dok=asin(sin(180*deg-(*besEMCGeometry).BSCAngleRotat)/oh*ch);
00225     
00226     i=1;
00227     for(i=1;i<=(*besEMCGeometry).BSCNbPhi;i++)
00228     {
00229       rotateMatrix[i-1] = new G4RotationMatrix();
00230       rotateMatrix[i-1]->rotateZ(-(i-1)*(*besEMCGeometry).BSCPhiDphi
00231           -(*besEMCGeometry).BSCAngleRotat
00232           -(*besEMCGeometry).BSCPhiDphi/2.
00233           -hoi);
00234       rotateMatrix[i-1]->getAngleAxis(delta, axis);
00235       //G4cout << "The axis of crystals in the world system is: "
00236       //   << delta/deg << "(deg)(delta) "
00237       //<< axis  << "(Z axis)"<< G4endl;
00238       ox=oOp*cos(-90.*deg+(*besEMCGeometry).BSCAngleRotat
00239           +(i-1)*(*besEMCGeometry).BSCPhiDphi);
00240       oy=oOp*sin(-90.*deg+(*besEMCGeometry).BSCAngleRotat
00241           +(i-1)*(*besEMCGeometry).BSCPhiDphi);
00242       oz=0*cm;
00243       physiBSCPhi = new G4PVPlacement(rotateMatrix[i-1],
00244           G4ThreeVector(ox,oy,oz),
00245           logicBSCPhi,
00246           "BSCPhi",
00247           logicEMC,
00248           false,
00249           i-1);
00250     }
00251 */      
00252       /*  
00253   G4RotationMatrix *rotateMatrix[200];
00254   //  rotateMatrix = new G4RotationMatrix();
00255   //  rotateMatrix->rotateZ(BSCAngleRotat-BSCPhiDphi);
00256   G4double oOp,ox,oy,oz; 
00257   G4int i;
00258   G4double delta = 0*deg;
00259   G4ThreeVector axis = G4ThreeVector(0,0,0);
00260   oOp=(*besEMCGeometry).BSCRmin/sin(0.5*(*besEMCGeometry).BSCPhiDphi+90*deg)
00261     *sin((*besEMCGeometry).BSCAngleRotat);
00262   i=1;
00263   for(i=1;i<=(*besEMCGeometry).BSCNbPhi;i++)
00264     {
00265       rotateMatrix[i-1] = new G4RotationMatrix();
00266       rotateMatrix[i-1]->rotateZ(-(i-1)*(*besEMCGeometry).BSCPhiDphi
00267                                  +(*besEMCGeometry).BSCAngleRotat
00268                                  +(*besEMCGeometry).BSCPhiDphi/2.);
00269       rotateMatrix[i-1]->getAngleAxis(delta, axis);
00270       //G4cout << "The axis of crystals in the world system is: "
00271         //   << delta/deg << "(deg)(delta) "
00272              //<< axis  << "(Z axis)"<< G4endl;
00273         ox=oOp*cos(90.*deg-(*besEMCGeometry).BSCAngleRotat
00274                    +(i-1)*(*besEMCGeometry).BSCPhiDphi);
00275         oy=oOp*sin(90.*deg-(*besEMCGeometry).BSCAngleRotat
00276                    +(i-1)*(*besEMCGeometry).BSCPhiDphi);
00277         oz=0*cm;
00278         physiBSCPhi = new G4PVPlacement(rotateMatrix[i-1],
00279                                         G4ThreeVector(ox,oy,oz),
00280           logicBSCPhi,
00281                                         "BSCPhi",
00282                                         logicEMC,
00283                                         false,
00284                                         i);
00285         //G4cout << G4ThreeVector(ox/cm,oy/cm,oz/cm) <<"(cm)" << G4endl
00286           //   << (-(*besEMCGeometry).BSCAngleRotat+(i-1)*(*besEMCGeometry).BSCPhiDphi)/deg <<"(degree)" << G4endl;
00287      }*/
00288     //
00289     //Crystals
00290     //
00291 /*    G4double zHalfLength[50];
00292     G4double thetaAxis[50];
00293     G4double phiAxis[50];
00294     G4double yHalfLength1[50];
00295     G4double xHalfLength2[50];
00296     G4double xHalfLength1[50];
00297     G4double tanAlpha1[50];
00298     G4double yHalfLength2[50];
00299     G4double xHalfLength4[50];
00300     G4double xHalfLength3[50];
00301     G4double tanAlpha2[50];
00302     G4double xPosition[50];
00303     G4double yPosition[50];
00304     G4double zPosition[50];
00305     G4double thetaPosition[50];
00306     for(i=0;i<(*besEMCGeometry).BSCNbTheta;i++)
00307       {
00308               zHalfLength[i]  = (*besEMCGeometry).zHalfLength[i];
00309               thetaAxis[i]    = (*besEMCGeometry).thetaAxis[i];
00310               phiAxis[i]      = (*besEMCGeometry).phiAxis[i];
00311               yHalfLength1[i] = (*besEMCGeometry).yHalfLength1[i];
00312               xHalfLength2[i] = (*besEMCGeometry).xHalfLength2[i];
00313         xHalfLength1[i] = (*besEMCGeometry).xHalfLength1[i];
00314               tanAlpha1[i]    = (*besEMCGeometry).tanAlpha1[i];
00315               yHalfLength2[i] = (*besEMCGeometry).yHalfLength2[i];
00316               xHalfLength4[i] = (*besEMCGeometry).xHalfLength4[i];
00317               xHalfLength3[i] = (*besEMCGeometry).xHalfLength3[i];
00318               tanAlpha2[i]    = (*besEMCGeometry).tanAlpha2[i];
00319               xPosition[i]    = (*besEMCGeometry).xPosition[i];
00320               yPosition[i]    = (*besEMCGeometry).yPosition[i];
00321               zPosition[i]    = (*besEMCGeometry).zPosition[i];
00322               thetaPosition[i]= (*besEMCGeometry).thetaPosition[i];
00323       }
00324     
00325     besEMCGeometry->ModifyForCasing();
00326     
00327     solidBSCCrystal = new G4Trap("Crystal",
00328                                  100*cm, 100*deg, 100*deg,
00329                                  100*cm, 100*cm,  100*cm,  100*deg,
00330                                  100*cm, 100*cm,  100*cm,  100*deg);
00331     
00332     logicBSCCrystal = new G4LogicalVolume(solidBSCCrystal,
00333                                           fCrystalMaterial,
00334                                           "Crystal");
00335     
00336     crystalParam = new ExtBesCrystalParameterisation
00337     (startID,
00338      thetaNbCrystals,
00339      (*besEMCGeometry).BSCNbTheta*2,
00340      besEMCGeometry,
00341      verboseLevel);
00342 
00343     //---------------------------------------------------------------------------------
00344     //rear substance
00345     solidRear = new G4Box("RearBox",
00346         (*besEMCGeometry).rearBoxLength/2,
00347         (*besEMCGeometry).rearBoxLength/2,
00348         (*besEMCGeometry).rearBoxDz/2);
00349 
00350     logicRear = new G4LogicalVolume(solidRear,
00351         G4Material::GetMaterial("Air"),
00352         "RearBox");
00353 
00354     //organic glass
00355     solidOrgGlass = new G4Box("OrganicGlass",
00356         (*besEMCGeometry).orgGlassLengthX/2,
00357         (*besEMCGeometry).orgGlassLengthY/2,
00358         (*besEMCGeometry).orgGlassLengthZ/2);
00359 
00360     logicOrgGlass = new G4LogicalVolume(solidOrgGlass,
00361         organicGlass,
00362         "OrganicGlass");
00363 
00364     physiOrgGlass = new G4PVPlacement(0,
00365         G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz-(*besEMCGeometry).orgGlassLengthZ)/2),
00366         logicOrgGlass,
00367         "OrganicGlass",
00368         logicRear,
00369         false,
00370         0);
00371 
00372     //casing
00373     solidCasingBox = new G4Box("CasingBox",
00374         (*besEMCGeometry).rearBoxLength/2,
00375         (*besEMCGeometry).rearBoxLength/2,
00376         (*besEMCGeometry).rearCasingThickness/2);
00377 
00378     solidAirHole = new G4Box("AirHole",
00379         (*besEMCGeometry).orgGlassLengthX/2,
00380         (*besEMCGeometry).orgGlassLengthY/2,
00381         (*besEMCGeometry).rearBoxDz/2);      //any value more than casing thickness
00382 
00383     solidRearCasing = new G4SubtractionSolid("RearCasing",
00384         solidCasingBox,
00385         solidAirHole,
00386         0,
00387         0);
00388 
00389     logicRearCasing = new G4LogicalVolume(solidRearCasing,
00390         rearCasingMaterial,
00391         "RearCasing");
00392 
00393     physiRearCasing = new G4PVPlacement(0,
00394         G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz-(*besEMCGeometry).rearCasingThickness)/2),
00395         logicRearCasing,
00396         "RearCasing",
00397         logicRear,
00398         false,
00399         0);
00400 
00401     //Al Plate
00402     solidAlBox = new G4Box("AlBox",
00403         (*besEMCGeometry).rearBoxLength/2,
00404         (*besEMCGeometry).rearBoxLength/2,
00405         (*besEMCGeometry).AlPlateDz/2);
00406 
00407     solidAlPlate = new G4SubtractionSolid("AlPlate",
00408         solidAlBox,
00409         solidAirHole,
00410         0,
00411         0);
00412 
00413     logicAlPlate = new G4LogicalVolume(solidAlPlate,
00414         G4Material::GetMaterial("Aluminium"),
00415         "AlPlate");
00416 
00417     physiAlPlate = new G4PVPlacement(0,
00418         G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
00419                             -(*besEMCGeometry).rearCasingThickness
00420                             -(*besEMCGeometry).AlPlateDz/2)),
00421         logicAlPlate,
00422         "AlPlate",
00423         logicRear,
00424         false,
00425         0);
00426 
00427     //photodiode
00428     solidPD = new G4Box("PD",
00429         (*besEMCGeometry).PDLengthX,     //two PD
00430         (*besEMCGeometry).PDLengthY/2,
00431         (*besEMCGeometry).PDLengthZ/2);
00432 
00433     logicPD = new G4LogicalVolume(solidPD,
00434         G4Material::GetMaterial("Silicon"),
00435         "PD");
00436 
00437     physiPD = new G4PVPlacement(0,
00438          G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
00439                              -(*besEMCGeometry).orgGlassLengthZ
00440                              -(*besEMCGeometry).PDLengthZ/2)),
00441          logicPD,
00442          "PD",
00443          logicRear,
00444          false,
00445          0);
00446 
00447     //preamplifier box
00448     solidPreAmpBox = new G4Box("PreAmpBox",
00449         (*besEMCGeometry).rearBoxLength/2,
00450         (*besEMCGeometry).rearBoxLength/2,
00451         (*besEMCGeometry).PABoxDz/2);
00452 
00453     logicPreAmpBox = new G4LogicalVolume(solidPreAmpBox,
00454         G4Material::GetMaterial("Aluminium"),
00455         "PreAmpBox");
00456 
00457     physiPreAmpBox = new G4PVPlacement(0,
00458         G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
00459                             -(*besEMCGeometry).rearCasingThickness
00460                             -(*besEMCGeometry).AlPlateDz
00461                             -(*besEMCGeometry).PABoxDz/2)),
00462         logicPreAmpBox,
00463         "PreAmpBox",
00464         logicRear,
00465         false,
00466         0);
00467 
00468     //air in preamplifier box
00469     solidAirInPABox = new G4Box("AirInPABox",
00470         (*besEMCGeometry).rearBoxLength/2-(*besEMCGeometry).PABoxThickness,
00471         (*besEMCGeometry).rearBoxLength/2-(*besEMCGeometry).PABoxThickness,
00472         (*besEMCGeometry).PABoxDz/2-(*besEMCGeometry).PABoxThickness);
00473 
00474     logicAirInPABox = new G4LogicalVolume(solidAirInPABox,
00475         G4Material::GetMaterial("Air"),
00476         "AirInPABox");
00477     
00478     physiAirInPABox = new G4PVPlacement(0,
00479         0,
00480         logicAirInPABox,
00481         "AirInPABox",
00482         logicPreAmpBox,
00483         false,
00484         0);
00485 
00486     //stainless steel for hanging the crystal
00487     solidHangingPlate = new G4Box("HangingPlate",
00488         (*besEMCGeometry).rearBoxLength/2,
00489         (*besEMCGeometry).rearBoxLength/2,
00490         (*besEMCGeometry).HangingPlateDz/2);
00491 
00492     logicHangingPlate = new G4LogicalVolume(solidHangingPlate,stainlessSteel,"HangingPlate");
00493 
00494     physiHangingPlate = new G4PVPlacement(0,
00495         G4ThreeVector(0,0,-((*besEMCGeometry).rearBoxDz/2
00496             -(*besEMCGeometry).rearCasingThickness
00497             -(*besEMCGeometry).AlPlateDz
00498             -(*besEMCGeometry).PABoxDz
00499             -(*besEMCGeometry).HangingPlateDz/2)),
00500         logicHangingPlate,
00501         "HangingPlate",
00502         logicRear,
00503         false,
00504         0);
00505 
00506     //water pipe
00507     solidWaterPipe = new G4Tubs("WaterPipe",
00508         0,
00509         (*besEMCGeometry).waterPipeDr,
00510         (*besEMCGeometry).BSCDz,
00511         0.*deg,
00512         360.*deg);
00513 
00514     logicWaterPipe = new G4LogicalVolume(solidWaterPipe,stainlessSteel,"WaterPipe");
00515     
00516     physiWaterPipe = new G4PVPlacement(0,
00517         G4ThreeVector((*besEMCGeometry).cablePosX[0]-2*(*besEMCGeometry).cableDr,
00518           (*besEMCGeometry).cablePosY[0]-(*besEMCGeometry).cableDr-(*besEMCGeometry).waterPipeDr,
00519           0),
00520         logicWaterPipe,
00521         "WaterPipe",
00522         logicBSCPhi,
00523         false,
00524         0);
00525     //---------------------------------------------------------------------------------
00526     
00527     //
00528     //Theta Cell
00529     //
00530     G4String nameCrystalAndCasing="CrystalAndCasing";
00531     G4int id=0;     //ID of crystals after distinguishing left and right
00532     for(i=startID;i<=thetaNbCrystals;i++)
00533       {
00534         if(i>(*besEMCGeometry).BSCNbTheta)
00535           {
00536             id=i-(*besEMCGeometry).BSCNbTheta-1;
00537             solidBSCTheta = new G4Trap(nameCrystalAndCasing,
00538                                        zHalfLength[id],
00539                                      thetaAxis[id],
00540                                        -phiAxis[id],
00541                                        yHalfLength1[id],
00542                                        xHalfLength2[id],
00543                                        xHalfLength1[id],
00544                                        -tanAlpha1[id],
00545                                        yHalfLength2[id],
00546                                        xHalfLength4[id],
00547                                        xHalfLength3[id],
00548                                        -tanAlpha2[id]);
00549             
00550           logicBSCTheta = new G4LogicalVolume(solidBSCTheta,
00551                                               fCasingMaterial,
00552                                               nameCrystalAndCasing);
00553           
00554           rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1] = new G4RotationMatrix();
00555           rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]->rotateZ(-90*deg);
00556           rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]
00557             ->rotateX(-thetaPosition[id]);
00558           physiBSCTheta = 
00559             new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
00560                               G4ThreeVector(xPosition[id],
00561                                             yPosition[id],
00562                                             zPosition[id]),
00563                               nameCrystalAndCasing,
00564                               logicBSCTheta,
00565                               physiBSCPhi,
00566                               false,
00567                               thetaNbCrystals-i);
00568           if(logicBSCTheta)
00569             logicBSCTheta->SetVisAttributes(G4VisAttributes::Invisible);
00570 
00571     if(id<(*besEMCGeometry).BSCNbTheta-1)
00572     {
00573       physiRear = new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
00574         G4ThreeVector((*besEMCGeometry).rearBoxPosX[id],
00575           (*besEMCGeometry).rearBoxPosY[id],
00576           (*besEMCGeometry).rearBoxPosZ[id]),
00577         "RearBox",
00578         logicRear,
00579         physiBSCPhi,
00580         false,
00581         thetaNbCrystals-i);
00582 
00583       solidOCGirder = new G4Cons("OpenningCutGirder",
00584         (*besEMCGeometry).OCGirderRmin1[id],
00585         (*besEMCGeometry).BSCPhiRmax,
00586         (*besEMCGeometry).OCGirderRmin2[id],
00587         (*besEMCGeometry).BSCPhiRmax,
00588         (*besEMCGeometry).OCGirderDz[id]/2,
00589         360.*deg-(*besEMCGeometry).OCGirderAngle/2,
00590         (*besEMCGeometry).OCGirderAngle/2);
00591 
00592       logicOCGirder = new G4LogicalVolume(solidOCGirder,stainlessSteel,"OpenningCutGirder");
00593       //logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
00594     
00595       physiOCGirder = new G4PVPlacement(0,
00596         G4ThreeVector(0,0,(*besEMCGeometry).OCGirderPosZ[id]),
00597         logicOCGirder,
00598         "OpenningCutGirder",
00599         logicBSCPhi,
00600         false,
00601         0);
00602       
00603       G4double zLength = (*besEMCGeometry).OCGirderPosZ[id+1]-(*besEMCGeometry).OCGirderPosZ[id]
00604         -(*besEMCGeometry).OCGirderDz[id+1]/2-(*besEMCGeometry).OCGirderDz[id]/2;
00605       G4double zPosition = (*besEMCGeometry).OCGirderPosZ[id+1]-(*besEMCGeometry).OCGirderDz[id+1]/2-zLength/2;
00606       
00607       solidOCGirder = new G4Cons("OpenningCutGirder",
00608           (*besEMCGeometry).OCGirderRmin2[id],
00609           (*besEMCGeometry).BSCPhiRmax,
00610           (*besEMCGeometry).OCGirderRmin1[id+1],
00611           (*besEMCGeometry).BSCPhiRmax,
00612           zLength/2,
00613           360.*deg-(*besEMCGeometry).OCGirderAngle/2,
00614           (*besEMCGeometry).OCGirderAngle/2);
00615       
00616       logicOCGirder = new G4LogicalVolume(solidOCGirder,stainlessSteel,"OpenningCutGirder");
00617       //logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
00618 
00619       physiOCGirder = new G4PVPlacement(0,
00620           G4ThreeVector(0,0,zPosition),
00621           logicOCGirder,
00622           "OpenningCutGirder",
00623           logicBSCPhi,
00624           false,
00625           0);
00626     }
00627     
00628     solidCable = new G4Tubs("BSCCable",
00629         0,
00630         (*besEMCGeometry).cableDr,
00631         (*besEMCGeometry).cableLength[id]/2,
00632         0.*deg,
00633         360.*deg);
00634 
00635     logicCable = new G4LogicalVolume(solidCable,cable,"BSCCable");
00636 
00637     physiCable = new G4PVPlacement(0,
00638         G4ThreeVector((*besEMCGeometry).cablePosX[id],
00639           (*besEMCGeometry).cablePosY[id],
00640           (*besEMCGeometry).cablePosZ[id]),
00641         logicCable,
00642         "BSCCable",
00643         logicBSCPhi,
00644         false,
00645         0);
00646     //logicCable->SetVisAttributes(G4VisAttributes::Invisible);
00647   
00648           }
00649         else
00650           {
00651             id=(*besEMCGeometry).BSCNbTheta-i;
00652             solidBSCTheta = new G4Trap(nameCrystalAndCasing,
00653                                        zHalfLength[id],
00654                                        thetaAxis[id],
00655                                        phiAxis[id],
00656                                        yHalfLength1[id],
00657                                        xHalfLength1[id],
00658                                        xHalfLength2[id],
00659                                        tanAlpha1[id],
00660                                        yHalfLength2[id],
00661                                        xHalfLength3[id],
00662                                        xHalfLength4[id],
00663                                        tanAlpha2[id]);
00664             
00665             logicBSCTheta = new G4LogicalVolume(solidBSCTheta,
00666                                                 fCasingMaterial,
00667                                                 nameCrystalAndCasing);
00668             
00669             rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1] = new G4RotationMatrix();
00670             rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]->rotateZ(-90*deg);
00671             rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1]
00672               ->rotateX(-180*deg+thetaPosition[id]);
00673             physiBSCTheta = 
00674               new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
00675                                 G4ThreeVector(xPosition[id],
00676           yPosition[id],
00677           -zPosition[id]),
00678                                 nameCrystalAndCasing,
00679                                 logicBSCTheta,
00680                                 physiBSCPhi,
00681                                 false,
00682                                 thetaNbCrystals-i);
00683             if(logicBSCTheta)
00684               {
00685                 //G4VisAttributes* rightVisAtt= new G4VisAttributes(G4Colour(1.0,0.,0.));
00686                 //rightVisAtt->SetVisibility(true);
00687                 //logicBSCTheta->SetVisAttributes(rightVisAtt);
00688                 //logicBSCTheta->SetVisAttributes(G4VisAttributes::Invisible);
00689               }
00690       
00691       if(id<(*besEMCGeometry).BSCNbTheta-1)
00692       {
00693     physiRear = new G4PVPlacement(rotateMatrix[(*besEMCGeometry).BSCNbPhi+i-1],
00694         G4ThreeVector((*besEMCGeometry).rearBoxPosX[id],
00695           (*besEMCGeometry).rearBoxPosY[id],
00696           -(*besEMCGeometry).rearBoxPosZ[id]),
00697         "RearBox",
00698         logicRear,
00699         physiBSCPhi,
00700         false,
00701         thetaNbCrystals-i);
00702     
00703           solidOCGirder = new G4Cons("OpenningCutGirder",
00704         (*besEMCGeometry).OCGirderRmin2[id],
00705         (*besEMCGeometry).BSCPhiRmax,
00706         (*besEMCGeometry).OCGirderRmin1[id],
00707         (*besEMCGeometry).BSCPhiRmax,
00708         (*besEMCGeometry).OCGirderDz[id]/2,
00709         360.*deg-(*besEMCGeometry).OCGirderAngle/2,
00710         (*besEMCGeometry).OCGirderAngle/2);
00711 
00712     logicOCGirder = new G4LogicalVolume(solidOCGirder,stainlessSteel,"OpenningCutGirder");
00713     //logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
00714     
00715     physiOCGirder = new G4PVPlacement(0,
00716         G4ThreeVector(0,0,-(*besEMCGeometry).OCGirderPosZ[id]),
00717         logicOCGirder,
00718         "OpenningCutGirder",
00719         logicBSCPhi,
00720         false,
00721         0);
00722     
00723     G4double zLength = (*besEMCGeometry).OCGirderPosZ[id+1]-(*besEMCGeometry).OCGirderPosZ[id]
00724       -(*besEMCGeometry).OCGirderDz[id+1]/2-(*besEMCGeometry).OCGirderDz[id]/2;
00725     G4double zPosition = (*besEMCGeometry).OCGirderPosZ[id+1]-(*besEMCGeometry).OCGirderDz[id+1]/2-zLength/2;
00726       
00727     solidOCGirder = new G4Cons("OpenningCutGirder",
00728         (*besEMCGeometry).OCGirderRmin1[id+1],
00729         (*besEMCGeometry).BSCPhiRmax,
00730         (*besEMCGeometry).OCGirderRmin2[id],
00731         (*besEMCGeometry).BSCPhiRmax,
00732         zLength/2,
00733         360.*deg-(*besEMCGeometry).OCGirderAngle/2,
00734         (*besEMCGeometry).OCGirderAngle/2);
00735       
00736     logicOCGirder = new G4LogicalVolume(solidOCGirder,stainlessSteel,"OpenningCutGirder");
00737     //logicOCGirder->SetVisAttributes(G4VisAttributes::Invisible);
00738 
00739     physiOCGirder = new G4PVPlacement(0,
00740         G4ThreeVector(0,0,-zPosition),
00741         logicOCGirder,
00742         "OpenningCutGirder",
00743         logicBSCPhi,
00744         false,
00745         0);
00746       }
00747     
00748           solidCable = new G4Tubs("BSCCable",
00749         0,
00750         (*besEMCGeometry).cableDr,
00751         (*besEMCGeometry).cableLength[id]/2,
00752         0.*deg,
00753         360.*deg);
00754 
00755     logicCable = new G4LogicalVolume(solidCable,cable,"BSCCable");
00756 
00757     physiCable = new G4PVPlacement(0,
00758         G4ThreeVector((*besEMCGeometry).cablePosX[id],
00759           (*besEMCGeometry).cablePosY[id],
00760           -(*besEMCGeometry).cablePosZ[id]),
00761         logicCable,
00762         "BSCCable",
00763         logicBSCPhi,
00764         false,
00765         0);
00766     //logicCable->SetVisAttributes(G4VisAttributes::Invisible);
00767           }
00768 
00769         physiBSCCrystal = new G4PVParameterised(
00770                                               "Crystal",
00771                                               logicBSCCrystal,
00772                                               physiBSCTheta,
00773                                               kZAxis,
00774                                               1,//for this method,it must be 1.
00775                                               crystalParam);
00776         (*besEMCGeometry).physiBSCCrystal[i]=physiBSCCrystal;
00777         //G4cout << (*besEMCGeometry).physiBSCCrystal[i] << G4endl;
00778         physiBSCCrystal->SetCopyNo(thetaNbCrystals-i);
00779         if(verboseLevel>4)
00780         G4cout << "BesEmcConstruction*****************************"<< G4endl
00781                << "point of crystal =" <<physiBSCCrystal << G4endl
00782           //           << "point of mother  =" <<physiBSCCrystal->GetMotherPhysical() << G4endl
00783                << "point of excepted=" <<physiBSCTheta << G4endl;
00784         //G4Exception("BesEMCConstruction::Construct() starting............");
00785       }
00786 */    
00787     //                               
00788     // Sensitive Detectors: Absorber and Gap
00789     //
00790     //if (logicBSCCrystal)
00791     //  logicBSCCrystal->SetSensitiveDetector(besEMCSD);
00792     
00793     //                                        
00794     // Visualization attributes
00795     //
00796     /*    if(logicEMC)
00797       {
00798         G4VisAttributes* bscVisAtt= new G4VisAttributes(G4Colour(0.5,0.5,0.5));
00799         bscVisAtt->SetVisibility(false);
00800         logicEMC->SetVisAttributes(bscVisAtt);
00801         //logicBSC->SetVisAttributes(G4VisAttributes::Invisible);
00802       }
00803     if(logicBSCPhi)
00804       {
00805         G4VisAttributes* rightVisAtt= new G4VisAttributes(G4Colour(1.0,0.,1.0));
00806         rightVisAtt->SetVisibility(false);
00807         logicBSCPhi->SetVisAttributes(rightVisAtt);
00808         //logicBSCPhi->SetVisAttributes(G4VisAttributes::Invisible);
00809       }
00810     if(logicBSCCrystal)
00811       {
00812         G4VisAttributes* crystalVisAtt= new G4VisAttributes(G4Colour(0,0,1.0));
00813         crystalVisAtt->SetVisibility(true);
00814         logicBSCCrystal->SetVisAttributes(crystalVisAtt);
00815         //logicBSCCrystal->SetVisAttributes(G4VisAttributes::Invisible);
00816       }
00817     if(logicOrgGlass)
00818     {
00819       G4VisAttributes* glassVisAtt = new G4VisAttributes(G4Colour(0.5,1.0,1.0));
00820       glassVisAtt->SetVisibility(false);
00821       logicOrgGlass->SetVisAttributes(glassVisAtt);
00822     }
00823     if(logicRearCasing)
00824     {
00825       logicRearCasing->SetVisAttributes(G4VisAttributes::Invisible);
00826     }
00827     if(logicAlPlate)
00828     {
00829       G4VisAttributes* AlPlateVisAtt = new G4VisAttributes(G4Colour(0.9,0.9,1.0));
00830       AlPlateVisAtt->SetVisibility(true);
00831       logicAlPlate->SetVisAttributes(AlPlateVisAtt);
00832       logicAlPlate->SetVisAttributes(G4VisAttributes::Invisible);
00833     }
00834     logicRear->SetVisAttributes(G4VisAttributes::Invisible);
00835     logicPreAmpBox->SetVisAttributes(G4VisAttributes::Invisible);
00836     logicHangingPlate->SetVisAttributes(G4VisAttributes::Invisible);
00837     logicAirInPABox->SetVisAttributes(G4VisAttributes::Invisible);
00838     logicPD->SetVisAttributes(G4VisAttributes::Invisible);
00839     logicWaterPipe->SetVisAttributes(G4VisAttributes::Invisible);
00840     //
00841     //always return the physical World
00842     //
00843     if(verboseLevel>0)PrintEMCParameters();
00844     //  return physiBSC;
00845     */
00846 //    ConstructEndGeometry(logicEMC);
00847 //    ConstructSPFrame(logicEMC,besEMCGeometry);  
00848 }
00849 
00850 
00851 void ExtBesEmcConstruction::DefineMaterials()
00852 {
00853   G4String name, symbol;             //a=mass of a mole;
00854   G4double a, z, density;            //z=mean number of protons;  
00855   //  G4int iz, n;                       //iz=number of protons  in an isotope;
00856                                      // n=number of nucleons in an isotope;
00857 
00858   G4int ncomponents, natoms;
00859   G4double fractionmass;
00860   //G4double abundance, fractionmass;
00861   //  G4double temperature, pressure;
00862 
00863   //for debug
00864   //  G4Exception("BesEmcConstruction::DefineMaterials() starting...........");
00865   //
00866   // define Elements
00867   //
00868   G4Element* H=G4Element::GetElement("Hydrogen");
00869   if(!H)
00870     {
00871       a = 1.01*g/mole;
00872       H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
00873     }
00874   G4Element* C=G4Element::GetElement("Carbon");
00875   if(!C)
00876     {
00877       a = 12.01*g/mole;
00878       C = new G4Element(name="Carbon"  ,symbol="C" , z= 6., a);
00879     }
00880   G4Element* O=G4Element::GetElement("Oxygen");
00881   if(!O)
00882     {
00883       a = 16.00*g/mole;
00884       O = new G4Element(name="Oxygen"  ,symbol="O" , z= 8., a);  
00885     }
00886   
00887   density = 0.344*g/cm3;
00888   G4Material* Tyvek = new G4Material(name="Polyethylene", density, ncomponents=2);
00889   Tyvek->AddElement(C, natoms=1);
00890   Tyvek->AddElement(H, natoms=2);
00891 
00892   density = 1.39*g/cm3;
00893   G4Material* Mylar = new G4Material(name="PolyethyleneTerephthlate", density, ncomponents=3);
00894   Mylar->AddElement(C, natoms=5);
00895   Mylar->AddElement(H, natoms=4);
00896   Mylar->AddElement(O, natoms=2);
00897 
00898   density = 1.18*g/cm3;
00899   organicGlass = new G4Material(name="OrganicGlass", density, ncomponents=3);
00900   organicGlass->AddElement(C, natoms=5);
00901   organicGlass->AddElement(H, natoms=7);
00902   organicGlass->AddElement(O, natoms=2);
00903 
00904   G4Material *Fe = new G4Material(name="Iron", z=26., a=55.85*g/mole, density=7.87*g/cm3);
00905   G4Material *Cr = new G4Material(name="Chromium", z=24., a=52.00*g/mole, density=8.72*g/cm3);
00906   G4Material *Ni = new G4Material(name="Nickel", z=28., a=58.69*g/mole, density=8.72*g/cm3);
00907 
00908   stainlessSteel = new G4Material(name="0Cr18Ni9", density=7.85*g/cm3, ncomponents=3);
00909   stainlessSteel->AddMaterial(Fe, fractionmass=73.*perCent);
00910   stainlessSteel->AddMaterial(Cr, fractionmass=18.*perCent);
00911   stainlessSteel->AddMaterial(Ni, fractionmass=9.*perCent);
00912   
00913   G4Material *H2O = G4Material::GetMaterial("Water");
00914   G4Material *Cu = G4Material::GetMaterial("Copper");
00915   G4double dWater = 1.*g/cm3; //density
00916   G4double dCopper = 8.96*g/cm3;
00917   G4double aWater = ((*besEMCGeometry).waterPipeDr-(*besEMCGeometry).waterPipeThickness)
00918     *((*besEMCGeometry).waterPipeDr-(*besEMCGeometry).waterPipeThickness);    //area
00919   G4double aCopper = (*besEMCGeometry).waterPipeDr*(*besEMCGeometry).waterPipeDr-aWater;
00920   density = (dWater*aWater+dCopper*aCopper)/(aWater+aCopper);
00921 
00922   waterPipe = new G4Material(name="WaterPipe", density, ncomponents=2);
00923   fractionmass = dWater*aWater/(dWater*aWater+dCopper*aCopper);
00924   waterPipe->AddMaterial(H2O, fractionmass);
00925   fractionmass = dCopper*aCopper/(dWater*aWater+dCopper*aCopper);
00926   waterPipe->AddMaterial(Cu, fractionmass);
00927 
00928   cable  = new G4Material(name="Cable", density=4.*g/cm3, ncomponents=1);
00929   cable->AddMaterial(Cu,1);
00930   
00931   //for debug
00932   //G4Exception("BesEmcConstruction::DefineMaterials() running one.........");
00933   //
00934   // predigest the casing of crystals to a mixture
00935   //
00936   
00937   G4Material* Al=G4Material::GetMaterial("Aluminium");
00938   if(Al==NULL)
00939   {
00940       Al = new G4Material(name="Aluminium", z=13., a=26.98*g/mole, density=2.700*g/cm3);
00941   }
00942   
00943   G4Material *Si=G4Material::GetMaterial("Silicon");
00944   if(Si==NULL)
00945   {
00946     Si = new G4Material(name="Silicon", z=14., a=28.0855*g/mole, density=2.33*g/cm3);
00947   }
00948   
00949   //for debug
00950   G4double totalThickness=(*besEMCGeometry).fTyvekThickness
00951     +(*besEMCGeometry).fAlThickness+(*besEMCGeometry).fMylarThickness;
00952   density = (Tyvek->GetDensity()*(*besEMCGeometry).fTyvekThickness+
00953              Al->GetDensity()*(*besEMCGeometry).fAlThickness+
00954              Mylar->GetDensity()*(*besEMCGeometry).fMylarThickness)
00955     /totalThickness;
00956   G4Material* Casing = new G4Material(name="Casing", density, ncomponents=3);
00957   Casing->AddMaterial(
00958                       Tyvek,
00959                       fractionmass=Tyvek->GetDensity()/density
00960                                    *(*besEMCGeometry).fTyvekThickness
00961                                    /totalThickness);
00962   Casing->AddMaterial(
00963                       Al,
00964                       fractionmass=Al->GetDensity()/density
00965                                    *(*besEMCGeometry).fAlThickness
00966                                    /totalThickness);
00967   Casing->AddMaterial(
00968                       Mylar,
00969                       fractionmass=Mylar->GetDensity()/density
00970                                    *(*besEMCGeometry).fMylarThickness
00971                                    /totalThickness);
00972   fCasingMaterial = Casing;
00973   rearCasingMaterial = Tyvek;
00974   //for debug
00975   //  G4Exception("BesEmcConstruction::DefineMaterials() running two........");
00976   fCrystalMaterial = G4Material::GetMaterial("Cesiumiodide");
00977 }
00978 
00979 
00980 void ExtBesEmcConstruction::ConstructEndGeometry(G4LogicalVolume* logicEM)
00981 {
00982   G4Material* fCrystalMaterial = G4Material::GetMaterial("Cesiumiodide");
00983   //  G4VisAttributes* crystalVisAtt= new G4VisAttributes(G4Colour(0.5,0,1.0));
00984   //crystalVisAtt->SetVisibility(true);
00985   //G4VisAttributes* endPhiVisAtt= new G4VisAttributes(G4Colour(0,1.0,0));
00986   //endPhiVisAtt->SetVisibility(false);
00987   
00988   //world volume of endcap
00989   //east end
00990   solidEnd = new G4Cons("EndWorld",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
00991                   (*emcEnd).WorldDz/2,0.*deg,360.*deg);
00992   logicEnd = new G4LogicalVolume(solidEnd, G4Material::GetMaterial("Air"), "EndWorld", 0, 0, 0);
00993   physiEnd = new G4PVPlacement(0,               // no rotation
00994                 G4ThreeVector(0,0,(*emcEnd).WorldZPosition),
00995                 logicEnd,               // its logical volume
00996                 "EndWorld",             // its name
00997                 logicEMC,               // its mother  volume
00998                 false,                  // no boolean operations
00999                 0);                     // no field specific to volume
01000   //  if(logicEnd)
01001   //  logicEnd->SetVisAttributes(G4VisAttributes::Invisible);
01002 
01003   
01004   //west end
01005   G4RotationMatrix *rotateEnd = new G4RotationMatrix();
01006   rotateEnd->rotateY(180.*deg);
01007   physiEnd = new G4PVPlacement(rotateEnd,
01008      G4ThreeVector(0,0,-(*emcEnd).WorldZPosition),
01009      logicEnd,
01010      "EndWorld",
01011      logicEMC,
01012      false,
01013      2);
01014 
01016   // emc endcap sectors (east)                                            //
01018   //                                    20mm gap                          // 
01019   //                                      ||                              //
01020   //                                \   7 || 6   /                        //
01021   //                           -   8 \    ||    / 5   -                   //
01022   //                             -    \   ||   /    -                     //
01023   //                        _  9   -   \  ||  /   -   4  _                //
01024   //                          - _    -  \ || /  -    _ -                  //
01025   //                              - _  - \||/ -  _ -                      //
01026   //                         10        - -||- -         3                 //
01027   //                      ----------------||----------------              //
01028   //                         11        - -||- -         2                 //
01029   //                              _ -  - /||\ -  - _                      //
01030   //                          _ -    -  / || \  -    - _                  //
01031   //                        -  12  -   /  ||  \   -   1  -                //
01032   //                             -    /   ||   \    -                     //
01033   //                           -  13 /    ||    \  0  -                   //
01034   //                                /  14 || 15  \                        //
01035   //                                      ||                              //
01037 
01038   // 1/16 of endcap world,which has some symmetry
01039   // sector 0-6,8-14
01040   solidEndPhi = new G4Cons("EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
01041                      (*emcEnd).WorldDz/2,0*deg,22.5*deg);
01042   logicEndPhi = new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial("Air"), "EndPhi", 0, 0, 0);
01043   for(G4int i=0;i<14;i++)
01044   {
01045     if((i!=6)&&(i!=7))
01046     {
01047       G4RotationMatrix *rotatePhi = new G4RotationMatrix();
01048       rotatePhi->rotateZ(-i*22.5*deg+67.5*deg);
01049       physiEndPhi = new G4PVPlacement(rotatePhi,0,logicEndPhi,"EndPhi",logicEnd,false,i);
01050     }
01051   }
01052   //if(logicEndPhi)
01053   //  logicEndPhi->SetVisAttributes(endPhiVisAtt);
01054   
01055   for(G4int i=0;i<35;i++)
01056   {
01057     G4int copyNb = ComputeEndCopyNb(i);
01058     
01059     solidEndCasing = new G4IrregBox("EndCasing",(*emcEnd).fPnt[i]);
01060     logicEndCasing = new G4LogicalVolume(solidEndCasing,fCasingMaterial,"EndCasing");
01061     physiEndCasing = new G4PVPlacement(0,0,logicEndCasing,"EndCasing",logicEndPhi,false,copyNb);
01062     
01063     emcEnd->ModifyForCasing((*emcEnd).fPnt[i],i);
01064     solidEndCrystal = new G4IrregBox("EndCrystal",(*emcEnd).cryPoint);
01065     logicEndCrystal = new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,"EndCrystal");
01066     physiEndCrystal = new G4PVPlacement(0,0,logicEndCrystal,"EndCrystal",logicEndCasing,false,copyNb);
01067     
01068     //logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
01069     //logicEndCrystal->SetVisAttributes(crystalVisAtt);
01070     //logicEndCrystal->SetSensitiveDetector(besEMCSD);
01071   }
01072 
01073   
01074   // the top area which has 20 mm gap
01075   // sector 6,14
01076   solidEndPhi = new G4Cons("EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,  
01077                      (*emcEnd).WorldDz/2,67.5*deg,22.5*deg);
01078   logicEndPhi = new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial("Air"), "EndPhi", 0, 0, 0);
01079   for(G4int i=0;i<2;i++)
01080   {
01081     G4RotationMatrix *rotatePhi = new G4RotationMatrix();
01082     rotatePhi->rotateZ(-i*180.*deg);
01083     physiEndPhi = new G4PVPlacement(rotatePhi,0,logicEndPhi,"EndPhi",logicEnd,false,i*8+6);
01084   }
01085   //if(logicEndPhi)
01086   //  logicEndPhi->SetVisAttributes(endPhiVisAtt);
01087 
01088   for(G4int i=0;i<35;i++)
01089   {
01090     G4int copyNb = ComputeEndCopyNb(i);
01091     solidEndCasing = new G4IrregBox("EndCasing",(*emcEnd).fPnt1[i]);
01092     logicEndCasing = new G4LogicalVolume(solidEndCasing,fCasingMaterial,"EndCasing");
01093     physiEndCasing = new G4PVPlacement(0,0,logicEndCasing,"EndCasing",logicEndPhi,false,copyNb);
01094 
01095     emcEnd->ModifyForCasing((*emcEnd).fPnt1[i],i);
01096     solidEndCrystal = new G4IrregBox("EndCrystal",(*emcEnd).cryPoint);
01097     logicEndCrystal = new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,"EndCrystal");
01098     physiEndCrystal = new G4PVPlacement(0,0,logicEndCrystal,"EndCrystal",logicEndCasing,false,copyNb);
01099     
01100     //logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
01101     //logicEndCrystal->SetVisAttributes(crystalVisAtt);
01102     //logicEndCrystal->SetSensitiveDetector(besEMCSD);
01103   }
01104 
01105   (*emcEnd).ReflectX();
01106 
01107   // sector 7,15
01108   for(G4int i=0;i<35;i++)
01109     for (G4int j=0;j<8;j++)
01110       (*emcEnd).fPnt1[i][j].rotateZ(-90.*deg);
01111   
01112   solidEndPhi = new G4Cons("EndPhi",(*emcEnd).WorldRmin1,(*emcEnd).WorldRmax1,(*emcEnd).WorldRmin2,(*emcEnd).WorldRmax2,
01113                            (*emcEnd).WorldDz/2,0*deg,22.5*deg);
01114   logicEndPhi = new G4LogicalVolume(solidEndPhi, G4Material::GetMaterial("Air"), "EndPhi", 0, 0, 0);
01115   for(G4int i=0;i<2;i++)
01116   {
01117     G4RotationMatrix *rotatePhi = new G4RotationMatrix();
01118     rotatePhi->rotateZ(-i*180.*deg-90.*deg);
01119     physiEndPhi = new G4PVPlacement(rotatePhi,0,logicEndPhi,"EndPhi",logicEnd,false,i*8+7);
01120   }
01121   //if(logicEndPhi)
01122   //  logicEndPhi->SetVisAttributes(endPhiVisAtt);
01123 
01124   for(G4int i=0;i<35;i++)
01125   {
01126     G4int copyNb = ComputeEndCopyNb(i);
01127     solidEndCasing = new G4IrregBox("EndCasing",(*emcEnd).fPnt1[i]);
01128     logicEndCasing = new G4LogicalVolume(solidEndCasing,fCrystalMaterial,"EndCasing");
01129     physiEndCasing = new G4PVPlacement(0,0,logicEndCasing,"EndCasing",logicEndPhi,false,copyNb);
01130 
01131     emcEnd->ModifyForCasing((*emcEnd).fPnt1[i],i);
01132     solidEndCrystal = new G4IrregBox("EndCrystal",(*emcEnd).cryPoint);
01133     logicEndCrystal = new G4LogicalVolume(solidEndCrystal,fCrystalMaterial,"EndCrystal");
01134     physiEndCrystal = new G4PVPlacement(0,0,logicEndCrystal,"EndCrystal",logicEndCasing,false,copyNb);
01135     
01136     //logicEndCasing->SetVisAttributes(G4VisAttributes::Invisible);
01137     //logicEndCrystal->SetVisAttributes(crystalVisAtt);
01138     //logicEndCrystal->SetSensitiveDetector(besEMCSD);
01139   }
01140 }
01141 
01143 void ExtBesEmcConstruction::ConstructSPFrame(G4LogicalVolume* logicEMC, ExtBesEmcGeometry* besEMCGeometry)
01144 {
01145   //G4VisAttributes* ringVisAtt= new G4VisAttributes(G4Colour(0.5,0.25,0.));
01146   //ringVisAtt->SetVisibility(false);
01147   
01148   solidSupportBar = new G4Tubs("SupportBar",
01149       (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness1,
01150       (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness+(*besEMCGeometry).SPBarThickness1,
01151       (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz,
01152       0.*deg,
01153       360.*deg);
01154 
01155   logicSupportBar = new G4LogicalVolume(solidSupportBar,stainlessSteel,"SupportBar");
01156 
01157   physiSupportBar = new G4PVPlacement(0,0,logicSupportBar,"SupportBar",logicEMC,false,0);
01158 
01159   solidSupportBar1 = new G4Tubs("SupportBar1",
01160       (*besEMCGeometry).BSCRmax,
01161       (*besEMCGeometry).BSCRmax+(*besEMCGeometry).SPBarThickness1,
01162       (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3,
01163       (*besEMCGeometry).BSCPhiDphi-(*besEMCGeometry).SPBarDphi/2,
01164       (*besEMCGeometry).SPBarDphi);
01165 
01166   logicSupportBar1 = new G4LogicalVolume(solidSupportBar1,stainlessSteel,"SupportBar1");
01167 
01168   for(G4int i=0;i<(*besEMCGeometry).BSCNbPhi/2;i++)
01169   {
01170     G4RotationMatrix *rotateSPBar = new G4RotationMatrix();
01171     rotateSPBar->rotateZ((*besEMCGeometry).BSCPhiDphi-i*2*(*besEMCGeometry).BSCPhiDphi);
01172     physiSupportBar1 = new G4PVPlacement(rotateSPBar,0,logicSupportBar1,"SupportBar1",logicEMC,false,0);
01173   }
01174 
01175   //end ring
01176   solidEndRing = new G4Tubs("EndRing",
01177       (*besEMCGeometry).EndRingRmin,
01178       (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
01179       (*besEMCGeometry).EndRingDz/2,
01180       0.*deg,
01181       360.*deg);
01182 
01183   solidGear = new G4Tubs("Gear",
01184       (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr/2,
01185       (*besEMCGeometry).EndRingRmin+(*besEMCGeometry).EndRingDr,
01186       (*besEMCGeometry).EndRingDz/2,
01187       0.*deg,
01188       (*besEMCGeometry).BSCPhiDphi);
01189 
01190   //taper ring
01191   solidTaperRing1 = new G4Tubs("TaperRing1",
01192       (*besEMCGeometry).TaperRingRmin1,
01193       (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingThickness1,
01194       (*besEMCGeometry).TaperRingInnerLength/2,
01195       0.*deg,
01196       360.*deg);
01197 
01198   solidTaperRing2 = new G4Cons("TaperRing2",
01199       (*besEMCGeometry).TaperRingRmin1,
01200       (*besEMCGeometry).TaperRingRmin1+(*besEMCGeometry).TaperRingDr,
01201       (*besEMCGeometry).TaperRingRmin2,
01202       (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
01203       (*besEMCGeometry).TaperRingDz/2,
01204       0.*deg,
01205       360.*deg);
01206   
01207   solidTaperRing3 = new G4Cons("TaperRing3",
01208       (*besEMCGeometry).BSCRmax2,
01209       (*besEMCGeometry).BSCRmax2+(*besEMCGeometry).TaperRingOuterLength1,
01210       (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr,
01211       (*besEMCGeometry).TaperRingRmin2+(*besEMCGeometry).TaperRingDr+(*besEMCGeometry).TaperRingOuterLength,
01212       (*besEMCGeometry).TaperRingThickness3/2,
01213       0.*deg,
01214       360.*deg);
01215 
01216   logicEndRing = new G4LogicalVolume(solidEndRing,stainlessSteel,"EmcEndRing");
01217   logicGear = new G4LogicalVolume(solidGear,stainlessSteel,"Gear");
01218   logicTaperRing1 = new G4LogicalVolume(solidTaperRing1,stainlessSteel,"TaperRing1");
01219   logicTaperRing2 = new G4LogicalVolume(solidTaperRing2,stainlessSteel,"TaperRing2");
01220   logicTaperRing3 = new G4LogicalVolume(solidTaperRing3,stainlessSteel,"TaperRing3");
01221 
01222   for(G4int i=0;i<2;i++)
01223   {
01224     G4RotationMatrix *rotateSPRing = new G4RotationMatrix();
01225     G4double zEndRing,z1,z2,z3;
01226     if(i==0)
01227     {
01228       zEndRing = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2;
01229       z1 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
01230         -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2;
01231       z2 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2;
01232       z3 = (*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2;
01233     }
01234     else
01235     {
01236       rotateSPRing->rotateY(180.*deg);
01237       zEndRing = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3+(*besEMCGeometry).EndRingDz/2);
01238       z1 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3
01239         -(*besEMCGeometry).TaperRingDz-(*besEMCGeometry).TaperRingInnerLength/2);
01240       z2 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3-(*besEMCGeometry).TaperRingDz/2);
01241       z3 = -((*besEMCGeometry).BSCDz+(*besEMCGeometry).TaperRingThickness3/2);
01242     }
01243     
01244     physiEndRing = new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,zEndRing),
01245         logicEndRing,"EndRing",logicEMC,false,0);
01246     
01247     for(G4int j=0;j<(*besEMCGeometry).BSCNbPhi/2;j++)
01248     {
01249       G4RotationMatrix *rotateGear = new G4RotationMatrix();
01250       rotateGear->rotateZ((*besEMCGeometry).BSCPhiDphi/2-j*2*(*besEMCGeometry).BSCPhiDphi);
01251       physiGear = new G4PVPlacement(rotateGear,G4ThreeVector(0,0,zEndRing),
01252           logicGear,"Gear",logicEMC,false,0);
01253     }
01254     
01255     physiTaperRing1 = new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z1),
01256         logicTaperRing1,"TaperRing1",logicEMC,false,0);
01257    
01258     physiTaperRing2 = new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z2),
01259         logicTaperRing2,"TaperRing2",logicEMC,false,0);
01260   
01261     physiTaperRing3 = new G4PVPlacement(rotateSPRing,G4ThreeVector(0,0,z3),
01262         logicTaperRing3,"TaperRing3",logicEMC,false,0);
01263   }
01264   /*
01265   logicSupportBar->SetVisAttributes(ringVisAtt);
01266   logicSupportBar1->SetVisAttributes(ringVisAtt);
01267   logicEndRing->SetVisAttributes(ringVisAtt);
01268   logicGear->SetVisAttributes(ringVisAtt);
01269   logicTaperRing1->SetVisAttributes(ringVisAtt);
01270   logicTaperRing2->SetVisAttributes(ringVisAtt);
01271   logicTaperRing3->SetVisAttributes(ringVisAtt);
01272   */
01273 }
01274 
01275 G4int ExtBesEmcConstruction::ComputeEndCopyNb(G4int num)
01276 {
01277   G4int copyNb;
01278   switch(num){
01279     case 30:
01280       copyNb = 5;
01281       break;
01282     case 31:
01283       copyNb = 6;
01284       break;
01285     case 32:
01286       copyNb = 14;
01287       break;
01288     case 33:
01289       copyNb = 15;
01290       break;
01291     case 34:
01292       copyNb = 16;
01293       break;
01294     default:
01295       copyNb = num;
01296       break;
01297   }
01298   return copyNb;
01299 }
01300 
01301 
01302 void ExtBesEmcConstruction::PrintEMCParameters()
01303 {
01304   G4cout << "-------------------------------------------------------"<< G4endl
01305      << "---> There are "
01306      << phiNbCrystals << "(max=" << (*besEMCGeometry).BSCNbPhi
01307      << ") crystals along phi direction and "
01308      << thetaNbCrystals << "(max=" << (*besEMCGeometry).BSCNbTheta
01309      << ") crystals along theta direction."<< G4endl
01310      << "The crystals have sizes of "
01311      << (*besEMCGeometry).BSCCryLength/cm << "cm(L) and "
01312      << (*besEMCGeometry).BSCYFront/cm << "cm(Y) with "
01313      << fCrystalMaterial->GetName() <<"."<< G4endl
01314      << "The casing is layer of "
01315      << (*besEMCGeometry).fTyvekThickness/mm << "mm tyvek,"
01316      << (*besEMCGeometry).fAlThickness/mm << "mm aluminum and"
01317      << (*besEMCGeometry).fMylarThickness/mm << "mm mylar."<< G4endl
01318      << "-------------------------------------------------------"<< G4endl;
01319   G4cout << G4Material::GetMaterial("PolyethyleneTerephthlate") << G4endl
01320      << G4Material::GetMaterial("Casing") << G4endl
01321      << G4Material::GetMaterial("Polyethylene") << G4endl
01322      << "-------------------------------------------------------"<< G4endl;
01323 }
01324 
01325 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01326 
01327 void ExtBesEmcConstruction::SetCrystalMaterial(G4String materialChoice)
01328 {
01329   // search the material by its name   
01330   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
01331   if (pttoMaterial)
01332      {fCrystalMaterial = pttoMaterial;
01333       logicBSCCrystal->SetMaterial(pttoMaterial);
01334       PrintEMCParameters();
01335      }
01336 }
01337 
01338 
01339 void ExtBesEmcConstruction::SetCasingMaterial(G4String materialChoice)
01340 {
01341   // search the material by its name 
01342   G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
01343   if (pttoMaterial)
01344      {fCasingMaterial = pttoMaterial;
01345      logicBSCTheta->SetMaterial(pttoMaterial);
01346       PrintEMCParameters();
01347      }
01348 }
01349 
01350 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01351 
01352 void ExtBesEmcConstruction::SetCasingThickness(G4ThreeVector val)
01353 {
01354   // change Gap thickness and recompute the calorimeter parameters
01355   (*besEMCGeometry).fTyvekThickness = val('X');
01356   (*besEMCGeometry).fAlThickness    = val('Y');
01357   (*besEMCGeometry).fMylarThickness = val('Z');
01358 }
01359 
01360 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01361 
01362 void ExtBesEmcConstruction::SetBSCRmin(G4double val)
01363 {
01364   (*besEMCGeometry).BSCRmin = val;
01365 }
01366 
01367 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01368 
01369 void ExtBesEmcConstruction::SetBSCNbPhi(G4int val)
01370 {
01371   (*besEMCGeometry).BSCNbPhi = val;
01372 }
01373 
01374 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01375 
01376 void ExtBesEmcConstruction::SetBSCNbTheta(G4int val)
01377 {
01378   (*besEMCGeometry).BSCNbTheta = val;
01379 }
01380 
01381 void ExtBesEmcConstruction::SetStartIDTheta(G4int val)
01382 {
01383   startID = val;
01384 }
01385 
01386 
01387 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01388 
01389 void ExtBesEmcConstruction::SetBSCCrystalLength(G4double val)
01390 {
01391   (*besEMCGeometry).BSCCryLength = val;
01392 }
01393 
01394 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01395 
01396 void ExtBesEmcConstruction::SetBSCYFront0(G4double val)
01397 {
01398   (*besEMCGeometry).BSCYFront0 = val;
01399 }
01400 
01401 
01402 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01403 
01404 void ExtBesEmcConstruction::SetBSCYFront(G4double val)
01405 {
01406   (*besEMCGeometry).BSCYFront = val;
01407 }
01408 
01409 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01410 
01411 void ExtBesEmcConstruction::SetBSCPosition0(G4double val)
01412 {
01413   (*besEMCGeometry).BSCPosition0 = val;
01414 }
01415 
01416 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01417 
01418 void ExtBesEmcConstruction::SetBSCPosition1(G4double val)
01419 {
01420   (*besEMCGeometry).BSCPosition1 = val;
01421 }
01422 
01423 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01424 
01425 void ExtBesEmcConstruction::SetMagField(G4double fieldValue)
01426 {
01427   //apply a global uniform magnetic field along Z axis
01428   G4FieldManager* fieldMgr
01429    = G4TransportationManager::GetTransportationManager()->GetFieldManager();
01430 
01431   if(magField) delete magField;     //delete the existing magn field
01432 
01433   if(fieldValue!=0.)            // create a new one if non nul
01434   { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
01435     fieldMgr->SetDetectorField(magField);
01436     fieldMgr->CreateChordFinder(magField);
01437     fmagField=fieldValue;
01438   } else {
01439     magField = 0;
01440     fieldMgr->SetDetectorField(magField);
01441     fmagField=0.;
01442   }
01443 }
01444 
01445 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
01446 //??????????????????????????????????????????????? 
01447 void ExtBesEmcConstruction::UpdateGeometry()
01448 {
01449   ;//G4RunManager::GetRunManager()->DefineWorldVolume(BesDetectorConstruction::Construct());
01450 }

Generated on Tue Nov 29 23:14:11 2016 for BOSS_7.0.2 by  doxygen 1.4.7