Forum: Hits, Digitization and Pileup Not Logged In (login)
Show subscribers

This forum includes topics on the properties of hits and their interactions with sensitive detectors, the use of digitization to model detector response, and the simulation of pileup.

The email gateway for this forum is: hitsdigits-g4hn@slac.stanford.edu


Inline Depth:
 0 0
 1 1
Add message: (add)

Question Multiple Layer Detectors. How to declare sensitive in the READOUT_GEOMETRY?  by <kalitan>,   Nov 07, 06:06
Dear Experts/Geant4 Users,

I am working on a project using 3 or 5 Layers of scintillator bars. Each Layer has a Horizontal and Vertical ReadOut Planes, and each plane is composed of many scintillator bars with dimension 1 cm x 2 cm x 240 cm. The situation is similar to the one reported in the forum: http://hypernews.slac.stanford.edu:5090/HyperNews/geant4/get/geometry/115/2.html

Since each layer is separated by some distance, the concept of parameterisation may applied on the Layer Placements, while the concept of replication is useful within the specific planes. I wrote a code below for the X-read out of the HORIZONTAL plane only.

  //-----------------
  //  The X-READOUT
  //-----------------

  G4VSolid * oneXRO_Box
    = new G4Box("oneXRO_Box",firstLength/2,AbsThick/2,AbsHeight/2);

  G4LogicalVolume * oneXRO_Box_log
    = new G4LogicalVolume(oneXRO_Box,Vacuum,"oneXRO_L",0,0,0);

  G4VPhysicalVolume * oneXRO_Box_phys =
      new G4PVPlacement(0,
                        G4ThreeVector(0.0*cm,AbsThick/2,0.0*cm),
                        oneXRO_Box_log,
                        "oneXRO_P",
  			logicChamber,false,0);

  G4Box* solidAbsX = new G4Box("AbsX",                   //its name
                   AbsWidth/2,AbsThick/2,AbsHeight/2);   //its size

  G4LogicalVolume* logicAbsX 
      = new G4LogicalVolume(solidAbsX,          //its solid
                            Scinti,             //its material
                            "logAbsX");         //its name

   G4double nXDivNs = int(firstLength/AbsWidth);    

   //G4VPhysicalVolume * physiAbsReplicasX = 
     new G4PVReplica("physicalAbsReplicasX",
                     logicAbsX,
                     oneXRO_Box_phys,
                     kXAxis,nXDivNs,AbsWidth);

  //-----------------
  //  The Y-READOUT
  //-----------------
      etc.....

======================================================================== Questions:

(1) How do we write/declare these Layers/Planes as sensitive in the detector construction? I mean, should I write two separate SD files? (e.g, xReadOutSD.{hh,cc} and yReadOutSD.{hh,cc}). Is there other way of doing this?

(2) Since I need a read out geometry, I wrote/modify the codes above for the READOUTGeometry for BOTH X- & Y- readouts. How do we declare the two planes as sensitive? Is the ff. OK?

  myDummySD *dummySD = new myDummySD;
  ROlogicAbsX->SetSensitiveDetector(dummySD);
  ROlogicAbsY->SetSensitiveDetector(dummySD);
 return ROWorldPhys;

where ROlogicAbsX/ROlogicAbsY is the logical component of a single scintillator bar, which will be replicated.

(3) Is there other ways of constructing this detector?

THANK YOU.

Kalitan

Question Primitive Scorer and parallel mode with TOPC and Marshalgen  by Antonio Otal <Antonio Otal>,   Aug 27, 04:13
Hi,

I've programed a Geant4 application in brachytherapy and I use primitive scorers. Now, I want to execute it in a parallel mode with TOPC and Marshalgen. I've used the ParN02 example as a template but when I "make" the code I've got the next error lines.

In file included from include/MarshaledG4HCofThisEvent.h:13,
                 from src/ParRunManager.cc:54:
include/MarshaledG4THitsMap.h:16: error: expected class-name before '{' token
include/MarshaledG4THitsMap.h:22: error: ISO C++ forbids declaration of `G4THitsMap' with no type
include/MarshaledG4THitsMap.h:22: error: expected `;' before '*' token
include/MarshaledG4THitsMap.h:29: error: expected `)' before '*' token
include/MarshaledG4THitsMap.h:50: error: ISO C++ forbids declaration of `G4THitsMap' with no type
include/MarshaledG4THitsMap.h:50: error: expected `;' before '*' token
include/MarshaledG4THitsMap.h:67: error: expected `;' before "void"
include/MarshaledG4THitsMap.h:67: error: `G4THitsMap' is not a type
include/MarshaledG4THitsMap.h:67: error: ISO C++ forbids declaration of `obj' with no type
include/MarshaledG4THitsMap.h: In member function `void MarshaledG4THitsMap::unmarshalTo(int*)':
include/MarshaledG4THitsMap.h:74: error: 'class MarshaledG4THitsMap' has no member named 'param'
include/MarshaledG4THitsMap.h:75: error: 'class MarshaledG4THitsMap' has no member named 'param'
include/MarshaledG4THitsMap.h: In member function `void MarshaledG4THitsMap::marshal1()':
include/MarshaledG4THitsMap.h:103: error: `MarshaledG4HitsCollection' was not declared in this scope
include/MarshaledG4THitsMap.h:103: error: expected `;' before "marParent"
include/MarshaledG4THitsMap.h:104: error: `marParent' was not declared in this scope
include/MarshaledG4THitsMap.h:103: warning: unused variable 'MarshaledG4HitsCollection'
include/MarshaledG4THitsMap.h: In member function `void MarshaledG4THitsMap::unmarshal1()':
include/MarshaledG4THitsMap.h:129: error: `MarshaledG4HitsCollection' was not declared in this scope
include/MarshaledG4THitsMap.h:129: error: expected `;' before "marObj"
include/MarshaledG4THitsMap.h:130: error: `marObj' was not declared in this scope
include/MarshaledG4THitsMap.h:130: error: `param' was not declared in this scopeinclude/MarshaledG4THitsMap.h:129: warning: unused variable 'MarshaledG4HitsCollection'
include/MarshaledG4THitsMap.h:130: warning: unused variable 'marObj'
include/MarshaledG4THitsMap.h:130: warning: unused variable 'param'
In file included from include/MarshaledG4HCofThisEvent.h:14,
                 from src/ParRunManager.cc:54:
include/MarshaledG4VHitsCollection.h: In member function `void MarshaledG4VHitsCollection::marshal3()':
include/MarshaledG4VHitsCollection.h:226: error: `MarshaledG4THitsMap' is not a template
include/MarshaledG4VHitsCollection.h: In member function `void MarshaledG4VHitsCollection::unmarshal3()':
include/MarshaledG4VHitsCollection.h:253: error: `MarshaledG4THitsMap' is not a template
include/MarshaledG4VHitsCollection.h:254: error: no matching function for call to `MarshaledG4THitsMap::unmarshalTo(G4THitsMap<G4VHit>*)'
include/MarshaledG4THitsMap.h:67: note: candidates are: void MarshaledG4THitsMap::unmarshalTo(int*)
In file included from include/MarshaledG4HCofThisEvent.h:15,
                 from src/ParRunManager.cc:54:
include/MarshaledG4THitsCollection.h: In member function `void MarshaledG4HitsCollection::marshal1()':
include/MarshaledG4THitsCollection.h:104: error: `G4THit' was not declared in this scope
include/MarshaledG4THitsCollection.h:104: error: template argument 1 is invalid
include/MarshaledG4THitsCollection.h:104: error: expected primary-expression before ')' token
include/MarshaledG4THitsCollection.h:104: error: expected `)' before "param"
include/MarshaledG4THitsCollection.h:108: error: `anElement' was not declared in this scope
include/MarshaledG4THitsCollection.h:109: error: `G4THit' cannot appear in a constant-expression
include/MarshaledG4THitsCollection.h:109: error: template argument 1 is invalid
include/MarshaledG4THitsCollection.h:109: error: expected primary-expression before ')' token
include/MarshaledG4THitsCollection.h:109: error: expected `)' before "param"
include/MarshaledG4THitsCollection.h:109: error: expected `)' before ';' token
include/MarshaledG4THitsCollection.h:110: error: `MarshaledG4THit' was not declared in this scope
include/MarshaledG4THitsCollection.h:110: error: expected `;' before "marEle"
include/MarshaledG4THitsCollection.h:111: error: `marEle' was not declared in this scope
include/MarshaledG4THitsCollection.h:110: warning: unused variable 'MarshaledG4THit'
include/MarshaledG4THitsCollection.h: In member function `void MarshaledG4HitsCollection::unmarshal1()':
include/MarshaledG4THitsCollection.h:143: error: `MarshaledG4THit' was not declared in this scope
include/MarshaledG4THitsCollection.h:143: error: expected `;' before "marEle"
include/MarshaledG4THitsCollection.h:144: error: `G4THit' was not declared in this scope
include/MarshaledG4THitsCollection.h:144: error: `anElement' was not declared in this scope
include/MarshaledG4THitsCollection.h:144: error: expected primary-expression before ')' token
include/MarshaledG4THitsCollection.h:144: error: expected `;' before "marEle"
include/MarshaledG4THitsCollection.h:145: error: `marEle' was not declared in this scope
include/MarshaledG4THitsCollection.h:146: error: `G4THit' cannot appear in a constant-expression
include/MarshaledG4THitsCollection.h:146: error: template argument 1 is invalid
include/MarshaledG4THitsCollection.h:146: error: expected primary-expression before ')' token
include/MarshaledG4THitsCollection.h:146: error: expected `)' before "param"
include/MarshaledG4THitsCollection.h:143: warning: unused variable 'MarshaledG4THit'
include/MarshaledG4THitsCollection.h:144: warning: unused variable 'anElement'
include/MarshaledG4THitsCollection.h:145: warning: unused variable 'marEle'
make[2]: *** [/root/Geant4/work//tmp/Linux-g++/Brachy/ParRunManager.o] Error 1
make[1]: *** [/root/Geant4/work//bin/Linux-g++/ParN02.timestamp] Error 2
make: *** [compile] Error 2

I think the problem is the annotations in G4THitsMap.hh and G4THitsCollection but I don't know what's going on. I attach the annotated files I used.

Thank you in advice

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-75238-G4HCofThisEvent.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-48197-G4String.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-69715-G4THitsCollection.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-82167-G4THitsMap.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-11342-G4VHit.hh
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/08/27/04.11-81767-G4VHitsCollection.hh

Question Using Primitive Scorer to fill an histogram with energies.  by Bruno Morgado <Bruno Morgado>,   Jul 21, 08:59
Hi all,

I'm doing a rather complicated experiment in Geant4 and it's the first time I something this big.

The code is getting so messy that I'm having to resort to global variables to, for instance, keep track of the energy that a particle deposits in a Sensitive Detector (I still didn't find an easier way to do this since there is no way to access all the steps the particle does inside the volume after leaving from it, i.e. having some way to track the particle back from the moment it dies or leaves the volume). Anyway, since I don't feel this is a nice way to keep the code I was trying to implement a Primitive Scorer to check the deposited energy instead.

But this doesn't work as well, what I get from the Primitive Scorer is the total energy deposit by all the particles, not just one of them (which I want to put in an histogram later).

So the basic question is: Does the Primitive Scorer only give the energy deposited by all 1000 particles when I do a run (/run/beamOn 1000)?

The mode advanced question is: If it's possible to check the energy deposit of each particle then, how do I do it?

Thanks is advance, Bruno

None Re: Using Primitive Scorer to fill an histogram with energies.  by Tsukasa Aso <Tsukasa Aso>,   Jul 21, 23:32
Re: Question Using Primitive Scorer to fill an histogram with energies. (Bruno Morgado)
Hi,

 The primitive scorer is designed to accumulate physical quantity in a event,
so that it is not suitable for scoring values in each step and each track.
(If you just want to score energy distribution of particular particle species
and obtain energy distribution, please check example/extended/runAndEvent/RE02,
where the sensitive filters are used to choose a particular particle species and
energy range.)

 If you want to score step based information, you have to implement your own
Hit class and SensitiveDetector class. One simple example is in 
example/novice/N02/. There is a ExN02TrackerSD class and ExN02TrackerHit class.
The ExN02TrackerSD is a sensitive detector class that creates a ExN02TrackerHit
object and fill values in it at every step.ExN02TrackerSD is a container for 
storing the quantity. 
 You may need to add a information about particle ID, but the example will be
a good starting point.


 Thanks,
 Tsukasa Aso

Question Sensitive Detector Problem  by Antonio Magalhaes <Antonio Magalhaes>,   May 29, 07:12
I created a detector and when I try to make it sensitive, compilation goes wrong

My codes:

Geometry: 
-----------------
G4Sphere*
  sCasca = new G4Sphere("Casca", pRmin, pRmax, pSPhi, pDPhi, pSTheta, pDTheta);
  G4LogicalVolume*
  lCasca = new G4LogicalVolume (sCasca, Air, "Casca");
  pCasca = new G4PVPlacement (Cascarot, G4ThreeVector(0.*cm, -70.765*cm, 0.*cm), lCasca, "Casca", lWorld, 0, false, 0);
-----------------
Sensitive Detector:

-----------------
G4SDManager* SDman = G4SDManager::GetSDMpointer();  
  G4String SDname;
  Casca = new RxCalorimeterSD(SDname="rx2/RxCalorimeterSD", this);
  SDman->AddNewDetector(Casca);
  lCasca->SetSensitiveDetector(Casca);
-----------------
Compilation ERROR:
-----------------
src/DetectorConstruction.cc: In member function ‘G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()’:
src/DetectorConstruction.cc:181: error: invalid use of incomplete type ‘struct RxCalorimeterSD’
include/DetectorConstruction.hh:17: error: forward declaration of ‘struct RxCalorimeterSD’
src/DetectorConstruction.cc:182: error: no matching function for call to ‘G4SDManager::AddNewDetector(RxCalorimeterSD*&)’
/home/antonio/geant4/geant4.9.2/source/digits_hits/detector/include/G4SDManager.hh:66: note: candidates are: void G4SDManager::AddNewDetector(G4VSensitiveDetector*)
src/DetectorConstruction.cc:183: error: no matching function for call to ‘G4LogicalVolume::SetSensitiveDetector(RxCalorimeterSD*&)’
/home/antonio/geant4/geant4.9.2/source/geometry/management/include/G4LogicalVolume.icc:269: note: candidates are: void G4LogicalVolume::SetSensitiveDetector(G4VSensitiveDetector*)

My Files: DetectorConstruction, RxCalorimeterSD and RxCalorHit (From E.g. AnaEx01).

Any sugestions?? Thanks!!

None Re: Sensitive Detector Problem  by Paul Nicholas Colin Gloster <Paul Nicholas Colin Gloster>,   May 29, 07:35
Re: Question Sensitive Detector Problem (Antonio Magalhaes)
Hello,

It seems that what is wrong is at least a lack of an appropriate declaration of  Casca  whose declaration you did not show. You showed us the definition
  Casca = new RxCalorimeterSD(SDname="rx2/RxCalorimeterSD", this);
without the declaration which should precede it like
  RxCalorimeterSD* Casca;

If that single change is not enough, then ensure that the class  RxCalorimeterSD  inherits from  G4VSensitiveDetector  which it must.

With kind regards,
Colin Paul Gloster
Question How to access ParticleGun from SteppingVerbose.cc  by Pradip Datta <Pradip Datta>,   20 May, 2009
Hi all,

Can anybody tell me how to access the methods in ParticleGun from SteppingVerbose.cc

With regards,

Pradip

None Re: How to access ParticleGun from SteppingVerbose.cc  by michel maire <michel maire>,   20 May, 2009
Re: Question How to access ParticleGun from SteppingVerbose.cc (Pradip Datta)
On Wed, 20 May 2009 11:52:19 GMT, Pradip Datta wrote:
> Hi all,
> 
> Can anybody tell me how to access the methods in ParticleGun from
> SteppingVerbose.cc
> 
> With regards,
> 
> Pradip
>

 The following is a possible way. 

 I take TestEm1 as example. PrimaryGeneratorAction* is given to RunAction via constructor. Then, in EndOfRunAction() you will find something like :
primary->GetParticleGun()

 It is the same for your SteppingVerbose : modify its constructor in order to pass  PrimaryGeneratorAction*.

 Do not forget to modify also the place where you instanciate your SteppingVerbose (usually in the main.cc) 

None Re: How to access ParticleGun from SteppingVerbose.cc  by Pradip Datta <Pradip Datta>,   20 May, 2009
Re: None Re: How to access ParticleGun from SteppingVerbose.cc (michel maire)
Hi Michel,

Thanks for your input. I did follow the same example however, I forgot to make changes in main.cc

Regards,

Pradip

Question Related to G4logicalVolume associated with Sensitive Detector  by Pradip Datta <Pradip Datta>,   29 Apr, 2009
Hi All,

I am new in Geant4 and have limited knowldge in C++.

My detector geometry has 32 readout segment (within a single detector). These segments are not identical in shape. So I construct them by different way but assign only one logical vol. for all of them (obviously I did that separately) and place them individually to construct my detector.

It seems working well and I will go ahead with this DetectorConstruction.cc. But before I make any other progress I would like to know "Is there any limitation of using same logicalvol with different solidname and place them as I have done". Kindly have look a part of the program (it is very simple) below:

Any support and comments are highly appreciated.

Thanks in advance

Pradip

        if(i==0)
        {
..........Solid with name "scyl1_strap2" is constructed here..............
lcyl1_strap1 = new G4LogicalVolume(scyl1_strap2,Ge,"logic_cyl2+trap2",0,0,0);

           for(G4int j=0;j<4;j++)
                {

//---------------------I have defined Z0Rot and x, y, z here---------------

pcyl1_strap1 = new G4PVPlacement(z0Rot,G4ThreeVector(x, y, z),lcyl1_strap1,"Cyld0_Trap1+2",logicWorld,false,i+10*j);

                }

        } // end if i==0     

if(i==1)
        {

...Solid with name "scyl1_strap1" is constructed here. It is of different shape.. lcyl1_strap1 = new G4LogicalVolume(scyl1_strap1,Ge,"logic_cyl1+trap1",0,0,0);

           for(G4int j=0;j<4;j++)
                {

//---------------------I have defined Z0Rot and x, y, z here---------------

pcyl1_strap1 = new G4PVPlacement(z0Rot,G4ThreeVector(x, y, z),lcyl1_strap1,"Cyld1_Trap1",logicWorld,false,i+10*j);

                }
        } // end if i==1    

Thus, you see, I have different shapes. I assigned same name lcyl1_strap1 and place them at different coordinates (definition of x,y,z is depends on j) within the "j" loop.

Question Related to G4logicalVolume associated with Sensitive Detector  by Pradip Datta <Pradip Datta>,   29 Apr, 2009
Hi All,

I am new in Geant4 and have limited knowldge in C++.

My detector geometry has 32 readout segment (within a single detector). These segments are not identical in shape. So I construct them by different way but assign only one logical vol. for all of them (obviously I did that separately) and place them individually to construct my detector.

It seems working well and I will go ahead with this DetectorConstruction.cc. But before I make any other progress I would like to know "Is there any limitation of using same logicalvol with different solidname and place them as I have done". Kindly have look a part of the program (it is very simple) below:

Any support and comments are highly appreciated.

Thanks in advance

Pradip

        if(i==0)
        {
..........Solid with name "scyl1_strap2" is constructed here..............
lcyl1_strap1 = new G4LogicalVolume(scyl1_strap2,Ge,"logic_cyl2+trap2",0,0,0);

           for(G4int j=0;j<4;j++)
                {

//---------------------I have defined Z0Rot and x, y, z here---------------

pcyl1_strap1 = new G4PVPlacement(z0Rot,G4ThreeVector(x, y, z),lcyl1_strap1,"Cyld0_Trap1+2",logicWorld,false,i+10*j);

                }

        } // end if i==0     

if(i==1)
        {

...Solid with name "scyl1_strap1" is constructed here. It is of different shape.. lcyl1_strap1 = new G4LogicalVolume(scyl1_strap1,Ge,"logic_cyl1+trap1",0,0,0);

           for(G4int j=0;j<4;j++)
                {

//---------------------I have defined Z0Rot and x, y, z here---------------

pcyl1_strap1 = new G4PVPlacement(z0Rot,G4ThreeVector(x, y, z),lcyl1_strap1,"Cyld1_Trap1",logicWorld,false,i+10*j);

                }
        } // end if i==1    

Thus, you see, I have different shapes. I assigned same name lcyl1_strap1 and place them at different coordinates (definition of x,y,z is depends on j) within the "j" loop.

Question Discrepancies between simulated and real histogram (Silicon Detector)  by I.Mateos <I.Mateos>,   27 Apr, 2009
We are simulating a Radiation Monitor (RM) and beam line using GEANT4. The simulation geometry is made up of the copper beam degrader plates, the aluminium box housing the RM, the cooper RM shield containing 2 Printed Circuit Boards (PCBs) and 2 Silicon Detectors mounted on ceramic substrates in a telescopic configuration.

The beam is simulated as a 255.27 MeV, parallel beam with a Gaussian energy profile and a flat radial profile with a diameter of 40 mm (wide enough to irradiate the detector uniformly). The simulation records the energy deposited in the Silicon detector and a Gaussian noise of 20 keV is added to mimic electronic noise.

The problem is that we have discrepancies between real and simulated histogram. Any comments about this discrepancies will be more than welcome.

I attach beam properties and the plot with the simulated and real data.

#beam properties (undegraded):
 /gps/particle proton 
/gps/pos/type Beam 
/gps/pos/rot1 1 0 0
/gps/pos/rot2 0 1 0
/gps/pos/shape Circle
/gps/pos/centre 22.5 -59.0 -490.0 mm
/gps/pos/radius 20.0 mm
/gps/direction 0 0 1
/gps/energy 255.27 MeV
/gps/ene/type Gauss
/gps/ene/sigma 3.556 MeV

Thanks in advanced!!

Cheers

   Attachment:
      http://hypernews.slac.stanford.edu/HyperNews/geant4/get/AUX/2009/04/27/03.33-98651-m_2.04e5p_noise_20keV.pdf

Question Primitive Scorer in repeated mother volume  by Suhaili Zakaria <Suhaili Zakaria>,   27 Mar, 2009
Hi

I have a parameterised logical volume that are placed in a mother volume, and the mother volume is repeated.

I read in the documentation, that in the case where there are more than one copyNo in different geometry hierarchy, I have to derive my own primitive scorer from the concrete class and implement GetIndex(G4Step* ) virtual method to return the copyNo.

does anyone has a good example on how to do this, please?

Really appreciate your replies.

Suhaili

None Re: Primitive Scorer in repeated mother volume  by Tsukasa Aso <Tsukasa Aso>,   27 Mar, 2009
Re: Question Primitive Scorer in repeated mother volume (Suhaili Zakaria)
Hi,

 You can find examples in examples/extended/runAndEvent/RE02.
We have several scorers for three-dimensional replicated geometry
in $G4INSTALL/digits_hits/scorer/. 

For example G4PSCellFlux3D has the constructor as follows.

G4PSCellFlux3D(G4String name,
               G4int ni, G4int nj, G4int nk,
               G4int depi, G4int depj, G4int depk)

 This case, you need to give number of divisions in x, y, z
by ni, nj, nk, and the replication depth in x, y, z by depi, depj, depk.

 Regards,
 Tsukasa Aso

Question Re: Primitive Scorer in repeated mother volume  by Suhaili Zakaria <Suhaili Zakaria>,   30 Mar, 2009
Re: None Re: Primitive Scorer in repeated mother volume (Tsukasa Aso)
Hi Tsukasa Aso,

Thanks for your reply. I have looked at the examples that you suggested, but I think it's not quite what I was looking for.

Perhaps I didn't explain it clearly.

My construction is as below. I have a mother volume (detector head Volume) that consists of detector and collimator as its daughter volume. I construct the collimator using parameterisation (as in older version's examples, not using nested parameterisation).

I have four detector heads and I construct it by repeating the original volume using a placement physical volume for each detector, using the same logical volume. I only define the position and rotation.

                                  ---------------
                                 |  Detector    |
                                  ---------------
                                 | | | | | | | | | collimator

                            ---                     ---
                           |  |==                 ==|  |
                  Detector |  |==        o        ==|  | Detector
                           |  |==    source       ==|  |
                           |  |==                 ==|  |
                           ---                      ---

                                | | | | | | | | |  collimator                          
                                  ---------------
                                 |  Detector    |
                                  ---------------

I defined the collimator holes as primitive scorer. The result that I obtain, is it from one set of collimators, or the sum from all four? Or, how do I want to set the copyNo for each collimator holes for all four heads?

None Re: Primitive Scorer in repeated mother volume  by Tsukasa Aso <Tsukasa Aso>,   30 Mar, 2009
Re: Question Re: Primitive Scorer in repeated mother volume (Suhaili Zakaria)
Hi, 

 The score value you get will be the sum of four detectors in this case.

Please modify your code as follows if you want to distinguish thoes values
for each detectors.

1)When you place the mother volume using a placement physical volume 
for each detector by G4PVPlacement,You can specify its copy number 
in the argument. G4PVPlacement has several constructor, for example,

G4PVPlacement (G4RotationMatrix *pRot, const G4ThreeVector &tlate, G4LogicalVolume *pCurrentLogical, const G4String &pName, G4LogicalVolume *pMotherLogical, G4bool pMany, G4int pCopyNo, G4bool pSurfChk=false)
                               -------------<= This gives copy No.!
 

2) This copy number can be used to identify the volume.
You need to modify the GetIndex() method in your primitive scorer.

For example, I assume your collimator is placed 
by parameterisation and the number is less than 10000.
And, the geometry hierarchy is as follows.


Mother           Daughter            SubDauther
(Replica Level2)(Replica Level1)    (Replica Level0)
Detector Head + Detector
              + Collimator Volume - many collimator holes as parameterisation
                                    ( Number of holes is NCOL. )



G4int RE02PSPassageCellFlux::GetIndex(G4Step* aStep)
{
  const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
  G4int HeadNumber = touchable->GetReplicaNumber(2);
  G4int ColimatorNumber = touchable->GetReplicaNumber(0);
  return  HeadNumber*10000+CollmatorNumber;
}

 You can distinguish the head number by looking the index  by
index%10000 in this example.

(please be carefull the replication level depends on your geometry hierarchy.)

I hope this is the answer for your question. 

Regards,
Tsukasa Aso

None Re: Primitive Scorer in repeated mother volume  by Suhaili Zakaria <Suhaili Zakaria>,   31 Mar, 2009
Re: None Re: Primitive Scorer in repeated mother volume (Tsukasa Aso)
Hi Tsukasa Aso,

It's what I am looking for. Thank you so much for your reply and help.

Regards, Suhaili

Question G4PSPassageCurrent in Geant4.9.2  by Suhaili Zakaria <Suhaili Zakaria>,   03 Mar, 2009
Hi

I used G4PSPassageCurrent in my code and I run it in Geant4.8.1. It seems to compile and run without problem.

Now, we have installed Geant4.9.2 and I tried to run the same code, but I get below message when compiling: src/PS_DetectorConstruction.cc:15:33: error: G4PSPassageCurrent.hh: No such file or directory

I tried changing it to G4PSFlatSurfaceCurrent, and it works okay.

Does anyone have idea what the problem is? Does it due to installation?

Many thanks, Suhaili

None Re: G4PSPassageCurrent in Geant4.9.2  by Tsukasa Aso <Tsukasa Aso>,   04 Mar, 2009
Re: Question G4PSPassageCurrent in Geant4.9.2 (Suhaili Zakaria)
Hi,

The scorers in geant4.8 were develop-version.
In geant4.9, those are slightly modified for release.
Now, the G4PSPassageCurrent is renamed to G4PSPassageCellCurrent in geant4.9.
Please use G4PSPassageCellCurrent if you want to get same result with
G4PSPassageCurrent in geant4.8.

Regards,
T.Aso
None Re: G4PSPassageCurrent in Geant4.9.2  by Suhaili Zakaria <Suhaili Zakaria>,   04 Mar, 2009
Re: None Re: G4PSPassageCurrent in Geant4.9.2 (Tsukasa Aso)
Hi,

Thank you. It works now. Are there other classes that's been changed? Where can I refer to check the changes?

I looked at the manual from the website: http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s04.html#sect.Hits.G4VPrim It still uses G4PSPassageCurrent.

Many thanks, Suhaili

None Re: G4PSPassageCurrent in Geant4.9.2  by Tsukasa Aso <Tsukasa Aso>,   04 Mar, 2009
Re: None Re: G4PSPassageCurrent in Geant4.9.2 (Suhaili Zakaria)
Hi,

 Thank you for your suggestion. The manual should be update.

Begards,
T.Aso

Question How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by Peter T. <Peter T.>,   03 Mar, 2009
Hello,

I would like to create a MultifunctionDetector that is only sensitive to photons that come out of a Compton scattering process. More specifically I want expose a metall target to gammas and then distinguish between the gammas that pass thru the target and the gammas that are the result of scattering processes.

Is there a way to specify a PrimitiveScorer with a Filter to reach this objective?

Thank you for any support!

Best regards Peter

None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by Tsukasa Aso <Tsukasa Aso>,   03 Mar, 2009
Re: Question How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles? (Peter T.)
Hi,

 I understand that your application needs to distinguish transmitting photon
without interactions from photons with interactions at the detector placed
behind the target.

 Compton scattering does not change the TrackID of the particle and its creator
process, we cannot directly identify the interaction after passing through 
the target. In this case, we have to introduce G4TrackInformation with user
parameters for keeping such information, i.e. a flag for presence of 
Compton scattering.

 If your requirement could be simplified as counting transmitting photons 
without interaction, then such photons will be identified by, 
for example, the vertex position, kinetic energy, and momentum direction. 
In this case, new SDFilter can be described for this purpose. 
Is this enough for your purpose?

T.Aso
None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by Peter T. <Peter T.>,   04 Mar, 2009
Re: None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles? (Tsukasa Aso)
Hello Michel and Tsukasa,

thank you very much for your replies! The TestEm5 example has pretty much everything I need. Excellent!

The simulation setup as I described it is supposed to be only the first step. Tsukasas suggestion would be fine for that.

In the next step I would like to simulate the response of a gas filled ionization chamber to the gamma that enter it. Clearly, I would not want to track the generated electrons. But what property that I can extract from the simulation would give me an estimate for the response of this type of detector? Is it the "energy deposit in the absorber" or a there properties that would give a better description?

Thanks again! Peter

None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by michel maire <michel maire>,   04 Mar, 2009
Re: None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles? (Peter T.)
On Wed, 04 Mar 2009 14:38:01 GMT, Peter T. wrote:
> Hello Michel and Tsukasa,
> 
> thank you very much for your replies! The TestEm5 example has pretty
> much everything I need. Excellent!
> 
> The simulation setup as I described it is supposed to be only the first
> step. Tsukasas suggestion would be fine for that.
> 
> In the next step I would like to simulate the response of a gas filled
> ionization chamber to the gamma that enter it. Clearly, I would not want
> to track the generated electrons. 

  I am not sure to understand your question. If you want to simulate the   response (eg the signal) of the detector, it is proportional to energy deposit in the gas. And only electrons can give energy deposit. So you must generate, track electrons and collect their energy deposition.

  Do I miss something ?

> But what property that I can extract
> from the simulation would give me an estimate for the response of this
> type of detector? Is it the "energy deposit in the absorber" or a there
> properties that would give a better description?

  Do you mean that you only want to count the number of cases where incident gamma does Compton interction ?

 Have a look in SteppingAction of TestEm13, 14, or 1 (see README of each example)

             Michel

None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by Peter T. <Peter T.>,   11 Mar, 2009
Re: None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles? (michel maire)
Hi Michel,

