Message: Sharing copynumber? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question Sharing copynumber? 

Forum: Event and Track Management
Date: 23 Apr, 2016
From: Selina Chen <Selina Chen>

Hi all,I ran into some difficulties. I constructed a detector like this

  G4Tubs* solidShape3= new G4Tubs("Shape3",
                                   innerradiusofthetube,
                                   outradiusofthetube,
                                   heightofthetube,
                                   startingleofthetube,
                                   spanningangleofthetube);
  G4LogicalVolume* logicShape3 =
    new G4LogicalVolume(solidShape3,         //its solid
                        shape3_mat,          //its material
                        "Shape3");           //its name

// place crystals within a ring

  for (G4int icrys = 0; icrys < nb_shape3 ; icrys++) {
    G4double phi = icrys*dPhi;
    G4RotationMatrix rotm  = G4RotationMatrix();
    rotm.rotateY(90*deg); 
    rotm.rotateZ(phi);
    G4ThreeVector uz = G4ThreeVector(std::cos(phi),  std::sin(phi),0.);     
    G4ThreeVector position = (15*mm)*uz;
    G4Transform3D transform = G4Transform3D(rotm,position);

    new G4PVPlacement(transform,             //rotation,position
                      logicShape3,            //its logical volume
                      "Shape3",             //its name
                      logicWorld,             //its mother  volume
                      false,                 //no boolean operation
                      icrys,                 //copy number
                      checkOverlaps);       // checking overlaps 

} And I want to get the energy of electrons energy arriving each detector,so in SteppingAction,I use this:

 G4double Energy= aStep->GetTrack()->GetKineticEnergy();

 G4int PostCopyNum = aStep->GetPostStepPoint()->GetTouchableHandle()->GetCopyNumber();

    const G4VPhysicalVolume* volume = aStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume();

    const G4VPhysicalVolume* volume1 = aStep->GetPostStepPoint()->GetTouchableHandle()->GetVolume();
...
...
...
if ((particlename =="e-")&&(VolumeName!="Shape3")&&(VolumeName1=="Shape3")&&(PostCopyNum=16))
  {
    std::fstream file("detector16.txt", std::ios::out|std::ios::app);
    file<<setw(10)<<particlename <<setw(20)<<Energy/eV<<setw(10)<<PostCopyNum<<setw(10)<<EventId<<endl;
  }
  if ((particlename =="e-")&&(VolumeName!="Shape3")&&(VolumeName1=="Shape3"))//reach shape3
  {
    std::fstream file("shape3.txt", std::ios::out|std::ios::app);
    file<<setw(10)<<particlename <<setw(20)<<Energy/eV<<setw(10)<<PostCopyNum<<setw(10)<<EventId<<endl;
}

However,I got this:
detector:
        e-              270.81        15       154
        e-             271.174        15      1458
        e-              270.12        15      2585
        e-             271.163        15     14579
        e-             270.798        15     22898
        e-             270.699        15     25045
        e-             270.838        15     26794
        e-             270.698        15     29550
        e-             269.119        15     32584
        e-             270.812        15     34249
        e-             270.725        15     37012
        e-             271.174        15     76952
        e-               271.2        15     77952
        e-             270.837        15     83914
        e-             270.953        15     84582
        e-              270.81        15       154
        e-             271.174        15      1458
        e-              270.12        15      2585
        e-             271.163        15     14579
        e-             270.798        15     22898
        e-             270.699        15     25045
        e-             270.838        15     26794
        e-             270.698        15     29550
        e-             269.119        15     32584
        e-             270.812        15     34249
        e-             270.725        15     37012
        e-             271.174        15     76952
        e-               271.2        15     77952
        e-             270.837        15     83914
        e-             270.953        15     84582

Shape3(All detectors):
        e-              270.81        15       154
        e-             271.174        15      1458
        e-              270.12        15      2585
        e-             271.163        15     14579
        e-             270.798        15     22898
        e-             270.699        15     25045
        e-             270.838        15     26794
        e-             270.698        15     29550
        e-             269.119        15     32584
        e-             270.812        15     34249
        e-             270.725        15     37012
        e-             271.174        15     76952
        e-               271.2        15     77952
        e-             270.837        15     83914
        e-             270.953        15     84582
It seems like all detectors sharing the same copynumber.
Do you have any suggestions?

Thanks Selina

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 None: Re: Sharing copynumber?   (Artem Zontikov - 23 Apr, 2016)
 Add Message Add Message
to: "Sharing copynumber?"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]