QwGeant4
QweakSimTarget.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // ---------------------------
4 // | Doxygen File Information |
5 // ---------------------------
6 //
7 /**
8 
9  \file QweakSimTarget.cc
10 
11  $Revision: 1.2 $
12  $Date: 2005/12/27 19:15:13 $
13 
14  \author Klaus Hans Grimm
15 
16 */
17 //=============================================================================
18 
19 // Oct. 2011. Added in details of target geometry. -peiqing
20 
21 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
22 
23 #include "QweakSimTarget.hh"
24 
25 // geant4 includes
26 #include "G4UserLimits.hh"
27 
28 // user includes
29 #include "QweakSimSolids.hh"
30 #include "QweakSimMaterial.hh"
33 
34 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
35 
37 {
38  G4cout << G4endl << "###### Calling QweakSimTarget::QweakTarget() " << G4endl << G4endl;
39 
40  myUserInfo = myUI;
41 
42  theMotherPV = NULL;
43 
47 
48  TargetCell_Logical = NULL;
49  TargetCell_Physical = NULL;
50  TargetCell_Material = NULL;
51 
55 
59 
63 
67 
71 
72 
74 
82 
83  // define target geometry values
84 
85  targetCellEntranceWindowThickness = 4.105*mil; //Avg of Run 1 & 2 (Greg's Target Elog 19)
86  targetCellExitWindowThickness = 29.06*mil; //Greg's Target Elog 19
87  targetCellExitWindowNippleThickness = 5.165*mil; //Avg of Run 1 & 2 (Greg's Target Elog 19)
89 
91 
95  + targetCellExitWindowThickness; // Full length of Target
96 
97  targetCellFrontRadiusMin = 0.0*cm;
100 
104 
105  targetCellStartingPhi = 0.0*deg;
106  targetCellDeltaPhi = 360*deg;
107 
109 
112 
116 
117  //Thicknesses taken from 2012 target survey (https://qweak.jlab.org/elog/Target/21)
124  myUserInfo->TargetThicknessUSCDummy = 0.9973*mm;
125  myUserInfo->TargetThicknessDSCDummy = 3.1876*mm;
126 
127  G4double densityLH2 = 0.0713 /(cm*cm*cm); // [g/cm^3]
128  G4double densityAL = 2.804 /(cm*cm*cm); // Avg density, Greg's Target Elog 21
129  G4double densityUSC = 1.70 /(cm*cm*cm); //
130  G4double densityDSC = 2.205 /(cm*cm*cm); //
131 
132  // Molar masses taken from PDG:
133  // J. Beringer et al. (Particle Data Group), Phys. Rev. D86, 010001 (2012).
134  G4double massLH2 = 1.00794; // [g/mol]
135  G4double massAL = 26.9815386; // [g/mol]
136  G4double massC = 12.0107; // [g/mol]
137  //Added mass for the elements in the alloy (PDG - 2015)
138  G4double massZn = 65.38; //[g/mol]
139  G4double massMg = 24.3050; //[g/mol]
140  G4double massCu = 63.546; //[g/mol]
141  G4double massCr = 51.9961; //[g/mol]
142  G4double massFe = 55.845; //[g/mol]
143  G4double massSi = 28.0855; //[g/mol]
144  G4double massMn = 54.938044; //[g/mol]
145  G4double massTi = 47.867; //[g/mol]
146 
147  //Weighting factors for calculation of luminosity of elements in the aluminum alloy
148  //Only implementing for DS 4% Al dummy target. Weighting factors take from Greg's
149  //Target ELOG 30 - K.Bartlett 2017/7/13
150  G4double weight_std = 1.0;//Standard weight for hydrogen and other solid targets.
151  G4double weight_Al = 0.8870;//Aluminum's % by weight[unitless]
152  G4double weight_Zn = 0.0630;//Zinc's % by weight[unitless]
153  G4double weight_Mg = 0.0270;//Magnesium's % by weight
154  G4double weight_Cu = 0.0180;//Copper's % by weight
155  G4double weight_Cr = 0.0021;//Chromium's % by weight
156  G4double weight_Fe = 0.0012;//Iron's % by weight
157  G4double weight_Si = 0.0010;//Silicon's % by weight
158  G4double weight_Mn = 0.0004;//Manganese's % by weight
159  G4double weight_Ti = 0.0003;//Titanium's % by weight
160 
161 
162  myUserInfo->TargetLuminosityLH2 = CalculateLuminosity(massLH2, densityLH2, myUserInfo->TargetLength, weight_std);
173 
174  //Calculate luminosities for elements in alloy for DS 4%.
184 
185 
186 
187  TargetSD = NULL;
188 
190 }
191 
192 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
194 {
195  delete targetMessenger;
196 }
197 
198 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
199 
200 void QweakSimTarget::ConstructComponent(G4VPhysicalVolume* MotherVolume)
201 {
202  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructComponent() " << G4endl << G4endl;
203 
204  theMotherPV = MotherVolume;
205 
207 
208  ConstructTargetContainer(); // scattering chamber
210 
211  ConstructTargetCell(); // Al cell without end caps
212  ConstructTargetMaterial(); // LH2 for production target
213 
217 
218 //--------------------------------------
219 
220  G4cout << G4endl << "###### QweakSimTarget: Setting Attributes " << G4endl << G4endl;
221 
222  G4Colour blue (0.,0.,1.);
223  G4Colour red (1.,0.,0.);
224 
225  G4VisAttributes* TargetContainer_VisAtt = new G4VisAttributes(red);
226  TargetContainer_VisAtt -> SetVisibility(false);
227  //TargetContainer_VisAtt -> SetForceWireframe(true);
228  TargetContainer_Logical -> SetVisAttributes(TargetContainer_VisAtt);
229 
230  G4VisAttributes* TargetCell_VisAtt = new G4VisAttributes(blue);
231  TargetCell_VisAtt -> SetVisibility(true);
232  //TargetCell_VisAtt -> SetForceWireframe(true);
233  TargetCell_Logical -> SetVisAttributes(TargetCell_VisAtt);
234 
235  G4VisAttributes* TargetWindow_VisAtt = new G4VisAttributes(blue);
236  TargetWindow_VisAtt -> SetVisibility(true);
237  //TargetWindow_VisAtt -> SetForceWireframe(true);
238  TargetEntranceWindow_Logical -> SetVisAttributes(TargetWindow_VisAtt);
239  TargetExitWindow_Logical -> SetVisAttributes(TargetWindow_VisAtt);
240 
241  G4VisAttributes* ScatteringChamberWindow_VisAtt = new G4VisAttributes(red);
242  ScatteringChamberWindow_VisAtt -> SetVisibility(true);
243  //ScatteringChamberWindow_VisAtt -> SetForceWireframe(true);
244  ScatteringChamberWindow_Logical -> SetVisAttributes(ScatteringChamberWindow_VisAtt);
245 
246  G4VisAttributes* TargetMaterial_VisAtt = new G4VisAttributes(red);
247  TargetMaterial_VisAtt -> SetVisibility(true);
248  //TargetVisAtt -> SetForceWireframe(true);
249  TargetMaterial_Logical -> SetVisAttributes(TargetMaterial_VisAtt);
250 
251  ///////////////////////////////////////////
252  // Define Sensitive Detectors to Target //
253  ///////////////////////////////////////////
254 
255  G4SDManager* SDman = G4SDManager::GetSDMpointer();
256 
257  TargetSD = new QweakSimTarget_DetectorSD("TargetSD");
258  SDman->AddNewDetector(TargetSD);
259  ScatteringChamberWindow_Logical->SetSensitiveDetector(TargetSD);
260 
261 
262  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructComponent() " << G4endl << G4endl;
263 
264 } // end of QweakSimTarget::ConstructComponent()
265 
267 
268  // define Target position
269  positionTarget = G4ThreeVector(0,0,0);
272  positionScatteringChamberWindow = G4ThreeVector(0,0,0.5*targetCellInnerLength + 0.5*targetCellExitWindowThickness + 45.0*cm); // Peiqing: should be located at z=-583.41 cm
273 
276  + targetCellExitWindowThickness; // Full length of Target
277 
279  G4cout << "TargetContainer_Physical = " << TargetContainer_Physical->GetTranslation()/cm << " cm" << G4endl;
280  }
281 
282  G4cout << "targetCellEntranceWindowThickness: " << targetCellEntranceWindowThickness/cm << " cm" << G4endl;
283  G4cout << "positionTargetEntranceWindow: " << positionTargetEntranceWindow/cm << " cm" << G4endl;
284  G4cout << "positionTarget: " << positionTarget/cm << " cm" << G4endl;
285  G4cout << "positionTargetExitWindow: " << positionTargetExitWindow/cm << " cm" << G4endl;
286  G4cout << "targetCellExitWindowThickness: " << targetCellExitWindowThickness/cm << " cm" << G4endl;
287  G4cout << "positionScatteringChamberWindow: " << positionScatteringChamberWindow/cm << " cm" << G4endl;
288  G4cout << "targetCellInnerLength = " << targetCellInnerLength/cm << " cm" << G4endl;
289  G4cout << "targetCellOuterLength = " << targetCellOuterLength/cm << " cm" << G4endl;
290 }
291 
292 
294 {
295  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetContainer() " << G4endl << G4endl;
296 
297  G4Tubs* TargetContainer_Solid = new G4Tubs("TargetContainer_Sol",
298  0, //targetCellRadiusMin, jpan@nuclear.uwinnipeg.ca
300  0.5*targetCellOuterLength+50.0*cm,
303 
304  TargetContainer_Logical = new G4LogicalVolume(TargetContainer_Solid,
306  "TargetContainer_Log",
307  0,0,0);
308 
309  TargetContainer_Physical = new G4PVPlacement(0,
311  "TargetContainer",
313  theMotherPV,
314  false,
315  0,
316  pSurfChk);
317  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetContainer() " << G4endl << G4endl;
318 
319 }
320 
322 {
323  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetCell() " << G4endl << G4endl;
324 
327 
328  delete TargetCell_Physical;
329  TargetCell_Physical = NULL;
330 
331  // define target solid volume
332  G4cout << G4endl << "###### QweakSimTarget: Define TargetCell_Solid " << G4endl << G4endl;
333  // front and back inner radius are at targetCellInnerLength, not targetCellOuterLength
334  G4double correction
338  G4Cons* TargetCell_Solid = new G4Cons("QweakTargetCell_Sol",
339  targetCellFrontInnerRadiusMax+correction,// G4double pRmin1,
340  targetCellFrontOuterRadiusMax, // G4double pRmax1,
341  targetCellBackInnerRadiusMax+correction, //G4double pRmin2,
342  targetCellBackOuterRadiusMax, //G4double pRmax2,
343  0.5*targetCellOuterLength, //G4double pDz,
344  targetCellStartingPhi, //G4double pSPhi,
345  targetCellDeltaPhi); //G4double pDPhi)
346 
347  // define Target logical volume
348  G4cout << G4endl << "###### QweakSimTarget: Define TargetCell_Logical " << G4endl << G4endl;
349 
350  TargetCell_Logical = new G4LogicalVolume(TargetCell_Solid,
352  "QweakTargetCell_Log",
353  0,0,0);
354  // define Target physical volume
355  G4cout << G4endl << "###### QweakSimTarget: Define TargetCell_Physical " << G4endl << G4endl;
356  TargetCell_Physical = new G4PVPlacement(0,
358  "QweakTargetCell",
360  TargetContainer_Physical, //MotherVolume,
361  false,
362  0,
363  pSurfChk);
364  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetCell() " << G4endl << G4endl;
365 
366 }
367 
369 {
370  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetEntranceWindow() " << G4endl << G4endl;
371 
374 
377 
378 //--------------------------------------
379  // define target window solid volume (front, upstream)
380  G4cout << G4endl << "###### QweakSimTarget: Define TargetEntranceWindow_Solid " << G4endl << G4endl;
381 
382  G4Tubs* TargetEntranceWindow_Solid = new G4Tubs("TargetEntranceWindow_Sol",
388 
389  // define Target window logical volume (front, upstream)
390  G4cout << G4endl << "###### QweakSimTarget: Define TargetEntranceWindow_Logical " << G4endl << G4endl;
391 
392  TargetEntranceWindow_Logical = new G4LogicalVolume(TargetEntranceWindow_Solid,
394  "QweakTargetEntranceWindow_Log",
395  0,0,0);
396 
397  //G4double MaxStepInEntranceWindow = 0.1*targetCellEntranceWindowThickness;
398  //TargetEntranceWindow_Logical->SetUserLimits(new G4UserLimits(MaxStepInEntranceWindow));
399 
400  // define Target window physical volume (front, upstream)
401  G4cout << G4endl << "###### QweakSimTarget: Define TargetEntranceWindow_Physical " << G4endl << G4endl;
402  TargetEntranceWindow_Physical = new G4PVPlacement(0,
404  "QweakTargetEntranceWindow",
406  TargetContainer_Physical, //MotherVolume,
407  false,
408  0,
409  pSurfChk);
410  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetEntranceWindow() " << G4endl << G4endl;
411 
412 }
413 
415 {
416  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetExitWindow() " << G4endl << G4endl;
417 
420 
423 
424  // define target window solid volume (back, downstream)
425  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindow_Solid " << G4endl << G4endl;
426 
427  G4Tubs* TargetExitWindow_Solid = new G4Tubs("TargetExitWindow_Sol",
433 
434  // define Target window logical volume (back, downstream)
435  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindow_Logical " << G4endl << G4endl;
436 
437  TargetExitWindow_Logical = new G4LogicalVolume(TargetExitWindow_Solid,
439  "QweakTargetExitWindow_Log",
440  0,0,0);
441 
442  // Set max step size for a certain volume, see
443 // http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/
444 // ForApplicationDeveloper/html/TrackingAndPhysics/thresholdVScut.html
445  //G4double MaxStepInExitWindow = 0.1*targetCellExitWindowThickness;
446  //TargetExitWindow_Logical->SetUserLimits(new G4UserLimits(MaxStepInExitWindow));
447 
448 
449  // define Target window physical volume (back, downstream)
450  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindow_Physical " << G4endl << G4endl;
451  TargetExitWindow_Physical = new G4PVPlacement(0,
453  "QweakTargetExitWindow",
455  TargetContainer_Physical, //MotherVolume,
456  false,
457  0,
458  pSurfChk);
459  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetExitWindow() " << G4endl << G4endl;
460 
461 }
462 
464 {
465  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetExitWindowNipple() " << G4endl << G4endl;
466 
469 
472 
473  // define target window Nipple solid volume (back, downstream)
474  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindowNipple_Solid " << G4endl << G4endl;
475 
476  G4Tubs* TargetExitWindowNipple_Solid = new G4Tubs("TargetExitWindowNipple_Sol",
477  0.,
479  // targetCellExitWindowNippleRadius-0.00001*mm,
483 
484  // define Target window logical volume (back, downstream)
485  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindowNipple_Logical " << G4endl << G4endl;
486 
487  TargetExitWindowNipple_Logical = new G4LogicalVolume(TargetExitWindowNipple_Solid,
489  "QweakTargetExitWindowNipple_Log",
490  0,0,0);
491 
492  //G4double MaxStepInExitWindowNipple = 0.1*targetCellExitWindowNippleThickness;
493  //TargetExitWindowNipple_Logical->SetUserLimits(new G4UserLimits(MaxStepInExitWindowNipple));
494 
495  // define Target window nipple physical volume (back, downstream)
496  G4cout << G4endl << "###### QweakSimTarget: Define TargetExitWindowNipple_Physical " << G4endl << G4endl;
497  TargetExitWindowNipple_Physical = new G4PVPlacement(0,
499  "QweakTargetExitWindowNipple_Physical",
501  TargetContainer_Physical, //MotherVolume,
502  false,
503  0,
504  pSurfChk);
505  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetExitWindowNipple() " << G4endl << G4endl;
506 
507 }
508 
510 {
511  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructScatteringChamberWindow() " << G4endl << G4endl;
512 
513  //*********************** Define Target scattering chamber Vacuum Window ************************
514  G4cout << G4endl << "###### QweakSimTarget: Define ScatteringChamberWindow_Solid " << G4endl << G4endl;
515  G4Tubs* ScatteringChamberWindow_Solid = new G4Tubs("ScatteringChamberWindow_Sol",
516  0.,
521 
522  // define ScatteringChamberWindow logical volume
523  G4cout << G4endl << "###### QweakSimTarget: Define ScatteringChamberWindow_Logical " << G4endl << G4endl;
524 
525  ScatteringChamberWindow_Logical = new G4LogicalVolume(ScatteringChamberWindow_Solid,
527  "ScatteringChamberWindow_Log",
528  0,0,0);
529 
530  // define Target vacuum window physical volume
531  G4cout << G4endl << "###### QweakSimTarget: Define ScatteringChamberWindow_Physical " << G4endl << G4endl;
532  ScatteringChamberWindow_Physical = new G4PVPlacement(0,
534  "ScatteringChamberWindow",
536  TargetContainer_Physical, //MotherVolume,
537  false,
538  0,
539  pSurfChk);
540  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructScatteringChamberWindow() " << G4endl << G4endl;
541 
542 //*************************End of Target Vacuum Window *****************************
543 }
544 
545 //--------------------------------------
546 
548 {
549  // define target material solid volume
550  G4cout << G4endl << "###### Calling QweakSimTarget::ConstructTargetMaterial() " << G4endl << G4endl;
551 
554 
557 
558  G4Cons* TargetMaterial_Solid = new G4Cons("QweakTargetMaterial_Sol",
559  0., //targetCellFrontRadiusMin, // G4double pRmin1,
560  targetCellFrontInnerRadiusMax, // G4double pRmax1,
561  0., //targetCellBackRadiusMin, //G4double pRmin2,
562  targetCellBackInnerRadiusMax, //G4double pRmax2,
563  0.5*targetCellInnerLength, //G4double pDz,
564  targetCellStartingPhi, //G4double pSPhi,
565  targetCellDeltaPhi); //G4double pDPhi)
566 
567 
568  // define Target logical volume
569  G4cout << G4endl << "###### QweakSimTarget: Define Target_Logical " << G4endl << G4endl;
570 
571  TargetMaterial_Logical = new G4LogicalVolume(TargetMaterial_Solid,
573  "QweakTargetMaterial_Log",
574  0,0,0);
575 
576  // set max step size for LH2 target
577  //G4double MaxStepInTarget = 0.05*targetCellInnerLength; //step size < 20% of target length
578  //TargetMaterial_Logical->SetUserLimits(new G4UserLimits(MaxStepInTarget));
579 
580  // define Target material physical volume
581  G4cout << G4endl << "###### QweakSimTarget: Define TargetMaterial_Physical " << G4endl << G4endl;
582  TargetMaterial_Physical = new G4PVPlacement(0,
584  "QweakTargetMaterial",
586  TargetContainer_Physical, //MotherVolume,
587  false,
588  0,
589  pSurfChk);
590  G4cout << G4endl << "###### Leaving QweakSimTarget::ConstructTargetMaterial() " << G4endl << G4endl;
591 
592 }
593 
594 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
595 
596 void QweakSimTarget::SetTarget(G4String targName)
597 { // NOTE: Can only make one call at a time. To change targets you must
598  // make a new run, otherwise the positions of the dummy target will be wrong.
599 
600  double zlength = 0.0; // Use for setting dummy position such that
601  // US face's are aligned (see Target ELOG 18).
602  // Technically the US targets are on average 1.39 mm upstream of the entrance window
603  // and the DS targets are on average 2.97 mm upstream of the exit window. For simplicity
604  // just align the US faces at -(+)17.173 cm for the US(DS) targets.
605  // K.E. Mesick 23/September/2014
606 
607  if (strcmp(targName,"LH2")==0)
608  {
609  G4cout << "==== Target is LH2 by default!! " << G4endl;
610  }
611  else if (strcmp(targName,"USAl1p")==0)
612  {
613  G4cout << "==== Changing Target to " << targName << G4endl;
617  SetTargetLength(zlength);
618  SetTargetMaterial("Vacuum");
619  SetTargetExitWindowMaterial("Vacuum");
621  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
622  }
623  else if (strcmp(targName,"USAl2p")==0)
624  {
625  G4cout << "==== Changing Target to " << targName << G4endl;
629  SetTargetLength(zlength);
630  SetTargetMaterial("Vacuum");
631  SetTargetExitWindowMaterial("Vacuum");
633  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
634  }
635  else if (strcmp(targName,"USAl4p")==0)
636  {
637  G4cout << "==== Changing Target to " << targName << G4endl;
641  SetTargetLength(zlength);
642  SetTargetMaterial("Vacuum");
643  SetTargetExitWindowMaterial("Vacuum");
645  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
646  }
647  else if (strcmp(targName,"USC")==0)
648  {
649  G4cout << "==== Changing Target to " << targName << G4endl;
653  SetTargetLength(zlength);
654  SetTargetMaterial("Vacuum");
655  SetTargetExitWindowMaterial("Vacuum");
657  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
658  }
659  else if (strcmp(targName,"DSAl2p")==0)
660  {
661  G4cout << "==== Changing Target to " << targName << G4endl;
662  zlength = targetCellInnerLength;
664  SetTargetLength(zlength);
665  SetTargetMaterial("Vacuum");
668  SetTargetExitWindowMaterial("Aluminum");
670  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
671  }
672  else if (strcmp(targName,"DSAl4p")==0)
673  {
674  G4cout << "==== Changing Target to " << targName << G4endl;
675  zlength = targetCellInnerLength;
677  SetTargetLength(zlength);
678  SetTargetMaterial("Vacuum");
681  //Changed to AlAlloy for alloy simulations. K. Bartlett 2016/9/13
682  SetTargetExitWindowMaterial("AlAlloy");
684  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
685  }
686  else if (strcmp(targName,"DSAl4pVacuum")==0)
687  {
688  //Special vacuum DS 4% aluminum target for radiative correction studies.
689  G4cout << "==== Changing Target to " << targName << G4endl;
690  zlength = targetCellInnerLength;
692  SetTargetLength(zlength);
693  SetTargetMaterial("Vacuum");
696  SetTargetExitWindowMaterial("Vacuum");
698  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
699  }
700  else if (strcmp(targName,"DSAl8p")==0)
701  {
702  G4cout << "==== Changing Target to " << targName << G4endl;
703  zlength = targetCellInnerLength;
705  SetTargetLength(zlength);
706  SetTargetMaterial("Vacuum");
709  SetTargetExitWindowMaterial("Aluminum");
711  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
712  }
713  else if (strcmp(targName,"DSC")==0)
714  {
715  G4cout << "==== Changing Target to " << targName << G4endl;
716  zlength = targetCellInnerLength;
718  SetTargetLength(zlength);
719  SetTargetMaterial("Vacuum");
722  SetTargetExitWindowMaterial("DSCarbon");
724  G4cout << "==== Changing Target : Now the Target is " << targName << G4endl;
725  }
726  else {
727  G4cerr << "==== ERROR: Changing Target failed" << G4endl;
728  }
729 
730 }
731 
732 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
733 
734 void QweakSimTarget::SetTargetMaterial(G4String materialName)
735 {
736  // search the material by its name
737  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
738  if (pttoMaterial)
739  {
740  G4cout << "==== Changing Target Material: Looking up Material " << G4endl;
741  TargetMaterial_Logical->SetMaterial(pttoMaterial);
742  G4cout << "==== Changing Target Material: Now the Target is made of " << materialName << G4endl;
743  }
744  else {
745  G4cerr << "==== ERROR: Changing Target Material failed" << G4endl;
746  }
747 
748 }
749 
750 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
751 
752 void QweakSimTarget::SetTargetCellMaterial(G4String materialName)
753 {
754  // search the material by its name
755  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
756  if (pttoMaterial)
757  {
758  G4cout << "==== Changing Target Cell Material: Looking up Material " << G4endl;
759  TargetCell_Logical->SetMaterial(pttoMaterial);
760  G4cout << "==== Changing Target Cell Material: Now the Target Cell is made of " << materialName << G4endl;
761  }
762  else {
763  G4cerr << "==== ERROR: Changing Target Cell Material failed" << G4endl;
764  }
765 
766 }
767 
768 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
769 
771 {
772  // search the material by its name
773  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
774  if (pttoMaterial)
775  {
776  G4cout << "==== Changing Target Entrance Window Material: Looking up Material " << G4endl;
777  TargetEntranceWindow_Logical->SetMaterial(pttoMaterial);
778  G4cout << "==== Changing Target Entrance Window Material: Now the Target Entrance Window is made of " << materialName << G4endl;
779  }
780  else {
781  G4cerr << "==== ERROR: Changing Target Entrance Window Material failed" << G4endl;
782  }
783 
784 }
785 
786 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
787 
789 {
790  // search the material by its name
791  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
792  if (pttoMaterial)
793  {
794  G4cout << "==== Changing Target Exit Window Material: Looking up Material " << G4endl;
795  TargetExitWindow_Logical->SetMaterial(pttoMaterial);
796  G4cout << "==== Changing Target Exit Window Material: Now the Target Exit Window is made of " << materialName << G4endl;
797  }
798  else {
799  G4cerr << "==== ERROR: Changing Target Exit Window Material failed" << G4endl;
800  }
801 
802 }
803 
804 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
805 
807 {
808  // search the material by its name
809  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
810  if (pttoMaterial)
811  {
812  G4cout << "==== Changing Target Exit Window Nipple Material: Looking up Material " << G4endl;
813  TargetExitWindowNipple_Logical->SetMaterial(pttoMaterial);
814  G4cout << "==== Changing Target Exit Window Nipple Material: Now the Target Exit Window Nipple is made of " << materialName << G4endl;
815  }
816  else {
817  G4cerr << "==== ERROR: Changing Target Exit Window Nipple Material failed" << G4endl;
818  }
819 
820 }
821 
822 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
823 
825 {
826 }
827 
828 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
829 
831 {
832  G4cout << G4endl << "###### Calling QweakSimTarget::SetTargetCenterPositionInZ() " << G4endl << G4endl;
833 
834  targetZPos = zPos;
836  TargetContainer_Physical->SetTranslation(G4ThreeVector(0.,0.,zPos));
837  G4cout << "==== Changing Target CenterPositionZ: Now the Target Center Position in Z is " << zPos/cm << " cm" << G4endl;
838 }
839 
841 {
842  G4cout << G4endl << "###### Calling QweakSimTarget::GetTargetCenterPositionInZ() " << G4endl << G4endl;
843  G4cout << "==== Getting Target CenterPositionZ: Now the Target Center Position in Z is " << targetZPos/cm << " cm" << G4endl;
844  return targetZPos;
845 }
846 
847 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
849 {
850  G4cout << G4endl << "###### Calling QweakSimTarget::SetTargetLength() " << G4endl << G4endl;
851 
852  targetCellInnerLength = len;
853  myUserInfo->TargetLength = len;
854  G4cout << "==== Changing Target Length: Now the Target Length is " << len/cm << " cm" << G4endl;
855 
857 
858  // construct target cell/material of appropriate length
859  ConstructTargetCell(); // Al cell without end caps
860  ConstructTargetMaterial(); // LH2 for production target
861 
862  // construct the end caps at the correct location
866 
867  G4cout << G4endl << "###### Leaving QweakSimTarget::SetTargetLength() " << G4endl << G4endl;
868 }
869 
871 {
872  G4cout << G4endl << "###### Calling QweakSimTarget::GetTargetLength() " << G4endl << G4endl;
873  G4cout << "==== Getting Target Length: Now the Target Length is " << targetCellInnerLength/cm << " cm" << G4endl;
874  return targetCellInnerLength;
875 }
876 
877 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
879 {
880  G4cout << G4endl << "###### Calling QweakSimTarget::SetTargetEntranceWindowLength() " << G4endl << G4endl;
881 
884 
885  G4cout << "==== Changing Target Entrance Window Length: Now the Target Entrance Window Length is " << len/mm << " mm" << G4endl;
886 
889 
890  G4cout << G4endl << "###### Leaving QweakSimTarget::SetTargetEntranceWindowLength() " << G4endl << G4endl;
891 }
892 
894 {
895  G4cout << G4endl << "###### Calling QweakSimTarget::SetTargetExitWindowLength() " << G4endl << G4endl;
896 
899  G4cout << "==== Changing Target Exit Window Length: Now the Target Exit Window Length is " << len/mm << " mm" << G4endl;
900 
903 
904  G4cout << G4endl << "###### Leaving QweakSimTarget::SetTargetExitWindowLength() " << G4endl << G4endl;
905 }
906 
908 {
909  G4cout << G4endl << "###### Calling QweakSimTarget::SetTargetExitWindowNippleLength() " << G4endl << G4endl;
910 
913  G4cout << "==== Changing Target Exit Window Nipple Length: Now the Target Exit Window Nipple Length is " << len/mm << " mm" << G4endl;
914 
917 
918  G4cout << G4endl << "###### Leaving QweakSimTarget::SetTargetExitWindowNippleLength() " << G4endl << G4endl;
919 }
920 
921 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
922 
923 G4double QweakSimTarget::CalculateLuminosity(G4double mass, G4double density, G4double length, G4double pweight)
924 {
925  G4double Lum = 0.0; // Luminosity
926  G4double N_b = 6.241e12; // [Hz/uA] # of particles in the beam (from definition of ampere)
927  G4double N_A = 6.02214129e23; // Avagadro's number
928 
929  Lum = N_b*length*pweight*density*N_A/mass; // units [Hz/(uA*mm^2)]
930 
931  Lum *= 1e-31; // Conversion from [Hz/(uA*mm^2)] -> [kHz/(uA*ub)]
932 
933  return Lum;
934 }
935 
936 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Material * ScatteringChamberWindow_Material
G4VPhysicalVolume * TargetEntranceWindow_Physical
G4double targetCellOuterLength
G4double ScatteringChamberWindowRadius
G4double CalculateLuminosity(G4double mass, G4double density, G4double length, G4double pweight)
static QweakSimMaterial * GetInstance()
G4double targetCellWallThickness
G4VSensitiveDetector * TargetSD
void ConstructTargetExitWindow()
void ConstructTargetContainer()
G4LogicalVolume * TargetExitWindow_Logical
Scans the input file for /Target/xyz commands.
void ConstructComponent(G4VPhysicalVolume *)
void ConstructTargetExitWindowNipple()
static const G4bool pSurfChk
G4double targetCellFrontInnerRadiusMax
void ConstructTargetMaterial()
G4ThreeVector positionTarget
G4VPhysicalVolume * TargetMaterial_Physical
QweakSimMaterial * pMaterial
G4Material * TargetMaterial_Material
G4Material * TargetExitWindow_Material
void CalculateTargetPositions()
G4double GetTargetLength()
G4double targetCellExitWindowNippleRadius
G4double targetCellStartingPhi
G4LogicalVolume * TargetMaterial_Logical
void SetTargetCenterPositionInZ(G4double)
G4VPhysicalVolume * TargetCell_Physical
G4VPhysicalVolume * TargetExitWindow_Physical
void ConstructTargetEntranceWindow()
static const G4double inch
static const G4double mil
void SetTargetEntranceWindowLength(G4double)
G4double targetCellFrontRadiusMin
G4ThreeVector positionScatteringChamberWindow
G4double targetCellEntranceWindowThickness
G4Material * GetMaterial(G4String material)
void SetTargetEntranceWindowMaterial(G4String)
G4double targetCellInnerLength
G4Material * TargetExitWindowNipple_Material
void ConstructTargetCell()
void SetTargetExitWindowNippleLength(G4double)
G4ThreeVector positionTargetExitWindow
G4LogicalVolume * ScatteringChamberWindow_Logical
G4LogicalVolume * TargetContainer_Logical
G4VPhysicalVolume * ScatteringChamberWindow_Physical
void SetTargetMaterial(G4String)
void SetTargetCellMaterial(G4String)
void SetTargetExitWindowLength(G4double)
G4LogicalVolume * TargetExitWindowNipple_Logical
G4double GetTargetCenterPositionInZ()
G4double targetCellBackInnerRadiusMax
G4VPhysicalVolume * TargetContainer_Physical
void ConstructScatteringChamberWindow()
G4LogicalVolume * TargetEntranceWindow_Logical
G4double targetCellDeltaPhi
QweakSimTarget(QweakSimUserInformation *myUI)
G4double targetCellBackOuterRadiusMax
G4Material * TargetContainer_Material
G4ThreeVector positionTargetEntranceWindow
G4double ScatteringChamberWindowThickness
void SetTargetExitWindowMaterial(G4String)
G4double targetCellBackRadiusMin
G4Material * TargetEntranceWindow_Material
G4double targetCellExitWindowThickness
G4double targetCellExitWindowNippleThickness
G4Material * TargetCell_Material
G4VPhysicalVolume * theMotherPV
QweakSimTargetMessenger * targetMessenger
void SetTargetLength(G4double)
void SetTargetExitWindowNippleMaterial(G4String)
G4VPhysicalVolume * TargetExitWindowNipple_Physical
void SetTarget(G4String)
G4LogicalVolume * TargetCell_Logical
G4double targetCellFrontOuterRadiusMax
QweakSimUserInformation * myUserInfo