thanks again for your support. I'll study the examples.

Best regards Peter

None Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?  by michel maire <michel maire>,   03 Mar, 2009
Re: Question How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles? (Peter T.)
On Tue, 03 Mar 2009 15:21:51 GMT, Peter T. wrote:
> Hello,
> 
> I would like to create a MultifunctionDetector that is only sensitive to
> photons that come out of a Compton scattering process. More specifically
> I want expose a metall target to gammas and then distinguish between the
> gammas that pass thru the target and the gammas that are the result of
> scattering processes.
> 
> Is there a way to specify a PrimitiveScorer with a Filter to reach this
> objective?
> 
> Thank you for any support!

 If you wish to use PrimitiveScorer, ok, go one.

  Otherwise, you may have a look at examples/extended/electromagnetic/TestEm5

      Michel

Question G4VPrimitive Scorer-Surface Current  by Suhaili Zakaria <Suhaili Zakaria>,   19 Jan, 2009
Hi.

I need to know the number of particles (gamma) entering my multifunctional detectors.

How do I use G4VPrimitive scorer to obtain such information?

Below is snippets of my code on how I register the G4VPrimitiveScorer and applying filter.

  G4SDManager* manager = G4SDManager::GetSDMpointer();
  G4String MFDname = "MyDetector";
  G4MultiFunctionalDetector* MFD = new G4MultiFunctionalDetector(MFDname);

  manager->AddNewDetector(MFD);
  logicHoles->SetSensitiveDetector(MFD);

  //filter
  G4String fltName, particleName;

  G4SDParticleFilter* gammafilter= new G4SDParticleFilter(fltName="gammaFilter",  particleName="gamma");

  G4PSEnergyDeposit* scorer = new G4PSEnergyDeposit("EnergyScorer");
  G4PSDoseDeposit* scorer1 = new G4PSDoseDeposit("DoseScorer");
  G4PSFlatSurfaceCurrent* scorer2 = new G4PSFlatSurfaceCurrent("Current", fCurrent_In);

  scorer2->SetFilter(gammafilter);

  MFD->RegisterPrimitive(scorer);
  MFD->RegisterPrimitive(scorer1);
  MFD->RegisterPrimitive(scorer2);

The program runs and give me results, but I am not sure if it gives me the number of gamma inside each detector.

Inputs and suggestion are highly appreciated.

S.

Question Re: G4VPrimitive Scorer-Surface Current  by Suhaili Zakaria <Suhaili Zakaria>,   20 Jan, 2009
Re: Question G4VPrimitive Scorer-Surface Current (Suhaili Zakaria)
Hi.

This is based on my previous question

My aim is to get the number of photons entering the scorer. I used G4PSPassageCurrent and G4PSFlatSurfaceCurrent in my code:

  G4SDManager* manager = G4SDManager::GetSDMpointer();
  G4String MFDname = "MyDetector";
  G4MultiFunctionalDetector* MFD = new G4MultiFunctionalDetector(MFDname);

   manager->AddNewDetector(MFD);
   logicHoles->SetSensitiveDetector(MFD);

   //filter
  G4String fltName, particleName;

  G4SDParticleFilter* gammafilter= new G4SDParticleFilter(fltName="gammaFilter",  particleName="gamma");

  G4PSPassageCurrent* scorer1 = new G4PSPassageCurrent("Current", fCurrent_In);
  G4PSFlatSurfaceCurrent* scorer2 = new G4PSFlatSurfaceCurrent("FlatCurrent", fCurrent_In);

  scorer1->SetFilter(gammafilter);
  scorer2->SetFilter(gammafilter);

  MFD->RegisterPrimitive(scorer1);
  MFD->RegisterPrimitive(scorer2);

I run for 10000000, and here is the result:
---------------------------------------------
 Number of Events Processed: 10000000
----------------------------------------------
  # Cell         Current     FlatCurrent
     0               21               7
     1               22               9
     2               34               7
     3               23              10
     4               23              11
     5               15               8
     6               16               8
     7               22              10
     8               26              16
     9               27              13
    10               20              15

Does this mean that there are 21 photons/mm3 for scorer1 and 7/mm2 photons in scorer 2 for #Cell 0, and so on?

Inputs and suggestion are highly appreciated.

Many thanks, Suhaili.

None Re: G4VPrimitive Scorer-Surface Current  by Tsukasa Aso <Tsukasa Aso>,   20 Jan, 2009
Re: Question Re: G4VPrimitive Scorer-Surface Current (Suhaili Zakaria)
HI,

The G4PSPassageCellCurrent counts the number of particles that pass the sensitive
volume, i.e. it does not count the particles stopped inside the sensitive volume. 
The scoring is defined by using the volume so that the particles come from any 
directions to the volume may be counted. The result shows just number of tracks. 
There is no normalization by the volume inside G4PSPassageCellCurrent.

 The G4PSFlatSurfaceCurrent counts particles at the -Z surface of G4Box geometry. 
If you specify the option “fCurrentIn” then it counts only particles go to +Z 
direction. If you specify “fCurrentInOut” then both directions are taken into 
account. The result shows the number of particles normalized by the area at –Z 
surface, i.e  counts/mm2, or counts/cm2 for example.
If you do not want to divide the current by area, please specify 
scorer2->DivideByArea(false).

Ideally, the counts of G4PSFlatSurfaceCurrent (with DivideByArea(false)) and
G4PSPassageCellCurrent should become closer if you defines very thin Box 
geometry for the sensitive volume. 
  The number you showed as output of the simulation depends on your geometry
and the condition of beam. 
 I cannot give comments about it.


Tsuaksa Aso

None Re: G4VPrimitive Scorer-Surface Current  by Suhaili Zakaria <Suhaili Zakaria>,   21 Jan, 2009
Re: None Re: G4VPrimitive Scorer-Surface Current (Tsukasa Aso)
>  
>   The number you showed as output of the simulation depends on your geometry
> and the condition of beam. 
>  I cannot give comments about it.
> 
> Tsuaksa Aso
> 

Thanks for your reply.

My detectors are 1x1x35mm filled with water, inside 50x50x35mm lead. I have a Y90 source inside a water phantom.

What I want to see is how much photons produced from the Y90 interactions inside water reach the detectors. That's where I use the G4PSFlatSurfaceCurrent. Based on that information, can you comment about the result?

FYI, I dont specify scorer2->DivideByArea(false).

Many thanks, Suhaili

None Re: G4VPrimitive Scorer-Surface Current  by Tsukasa Aso <Tsukasa Aso>,   26 Jan, 2009
Re: None Re: G4VPrimitive Scorer-Surface Current (Suhaili Zakaria)
Hi,

 You are using G4PSPassageCellCurrent and G4PSFlatSurfaceCurrent.
The detectors are 1x1x35mm filled with water.

   Geometry
  
                 35mm
         +------------------+   
  -----> |                  |   S=1x1mm2
  -----> |                  |
         +------------------+
       (Z=-17.5mm)          (Z=+17.5mm)

 As I wrote, G4PSFlatSurfaceCurrent counts tracks at the "-Z" surface
as shown in the above figure. So, the detector length of 35mm does not
have any meanings for scoring. fCurrentIn specifys the track direction.
 The area of the surface is 1x1mm2 so that basically your result shows
the number of tracks / 1x1mm2. (You should set units for the output
value by multiplying  (mm*mm) for getting the value in an unit of [/mm2]).

 G4PSPassageCellCurrent counts number of tracks which passed the detector
volume. There is no limitation for track's directions and the scoring surface,
i.e, the scorer counts all tracks which pass the detector volume.
In this case, the detector length of 35mm contributes to wider detector
acceptance. This means we expect more counts than FlatSurfaceScorer.
The unit of G4PSPassageCellCurrent is just number of tracks.It means
number of tracks at (1x1x35mm3) volume.


 The results depends of the particle flux, i.e. anglur distribution to
the detector. But, I think your results,
 (FlatSurfaceCurrent < PassageCellCurrent), can be explained in terms 
of the detector geometry.

 You can try to compare these two scorers with very thin detector
such as 1x1x0.01mm3, and use fCurrentInOut direction for G4PSFlatSurfaceCurrent.
This case the results of two scorers should be close.
       
Tsukasa Aso
Ok Re: G4VPrimitive Scorer-Surface Current  by Suhaili Zakaria <Suhaili Zakaria>,   26 Jan, 2009
Re: None Re: G4VPrimitive Scorer-Surface Current (Tsukasa Aso)
Thanks so much for your explanation

Suhaili

Question Finite energy resolution  by Chibueze Zimuzo <Chibueze Zimuzo>,   16 Dec, 2008
Hi all,

Can anyone please tell me how best to include energy resolution in my semiconductor detector in G4.

Thanks

Chibueze.

None Score in time slices  by Kevin Xie <Kevin Xie>,   10 Nov, 2008
Hi,
  I'd like to count particles of a given type within given time slices. I would be very grateful if someone give me some suggestion. 
  Thank you! 

Question Definition of a spherical shell detector   by Peter T. <Peter T.>,   30 Sep, 2008
Hello,

I am trying to define a detector having the shape of a spherical shell in order to collect all the escaping particles that are generated inside the shell.

Especially I'm interested in the coordinates where the particle hits the detector.

I am aware that with the G4PVParameterised method one can generate a _striped_ scoring sphere but that would only give _one_ coordinate since the sensitive area is a ring. Is this assumption correct?

What is an effective way to define such a spherical shell detector that allows to extract the full coordinates ( spherical or cartesian) of the hits?

Preferably I would like to use primitive scorers.

Thank you very much for the support!

Best regards

Peter

Idea A way to score charge deposition without slicing up geometry  by Mark Looper <Mark Looper>,   10 Sep, 2008

One of the things I work on a lot is "deep dielectric charging" or "bulk charging," the phenomenon where energetic electrons in space come to a stop in insulating materials like circuit boards or wire insulation within a spacecraft, then discharge in a destructive manner when enough charge builds up. For my present study, I need to map out the location of charging events (either a charged particle coming to a stop in a material, or a secondary electron being ejected from the material) in very fine spatial detail.

I could use the G4PSCellCharge or G4PSCellCharge3D primitive scorers, or the similar approach in examples/advanced/cosmicray_charging, or the command-line scorers; these define volumes of interest, and simply add and subtract the charges of particles entering and leaving each volume. However, because of the spatial resolution I need, I would have to define huge numbers of very small volumes, and a lot of time would be wasted interrupting particle tracks to add and subtract the charge at the boundaries of volumes in which the particle neither originated nor stopped. What I want to do is define no geometric volumes (including those in a parallel world) that are not actually required by the physical experiment layout, and simply log the points where each charged particle is generated, is destroyed, or comes to rest. That is, I don't want to impose any tracking burden merely for purposes of histogramming the charge deposition.

Originally I did this kind of calculation in EGS4, and later EGSnrc; in fact, I had to do something besides define a lot of very fine "histogramming" regions, because these codes have trouble with tracking when region scales get too small. I was getting absurd results like all particles stopping in the topmost layer, no matter how thin! In these codes I was able, with much effort, to identify all the physical interactions that represent charging events, and log deposited or liberated charge at the location of each such physical interaction; however, I had no idea how to do this in Geant4.

Fortunately, there is enough information in a G4Track object to do this at the level of an individual particle's creation and destruction, rather than at each physical interaction as I had to do in EGS. Simply define a G4UserTrackingAction class with a PostUserTrackingAction method like so:

void MyTrackingAction::PostUserTrackingAction(const G4Track * aTrack)
{
G4ThreeVector vertex = aTrack->GetVertexPosition();
G4ThreeVector terminus = aTrack->GetPosition();
G4double chg = aTrack->GetDynamicParticle()->GetCharge();

if (chg != 0.)
{
XXX
}

}

At the XXX above, you would log charge deposit equal to chg at position terminus, and equal to -1. * chg at position vertex. Voilà! Unlike the agonies I had to go through to ensure that charge conservation was handled properly in EGS, here it is taken care of automatically. I don't know if this idea would be useful to the Geant4 developers in creating another kind of primitive scorer that doesn't burden the tracking system with more geometric regions (including in a parallel world) and their boundaries, but users who need another way to tot up charge deposition may find it useful.

Question Particle Hit Question (Novice Level)  by E Askan <E Askan>,   30 Jul, 2008
I am working on a Cerenkov simulation that uses Cerenkov electrons to set a beam of photons towards a set of 4 mirrors and reflect into PMTs. I also have a metal plane positioned in front of the four mirrors that photons can either pass through or kill, presuming I make the threshold energy for the photons to be killed high enough. The plane I have in front of the 4 mirrors is drawn as follows:

G4double Plane_x = 4.0*m;
  G4double Plane_y = 4.0*m;
  G4double Plane_z = 0.25*m;

  G4Box* MirPlane
     = new G4Box("MirPlane",Plane_x,Plane_y,Plane_z);

G4LogicalVolume *logicMirPlane;
  logicMirPlane = new G4LogicalVolume( solidCerMirPlane , Cu , "MirPlane", 0 , 0 , 0 );

  G4double planeposX = 0;
  G4double planeposY = 0;
  G4double planeposZ = -MirrRadii * cos( MirrTiltAngle ) + MirrZpos + 1.0 *cm ;

G4VPhysicalVolume *physMirPlane;
  physMirPlane = new G4PVPlacement( 0 , G4ThreeVector( planeposX , planeposY, planeposZ ), logicMirPlane , "plane" , logicCerMirPlane , false , 0 );

Now, I was wondering if anyone knew how to create program code that causes all photons that pass through this plane to be "killed" and then records and prints out all of the photons that pass through this plane. I was under the impression that you can set up an arbitrarily determined plane, as I have here to be placed in front of 4 Cerenkov mirrors, and have all photons that pass through it be "killed" and for all photons killed in the plane to be recorded.

I also cannot recall offhand the code needed for geant4 to record all photons that enter the PMTs-this is after the plane is removed, the goal is to compare the number of photons collected by the PMTs to the # of photons passing through the plane in front of the mirror. So if anyone has the code for recording all photons that enter the PMTs and printing it, that would be appreciated.

Thanks for providing this forum.

None Re: Particle Hit Question (Novice Level)  by Mark Looper <Mark Looper>,   10 Sep, 2008
Re: Question Particle Hit Question (Novice Level) (E Askan)

A G4Track object has a SetTrackStatus method that can be used to shut down propagation; in, for example, a class you derive from G4UserSteppingAction:

void MySteppingAction::UserSteppingAction(const G4Step * theStep)
{
G4Track* theTrack = theStep->GetTrack();
theTrack->SetTrackStatus(fStopAndKill);
}

However, since you are dealing with "opticalphoton" objects I will note that I don't think these propagate through materials that don't have optical properties defined anyway. That is, to generate and propagate Cerenkov photons you must have created a G4MaterialPropertiesTable, then used its AddProperty method to assign RINDEX and ABSLENGTH tables to it (refractive index and absorption length), and then used the SetMaterialPropertiesTable method of your G4Material object to associate those tables with your optical materials. If your Cu material doesn't have optical properties defined (and why would it?), "opticalphoton" particles will die on entry automatically if I'm not mistaken.

As for how to log the particles, you might also put that in a G4UserSteppingAction class:

if(theTrack->GetNextVolume())
{
G4String nextVol = theTrack->GetNextVolume()->GetName();
if(nextVol == "dump_here") {
G4cout << [whatever info you need to dump] << G4endl;
}
None Bug in scorer?  by Martin Cawley <Martin Cawley>,   30 Jul, 2008
Using Geant4.9.1.p02 on fedora 8

While trying to get the meshBox scorer to work I have found a couple of problems:-

*	digits_hits/utils/src/G4ScoringBox.cc
Class G4ScoringBox::SetupGeometry()
 		The last argument in the call to G4PVDivision( .... , 
fSize[0]/fSegment[0]*2.) is the width of the mesh box (as in the call to
G4PVReplica) and should be 0.0, the offset of the mesh. This is the same for
all the calls to G4PVDivision in this file. The result is that an extra box
is added to the mesh in one direction which can be easily verified by creating
a meshBox of 2x2x2. The resulting box is 2x2x3.
 		I use Inventor (OIX) for the visualisation and the meshBox
can be seen and verified in it.

*	digits_hits/utils/src/G4VScoreWriter.cc
Class G4VScoreWriter::GetIndex()
 		This took a while to figure out but the index
x + y*fNMeshSegments[0] + z*fNMeshSegments[0] *fNMeshSegments[1] is constructed
differently to where the data is stored in each of files digits_hits/scorer/src/
4PS*3D.cc where the index is contructed as i*fNj*fNk+j*fNk+k. I suggest that
the index in the writer should be
z + y*fNMeshSegments[2] + x*fNMeshSegments [1]*fNMeshSegments[2].
 		After changing it I can now read in (using imagej) the
flux, energy, etc as a 3D image and they make a lot more sense.

I hope this makes sense and is helpful. I have noticed that the beta version 4.9.2 contains the same code.

None RE02 example problem - double free or corruption (out)  by Yuri Burmistenko <Yuri Burmistenko>,   04 May, 2008
path: examples/extended/runAndEvent/RE02
OS: SL
gcc version 4.1.2

I didn't change the code of example.



Does anybody know what to do?
None RE: RE02 example problem - double free or corruption (out)  by Makoto Asai <Makoto Asai>,   04 May, 2008
Re: None RE02 example problem - double free or corruption (out) (Yuri Burmistenko)
Which version of Geant4 are you using?
In your screen shot, we usually see the massage 
"Thank you for using G4BinaryCascade."
where your code got the problem. Have you
alternate physics list? 

> -----Original Message-----
> From: Yuri Burmistenko [mailto:dafk-boogie@yandex.ru] 
> Sent: Sunday, May 04, 2008 7:06 AM
> To: publichypernews
> Subject: RE02 example problem - double free or corruption (out)
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/212"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> path: examples/extended/runAndEvent/RE02
> OS: SL
> gcc version 4.1.2
> I didn't change the code of example.
> [IMAGE][1]
> Does anybody know what to do?
> --------------------------------------------------------------
> ---------
> [1] http://pics.livejournal.com/oguretzz/pic/0009w1b3
> 

None RE: RE02 example problem - double free or corruption (out)  by Yuri Burmistenko <Yuri Burmistenko>,   05 May, 2008
Re: None RE: RE02 example problem - double free or corruption (out) (Makoto Asai)

Version of Geant 4 is 4.9.0

I didn't change the example at all, so the physics list is same as it was.

None RE: RE02 example problem - double free or corruption (out)  by Makoto Asai <Makoto Asai>,   05 May, 2008
Re: None RE: RE02 example problem - double free or corruption (out) (Yuri Burmistenko)
Did you applied the released patch on 9.0? 

> -----Original Message-----
> From: Yuri Burmistenko [mailto:dafk-boogie@yandex.ru] 
> Sent: Monday, May 05, 2008 7:43 AM
> To: publichypernews
> Subject: RE: RE02 example problem - double free or corruption (out)
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/212/1/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Version of Geant 4 is 4.9.0
> 
> I didn't change the example at all, so the physics list is same as it
> was.
> 

None RE: RE02 example problem - double free or corruption (out)  by Yuri Burmistenko <Yuri Burmistenko>,   06 May, 2008
Re: None RE: RE02 example problem - double free or corruption (out) (Makoto Asai)

No, I unfortunately can not find this patch.

Could you kindly give me link?

None Some kind of bug with G4PSPassageCellFlux (???)  by Yuri Burmistenko <Yuri Burmistenko>,   17 Apr, 2008

An error occures when running G4 program with G4PSPassageCellFlux.

This is true for G4 example (extended/runAndEvent/RE02), and for my own applications under Windows (with cygwin);

Don't know what to do :(

Please help...

None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Makoto Asai <Makoto Asai>,   17 Apr, 2008
Re: None Some kind of bug with G4PSPassageCellFlux (???) (Yuri Burmistenko)
Could you please be a bit more specific?
What kind of error do you see? Also it helps
a lot if you can add the trace back. 

> -----Original Message-----
> From: Yuri Burmistenko [mailto:dafk-boogie@yandex.ru] 
> Sent: Thursday, April 17, 2008 8:46 AM
> To: publichypernews
> Subject: Some kind of bug with G4PSPassageCellFlux (???)
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/210"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> An error occures when running G4 program with G4PSPassageCellFlux.
> 
> This is true for G4 example (extended/runAndEvent/RE02), and 
> for my own
> applications under Windows (with cygwin);
> 
> Don't know what to do :(
> 
> Please help...
> 

None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Yuri Burmistenko <Yuri Burmistenko>,   17 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Makoto Asai)

The program starts, geometry window starts, then pops a window called "Visual Studio Just-In-Time Debugger" and it says that: "An unhandled win32 exeption occured in ...exe[220]" Than it asks about dubugging

None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Makoto Asai <Makoto Asai>,   17 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Yuri Burmistenko)
I'm afraid your information is insufficient.

1) You wrote in your previous mail that you have the 
problem in extended/runAndEvent/RE02. Did you 
change something in this example?

2) Besides of the Windows debugger, did you have
any output messages on your terminal window?
Has the event loop already started? 

> -----Original Message-----
> From: Yuri Burmistenko [mailto:dafk-boogie@yandex.ru] 
> Sent: Thursday, April 17, 2008 9:06 AM
> To: publichypernews
> Subject: RE: Some kind of bug with G4PSPassageCellFlux (???)
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/210/1/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> The program starts, geometry window starts, then pops a window called
> "Visual Studio Just-In-Time Debugger" and it says that: "An unhandled
> win32 exeption occured in ...exe[220]" Than it asks about dubugging
> 

None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Yuri Burmistenko <Yuri Burmistenko>,   17 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Makoto Asai)

1) Didn't change anything 2) I'm not sure about the event loop, but visualisation window started

None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Makoto Asai <Makoto Asai>,   17 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Yuri Burmistenko)
> 2) I'm not sure about the event loop, but
> visualisation window started

Did you see your geometry desplayed? 
On the text window, what was the last 
message before the debugger started?


None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Yuri Burmistenko <Yuri Burmistenko>,   18 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Makoto Asai)
Here is a picture
None RE: Some kind of bug with G4PSPassageCellFlux (???)  by Yuri Burmistenko <Yuri Burmistenko>,   18 Apr, 2008
Re: None RE: Some kind of bug with G4PSPassageCellFlux (???) (Yuri Burmistenko)
And here is a picture of my own exmple...
Question Recording 2 sets of hits in the same EMcalorimeter detector.  by Chibueze Zimuzo <Chibueze Zimuzo>,   07 Apr, 2008

Hi All,

Is it possible to create 2 spatially separated volumes within one EMCalorimeter sensitive detector and record hit interactions within the 2 volumes separately?

I have looked through Geant examples but couldn't any example that treated this area. If this is not yet possible how can one create 2 EMCalorimeter volumes and obtain distinct sets of hits data from them.

Thanks for your help.

Chibueze.

None Re: Recording 2 sets of hits in the same EMcalorimeter detector.  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   07 Apr, 2008
Re: Question Recording 2 sets of hits in the same EMcalorimeter detector. (Chibueze Zimuzo)
On Mon, 7 Apr 2008, Chibueze Zimuzo wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/208"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi All,
> 
> Is it possible to create 2 spatially separated volumes within one
> EMCalorimeter sensitive detector and record hit interactions within the
> 2 volumes separately?
> 
> I have looked through Geant examples but couldn't any example that
> treated this area. If this is not yet possible how can one create 2
> EMCalorimeter volumes and obtain distinct sets of hits data from them.
> 
> Thanks for your help.
> 
> Chibueze.
> 

Hello Chibueze,

There is no limitation, you can register as many sensitive detectors as
needed. See $G4INSTALL/example/extended/hadronic/Hadr01 - there are 2
different sensitive detectors.

VI

None multiple sensitive detectors conflicting with each other  by David Oxley <David Oxley>,   18 Mar, 2008

Dear all,

I appreciate there are many posts around this topic but I can't find one that answers my question. Any thoughts would be much appreciated:

I have adapted exampleN05 to simulate two seperate sensitive detectors and hope to create two hit collections. I find I can only run the simulation with either one or the other. Comment one out, and the other works...and vice versa.

If they are both in , only the first ever has hits although the visualisation shows interactions in the second.

I attach the sections of my code I have changed and that I believe are relevant. I have been comparing my code with example N05 for some time now and just can't see where I am going wrong. I hope someone with more C++ experience will be able to point me in the right direction.

Thanks for any help,

Dave

000000000000000000==========================00000000000000000000
My DetectorConstruction.cc
  G4SDManager* SDman  = G4SDManager::GetSDMpointer();
  G4String SmartPET1 = "ExN01/SmartPET1";
  ExN01TrackerSD* aSenDet1 = new ExN01TrackerSD(SmartPET1, "SmartPET1");
  SDman->AddNewDetector(aSenDet1);
  geStrip_log ->SetSensitiveDetector(aSenDet1);

  G4String SmartPET2 = "ExN01/SmartPET2";
  ExN01TrackerSD* aSenDet2 = new ExN01TrackerSD(SmartPET2, "SmartPET2");
  SDman->AddNewDetector(aSenDet2);
  geStrip_log2 ->SetSensitiveDetector(aSenDet2);

00000000000000-============================0000000000000000 My TrackerSD.cc file:

ExN01TrackerSD :: ExN01TrackerSD(G4String name, G4String trackName)
:G4VSensitiveDetector(name)
{ G4String HCname; collectionName.insert(HCname=trackName); }

ExN01TrackerSD:: ~ExN01TrackerSD(){}

//functions

void ExN01TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
trackerCollection = new ExN01TrackerHitsCollection
                          (SensitiveDetectorName,collectionName[0]); 
static G4int HCID = -1;
//HCID(-1)
  if(HCID<0)
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
    HCE->AddHitsCollection( HCID, trackerCollection ); 
}

