#include <BesTofConstruction.hh>
Inheritance diagram for BesTofConstruction:
Public Member Functions | |
BesTofConstruction () | |
BesTofConstruction () | |
void | Construct (G4LogicalVolume *logicalBes) |
void | Construct (G4LogicalVolume *logicalBes) |
void | ConstructBr1Tof () |
void | ConstructBr1Tof () |
void | ConstructBr2Tof () |
void | ConstructBr2Tof () |
void | ConstructEcTof () |
void | ConstructEcTof () |
void | DefineMaterial () |
void | DefineMaterial () |
G4LogicalVolume * | FindLogicalVolume (const G4String &vn) |
G4LogicalVolume * | FindLogicalVolume (const G4String &vn) |
void | getXYZ (const G4RotationMatrix r, double &a, double &b, double &c) const |
void | getXYZ (const G4RotationMatrix r, double &a, double &b, double &c) const |
virtual | ~BesTofConstruction () |
virtual | ~BesTofConstruction () |
Protected Attributes | |
ProcessingConfigurator | m_config |
SAXProcessor | m_sxp |
Private Attributes | |
G4Material * | BC404 |
G4Material * | BC404 |
G4Material * | BC408 |
G4Material * | BC408 |
G4LogicalVolume * | logicalAlBr1 |
G4LogicalVolume * | logicalAlBr1 |
G4LogicalVolume * | logicalAlBr2 |
G4LogicalVolume * | logicalAlBr2 |
G4LogicalVolume * | logicalAlEcEast |
G4LogicalVolume * | logicalAlEcEast |
G4LogicalVolume * | logicalAlEcWest |
G4LogicalVolume * | logicalAlEcWest |
G4LogicalVolume * | logicalBrTof |
G4LogicalVolume * | logicalBrTof |
G4LogicalVolume * | logicalBucketBr1 |
G4LogicalVolume * | logicalBucketBr1 |
G4LogicalVolume * | logicalBucketBr2 |
G4LogicalVolume * | logicalBucketBr2 |
G4LogicalVolume * | logicalBucketEc |
G4LogicalVolume * | logicalBucketEc |
G4LogicalVolume * | logicalEcTofEast |
G4LogicalVolume * | logicalEcTofEast |
G4LogicalVolume * | logicalEcTofWest |
G4LogicalVolume * | logicalEcTofWest |
G4LogicalVolume * | logicalPVFBr1 |
G4LogicalVolume * | logicalPVFBr1 |
G4LogicalVolume * | logicalPVFBr2 |
G4LogicalVolume * | logicalPVFBr2 |
G4LogicalVolume * | logicalPVFEcEast |
G4LogicalVolume * | logicalPVFEcEast |
G4LogicalVolume * | logicalPVFEcWest |
G4LogicalVolume * | logicalPVFEcWest |
G4LogicalVolume * | logicalScinBr1 |
G4LogicalVolume * | logicalScinBr1 |
G4LogicalVolume * | logicalScinBr2 |
G4LogicalVolume * | logicalScinBr2 |
G4LogicalVolume * | logicalScinEcEast |
G4LogicalVolume * | logicalScinEcEast |
G4LogicalVolume * | logicalScinEcWest |
G4LogicalVolume * | logicalScinEcWest |
G4LogicalVolume * | logicalTof |
G4LogicalVolume * | logicalTof |
G4VPhysicalVolume * | physicalAlBr1 |
G4VPhysicalVolume * | physicalAlBr1 |
G4VPhysicalVolume * | physicalAlBr2 |
G4VPhysicalVolume * | physicalAlBr2 |
G4VPhysicalVolume * | physicalAlEcEast |
G4VPhysicalVolume * | physicalAlEcEast |
G4VPhysicalVolume * | physicalAlEcWest |
G4VPhysicalVolume * | physicalAlEcWest |
G4VPhysicalVolume * | physicalBucket1Br1 |
G4VPhysicalVolume * | physicalBucket1Br1 |
G4VPhysicalVolume * | physicalBucket1Br2 |
G4VPhysicalVolume * | physicalBucket1Br2 |
G4VPhysicalVolume * | physicalBucket2Br1 |
G4VPhysicalVolume * | physicalBucket2Br1 |
G4VPhysicalVolume * | physicalBucket2Br2 |
G4VPhysicalVolume * | physicalBucket2Br2 |
G4VPhysicalVolume * | physicalBucketEc |
G4VPhysicalVolume * | physicalBucketEc |
G4VPhysicalVolume * | physicalPVFBr1 |
G4VPhysicalVolume * | physicalPVFBr1 |
G4VPhysicalVolume * | physicalPVFBr2 |
G4VPhysicalVolume * | physicalPVFBr2 |
G4VPhysicalVolume * | physicalPVFEcEast |
G4VPhysicalVolume * | physicalPVFEcEast |
G4VPhysicalVolume * | physicalPVFEcWest |
G4VPhysicalVolume * | physicalPVFEcWest |
G4VPhysicalVolume * | physicalScinBr1 |
G4VPhysicalVolume * | physicalScinBr1 |
G4VPhysicalVolume * | physicalScinBr2 |
G4VPhysicalVolume * | physicalScinBr2 |
G4VPhysicalVolume * | physicalScinEcEast |
G4VPhysicalVolume * | physicalScinEcEast |
G4VPhysicalVolume * | physicalScinEcWest |
G4VPhysicalVolume * | physicalScinEcWest |
G4VPhysicalVolume * | physicalTof |
G4VPhysicalVolume * | physicalTof |
G4Material * | PMTmaterial |
G4Material * | PMTmaterial |
G4Material * | PVF |
G4Material * | PVF |
|
|
00089 { 00090 }
|
|
|
|
|
|
Implements BesSubdetector. |
|
Implements BesSubdetector. 00093 { 00094 DefineMaterial(); 00095 00096 if ( ReadBoostRoot::GetTof() == 2 ) 00097 { 00098 TofG4Geo* aTofG4Geo = new TofG4Geo(); 00099 logicalTof = aTofG4Geo->GetTopVolume(); 00100 if (!logicalTof) 00101 G4cout<<"BesTofConstruction::Construct(), logicalTof not found"<<G4endl; 00102 else 00103 { 00104 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0), 00105 logicalTof,"physicalTof",logicalBes,false,0); 00106 00107 //for visual attributes 00108 logicalScinBr1 = FindLogicalVolume("logicalScinBr1"); 00109 logicalScinBr2 = FindLogicalVolume("logicalScinBr2"); 00110 00111 logicalAlBr1 = FindLogicalVolume("logicalAlBr1"); 00112 logicalAlBr2 = FindLogicalVolume("logicalAlBr2"); 00113 logicalPVFBr1 = FindLogicalVolume("logicalPVFBr1"); 00114 logicalPVFBr2 = FindLogicalVolume("logicalPVFBr2"); 00115 logicalBucketBr1 = FindLogicalVolume("logicalBucketBr1"); 00116 logicalBucketBr2 = FindLogicalVolume("logicalBucketBr2"); 00117 00118 logicalScinEcWest = FindLogicalVolume("logicalScinEcWest"); 00119 logicalScinEcEast = FindLogicalVolume("logicalScinEcEast"); 00120 logicalBucketEc = FindLogicalVolume("logicalBucketEc"); 00121 } 00122 //m_sxp.Finalize(); 00123 delete aTofG4Geo; 00124 } 00125 else 00126 { 00127 //-----------------logicalTof added here 00128 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); 00129 G4double r1=tofPara->GetEcR1()-1; //=399 00130 G4double r2=tofPara->GetBucketPosR()+0.5*tofPara->GetBucketDEc()+1; //=474 00131 G4double r3=810;; 00132 G4double r4=925; 00133 G4double a1=1382+tofPara->GetBucketLEc()+1; //1463 00134 G4double a2=1381; // Changed from 1382 to avoid overlapping with EMC 00135 //to make the center of tub6 is tofPara.GetzPosEastEc()=1356 00136 G4double a3=1330; 00137 G4cout<<"Tof Volume: "<<r1<<" "<<r2<<" "<<r3<<" "<<r4<<" "<<a1<<" "<<a2<<" "<<a3<<G4endl; 00138 00139 G4Tubs* tub1 = new G4Tubs("tub1",r1,r2,a1,0,360); 00140 G4Tubs* tub2 = new G4Tubs("tub2",r2-4,r4,a2,0,360); 00141 G4Tubs* tub3 = new G4Tubs("tub3",0,r3,a3,0,360); 00142 G4UnionSolid* tub4 = new G4UnionSolid("tub4",tub1,tub2,0,G4ThreeVector(0,0,0) ); 00143 G4SubtractionSolid* solidTof = new G4SubtractionSolid("solidTof",tub4,tub3, 00144 0, G4ThreeVector(0,0,0) ); 00145 00146 logicalTof = new G4LogicalVolume(solidTof, G4Material::GetMaterial("Air"),"logicalTof"); 00147 00148 G4Tubs* tub5 = new G4Tubs("tub5",r3,r4,a3,0,360); 00149 logicalBrTof = new G4LogicalVolume(tub5, G4Material::GetMaterial("Air"),"logicalBrTof"); 00150 G4VPhysicalVolume* physicalBrTof = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalBrTof,"physicalBrTof",logicalTof,false,0); 00151 00152 G4Tubs* tub6 = new G4Tubs("tub6",r1,r4,(a2-a3)/2,0,360); 00153 G4Tubs* tub7 = new G4Tubs("tub7",r1,r2,(a1-a2)/2,0,360); 00154 G4UnionSolid* tub8 = new G4UnionSolid("tub8",tub6,tub7,0,G4ThreeVector(0,0,(a3-a1)/2) ); 00155 logicalEcTofWest = new G4LogicalVolume(tub8, G4Material::GetMaterial("Air"),"logicalEcTofWest"); 00156 G4VPhysicalVolume* physicalEcTofWest = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosWestEc()),logicalEcTofWest,"physicalEcTofWest",logicalTof,false,0); 00157 00158 G4UnionSolid* tub9 = new G4UnionSolid("tub9",tub6,tub7,0,G4ThreeVector(0,0,(a1-a3)/2) ); 00159 logicalEcTofEast = new G4LogicalVolume(tub9, G4Material::GetMaterial("Air"),"logicalEcTofEast"); 00160 G4VPhysicalVolume* physicalEcTofEast = new G4PVPlacement(0,G4ThreeVector(0,0,tofPara->GetzPosEastEc()),logicalEcTofEast,"physicalEcTofEast",logicalTof,false,0); 00161 00162 00163 //place logicalTof in logicbes 00164 physicalTof = new G4PVPlacement(0,G4ThreeVector(0,0,0), 00165 logicalTof,"physicalTof",logicalBes,false,0); 00166 00167 00168 ConstructBr1Tof(); 00169 ConstructBr2Tof(); 00170 ConstructEcTof(); 00171 } 00172 00173 //sensitive detector 00174 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 00175 BesTofSD* tofSD = new BesTofSD("BesTofSD"); 00176 SDman->AddNewDetector(tofSD); 00177 if (logicalScinBr1) 00178 logicalScinBr1->SetSensitiveDetector(tofSD); 00179 if (logicalScinBr2) 00180 logicalScinBr2->SetSensitiveDetector(tofSD); 00181 if (logicalScinEcWest) 00182 logicalScinEcWest->SetSensitiveDetector(tofSD); 00183 if (logicalScinEcEast) 00184 logicalScinEcEast->SetSensitiveDetector(tofSD); 00185 00186 G4VisAttributes* visBrTof = new G4VisAttributes(G4Colour(1.,0.,0.)); 00187 G4VisAttributes* visEcTof = new G4VisAttributes(G4Colour(0.,1.,0.)); 00188 00189 //visual attributes 00190 if (logicalTof) 00191 logicalTof->SetVisAttributes(G4VisAttributes::Invisible); 00192 if (logicalBrTof) 00193 logicalBrTof->SetVisAttributes(G4VisAttributes::Invisible); 00194 //logicalBrTof->SetVisAttributes(visBrTof); 00195 if (logicalEcTofWest) 00196 logicalEcTofWest->SetVisAttributes(G4VisAttributes::Invisible); 00197 //logicalEcTofWest->SetVisAttributes(visEcTof); 00198 if (logicalEcTofEast) 00199 logicalEcTofEast->SetVisAttributes(G4VisAttributes::Invisible); 00200 //logicalEcTofEast->SetVisAttributes(visEcTof); 00201 00202 G4VisAttributes* visAttBrTof = new G4VisAttributes(G4Colour(0,1,1)); 00203 if (logicalScinBr1) 00204 logicalScinBr1->SetVisAttributes(visAttBrTof); 00205 //logicalScinBr1->SetVisAttributes(G4VisAttributes::Invisible); 00206 if (logicalScinBr2) 00207 logicalScinBr2->SetVisAttributes(visAttBrTof); 00208 //logicalScinBr2->SetVisAttributes(G4VisAttributes::Invisible); 00209 00210 00211 if (logicalAlBr1) 00212 logicalAlBr1->SetVisAttributes(G4VisAttributes::Invisible); 00213 if (logicalAlBr2) 00214 logicalAlBr2->SetVisAttributes(G4VisAttributes::Invisible); 00215 00216 if (logicalPVFBr1) 00217 logicalPVFBr1->SetVisAttributes(G4VisAttributes::Invisible); 00218 if (logicalPVFBr2) 00219 logicalPVFBr2->SetVisAttributes(G4VisAttributes::Invisible); 00220 00221 G4VisAttributes* visAttBrBuck = new G4VisAttributes(G4Colour(1.,1.,0.)); 00222 if (logicalBucketBr1) 00223 logicalBucketBr1->SetVisAttributes(visAttBrBuck); 00224 //logicalBucketBr1->SetVisAttributes(G4VisAttributes::Invisible); 00225 if (logicalBucketBr2) 00226 logicalBucketBr2->SetVisAttributes(visAttBrBuck); 00227 //logicalBucketBr2->SetVisAttributes(G4VisAttributes::Invisible); 00228 00229 G4VisAttributes* visAttEcTof = new G4VisAttributes(G4Colour(0.,1.,1.)); 00230 if (logicalScinEcWest) 00231 logicalScinEcWest->SetVisAttributes(visAttEcTof); 00232 //logicalScinEc->SetVisAttributes(G4VisAttributes::Invisible); 00233 if (logicalScinEcEast) 00234 logicalScinEcEast->SetVisAttributes(visAttEcTof); 00235 00236 G4VisAttributes* visAttEcBuck = new G4VisAttributes(G4Colour(1.,1.,0.)); 00237 if (logicalBucketEc) 00238 logicalBucketEc->SetVisAttributes(visAttEcBuck); 00239 //logicalBucketEc->SetVisAttributes(G4VisAttributes::Invisible); 00240 00241 if (logicalAlEcWest) 00242 logicalAlEcWest->SetVisAttributes(G4VisAttributes::Invisible); 00243 if (logicalAlEcEast) 00244 logicalAlEcEast->SetVisAttributes(G4VisAttributes::Invisible); 00245 if (logicalPVFEcWest) 00246 logicalPVFEcWest->SetVisAttributes(G4VisAttributes::Invisible); 00247 if (logicalPVFEcEast) 00248 logicalPVFEcEast->SetVisAttributes(G4VisAttributes::Invisible); 00249 }
|
|
|
|
00252 { 00253 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); 00254 00255 //barrel tof layer1 geometry data 00256 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators 00257 G4double br1L=tofPara->GetBr1L(); 00258 G4double br1TrapW1=tofPara->GetBr1TrapW1(); 00259 G4double br1TrapW2=tofPara->GetBr1TrapW2(); 00260 G4double br1TrapH=tofPara->GetBr1TrapH(); 00261 G4double br1R1=tofPara->GetBr1R1(); 00262 G4double AlThickness=tofPara->GetAlThickness(); 00263 G4double PVFThickness=tofPara->GetPVFThickness(); 00264 //barrel PMT bucket geometry data 00265 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket 00266 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket 00267 00268 //computer from the original data 00269 G4double angleBr=360./nScinBr*deg; 00270 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4; 00271 scinTrapdx1=scinTrapdx3=br1TrapW1/2.; 00272 scinTrapdx2=scinTrapdx4=br1TrapW2/2.; 00273 G4double scinTrapdy1,scinTrapdy2; 00274 scinTrapdy1=scinTrapdy2=0.5*br1TrapH; 00275 G4double scinTrapdz=br1L/2.; 00276 G4double scinPosR=br1R1+scinTrapdy1; 00277 G4double theta = atan((br1TrapW2/2.-br1TrapW1/2.)/br1TrapH); 00278 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta)); 00279 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta)); 00280 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta)); 00281 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta)); 00282 00283 //construct barrel tof scintillator 00284 G4Trap* solidScinBr1=new G4Trap("solidScinBr1",scinTrapdz,0*deg,0*deg, 00285 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg, 00286 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg); 00287 logicalScinBr1 = new G4LogicalVolume(solidScinBr1,BC408,"logicalScinBr1"); 00288 00289 //construct barrel Al film and PVF film 00290 G4Trap* solidAlBr1 = new G4Trap("solidAlBr1", scinTrapdz+0.001,0*deg,0*deg, 00291 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg, 00292 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg); 00293 00294 logicalAlBr1 = new G4LogicalVolume(solidAlBr1,G4Material::GetMaterial("Aluminium"),"logicalAlBr1"); 00295 G4Trap* solidPVFBr1 = new G4Trap("solidPVFBr1",scinTrapdz+0.002,0*deg,0*deg, 00296 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg, 00297 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg); 00298 00299 logicalPVFBr1 = new G4LogicalVolume(solidPVFBr1,PVF,"logicalPVFBr1"); 00300 //put daughter in mother logical volume 00301 physicalAlBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr1, "physicalAlBr1",logicalPVFBr1, false,0); 00302 physicalScinBr1 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr1, "physicalScinBr1",logicalAlBr1, false, 0); 00303 00304 //construct barrel PMT bucket 00305 G4Tubs* solidBucketBr1= new G4Tubs("solidBucketBr1",0,bucketDBr/2., 00306 bucketLBr/2., 0, 360.*deg); 00307 logicalBucketBr1=new G4LogicalVolume(solidBucketBr1,PMTmaterial,"logicalBucketBr1"); 00308 00309 G4RotationMatrix trapRot; 00310 trapRot.rotateZ(0.5*angleBr-90.*deg); 00311 // /| y 00312 //------- / | | 00313 //\ / | | rotate->(0.5*angleBr-90.*deg): | 00314 // \ / ->>>> | | -----x 00315 // --- \ | 00316 // \| 00317 G4ThreeVector pos(0,0,0); 00318 G4double x,y; 00319 for (int i=0;i<nScinBr;i++) 00320 { 00321 ostringstream osnamePVFBr1; 00322 osnamePVFBr1 << "physicalPVFBr1_"<<i; 00323 ostringstream osnameBucket1Br1; 00324 osnameBucket1Br1 << "physicalBucket1Br1_"<<i; 00325 ostringstream osnameBucket2Br1; 00326 osnameBucket2Br1 << "physicalBucket2Br1_"<<i; 00327 00328 //scintillator and casing 00329 x=scinPosR*cos((i+0.5)*angleBr); //+0.5: start from phi=0 00330 y=scinPosR*sin((i+0.5)*angleBr); 00331 pos.setX(x); 00332 pos.setY(y); 00333 pos.setZ(0); 00334 00335 //to make code consistent with gdml 00336 double a, b, c; 00337 getXYZ(trapRot, a, b ,c); 00338 G4RotationMatrix trapRotTemp; 00339 trapRotTemp.rotateZ(c); 00340 G4Transform3D transform(trapRotTemp,pos); 00341 //G4Transform3D transform(trapRot,pos); 00342 physicalPVFBr1 = new G4PVPlacement(transform,logicalPVFBr1,osnamePVFBr1.str(), logicalBrTof,false,i); 00343 //bucket 00344 pos.setZ(-(bucketLBr+br1L)/2.-0.01); 00345 physicalBucket1Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket1Br1.str(),logicalBrTof,false,0); 00346 pos.setZ((bucketLBr+br1L)/2.+0.01); 00347 physicalBucket2Br1 = new G4PVPlacement(0,pos,logicalBucketBr1,osnameBucket2Br1.str(),logicalBrTof,false,0); 00348 00349 //rotate for next scintillator 00350 trapRot.rotateZ(angleBr); 00351 } 00352 }
|
|
|
|
00355 { 00356 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); 00357 00358 //barrel tof layer2 geometry data 00359 G4int nScinBr=tofPara->GetnScinBr(); //number of barrel scintillators 00360 G4double br2L=tofPara->GetBr2L(); 00361 G4double br2TrapW1=tofPara->GetBr2TrapW1(); 00362 G4double br2TrapW2=tofPara->GetBr2TrapW2(); 00363 G4double br2TrapH=tofPara->GetBr2TrapH(); 00364 G4double br2R1=tofPara->GetBr2R1(); 00365 G4double AlThickness=tofPara->GetAlThickness(); 00366 G4double PVFThickness=tofPara->GetPVFThickness(); 00367 //barrel PMT bucket geometry data 00368 G4double bucketDBr=tofPara->GetBucketDBr(); //diameter of barrel PMT bucket 00369 G4double bucketLBr=tofPara->GetBucketLBr(); //length of barrel PMT bucket 00370 00371 //computer from the original data 00372 G4double angleBr=360./nScinBr*deg; 00373 G4double scinTrapdx1,scinTrapdx2,scinTrapdx3,scinTrapdx4; 00374 scinTrapdx1=scinTrapdx3=br2TrapW1/2.; 00375 scinTrapdx2=scinTrapdx4=br2TrapW2/2.; 00376 G4double scinTrapdy1,scinTrapdy2; 00377 scinTrapdy1=scinTrapdy2=0.5*br2TrapH; 00378 G4double scinTrapdz=br2L/2.; 00379 G4double scinPosR=br2R1+scinTrapdy1; 00380 G4double theta = atan((br2TrapW2/2.-br2TrapW1/2.)/br2TrapH); 00381 G4double delta13 = AlThickness*(1/cos(theta)-tan(theta)); 00382 G4double delta24 = AlThickness*(1/cos(theta)+tan(theta)); 00383 G4double delta13P = (PVFThickness+AlThickness)*(1/cos(theta)-tan(theta)); 00384 G4double delta24P = (PVFThickness+AlThickness)*(1/cos(theta)+tan(theta)); 00385 00386 //construct barrel tof scintillator 00387 G4Trap* solidScinBr2=new G4Trap("solidScinBr2",scinTrapdz,0*deg,0*deg, 00388 scinTrapdy1,scinTrapdx1,scinTrapdx2,0*deg, 00389 scinTrapdy2,scinTrapdx3,scinTrapdx4,0*deg); 00390 logicalScinBr2 = new G4LogicalVolume(solidScinBr2,BC408,"logicalScinBr2"); 00391 00392 //construct barrel Al film and PVF film 00393 G4Trap* solidAlBr2 = new G4Trap("solidAlBr2", scinTrapdz+0.001,0*deg,0*deg, 00394 scinTrapdy1+AlThickness, scinTrapdx1+delta13, scinTrapdx2+delta24 ,0*deg, 00395 scinTrapdy2+AlThickness, scinTrapdx3+delta13, scinTrapdx4+delta24 ,0*deg); 00396 00397 logicalAlBr2 = new G4LogicalVolume(solidAlBr2,G4Material::GetMaterial("Aluminium"),"logicalAlBr2"); 00398 G4Trap* solidPVFBr2 = new G4Trap("solidPVFBr2",scinTrapdz+0.002,0*deg,0*deg, 00399 scinTrapdy1+AlThickness+PVFThickness,scinTrapdx1+delta13P, scinTrapdx2+delta24P,0*deg, 00400 scinTrapdy2+AlThickness+PVFThickness,scinTrapdx3+delta13P, scinTrapdx4+delta24P,0*deg); 00401 00402 logicalPVFBr2 = new G4LogicalVolume(solidPVFBr2,PVF,"logicalPVFBr2"); 00403 //put daughter in mother logical volume 00404 physicalAlBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlBr2, "physicalAlBr2",logicalPVFBr2, false,0); 00405 physicalScinBr2 = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinBr2, "physicalScinBr2",logicalAlBr2, false, 0); 00406 00407 //construct barrel PMT bucket 00408 G4Tubs* solidBucketBr2= new G4Tubs("solidBucketBr2",0,bucketDBr/2., 00409 bucketLBr/2., 0, 360.*deg); 00410 logicalBucketBr2=new G4LogicalVolume(solidBucketBr2,PMTmaterial,"logicalBucketBr2"); 00411 00412 G4RotationMatrix trapRot; 00413 trapRot.rotateZ(-90.*deg); 00414 // /| y 00415 //------- / | | 00416 //\ / | | rotate->(-90.*deg): | 00417 // \ / ->>>> | | -----x 00418 // --- \ | 00419 // \| 00420 G4ThreeVector pos(0,0,0); 00421 G4double x,y; 00422 for (int i=0;i<nScinBr;i++) 00423 { 00424 ostringstream osnamePVFBr2; 00425 osnamePVFBr2 << "physicalPVFBr2_"<<i; 00426 ostringstream osnameBucket1Br2; 00427 osnameBucket1Br2 << "physicalBucket1Br2_"<<i; 00428 ostringstream osnameBucket2Br2; 00429 osnameBucket2Br2 << "physicalBucket2Br2_"<<i; 00430 00431 //scintillator and casing 00432 x=scinPosR*cos(i*angleBr); //+0.5: start from phi=0 00433 y=scinPosR*sin(i*angleBr); 00434 pos.setX(x); 00435 pos.setY(y); 00436 pos.setZ(0); 00437 //to make code consistent with gdml 00438 double a, b, c; 00439 getXYZ(trapRot, a, b ,c); 00440 G4RotationMatrix trapRotTemp; 00441 trapRotTemp.rotateZ(c); 00442 G4Transform3D transform(trapRotTemp,pos); 00443 //G4Transform3D transform(trapRot,pos); 00444 physicalPVFBr2 = new G4PVPlacement(transform,logicalPVFBr2,osnamePVFBr2.str(), logicalBrTof,false,i); 00445 //bucket 00446 pos.setZ(-(bucketLBr+br2L)/2.-0.01); 00447 physicalBucket1Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket1Br2.str(),logicalBrTof,false,0); 00448 pos.setZ((bucketLBr+br2L)/2.+0.01); 00449 physicalBucket2Br2 = new G4PVPlacement(0,pos,logicalBucketBr2,osnameBucket2Br2.str(),logicalBrTof,false,0); 00450 00451 //rotate for next scintillator 00452 trapRot.rotateZ(angleBr); 00453 } 00454 00455 }
|
|
|
|
00458 { 00459 BesTofGeoParameter* tofPara = BesTofGeoParameter::GetInstance(); 00460 00461 //endcap geometry data 00462 G4int nScinEc = tofPara->GetnScinEc(); //number of endcap scintillators 00463 G4double ecL = tofPara->GetEcL(); 00464 G4double ecTrapW1 = tofPara->GetEcTrapW1(); 00465 G4double ecTrapW2 = tofPara->GetEcTrapW2(); 00466 G4double ecTrapH = tofPara->GetEcTrapH(); 00467 G4double ecTrapH1 = tofPara->GetEcTrapH1(); 00468 G4double zPosEastEc = tofPara->GetzPosEastEc(); //z position of east endcap 00469 G4double zPosWestEc = tofPara->GetzPosWestEc(); //z position of west endcap 00470 G4double ecR1 = tofPara->GetEcR1(); 00471 //G4double ecR2 = tofPara.GetEcR2(); 00472 00473 //endcap PMT bucket geometry data 00474 G4double bucketDEc = tofPara->GetBucketDEc(); //diameter of endcap PMT bucket 00475 G4double bucketLEc = tofPara->GetBucketLEc(); //length of endcap PMT bucket 00476 G4double bucketPosR = tofPara->GetBucketPosR(); //R of bucket center 00477 00478 G4double AlThickness=tofPara->GetAlThickness(); 00479 G4double PVFThickness=tofPara->GetPVFThickness(); 00480 00481 G4double angleEc=360./nScinEc*deg; 00482 G4double ecTrapW3 = ecTrapW1 + (ecTrapW2-ecTrapW1)*ecTrapH1/ecTrapH; 00483 G4double ecTrapH2 = ecTrapH-ecTrapH1; 00484 G4double pdz = ecL/2; 00485 G4double ptheta = atan(ecTrapH1/(2*ecL)); 00486 G4double pdy1 = ecTrapH2/2; 00487 G4double pdx1 = ecTrapW3/2; 00488 G4double pdx2 = ecTrapW2/2; 00489 G4double pdy2 = ecTrapH/2; 00490 G4double pdx3 = ecTrapW1/2; 00491 G4double pdx4 = ecTrapW2/2; 00492 00493 //because of removing a heighth of H1, 00494 //plus initial center position ecR=ecR1+ecTrapH/2 with ecTrapH1/4 00495 G4double ecR = ecR1+ecTrapH/2+ecTrapH1/4; 00496 00497 //construct endcap scintillator 00498 G4Trap* solidScinEc=new G4Trap("solidScinEc",pdz,ptheta, 270*deg, 00499 pdy1,pdx1,pdx2,0*deg,pdy2,pdx3,pdx4,0*deg); 00500 00501 logicalScinEcWest=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcWest"); 00502 logicalScinEcEast=new G4LogicalVolume(solidScinEc,BC404,"logicalScinEcEast"); 00503 00504 //construct endcap PMT bucket 00505 G4Tubs* solidBucketEc = new G4Tubs("solidBucketEc", 0, bucketDEc/2., 00506 bucketLEc/2., 0, 360.*deg); 00507 logicalBucketEc = new G4LogicalVolume(solidBucketEc, PMTmaterial, "logicalBucketEc"); 00508 00509 //construct Al and PVF film 00510 G4double pthetaAl = atan(ecTrapH1/(2*(ecL+AlThickness*2))); 00511 G4double theta1 = atan((ecTrapW2/2.-ecTrapW3/2.)/ecTrapH2); 00512 G4double theta2 = atan((ecTrapW2/2.-ecTrapW1/2.)/ecTrapH); 00513 00514 G4double delta1 = AlThickness*(1/cos(theta1)-tan(theta1)); 00515 G4double delta2 = AlThickness*(1/cos(theta1)+tan(theta1)); 00516 G4double delta3 = AlThickness*(1/cos(theta2)-tan(theta2)); 00517 G4double delta4 = AlThickness*(1/cos(theta2)+tan(theta2)); 00518 00519 G4double thick = AlThickness+PVFThickness; 00520 G4double pthetaPVF = atan(ecTrapH1/(2*(ecL+thick*2))); 00521 G4double delta1P = thick*(1/cos(theta1)-tan(theta1)); 00522 G4double delta2P = thick*(1/cos(theta1)+tan(theta1)); 00523 G4double delta3P = thick*(1/cos(theta2)-tan(theta2)); 00524 G4double delta4P = thick*(1/cos(theta2)+tan(theta2)); 00525 00526 G4Trap* solidAlEc= new G4Trap("solidAlEc",pdz+AlThickness,pthetaAl,270*deg,pdy1+AlThickness,pdx1+delta1,pdx2+delta2,0*deg,pdy2+AlThickness,pdx3+delta3,pdx4+delta4,0*deg); 00527 00528 logicalAlEcWest = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcWest"); 00529 logicalAlEcEast = new G4LogicalVolume(solidAlEc,G4Material::GetMaterial("Aluminium"),"logicalAlEcEast"); 00530 00531 G4Trap* solidPVFEc = new G4Trap("solidPVFEc",pdz+thick,pthetaPVF,270*deg, 00532 pdy1+thick,pdx1+delta1P,pdx2+delta2P,0*deg, 00533 pdy2+thick,pdx3+delta3P,pdx4+delta4P,0*deg); 00534 00535 logicalPVFEcWest = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcWest"); 00536 logicalPVFEcEast = new G4LogicalVolume(solidPVFEc,PVF,"logicalPVFEcEast"); 00537 00538 //put scintilator in Al, then put Al in PVF 00539 physicalAlEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcWest, "physicalAlEcWest",logicalPVFEcWest, false,0); 00540 physicalScinEcWest = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcWest, "physicalScinEcWest",logicalAlEcWest, false, 0); 00541 00542 00543 //put scintilator in Al, then put Al in PVF 00544 physicalAlEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalAlEcEast, "physicalAlEcEast",logicalPVFEcEast, false,0); 00545 physicalScinEcEast = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicalScinEcEast, "physicalScinEcEast",logicalAlEcEast, false, 0); 00546 00547 //zPosWestEc<0, zPosEastEc>0, direction of axis z: west--->east 00548 //construct west endcap first 00549 //when no rotation, the first tub is start from phi=90 00550 //after rotation, the first tub is start from 0, rotate angle = 0.5*angleEc 00551 G4ThreeVector posW(0,0,0); 00552 G4ThreeVector posE(0,0,0); 00553 G4RotationMatrix trapRot; 00554 trapRot.rotateY(180.*deg); 00555 trapRot.rotateZ(0.5*angleEc-90*deg); 00556 for (int i=0;i<nScinEc;i++) 00557 { 00558 ostringstream osnamePVFEc; 00559 osnamePVFEc << "physicalPVFEcWest_"<<i; 00560 ostringstream osnameBucketEc; 00561 osnameBucketEc << "physicalBucketEcWest_"<<i; 00562 00563 posW.setX( ecR*cos((0.5+i)*angleEc) ); 00564 posW.setY( ecR*sin((0.5+i)*angleEc) ); 00565 //posW.setZ( zPosWestEc ); 00566 posW.setZ(0); 00567 00568 //to make code consistent with gdml 00569 double a, b, c; 00570 getXYZ(trapRot, a, b ,c); 00571 G4RotationMatrix trapRotTemp; 00572 trapRotTemp.rotateX(a); 00573 trapRotTemp.rotateY(b); 00574 trapRotTemp.rotateZ(c); 00575 G4Transform3D transform(trapRotTemp,posW); 00576 //G4Transform3D transform(trapRot,posW); 00577 physicalPVFEcWest = new G4PVPlacement(transform,logicalPVFEcWest,osnamePVFEc.str(), logicalEcTofWest,false,i); 00578 posW.setX( bucketPosR*cos((0.5+i)*angleEc) ); 00579 posW.setY( bucketPosR*sin((0.5+i)*angleEc) ); 00580 //posW.setZ( zPosWestEc-ecL/2-thick-bucketLEc/2-0.01 ); 00581 posW.setZ(-ecL/2-thick-bucketLEc/2-0.01 ); 00582 physicalBucketEc = new G4PVPlacement(0,posW,logicalBucketEc,osnameBucketEc.str(),logicalEcTofWest,false,0); 00583 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc 00584 } 00585 //to make east scintillator start from phi=0 00586 // _ _ 00587 // _ - _ - 00588 // - - - - ====> - - - - ====> - - - - 00589 // ~ - _ 00590 // 00591 trapRot.rotateZ(-angleEc); 00592 trapRot.rotateX(180.*deg); //make east bucket point to the center 00593 for (int i=0;i<nScinEc;i++) 00594 { 00595 ostringstream osnamePVFEc; 00596 osnamePVFEc << "physicalPVFEcEast_"<<i; 00597 ostringstream osnameBucketEc; 00598 osnameBucketEc << "physicalBucketEcEast_"<<i; 00599 00600 posE.setX( ecR*cos((0.5+i)*angleEc) ); 00601 posE.setY( ecR*sin((0.5+i)*angleEc) ); 00602 //posE.setZ( zPosEastEc ); 00603 posE.setZ(0); 00604 00605 //to make code consistent with gdml 00606 double a, b, c; 00607 getXYZ(trapRot, a, b ,c); 00608 G4RotationMatrix trapRotTemp; 00609 trapRotTemp.rotateX(a); 00610 trapRotTemp.rotateY(b); 00611 trapRotTemp.rotateZ(c); 00612 G4Transform3D transform(trapRotTemp,posE); 00613 //G4Transform3D transform(trapRot,posE); 00614 physicalPVFEcEast = new G4PVPlacement(transform,logicalPVFEcEast,osnamePVFEc.str(), logicalEcTofEast,false,i); 00615 posE.setX( bucketPosR*cos((0.5+i)*angleEc) ); 00616 posE.setY( bucketPosR*sin((0.5+i)*angleEc) ); 00617 //posE.setZ( zPosEastEc+ecL/2+thick+bucketLEc/2+0.01 ); 00618 posE.setZ(ecL/2+thick+bucketLEc/2+0.01 ); 00619 physicalBucketEc = new G4PVPlacement(0,posE,logicalBucketEc,osnameBucketEc.str(),logicalEcTofEast,false,0); 00620 trapRot.rotateZ(angleEc); //pay attention: not i*angleEc 00621 } 00622 }
|
|
|
|
00625 { 00626 G4double a,z,density; 00627 G4int nel; 00628 G4String name, symbol; 00629 G4Element* H=G4Element::GetElement("Hydrogen"); 00630 if (!H) 00631 H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a=1.01*g/mole); 00632 00633 G4Element* C=G4Element::GetElement("Carbon"); 00634 if (!C) 00635 C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a=12.01*g/mole); 00636 00637 G4Element* F=G4Element::GetElement("Fluorin"); 00638 if (!F) 00639 F = new G4Element(name="Fluorin", symbol="F", z=9., a=18.01*g/mole); 00640 00641 BC404 = new G4Material("BC404",density=1.032*g/cm3,nel=2); 00642 BC404->AddElement(C,10); 00643 BC404->AddElement(H,11); 00644 00645 BC408 = new G4Material("BC408",density=1.032*g/cm3,nel=2); 00646 BC408->AddElement(C,1000); 00647 BC408->AddElement(H,1104); 00648 00649 PVF = new G4Material("PVF",density=1.45*g/cm3,nel=3); 00650 PVF->AddElement(C,2); 00651 PVF->AddElement(H,3); 00652 PVF->AddElement(F,1); 00653 //PVF = G4Material::GetMaterial("Air"); 00654 00655 //PMT mixed material 00656 G4Material* Cu = G4Material::GetMaterial("Copper"); 00657 00658 G4Material* Al = G4Material::GetMaterial("Aluminium"); 00659 00660 //SiO2 00661 G4Material* SiO2 =G4Material::GetMaterial("SiO2"); 00662 00663 //G4Material* SiO2 = new G4Material("SiO2",density=2*g/cm3, 2); 00664 //G4Element* Si = new G4Element("Silicon",symbol="Si" , z= 14., a= 28.09*g/mole); 00665 //G4Element* O=G4Element::GetElement("Oxygen"); 00666 //if(!O) 00667 // O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a= 16.00*g/mole); 00668 //SiO2->AddElement(Si,1); 00669 //SiO2->AddElement(O,2); 00670 00671 //vacuum 00672 //G4Material* Vacuum = 00673 // new G4Material("Galactic", z=1., a=1.01*g/mole,density= universe_mean_density, 00674 // kStateGas, 3.e-18*pascal, 2.73*kelvin); 00675 00676 density = 1.4618815*g/cm3; 00677 PMTmaterial = new G4Material(name="PMTmaterial", density, 4); 00678 PMTmaterial->AddMaterial(Al, 0.4495); 00679 PMTmaterial->AddMaterial(Cu,0.35); 00680 PMTmaterial->AddMaterial(SiO2,0.2); 00681 PMTmaterial->AddMaterial(G4Material::GetMaterial("Air"),0.0005); 00682 //PMTmaterial->AddMaterial(Vacuum,0.1); 00683 G4cout<<PMTmaterial; 00684 }
|
|
|
|
00038 {
00039 return const_cast<G4LogicalVolume*>( GDMLProcessor::GetInstance()->GetLogicalVolume(vn) );
00040 }
|
|
|
|
00687 { 00688 double cosb = sqrt( r.xx()*r.xx() + r.yx()*r.yx() ); 00689 00690 if (cosb > 16*FLT_EPSILON) 00691 { 00692 a = atan2( r.zy(), r.zz() ); 00693 b = atan2( -r.zx(), cosb ); 00694 c = atan2( r.yx(), r.xx() ); 00695 } 00696 else 00697 { 00698 a = atan2( -r.yz(), r.yy() ); 00699 b = atan2( -r.zx(), cosb ); 00700 c = 0.; 00701 } 00702 //std::cout.precision(20); 00703 //std::cout<<"in getXYZ :( "<<r.xx()<<" "<<r.xy()<<" "<<r.xz()<<std::endl; 00704 //std::cout<<" "<<r.yx()<<" "<<r.yy()<<" "<<r.yz()<<std::endl; 00705 //std::cout<<" "<<r.zx()<<" "<<r.zy()<<" "<<r.zz()<<std::endl; 00706 00707 //std::cout<<" details: cosb="<<cosb<<" a="<<a<<" b="<<b<<" c="<<c<<" min="<<16*FLT_EPSILON<<std::endl; 00708 00709 00710 00711 G4RotationMatrix temp; 00712 // std::cout<<"in detail temp :( "<<temp.xx()<<" "<<temp.xy()<<" "<<temp.xz()<<std::endl; 00713 // std::cout<<" "<<temp.yx()<<" "<<temp.yy()<<" "<<temp.yz()<<std::endl; 00714 // std::cout<<" "<<temp.zx()<<" "<<temp.zy()<<" "<<temp.zz()<<std::endl; 00715 // temp.rotateZ(0.5*360/88.0*deg-90.*deg); 00716 temp.rotateZ((c/deg)*deg); 00717 //std::cout.precision(20); 00718 //std::cout<<"in detail temp2:( "<<temp.xx()<<" "<<temp.xy()<<" "<<temp.xz()<<std::endl; 00719 //std::cout<<" "<<temp.yx()<<" "<<temp.yy()<<" "<<temp.yz()<<std::endl; 00720 //std::cout<<" "<<temp.zx()<<" "<<temp.zy()<<" "<<temp.zz()<<std::endl; 00721 00722 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|