20 #include <Geant4/G4LogicalVolume.hh>
21 #include <Geant4/G4Box.hh>
22 #include <Geant4/G4SubtractionSolid.hh>
23 #include <Geant4/G4SystemOfUnits.hh>
24 #include <Geant4/G4NistManager.hh>
25 #include <Geant4/G4VisAttributes.hh>
26 #include <Geant4/G4PVPlacement.hh>
27 #include <Geant4/G4VPhysicalVolume.hh>
28 #include <Geant4/G4OpticalPhoton.hh>
29 #include <Geant4/G4Scintillation.hh>
30 #include <Geant4/G4Cerenkov.hh>
32 #include <Geant4/G4Step.hh>
33 #include <Geant4/G4TouchableHistory.hh>
42 Cell::Cell(
const G4String& nam, G4int ix, G4int iy, G4int ncells, G4double zpos, G4double ypos, G4LogicalVolume *top,
CompCal&
d,
RootOut *rout):
51 G4double csiz = 2.6*
cm;
54 G4double zlen = 35*
cm;
57 G4String alv_nam =
fNam+
"_alv";
58 G4Box *alv_out =
new G4Box(alv_nam+
"_out", asiz/2., asiz/2, zlen/2.);
59 G4Box *alv_in =
new G4Box(alv_nam+
"_in", csiz/2., csiz/2, zlen/2.);
60 G4SubtractionSolid *alv_s =
new G4SubtractionSolid(alv_nam, alv_out, alv_in);
63 if( !G4Material::GetMaterial(
"CarbonFiber",
false) ) {
64 G4Element *elC =
new G4Element(
"Carbon",
"C", 6., 12.01*
g/mole);
65 G4Material *alv_m =
new G4Material(
"CarbonFiber", 0.145*
g/
cm3, 1);
66 alv_m->AddElement(elC, 1);
71 G4LogicalVolume *alv_l =
new G4LogicalVolume(alv_s, G4Material::GetMaterial(
"CarbonFiber"), alv_nam);
74 alv_l->SetVisAttributes( G4VisAttributes::GetInvisible() );
77 G4Material *crystal_m = G4NistManager::Instance()->FindOrBuildMaterial(
"G4_PbWO4");
84 G4Box *crystal_s =
new G4Box(
fNam, csiz/2., csiz/2, zlen/2.);
85 G4LogicalVolume *crystal_l =
new G4LogicalVolume(crystal_s, crystal_m,
fNam);
91 G4VisAttributes *vis =
new G4VisAttributes();
92 vis->SetColor(1, 0, 0, 0.5);
94 crystal_l->SetVisAttributes(vis);
97 G4double xcen = -asiz/2. * (ncells-1.) + ix*asiz;
99 G4double y0 = asiz/2. * (ncells-1.);
101 y0 = y0 + ncells*asiz/2. + ypos;
102 }
else if (ypos < -0.01) {
103 y0 = y0 - ncells*asiz/2. + ypos;
106 G4double ycen = y0 - iy*asiz;
109 G4VPhysicalVolume *alvvol =
new G4PVPlacement(
nullptr, G4ThreeVector(xcen, ycen, zpos-zlen/2.), alv_l, alv_nam, top,
false, 0);
113 G4VPhysicalVolume *csens =
new G4PVPlacement(
nullptr, G4ThreeVector(xcen, ycen, zpos-zlen/2.), crystal_l,
fNam, top,
false, 0);
121 G4Scintillation scin;
135 G4TouchableHandle touch = step->GetPreStepPoint()->GetTouchableHandle();
136 G4VPhysicalVolume*
volume = touch->GetVolume();
146 fE += step->GetTotalEnergyDeposit();
149 if(step->GetTrack()->GetDynamicParticle()->GetParticleDefinition() == G4OpticalPhoton::OpticalPhotonDefinition()) {
155 if(step->GetTrack()->GetTotalEnergy() > 100) {
158 const G4ThreeVector
point = step->GetPreStepPoint()->GetPosition();
164 det.
fXyzE = step->GetTrack()->GetTotalEnergy();
169 const std::vector<const G4Track*> *sec = step->GetSecondaryInCurrentStep();
170 std::vector<const G4Track*>::const_iterator i;
171 for(i = sec->begin(); i != sec->end(); i++) {
172 if((*i)->GetParentID() <= 0)
continue;
175 if((*i)->GetDynamicParticle()->GetParticleDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
continue;
179 G4int ptype = (*i)->GetCreatorProcess()->GetProcessType();
180 G4int pstype = (*i)->GetCreatorProcess()->GetProcessSubType();
230 std::string leaf = name +
"/D";
231 tree->Branch(name.c_str(), val, leaf.c_str());
241 std::string leaf = name +
"/l";
242 tree->Branch(name.c_str(), val, leaf.c_str());