00000000000000000===========================0000000000000000000000 My event action: void ExN01EventAction::EndOfEventAction(const G4Event* evt ) {

  G4SDManager * SDman = G4SDManager::GetSDMpointer();
  G4String detName;
  SP1CollID    = SDman->GetCollectionID(detName="SmartPET1");

  SP2CollID    = SDman->GetCollectionID(detName="SmartPET2");

   G4cout << ">>> Event " << evt->GetEventID() << G4endl;

  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();

  ExN01TrackerHitsCollection* SP1_HC    = 0;
  ExN01TrackerHitsCollection* SP2_HC = 0;

  if(HCE)
    {
	SP1_HC  = (ExN01TrackerHitsCollection*) (HCE ->GetHC(SP1CollID));
	SP2_HC  = (ExN01TrackerHitsCollection*) (HCE ->GetHC(SP2CollID));
    //  CaloHC    = (ExN05CalorimeterHitsCollection*)(HCE->GetHC(calorimeterCollID));
    //  HadCaloHC = (ExN05CalorimeterHitsCollection*)(HCE->GetHC(hadCalorimeterCollID));
    }
  G4int NbHits =0;
G4double jim =0; G4double track =0;
	if(SP1_HC)
	{
	NbHits = SP1_HC->entries();
	cout << NbHits << "JACK" <<endl;	

		for (G4int i =0; i<NbHits; i++)
		{
		jim += (*SP1_HC)[i]->GetEdep();
		track = (*SP1_HC)[i]->GetTrackID();
		(*SP1_HC)[i]->Store(NbHits,i);
		}

	}
G4double SP2double =0;
G4int NbHits2 = 0;
	NbHits2 = SP2_HC->entries();

	if(SP2_HC)
	{
	NbHits2 = SP2_HC->entries();
	cout <<NbHits2 << "Jill"<<endl;
	cout << "In here"<<endl;
	}

None How to output the useful information of G4 simulation  Keywords: output data
by Yongfeng Deng <yfdeng@student.dlut.edu.cn>,   17 Mar, 2008

Hello,
  I am beginner of G4. I am studing the examples of G4 these days. 
There is always a question in my mind. The examples almost run in silence and make nothing output. 
However, there are lots of usuful information we need to output and plotted, such as particle energy. 
So how to do this work? Could you help me ?
  Thanks! please forgive my poor English.

None Re: How to output the useful information of G4 simulation  Keywords: output data
by michel maire <michel maire>,   17 Mar, 2008
Re: None How to output the useful information of G4 simulation (Yongfeng Deng)

 1- if you use /tracking/verbose 1 or 2, you will see that Geant4 is not so silent ...

 2- in novice/N03, the class ExN03SteppingVerbose will show you from where these printing come.

 3- simple examples of ploting are in examples/extended, for instance electromagnetic/TestEm4

None Re: How to output the useful information of G4 simulation  Keywords: output data
by <yfdeng@student.dlut.edu.cn>,   17 Mar, 2008
Re: None Re: How to output the useful information of G4 simulation (michel maire)

Thank you for your help! I will try my best!

None Untitled  by Yuri Burmistenko <Yuri Burmistenko>,   14 Mar, 2008

Is there in G4 a builtin option to calculate Flux, to achive [1/cm^2]?

Question IonFilter  Keywords: IonFilter
by Kathrin <gester@physik.rwth-aachen.de>,   10 Mar, 2008
Hello, 

I am trying to create a primitive scorer for ions by using the G4SDParticleFilter. 
I used the a filter for generic ions, but if I shoot C12 ions, the filter does not recognize the C12ions, 
as their name is not Generic Ion but C12[0.0]. If I try to create a filter by 

G4SDParticleFilter* C12IonFilter = new G4SDParticleFilter(filterName = "C12IonFilter", particleName = "C12[0.0]");

I get the error that ions cannot be created in the PreInit State. My problem is that the filter is used 
in my DetectorCunstruction class but the DetectorConstruction has to be done  before I can use the Initialize-method 
in my main programme therefore I am in the PreInit State. 

Is there a way I can create filters for ions?

Thank you for your help

Kathrin
None Problems with sensitive detector  Keywords: Sensitive detector
by <maria.antonietta.piliero@pi.infn.it>,   05 Mar, 2008

Hello, I've got problems with my sensitive detectors.

I adopted the Hadrontherapy example as model for the read-out geometry and sensitive detector of a slab of silicon (300 um thickness). Only xz pixelation has been implemented in my case.

62 MeV protons are delivered to the sensitive detector and a step limiter of 50 um is adopted within the sensitive detector (i.e., at least 6 steps are registered per particle). The traking verbosity confirms the number of steps and shows an energy loss at each step, however it appears that the sensitive detector only records the first interaction. The function ProcessHits() is invoked only for the first interaction of the primary particle, and the number of Hits per event is always only 1.

I have already followed the suggestions in post number 68 but it doesn't seem to be my case because I don't have volume overlapping.

Do you have any suggestion?

Thank you, Maria Antonietta Piliero

*********************************************************************************************************
* G4Track Information:   Particle = proton,   Track ID = 1,   Parent ID = 0
*********************************************************************************************************

Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng    Volume     Process
    0   -2.5 cm      0 fm      0 fm     62 MeV     0 eV      0 fm      0 fm    WorldPhys    initStep
    1      0 fm      0 fm      0 fm     62 MeV3.97e-18 eV    2.5 cm    2.5 cm    WorldPhys  Transportation
    2     50 um   -104 nm  -87.2 nm   61.9 MeV    88 keV    50 um    2.5 cm   MedipixPhys  StepLimiter
ProcessHits invoked
    3    100 um   -121 nm   -103 nm   61.8 MeV  66.7 keV    50 um   2.51 cm   MedipixPhys  StepLimiter
    4    150 um   69.4 nm   -145 nm   61.8 MeV  76.9 keV    50 um   2.52 cm   MedipixPhys  StepLimiter
    5    151 um   70.6 nm   -147 nm   61.8 MeV  1.44 keV  1.16 um   2.52 cm   MedipixPhys       hIoni
    6    201 um   90.3 nm   -229 nm   61.7 MeV  78.6 keV    50 um   2.52 cm   MedipixPhys  StepLimiter
    7    251 um   28.2 nm   -194 nm   61.6 MeV  71.4 keV    50 um   2.53 cm   MedipixPhys  StepLimiter
    8    267 um  -21.2 nm   -217 nm   61.6 MeV  39.3 keV  16.2 um   2.53 cm   MedipixPhys       hIoni
    9    300 um   -119 nm   -294 nm   61.5 MeV    48 keV  32.6 um   2.53 cm   MedipixPhys  Transportation
   10    2.5 cm  -94.6 um    -47 um   61.5 MeV3.95e-18 eV   2.47 cm      5 cm   OutOfWorld  Transportation

*********************************************************************************************************
* G4Track Information:   Particle = e-,   Track ID = 2,   Parent ID = 1
*********************************************************************************************************

Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng    Volume     Process
    0    151 um   70.6 nm   -147 nm   13.9 keV     0 eV      0 fm      0 fm   MedipixPhys    initStep
    1    151 um   -313 nm    513 nm      0 eV   13.9 keV  2.66 um   2.66 um   MedipixPhys       eIoni
---> End of event: 0
   Absorber: total energy:       0 eV        total track length:       0 fm 
        Gap: total energy: 484.22691 keV       total track length: 302.66586 um 
numberOfHits 1

None Re: Problems with sensitive detector  Keywords: Sensitive detector
by <piliero@pi.infn.it>,   08 Mar, 2008
Re: None Problems with sensitive detector

Hello,

I found what was wrong in my code: the read out geometry and the detector were not in the same position.

Thank you, Maria Antonietta

None Mistake in DoseDeposit-scorer with G4PhantomParameterisation  Keywords: G4PhantomParameterisation G4PSDoseDeposit
by Sylvia Studeny <sylvia.studeny@helmholtz-muenchen.de>,   27 Feb, 2008

Hello,
To test how the new G4PhantomParameterisation is working
I want to calculate a neutron depth dose in a waterphantom. 
I have done this in a waterbox and a "normaly" parametriesed
detector before and the depth dose curve from this seems
to be good.
I defined the G4PhantomParameterisation the way it is given in the manual:
 G4PhantomParameterisation* wpParam = new G4PhantomParameterisation();
  wpParam-> SetVoxelDimensions(voxelSize.x()/2.,voxelSize.y()/2.,voxelSize.z()/2.);
  wpParam-> SetNoVoxel(xNo,yNo,zNo);

  std::vector <G4Material*> theMaterials;
  for(G4int i=0;i<1;i++){theMaterials.push_back(H2O);};
  wpParam->SetMaterials( theMaterials );

  size_t* mateIDs = new size_t[xNo*yNo*zNo];
   G4int Zahler =0;
   for(G4int i=0;i<zNo;i++){
      for(G4int j=0;j<yNo;j++){
        for(G4int k=0;k<xNo;k++){
    	  mateIDs[Zahler] = 0;
    	  Zahler++;
    }}}
  wpParam->SetMaterialIndices( mateIDs );

  G4ThreeVector positionPhantom(0.,0.,0.); 
  solidPhantom = new G4Box("phantom",fphantomSize.x()/2.,fphantomSize.y()/2.,
  		 fphantomSize.z()/2.);
  logicPhantom = new G4LogicalVolume(solidPhantom, Air, "phantom", 0, 0, 0);  
  physiPhantom = new G4PVPlacement(0,positionPhantom,logicPhantom,
  		"phantom",logicWorld, false,0); 
//here also with copynumber=1

  wpParam->BuildContainerSolid(physiPhantom);
  wpParam->SetSkipEqualMaterials(1);

  solidVoxel = new G4Box("voxel",voxelSize.x()/2.,voxelSize.y()/2.,voxelSize.z()/2.);
  logicVoxel = new G4LogicalVolume(solidVoxel, H2O, "voxel", 0,0,0); 
  patient_phys = new G4PVParameterised("Voxel",logicVoxel,
 		 logicPhantom, kYAxis, xNo*yNo*zNo, wpParam);

  patient_phys->SetRegularStructureId(1);

I then set a DoseDeposit-scorer to the logicVoxel:

 G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(phantomSDname);
  SDman->AddNewDetector( MFDet );                
  logicVoxel->SetSensitiveDetector(MFDet);  

G4PSDoseDeposit* scorer0 = new G4PSDoseDeposit(psName="totalDose"); MFDet->RegisterPrimitive(scorer0);

In RunAction I want to readout the dose and print it in an ascii-file:
void RE02RunAction::EndOfRunAction(const G4Run* aRun)
{
RE02Run* re02Run = (RE02Run*)aRun;
G4THitsMap<G4double>* totalDose;
totalDose = re02Run->GetHitsMap("PhantomSD/totalDose");
...
  xNo = detector->GetxNo(); //number of voxels in x-direction
  yNo = detector->GetyNo();
  zNo = detector->GetzNo();
  xyNo = xNo*yNo;
...
ofstream wpDose;
  wpDose.open("wpDoseMatrix.dat");
  ...
 for(G4int nz=0;nz<zNo;nz++){ 
  for(G4int nx=0;nx<xNo;nx++){
   for(G4int ny=0;ny<yNo;ny++){
    copyNo= nz*xyNo + ny*xNo + nx; 
//I copied this from the G4PhantomParameterisation-class!
 wpDose << copyNo << " "<< nx << " "<< ny << " "<< nz;
     Dose = (*totalDose)[copyNo];
if(Dose){
     dose = *Dose/NoOfEvents;
     wpDose << "   " << dose/gray << " " ;
}else{ 
	   wpDose <<"  " << 0.000 << "  " ;
	}
Dose=0;
...

But when I plot this with gnuplot:
reset
set title 'Dosis ueber xy'
set logscale z
set xlabel 'x'
set ylabel 'y'
splot 'wpDoseMatrix.dat' u 2:3:(($4) == 0 ? $5 : 1/0) pt 1 ti 'z = 0'\
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 1 ? $5 : 1/0) pt 2 ti 'z = 1' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 2 ? $5 : 1/0) pt 3 ti 'z = 2' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 3 ? $5 : 1/0) pt 4 ti 'z = 2' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 4 ? $5 : 1/0) pt 5 ti 'z = 4' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 5 ? $5 : 1/0) pt 6 ti 'z = 5' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 6 ? $5 : 1/0) pt 7 ti 'z = 6' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 7 ? $5 : 1/0) pt 8 ti 'z = 7' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 8 ? $5 : 1/0) pt 9 ti 'z = 8' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 9 ? $5 : 1/0) pt 10 ti 'z = 9' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 10 ? $5 : 1/0) pt 11 ti 'z = 10' \
    , 'wpDoseMatrix.dat' u 2:3:(($4) == 11 ? $5 : 1/0) pt 12 ti 'z = 11' \

I see that there is only dose at the borders of the water qube, not in the middle. When I look at the visualisation, I do see tracks there and I tested the material definition (all voxels are set to water).

What did I do wrong? I have also tested	G4PSDoseDeposit3D (though
 I rather think this was desinged for Nestedparameterisation),
with no change.

How can I use a scorer with the G4PhantomParameterisation??? (maybe you can but this in the DICOM example, because many people will be interested in dose in this case)

Thanks a lot for your help Sylvia

None Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation  Keywords: G4PhantomParameterisation G4PSDoseDeposit
by Makoto Asai <Makoto Asai>,   28 Feb, 2008
Re: None Mistake in DoseDeposit-scorer with G4PhantomParameterisation (Sylvia Studeny)
Could you please try
  wpParam->SetSkipEqualMaterials(0);
rather than "1"? Then steps should be limited at every voxel boundaries
and thus scorers should work properly. I would appreciate if you can
confirm this fixes the problem you saw.

Kind regards,
Makoto
None Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation  Keywords: G4PhantomParameterisation G4PSDoseDeposit
by Sylvia Studeny <sylvia.studeny@helmholtz-muenchen.de>,   28 Feb, 2008
Re: None Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation (Makoto Asai)

Maybe you can add a line to the releasenotes and the manual that the SetSkipEqualMaterials(1)-routine is not working together with the scorers at the moment? I do hope you can improve that in the future, the parameterisation was a very good idea! Cheers, Sylvia

None Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation  Keywords: G4PhantomParameterisation G4PSDoseDeposit
by Sylvia Studeny <sylvia.studeny@helmholtz-muenchen.de>,   28 Feb, 2008
Re: None Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation (Makoto Asai)

Hi, Thanks a lot for this suggestion!!! Now it works well (as far as I can see). I just tried 10^5 primary particles, but already there is "depth" dose. It is just a little bit slower than before, but I can live with that, Cheers, Sylvia

None RE: Mistake in DoseDeposit-scorer with G4PhantomParameterisation  by Makoto Asai <Makoto Asai>,   27 Feb, 2008
Re: None Mistake in DoseDeposit-scorer with G4PhantomParameterisation (Sylvia Studeny)
Dear Sylvia,

 It is our fault that we could not document well about the limitation
of this new G4PhantomParameterisation class. To get the best
navigation performance, a step is NOT limited by a voxel boundary
if the materials of both sides of the boundaries are same. On the
other hand, our scorers naively believe that a step should be fully
contained by a voxel. That is the reason why you saw strange
dose deposition.

 For the time being, please use the ordinary G4NestedParameterisation.

We are sorry for this problem.
Kind regards,
Makoto Asai 

> -----Original Message-----
> From: Sylvia Studeny [mailto:sylvia.studeny@helmholtz-muenchen.de] 
> Sent: Wednesday, February 27, 2008 8:44 AM
> To: publichypernews
> Subject: Mistake in DoseDeposit-scorer with G4PhantomParameterisation
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/196"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hello,
> To test how the new G4PhantomParameterisation is working
> I want to calculate a neutron depth dose in a waterphantom. 
> I have done this in a waterbox and a "normaly" parametriesed
> detector before and the depth dose curve from this seems
> to be good.
> I defined the G4PhantomParameterisation the way it is given 
> in the manual:
>  G4PhantomParameterisation* wpParam = new G4PhantomParameterisation();
>   wpParam-> 
> SetVoxelDimensions(voxelSize.x()/2.,voxelSize.y()/2.,voxelSize
> .z()/2.);
>   wpParam-> SetNoVoxel(xNo,yNo,zNo);
> 
>   std::vector <G4Material*> theMaterials;
>   for(G4int i=0;i<1;i++){theMaterials.push_back(H2O);};
>   wpParam->SetMaterials( theMaterials );
> 
>   size_t* mateIDs = new size_t[xNo*yNo*zNo];
>    G4int Zahler =0;
>    for(G4int i=0;i<zNo;i++){
>       for(G4int j=0;j<yNo;j++){
>         for(G4int k=0;k<xNo;k++){
>           mateIDs[Zahler] = 0;
>           Zahler++;
>     }}}
>   wpParam->SetMaterialIndices( mateIDs );
> 
>   G4ThreeVector positionPhantom(0.,0.,0.); 
>   solidPhantom = new 
> G4Box("phantom",fphantomSize.x()/2.,fphantomSize.y()/2.,
>                  fphantomSize.z()/2.);
>   logicPhantom = new G4LogicalVolume(solidPhantom, Air, 
> "phantom", 0, 0, 0);  
>   physiPhantom = new G4PVPlacement(0,positionPhantom,logicPhantom,
>                 "phantom",logicWorld, false,0); 
> //here also with copynumber=1
> 
>   wpParam->BuildContainerSolid(physiPhantom);
>   wpParam->SetSkipEqualMaterials(1);
> 
>   solidVoxel = new 
> G4Box("voxel",voxelSize.x()/2.,voxelSize.y()/2.,voxelSize.z()/2.);
>   logicVoxel = new G4LogicalVolume(solidVoxel, H2O, "voxel", 0,0,0); 
>   patient_phys = new G4PVParameterised("Voxel",logicVoxel,
>                  logicPhantom, kYAxis, xNo*yNo*zNo, wpParam);
> 
>   patient_phys->SetRegularStructureId(1);
> 
> I then set a DoseDeposit-scorer to the logicVoxel:
> 
>  G4MultiFunctionalDetector* MFDet = new 
> G4MultiFunctionalDetector(phantomSDname);
>   SDman->AddNewDetector( MFDet );                
>   logicVoxel->SetSensitiveDetector(MFDet);  
> 
> G4PSDoseDeposit* scorer0 = new G4PSDoseDeposit(psName="totalDose");
> MFDet->RegisterPrimitive(scorer0);
> 
> In RunAction I want to readout the dose and print it in an ascii-file:
> void RE02RunAction::EndOfRunAction(const G4Run* aRun)
> {
> RE02Run* re02Run = (RE02Run*)aRun;
> G4THitsMap<G4double>* totalDose;
> totalDose = re02Run->GetHitsMap("PhantomSD/totalDose");
> ...
>   xNo = detector->GetxNo(); //number of voxels in x-direction
>   yNo = detector->GetyNo();
>   zNo = detector->GetzNo();
>   xyNo = xNo*yNo;
> ...
> ofstream wpDose;
>   wpDose.open("wpDoseMatrix.dat");
>   ...
>  for(G4int nz=0;nz<zNo;nz++){ 
>   for(G4int nx=0;nx<xNo;nx++){
>    for(G4int ny=0;ny<yNo;ny++){
>     copyNo= nz*xyNo + ny*xNo + nx; 
> //I copied this from the G4PhantomParameterisation-class!
>  wpDose << copyNo << " "<< nx << " "<< ny << " "<< nz;
>      Dose = (*totalDose)[copyNo];
> if(Dose){
>      dose = *Dose/NoOfEvents;
>      wpDose << "   " << dose/gray << " " ;
> }else{ 
>            wpDose <<"  " << 0.000 << "  " ;
>         }
> Dose=0;
> ...
> 
> But when I plot this with gnuplot:
> reset
> set title 'Dosis ueber xy'
> set logscale z
> set xlabel 'x'
> set ylabel 'y'
> splot 'wpDoseMatrix.dat' u 2:3:(($4) == 0 ? $5 : 1/0) pt 1 ti 'z = 0'\
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 1 ? $5 : 1/0) pt 2 ti 
> 'z = 1' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 2 ? $5 : 1/0) pt 3 ti 
> 'z = 2' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 3 ? $5 : 1/0) pt 4 ti 
> 'z = 2' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 4 ? $5 : 1/0) pt 5 ti 
> 'z = 4' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 5 ? $5 : 1/0) pt 6 ti 
> 'z = 5' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 6 ? $5 : 1/0) pt 7 ti 
> 'z = 6' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 7 ? $5 : 1/0) pt 8 ti 
> 'z = 7' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 8 ? $5 : 1/0) pt 9 ti 
> 'z = 8' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 9 ? $5 : 1/0) pt 10 
> ti 'z = 9' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 10 ? $5 : 1/0) pt 11 
> ti 'z = 10' \
>     , 'wpDoseMatrix.dat' u 2:3:(($4) == 11 ? $5 : 1/0) pt 12 
> ti 'z = 11' \
> 
> I see that there is only dose at the borders of the water qube, not in
> the middle. When I look at the visualisation, I do see tracks 
> there and
> I tested the material definition (all voxels are set to water).
> 
> What did I do wrong? I have also tested G4PSDoseDeposit3D (though
>  I rather think this was desinged for Nestedparameterisation),
> with no change.
> 
> How can I use a scorer with the G4PhantomParameterisation??? 
> (maybe you
> can but this in the DICOM example, because many people will be
> interested in dose in this case)
> 
> Thanks a lot for your help Sylvia
> 

Question Understanding G4PSFlatSurfFlux output  Keywords: G4PSFlatSurfFlux , Primitive Scorer
by Axanka <gruenwald@physik.rwth-aachen.de>,   06 Feb, 2008
Hello,
I'm having a tough time understanding the output of my 
G4PSFlatSurfaceFlux scorer. The current state of my 
simulation is fairly simple: a single proton is transported 
through an absorber and a detector. The only process envoked 
is AddTransportation(); 20 events are simulated; the particle 
impinges the detector surface at an angle of 90 degrees and 
the weight of the proton is 1. The scorer G4PSTrackCounter 
outputs a total of 20 tracks.
Now, according to the formula in the Book for Application
Developers on page 122, the FlatSurfaceFlux should be 

             Flux = 20*(W/cos(t)/A)

So, the weight is 1 and cos(0deg) = 1. Therefore the flux 
should be:
             Flux = 20*(1/1/A)

The flux output by my simulation is 5.555555555555553e-05

The -Z surface area of my detector is 30cm X 30cm = 90000*mm2

By multiplying the flux with the surface area I expect to 
get the number of tracks. This calculation does not add 
up though.
The question is: WHY?
None Re: Understanding G4PSFlatSurfFlux output  Keywords: G4PSFlatSurfFlux , Primitive Scorer
by Yuri Burmistenko <Yuri Burmistenko>,   05 May, 2008
Re: Question Understanding G4PSFlatSurfFlux output (Axanka)

Is it possible for you to send me a siple example of using G4PSFlatSurfaceFlux scorer, or some other primitive scores?

