Dear Users,
I am simulating Replicas and related properties to be obtained from the PhysicalVolume member functions.
I am interested in knowing the position of a particular replica obtained through positioning of a certain LogicalVolume inside another LogicalVolume.
Hereafter some code snippets of my source:
An array of pixels is created putting “pixels” copies of the “CMOSpixel” inside “CMOSarray”.
****** Detector Construction
G4double size = 10 * mm;
G4int pixels = 10;
G4Box* CMOSpixel = new G4Box(“CMOS_Pixel”, size / 2., size / 2., size /2.);
G4Box* CMOSarray = new G4Box(“CMOS_Array”, size * pixels/ 2., size / 2., size /2.);
G4LogicalVolume* PixelLogical = new G4LogicalVolume(CMOSpixel, voidSpace, “Pixel”);
G4LogicalVolume* ArrayLogical = new G4LogicalVolume(CMOSarray, voidSpace, “Array”);
G4PVReplica* Replica1 = new G4PVReplica(“Replica_level1”, PixelLogical, ArrayLogical, kXAxis, pixels, size, 0);
G4PVPlacement* ArrayPhysical = new G4PVPlacement(0, G4ThreeVector(0,0,40*cm), ArrayLogical, “ArrayPV”, worldLogical, false, 0, true);
Afterwards, step-by-step the geometry is inspected at Stepping Action time.
****** Stepping Action
for (int i = 0; iGetHistoryDepth(); i++)
{
G4cout<<"Stepping: "<<event<<
" Trk: "<GetTrack()->GetTrackID()<<
" Part: "<GetTrack()->GetParticleDefinition()->GetParticleName()<<
" Step: "<GetTrack()->GetCurrentStepNumber()<<
" PreStep: "<GetPreStepPoint()->GetPosition()<<
" PostStep: "<GetPostStepPoint()->GetPosition()<<
" TOUCHABLE – Lev: “<<i<<” "<GetVolume(i)->GetName()<<
" of depth "<GetHistoryDepth()<<
" IsReplicated: "<GetVolume(i)->IsReplicated()<<
" Transf: "<GetVolume(i)->GetTranslation()<<
" Replica Num: “<GetReplicaNumber(i)<<
" *******”<<
G4endl;
}
source according to the following macro file portion:
/gps/pos/centre -6 0 40 cm
/gps/direction 1 0 0
The output the (only one) event is as following:
Stepping: 0 Trk: 1 Part: opticalphoton Step: 2 PreStep: (-50,0,400) PostStep: (-40,0,400)
TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (-35,0,0) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 2 PreStep: (-50,0,400) PostStep: (-40,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 3 PreStep: (-40,0,400) PostStep: (-30,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (-25,0,0) Replica Num: 1
Stepping: 0 Trk: 1 Part: opticalphoton Step: 3 PreStep: (-40,0,400) PostStep: (-30,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 4 PreStep: (-30,0,400) PostStep: (-20,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (-15,0,0) Replica Num: 2
Stepping: 0 Trk: 1 Part: opticalphoton Step: 4 PreStep: (-30,0,400) PostStep: (-20,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 5 PreStep: (-20,0,400) PostStep: (-10,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (-5,0,0) Replica Num: 3
Stepping: 0 Trk: 1 Part: opticalphoton Step: 5 PreStep: (-20,0,400) PostStep: (-10,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 6 PreStep: (-10,0,400) PostStep: (0,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (5,0,0) Replica Num: 4
Stepping: 0 Trk: 1 Part: opticalphoton Step: 6 PreStep: (-10,0,400) PostStep: (0,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 7 PreStep: (0,0,400) PostStep: (10,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (15,0,0) Replica Num: 5
Stepping: 0 Trk: 1 Part: opticalphoton Step: 7 PreStep: (0,0,400) PostStep: (10,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 8 PreStep: (10,0,400) PostStep: (20,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (25,0,0) Replica Num: 6
Stepping: 0 Trk: 1 Part: opticalphoton Step: 8 PreStep: (10,0,400) PostStep: (20,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 9 PreStep: (20,0,400) PostStep: (30,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (35,0,0) Replica Num: 7
Stepping: 0 Trk: 1 Part: opticalphoton Step: 9 PreStep: (20,0,400) PostStep: (30,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 10 PreStep: (30,0,400) PostStep: (40,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (45,0,0) Replica Num: 8
Stepping: 0 Trk: 1 Part: opticalphoton Step: 10 PreStep: (30,0,400) PostStep: (40,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
Stepping: 0 Trk: 1 Part: opticalphoton Step: 11 PreStep: (40,0,400) PostStep: (50,0,400) TOUCHABLE – Lev: 0 Replica_level1 of depth 2 IsReplicated: 1 Transf: (45,0,0) Replica Num: 9
Stepping: 0 Trk: 1 Part: opticalphoton Step: 11 PreStep: (40,0,400) PostStep: (50,0,400) TOUCHABLE – Lev: 1 ArrayPV of depth 2 IsReplicated: 0 Transf: (0,0,400) Replica Num: 0
It is strange since the Transformation concerning each replicated element does not coincides with the center of the pixel, whilst the replica number is consistend.
I would expect a Transf vector series like that:
(-45,0,0) (-35,0,0) (-25,0,0) (-15,0,0) (-5,0,0) (5,0,0) (15,0,0) (25,0,0) (35,0,0) (45,0,0)
instead I get:
(-35,0,0) (-25,0,0) (-15,0,0) (-5,0,0) (5,0,0) (15,0,0) (25,0,0) (35,0,0) (45,0,0) (45,0,0)
Thank you in advance
Best Regards