I don't know why but my progs don't work :(

Thanks anyway...

None simple particle counting  by <crantjones123@mail.ru>,   20 Jan, 2008

My greetings to everyone. Sorry for this primitive question but I have difficulties in the following:

 I shoot 1 GeV protons on mercury target using QGSP_BIC_HP physics list.
This leads to creation of pions and mesons that decay to various neutrinos/antineutrinos.
What I want is simply to count the number of created neutrinos of each flavor.
 I.e. at the end I need to have four numbers - for electron neutrino and antineutrino, 
and for muon neutrino and antineutrino.
 I feel that for this simple task, it is not necessary to use scoring or sensitive detectors.
It can be done in user stepping action. But I can not write out the correct code.
 I will appreciate if someone describes in detail the procedure for this task (with lines of code, if possible).

 Thank you in advance.

None No hits in SD  Keywords: hits, event, SD
by <agnieszka.priebe@cern.ch>,   11 Jan, 2008

Hallo, I've been preaparing simulation of a quadrupol (MQ). Every files which I used, was taken from previous dipol (MD), which worked. I have a problem with Geant4. Compilation is OK (gmake), but after:

bin/Linux-g++/MQ /run/beamOn 10

I receive:
"
### Run 0 start.
 Generating event number 0
shooting from G4ThreeVector(0.4*mm,0.2*cm,200.*cm)
MQCoilSD::Initialize - initializing collection
 MQCoilSD::EndOfEvent action - adding a collection
 MQCoilSD::EndOfEvent - adding hits collection
 MQCoilSD::EndOfEvent - added hits collection
RootInterface::RootInterface() incarnation
>>> Event 0
    0 trajectories stored in this event.
 MQEventAction::EndOfEventAction: collection found  for collection ID = 0
 MQEventAction::EndOfEventAction:  entering collection
  No of hits:   0
EventOK - tree filled ... event Clearing ...
"
I have no idea why there are no events, because my MQCoilSD.cc is:
"

#include "MQCoilSD.hh"
#include "MQCoilHit.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
#include "MQbinParameters.hh"

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

MQCoilSD::MQCoilSD(G4String name)
:G4VSensitiveDetector(name),
 numberOfCellsInZ(segmentsinZ),numberOfCellsInPhi(segmentsinPhi),
 numberOfCellsInRho(segmentsinRho)
{
//  G4cout << " MQCoilSD::MQCoilSD  - inserting collection " << G4endl;
  G4String HCname;
  collectionName.insert(HCname="coilCollection");
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

MQCoilSD::~MQCoilSD(){ }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void MQCoilSD::Initialize(G4HCofThisEvent* )
{
 G4cout << "MQCoilSD::Initialize - initializing collection" << G4endl; 
 #include "MQParameters.icc"

   coilCollection = new MQCoilHitsCollection
                       (SensitiveDetectorName,collectionName[0]); 
   for(G4int j=0;j<numberOfCellsInPhi;j++)
   for(G4int k=0;k<numberOfCellsInZ;k++)
   for(G4int m=0;m<numberOfCellsInRho;m++) {
     CellID[j][k][m] = -1;
   }

// verboseLevel = 2;

/*
  coilCollection = new MQCoilHitsCollection
                          (SensitiveDetectorName,collectionName[0]); 
  static G4int HCID = -1;
  if(HCID<0)
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
  HCE->AddHitsCollection( HCID, coilCollection ); 
*/  
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4bool MQCoilSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
G4cout << " MQCoilSD::ProcessHits  entering" << G4endl;
#include "MQParameters.icc"
  if(!ROhist) return false;

  G4double edep = aStep->GetTotalEnergyDeposit();

  if(edep==0.) return false;

  G4VPhysicalVolume* physVol = ROhist->GetVolume();
  G4int copyNumberVolume = ROhist->GetCopyNumber();
  G4int copyIDinPhi = ROhist->GetReplicaNumber(2);
  G4int copyIDinZ = ROhist->GetReplicaNumber(1);
  G4int copyIDinRho = ROhist->GetReplicaNumber(0);

  if(CellID[copyIDinPhi][copyIDinZ][copyIDinRho]==-1)
  {
    MQCoilHit* newHit = new MQCoilHit(physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi,copyIDinRho);

//     WSD4CoilHit* calHit
//           = new WSD4CoilHit(physVol->GetLogicalVolume(),copyIDinZ,copyIDinPhi,copyIDinRho);
     G4RotationMatrix rotM;
     rotM = *(ROhist->GetRotation());
     newHit->SetTrackID  (aStep->GetTrack()->GetTrackID());     
     newHit->SetEdep( edep );
// original version:
     newHit->SetPos( ROhist->GetTranslation() ); // this gives only z-position... x&y=0
//     newHit->SetRot( rotM );
     newHit->SetCellID(copyIDinZ, copyIDinPhi, copyIDinRho);    
     G4int icell = coilCollection->insert( newHit );
//     newHit->SetPos      (aStep->GetPostStepPoint()->GetPosition());
     CellID[copyIDinPhi][copyIDinZ][copyIDinRho] = icell - 1;
  }  else {
    (*coilCollection)[CellID[copyIDinPhi][copyIDinZ][copyIDinRho]]->AddEdep(edep);  
  }

return true; }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void MQCoilSD::EndOfEvent(G4HCofThisEvent* HCE)
{
  if (verboseLevel>0) { 
     G4int NbHits = coilCollection->entries();
     G4cout << "\n-------->Hits Collection: in this event they are " << NbHits 
            << " hits in the Coil chambers: " << G4endl;
     for (G4int i=0;i<NbHits;i++) (*coilCollection)[i]->Print();
    } 

  G4cout << " MQCoilSD::EndOfEvent action - adding a collection" << G4endl; 
  static G4int HCID = -1;
  if(HCID<0)
  { 
   HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); 
   //HCID = GetCollectionID(0);

  }
  G4cout << " MQCoilSD::EndOfEvent - adding hits collection " << G4endl;
  HCE->AddHitsCollection( HCID, coilCollection );     
  G4cout << " MQCoilSD::EndOfEvent - added hits collection " << G4endl;

}

"
                          and MQEventAction.cc is
"
#include "MQEventAction.hh"
#include "MQCoilHit.hh"
#include "MQParameters.hh"
#include "MQRunAction.hh"
#include "RootInterface.hh"

#include "G4Run.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4ios.hh"
#include "G4RunManager.hh"
#include "G4VHitsCollection.hh"
#include "G4HCofThisEvent.hh"
#include <string>
#include <iostream>
#include "G4DCofThisEvent.hh"

#include "MQDetectorConstruction.hh" //nowa linijka //#include "G4PSTrackCounter.hh" //

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

MQEventAction::MQEventAction() {

   G4cout << " MQEventAction ini " << G4endl;
   G4String colName;
   G4SDManager* SDman = G4SDManager::GetSDMpointer();
   G4cout << " collections: " << SDman->GetHCtable()->entries() << G4endl;
   coilCollectionID = SDman->GetCollectionID(colName="coilCollection");
   G4cout << " MQEventAction end " << G4endl;

   numberOfCoilHitStoredAlongRun= 0;

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

MQEventAction::~MQEventAction() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void MQEventAction::BeginOfEventAction(const G4Event*) {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void MQEventAction::EndOfEventAction(const G4Event* evt) {

   RootInterface* rootinterface = RootInterface::getInstance();

   const G4Run* currentrun=G4RunManager::GetRunManager()->GetCurrentRun();
   int nbevent=currentrun->GetNumberOfEventToBeProcessed();

  G4int event_id = evt->GetEventID();

  // get number of stored trajectories
  //
  G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
  G4int n_trajectories = 0;
  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();

  // periodic printing
  //
  if (event_id < 100 || event_id%100 == 0) {
    G4cout << ">>> Event " << evt->GetEventID() << G4endl;
    G4cout << "    " << n_trajectories
           << " trajectories stored in this event." << G4endl;

    //char a=SDman->GetName(); //
    //int *a = G4PSTrackCounter::G4PSTrackCounter ("licznik", 230.,0.);

    //G4cout<<a<<G4endl;//

  }

   // -------> Extract the hits (access all hits in G4Event)
   G4HCofThisEvent * HCE = evt->GetHCofThisEvent(); 
   MQCoilHitsCollection* CHC = 0;
   if(HCE) {
//     CHC = (MQCoilHitsCollection*)(HCE->GetHC(0));  
     CHC = (MQCoilHitsCollection*)(HCE->GetHC(coilCollectionID));
     G4cout << " MQEventAction::EndOfEventAction: collection found  for collection ID = " << coilCollectionID << G4endl;
   } 

   // write hits collection into the file:
   if(CHC)
   {
     G4cout << " MQEventAction::EndOfEventAction:  entering collection " << G4endl;   
     // number of particules/hits in event:
     int n_hit = CHC->entries();
     G4cout << "  No of hits:   " << n_hit << G4endl;

     // loop over particles in the event:
     if(n_hit>0) {  
        numberOfCoilHitStoredAlongRun += n_hit; 
        for(int i=0;i<n_hit;i++) {
                double edep = (*CHC)[i]->GetEdep()/MeV;        
                int rID = (*CHC)[i]->GetRID(); 
                int phiID = (*CHC)[i]->GetPhiID();     
                int zID = (*CHC)[i]->GetZID();
                G4cout << " edep = " << edep << " MeV " << G4endl;
                G4cout << " rID = " << rID << "  phiID = " << phiID << " zID = " << zID << G4endl;             
                rootinterface->AddCCell(1,edep,zID,phiID,rID);         
        }
     }
    }
    rootinterface->EventOK();
 // auto-save tree
    rootinterface->tree->AutoSave("SaveSelf");      

    G4cout << ">>> -------------------END-------------------------- " << G4endl;  //nowa linijka

     // Reintialize the counter of hits
     G4cout << "MQEventAction::EndOfEventAction, numberOfCoilHitStoredAlongRun = " << numberOfCoilHitStoredAlongRun << G4endl;
     numberOfCoilHitStoredAlongRun= 0;

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... "

Do you know what could be a reason and how to fix it up?

I am so surprised because in previous MD there were hits.

I would be grateful for help

Best regards

Agnieszka Priebe

Question Confused on my Hits result  Keywords: No useful hits result
by Chibueze Zimuzo <Chibueze Zimuzo>,   10 Jan, 2008

Hi all,

I really need help. I am simulating Compton camera with G4. I have written all my files(detectorConstruction, PrimaryGeneratorAction, PhysicsList, SensitiveDetector, RunAction, EventAction and Hit files). But the simulation didn't give me any useful result as shown:

*************************************************************
 Geant4 version Name: geant4-08-01-patch-02    (10-November-2006)
                      Copyright : Geant4 Collaboration
                      Reference : NIM A 506 (2003), 250-303
                            WWW : http://cern.ch/geant4
*************************************************************

Visualization Manager instantiating... Visualization Manager initialising... Registering graphics systems...

You have successfully registered the following graphics systems.
Current available graphics systems are:
  ASCIITree (ATree)
  DAWNFILE (DAWNFILE)
  GAGTree (GAGTree)
  G4HepRep (HepRepXML)
  G4HepRepFile (HepRepFile)
  RayTracer (RayTracer)
  VRML1FILE (VRML1FILE)
  VRML2FILE (VRML2FILE)
  OpenGLImmediateX (OGLIX)
  OpenGLStoredX (OGLSX)
  RayTracerX (RayTracerX)

Registering model factories...

You have successfully registered the following model factories.
Registered model factories:
  generic
  drawByCharge
  drawByParticleID
  drawByOriginVolume

Registered models:
  None

Registered filter factories:
  chargeFilter
  particleFilter
  originVolumeFilter

Registered filters:
  None

/run/verbose 2
#
# create empty scene
#
/vis/scene/create
#
# Create a scene handler for a specific graphics system
# (Edit the next line(s) to choose another graphic system)
#
/vis/open OGLIX
/vis/sceneHandler/create OGLIX
/vis/sceneHandler/attach
/vis/viewer/create ! ! 600
Got standard cmap
Window name: viewer-0 (OpenGLImmediateX)
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1
G4OpenGLXViewer: XLoadQueryFont failed for font
  -adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1
WARNING: objects with visibility flag set to "false" will not be drawn!
  "/vis/viewer/set/culling global false" to Draw such objects.
  Also see other "/vis/viewer/set" commands.
/vis/viewer/refresh
Your "world" has no vis attributes or is marked as visible.
  For a better view of the contents, mark the world as invisible, e.g.,
  myWorldLogicalVol -> SetVisAttributes (G4VisAttributes::Invisible);
G4Scene::AddWorldIfEmpty: The scene was empty of run-duration models.
  "world" has been added.
/vis/scene/notifyHandlers
#
####/vis/open DAWNFILE
#
# draw scene
#
/vis/viewer/set/viewpointThetaPhi 90 180 deg
/vis/viewer/refresh
/vis/viewer/zoom 1.4
/vis/viewer/refresh
/vis/viewer/flush
/vis/viewer/refresh viewer-0
/vis/viewer/update viewer-0
#
# for drawing the tracks
# (if too many tracks cause core dump => storeTrajectory 0)
/tracking/storeTrajectory 1
/vis/scene/add/trajectories
/tracking/storeTrajectory 1
WARNING: "/tracking/storeTrajectory 1" has been executed.
# (if you prefer refreshing each event, comment out next line)
/vis/scene/endOfEventAction accumulate
#
/run/beamOn 10

msc:  Model variant of multiple scattering for e-
      Lambda tables from 100 eV  to 100 TeV in 120 bins.
      Boundary/stepping algorithm is active with facrange= 0.02  Step limitation 1

eIoni:   tables are built for  e-
      dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
      Lambda tables from threshold to 100 TeV in 120 bins.
      Delta cross sections from Moller+Bhabha, good description from 1 KeV to 100 GeV.
      Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 1

eBrem:   tables are built for  e-
      dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
      Lambda tables from threshold to 100 TeV in 120 bins.
      Total cross sections from a parametrisation based on the EEDL data library.
      Good description from 1 KeV to 100 GeV, log scale extrapolation above 100 GeV.

eIoni:   tables are built for  e+
      dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
      Lambda tables from threshold to 100 TeV in 120 bins.
      Delta cross sections from Moller+Bhabha, good description from 1 KeV to 100 GeV.
      Step function: finalRange(mm)= 1, dRoverRange= 0.2, integral: 1

eBrem:   tables are built for  e+
      dE/dx and range tables from 100 eV  to 100 TeV in 120 bins.
      Lambda tables from threshold to 100 TeV in 120 bins.
      Total cross sections from a parametrisation based on the EEDL data library.
      Good description from 1 KeV to 100 GeV, log scale extrapolation above 100 GeV.

annihil:       Heilter model of formula of annihilation into 2 photons
      tables are built for  e+
      Lambda tables from 100 eV  to 100 TeV in 120 bins.

Region <DefaultRegionForTheWorld> -- appears in <World> world volume
 Materials : Air Silicon NaI
 Production cuts :  gamma 1 mm     e- 1 mm     e+ 1 mm

========= Table of registered couples ==============================

Index : 0     used in the geometry : Yes     recalculation needed : No
 Material : Air
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm
 Energy thresholds :  gamma 990 eV     e- 990 eV     e+ 990 eV
 Region(s) which use this couple :
    DefaultRegionForTheWorld

Index : 1     used in the geometry : Yes     recalculation needed : No
 Material : Silicon
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm
 Energy thresholds :  gamma 6.88731 keV    e- 540.718 keV    e+ 521.113 keV
 Region(s) which use this couple :
    DefaultRegionForTheWorld

Index : 2     used in the geometry : Yes     recalculation needed : No
 Material : NaI
 Range cuts        :  gamma 1 mm     e- 1 mm     e+ 1 mm
 Energy thresholds :  gamma 29.5738 keV    e- 619.129 keV    e+ 589.38 keV
 Region(s) which use this couple :
    DefaultRegionForTheWorld

====================================================================

Start closing geometry. G4GeometryManager::ReportVoxelStats -- Voxel Statistics

    Total memory consumed for geometry optimisation:   1 kByte
    Total CPU time elapsed for geometry optimisation: 0 seconds

    Voxelisation: top CPU users:
    Percent   Total CPU    System CPU       Memory  Volume
    -------   ----------   ----------     --------  ----------
       0.00         0.00         0.00            0k World
       0.00         0.00         0.00            1k Scatterer
       0.00         0.00         0.00            1k ScattererStripsX

    Voxelisation: top memory users:
    Percent     Memory      Heads    Nodes   Pointers    Total CPU    Volume
    -------   --------     ------   ------   --------   ----------    ----------
      43.12          0k         1       16         16         0.00    Scatterer
      43.12          0k         1       16         16         0.00    ScattererStripsX
      13.76          0k         1        4          4         0.00    World
Start Run processing.
G4AugerData for Element no. 7 are loaded
G4AugerData for Element no. 8 are loaded
G4AugerData for Element no. 11 are loaded
G4AugerData for Element no. 14 are loaded
G4AugerData for Element no. 53 are loaded
AugerTransitionTable complete
G4VisManager: Using G4TrajectoryDrawByCharge as default trajectory model.
See commands in /vis/modeling/trajectories/ for other options.
Run terminated.
Run Summary
  Number of events processed : 10
  User=0.06s Real=0.4s Sys=0.05s
Idle>                           

Please any help from anybody will be greatly appreciated.

Chibueze Uche, University of Waikato New Zealand

Question Making multiple sensitive Detectors - a probelm  Keywords: sensitive detector hits collection geometry output problem
by Laura Harkness <Laura Harkness>,   18 Dec, 2007

Hi,

I am simulating a compton camera arrangement and so have two detectors with gamma interactions, (currently set at <1MeV incoming).

I have tried to set the two detectors to be sensitive, which I believe works, but when I output the hit information I find something strange:

--->Hits Collection: in this event there are 0 hits in the detector : BUT SHOWS TWO HITS
  trackID: 1  time: 325.428 ps   SPDetector No: 0  energy dep: 11.067 keV
  trackID: 2  time: 325.492 ps   SPDetector No: 0  energy dep: 134.739 keV

--->Hits Collection: in this event there are 2 hits in the detector : 
  trackID: 1  time: 325.428 ps   SPDetector No: 0  energy dep: 11.067 keV
  trackID: 2  time: 325.492 ps   SPDetector No: 0  energy dep: 134.739 keV

--->Hits Collection: in this event there are 0 hits in the detector : BUT SHOWS TWO HITS
  trackID: 1  time: 162.511 ps   SPDetector No: 0  energy dep: 11.067 keV
  trackID: 2  time: 162.581 ps   SPDetector No: 0  energy dep: 145.671 keV

--->Hits Collection: in this event there are 2 hits in the detector : 
  trackID: 1  time: 162.511 ps   SPDetector No: 0  energy dep: 11.067 keV
  trackID: 2  time: 162.581 ps   SPDetector No: 0  energy dep: 145.671 keV

--->Hits Collection: in this event there are 0 hits in the detector : BUT SHOWS THREE HITS
  trackID: 1  time: 183.959 ps   SPDetector No: 0  energy dep: 129.166 keV
  trackID: 1  time: 205.561 ps   SPDetector No: 0  energy dep: 61.9996 keV
  trackID: 1  time: 208.869 ps   SPDetector No: 0  energy dep: 14.6158 keV

--->Hits Collection: in this event there are 3 hits in the detector : 
  trackID: 1  time: 183.959 ps   SPDetector No: 0  energy dep: 129.166 keV
  trackID: 1  time: 205.561 ps   SPDetector No: 0  energy dep: 61.9996 keV
  trackID: 1  time: 208.869 ps   SPDetector No: 0  energy dep: 14.6158 keV

So I appear to be duplicating the hits collection rather than looking at the detectors independently. I don't understand if this is a problem in my detectorHits file or my sensitivedetector file or if I haven't declared the sensitive detectors correctly:

 G4SDManager *SDman = G4SDManager::GetSDMpointer(); 
  SPDetectorSD* aDetectorSD = new SPDetectorSD( detName[i] );
  SDman->AddNewDetector( aDetectorSD );
  detector_log[i]->SetSensitiveDetector(aDetectorSD);

(within a large looped geometry)

Any advice would be greatly appreciated,

thanks in advance,

Laura
    

None Re: Making multiple sensitive Detectors - a probelm  Keywords: sensitive detector hits collection geometry output problem
by Laura Harkness <Laura Harkness>,   31 Dec, 2007
Re: Question Making multiple sensitive Detectors - a probelm (Laura Harkness)

Hi,

thanks for your helpful advice, I discovered a couple of bugs in the program, but now I have a slightly different problem with the output. The hits just don't seem to be registering in the correct event. An example of my output is shown below to highlight the problem. Has anyone seen this sort of thing before? I am sure it must be something silly that I have done, but I have spent a lot of time changing bits and just going round in circles.

--->Hits Collection: in this event there are 0 hits in the detector :

--->Hits Collection: in this event there are 0 hits in the detector :

--->Hits Collection: in this event there are 0 hits in the detector :

--->Hits Collection: in this event there are 0 hits in the detector : 
  trackID: 1  time: 147.712 ps   SPDetector No: 0  energy dep: 213.322 keV
  trackID: 1  time: 168.56 ps   SPDetector No: 0  energy dep: 7.35695 keV
  trackID: 1  time: 469.191 ps   SPDetector No: 1  energy dep: 7.07169 keV

--->Hits Collection: in this event there are 2 hits in the detector :

--->Hits Collection: in this event there are 1 hits in the detector : 
  trackID: 1  time: 204.322 ps   SPDetector No: 0  energy dep: 14.3325 keV
  trackID: 1  time: 210.45 ps   SPDetector No: 0  energy dep: 42.0177 keV
  trackID: 1  time: 224.572 ps   SPDetector No: 0  energy dep: 9.30281 keV
  trackID: 1  time: 267.638 ps   SPDetector No: 0  energy dep: 11.067 keV
  trackID: 3  time: 267.728 ps   SPDetector No: 0  energy dep: 177.594 keV

Any help would be greatly appreciated!

Thank you,

Laura

None Re: Making multiple sensitive Detectors - a probelm  Keywords: sensitive detector hits collection geometry output problem
by Laura Harkness <Laura Harkness>,   19 Dec, 2007
Re: Question Making multiple sensitive Detectors - a probelm (Laura Harkness)

Hi,

thanks for that, I checked through my loops for the geometry, and they are ok. I don't have an events action file. I have primarygenerator, physicslist, detector construction, detectorhits and sensitivedetector.

I think the problem lies either in detectorhits or sensitivedetector, though I am not experienced enough in c++ to know what it is. Perhaps I need multuple hits collection to be defined?

My sensitive detector file: -----------------------------------------------------------

SPDetectorSD::SPDetectorSD(G4String name)
  :G4VSensitiveDetector(name)
{
  G4String HCname;
  collectionName.insert(HCname="detectorCollection");

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SPDetectorSD::~SPDetectorSD(){ }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void SPDetectorSD::Initialize(G4HCofThisEvent* HCE)
{
  DetectorCollection = new SPDetectorHitsCollection(SensitiveDetectorName,collectionName[0]); 
   static G4int HCID = -1;
  if(HCID<0)
    //   { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); }
    { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(DetectorCollection); }

HCE->AddHitsCollection( HCID, DetectorCollection ); }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4bool SPDetectorSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
  G4double edep = aStep->GetTotalEnergyDeposit();

  if(edep==0.) return false;

  SPDetectorHit* newHit = new SPDetectorHit();
  newHit->SetTrackID  (aStep->GetTrack()->GetTrackID());
  newHit->SetDetectorspNb(aStep->GetPreStepPoint()->GetTouchable()
                                               ->GetReplicaNumber());
  newHit->SetHitTime (aStep->GetPostStepPoint()->GetGlobalTime());
  newHit->SetEdep     (edep);
  // newHit->SetDelEnergy (aStep->GetDeltaEnergy());
  newHit->SetPos      (aStep->GetPostStepPoint()->GetPosition());
  // newHit->SetProcessPost (aStep->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName());
  DetectorCollection->insert( newHit );

  newHit->Print();
  newHit->Draw();

return true; }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void SPDetectorSD::EndOfEvent(G4HCofThisEvent*)
{
  if (verboseLevel>0) { 
    G4int NbHits = DetectorCollection->entries();
    G4cout << "\n--->Hits Collection: in this event there are " << NbHits 
        << " hits in the detector : " << G4endl;
     for (G4int i=0;i<NbHits;i++) (*DetectorCollection)[i]->Print();
  } 
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

------------------------------------------------------------------------- My detector hits file:

----------------------------------------------------------------------- G4Allocator<SPDetectorHit> SPDetectorHitAllocator;

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SPDetectorHit::SPDetectorHit() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SPDetectorHit::~SPDetectorHit() {}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

SPDetectorHit::SPDetectorHit(const SPDetectorHit& right)
  : G4VHit()
{
  trackID   = right.trackID;
  // processPost  = right.processPost;
  time      = right.time;
  detectorspNb = right.detectorspNb;
  edep      = right.edep;
  // delEnergy = right.delEnergy;
  pos       = right.pos;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

const SPDetectorHit& SPDetectorHit::operator=(const SPDetectorHit& right)
{
  trackID   = right.trackID;
  //processPost  = right.processPost;
  time      = right.time;
  detectorspNb = right.detectorspNb;
  edep      = right.edep;
  // delEnergy = right.delEnergy;
  pos       = right.pos;
  return *this;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

G4int SPDetectorHit::operator==(const SPDetectorHit& right) const
{
  return (this==&right) ? 1 : 0;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void SPDetectorHit::Draw()
{
  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
  if(pVVisManager)
  {
    G4Circle circle(pos);
    circle.SetScreenSize(3.);
    circle.SetFillStyle(G4Circle::filled);
    G4Colour colour(1.,0.,0.);
    G4VisAttributes attribs(colour);
    circle.SetVisAttributes(attribs);
    pVVisManager->Draw(circle);
  }
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void SPDetectorHit::Print()
{
  G4cout << "  trackID: "<< trackID 
    //	 << "  process "<< processPost
    	 << "  time: "<<G4BestUnit(time,"Time")
    	 << "  SPDetector No: "<< detectorspNb
	 << "  energy dep: "  << G4BestUnit(edep,"Energy") << G4endl;
    //	 << "  energy loss: "  << G4BestUnit(delEnergy,"Energy")

// << " x,y,z: " << G4BestUnit(pos,"Length") << G4endl; }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

-----------------------------------------------------------------------

Any help with this would be greatly appreciated as I have been trying to figure this one out for a while. Thank you very much in advance,

Laura

None RE: Making multiple sensitive Detectors - a probelm  by Makoto Asai <Makoto Asai>,   18 Dec, 2007
Re: Question Making multiple sensitive Detectors - a probelm (Laura Harkness)
Hi,

 The way you defined your two detectors looks fine, but please 
double-check that these declaration lines are not executed 
more than necessary in your looped geometry. I would rather
suspect there would be a problem in how you access to your 
hits collections in your event action or somewhere you wrote 
this output. Could you please post that part of your code?

Makoto 

> -----Original Message-----
> From: ljh@ns.ph.liv.ac.uk [mailto:ljh@ns.ph.liv.ac.uk] 
> Sent: Tuesday, December 18, 2007 10:38 AM
> To: publichypernews
> Subject: Making multiple sensitive Detectors - a probelm
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/186"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi,
> 
> I am simulating a compton camera arrangement and so have two detectors
> with gamma interactions, (currently set at <1MeV incoming).
> 
> I have tried to set the two detectors to be sensitive, which I believe
> works, but when I output the hit information I find something strange:
> 
> --->Hits Collection: in this event there are 0 hits in the 
> detector : BUT SHOWS TWO HITS
>   trackID: 1  time: 325.428 ps   SPDetector No: 0  energy 
> dep: 11.067 keV
>   trackID: 2  time: 325.492 ps   SPDetector No: 0  energy 
> dep: 134.739 keV
> 
> --->Hits Collection: in this event there are 2 hits in the detector : 
>   trackID: 1  time: 325.428 ps   SPDetector No: 0  energy 
> dep: 11.067 keV
>   trackID: 2  time: 325.492 ps   SPDetector No: 0  energy 
> dep: 134.739 keV
> 
> --->Hits Collection: in this event there are 0 hits in the 
> detector : BUT SHOWS TWO HITS
>   trackID: 1  time: 162.511 ps   SPDetector No: 0  energy 
> dep: 11.067 keV
>   trackID: 2  time: 162.581 ps   SPDetector No: 0  energy 
> dep: 145.671 keV
> 
> --->Hits Collection: in this event there are 2 hits in the detector : 
>   trackID: 1  time: 162.511 ps   SPDetector No: 0  energy 
> dep: 11.067 keV
>   trackID: 2  time: 162.581 ps   SPDetector No: 0  energy 
> dep: 145.671 keV
> 
> --->Hits Collection: in this event there are 0 hits in the 
> detector : BUT SHOWS THREE HITS
>   trackID: 1  time: 183.959 ps   SPDetector No: 0  energy 
> dep: 129.166 keV
>   trackID: 1  time: 205.561 ps   SPDetector No: 0  energy 
> dep: 61.9996 keV
>   trackID: 1  time: 208.869 ps   SPDetector No: 0  energy 
> dep: 14.6158 keV
> 
> --->Hits Collection: in this event there are 3 hits in the detector : 
>   trackID: 1  time: 183.959 ps   SPDetector No: 0  energy 
> dep: 129.166 keV
>   trackID: 1  time: 205.561 ps   SPDetector No: 0  energy 
> dep: 61.9996 keV
>   trackID: 1  time: 208.869 ps   SPDetector No: 0  energy 
> dep: 14.6158 keV
> 
> So I appear to be duplicating the hits collection rather than 
> looking at
> the detectors independently. I don't understand if this is a 
> problem in
> my detectorHits file or my sensitivedetector file or if I haven't
> declared the sensitive detectors correctly:
> 
>  G4SDManager *SDman = G4SDManager::GetSDMpointer(); 
>   SPDetectorSD* aDetectorSD = new SPDetectorSD( detName[i] );
>   SDman->AddNewDetector( aDetectorSD );
>   detector_log[i]->SetSensitiveDetector(aDetectorSD);
> 
> (within a large looped geometry)
> 
> Any advice would be greatly appreciated,
> 
> thanks in advance,
> 
> Laura
>     
> 

Question how to make a particle interact only once per detector?  by Victor_Makarov <Victor_Makarov>,   12 Dec, 2007

Hi. I have a number of plane-like detectors set at different heights. I want to detect a particle only once per detector and to let it live in order to be detected by another detector. How can it be realized? Thank you.

None Re: how to make a particle interact only once per detector?  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   17 Dec, 2007
Re: Question how to make a particle interact only once per detector? (Victor_Makarov)
On Wed, 12 Dec 2007, Victor_Makarov wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/184"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi. I have a number of plane-like detectors set at different heights. I
> want to detect a particle only once per detector and to let it live in
> order to be detected by another detector. How can it be realized? Thank
> you.
> 

Hi Victo,

This is an ordinary condition: majority of  our examples work like you 
need.

VI 

None Re: how to make a particle interact only once per detector?  by Victor_Makarov <Victor_Makarov>,   18 Dec, 2007
Re: None Re: how to make a particle interact only once per detector? (Vladimir IVANTCHENKO )

Zdravstvuite Vladimir. Ne mogu perekluchitsa s drugih problem srazu i uvidet' sam realizatziu v primerah. Ne mogli bi vi ukazat' hotja bi odin primer? Spasibo.

Sad Parameterised Volume as sensitive detector : doesn't work :-(  Keywords: sensitive detector, parameterised volume
by roccaz <jerome.roccaz@cea.fr>,   06 Nov, 2007

Well, another problem with my parameterised germanium cristal. I set it as sensitive detector : nothing wrong while compiling, geometry looks good while visualising it ... but no hits in the ouput file.

When I set another part of my detector (the endcap for ex.) I have hits. I've checked that the logical volume associated to the parameterised volume has the right dimensions (parameterised volume contained within the logical volume) so I don't understand where I did it wrong. Here is a part of the script, if it helps :

  // Cristal germanium

  G4double Rmin=0.*mm;
  G4double Rmax=30.5*mm;
  G4double Dz=26.5*mm;
  phiStart=0.*deg;
  phiTotal=360.*deg;

  G4VSolid* cristalGe=new G4Tubs("cristalGe",Rmin,Rmax,Dz,phiStart,phiTotal);
  logicCristal=new G4LogicalVolume(cristalGe, Ge, "logicCristal", 0, 0, 0);
  G4VPVParameterisation* Param_Cristal=new BottomParameterisation(802,13.5*mm,0.01*mm);
  physiCristal=new G4PVParameterised("Cristal",logicCristal,logicSupAlu,kZAxis,802,Param_Cristal); 

  G4VisAttributes* CristalVisAtt=new G4VisAttributes(G4Colour::Yellow());
  logicCristal->SetVisAttributes(CristalVisAtt);

  //Sensitive Detector

  G4SDManager* SDman=G4SDManager::GetSDMpointer();

  G4String simpleSDname="GeSD";
  aGeSD=new SimpleSD(simpleSDname);
  SDman->AddNewDetector(aGeSD);
  logicCristal->SetSensitiveDetector(aGeSD);

  return physiWorld;

thanks,

None RE: Parameterised Volume as sensitive detector : doesn't work :-(  by Makoto Asai <Makoto Asai>,   06 Nov, 2007
Re: Sad Parameterised Volume as sensitive detector : doesn't work :-( (roccaz)
Hi,

 Could you add a simple G4cout in the first line of ProcessHit()
method of your "SimpleSD" to confirm your sensitive detector
is actually invoked?

Makoto 

> -----Original Message-----
> From: roccaz [mailto:jerome.roccaz@cea.fr] 
> Sent: Tuesday, November 06, 2007 7:02 AM
> To: publichypernews
> Subject: Parameterised Volume as sensitive detector : doesn't work :-(
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/182"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Well, another problem with my parameterised germanium 
> cristal. I set it
> as sensitive detector : nothing wrong while compiling, geometry looks
> good while visualising it ... but no hits in the ouput file.
> 
> When I set another part of my detector (the endcap for ex.) I 
> have hits.
> I've checked that the logical volume associated to the parameterised
> volume has the right dimensions (parameterised volume contained within
> the logical volume) so I don't understand where I did it 
> wrong. Here is
> a part of the script, if it helps :
> 
>   // Cristal germanium
> 
>   G4double Rmin=0.*mm;
>   G4double Rmax=30.5*mm;
>   G4double Dz=26.5*mm;
>   phiStart=0.*deg;
>   phiTotal=360.*deg;
> 
>   G4VSolid* cristalGe=new 
> G4Tubs("cristalGe",Rmin,Rmax,Dz,phiStart,phiTotal);
>   logicCristal=new G4LogicalVolume(cristalGe, Ge, 
> "logicCristal", 0, 0, 0);
>   G4VPVParameterisation* Param_Cristal=new 
> BottomParameterisation(802,13.5*mm,0.01*mm);
>   physiCristal=new 
> G4PVParameterised("Cristal",logicCristal,logicSupAlu,kZAxis,80
> 2,Param_Cristal); 
> 
>   G4VisAttributes* CristalVisAtt=new 
> G4VisAttributes(G4Colour::Yellow());
>   logicCristal->SetVisAttributes(CristalVisAtt);
> 
>   //Sensitive Detector
> 
>   G4SDManager* SDman=G4SDManager::GetSDMpointer();
> 
>   G4String simpleSDname="GeSD";
>   aGeSD=new SimpleSD(simpleSDname);
>   SDman->AddNewDetector(aGeSD);
>   logicCristal->SetSensitiveDetector(aGeSD);
> 
>   return physiWorld;
> 
> thanks,
> 

None RE: Parameterised Volume as sensitive detector : doesn't work :-(  by <Jerome.ROCCAZ@CEA.FR>,   07 Nov, 2007
Re: None RE: Parameterised Volume as sensitive detector : doesn't work :-( (Makoto Asai)
Hem, What I've written in my last message works in another case where the cristal is defined as a simple tub and not a parameterised Volume.

As a parameterised Volume must be the only daughter of a mother, the mother cannot be the World in this case... so how to define the mother of my parametrised volume in order to be an effective sensitive detector?

-----Message d'origine-----
De : asai@slac.stanford.edu [mailto:asai@slac.stanford.edu] 
Envoyé : mardi 6 novembre 2007 17:07
À : PublicHyperNews@slac.stanford.edu
Objet : RE: Parameterised Volume as sensitive detector : doesn't work :-(

*** Discussion title: Hits, Digitization and Pileup
Email replies to PublicHyperNews@slac.stanford.edu must include:
  In-Reply-To: <274E6BE39062274CAF5C7153C839FD04024D35C6@exch-mail1.win.slac.stanford.edu>
  Subject: ...change this to be about your reply.

Hi,

 Could you add a simple G4cout in the first line of ProcessHit()
method of your "SimpleSD" to confirm your sensitive detector
is actually invoked?

Makoto 

> -----Original Message-----
> From: roccaz [mailto:jerome.roccaz@cea.fr] 
> Sent: Tuesday, November 06, 2007 7:02 AM
> To: publichypernews
> Subject: Parameterised Volume as sensitive detector : doesn't work :-(
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/182"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Well, another problem with my parameterised germanium 
> cristal. I set it
> as sensitive detector : nothing wrong while compiling, geometry looks
> good while visualising it ... but no hits in the ouput file.
> 
> When I set another part of my detector (the endcap for ex.) I 
> have hits.
> I've checked that the logical volume associated to the parameterised
> volume has the right dimensions (parameterised volume contained within
> the logical volume) so I don't understand where I did it 
> wrong. Here is
> a part of the script, if it helps :
> 
>   // Cristal germanium
> 
>   G4double Rmin=0.*mm;
>   G4double Rmax=30.5*mm;
>   G4double Dz=26.5*mm;
>   phiStart=0.*deg;
>   phiTotal=360.*deg;
> 
>   G4VSolid* cristalGe=new 
> G4Tubs("cristalGe",Rmin,Rmax,Dz,phiStart,phiTotal);
>   logicCristal=new G4LogicalVolume(cristalGe, Ge, 
> "logicCristal", 0, 0, 0);
>   G4VPVParameterisation* Param_Cristal=new 
> BottomParameterisation(802,13.5*mm,0.01*mm);
>   physiCristal=new 
> G4PVParameterised("Cristal",logicCristal,logicSupAlu,kZAxis,80
> 2,Param_Cristal); 
> 
>   G4VisAttributes* CristalVisAtt=new 
> G4VisAttributes(G4Colour::Yellow());
>   logicCristal->SetVisAttributes(CristalVisAtt);
> 
>   //Sensitive Detector
> 
>   G4SDManager* SDman=G4SDManager::GetSDMpointer();
> 
>   G4String simpleSDname="GeSD";
>   aGeSD=new SimpleSD(simpleSDname);
>   SDman->AddNewDetector(aGeSD);
>   logicCristal->SetSensitiveDetector(aGeSD);
> 
>   return physiWorld;
> 
> thanks,
> 


None RE: Parameterised Volume as sensitive detector : doesn't work :-(  by Makoto Asai <Makoto Asai>,   08 Nov, 2007
Re: None RE: Parameterised Volume as sensitive detector : doesn't work :-(

I'm sorry but I don't understand your point.
The geometrical hierarchy of your case should be
 World
  A support Al : logical volume logicSupAlu
    Crystal : logical volume logicCristal <-- sensitive

I do not know how your crystals are placed in their mother (logicSupAlu), but you may need to check if they all are placed inside logicSupAlu.

None RE: Parameterised Volume as sensitive detector : doesn't work :-(  by <Jerome.ROCCAZ@CEA.FR>,   07 Nov, 2007
Re: None RE: Parameterised Volume as sensitive detector : doesn't work :-( (Makoto Asai)
Well I guess I've solved the problem ... that comes from the mother volume of the cristal : if I set the World as mother volume of the cristal, it works!

By the way, I guess I've not well understood what is really a mother volume and how to set that one volume is the mother of another :-s

-----Message d'origine-----
De : asai@slac.stanford.edu [mailto:asai@slac.stanford.edu] 
Envoyé : mardi 6 novembre 2007 17:07
À : PublicHyperNews@slac.stanford.edu
Objet : RE: Parameterised Volume as sensitive detector : doesn't work :-(

*** Discussion title: Hits, Digitization and Pileup
Email replies to PublicHyperNews@slac.stanford.edu must include:
  In-Reply-To: <274E6BE39062274CAF5C7153C839FD04024D35C6@exch-mail1.win.slac.stanford.edu>
  Subject: ...change this to be about your reply.

Hi,

 Could you add a simple G4cout in the first line of ProcessHit()
method of your "SimpleSD" to confirm your sensitive detector
is actually invoked?

Makoto 

> -----Original Message-----
> From: roccaz [mailto:jerome.roccaz@cea.fr] 
> Sent: Tuesday, November 06, 2007 7:02 AM
> To: publichypernews
> Subject: Parameterised Volume as sensitive detector : doesn't work :-(
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/182"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Well, another problem with my parameterised germanium 
> cristal. I set it
> as sensitive detector : nothing wrong while compiling, geometry looks
> good while visualising it ... but no hits in the ouput file.
> 
> When I set another part of my detector (the endcap for ex.) I 
> have hits.
> I've checked that the logical volume associated to the parameterised
> volume has the right dimensions (parameterised volume contained within
> the logical volume) so I don't understand where I did it 
> wrong. Here is
> a part of the script, if it helps :
> 
>   // Cristal germanium
> 
>   G4double Rmin=0.*mm;
>   G4double Rmax=30.5*mm;
>   G4double Dz=26.5*mm;
>   phiStart=0.*deg;
>   phiTotal=360.*deg;
> 
>   G4VSolid* cristalGe=new 
> G4Tubs("cristalGe",Rmin,Rmax,Dz,phiStart,phiTotal);
>   logicCristal=new G4LogicalVolume(cristalGe, Ge, 
> "logicCristal", 0, 0, 0);
>   G4VPVParameterisation* Param_Cristal=new 
> BottomParameterisation(802,13.5*mm,0.01*mm);
>   physiCristal=new 
> G4PVParameterised("Cristal",logicCristal,logicSupAlu,kZAxis,80
> 2,Param_Cristal); 
> 
>   G4VisAttributes* CristalVisAtt=new 
> G4VisAttributes(G4Colour::Yellow());
>   logicCristal->SetVisAttributes(CristalVisAtt);
> 
>   //Sensitive Detector
> 
>   G4SDManager* SDman=G4SDManager::GetSDMpointer();
> 
>   G4String simpleSDname="GeSD";
>   aGeSD=new SimpleSD(simpleSDname);
>   SDman->AddNewDetector(aGeSD);
>   logicCristal->SetSensitiveDetector(aGeSD);
> 
>   return physiWorld;
> 
> thanks,
> 


None RE: Parameterised Volume as sensitive detector : doesn't work :-(  by <Jerome.ROCCAZ@CEA.FR>,   07 Nov, 2007
Re: None RE: Parameterised Volume as sensitive detector : doesn't work :-( (Makoto Asai)
I did it and ... nothing is written as output when I "declare" the cristal as sensitive detector. What can be wrong in my code? :-(

-----Message d'origine-----
De : asai@slac.stanford.edu [mailto:asai@slac.stanford.edu] 
Envoyé : mardi 6 novembre 2007 17:07
À : PublicHyperNews@slac.stanford.edu
Objet : RE: Parameterised Volume as sensitive detector : doesn't work :-(

*** Discussion title: Hits, Digitization and Pileup
Email replies to PublicHyperNews@slac.stanford.edu must include:
  In-Reply-To: <274E6BE39062274CAF5C7153C839FD04024D35C6@exch-mail1.win.slac.stanford.edu>
  Subject: ...change this to be about your reply.

Hi,

 Could you add a simple G4cout in the first line of ProcessHit()
method of your "SimpleSD" to confirm your sensitive detector
is actually invoked?

Makoto 

> -----Original Message-----
> From: roccaz [mailto:jerome.roccaz@cea.fr] 
> Sent: Tuesday, November 06, 2007 7:02 AM
> To: publichypernews
> Subject: Parameterised Volume as sensitive detector : doesn't work :-(
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/182"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Well, another problem with my parameterised germanium 
> cristal. I set it
> as sensitive detector : nothing wrong while compiling, geometry looks
> good while visualising it ... but no hits in the ouput file.
> 
> When I set another part of my detector (the endcap for ex.) I 
> have hits.
> I've checked that the logical volume associated to the parameterised
> volume has the right dimensions (parameterised volume contained within
> the logical volume) so I don't understand where I did it 
> wrong. Here is
> a part of the script, if it helps :
> 
>   // Cristal germanium
> 
>   G4double Rmin=0.*mm;
>   G4double Rmax=30.5*mm;
>   G4double Dz=26.5*mm;
>   phiStart=0.*deg;
>   phiTotal=360.*deg;
> 
>   G4VSolid* cristalGe=new 
> G4Tubs("cristalGe",Rmin,Rmax,Dz,phiStart,phiTotal);
>   logicCristal=new G4LogicalVolume(cristalGe, Ge, 
> "logicCristal", 0, 0, 0);
>   G4VPVParameterisation* Param_Cristal=new 
> BottomParameterisation(802,13.5*mm,0.01*mm);
>   physiCristal=new 
> G4PVParameterised("Cristal",logicCristal,logicSupAlu,kZAxis,80
> 2,Param_Cristal); 
> 
>   G4VisAttributes* CristalVisAtt=new 
> G4VisAttributes(G4Colour::Yellow());
>   logicCristal->SetVisAttributes(CristalVisAtt);
> 
>   //Sensitive Detector
> 
>   G4SDManager* SDman=G4SDManager::GetSDMpointer();
> 
>   G4String simpleSDname="GeSD";
>   aGeSD=new SimpleSD(simpleSDname);
>   SDman->AddNewDetector(aGeSD);
>   logicCristal->SetSensitiveDetector(aGeSD);
> 
>   return physiWorld;
> 
> thanks,
> 


Question Best way to find energy absorbed by detector?  Keywords: Histogram, Photon, Absorved Energy
by <lazcisco@hotmail.com>,   22 Oct, 2007

So I've created a setup where photons are being shot into a tube of Germanium. What is the best way to obtain how many energy is absorbed by the Germanium so that a histogram can be made?

Question ExN03 energy absorption in each layer  Keywords: ExN03 energy absorption layers
by Oscar Larsson <Oscar Larsson>,   09 Oct, 2007

Hi

I'm currently doing my diploma work and been introduced to Geant4 a very short time ago. Therefor I need your help.

I'm making a model much like the one in example N03, but instead of being interested in the total energy absorbed by ALL the layers, I'm interested in how much energy is being absorbed by EACH layer. How do I do this?

/Oscar

None Re: ExN03 energy absorption in each layer  Keywords: ExN03 energy absorption layers
by michel maire <michel maire>,   09 Oct, 2007
Re: Question ExN03 energy absorption in each layer (Oscar Larsson)

User Oscar Larsson wrote:

>> Hi
>> 
>> I'm currently doing my diploma work and been introduced to Geant4 a very
>> short time ago. Therefor I need your help.
>> 
>> I'm making a model much like the one in example N03, but instead of
>> being interested in the total energy absorbed by ALL the layers, I'm
>> interested in how much energy is being absorbed by EACH layer. How do I
>> do this?
>> 
>> /Oscar

 You may be interested to have a look at :
 examples/extended/electromagnetic/TestEm3

   Michel

Question Problem with Sensitive Detectors using Primitve Scorer  Keywords: Sensitive Detectors, Primitive Scorer
by Slawomir Suchy <ssuchy@ucsd.edu>,   12 Sep, 2007
Hello Everybody, 

I ran into a problem when I tried to make my detectors Sensitive. 
I used Example N07 as a guideline to figure out how this works and 
implemented it on my program. Example N07 compiles and runs without problems. 
(At least with no Seg Fault)
My program compiles without an error message, but 
when I run the program I get an segmentation fault at line:

  CZT_1_Logical_Module1->SetSensitiveDetector(myScorer);

I doublechecked that the logic is defined and now I am running out of ideas.

My code for this part looks like that: I am looping through multiple detectors, 
each having 4 logical volumes. For this test I just used Module 1 and Detector 1. 

for (int j=1;j<2;j++)
    {
      for (int i=1;i<5;i++)
	{
	  sprintf(detName,"CZT_%i_Logical_Module%i_Scorer",i,j);
	  G4MultiFunctionalDetector* myScorer 
	    = new G4MultiFunctionalDetector(detName);
	  
           G4VPrimitiveScorer* primitive;
	   primitive = new G4PSEnergyDeposit("eDep");
	   myScorer->RegisterPrimitive(primitive);

	   G4SDManager::GetSDMpointer()->AddNewDetector(myScorer);

           // Segmentation fault occurs here
	   CZT_1_Logical_Module1->SetSensitiveDetector(myScorer);
           
 	}
    }


Thanks for your help, Slawo

None RE: Problem with Sensitive Detectors using Primitve Scorer  by Makoto Asai <Makoto Asai>,   13 Sep, 2007
Re: Question Problem with Sensitive Detectors using Primitve Scorer (Slawomir Suchy)
Hi, Could you please check the validity of the pointer
"CZT_1_Logical_Module1"?

Makoto

> -----Original Message-----
> From: Slawomir Suchy [mailto:ssuchy@ucsd.edu] 
> Sent: Wednesday, September 12, 2007 7:03 PM
> To: publichypernews
> Subject: Problem with Sensitive Detectors using Primitve Scorer
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/176"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hello Everybody, 
> 
> I ran into a problem when I tried to make my detectors Sensitive. 
> I used Example N07 as a guideline to figure out how this works and 
> implemented it on my program. Example N07 compiles and runs 
> without problems. 
> (At least with no Seg Fault)
> My program compiles without an error message, but 
> when I run the program I get an segmentation fault at line:
> 
>   CZT_1_Logical_Module1->SetSensitiveDetector(myScorer);
> 
> I doublechecked that the logic is defined and now I am 
> running out of ideas.
> 
> My code for this part looks like that: I am looping through 
> multiple detectors, 
> each having 4 logical volumes. For this test I just used 
> Module 1 and Detector 1. 
> 
> for (int j=1;j<2;j++)
>     {
>       for (int i=1;i<5;i++)
>         {
>           sprintf(detName,"CZT_%i_Logical_Module%i_Scorer",i,j);
>           G4MultiFunctionalDetector* myScorer 
>             = new G4MultiFunctionalDetector(detName);
>           
>            G4VPrimitiveScorer* primitive;
>            primitive = new G4PSEnergyDeposit("eDep");
>            myScorer->RegisterPrimitive(primitive);
> 
>            G4SDManager::GetSDMpointer()->AddNewDetector(myScorer);
> 
>            // Segmentation fault occurs here
>            CZT_1_Logical_Module1->SetSensitiveDetector(myScorer);
>            
>         }
>     }
> 
> Thanks for your help, Slawo
> 
> 

None RE: Problem with Sensitive Detectors using Primitve Scorer  by Slawomir Suchy <ssuchy@ucsd.edu>,   13 Sep, 2007
Re: None RE: Problem with Sensitive Detectors using Primitve Scorer (Makoto Asai)
You were right, 
I had the Logic Volume locally in SetupGeometry() defined, 
not globally in the SetupDetector() function. 
It took me some time to figure this out, because I always was 
overwriting it locally in the Geometry. :-). 

Thanks for the hint. Helped a lot. 

Slawo

Question optical photon hit coordinate at detector  Keywords: coordinate
by jaypee quino <jaypee quino>,   15 Aug, 2007

what's wrong with this code in getting the photon hit coordinate??? I never got the reasonable coordinate.. It gives out values like 1 hit stored in SD1

> with coordinates x=1.44e-269,
> y=1.44e-269,z=1.74e-290}, which actually not
> reasonable

//################################################## //AHit.cc //##################################################

#include "AHit.hh"
#include "G4UnitsTable.hh"
#include "G4VVisManager.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"

G4Allocator<AHit> AHitAllocator;

AHit::AHit() 
{
  pos      = 0.0;
}

AHit::~AHit() {}

AHit::AHit(const AHit& right)
  : G4VHit()
{
  trackID   = right.trackID;
//  edep      = right.edep;
  pos       = right.pos;
}

const AHit& AHit::operator=(const AHit& right)
{
  trackID   = right.trackID;
  pos       = right.pos;
  return *this;
}

G4int AHit::operator==(const AHit& right) const
{
  return (this==&right) ? 1 : 0;
}

void AHit::Draw()
{
  G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
  if(pVVisManager)
  {
    G4Circle circle(pos);
    circle.SetScreenSize(2.);
    circle.SetFillStyle(G4Circle::filled);
    G4Colour colour(1.,0.,0.);
    G4VisAttributes attribs(colour);
    circle.SetVisAttributes(attribs);
    pVVisManager->Draw(circle);
  } 
}

void AHit::Print() {

}

//################################################## //AHit.cc //##################################################

#include "AHit.hh"
#include "ASD.hh"
#include "G4HCofThisEvent.hh"
#include "G4Step.hh"
#include "G4ThreeVector.hh"
#include "G4ios.hh"

ASD::ASD(G4String name)
:G4VSensitiveDetector(name)
{
  G4String HCname;
  collectionName.insert(HCname="ACollection");
}

ASD::~ASD(){ }

void ASD::Initialize(G4HCofThisEvent* HCE)
{
  static int HCID = -1;
  ACollection = new AHitsCollection
                          (SensitiveDetectorName,collectionName[0]); 
  if(HCID<0)
  { HCID = GetCollectionID(0); }
  HCE->AddHitsCollection(HCID, ACollection); 
  }

G4bool ASD::ProcessHits(G4Step* aStep, G4TouchableHistory*) {

  G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
  if(particleName == "opticalphoton") aStep->GetTrack()->SetTrackStatus(fStopAndKill);

  G4StepPoint* thePrePoint = aStep->GetPreStepPoint();
  G4StepPoint* thePostPoint = aStep->GetPostStepPoint();

  //Get the average position of the hit
  G4ThreeVector pos = thePrePoint->GetPosition() + thePostPoint->GetPosition();
  pos/=2.;

  AHit* newHit = new AHit();
  newHit->SetTrackID(aStep->GetTrack()->GetTrackID());
  newHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
  ACollection->insert(newHit);

return true; }

void ASD::EndOfEvent(G4HCofThisEvent* HCE)
{
  static G4int HCID = -1;
  if (HCID<0)
    { HCID = GetCollectionID(0);}
  HCE->AddHitsCollection( HCID, ACollection);

}

void ASD::clear() { }

void ASD::DrawAll() { }

void ASD::PrintAll() { }

//################################################## //EventAction.cc //##################################################

#include "EventAction.hh"

#include "AHit.hh"
#include "BHit.hh"

#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4SDManager.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include <fstream>

EventAction::EventAction() {

  AID = -1;
  BID = -1;

  m = 0;
  m1=0;
}

EventAction::~EventAction() {;}

void EventAction::BeginOfEventAction(const G4Event*)
{
  G4SDManager * SDman = G4SDManager::GetSDMpointer();

  if(AID<0){
    G4String colNam;
    AID = SDman->GetCollectionID(colNam="ACollection");
  } 
  if(BID<0){
    G4String colNam;
    BID = SDman->GetCollectionID(colNam="BCollection");
  }
}

void EventAction::EndOfEventAction(const G4Event* evt)
{
  G4cout << ">> Event " << evt->GetEventID() << G4endl;

  G4TrajectoryContainer* trajectoryContainer = evt->GetTrajectoryContainer();
  G4int n_trajectories = 0;
  if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();

  if (G4VVisManager::GetConcreteInstance())
    {
     for (G4int i=0; i<n_trajectories; i++) 
        { G4Trajectory* trj = (G4Trajectory*)
	                            ((*(evt->GetTrajectoryContainer()))[i]);
          trj->DrawTrajectory(50);
        }
    }

  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();

  AHitsCollection* AHC = 0;
  BHitsCollection* BHC = 0;
//Get the hit collections
  if(HCE){
  AHC = (AHitsCollection*)(HCE->GetHC(AID));
  BHC = (BHitsCollection*)(HCE->GetHC(BID));
         }

  std::fstream iopos("det.dat",std::ios::out | std::ios::app);

// hits in Detector A
  if (AHC){
    int n_hit = AHC->entries();
    if(n_hit>0){
      m = m + 1;

  G4ThreeVector pos = (*AHC)[n_hit]->GetPos()/mm;

  G4ThreeVector position = 0;
  if (AHC){
    int n_hit = AHC->entries();
    if(n_hit>0){

        G4ThreeVector pos = (*AHC)[n_hit]->GetPos();
        G4cout << n_hit << " : " << n_hit << " Hits out w/ pos(x,y,z) = "
               << pos.x() << "\t" << pos.y() << "\t" << pos.z() << G4endl;

         store in a dat file the position of the hit
        iopos << pos.x() << "\t" << pos.y() << "\t" << pos.z() << G4endl;
       }
  }

//or alternatively

/*
  if (AHC){

    int n_hit = AHC->entries();
    if(n_hit>0){
      m = m+1;
    iopos << m << "Hits in" << std::endl;
    }}

  if (BHC){
    int n_hit = BHC->entries();
    if(n_hit>0){
      m2 = m2 + 1;
      for (int ihit = 0 ; ihit < m2; ihit++) {
        G4ThreeVector pos = (*BHC)[ihit]->GetPos();
        G4cout << m2 << " : " << n_hit << " Hits out w/ pos(x,y,z) = "
               << pos.x() << "\t" << pos.y() << "\t" << pos.z() << G4endl;
        iopos << m2 << " Hits out w/ pos(x,y,z) = "
              << pos.x() << "\t" << pos.y() << "\t" << pos.z() << G4endl;
      }
    }
  }   */

iopos.close(); }

Question optical hit coordinate at the detector with respect to the world coordinate  Keywords: optical photon hit coordinate at the detector
by jaypee quino <jaypee quino>,   15 Aug, 2007

Good Evening Sir,

I am Jaypee From Philippines. I am working on optical photon propagation in an optical fiber. I am interested on the hits on the detector. The problem goes like this, i can count the number of photons hitting the detector but it cannot produce the exactly location of the hits at the end of the fiber.In fact it gave me a location like this {1 hit stored in SD1 with coordinates x=1.44e-269, y=1.44e-269,z=1.74e-290}, which actually not reasonable. I am interested on the coordinate of the hits. I humbly ask for your help. It would be a great honor.

Sincerely,

None use G4PSDoseDeposit class together with variance deduction techniques  Keywords: Dose, sensitive detector
by long <long>,   07 Aug, 2007

Dear geant4 experts, I met a strange problem. I use snesitive detector to
record dose. At the same time, I try to get dose by user-defined function in
UserSteppingAction class. Two results are same if without variance deduction.
But if I use interactive commands, /grdm/analogueMC false,/grdm/splitNuclei 10
two results become different. The result from G4PSDoseDeposit becomes much
larger than the result from UserSteppingAction. The latter seems more reasonable,
approximatley equals to the results by Analogue method. 
     I once thought it may be the weight factor has been forgotten in G4PSDoseDeposit.
But actually G4PSDoseDeposit has taken into account the weight correction. So there must
be other reasons. Any idea would be appreciated. Thanks in advance.

long

 

None Re: use G4PSDoseDeposit class together with variance deduction techniques  Keywords: Dose, sensitive detector
by Tsukasa Aso <Tsukasa Aso>,   09 Aug, 2007
Re: None use G4PSDoseDeposit class together with variance deduction techniques (long)
Hi,

 I tried to reproduce your situation, and confirmed that the DoseScorer
does not give correct answer with "/grdm/analogueMC false" and 
"/grdm/splitNuclei 10". I checked the particle
weight at the both of G4PSDoseScorer and SteppingAction and found
the particle weights are larger than expected in both case.

But, you wrote that the dose calculated at SteppingAction was 
correct. If the particle weight is wrong, the dose calculated at
SteppingAction should give wrong value, too.
So, it is very helpful if you give me your code of SteppingAction,
or if you could check the value of particle weight at your 
SteppingAction.

Best Regards,
Tsukasa Aso

None Re: use G4PSDoseDeposit class together with variance deduction techniques  Keywords: Dose, sensitive detector
by Tsukasa Aso <Tsukasa Aso>,   20 Aug, 2007
Re: None Re: use G4PSDoseDeposit class together with variance deduction techniques (Tsukasa Aso)
Dear Long,

 Thank you for providing your code.
It looks same as the code in G4PSDoseDeposit.
In my study, both value of the dose calculated in 
G4PSDoseDeposit and SteppingAction are same each other. 
And the dose calculated with "analogueMC 0" are
not consistent with the dose calculated with "analogueMC 1".

 I checked related parameters in both of SteppingAction and
G4PSDoseDeposit, but all of them are same. So I still does not
understand what is the difference between SteppingAction 
and G4PSDoseDeposit as you reported.

 Do you have any further information about your calculation
in your SteppingAction and your analysis? I want to find
what is missed in G4PSDoseDeposit but you included 
in your SteppingAction.


 Tsukasa Aso
None Re: use G4PSDoseDeposit class together with variance deduction techniques  Keywords: Dose, sensitive detector
by long <long>,   10 Aug, 2007
Re: None Re: use G4PSDoseDeposit class together with variance deduction techniques (Tsukasa Aso)

Tsukasa Aso,
   Thank you for your reply. Here some more information on my test results. 
  Result without variance deduction:
   G4PSDoseDeposit: 4.18e-8 gray   , UserStepping: 4.18e-8 gray
  Result with variance deduction(splitNuclei):
   G4PSDoseDeposit: 1.38e-4 gray   , UserStepping: 4.3*e-8 gray
   The following code is my user-defined scorer. I hope it could be useful
for you.     
  with best regards!
long

//-------------------------------------------------------------------
void my1SteppingAction::UserSteppingAction(const G4Step* pStep) 
{
  CallAddDoseRate(pStep); // only in detector plane 
  CallAddSpectrum(pStep);
  CallAddIsotope(pStep);
  CallEnergyDistribution(pStep);
  CallAddEmittedParticle(pStep);
  //CallAddLostPrimaryParticle(pStep);

#if OUTPUT_FILES
  CallAddNeutron(pStep);// only output to regular file,not through AIDA
#endif
}

void my1SteppingAction::CallAddDoseRate(const G4Step* pStep) 
{
#ifdef G4ANALYSIS_USE
 G4String CurrentVolumeName = pStep->GetPreStepPoint()->GetTouchableHandle()->GetVolume()->GetName();
  if (CurrentVolumeName == "physDetCell")
    {
      if (pStep->GetTotalEnergyDeposit() ) 
	{
	  G4Track* pTrack = pStep->GetTrack();  //G4Track* G4Step::GetTrack() const
	  G4ThreeVector prePoint = pStep->GetPreStepPoint()->GetPosition();
	  G4double time = pStep->GetPreStepPoint()->GetGlobalTime() ;
	  // - pStep->GetPreStepPoint()->GetLocalTime(); 
	  //    G4double time = pStep->GetPreStepPoint()->GetLocalTime(); // time since the track was created
	  G4double edep = pStep->GetTotalEnergyDeposit();
	  G4double weight = pStep->GetPreStepPoint()->GetWeight() ; 
	  G4String ParticleName = pTrack->GetDefinition()->GetParticleName();
	  const G4VTouchable *pTouchable = pStep->GetPreStepPoint()->GetTouchable();
	  G4int iy=pTouchable->GetReplicaNumber(2);  // topest level =2
	  G4int ix=pTouchable->GetReplicaNumber(1);
	  G4int iz=pTouchable->GetReplicaNumber(0);

	  // debug code --Begin
	  //	  if(time <= 0*s || time >=3600*24*7*s) 
	  //  {
	  //    G4cout << "ParticleName: "<<ParticleName <<"   "<<"time: "<<time/s<<G4endl;
	  //  }
          // debug code --end
	  // all the geometryical information should be taken from preStepPoint

	  my1AnalysisManager::GetInstance()->AddDoseRate(ix,iy,iz,ParticleName,edep,weight,time);
 	}
    }
#endif
}

Question How to make a inputfile for TDC information  Keywords: TDC
by H.D.Kim <kimhd@kaist.ac.kr>,   10 Jul, 2007

Dear all GEANT4 users

I trying to make a inputfile in order to obtain the TDC data. In this input, the Detection setup is very simple as like this

1) scintillator is located in the center of the geometry setup. 2) two silicon detectors were attached at the end of the scintillator.

In this inputfile, I'd like to obtain the TDC signal from each silicon detectors. Also ADC data is need in the scintillator.

Now I am modifying gammaray_telescope this is exist in the '/geant4/example/advanced' directory. However, I do not know how to obtain the TDC data using "Digi".

Dose anyone have any thoughts on what I need to do?

Thanks

H.D.Kim

None Re: How to make a inputfile for TDC information  Keywords: TDC
by Michael Burgess <Michael Burgess>,   12 Jul, 2007
Re: Question How to make a inputfile for TDC information (H.D.Kim)

I am also curious about this. It seems that geant4 requires you to right your own algorithims for digitizing data and generating a pulse height by utilizng what is already included.

Am I wrong? If so, how is this done?

None Retrieving G4THitsMap from EndOfRunAction  by Michael L. <leunm@hotmail.com>,   13 Jun, 2007

I've been getting different error messages when I try to access the G4THitsMap object outside the class it was defined in.

For illustration, if I make the following two changes to example N07:

In ExN07Run.cc, at the end...

...
    inline G4double GetEMinElectron(G4int i) const
    { return FindMinimum(mapMin[i][1]); }
    inline G4double GetEMinPositron(G4int i) const
    { return FindMinimum(mapMin[i][2]); }

    // I ADDED THIS
    G4THitsMap<G4double> GetDoseMap() const
    { return mapSum[6][6]; }
...

In ExN07RunAction.cc, near the end...

...
    G4cout << " Total number of steps of e+/e- in an event :" << G4endl << "   "
           << " Absorber " << (theRun->GetNStep(ih1))/nEvt
           << "      Gap " << (theRun->GetNStep(ih2))/nEvt
           << G4endl;
    G4cout
    << "############################################################" << G4endl;

    // I ADDED THIS
    G4THitsMap<G4double> myMAP = theRun->GetDoseMap();
...

The program will compile. However, when I run: $G4EXE/exampleN07 exampleN07.in

I get: *** glibc detected *** corrupted double-linked list: 0x00b36878 ***

In my own application, I try to do something similar, and I get a segmentation fault.

Is there a bug in the code?

Thank you in advance.

Question Filtering optical photons and counting them  Keywords: photon detection
by Hugo Rivera <uair9@yahoo.com>,   11 Jun, 2007

Hello:
 I am trying to simulate a Cerenkov water tank detector and I need to count
the number of optical photons arriving at my PMT per event, but only those
photons with energies lower than 4.0 eV and higher than 2.2 eV. I implemented
a primitive counter with a filter using ExN07 as guide, but I can only filter between
particle types and not energy ranges; in other words, how can I count the
number of photons with energies inside a given energy range arriving at my
PMT?
Thanks in advance for your help, and my apologies if this question is silly, but I am
confused on how to create Sensitive Detectors in GEANT4.

Hugo

None RE: Filtering optical photons and counting them  by Makoto Asai <Makoto Asai>,   11 Jun, 2007
Re: Question Filtering optical photons and counting them (Hugo Rivera)
You may want to use G4SDParticleWithEnergyFilter, which allows
you to specify both particle type(s) and upper and lower kinetic energy
limits. Please consult to the header file of this filter class. 

> -----Original Message-----
> From: Hugo Rivera [mailto:uair9@yahoo.com] 
> Sent: Monday, June 11, 2007 1:46 PM
> To: publichypernews
> Subject: Filtering optical photons and counting them
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/155"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hello:
>  I am trying to simulate a Cerenkov water tank detector and I 
> need to count
> the number of optical photons arriving at my PMT per event, 
> but only those
> photons with energies lower than 4.0 eV and higher than 2.2 
> eV. I implemented
> a primitive counter with a filter using ExN07 as guide, but I 
> can only filter between
> particle types and not energy ranges; in other words, how can 
> I count the
> number of photons with energies inside a given energy range 
> arriving at my
> PMT?
> Thanks in advance for your help, and my apologies if this 
> question is silly, but I am
> confused on how to create Sensitive Detectors in GEANT4.
> 
> Hugo
> 

None RE: Filtering optical photons and counting them  by Hugo Rivera <uair9@yahoo.com>,   11 Jun, 2007
Re: None RE: Filtering optical photons and counting them (Makoto Asai)

Many thanks for your feedback. One more thing: I was wondering if is it possible to get the energy for every photon that arrives to my PMT? how can this be done? I saw a couple of functions that register the total energy deposited for each event, perhaps there is a way to obtain the energy of every single photon per event. Thanks again

Hugo

> You may want to use G4SDParticleWithEnergyFilter, which allows
> you to specify both particle type(s) and upper and lower kinetic energy
> limits. Please consult to the header file of this filter class. 

None RE: Filtering optical photons and counting them  by Makoto Asai <Makoto Asai>,   11 Jun, 2007
Re: None RE: Filtering optical photons and counting them (Hugo Rivera)
In this case, you cannot use a scorer. A scorer by definition
sums one physical quantity for an event. You should create
your own sensitive detector to record each photon. Note that
you can still use G4SDParticleWithEnergyFilter to be attached
to your detector, thus your detector should simply record each
step.

Makoto

> -----Original Message-----
> From: Hugo Rivera [mailto:uair9@yahoo.com] 
> Sent: Monday, June 11, 2007 7:41 PM
> To: publichypernews
> Subject: RE: Filtering optical photons and counting them
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/155/1/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Many thanks for your feedback. One more thing: I was 
> wondering if is it
> possible to get the energy for every photon that arrives to 
> my PMT? how
> can this be done? I saw a couple of functions that register the total
> energy deposited for each event, perhaps there is a way to obtain the
> energy of every single photon per event. Thanks again
> 
> Hugo
> 
> > You may want to use G4SDParticleWithEnergyFilter, which allows
> > you to specify both particle type(s) and upper and lower 
> kinetic energy
> > limits. Please consult to the header file of this filter class. 
> 
> 

None RE: Filtering optical photons and counting them  by michel maire <michel maire>,   12 Jun, 2007
Re: None RE: Filtering optical photons and counting them (Makoto Asai)

 One additionnal comment : if it is only question to count particles, 
 it is not necessary to use the concept of sensitive detector,
 nor scoring engines.
 You can do it directly in stepping action.

   Michel Maire

Question Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?  by Victor_Makarov <Victor_Makarov>,   07 Jun, 2007

I have a sensitive detector. It calculates energy deposition per event and prints it out by means of the current block of EndofEvent method:

G4double totE = 0;
    G4int NbHits = trackerCollection->entries();
	for(int i=0;i<NbHits;i++)
    { totE += (*trackerCollection)[i]->GetEdep(); }
    G4cout << "     Total energy deposition in NaI : "
         << totE / MeV << " (MeV)" << G4endl;
....

It is printed out very well in my output. But I would also like to fill a histogram with that info. I think I should use something like

#ifdef G4ANALYSIS_USE
  Run->GetHisto(0)->fill(totE/MeV);
#endif

after the previous block.

I've already created a blank histogram in RunAction and an empty aida file is outputted. It's ok!

In an example (extended-Em4) I saw how things are connected in EventAction when energy deposition of every event with no SD is sent to histogram:

1) EventAction::EventAction(RunAction* run)

:Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
2) Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV);

In a similar way I think I should modify my sensitive detector constructor But I'm not very strong in C++ programming and don't know what to modify. My SD constructor is:

TrackerSD::TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
  G4String HCname;
  collectionName.insert(HCname="trackerCollection");
}

Any idea how to modify it? Thanks.

None Re: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   08 Jun, 2007
Re: Question Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Victor_Makarov)
On Thu, 7 Jun 2007, Victor wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/153"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> I have a sensitive detector. It calculates energy deposition per event
> and prints it out by means of the current block of EndofEvent method:
> 
> G4double totE = 0;
>     G4int NbHits = trackerCollection->entries();
>         for(int i=0;i<NbHits;i++)
>     { totE += (*trackerCollection)[i]->GetEdep(); }
>     G4cout << "     Total energy deposition in NaI : "
>          << totE / MeV << " (MeV)" << G4endl;
> ....
> 
> It is printed out very well in my output. But I would also like to fill
> a histogram with that info. I think I should use something like
> 
> #ifdef G4ANALYSIS_USE
>   Run->GetHisto(0)->fill(totE/MeV);
> #endif
> 
> after the previous block.
> 
> I've already created a blank histogram in RunAction and an empty aida
> file is outputted. It's ok!
> 
> In an example (extended-Em4) I saw how things are connected in
> EventAction when energy deposition of every event with no SD is sent to
> histogram:
> 
> 1) EventAction::EventAction(RunAction* run)
> 
> :Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
> 
> 2) Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV);
> 
> In a similar way I think I should modify my sensitive detector
> constructor But I'm not very strong in C++ programming and don't know
> what to modify. My SD constructor is:
> 
> TrackerSD::TrackerSD(G4String name)
> :G4VSensitiveDetector(name)
> {
>   G4String HCname;
>   collectionName.insert(HCname="trackerCollection");
> }
> 
> Any idea how to modify it? Thanks.
> 

Hello,

TestEm4 is not the best example for histogramming. Please, have a look 
into other examples: Em3, Em7, Em13... or as analysis example A01.

VI
None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?  by Makoto Asai <Makoto Asai>,   07 Jun, 2007
Re: Question Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Victor_Makarov)
Please refer to examples/extended/analysis/A01.
Given you have nice print-out for each event, you 
do not need to modify your sensitive detector at 
all. Just modify your EndOfEventAction() to fill your
histograms, as demonstrated in A01 example.

Makoto 

> -----Original Message-----
> From: Victor [mailto:douglas@slac.stanford.edu] 
> Sent: Thursday, June 07, 2007 6:24 AM
> To: publichypernews
> Subject: Can I fill histograms with energy deposit per event 
> using EndOfEvent() method of G4VSensitiveDetector?
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/153"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> I have a sensitive detector. It calculates energy deposition per event
> and prints it out by means of the current block of EndofEvent method:
> 
> G4double totE = 0;
>     G4int NbHits = trackerCollection->entries();
>         for(int i=0;i<NbHits;i++)
>     { totE += (*trackerCollection)[i]->GetEdep(); }
>     G4cout << "     Total energy deposition in NaI : "
>          << totE / MeV << " (MeV)" << G4endl;
> ....
> 
> It is printed out very well in my output. But I would also 
> like to fill
> a histogram with that info. I think I should use something like
> 
> #ifdef G4ANALYSIS_USE
>   Run->GetHisto(0)->fill(totE/MeV);
> #endif
> 
> after the previous block.
> 
> I've already created a blank histogram in RunAction and an empty aida
> file is outputted. It's ok!
> 
> In an example (extended-Em4) I saw how things are connected in
> EventAction when energy deposition of every event with no SD 
> is sent to
> histogram:
> 
> 1) EventAction::EventAction(RunAction* run)
> 
> :Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
> 
> 2) Run->GetHisto(0)->fill(TotalEnergyDeposit/MeV);
> 
> In a similar way I think I should modify my sensitive detector
> constructor But I'm not very strong in C++ programming and don't know
> what to modify. My SD constructor is:
> 
> TrackerSD::TrackerSD(G4String name)
> :G4VSensitiveDetector(name)
> {
>   G4String HCname;
>   collectionName.insert(HCname="trackerCollection");
> }
> 
> Any idea how to modify it? Thanks.
> 

None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?  by Victor_Makarov <Victor_Makarov>,   08 Jun, 2007
Re: None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Makoto Asai)

I receive an error.

<aTrackerSD/tCollection> is not found. Seems that I can't give an exact name of my collection/detector.
But I checked and found no mistakes. Maybe You can see them:

My Detector construction block:

//------------------------------------------------ 
  // Sensitive detectors
  //------------------------------------------------ 

  G4SDManager* SDman = G4SDManager::GetSDMpointer();
  G4String trackerChamberSDname;
  TrackerSD* aTrackerSD = new TrackerSD(trackerChamberSDname="/aTrackerSD");
  SDman->AddNewDetector( aTrackerSD );
  logicBox->SetSensitiveDetector( aTrackerSD );

My TrackerSD block:

TrackerSD::TrackerSD(G4String name)
:G4VSensitiveDetector(name)
{
  G4String HCname;
  collectionName.insert(HCname="tCollection");
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

TrackerSD::~TrackerSD(){ }

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void TrackerSD::Initialize(G4HCofThisEvent* HCE)
{
  trackerCollection = new TrackerHitsCollection
                          (SensitiveDetectorName,collectionName[0]); 
  G4int HCID = -1;
  if(HCID<0)
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(trackerCollection); }
  HCE->AddHitsCollection( HCID, trackerCollection ); 
}

My block in EventAction:

EventAction::EventAction(RunAction* run)
:Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
{

  G4String colName;
  G4SDManager* SDman = G4SDManager::GetSDMpointer();
  HHC1ID = SDman->GetCollectionID(colName="aTrackerSD/tCollection");
  eventMessenger = new EventActionMessenger(this);
}

None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?  by Makoto Asai <Makoto Asai>,   08 Jun, 2007
Re: None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Victor_Makarov)
Please refer to any of recent SLAC-organized tutorials and look at
the presentation titled "Scoring 2". For example at the previous 
SLAC tutorial,
http://geant4.slac.stanford.edu/SLACTutorial07/agenda.html
look at page 25 of "Scoring 2".

> -----Original Message-----
> From: Victor [mailto:douglas@slac.stanford.edu] 
> Sent: Friday, June 08, 2007 3:01 AM
> To: publichypernews
> Subject: RE: Can I fill histograms with energy deposit per 
> event using EndOfEvent() method of G4VSensitiveDetector?
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/153/1/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> I receive an error.
> 
> <aTrackerSD/tCollection> is not found. Seems that I can't 
> give an exact name of my collection/detector.
> 
> But I checked and found no mistakes. Maybe You can see them:
> 
> My Detector construction block:
> 
> //------------------------------------------------ 
>   // Sensitive detectors
>   //------------------------------------------------ 
> 
>   G4SDManager* SDman = G4SDManager::GetSDMpointer();
>   G4String trackerChamberSDname;
>   TrackerSD* aTrackerSD = new 
> TrackerSD(trackerChamberSDname="/aTrackerSD");
>   SDman->AddNewDetector( aTrackerSD );
>   logicBox->SetSensitiveDetector( aTrackerSD );
> 
> My TrackerSD block:
> 
> TrackerSD::TrackerSD(G4String name)
> :G4VSensitiveDetector(name)
> {
>   G4String HCname;
>   collectionName.insert(HCname="tCollection");
> }
> 
> //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.......
> .oooOO0OOooo......
> 
> TrackerSD::~TrackerSD(){ }
> 
> //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.......
> .oooOO0OOooo......
> 
> void TrackerSD::Initialize(G4HCofThisEvent* HCE)
> {
>   trackerCollection = new TrackerHitsCollection
>                           (SensitiveDetectorName,collectionName[0]); 
>   G4int HCID = -1;
>   if(HCID<0)
>   { HCID = 
> G4SDManager::GetSDMpointer()->GetCollectionID(trackerCollection); }
>   HCE->AddHitsCollection( HCID, trackerCollection ); 
> }
> 
> My block in EventAction:
> 
> EventAction::EventAction(RunAction* run)
> :Run(run),drawFlag("none"),printModulo(10000),eventMessenger(NULL)
> 
> {
> 
>   G4String colName;
>   G4SDManager* SDman = G4SDManager::GetSDMpointer();
>   HHC1ID = SDman->GetCollectionID(colName="aTrackerSD/tCollection");
>   eventMessenger = new EventActionMessenger(this);
> }
> 
> 

None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?  by Victor_Makarov <Victor_Makarov>,   09 Jun, 2007
Re: None RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector? (Makoto Asai)

Thanks!!! Page 25 helped a lot!!!
I put the line   runManager->Initialize() before 
 EventAction* EvAct    = new EventAction(RunAct);  
  runManager->SetUserAction(EvAct)
and that solved the problem!

None question on how to use G4THitsMap  Keywords: G4THitsMap, CopyNo
by long <long>,   04 Jun, 2007

Dear geant4 experts,
      I feel confused on how to use G4THitsMap. As mentioned in manual Section 4.4.5, 
each of the concrete primitive scorers generates a G4THitsMap<G4double> that maps a
G4double value to its key integer number. By default, the key is taken as the copy 
number of the G4LogicalVolume to which G4MultiFunctionalDetector is assigned. In case
the key must consider more than one copy number of a different geometry hierarchy, 
the user can derive his/her own primitive scorer from the provided concrete class and
implement the GetIndex(G4Step*) virtual method to return the unique key.
     So for example RE02, the key value set by GetIndex() should be less than the total
number of sensitive cells(fNx*fNy*fNz). But in another function called DumpAllScorer(), 
it is found that the key value ()of HitsMaps sometimes is larger than the total number 
of cells. I listed these two functions below. How to understand this? what is the exact
relation between the CopyNo and key index of G4THitsMap?
     Thanks a lot!

long

G4int RE02PSEnergyDeposit::GetIndex(G4Step* aStep)
{
  const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
  G4int ix = touchable->GetReplicaNumber(1);
  G4int iy = touchable->GetReplicaNumber(2);
  G4int iz = touchable->GetReplicaNumber(0);
  return iy*fNx*fNy+ix*fNz+iz;      //  ********key value************
}

void RE02Run::DumpAllScorer(){

  // - Number of HitsMap in this RUN.
  G4int n = GetNumberOfHitsMap();
  // - GetHitsMap and dump values.
  for ( G4int i = 0; i < n ; i++ ){
    G4THitsMap<G4double>* RunMap =GetHitsMap(i);
    if ( RunMap ) {
      G4cout << " PrimitiveScorer RUN " 
	     << RunMap->GetSDname() <<","<< RunMap->GetName() << G4endl;
      G4cout << " Number of entries " << RunMap->entries() << G4endl;
      std::map<G4int,G4double*>::iterator itr = RunMap->GetMap()->begin();
      for(; itr != RunMap->GetMap()->end(); itr++) {
	G4cout << "  copy no.: " << itr->first       //*******key value**********    
	       << "  Run Value : " << *(itr->second) 
	       << G4endl;
      }
    }
  }
}

None Re: question on how to use G4THitsMap  by Christopher Oakley <Christopher Oakley>,   14 Aug, 2008
Re: None question on how to use G4THitsMap (long)
Dear Geant4 Community-

I'm a bit new to Geant4 and C++ (to a lesser extent), and I was wondering if anyone could explain to me exactlty how the HitsMap creates a Hits Collection without a Hits Class? I have explored examples N07 and RE02, but I'm probably missing something. Any help would be greatly appreciated.

Thanks

None RE: question on how to use G4THitsMap  by Makoto Asai <Makoto Asai>,   05 Jun, 2007
Re: None question on how to use G4THitsMap (long)
Hi,

 Yes, we have identified this bug, and the coming release
by the end of this month has already been fixed. Meanwhile
please correct the line in GetIndex() method of each of four 
scorers provided in this example. The correct indexing 
scheme is 

  return iy*fNx*fNz+ix*fNz+iz;

We are sorry for this bug and inconvenience.

Makoto

 

> -----Original Message-----
> From: long [mailto:long@anl.gov] 
> Sent: Monday, June 04, 2007 1:33 PM
> To: publichypernews
> Subject: question on how to use G4THitsMap
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/151"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Dear geant4 experts,
>       I feel confused on how to use G4THitsMap. As mentioned 
> in manual Section 4.4.5, 
> each of the concrete primitive scorers generates a 
> G4THitsMap<G4double> that maps a
> G4double value to its key integer number. By default, the key 
> is taken as the copy 
> number of the G4LogicalVolume to which 
> G4MultiFunctionalDetector is assigned. In case
> the key must consider more than one copy number of a 
> different geometry hierarchy, 
> the user can derive his/her own primitive scorer from the 
> provided concrete class and
> implement the GetIndex(G4Step*) virtual method to return the 
> unique key.
>      So for example RE02, the key value set by GetIndex() 
> should be less than the total
> number of sensitive cells(fNx*fNy*fNz). But in another 
> function called DumpAllScorer(), 
> it is found that the key value ()of HitsMaps sometimes is 
> larger than the total number 
> of cells. I listed these two functions below. How to 
> understand this? what is the exact
> relation between the CopyNo and key index of G4THitsMap?
>      Thanks a lot!
> 
> long
> 
> G4int RE02PSEnergyDeposit::GetIndex(G4Step* aStep)
> {
>   const G4VTouchable* touchable = 
> aStep->GetPreStepPoint()->GetTouchable();
>   G4int ix = touchable->GetReplicaNumber(1);
>   G4int iy = touchable->GetReplicaNumber(2);
>   G4int iz = touchable->GetReplicaNumber(0);
>   return iy*fNx*fNy+ix*fNz+iz;      //  ********key value************
> }
> 
> void RE02Run::DumpAllScorer(){
> 
>   // - Number of HitsMap in this RUN.
>   G4int n = GetNumberOfHitsMap();
>   // - GetHitsMap and dump values.
>   for ( G4int i = 0; i < n ; i++ ){
>     G4THitsMap<G4double>* RunMap =GetHitsMap(i);
>     if ( RunMap ) {
>       G4cout << " PrimitiveScorer RUN " 
>              << RunMap->GetSDname() <<","<< RunMap->GetName() 
> << G4endl;
>       G4cout << " Number of entries " << RunMap->entries() << G4endl;
>       std::map<G4int,G4double*>::iterator itr = 
> RunMap->GetMap()->begin();
>       for(; itr != RunMap->GetMap()->end(); itr++) {
>         G4cout << "  copy no.: " << itr->first       
> //*******key value**********    
>                << "  Run Value : " << *(itr->second) 
>                << G4endl;
>       }
>     }
>   }
> }
> 
> 

None RE: question on how to use G4THitsMap  by long <long>,   05 Jun, 2007
Re: None RE: question on how to use G4THitsMap (Makoto Asai)

Makoto, thanks for your reply.  So that just means the key value has problem 
but the second value of the HitsMap is right. Is my understanding right? 
   Also I have a suggestion. It seems there is no assignment operator defined in G4THitsMap class. Maybe put a blank =operator 
function in private member's list is a good choice. 
   Thanks a lot!

long

Question parentID, StepNo  Keywords: parentID, StepNo
by Victor Golovko <vgolovko@comp.tamu.edu>,   15 May, 2007

Hi,

I found some bizarre behavior in Geant4. Namely, I am trying to get information about initial step number and initial parent ID of registered particle in novice example # 2, using “sensitive detector” approach. For that I modified next file: ExN02TrackerSD.cc. Modification is given below:

  newHit->SetPos      (aStep->GetPostStepPoint()->GetPosition());
  if ( (aStep->GetTrack()->GetParentID() == 0)&&
       (aStep->GetTrack()->GetCurrentStepNumber() == 1) )
  {
    G4cout << "====> ExN02TrackerSD: (0) parentID: "<< aStep->GetTrack()->GetParentID()
           << " StepNo: "  << aStep->GetTrack()->GetCurrentStepNumber()
           <<  G4endl;
    exit (-10);
  }
  trackerCollection->insert( newHit );

In principle, the executable for this example should be stopped right after first simulated particle, as it will be satisfy the case condition. In reality, the program just runs till the last simulated particle. I have tried to do the same modification in novice example # 4; however I have got the same results as for example # 2. How I have to modify code to get information that I would like to get?

I am using Scientific Linux 4 with gcc 4.5 and Geant4.8.3 version.

Regards, Victor Golovko. May 15, 2007

None Re: parentID, StepNo  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   15 May, 2007
Re: Question parentID, StepNo (Victor Golovko)
On Tue, 15 May 2007, Victor Golovko wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/149"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi,
> 
> I found some bizarre behavior in Geant4. Namely, I am trying to get
> information about initial step number and initial parent ID of
> registered particle in novice example # 2, using “sensitive detector”
> approach. For that I modified next file: ExN02TrackerSD.cc. Modification
> is given below:
> 
>   newHit->SetPos      (aStep->GetPostStepPoint()->GetPosition());
>   if ( (aStep->GetTrack()->GetParentID() == 0)&&
>        (aStep->GetTrack()->GetCurrentStepNumber() == 1) )
>   {
>     G4cout << "====> ExN02TrackerSD: (0) parentID: "<< aStep->GetTrack()->GetParentID()
>            << " StepNo: "  << aStep->GetTrack()->GetCurrentStepNumber()
>            <<  G4endl;
>     exit (-10);
>   }
>   trackerCollection->insert( newHit );
> 
> In principle, the executable for this example should be stopped right
> after first simulated particle, as it will be satisfy the case
> condition. In reality, the program just runs till the last simulated
> particle. I have tried to do the same modification in novice example #
> 4; however I have got the same results as for example # 2. How I have to
> modify code to get information that I would like to get?
> 
> I am using Scientific Linux 4 with gcc 4.5 and Geant4.8.3 version.
> 
> Regards, Victor Golovko. May 15, 2007
> 

Hello,

When particle enter a sensitive detector it may not be a first step or 
even it has inelastic interaction before and only secondary particles 
arrive there. Try to use TrackingAction for histories. Try also

/tracking/verbose 1

to be familiar with simulation history in your application.

VI
Question two different Sensitive detectors and assign them to the same Logical Volume  Keywords: Sensitive detectors
by Victor Golovko <vgolovko@comp.tamu.edu>,   15 May, 2007

Hi,

Is it possible to specify two different Sensitive detectors and assign them to the same Logical Volume? I would like to do something like this:

  //------------------------------------------------
  // Sensitive detectors
  //------------------------------------------------      
  G4SDManager* SDman = G4SDManager::GetSDMpointer();

  G4String scintDetSDname  = "tamu/ScintSD";
  G4String scintDetSDname1 = "tamu/ScintSD1";
  tamuScintSD* aScintSD    = new tamuScintSD ( scintDetSDname  );
  tamuScintSD1* aScintSD1  = new tamuScintSD1( scintDetSDname1 );
  SDman->AddNewDetector( aScintSD  );
  SDman->AddNewDetector( aScintSD1 );
  dE_Detector_log->SetSensitiveDetector( aScintSD  );
  dE_Detector_log->SetSensitiveDetector( aScintSD1 );

Regards, Victor Golovko. May 15, 2007

None Re: two different Sensitive detectors and assign them to the same Logical Volume  Keywords: Sensitive detectors
by Makoto Asai <Makoto Asai>,   22 May, 2007
Re: Question two different Sensitive detectors and assign them to the same Logical Volume (Victor Golovko)
G4LogicalVolume may take only one sensitive detector.
You may implement a detector that invokes two of your
detectors sequentially.
Question No hits in daughter volumes  Keywords: hits mother daughtor volumes
by Rick Foster <rickf@space.mit.edu>,   06 Mar, 2007

When I make a simple structure (Aluminum tube with some volumes set as sensitive detectors inside), I have no problem registering hits in the SDs when the tube and detectors have the world as their parent.

However, When I make the sensitive detector volumes to be daughters of the aluminum tube (The tube's parent remains the word volume), I do not seem to be registering hits.

So I am wondering if there is a step I am missing when I made the sensitive detector volume a daughter of the tube?

Thanks

Rick

PS: I have triple checked that none of the volumes are overlapping. Everything looks fine when I visualize the geometry, it is just the particles go thru without even appearantly interacting with the SDs.

None RE: No hits in daughter volumes  by Makoto Asai <Makoto Asai>,   06 Mar, 2007
Re: Question No hits in daughter volumes (Rick Foster)
Could you post your detector construction class and sensitive detector class?
It is not easy to detect your problem without source.

Makoto 

> -----Original Message-----
> From: Rick Foster [mailto:rickf@space.mit.edu] 
> Sent: Tuesday, March 06, 2007 1:44 PM
> To: publichypernews
> Subject: No hits in daughter volumes
> 
> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/145"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> When I make a simple structure (Aluminum tube with some volumes set as
> sensitive detectors inside), I have no problem registering hits in the
> SDs when the tube and detectors have the world as their parent.
> 
> However, When I make the sensitive detector volumes to be daughters of
> the aluminum tube (The tube's parent remains the word 
> volume), I do not
> seem to be registering hits.
> 
> So I am wondering if there is a step I am missing when I made the
> sensitive detector volume a daughter of the tube?
> 
> Thanks
> 
> Rick
> 
> PS: I have triple checked that none of the volumes are 
> overlapping. Everything looks fine when I visualize the 
> geometry, it is just the particles go thru without even 
> appearantly interacting with the SDs.
> 
> 

Feedback RE: No hits in daughter volumes  by Rick Foster <rickf@space.mit.edu>,   06 Mar, 2007
Re: None RE: No hits in daughter volumes (Makoto Asai)
I added two files, the version that works and the one that does not.
In the one that does not I simply changed the mother volume from the world
to the Telescope.

Thanks
Rick



The code that works:
********************

//-----------------------------------------------------------------------
// File Name:	CraterDetectorConstruction.cc
// Purpose:	Defines the physical makeup of the a simplified telescope
// Author:	Rick Foster, MIT
//
// Rev 0.1	Initial revision
//-----------------------------------------------------------------------


#include "CraterDetectorConstruction.hh"
#include "CraterDetectorMessenger.hh"
#include "CraterTrackerSD.hh"

#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"

#include "globals.hh"
#include "G4NistManager.hh"
#include "G4Isotope.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
 
CraterDetectorConstruction::CraterDetectorConstruction()
:solidWorld(0),  logicWorld(0),  physiWorld(0),
 solidTelescope(0),logicTelescope(0),physiTelescope(0),
 solidTep1(0), logicTep1(0), physiTep1(0), 
 solidTep2(0), logicTep2(0), physiTep2(0), 
 solidD1(0), logicD1(0), physiD1(0), 
 solidD2(0), logicD2(0), physiD2(0), 
 solidD3(0), logicD3(0), physiD3(0), 
 solidD4(0), logicD4(0), physiD4(0), 
 solidD5(0), logicD5(0), physiD5(0), 
 solidD6(0), logicD6(0), physiD6(0), 
 solidS1(0), logicS1(0), physiS1(0), 
 solidS2(0), logicS2(0), physiS2(0), 
 solidSource(0), logicSource(0), physiSource(0),
 fWorldLength(0.),  fTargetLength(0.), fTrackerLength(0.)
{
  detectorMessenger = new CraterDetectorMessenger(this);
}

 
CraterDetectorConstruction::~CraterDetectorConstruction()
{
  delete detectorMessenger;             
}

 
G4VPhysicalVolume* CraterDetectorConstruction::Construct()
{
//--------- Material definition ---------

  G4NistManager* man = G4NistManager::Instance();
  man->SetVerbose(0);

  // define pure NIST materials
  G4Material* Al = man->FindOrBuildMaterial("G4_Al");

  // define pure NIST materials
  G4Material* Si = man->FindOrBuildMaterial("G4_Si");

  // define NIST materials
  G4Material* TEP  = man->FindOrBuildMaterial("G4_A-150_TISSUE");
  // HEP materials
  G4Material* vac    = man->FindOrBuildMaterial("G4_Galactic");

  // Print all the materials defined.
  //G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
  //G4cout << *(G4Material::GetMaterialTable()) << G4endl;
      
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
  
//------------------------------ 
// World
//------------------------------ 
 
  G4double HalfWorldLength = 0.5*20.0*cm;
  G4double HalfWorldHeight = 0.5*20.0*cm;
  G4double HalfWorldDepth = 0.5*20.0*cm;
  
  solidWorld= new G4Box("world",HalfWorldLength,HalfWorldHeight,HalfWorldDepth);
  logicWorld= new G4LogicalVolume( solidWorld,vac, "World", 0, 0, 0);
 
  //  Must place the World Physical volume unrotated at (0,0,0). 
  physiWorld = new G4PVPlacement(0,               // no rotation
                                 G4ThreeVector(), // at (0,0,0)
                                 logicWorld,      // its logical volume
				 "World",         // its name
                                 0,               // its mother  volume
                                 false,           // no boolean operations
                                 0);              // copy number

 

  //------------------------------ 
  // Telescope Shell
  //------------------------------
 
  G4ThreeVector positionTelescope = G4ThreeVector(0,0,0);

  solidTelescope = new G4Tubs("telescope",	//Name
				1.8476*cm,	//Inside radius
                                2.0*cm,		//Outside radius
				5.8262*cm,	//Height
                                0.0*deg,	//Start Angle
				360.0*deg);	//Spanning Angle
  
  logicTelescope = new G4LogicalVolume(solidTelescope,Al,"telescope",0,0,0);

  physiTelescope = new G4PVPlacement(0,			// no rotation
             			positionTelescope,	// at (x,y,z)
             			logicTelescope,		// its logical volume
				"telescope",		// its name
				logicWorld,		// its mother volume
				false,			// no boolean operations
				0);			// copy number
  
  //------------------------------ 
  // TEP1
  //------------------------------

  G4ThreeVector positionTep1 = G4ThreeVector(0,0,-1.9*cm);

  solidTep1 = new G4Tubs("tep1",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			27.0*mm,	//Height Note the is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicTep1 = new G4LogicalVolume(solidTep1,TEP,"TEP1",0,0,0);

  physiTep1 = new G4PVPlacement(0,		// no rotation
             			positionTep1,	// at (x,y,z)
             			logicTep1,	// its logical volume
				"TEP1",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // TEP2
  //------------------------------

  G4ThreeVector positionTep2 = G4ThreeVector(0,0,3.15*cm);

  solidTep2 = new G4Tubs("tep2",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			13.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicTep2 = new G4LogicalVolume(solidTep2,TEP,"TEP2",0,0,0);

  physiTep2 = new G4PVPlacement(0,		// no rotation
             			positionTep2,	// at (x,y,z)
             			logicTep2,	// its logical volume
				"TEP2",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector6
  //------------------------------

  G4ThreeVector positionD6 = G4ThreeVector(0,0,4.95*cm);

  solidD6 = new G4Tubs("detector6",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD6 = new G4LogicalVolume(solidD6,Si,"D6",0,0,0);

  physiD6 = new G4PVPlacement(0,		// no rotation
             			positionD6,	// at (x,y,z)
             			logicD6,	// its logical volume
				"D6",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector5
  //------------------------------

  G4ThreeVector positionD5 = G4ThreeVector(0,0,4.75*cm);

  solidD5 = new G4Tubs("detector5",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD5 = new G4LogicalVolume(solidD5,Si,"D5",0,0,0);

  physiD5 = new G4PVPlacement(0,		// no rotation
             			positionD5,	// at (x,y,z)
             			logicD5,	// its logical volume
				"D5",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector4
  //------------------------------

  G4ThreeVector positionD4 = G4ThreeVector(0,0,1.45*cm);

  solidD4 = new G4Tubs("detector4",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD4 = new G4LogicalVolume(solidD4,Si,"D4",0,0,0);

  physiD4 = new G4PVPlacement(0,		// no rotation
             			positionD4,	// at (x,y,z)
             			logicD4,	// its logical volume
				"D4",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector3
  //------------------------------

  G4ThreeVector positionD3 = G4ThreeVector(0,0,1.25*cm);

  solidD3 = new G4Tubs("detector3",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD3 = new G4LogicalVolume(solidD3,Si,"D3",0,0,0);

  physiD3 = new G4PVPlacement(0,		// no rotation
             			positionD3,	// at (x,y,z)
             			logicD3,	// its logical volume
				"D3",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector2
  //------------------------------

  G4ThreeVector positionD2 = G4ThreeVector(0,0,-4.85*cm);

  solidD2 = new G4Tubs("detector2",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD2 = new G4LogicalVolume(solidD2,Si,"D2",0,0,0);

  physiD2 = new G4PVPlacement(0,		// no rotation
             			positionD2,	// at (x,y,z)
             			logicD2,	// its logical volume
				"D2",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector1
  //------------------------------

  G4ThreeVector positionD1 = G4ThreeVector(0,0,-5.05*cm);

  solidD1 = new G4Tubs("detector1",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD1 = new G4LogicalVolume(solidD1,Si,"D1",0,0,0);

  physiD1 = new G4PVPlacement(0,		// no rotation
             			positionD1,	// at (x,y,z)
             			logicD1,	// its logical volume
				"D1",		// its name
				logicWorld,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Shield1
  //------------------------------

  G4ThreeVector positionS1 = G4ThreeVector(0,0,-5.75*cm);

  solidS1 = new G4Tubs("shield1",		//Name
			0.0*cm,		//Inside radius
			1.8476*cm,		//Outside radius
			0.762*mm,		//Height note this is 1/2 total height
			0.0*deg,		//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicS1 = new G4LogicalVolume(solidS1,Al,"S1",0,0,0);

  physiS1 = new G4PVPlacement(0,		// no rotation
             		positionS1,	// at (x,y,z)
             		logicS1,		// its logical volume
			"S1",		// its name
			logicWorld,	// its mother volume
			false,		// no boolean operations
			0);		// copy number

  //------------------------------ 
  // Shield2
  //------------------------------

  G4ThreeVector positionS2 = G4ThreeVector(0,0,5.75*cm);

  solidS2 = new G4Tubs("shield2",	//Name
			0.0*cm,		//Inside radius
			1.8476*cm,	//Outside radius
			0.762*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicS2 = new G4LogicalVolume(solidS2,Al,"S2",0,0,0);

  physiS2 = new G4PVPlacement(0,	// no rotation
             		positionS2,	// at (x,y,z)
             		logicS2,	// its logical volume
			"S2",		// its name
			logicWorld,	// its mother volume
			false,		// no boolean operations
			0);		// copy number


//------------------------------------------------ 
// Sensitive detectors
//------------------------------------------------ 
    G4SDManager* SDman = G4SDManager::GetSDMpointer();

    G4String SDname;

    CraterTracker1SD* detec1= new CraterTracker1SD(SDname="detector1");
    SDman->AddNewDetector(detec1);
    logicD1->SetSensitiveDetector(detec1);

    CraterTracker2SD* detec2= new CraterTracker2SD(SDname="detector2");
    SDman->AddNewDetector(detec2);
    logicD2->SetSensitiveDetector(detec2);

    CraterTracker3SD* detec3= new CraterTracker3SD(SDname="detector3");
    SDman->AddNewDetector(detec3);
    logicD3->SetSensitiveDetector(detec3);

    CraterTracker4SD* detec4= new CraterTracker4SD(SDname="detector4");
    SDman->AddNewDetector(detec4);
    logicD4->SetSensitiveDetector(detec4);

    CraterTracker5SD* detec5= new CraterTracker5SD(SDname="detector5");
    SDman->AddNewDetector(detec5);
    logicD5->SetSensitiveDetector(detec5);

    CraterTracker6SD* detec6= new CraterTracker6SD(SDname="detector6");
    SDman->AddNewDetector(detec6);
    logicD6->SetSensitiveDetector(detec6);

//--------- Visualization attributes -------------------------------

  G4VisAttributes* TelVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.1));
  TelVisAtt->SetForceSolid(true);
  logicTelescope->SetVisAttributes(TelVisAtt);
  TelVisAtt->SetVisibility(false);
  
  G4VisAttributes* TEPVisAtt= new G4VisAttributes(G4Colour(0.4,0.4,0.4,0.6));
  TEPVisAtt->SetForceSolid(true);
  logicTep1 ->SetVisAttributes(TEPVisAtt);
  logicTep2 ->SetVisAttributes(TEPVisAtt);

  G4VisAttributes* DetThinVisAtt= new G4VisAttributes(G4Colour(1,1,0));
  DetThinVisAtt->SetForceSolid(true);
  logicD1 ->SetVisAttributes(DetThinVisAtt);
  logicD3 ->SetVisAttributes(DetThinVisAtt);
  logicD5 ->SetVisAttributes(DetThinVisAtt);

  G4VisAttributes* DetThickVisAtt= new G4VisAttributes(G4Colour(0,0,1));
  DetThickVisAtt->SetForceSolid(true);
  logicD2 ->SetVisAttributes(DetThickVisAtt);
  logicD4 ->SetVisAttributes(DetThickVisAtt);
  logicD6 ->SetVisAttributes(DetThickVisAtt);

  G4VisAttributes* ShieldVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.3));
  ShieldVisAtt->SetForceSolid(true);
  logicS1 ->SetVisAttributes(ShieldVisAtt);
  logicS2 ->SetVisAttributes(ShieldVisAtt);

  G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(.9,.9,.9,0.01));
  logicWorld->SetVisAttributes(WorldVisAtt);
  WorldVisAtt->SetVisibility(false);

return physiWorld;
}

The Code that Does not Work
(Particles pass right thru)
***************************



//-----------------------------------------------------------------------
// File Name:	CraterDetectorConstruction.cc
// Purpose:	Defines the physical makeup of the a simplified telescope
// Author:	Rick Foster, MIT
//
// Rev 0.1	Initial revision
//-----------------------------------------------------------------------


#include "CraterDetectorConstruction.hh"
#include "CraterDetectorMessenger.hh"
#include "CraterTrackerSD.hh"

#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVParameterised.hh"
#include "G4SDManager.hh"

#include "globals.hh"
#include "G4NistManager.hh"
#include "G4Isotope.hh"
#include "G4Element.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4UserLimits.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
 
CraterDetectorConstruction::CraterDetectorConstruction()
:solidWorld(0),  logicWorld(0),  physiWorld(0),
 solidTelescope(0),logicTelescope(0),physiTelescope(0),
 solidTep1(0), logicTep1(0), physiTep1(0), 
 solidTep2(0), logicTep2(0), physiTep2(0), 
 solidD1(0), logicD1(0), physiD1(0), 
 solidD2(0), logicD2(0), physiD2(0), 
 solidD3(0), logicD3(0), physiD3(0), 
 solidD4(0), logicD4(0), physiD4(0), 
 solidD5(0), logicD5(0), physiD5(0), 
 solidD6(0), logicD6(0), physiD6(0), 
 solidS1(0), logicS1(0), physiS1(0), 
 solidS2(0), logicS2(0), physiS2(0), 
 solidSource(0), logicSource(0), physiSource(0),
 fWorldLength(0.),  fTargetLength(0.), fTrackerLength(0.)
{
  detectorMessenger = new CraterDetectorMessenger(this);
}

 
CraterDetectorConstruction::~CraterDetectorConstruction()
{
  delete detectorMessenger;             
}

 
G4VPhysicalVolume* CraterDetectorConstruction::Construct()
{
//--------- Material definition ---------

  G4NistManager* man = G4NistManager::Instance();
  man->SetVerbose(0);

  // define pure NIST materials
  G4Material* Al = man->FindOrBuildMaterial("G4_Al");

  // define pure NIST materials
  G4Material* Si = man->FindOrBuildMaterial("G4_Si");

  // define NIST materials
  G4Material* TEP  = man->FindOrBuildMaterial("G4_A-150_TISSUE");
  // HEP materials
  G4Material* vac    = man->FindOrBuildMaterial("G4_Galactic");

  // Print all the materials defined.
  //G4cout << G4endl << "The materials defined are : " << G4endl << G4endl;
  //G4cout << *(G4Material::GetMaterialTable()) << G4endl;
      
//--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
  
//------------------------------ 
// World
//------------------------------ 
 
  G4double HalfWorldLength = 0.5*20.0*cm;
  G4double HalfWorldHeight = 0.5*20.0*cm;
  G4double HalfWorldDepth = 0.5*20.0*cm;
  
  solidWorld= new G4Box("world",HalfWorldLength,HalfWorldHeight,HalfWorldDepth);
  logicWorld= new G4LogicalVolume( solidWorld,vac, "World", 0, 0, 0);
 
  //  Must place the World Physical volume unrotated at (0,0,0). 
  physiWorld = new G4PVPlacement(0,               // no rotation
                                 G4ThreeVector(), // at (0,0,0)
                                 logicWorld,      // its logical volume
				 "World",         // its name
                                 0,               // its mother  volume
                                 false,           // no boolean operations
                                 0);              // copy number

 

  //------------------------------ 
  // Telescope Shell
  //------------------------------
 
  G4ThreeVector positionTelescope = G4ThreeVector(0,0,0);

  solidTelescope = new G4Tubs("telescope",	//Name
				1.8476*cm,	//Inside radius
                                2.0*cm,		//Outside radius
				5.8262*cm,	//Height
                                0.0*deg,	//Start Angle
				360.0*deg);	//Spanning Angle
  
  logicTelescope = new G4LogicalVolume(solidTelescope,Al,"telescope",0,0,0);

  physiTelescope = new G4PVPlacement(0,			// no rotation
             			positionTelescope,	// at (x,y,z)
             			logicTelescope,		// its logical volume
				"telescope",		// its name
				logicWorld,		// its mother volume
				false,			// no boolean operations
				0);			// copy number
  
  //------------------------------ 
  // TEP1
  //------------------------------

  G4ThreeVector positionTep1 = G4ThreeVector(0,0,-1.9*cm);

  solidTep1 = new G4Tubs("tep1",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			27.0*mm,	//Height Note the is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicTep1 = new G4LogicalVolume(solidTep1,TEP,"TEP1",0,0,0);

  physiTep1 = new G4PVPlacement(0,		// no rotation
             			positionTep1,	// at (x,y,z)
             			logicTep1,	// its logical volume
				"TEP1",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // TEP2
  //------------------------------

  G4ThreeVector positionTep2 = G4ThreeVector(0,0,3.15*cm);

  solidTep2 = new G4Tubs("tep2",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			13.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicTep2 = new G4LogicalVolume(solidTep2,TEP,"TEP2",0,0,0);

  physiTep2 = new G4PVPlacement(0,		// no rotation
             			positionTep2,	// at (x,y,z)
             			logicTep2,	// its logical volume
				"TEP2",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector6
  //------------------------------

  G4ThreeVector positionD6 = G4ThreeVector(0,0,4.95*cm);

  solidD6 = new G4Tubs("detector6",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD6 = new G4LogicalVolume(solidD6,Si,"D6",0,0,0);

  physiD6 = new G4PVPlacement(0,		// no rotation
             			positionD6,	// at (x,y,z)
             			logicD6,	// its logical volume
				"D6",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector5
  //------------------------------

  G4ThreeVector positionD5 = G4ThreeVector(0,0,4.75*cm);

  solidD5 = new G4Tubs("detector5",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD5 = new G4LogicalVolume(solidD5,Si,"D5",0,0,0);

  physiD5 = new G4PVPlacement(0,		// no rotation
             			positionD5,	// at (x,y,z)
             			logicD5,	// its logical volume
				"D5",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector4
  //------------------------------

  G4ThreeVector positionD4 = G4ThreeVector(0,0,1.45*cm);

  solidD4 = new G4Tubs("detector4",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD4 = new G4LogicalVolume(solidD4,Si,"D4",0,0,0);

  physiD4 = new G4PVPlacement(0,		// no rotation
             			positionD4,	// at (x,y,z)
             			logicD4,	// its logical volume
				"D4",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector3
  //------------------------------

  G4ThreeVector positionD3 = G4ThreeVector(0,0,1.25*cm);

  solidD3 = new G4Tubs("detector3",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD3 = new G4LogicalVolume(solidD3,Si,"D3",0,0,0);

  physiD3 = new G4PVPlacement(0,		// no rotation
             			positionD3,	// at (x,y,z)
             			logicD3,	// its logical volume
				"D3",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Detector2
  //------------------------------

  G4ThreeVector positionD2 = G4ThreeVector(0,0,-4.85*cm);

  solidD2 = new G4Tubs("detector2",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.5*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD2 = new G4LogicalVolume(solidD2,Si,"D2",0,0,0);

  physiD2 = new G4PVPlacement(0,		// no rotation
             			positionD2,	// at (x,y,z)
             			logicD2,	// its logical volume
				"D2",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number
  //------------------------------ 
  // Detector1
  //------------------------------

  G4ThreeVector positionD1 = G4ThreeVector(0,0,-5.05*cm);

  solidD1 = new G4Tubs("detector1",	//Name
			0.0*cm,		//Inside radius
			1.75*cm,	//Outside radius
			0.07*mm,	        //Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicD1 = new G4LogicalVolume(solidD1,Si,"D1",0,0,0);

  physiD1 = new G4PVPlacement(0,		// no rotation
             			positionD1,	// at (x,y,z)
             			logicD1,	// its logical volume
				"D1",		// its name
				logicTelescope,	// its mother volume
				false,		// no boolean operations
				0);		// copy number

  //------------------------------ 
  // Shield1
  //------------------------------

  G4ThreeVector positionS1 = G4ThreeVector(0,0,-5.75*cm);

  solidS1 = new G4Tubs("shield1",		//Name
			0.0*cm,		//Inside radius
			1.8476*cm,		//Outside radius
			0.762*mm,		//Height note this is 1/2 total height
			0.0*deg,		//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicS1 = new G4LogicalVolume(solidS1,Al,"S1",0,0,0);

  physiS1 = new G4PVPlacement(0,		// no rotation
             		positionS1,	// at (x,y,z)
             		logicS1,		// its logical volume
			"S1",		// its name
			logicTelescope,	// its mother volume
			false,		// no boolean operations
			0);		// copy number

  //------------------------------ 
  // Shield2
  //------------------------------

  G4ThreeVector positionS2 = G4ThreeVector(0,0,5.75*cm);

  solidS2 = new G4Tubs("shield2",	//Name
			0.0*cm,		//Inside radius
			1.8476*cm,	//Outside radius
			0.762*mm,	//Height note this is 1/2 total height
			0.0*deg,	//Start Angle
			360.0*deg);	//Spanning Angle
  
  logicS2 = new G4LogicalVolume(solidS2,Al,"S2",0,0,0);

  physiS2 = new G4PVPlacement(0,	// no rotation
             		positionS2,	// at (x,y,z)
             		logicS2,	// its logical volume
			"S2",		// its name
			logicTelescope,	// its mother volume
			false,		// no boolean operations
			0);		// copy number


//------------------------------------------------ 
// Sensitive detectors
//------------------------------------------------ 
    G4SDManager* SDman = G4SDManager::GetSDMpointer();

    G4String SDname;

    CraterTracker1SD* detec1= new CraterTracker1SD(SDname="detector1");
    SDman->AddNewDetector(detec1);
    logicD1->SetSensitiveDetector(detec1);

    CraterTracker2SD* detec2= new CraterTracker2SD(SDname="detector2");
    SDman->AddNewDetector(detec2);
    logicD2->SetSensitiveDetector(detec2);

    CraterTracker3SD* detec3= new CraterTracker3SD(SDname="detector3");
    SDman->AddNewDetector(detec3);
    logicD3->SetSensitiveDetector(detec3);

    CraterTracker4SD* detec4= new CraterTracker4SD(SDname="detector4");
    SDman->AddNewDetector(detec4);
    logicD4->SetSensitiveDetector(detec4);

    CraterTracker5SD* detec5= new CraterTracker5SD(SDname="detector5");
    SDman->AddNewDetector(detec5);
    logicD5->SetSensitiveDetector(detec5);

    CraterTracker6SD* detec6= new CraterTracker6SD(SDname="detector6");
    SDman->AddNewDetector(detec6);
    logicD6->SetSensitiveDetector(detec6);

//--------- Visualization attributes -------------------------------

  G4VisAttributes* TelVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.1));
  TelVisAtt->SetForceSolid(true);
  logicTelescope->SetVisAttributes(TelVisAtt);
  TelVisAtt->SetVisibility(false);
  
  G4VisAttributes* TEPVisAtt= new G4VisAttributes(G4Colour(0.4,0.4,0.4,0.6));
  TEPVisAtt->SetForceSolid(true);
  logicTep1 ->SetVisAttributes(TEPVisAtt);
  logicTep2 ->SetVisAttributes(TEPVisAtt);

  G4VisAttributes* DetThinVisAtt= new G4VisAttributes(G4Colour(1,1,0));
  DetThinVisAtt->SetForceSolid(true);
  logicD1 ->SetVisAttributes(DetThinVisAtt);
  logicD3 ->SetVisAttributes(DetThinVisAtt);
  logicD5 ->SetVisAttributes(DetThinVisAtt);

  G4VisAttributes* DetThickVisAtt= new G4VisAttributes(G4Colour(0,0,1));
  DetThickVisAtt->SetForceSolid(true);
  logicD2 ->SetVisAttributes(DetThickVisAtt);
  logicD4 ->SetVisAttributes(DetThickVisAtt);
  logicD6 ->SetVisAttributes(DetThickVisAtt);

  G4VisAttributes* ShieldVisAtt= new G4VisAttributes(G4Colour(0.0,0.4,0.0,0.3));
  ShieldVisAtt->SetForceSolid(true);
  logicS1 ->SetVisAttributes(ShieldVisAtt);
  logicS2 ->SetVisAttributes(ShieldVisAtt);

  G4VisAttributes* WorldVisAtt = new G4VisAttributes(G4Colour(.9,.9,.9,0.01));
  logicWorld->SetVisAttributes(WorldVisAtt);
  WorldVisAtt->SetVisibility(false);

return physiWorld;
}

None Re: RE: No hits in daughter volumes  by Jacques Goldberg <Jacques Goldberg>,   Sep 20, 12:57
Re: Feedback RE: No hits in daughter volumes (Rick Foster)
On Tue, 06 Mar 2007 22:30:21 GMT, Rick Foster wrote:
> I added two files, the version that works and the one that does not.
> In the one that does not I simply changed the mother volume from the world
> to the Telescope.
> 
> Thanks
> Rick
> 
> The code that works:
> ********************

 .... skipped   ...
Having a similar problem I found this thread unachieved.
So, even so late, for the sake of the next one who may encouter it:

The two listings do not explicitly numerically define the physical placement of the intermediary volume (telescope) used as a mother volume in the second case. At the same time they both show the third level volumes (detectors) at well defined coordinates. These are defined with respect with the mother volume. Thus the location of the detectors with respect to World are not the same in both cases, unless the intermediate volumes (telescope) are always at (0,0,0).

This **may** be the answer - if my guess that the telescope may be elsewhere than at 0,0,0 in World, is correct.

Jacques

Question No hits on shield  Keywords: hits shielding energy loss
by Kazutaka Nakahara <nakahara@post.kek.jp>,   22 Feb, 2007

Hi,

I'm having some problems with registering hits for 4.26MeV positive muons incident on ~1.3 meters of lead. In principle, it should stop near the surface, but the muons pass right through.

To debug, I've set the stepsize to 1mm, and put statements in UserSteppingAction() to get the stepsize, Energy deposit, position, etc for each step. A sample below:

----------------------------- Stepsize = 1 mm Edep = 0 eV Position = 157.369 -251.233 497.341 Momentum = 8.51397 -13.0988 25.967 K.E = 4.26 MeV ----------------------------- At every step throughout the track, the energy deposit is 0. The physic processes I've included are (in my PhysicsList.cc)

-------------------------------
 } else if( particleName == "mu+" || 
               particleName == "mu-"    ) {
	   G4cout << "Constructing Mu+ and Mu- processes" << G4endl;
      //muon  
      pmanager->AddProcess(new G4MultipleScattering);
      pmanager->AddProcess(new G4MuIonisation);
      pmanager->AddDiscreteProcess(new G4MuBremsstrahlung);
      pmanager->AddDiscreteProcess(new G4MuPairProduction);        
      pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
      pmanager->AddProcess(StepLimiter);
----------------------------------------

The  definition of the lead shielding is as follows:
-------------------------------------
    G4RotationMatrix rmlead;
    rmlead.rotateY(0.);
	G4ThreeVector positionshield1 = G4ThreeVector(0,0,184.8*cm);
	solidLeadShield1 = new G4Tubs("lead_shield1", 32*cm,100*cm,133.5*cm,0,2*3.1415);
	logicLeadShield1 = new G4LogicalVolume(solidLeadShield1,LeadShieldMater
			,"lead_shield1",0,0,0);
	physiLeadShield1 = new G4PVPlacement(0,positionshield1,
							logicLeadShield1,
							"lead_shield1",
							logicWorld,
							0,
							false,
							0);	
---------------------------------------

I've based everything on the N02 example, but I'm pretty sure I'm missing something VERY basic. Any help would be appreciated.

Thanks in advance, Kaz

None Re: No hits on shield  Keywords: hits shielding energy loss
by michel maire <michel maire>,   22 Feb, 2007
Re: Question No hits on shield (Kazutaka Nakahara)

 I ran examples/extended/electromagnetic/TestEm1 with the following macro :

 #
 # Macro file for "TestEm1.cc"
 #
 /control/verbose 2
 /run/verbose 2
 #
 /testem/det/setMat Lead
 /testem/det/setSize 1.3 m
 #
 /run/initialize
 #
 /testem/gun/setDefault
 /gun/particle mu+
 /gun/energy 4.26 MeV
 #
 /process/inactivate Decay
 #
 /tracking/verbose 1
 #
 /run/beamOn 1

 The output is :

 ---> Begin of Event: 0

 *********************************************************************************************************
 * G4Track Information:   Particle = mu+,   Track ID = 1,   Parent ID = 0
 *********************************************************************************************************

 Step#      X         Y         Z        KineE    dEStep   StepLeng  TrakLeng    Volume     Process
    0    -65 cm      0 fm      0 fm   4.26 MeV     0 eV      0 fm      0 fm         Lead    initStep
    1    -65 cm  -10.5 um  -11.3 um   3.41 MeV   846 keV  96.6 um   96.6 um         Lead         msc
    2    -65 cm   17.1 um  -83.7 um   2.33 MeV  1.08 MeV  96.6 um    193 um         Lead         msc
    3    -65 cm   25.2 um   -152 um      0 eV   2.33 MeV   115 um    308 um         Lead      muIoni
    4    -65 cm   25.2 um   -152 um      0 eV      0 eV      0 fm    308 um         Lead      muIoni

 Run terminated.
 Run Summary
  Number of events processed : 1
  User=0s Real=0.18s Sys=0s

 ======================== run summary ======================

 The run was: 1 mu+ of 4.26 MeV through 1.3 m   of Lead (density: 11.35 g/cm3 )

 ============================================================

 total energy deposit: 4.26 MeV

 nb tracks/event   neutral:          0   charged:          1
 nb  steps/event   neutral:          0   charged:          4

 nb of process calls per event: 
            msc      muIoni
              2           2

 ---------------------------------------------------------
 Primary particle : 
 true Range = 308.3 um    rms = 0 fm 
 proj Range = 224.11 um    rms = 1395.8 fm 
 proj/true  = 0.72693
 transverse dispersion at end = 88.578 um 
      mass true Range from simulation = 349.92 mg/cm2
       from PhysicsTable (csda range) = 358.95 mg/cm2
 --------------------------------------------------------

None Re: No hits on shield  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   22 Feb, 2007
Re: Question No hits on shield (Kazutaka Nakahara)
On Thu, 22 Feb 2007, Kazutaka Nakahara wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/143"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi,
> 
> I'm having some problems with registering hits for 4.26MeV positive
> muons incident on ~1.3 meters of lead. In principle, it should stop near
> the surface, but the muons pass right through.
> 
> To debug, I've set the stepsize to 1mm, and put statements in
> UserSteppingAction() to get the stepsize, Energy deposit, position, etc
> for each step. A sample below:
> 
> ----------------------------- Stepsize = 1 mm Edep = 0 eV Position =
> 157.369 -251.233 497.341 Momentum = 8.51397 -13.0988 25.967 K.E = 4.26
> MeV ----------------------------- At every step throughout the track,
> the energy deposit is 0. The physic processes I've included are (in my
> PhysicsList.cc)
> 
> -------------------------------
>  } else if( particleName == "mu+" || 
>                particleName == "mu-"    ) {
>            G4cout << "Constructing Mu+ and Mu- processes" << G4endl;
>       //muon  
>       pmanager->AddProcess(new G4MultipleScattering);
>       pmanager->AddProcess(new G4MuIonisation);
>       pmanager->AddDiscreteProcess(new G4MuBremsstrahlung);
>       pmanager->AddDiscreteProcess(new G4MuPairProduction);        
>       pmanager = G4MuonPlus::MuonPlus()->GetProcessManager();
>       pmanager->AddProcess(StepLimiter);
> ----------------------------------------
> 
> The  definition of the lead shielding is as follows:
> -------------------------------------
>     G4RotationMatrix rmlead;
>     rmlead.rotateY(0.);
>         G4ThreeVector positionshield1 = G4ThreeVector(0,0,184.8*cm);
>         solidLeadShield1 = new G4Tubs("lead_shield1", 32*cm,100*cm,133.5*cm,0,2*3.1415);
>         logicLeadShield1 = new G4LogicalVolume(solidLeadShield1,LeadShieldMater
>                         ,"lead_shield1",0,0,0);
>         physiLeadShield1 = new G4PVPlacement(0,positionshield1,
>                                                         logicLeadShield1,
>                                                         "lead_shield1",
>                                                         logicWorld,
>                                                         0,
>                                                         false,
>                                                         0);     
> ---------------------------------------
> 
> I've based everything on the N02 example, but I'm pretty sure I'm
> missing something VERY basic. Any help would be appreciated.
> 
> Thanks in advance, Kaz
> 

Hello,

Please, consult PhysicsLists in 
$G4INSTALL/source/physics_lists/builders/src/G4EmStandardPhysics.cc

or in $G4INSTALL/example/extended/electromagnetic/TestEm3 (any other 
example as well)

VI
None confused by hits, hit collections, and sensitive detectors  by Ken Teh <teh@anl.gov>,   29 Dec, 2006

I'm struggling with ExN02's treatment of sensitive detectors, hits, and hit collections. Each on their own is clear. The confusion arises from hit collections being a data member of SensitiveDetector sub-class. In this case, ExN02TrackerSD.

I want to process the hits at the end of each event to create "raw data" which are then written out to a file. It seems to me this is best done with UserEventAction sub-class. However, the UserEventAction sub-class needs to know the name of the collection in order to access it. This would suggest the hit collections be created outside of the SensitiveDetector sub-class so information about the collection object can be passed to the UserEventAction sub-class. It seems to me that it is sufficient to pass the collection object to the SensitiveDetector sub-class so it can register the collection object with HCofThisEvent and fill hits into it during the ProcessHits().

But, in the ExN02 example, the hits collection is allocated each time inside the SensitiveDetector's Initialize() method. Is this necessary? It seems to me that what's required per event is that the hits in the collection be deleted (by HCofThisEvent, I guess) and the number of entries in the collection reset to zero. The collection itself does not have to deleted.

If the collection must be allocated and deleted per event, then it makes perfect sense for the collection to be a data member of the sensitive detector. But, how does UserEventAction know about the collection? If 2 separate classes are to know about an object, then that object needs to be promoted outside of either these 2 classes.

My apologies if I sound like I'm splitting hairs. I'm sure it is because I don't quite understand the whole picture. If someone could explain this or assure me that all will be clear in time, I'd appreciate it.

Thanks! Ken

None Re: confused by hits, hit collections, and sensitive detectors  by Makoto Asai <Makoto Asai>,   30 Dec, 2006
Re: None confused by hits, hit collections, and sensitive detectors (Ken Teh)
More than one G4Event objects may co-exist simultaneously for the
sake of pile-up study. Thus, each G4Event object must have its own
hits collection vector.

As you know, each kind of sensitive detector detects its unique set
of quantities such as position, energy, etc. Thus each sensitive
detector has its unique hit class. On the other hand, an experimental
set-up may have identical detectors. For example in A01 example in
examples/extended/analysis, each of two lever arms has a set of
drift chambers. In this example, one drift chamber SD class is 
instantiated twice with different detector name. Thus, in 
EndOfEventAction one can identify each hits collection by the 
collection ID (associated with the unique detector name).

In EndOfEventAction, you can access to each individual hit of each
individual hits collection to record it, as demonstrated in exampleN02.
Alternatively, you can implement your own hits collection sub-class
so that it knows how to record his of its kind. Actually, this 
alternative way is better in the sense of object orientation. Your 
EndOfEventAction does not need names of the hits collections, but 
just loops over all hits collections stored in G4HCofThisEvent and 
invokes "Record()" virtual method.

class MyHitsCollectionBase : public G4THitsCollection
{
  public:
    virtual void Record() const = 0;
    ...
};

class MyConcreteHitsCollection : public MyHitsCollectionBase 
{
  public:
    virtual void Record() const;
    ...
};
Question count only decays ( time, position, etc )  Keywords: hits sensitive detector decay
by Peter Russo <plrusso@triumf.ca>,   12 Nov, 2006

Hello,

I am starting to get the hang of using sensitive detectors. However, up till now, I have been collecting hits of live particles. Now, I want to count the number of muon decays in a sensitive detector. Any suggestions on how to do this?

None Re: count only decays ( time, position, etc )  Keywords: hits sensitive detector decay
by Makoto Asai <Makoto Asai>,   30 Dec, 2006
Re: Question count only decays ( time, position, etc ) (Peter Russo)
In your sensitive detector, you can "detect" muon decay by
1) the track is muon, and
2) the step is limited by the decay process.
Then, you can record the decay point, and momenta of decay
products. (Note since version 8.2 G4Step has a vector of 
secondary particles)
None measure position, momentum and energy of a proton...  Keywords: proton scoring intermediary source
by Frédéric Guillaume <Frédéric Guillaume>,   14 Sep, 2006

Hello, I am a bit lost !!! I am actually creating protons and measuring their contribution in a sensitive detector (at about 12 meters away...) By definition my source is quite wide and only a few percent of the proton interacts with the sensitive detector...

So i came with the idea of using an "intermediary source" placed at about 9 meters from the initial one ... For that purpose i plan to measure the position, the momentum and the energy of each protons going through a sensitive volume (9 meters away from initial source) and to use these results to create the new source ...

I am confused with the kind of detector to chose and how to implement it...

For a better description of my problem, here is a "graphical explanation" of what i want to do:

 Initial Source ----------------------------------------------->> Water phantom  (only 1% of protons reach the target)

 Initial Source ------------------------------OO Sensitive detector

                         Intermediary Source  ----------------->> Water phantom (better stats : 20-40% protons reach target)

I hope i made it quite clear !!!

Regards, Frédéric.

Question Spike in Deposited Energy/Time at Boundary of Detector  Keywords: spike discontinuous boundary neutron detector
by Sean Lourette <slourette@lle.rochester.edu>,   16 Aug, 2006
Hello. I am using a General Particle Source to fire 14.1 MeV neutrons directly at a 4cm plastic detector through a vacuum. I’m having GEANT output the global time and energy deposit to a file and I am graphing dE(total)/dt. At the time at which the primaries reach the back of the detector there is a large spike in power. (In addition, at the front of the detector the line is not vertical.) When I spliced a 200cm long detector into 2cm volumes it gave me many of these spikes.

I’m running Geant4.8.1 and I’m using the LHEP library in place of the physicslist file as in example 4. Thanks in advance.

None Re: Spike in Deposited Energy/Time at Boundary of Detector  Keywords: spike discontinuous boundary neutron detector
by Sean Lourette <slourette@lle.rochester.edu>,   17 Aug, 2006
Re: Question Spike in Deposited Energy/Time at Boundary of Detector (Sean Lourette)

I just discovered that the Transportation process was occasionally depositing energy. When I sift out the energy that it deposits, it removes the final spike in the graph (the second of the two spikes at the back of the detector). How can I fix this problem?

None Re: Spike in Deposited Energy/Time at Boundary of Detector  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   30 Aug, 2006
Re: None Re: Spike in Deposited Energy/Time at Boundary of Detector (Sean Lourette)
On Thu, 17 Aug 2006, Sean Lourette wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/133/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> I just discovered that the Transportation process was occasionally
> depositing energy. When I sift out the energy that it deposits, it
> removes the final spike in the graph (the second of the two spikes at
> the back of the detector). How can I fix this problem?
> 

Transportation limiting the step, energy is deposited due to ionisation. 
Please, post your problem in em forum

VI

None Counting Number of Rkt Li6(n,t)alpha  Keywords: reaktion, secondaries
by Sylvia Studeny <sylvia.studeny@gsf.de>,   18 Jul, 2006

Hi, I want to calculate the Number of Neutron-Reaktions on Li6: Li6(n,t)alpha For this purpose I thought I can somehow get information about the secondary particles of an event. If they are t and alpha, I would count it as reaktion. My problem is now: how do I get this info about secondaries? I have looked into Step,Track,Steppoint,VProzess,SteppingVebose and many more, but all I could find was, that somehow, you have to get the G4VParticleChange -Objekt and with this you have access to the secondaries. Where can I get this from? I used G4PSNofSecondary as a basis and wanted to change it to a new primitive scorer.

G4bool RE02NofReaktions::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
  //- check for newly produced particle. e.g. first step.
  if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE;
  //- check for this is not a primary particle. e.g. ParentID > 0 .
  if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE;
  //
  G4Track* aTrack = aStep->GetTrack();
//the next line is out of the forum, but it was a different problem 
//and doesn't work here because pRegProcess is not known and I don't
//know where to get ist from.
  fParticleChange = dynamic_cast<G4ParticleChange*>(pRegProcess->PostStepDoIt(aTrack, aStep))

  //- This is a newly produced secondary particle.
  G4int  index = GetIndex(aStep);
 // fSecondary = fParticleChange->GetSecondary(index);
if(fParticleChange->GetNumberOfSecondaries() == 2){
   fSecondary[0] = fParticleChange->GetSecondary(0);
   fSecondary[1] = fParticleChange->GetSecondary(1);
   }
  G4cout << G4endl;
  if((fSecondary[0]->GetDefinition()->GetParticleName() == "alpha") &&
     (fSecondary[1]->GetDefinition()->GetParticleName() == "titon")){
     G4cout << "reaktion gefunden!" << G4endl;
     }
  G4cout << G4endl;

  //G4double weight = aStep->GetPreStepPoint()->GetWeight();
 // EvtMap->add(index,weight);  
  return TRUE;
}

Does somebody have an idea how I can do this? Thanks a lot Sylvia

None Re: Counting Number of Rkt Li6(n,t)alpha  Keywords: reaktion, secondaries
by Sylvia Studeny <sylvia.studeny@gsf.de>,   01 Aug, 2006
Re: None Counting Number of Rkt Li6(n,t)alpha (Sylvia Studeny)

Hi,

I finally solved the problem in another way (I found another listing to the topic: 35). I count the reaction in UserSteppingAction, where it is possible to access secondary particle information via the SteppingManager:

void RE02SteppingAction::UserSteppingAction(const G4Step * theStep) {

G4Track * theTrack = theStep->GetTrack();

  // check if it is alive
  if(theTrack->GetTrackStatus()!=fAlive) { return; }

  // check if it is primary
  if(theTrack->GetParentID()!=0) { return; }

 fSecondary = fpSteppingManager->GetfSecondary();
 anzahlSekTeilchen = fpSteppingManager-> GetfN2ndariesPostStepDoIt();
 if(anzahlSekTeilchen!=2){return;}
  particleName0 = (*fSecondary)[0]->GetDefinition()->GetParticleName();
  particleName1 = (*fSecondary)[1]->GetDefinition()->GetParticleName();

 if(particleName0=="triton" && particleName1== "alpha"){
   if(theStep->GetPreStepPoint()->GetPhysicalVolume()->GetLogicalVolume()
                                                          ->GetName()=="TLD"){
      copyNumber = 0;
      copyNumber = theStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber();
      anzahlRkt[copyNumber]++;
   }
 }
}

How this is possible in a primitive scorer I do not know. Sylvia

None Re: Counting Number of Rkt Li6(n,t)alpha  Keywords: reaktion, secondaries
by Sylvia Studeny <sylvia.studeny@gsf.de>,   25 Jul, 2006
Re: None Counting Number of Rkt Li6(n,t)alpha (Sylvia Studeny)

Hi, I found something suitable in G4SteppingManager and changed my code:

G4bool RE02NofReaktions::ProcessHits(G4Step* aStep,G4TouchableHistory*)
{
  //- check for newly produced particle. e.g. first step.
  if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE;
  //- check for this is not a primary particle. e.g. ParentID > 0 .
  if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE;
 //- This is a newly produced secondary particle. 
  G4Track* aTrack = aStep->GetTrack();

  //neu aus Stepping Manager:
  G4ProcessManager* pm= aTrack->GetDefinition()->GetProcessManager();
  fPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
  for(G4int i=0;i<fPostStepDoItVector->size();i++){
    fCurrentProcess = (*fPostStepDoItVector)[i];
    G4cout << "Prozess= "<<fCurrentProcess -> GetProcessName()<< G4endl;
    fParticleChange  = fCurrentProcess->PostStepDoIt(*aTrack, *aStep);

    G4int  index = GetIndex(aStep);
    if(fParticleChange){
     G4cout << "Anzahl an sekundärteilchen= "<<fParticleChange->GetNumberOfSecondaries()<< G4endl;
      if(fParticleChange->GetNumberOfSecondaries() == 2){
        fSecondary->push_back(fParticleChange->GetSecondary(0));
        fSecondary->push_back(fParticleChange->GetSecondary(1));
        G4cout << G4endl;
        if((fSecondary-> back()->GetDefinition()->GetParticleName() == "alpha") &&
          (fSecondary-> back()->GetDefinition()->GetParticleName() == "titon")){
           G4cout << "reaktion gefunden!" << G4endl;
          // G4double weight = aStep->GetPreStepPoint()->GetWeight();
          // EvtMap->add(index,weight);  
        }
      }
      G4cout << G4endl;
    } 
    else{G4cout<<"No Particle change!" << G4endl;}
  }
  return TRUE;
}

Unfortunately, There is something totally wrong with my way, I think, because when I let it run there are warning, which don't look good:

*** G4Exception : 001
      issued by : G4HadronicProcess
bailing out
*** This is just a warning message.
G4HadronInelasticProcess: called for final state, while cross-section was zero
                          Returning empty particle change....
                          current MeanFreePath is 1.79769e+308
G4HadronicProcess: track in unusable state - 2
G4HadronicProcess: returning unchanged track

and there is no Li6(n,t)alpha raktion at all:

... Prozess= Transportation

Anzahl an sekundärteilchen= 0

Prozess= msc

Anzahl an sekundärteilchen= 0

Prozess= hIoni Anzahl an sekundärteilchen= 0

Prozess= LElastic

Anzahl an sekundärteilchen= 0

Prozess= TritonInelastic

Anzahl an sekundärteilchen= 0

Prozess= Transportation

Anzahl an sekundärteilchen= 0

Prozess= msc

Anzahl an sekundärteilchen= 0

Prozess= ionIoni Anzahl an sekundärteilchen= 0

Prozess= LElastic

Anzahl an sekundärteilchen= 0

Prozess= AlphaInelastic

Anzahl an sekundärteilchen= 0

Prozess= Transportation

Anzahl an sekundärteilchen= 0

Prozess= msc

Anzahl an sekundärteilchen= 0

Prozess= hIoni

Anzahl an sekundärteilchen= 0

Prozess= LElastic

Anzahl an sekundärteilchen= 0

Prozess= TritonInelastic

Anzahl an sekundärteilchen= 0

Prozess= Transportation

Anzahl an sekundärteilchen= 0

Prozess= msc

Anzahl an sekundärteilchen= 0

...

Has anybody done something similar? I think I'm totally wrong in using the ParticleChange-Object, because I don't want to implement a new kind of reaktion or something like that. Unfortunately I don't see any other way to do it.

Thanks a lot Sylvia

None Re: Counting Number of Rkt Li6(n,t)alpha  by Vladimir IVANTCHENKO <vnivanch@mail.cern.ch>,   25 Jul, 2006
Re: None Re: Counting Number of Rkt Li6(n,t)alpha (Sylvia Studeny)
On Tue, 25 Jul 2006, Sylvia Studeny wrote:

> *** Discussion title: Hits, Digitization and Pileup
> Email replies to PublicHyperNews@slac.stanford.edu must include:
>   In-Reply-To: <"/hitsdigits/131/1"@geant4-hn.slac.stanford.edu>
>   Subject: ...change this to be about your reply.
> 
> Hi, I found something suitable in G4SteppingManager and changed my code:
> 
> G4bool RE02NofReaktions::ProcessHits(G4Step* aStep,G4TouchableHistory*)
> {
>   //- check for newly produced particle. e.g. first step.
>   if ( aStep->GetTrack()->GetCurrentStepNumber() != 1) return FALSE;
>   //- check for this is not a primary particle. e.g. ParentID > 0 .
>   if ( aStep->GetTrack()->GetParentID() == 0 ) return FALSE;
>  //- This is a newly produced secondary particle. 
>   G4Track* aTrack = aStep->GetTrack();
> 
>   //neu aus Stepping Manager:
>   G4ProcessManager* pm= aTrack->GetDefinition()->GetProcessManager();
>   fPostStepDoItVector = pm->GetPostStepProcessVector(typeDoIt);
>   for(G4int i=0;i<fPostStepDoItVector->size();i++){
>     fCurrentProcess = (*fPostStepDoItVector)[i];
>     G4cout << "Prozess= "<<fCurrentProcess -> GetProcessName()<< G4endl;
>     fParticleChange  = fCurrentProcess->PostStepDoIt(*aTrack, *aStep);
> 
>     G4int  index = GetIndex(aStep);
>     if(fParticleChange){
>      G4cout << "Anzahl an sekundärteilchen= "<<fParticleChange->GetNumberOfSecondaries()<< G4endl;
>       if(fParticleChange->GetNumberOfSecondaries() == 2){
>         fSecondary->push_back(fParticleChange->GetSecondary(0));
>         fSecondary->push_back(fParticleChange->GetSecondary(1));
>         G4cout << G4endl;
>         if((fSecondary-> back()->GetDefinition()->GetParticleName() == "alpha") &&
>           (fSecondary-> back()->GetDefinition()->GetParticleName() == "titon")){
>            G4cout << "reaktion gefunden!" << G4endl;
>           // G4double weight = aStep->GetPreStepPoint()->GetWeight();
>           // EvtMap->add(index,weight);  
>         }
>       }
>       G4cout << G4endl;
>     } 
>     else{G4cout<<"No Particle change!" << G4endl;}
>   }
>   return TRUE;
> }
> 
> Unfortunately, There is something totally wrong with my way, I think,
> because when I let it run there are warning, which don't look good:
> 
> *** G4Exception : 001
>       issued by : G4HadronicProcess
> bailing out
> *** This is just a warning message.
> G4HadronInelasticProcess: called for final state, while cross-section was zero
>                           Returning empty particle change....
>                           current MeanFreePath is 1.79769e+308
> G4HadronicProcess: track in unusable state - 2
> G4HadronicProcess: returning unchanged track
> 
> and there is no Li6(n,t)alpha raktion at all:
> 
> ... Prozess= Transportation
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= msc
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= hIoni Anzahl an sekundärteilchen= 0
> 
> Prozess= LElastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= TritonInelastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= Transportation
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= msc
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= ionIoni Anzahl an sekundärteilchen= 0
> 
> Prozess= LElastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= AlphaInelastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= Transportation
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= msc
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= hIoni
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= LElastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= TritonInelastic
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= Transportation
> 
> Anzahl an sekundärteilchen= 0
> 
> Prozess= msc
> 
> Anzahl an sekundärteilchen= 0
> 
> ...
> 
> Has anybody done something similar? I think I'm totally wrong in using
> the ParticleChange-Object, because I don't want to implement a new kind
> of reaktion or something like that. Unfortunately I don't see any other
> way to do it.
> 
> Thanks a lot Sylvia
> 

Hello Sylvia,

My impression is that you choose a wrong way - to modify G4 kernel class 
is always danger even if the class seems to do a simple thing.

I would suggest to find out the way to obtain parameters, information you 
need only from user actions - here you free to ACCESS a lot of information 
about step, track, interaction whithout any risk to destroy G4 tracking.

VI 

None Re: Counting Number of Rkt Li6(n,t)alpha  by Sylvia Studeny <sylvia.studeny@gsf.de>,   25 Jul, 2006
Re: None Re: Counting Number of Rkt Li6(n,t)alpha (Vladimir IVANTCHENKO )

Hi, Thanks for the reply. My Problem is, that I don't know how to get any information about the actual reaktion which is taking place. Can you give me a hint how to do this? I looked in Step and Track and all those, but I found nothing about the type of reaktion or type of secondaries! Sylvia

None Re: Counting Number of Rkt Li6(n,t)alpha  by Sergio Lo Meo <sergio.lomeo@roma1.infn.it>,   25 Jul, 2006
Re: None Re: Counting Number of Rkt Li6(n,t)alpha (Sylvia Studeny)
Hi Sylvia,

I am not an expert ... but I use StackingAction to extract some
informations for Re(188) decay
in this way:

G4ClassificationOfNewTrack
Dose5StackingAction::ClassifyNewTrack(const G4Track* track)
{
  G4int parentID = track->GetParentID();
  G4double energy = -1;
  G4int code = 0;
  G4ThreeVector momentum;
  G4double ximp = 0.0;
  G4double yimp = 0.0;
  G4double zimp = -1.0;


  if (parentID == 1)
    {
      //first daugthers
      G4String pname = track->GetCreatorProcess()->GetProcessName();
      if (pname == "RadioactiveDecay")
        {
          code = track->GetDefinition()->GetPDGEncoding();
          energy = track->GetDynamicParticle()->GetKineticEnergy();
          momentum = track->GetDynamicParticle()->GetMomentumDirection();
          ximp = momentum.x();
          yimp = momentum.y();
          zimp = momentum.z();
        }
    }
  if (energy > 0)
    {
      //write energy, code (22=gamma,11=electron,0=recoil)
    fprintf(fen, "%d %f %f %f %f\n", code, energy, ximp,yimp, zimp);
    
    }
  return fUrgent;
}

Bye.

Sergio 

********************************************************************
Dr. Sergio Lo Meo
Medical Physicist
 
Italian National Institute of Occupational Safety and Prevention 
ISPESL  Rome (Italy)
Department of Occupational Hygiene
Via Fontana Candida 1
00040 Monte Porzio Catone (Rome)  
ITALY
Office: +39 06 94181252
Fax: +39 06 9419419

Graduate Student (XXI course)
"Alma Mater Studiorum" - University of Bologna
SCINTIRAD - I.N.F.N
Lab: +39 06 49918277

Mobile: +39 348 7142405
e-mail: sergio.lomeo@roma1.infn.it
*******************************************************************


Question Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Jonathan <Jonathan>,   02 Jul, 2006

Hello all. I am a currently trying to build a voxel phantom based on a 3D parameterisation. I have assigned a multifunctional detector to the logical volume assigned to my parameterisation, and I have registered G4PSDoseDeposit and G4PSEnergyDeposit to the MFD. I place a simple monoenergetic isotropic point source at the center of the box, and simulate around 100000 events. I would expect to see many hits in the voxels (I am starting around 20x20x20, 1mm^3 with 50keV or so e-), but I only get a few hits scored on the outside edge of the volume. I have been able to visualize the volume and the trajectories, and all of the volumes appear to be placed correctly. I have implemented the Run and RunAction classes based on the RE02 example, and it is strange because it compiles fine and I do see scores in around 5 voxels (out of 8000). I have looked at the tracks, and all of the particles appear to be interacting and losing energy, but are not being scored. I have also increased the volume to 128x128x128+ to see if they were just escaping and I get the same results. The range cuts are set to 100nm for all particles (e-, e+, gamma). The phantom is composed of mostly water. I am a grad student who doesn't have too much experience with the toolkit, so it may be a simple mistake. Thanks for any advice you can give!

Regards, Jonathan

None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Makoto Asai <Makoto Asai>,   06 Jul, 2006
Re: Question Primative Scorers in Parameterised Volume (Jonathan)
Sylvia's comment is correct. Your ComputeTransformation() method
of VoxelPhantomParameterisation class should calculate the position
of the voxel directly from the CopyNo given in the argument.
You should not use static valiables (xPos, etc.) with an assumption
that the CopyNo is incremental. Actually CopyNo is quite random
depending where a particular track stands.
None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Makoto Asai <Makoto Asai>,   05 Jul, 2006
Re: Question Primative Scorers in Parameterised Volume (Jonathan)
It seems like a mis-configuration of MFD to your logical volume.
Could you post a part of your detector construction where you
create voxels and assign MFD?
None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Jonathan <Jonathan>,   05 Jul, 2006
Re: None Re: Primative Scorers in Parameterised Volume (Makoto Asai)

Also, here is my ASCIItree output, if that will help any:

"World":0 / "WorldLogical" / "WorldSolid"(G4Box), 1000 m3 , 1.29 mg/cm3
  "PhysicalBreast":0 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":1 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":2 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":3 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":4 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":5 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalLungINhale":6 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":7 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":8 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalBreast":9 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":10 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalLungINhale":11 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":12 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":13 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalBreast":14 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":15 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalLungINhale":16 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":17 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalLungINhale":18 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 217 mg/cm3
  "PhysicalBreast":19 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":20 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":21 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":22 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":23 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":24 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":25 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
  "PhysicalBreast":26 / "VoxelParameterisation_logical" (SD="voxelSD") / "Voxels"(G4Box), 1 mm3, 990.0000000000001 mg/cm3
Calculating mass(es)...
Overall volume of "World":0, is 1000 m3  and the daughter-included mass to unlimited depth is 1290.00001973817 kg

Thanks, Jon

None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Jonathan <Jonathan>,   05 Jul, 2006
Re: None Re: Primative Scorers in Parameterised Volume (Makoto Asai)

Hi Makoto,

Thanks for your response. Below is my DetectorConstruction, followed by the parameterisation where I place the voxels:

DetectorConstruction:

void VoxelPhantomGeometry::PhantomConstructor()
{
	VoxelPhantomImporter* importPhantom = new VoxelPhantomImporter;
	Voxel voxels;
	G4int cols,rows,slices = 0;
	G4double xDim,yDim,zDim = 0;

	G4String fileName = "";	

	G4cout << "Please enter the name of the segmented voxel file (enter 1 for default): " << G4endl;
	G4cin >> fileName;

	if(fileName == "1")
        fileName = "examplePatient.csv";

	importPhantom->ReadASCIIFile(fileName,voxels);

	cols = voxels.getVoxelCols();
	rows = voxels.getVoxelRows();
	slices = voxels.getVoxelSlices();

	G4ThreeVector dim = voxels.getVoxelDimensions();
	xDim = dim.x();
	yDim = dim.y();
	zDim = dim.z();

    //Building up the parameterisation ...

    G4Box* voxelParameterisation = new G4Box( "Voxels", (xDim/2)*mm, 
    							(yDim/2)*mm, 
    							(zDim/2)*mm);

    voxelParameterisationLogicalvolume = new G4LogicalVolume(voxelParameterisation,
    					                     phantom,
    						             "VoxelParameterisation_logical");

    G4int numberOfVoxels = voxels.getTotalNumberOfVoxels();

    G4VPVParameterisation* paramVoxel = new VoxelPhantomParameterisation(lunginhale,
						                         lungexhale,
				                                         adiposeTissue,
						                         breast,
							                 phantom,
									 muscle,
								         liver,
									 denseBone,
								         trabecularBone );

    voxelParameterisationPhysical = new G4PVParameterised( "Voxels (physical)", 
                            					voxelParameterisationLogicalvolume, 
                            					physiWorld,
                            					kUndefined, 	// 3D optimization
                            					numberOfVoxels,  // copy's
                            					paramVoxel );			
    delete importPhantom;

}

void VoxelPhantomGeometry::SetupDetectors()
{
    //================================================
    // Sensitive detectors : MultiFunctionalDetector
    //================================================

    G4SDManager* SDman = G4SDManager::GetSDMpointer();

    G4String voxelSDname = "voxelSD";

    //------------------------
    // MultiFunctionalDetector
    //------------------------

    G4MultiFunctionalDetector* MFDet = new G4MultiFunctionalDetector(voxelSDname);
    SDman->AddNewDetector( MFDet );                 // Register SD to SDManager.
    voxelParameterisationLogicalvolume->SetSensitiveDetector(MFDet);  // Assign SD to the logical volume.

    //---------------------------------------
    // SDFilter : Sensitive Detector Filters
    //---------------------------------------

    G4String fltName,particleName;

    //-- gamma filter
    G4SDParticleFilter* gammaFilter = 
        new G4SDParticleFilter(fltName="gammaFilter", particleName="gamma");

    //-- electron filter
    G4SDParticleFilter* electronFilter = 
        new G4SDParticleFilter(fltName="electronFilter");
    electronFilter->add(particleName="e+");   // accept electrons.
    electronFilter->add(particleName="e-");   // accept positorons.

    //------------------------
    // PS : Primitive Scorers
    //------------------------

    G4String psName;

    // total
    G4PSEnergyDeposit*      scorer0 = new G4PSEnergyDeposit(psName="totalEDep", 0);
    G4PSDoseDeposit*        scorer1 = new G4PSDoseDeposit(psName="totalDose", 0);

    // by gammas
    G4PSEnergyDeposit*      scorer2 = new G4PSEnergyDeposit(psName="gammaEDep", 0);
    scorer2->SetFilter(gammaFilter);

    G4PSDoseDeposit*        scorer3 = new G4PSDoseDeposit(psName="gammaDose", 0);
    scorer3->SetFilter(gammaFilter);

    // by electrons    
    G4PSEnergyDeposit*      scorer4 = new G4PSEnergyDeposit(psName="electronEDep", 0);
    scorer4->SetFilter(electronFilter);

    G4PSDoseDeposit*        scorer5 = new G4PSDoseDeposit(psName="electronDose", 0);
    scorer5->SetFilter(electronFilter);

    //------------------------------------------------------------
    //  Register primitive scorers to MultiFunctionalDetector
    //------------------------------------------------------------

    MFDet->RegisterPrimitive(scorer0);
    MFDet->RegisterPrimitive(scorer1);
    MFDet->RegisterPrimitive(scorer2);
    MFDet->RegisterPrimitive(scorer3);
    MFDet->RegisterPrimitive(scorer4);
    MFDet->RegisterPrimitive(scorer5);	
}

G4VPhysicalVolume* VoxelPhantomGeometry::Construct()
{
	InitialisationOfMaterials();

    G4double worldXDimension = 5000.*mm;
    G4double worldYDimension = 5000.*mm;
    G4double worldZDimension = 5000.*mm;

    solidWorld = new G4Box( "WorldSolid",
                            worldXDimension,
                            worldYDimension,
                            worldZDimension );

    logicWorld = new G4LogicalVolume( solidWorld, 
                                      air, 
                                      "WorldLogical", 
                                      0, 0, 0 );

    physiWorld = new G4PVPlacement( 0,
                                    G4ThreeVector(0,0,0),
                                    "World",
                                    logicWorld,
                                    0,
                                    false,
                                    0 );

    //logicWorld->SetVisAttributes (G4VisAttributes::Invisible);	   

    PhantomConstructor();

    SetupDetectors();

    return physiWorld;	

}

And my Parameterisation: (xPos, yPos, zPos declared static)

void VoxelPhantomParameterisation::ComputeTransformation(const G4int copyNo, 
													G4VPhysicalVolume* physVol) const
{	
      if(copyNo == 0)
      {
	xPos = -colNumber/2.;
	yPos = -rowNumber/2.;
	zPos = -sliceNumber/2.;
      } 

 	  // increments row
      if((copyNo % colNumber == 0) && copyNo != 0)
      {
      	xPos = -colNumber/2.;
      	yPos++;
      }

      // increments slice
      if((copyNo % (colNumber * rowNumber) == 0) && copyNo != 0) 
	  {
	  	xPos = -colNumber/2.;
	  	yPos = -rowNumber/2.;
	  	zPos++;
	  }

	  // increments column
	  if((copyNo % colNumber != 0) && (copyNo % (colNumber * rowNumber) !=0) && copyNo != 0)
	  {
	  	xPos++;
	  } 

	  // positions all voxels so that their origin will fall in line with mother's origin (0,0,0)	  
	  G4ThreeVector origin(((xPos*xDim)+(xDim/2.))*mm, 
	  					   ((yPos*yDim)+(yDim/2.))*mm, 
	  					   ((zPos*zDim)+(zDim/2.))*mm);
          // debuggin
	  //G4cout << origin << ", ";

	  physVol->SetTranslation(origin);

	  // prep for an additional run (ie, if the copyNo is equal to the last element, reset all counters
	  if((copyNo + 1) == (colNumber * rowNumber * sliceNumber))
	  {
	  	xPos = -colNumber/2.;
	  	yPos = -rowNumber/2.;
	  	zPos = -sliceNumber/2.;
	  }

}

void VoxelPhantomParameterisation::ComputeDimensions(G4Box& voxels, const G4int, 
													 const G4VPhysicalVolume*) const
{
      //not needed yet until you want to update on the fly or change geometry as function of copyNo
      voxels.SetXHalfLength(voxelDim.x()/2 * mm);
      voxels.SetYHalfLength(voxelDim.y()/2 * mm);
      voxels.SetZHalfLength(voxelDim.z()/2 * mm);
} 

G4Material* VoxelPhantomParameterisation::ComputeMaterial(const G4int copyNo, G4VPhysicalVolume* physVol,
	                                                	  const G4VTouchable*)
{
      // uses the material map formed in VoxelImporter class to map the materials to the voxels
	  G4int chooser = materials[copyNo];

	  switch(chooser)
	  {
	  	case 1:          physVol->SetName("PhysicalLungINhale");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeLungINhale );
                         return lungInhale;
	  	case 11:          physVol->SetName("PhysicalAdipose");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeAdipose );
                         return adiposeTissue;
	  	case 0:          physVol->SetName("PhysicalBreast");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeBreast );
                         return breastTissue;
	  	case 4:          physVol->SetName("PhysicalPhantom");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributePhantom );
                         return phantomTissue;
	  	case 14:          physVol->SetName("PhysicalMuscle");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeMuscle );
                         return muscleTissue;
	  	case 35:          physVol->SetName("PhysicalLiver");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeLiver );
                         return liverTissue;
	  	case 10:          physVol->SetName("PhysicalTrabecularBone");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeTrabecularBone );
                         return trabecularBoneTissue;
	  	case 8:          physVol->SetName("PhysicalDenseBone");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributeDenseBone );
                         return denseBoneTissue;                         
	  	default: 	  	 physVol->SetName("PhysicalPhantom");
                         physVol->GetLogicalVolume()->SetVisAttributes( attributePhantom );
                         return phantomTissue;
	  }

return physVol->GetLogicalVolume()->GetMaterial(); }

Thanks again for taking the time to help me out on this. There is also a related post that I made that may shed some light on the problem in the Events and Tracking forum #509. If you need anymore info, just let me know!

Jonathan

None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Sylvia Studeny <sylvia.studeny@gsf.de>,   05 Jul, 2006
Re: None Re: Primative Scorers in Parameterised Volume (Jonathan)

Hi, I'm not an expert in Geant4 myself, but I also work with Voxelphantoms. My question to your problem is: Where do you know from, that the copynumber is always called ascending and not chaotic? My impression was, that during the run the CompueTranslation Method is called often to get the position of the parametriesed Voxel. If this is the case, your routine would work in the beginning (giving the right-looking picture), but fail in the run. When you look in the DICOM example, you can see that the placement is called directly with copynumber. I don't know if this is correct, but it could be a solution. Best wishes Sylvia

None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Jonathan <Jonathan>,   06 Jul, 2006
Re: None Re: Primative Scorers in Parameterised Volume (Sylvia Studeny)

You were absolutely right! The copyNo was not being called like I thought it was (sequentially) during the runs, but was random. This caused the placement to be very wierd. Thanks again! =)

Jon

None Re: Primative Scorers in Parameterised Volume  Keywords: Primative Scorer, Hits, Voxel Phantom
by Jonathan <Jonathan>,   06 Jul, 2006
Re: None Re: Primative Scorers in Parameterised Volume (Sylvia Studeny)

Hi Sylvia! Thanks for your comments! I was thinking the same thing as you 
about this, so I placed a G4cout statement (where is says debugging in 
the code I posted) to display the coordinates of the origin I was placing.
 I repeatedly checked this value during the events, and everything looked 
like it was supposed to. BUT, something wierd did happen on the very first
 run with the values.. some values went chaotic, but I suspect this was 
during the initial geometry test. During every actual event, things 
"seemed" to be placed fine. Thanks again!

Jon

None converter  by Mihai Potlog <Mihai Potlog>,   29 May, 2006

Hello all! I'm a new user of GEANT4 and I have a question related to an iron converter; in order to make a detector for neutrons I need to place before this detectors an iron converter; does anybody knows how should I consider this? How can I retrieve the information about what is happening inside of iron converter? Should I consider this converter as a sensitive detector? Thank you in advance! Mihai

Question How to split numerous events, to store and to accumulate their results?  Keywords: numerous events per run split store pile-up
by Shahrokh <Shahrokh>,   26 May, 2006
Hi,

I need to simulate 10^9 events per run but this is time consuming. 
For running, the computer needs to power on for several days. 
My computer is not so much powerful for running several days 
and I can not power on the computer for this long time. 
Thus, I think to split events to multiple steps including 10^6 events per step. 
So, to simulate 10^9 events, I need to do step by step and to store the results of each step. 
After doing one step, its results must be accumulated with the results of the previous steps.

Could you please answer me the following questions:
1) How can I store the results of each step (for example 10^6 events per step) in a file?
2) How can I accumulate the results of each step by the ones of the previous steps in a file?
3) Does this process mean "pile up" in geant4?
4) If so, which class of geant4 is used?

Please help me, 
Thanks a lot,
Shahrokh.
None Need HELP to record particle energy in the world  by lexaxl <lexaxl>,   10 Apr, 2006

The simple way to solve this problem is just filling World with SD. I have a assembling with complex geometry and large World and I need information about particle energy inside and around assembling. Is it possible recording particle energy in any position in the World without using SD?

None Re: Need HELP to record particle energy in the world  by Makoto Asai <Makoto Asai>,   14 Apr, 2006
Re: None Need HELP to record particle energy in the world (lexaxl)
You may use your own implementation of user stepping action and/or 
user tracking action to record.
None How to reassign SD when geometry is updated  Keywords: primative scorer, update geometry, sensitive detector
by Jonathan <Jonathan>,   04 Apr, 2006

Hi. I have seen a couple of questions on this, but I can't figure out how to reassign a sensitive detector after I have updated my geometry. I am using primative scorers with a multifunctional detector. After I update the geometry, if I try to setup the scorers again, it tells me:

MFDet had already stored in /

Is there any way someone can point me in the right direction. I am a very new user of GEANT4.

None Re: How to reassign SD when geometry is updated  Keywords: primative scorer, update geometry, sensitive detector
by Makoto Asai <Makoto Asai>,   14 Apr, 2006
Re: None How to reassign SD when geometry is updated (Jonathan)
Unless you intentionally "de-assign" your detector, you can re-use it
in your new geometry by just assigning it to a new logical volume.
Question problem with a modified hadrontherapy example  Keywords: SensitiveDetector, geometry update, hadrontherapy
by Sara Vecchio <sara.vecchio@pi.infn.it>,   31 Mar, 2006

Hallo, I have a big problem which seems to be common to many users, but the answers in this forum are not satisfying (at least: I have not been able to found the right answer..).

I have extended in the hadrontherapy example the possibility to change geometry through the messenger. To be sure of the result, after the changes I apply a command /geometry_update, which corresponds to:

* void  HadrontherapyDetectorConstruction::UpdateGeometry()
* {  // clean-up previous geometry
*  G4GeometryManager::GetInstance()->OpenGeometry();
*
*  phantomLogicalVolume->SetRegionRootFlag(0);
*  delete specialRegion;
*
*  G4PhysicalVolumeStore::GetInstance()->Clean();
*  G4LogicalVolumeStore::GetInstance()->Clean();
*  G4SolidStore::GetInstance()->Clean();
*
*  //define new one
*  Construct();
*
*  G4RunManager::GetRunManager()->DefineWorldVolume(physicalTreatmentRoom); 
*  G4RunManager::GetRunManager()->GeometryHasBeenModified(); 
* }

and then a command /update_cuts to set again the cuts in the specialRegion phantomLog.

Without applying /geometry_update my geometry does not really change. However, when I use this command (even without applying changes in geometry), , though the simulation is properly working, the result from the sensitive detector is empty.

So the question is: how can I update correctly the sensitive detector geometry? what's wrong or missing in my function UpdateGeometry() ?

Please, I really need it, because I am testing the program with several targets, at the end of the proton beam, and it would be time-consuming to compile the example every time..

None Re: problem with a modified hadrontherapy example  Keywords: SensitiveDetector, geometry update, hadrontherapy
by Makoto Asai <Makoto Asai>,   03 Apr, 2006
Re: Question problem with a modified hadrontherapy example (Sara Vecchio)
Have you set the sensitive detector pointer to new volumes?
Sensitive detector object is not deleted when you delete 
logical volumes. You do not have to delete the old sensitive 
detector, but just set the pointer to the new volumes.
Sad Re: problem with a modified hadrontherapy example  Keywords: SensitiveDetector, geometry update, hadrontherapy
by Sara Vecchio <sara.vecchio@pi.infn.it>,   04 Apr, 2006
Re: None Re: problem with a modified hadrontherapy example (Makoto Asai)

User Makoto Asai wrote:

>> Have you set the sensitive detector pointer to new volumes?
>> Sensitive detector object is not deleted when you delete 
>> logical volumes. You do not have to delete the old sensitive 
>> detector, but just set the pointer to the new volumes.

Actually I didn't, and I have just corrected my mistake. But this cannot be enough since the Read-Out geometry must change to adapt to the new PhantomLog shape. I need to find a way to delete at least the old PhantomROGeometry, before pointing the sensitive detector to the new logical volume

If I try to delete the phantomROGeometry and the phantomSD I get this strange warning:

 Hadrontherapy: /usr/local/share/geant4.8.0.p01/source/geometry/management/include/G4VoxelLimits.icc:141: G4bool G4VoxelLimits::IsLimited(EAxis) const: Assertion `pAxis==kZAxis' failed.

And the energy deposit still appears empty.

None Re: problem with a modified hadrontherapy example  Keywords: SensitiveDetector, geometry update, hadrontherapy
by Makoto Asai <Makoto Asai>,   14 Apr, 2006
Re: Sad Re: problem with a modified hadrontherapy example (Sara Vecchio)
It seems your new geometry (either mass geometry or readout geometry)
is incorrect. 

First, try to figure out which geometry has a problem. To do this,
remove the sensitive detector and see whether you still have the
warning message. 

In case your mass geometry is OK, please make sure BuildROGeometry()
method of your readout geometry is properly invoked.



News Re: problem with a modified hadrontherapy example  Keywords: SensitiveDetector, geometry update, hadrontherapy
by Sara Vecchio <sara.vecchio@pi.infn.it>,   14 Apr, 2006
Re: None Re: problem with a modified hadrontherapy example (Makoto Asai)

The mass and readout geometry are correct. BuildROGeometry is invoked exactly as in the hadrontherapy example. This is confirmed by the fact that, if I comment the line ConstructSensitiveDetector() in the Construct() function of the physics list, and I call it only once, in the function UpdateGeometry() after Construction() (see my first post on the topic), no segmentation fault appear.

What I have not understood is just how to tell to the program that the readout geometry had been deeply changed, not the change in itself.

Anyway, this last trick is enough to solve the problem (though not in a very elegant way): I will not invoke ConstructSensitiveDetector() in the HadrontherapyDetectorConstruction::Construct(), but I will have to call HadrontherapyDetectorConstruction::UpdateGeometry() whatever change (even none) has been invoked in the macro.

None problem with primitive scorer?  Keywords: primitive scorer, parameterisation
by sylvia studeny <sylvia.studeny@gsf.de>,   23 Mar, 2006

Hi, I'm working with geant4.8.0 on a problem using phantoms. For this I took example/extended/runAndEvent/Re02. I print out an file, so that I can see the deposited energy in every voxel. For this I use the data in the primitive scorers. With the original example everything is fine and I get the expected energy distribution.Then I tried and changed the parameterisation into

#include "RE02PhantomParameterisation.hh"
#include "G4Box.hh"
#include "G4VPhysicalVolume.hh"

RE02PhantomParameterisation::RE02PhantomParameterisation(
		   const G4ThreeVector& motherSize, const G4ThreeVector& voxelSize,
		   const G4int nx, const G4int ny, const G4int nz)
//I changed this in DetectorConstruction,too!
    :G4VPVParameterisation(),fDxyzMother(motherSize),fVoxel(voxelSize),
     fNx(nx),fNy(ny),fNz(nz)
{}

RE02PhantomParameterisation::~RE02PhantomParameterisation() {}

void RE02PhantomParameterisation::ComputeTransformation(const G4int copyNo, 
				  G4VPhysicalVolume* physVol) const
{

G4int nx=0,ny=0,nz=0;
G4int nzx=fNz*fNx;
   G4int cN; 
    cN=copyNo;
    //G4cout<<"CopyNumber"<<cN<<G4endl;
    ny=cN/nzx;
    cN%=nzx;
    nx=cN/fNz;
    cN%=fNz;
    nz=cN;

  G4double Xposition= -fDxyzMother.x() + (nx+.5) * fVoxel.x(); 
  G4double Yposition= -fDxyzMother.y() + (ny+.5) * fVoxel.y();
  G4double Zposition= -fDxyzMother.z() + (nz+.5) * fVoxel.z();

  //G4double Xposition= offsetX + nx *2* fVoxel.x();
  //G4double Yposition= offsetY + ny *2* fVoxel.y();
  //G4double Zposition= offsetZ + nz *2* fVoxel.z();
  G4ThreeVector Schwerpunkt(Xposition,Yposition,Zposition);

    physVol->SetTranslation(Schwerpunkt);
    physVol->SetRotation(0);
}

which worked quite well in geant4.7.0.p1. Also when I look at the phantom with vis.mac everything looks fine. The deposited energy on the other hand looks quite weird. I double checked everything, but I don't know what I did wrong. Has anybody any idea what else I can try? Thanks a lot Sylvia

None Re: problem with primitive scorer?  Keywords: primitive scorer, parameterisation
by Makoto Asai <Makoto Asai>,   28 Mar, 2006
Re: None problem with primitive scorer? (sylvia studeny)
> which worked quite well in geant4.7.0.p1.

 We did not have primitive scorers in version 7.1. 
What do you mean in "worked well"?

> Also when I look at the
> phantom with vis.mac everything looks fine. The deposited 
> energy on the
> other hand looks quite weird. I double checked everything, but I don't
> know what I did wrong. Has anybody any idea what else I can 
> try? 

 How "weird" was your result? Could you be more specific?

None Re: problem with primitive scorer?  Keywords: primitive scorer, parameterisation
by sylvia studeny <sylvia.studeny@gsf.de>,   29 Mar, 2006
Re: None Re: problem with primitive scorer? (Makoto Asai)

Hi, In Geant4.7.0.p01 I plotted the deposited energy with analysis in a histogramm and the distribution (of a single neutron beam) looked quite right. This was also the case when I took the original example runAndEvent/RE02 in geant4.8.0. When I changed (in 4.8.0) the Parameterisation into the one I wrote earlier, the histigramm was not as before, but only some points with a lot of energy somewhere, where they should not be ( as I changed nothing else). The parameterisation worked well in geant4.7.0.p01 (the histogramms there looked good), so maybe there is more to primitive scorers than I thought?

Thanks a lot, sylvia

None Re: problem with primitive scorer?  Keywords: primitive scorer, parameterisation
by Sylvia Studeny <sylvia.studeny@gsf.de>,   03 Apr, 2006
Re: None Re: problem with primitive scorer? (sylvia studeny)

Hi, I found the error on my own: somehow, I changed the positioning of the voxels, so I didn't hit them any more with my beam. Now everything looks good, Sylvia

Question Cut on energy deposit to a sensitive detector  Keywords: Cut on energy deposit to a sensitive detector
by <maryam@jlab.org>,   20 Mar, 2006

Dear Geant4 experts,

I was wondering how to put a cut (threshold) on energy deposited to a sensitive detector (by each track). Has it been already implemented or should I define it from scratch (in EventAction or TrackingAction)? I know that HCofThisEvent gives me the energy deposit of one event but not of one track.

Many thanks in advance,

Maryam

None Re: Cut on energy deposit to a sensitive detector  Keywords: Cut on energy deposit to a sensitive detector
by Makoto Asai <Makoto Asai>,   03 Apr, 2006
Re: Question Cut on energy deposit to a sensitive detector
Do you mean you want to accumurate energy deposition of steps only
above a certain threshold? In this case, we do not have definitely
matching functionarity, but you can easily create your own filter
class to be attached to your detector or scorer class.