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
 All All
Outline Depth:
 1 1
 2 2
 All All
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

1 None: Re: Using Primitive Scorer to fill an histogram with energies.   (Tsukasa Aso - Jul 21, 23:32)
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!!

1 None: Re: Sensitive Detector Problem   (Paul Nicholas Colin Gloster - May 29, 07:35)
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

1 None: Re: How to access ParticleGun from SteppingVerbose.cc   (michel maire - 20 May, 2009)
(_ None: Re: How to access ParticleGun from SteppingVerbose.cc   (Pradip Datta - 20 May, 2009)
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

1 None: Re: Primitive Scorer in repeated mother volume   (Tsukasa Aso - 27 Mar, 2009)
(_ Question: Re: Primitive Scorer in repeated mother volume   (Suhaili Zakaria - 30 Mar, 2009)
(_ None: Re: Primitive Scorer in repeated mother volume   (Tsukasa Aso - 30 Mar, 2009)
(_ None: Re: Primitive Scorer in repeated mother volume   (Suhaili Zakaria - 31 Mar, 2009)
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

1 None: Re: G4PSPassageCurrent in Geant4.9.2   (Tsukasa Aso - 04 Mar, 2009)
(_ None: Re: G4PSPassageCurrent in Geant4.9.2   (Suhaili Zakaria - 04 Mar, 2009)
(_ None: Re: G4PSPassageCurrent in Geant4.9.2   (Tsukasa Aso - 04 Mar, 2009)
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

1 None: Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?   (michel maire - 03 Mar, 2009)
2 None: Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?   (Tsukasa Aso - 03 Mar, 2009)
1 None: Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?   (Peter T. - 04 Mar, 2009)
(_ None: Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?   (michel maire - 04 Mar, 2009)
(_ None: Re: How to make G4MultiFunctionalDetector sensitive to only Compton scattered particles?   (Peter T. - 11 Mar, 2009)
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.

1 Question: Re: G4VPrimitive Scorer-Surface Current   (Suhaili Zakaria - 20 Jan, 2009)
(_ None: Re: G4VPrimitive Scorer-Surface Current   (Tsukasa Aso - 20 Jan, 2009)
(_ None: Re: G4VPrimitive Scorer-Surface Current   (Suhaili Zakaria - 21 Jan, 2009)
(_ None: Re: G4VPrimitive Scorer-Surface Current   (Tsukasa Aso - 26 Jan, 2009)
(_ Ok: Re: G4VPrimitive Scorer-Surface Current   (Suhaili Zakaria - 26 Jan, 2009)
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.

1 None: Re: Particle Hit Question (Novice Level)   (Mark Looper - 10 Sep, 2008)
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?
1 None: RE: RE02 example problem - double free or corruption (out)   (Makoto Asai - 04 May, 2008)
(_ None: RE: RE02 example problem - double free or corruption (out)   (Yuri Burmistenko - 05 May, 2008)
(_ None: RE: RE02 example problem - double free or corruption (out)   (Makoto Asai - 05 May, 2008)
(_ None: RE: RE02 example problem - double free or corruption (out)   (Yuri Burmistenko - 06 May, 2008)
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...

1 None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Makoto Asai - 17 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Yuri Burmistenko - 17 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Makoto Asai - 17 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Yuri Burmistenko - 17 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Makoto Asai - 17 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Yuri Burmistenko - 18 Apr, 2008)
(_ None: RE: Some kind of bug with G4PSPassageCellFlux (???)   (Yuri Burmistenko - 18 Apr, 2008)
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.

1 None: Re: Recording 2 sets of hits in the same EMcalorimeter detector.   (Vladimir IVANTCHENKO - 07 Apr, 2008)
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.

1 None: Re: How to output the useful information of G4 simulation   (michel maire - 17 Mar, 2008)
(_ None: Re: How to output the useful information of G4 simulation   (yfdeng@student.dlut.edu.cn - 17 Mar, 2008)
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

1 None: Re: Problems with sensitive detector   (piliero@pi.infn.it - 08 Mar, 2008)
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

1 None: RE: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Makoto Asai - 27 Feb, 2008)
2 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Makoto Asai - 28 Feb, 2008)
1 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Sylvia Studeny - 28 Feb, 2008)
3 None: Re: Mistake in DoseDeposit-scorer with G4PhantomParameterisation   (Sylvia Studeny - 28 Feb, 2008)
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?
1 None: Re: Understanding G4PSFlatSurfFlux output   (Yuri Burmistenko - 05 May, 2008)
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
    

1 None: RE: Making multiple sensitive Detectors - a probelm   (Makoto Asai - 18 Dec, 2007)
2 None: Re: Making multiple sensitive Detectors - a probelm   (Laura Harkness - 19 Dec, 2007)
4 None: Re: Making multiple sensitive Detectors - a probelm   (Laura Harkness - 31 Dec, 2007)
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.

1 None: Re: how to make a particle interact only once per detector?   (Vladimir IVANTCHENKO - 17 Dec, 2007)
(_ None: Re: how to make a particle interact only once per detector?   (Victor_Makarov - 18 Dec, 2007)
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,

1 None: RE: Parameterised Volume as sensitive detector : doesn't work :-(   (Makoto Asai - 06 Nov, 2007)
1 None: RE: Parameterised Volume as sensitive detector : doesn't work :-(   (Jerome.ROCCAZ@CEA.FR - 07 Nov, 2007)
2 None: RE: Parameterised Volume as sensitive detector : doesn't work :-(   (Jerome.ROCCAZ@CEA.FR - 07 Nov, 2007)
3 None: RE: Parameterised Volume as sensitive detector : doesn't work :-(   (Jerome.ROCCAZ@CEA.FR - 07 Nov, 2007)
1 None: RE: Parameterised Volume as sensitive detector : doesn't work :-(   (Makoto Asai - 08 Nov, 2007)
...
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

1 None: Re: ExN03 energy absorption in each layer   (michel maire - 09 Oct, 2007)
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

1 None: RE: Problem with Sensitive Detectors using Primitve Scorer   (Makoto Asai - 13 Sep, 2007)
(_ None: RE: Problem with Sensitive Detectors using Primitve Scorer   (Slawomir Suchy - 13 Sep, 2007)
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

 

1 None: Re: use G4PSDoseDeposit class together with variance deduction techniques   (Tsukasa Aso - 09 Aug, 2007)
1 None: Re: use G4PSDoseDeposit class together with variance deduction techniques   (long - 10 Aug, 2007)
3 None: Re: use G4PSDoseDeposit class together with variance deduction techniques   (Tsukasa Aso - 20 Aug, 2007)
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

1 None: Re: How to make a inputfile for TDC information   (Michael Burgess - 12 Jul, 2007)
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

1 None: RE: Filtering optical photons and counting them   (Makoto Asai - 11 Jun, 2007)
(_ None: RE: Filtering optical photons and counting them   (Hugo Rivera - 11 Jun, 2007)
(_ None: RE: Filtering optical photons and counting them   (Makoto Asai - 11 Jun, 2007)
(_ None: RE: Filtering optical photons and counting them   (michel maire - 12 Jun, 2007)
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.

1 None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Makoto Asai - 07 Jun, 2007)
1 None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Victor - 08 Jun, 2007)
(_ None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Makoto Asai - 08 Jun, 2007)
(_ None: RE: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Victor - 09 Jun, 2007)
2 None: Re: Can I fill histograms with energy deposit per event using EndOfEvent() method of G4VSensitiveDetector?   (Vladimir IVANTCHENKO - 08 Jun, 2007)
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;
      }
    }
  }
}

1 None: RE: question on how to use G4THitsMap   (Makoto Asai - 05 Jun, 2007)
1 None: RE: question on how to use G4THitsMap   (long - 05 Jun, 2007)
2 None: Re: question on how to use G4THitsMap   (Christopher Oakley - 14 Aug, 2008)
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

1 None: Re: parentID, StepNo   (Vladimir IVANTCHENKO - 15 May, 2007)
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

1 None: Re: two different Sensitive detectors and assign them to the same Logical Volume   (Makoto Asai - 22 May, 2007)
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.

1 None: RE: No hits in daughter volumes   (Makoto Asai - 06 Mar, 2007)
(_ Feedback: RE: No hits in daughter volumes   (Rick Foster - 06 Mar, 2007)
(_ None: Re: RE: No hits in daughter volumes   (Jacques Goldberg - Sep 20, 12:57)
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

1 None: Re: No hits on shield   (Vladimir IVANTCHENKO - 22 Feb, 2007)
2 None: Re: No hits on shield   (michel maire - 22 Feb, 2007)
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

1 None: Re: confused by hits, hit collections, and sensitive detectors   (Makoto Asai - 30 Dec, 2006)
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?

1 None: Re: count only decays ( time, position, etc )   (Makoto Asai - 30 Dec, 2006)
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.

1 None: Re: Spike in Deposited Energy/Time at Boundary of Detector   (Sean Lourette - 17 Aug, 2006)
(_ None: Re: Spike in Deposited Energy/Time at Boundary of Detector   (Vladimir IVANTCHENKO - 30 Aug, 2006)
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

1 None: Re: Counting Number of Rkt Li6(n,t)alpha   (Sylvia Studeny - 25 Jul, 2006)
1 None: Re: Counting Number of Rkt Li6(n,t)alpha   (Vladimir IVANTCHENKO - 25 Jul, 2006)
(_ None: Re: Counting Number of Rkt Li6(n,t)alpha   (Sylvia Studeny - 25 Jul, 2006)
(_ None: Re: Counting Number of Rkt Li6(n,t)alpha   (Sergio Lo Meo - 25 Jul, 2006)
3 None: Re: Counting Number of Rkt Li6(n,t)alpha   (Sylvia Studeny - 01 Aug, 2006)
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

1 None: Re: Primative Scorers in Parameterised Volume   (Makoto Asai - 05 Jul, 2006)
1 None: Re: Primative Scorers in Parameterised Volume   (Jonathan Rogers - 05 Jul, 2006)
1 None: Re: Primative Scorers in Parameterised Volume   (Sylvia Studeny - 05 Jul, 2006)
... 2 Message(s)
3 None: Re: Primative Scorers in Parameterised Volume   (Jonathan Rogers - 05 Jul, 2006)
3 None: Re: Primative Scorers in Parameterised Volume   (Makoto Asai - 06 Jul, 2006)
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?

1 None: Re: Need HELP to record particle energy in the world   (Makoto Asai - 14 Apr, 2006)
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.

1 None: Re: How to reassign SD when geometry is updated   (Makoto Asai - 14 Apr, 2006)
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..

1 None: Re: problem with a modified hadrontherapy example   (Makoto Asai - 03 Apr, 2006)
(_ Sad: Re: problem with a modified hadrontherapy example   (Sara Vecchio - 04 Apr, 2006)
(_ None: Re: problem with a modified hadrontherapy example   (Makoto Asai - 14 Apr, 2006)
(_ News: Re: problem with a modified hadrontherapy example   (Sara Vecchio - 14 Apr, 2006)
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

1 None: Re: problem with primitive scorer?   (Makoto Asai - 28 Mar, 2006)
(_ None: Re: problem with primitive scorer?   (sylvia studeny - 29 Mar, 2006)
(_ None: Re: problem with primitive scorer?   (Sylvia Studeny - 03 Apr, 2006)
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

1 None: Re: Cut on energy deposit to a sensitive detector   (Makoto Asai - 03 Apr, 2006)
None sensitive detector  Keywords: sensitive detector
by Raffaello Trentadue <Raffaello Trentadue>,   15 Mar, 2006

Dear all, I need help about the "sensitive Detector".

To make it, I used the following procedure:

in the DetectorConstruction.cc, inside the definition of function construct() I inserted the code:

G4VSensitiveDetector* target;

.........................

  G4ThreeVector positionTarget = G4ThreeVector(0,0,0);

  G4Box* solidTarget = new G4Box("target",expTarget_x,expTarget_y,expTarget_z);
  logicTarget = new G4LogicalVolume(solidTarget,Bakelite,"Target",0,0,0);
  physTarget = new G4PVPlacement(0,               // no rotation
				  positionTarget,  // at (x,y,z)
				  logicTarget,     // its logical volume				  
				  "Target",        // its name
			          experimentalHall_log,      // its mother  volume

..........................

  // sensitive detectors -----------------------------------------------------

  G4SDManager* SDman = G4SDManager::GetSDMpointer();
  G4String SDname;

  //  target = new ExN01Target(SDname="target");
  target = new ExN01Target("target");

  SDman->AddNewDetector(target);
  logicTarget->SetSensitiveDetector(target);

______________________________________________________________________

Then I defined the a class called ExN01Target, introducing this code:

ExN01Target::ExN01Target(G4String name)
:G4VSensitiveDetector(name)
{
  G4String HCname;
  collectionName.insert(HCname="targetCollection");
  HCID = -1;
}

ExN01Target::~ExN01Target(){;}

void ExN01Target::Initialize(G4HCofThisEvent*HCE)
{
  hitsCollection = new ExN01TargetHitsCollection
                   (SensitiveDetectorName,collectionName[0]);
  if(HCID<0)
  { HCID = G4SDManager::GetSDMpointer()->GetCollectionID(hitsCollection); }
  HCE->AddHitsCollection(HCID,hitsCollection);
}

G4bool ExN01Target::ProcessHits.......................

______________________________________________________________________

After that I created the class ExN01TargetHit, following the exemple4 of the tutorial done at CERN.

At the end, I put in EventAction.cc:

ExN01EventAction::ExN01EventAction()
{
  G4String colName;
  G4SDManager* SDman = G4SDManager::GetSDMpointer();
  HHC1ID = SDman->GetCollectionID(colName="target/targetCollection");
  verboseLevel = 1;
  messenger = new ExN01EventActionMessenger(this);
}

ExN01EventAction::~ExN01EventAction() { }

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

void ExN01EventAction::EndOfEventAction(const G4Event* evt)
{
  G4HCofThisEvent * HCE = evt->GetHCofThisEvent();
  ExN01TargetHitsCollection* HHC1 = 0;

  if(HCE)
  {
    HHC1 = (ExN01TargetHitsCollection*)(HCE->GetHC(HHC1ID));
      }

  // Diagnostics

  if (verboseLevel==0 || evt->GetEventID() % verboseLevel != 0) return;

  G4PrimaryParticle* primary = evt->GetPrimaryVertex(0)->GetPrimary(0);
  G4cout << G4endl
         << ">>> Event " << evt->GetEventID() << " >>> Simulation truth : "
         << primary->GetG4code()->GetParticleName()
         << " " << primary->GetMomentum() << G4endl;

// if(HCE) // { // int n_hit = HHC1->entries(); // G4cout << "Target 1 has " << n_hit << " hits." << G4endl; // for(int i1=0;i1<n_hit;i1++) // { // ExN01TargetHit* aHit = (*HHC1)[i1]; // aHit->Print(); // } // } }

If I uncomment the commented piece the software crash when I run the command /run/beamOn. On the other hand when it is commented it seam working but there is a message:

<target/targetCollection> is not found

Therefore there is no output about the sensitive detector.

Could anybody help me about this?

Thanks Raffaello

1 None: Re: sensitive detector   (Makoto Asai - 15 Mar, 2006)
Question Question about Gamma Energy Deposition  Keywords: Gamma Energy Deposition
by <liustonline@gmail.com>,   01 Feb, 2006

In a program to get the energy deposition of Gamma ray(got from positron annihilation When output result like this:

...
G4cout << aStep->GetTrack()->GetTrackID() << "  " 
            << aStep->GetPreStepPoint()->GetKineticEnergy()/keV << "  "
            << aStep->GetPostStepPoint()->GetKineticEnergy()/keV << "  "
	    << aStep->GetDeltaEnergy() << "  "
	    << aStep->GetTotalEnergyDeposit() << "  " 
	    << stepProcessName << "  "
	    << trackProcessName << G4endl;
...

The output is:

... 2 510.99906 510.99906 0 0.090526 phot annihil ...

The photonelectric effect don't have energy deposition?

Thanks

Shitao

1 None: Re: Question about Gamma Energy Deposition   (Makoto Asai - 03 Apr, 2006)
Question how to get secondary particle information  Keywords: secondary particle energy deposit
by Manju Sudhakar <manjus@isac.gov.in>,   24 Jan, 2006
Hi .

I want to get the response of a detector to secondary particles produced when
high energy protons interact with shielding material around the detector.
I usually do it with UserSteppingAction.cc, but is there a way to do the 
same with SensitiveDectectors and Hits ??

What I want is the energy deposited in the detector due to the different 
secodaries produced, viz, neutrons, gammas .Will the result obtained using 
UserSteppingAction.cc be different from that using Sensitive Detectors and 
Hits ?
What is the advantage of using Sensitive Detectors and Hits over UserSteppingAction.cc
??

Thanks in advance.
Manju Sudhakar.
1 None: Re: how to get secondary particle information   (Vladimir IVANTCHENKO - 24 Jan, 2006)
(_ None: Re: how to get secondary particle information   (Manju Sudhakar - 25 Jan, 2006)
None Access to HitsCollection in EndOfRunAction  Keywords: HitsCollection, EndOfRunAction,ITuple
by Sylvia Studeny <sylvia.studeny@gsf.de>,   06 Dec, 2005

Hi,
I calculate the dose distibution in a voxeliesed Phantom. (To simplify, I
 took a cube consisting of little voxels first). I collect the dose in a
 HitsCollection-object.
I had the idea to write all the data of the HitsCollection in a ITuple.
I wanted to do this in EndOfRunAction, because there I'm sure all the 
calculations are finished. Unfortunately I have many problems accessing 
the HitsCollection there, because there are no Events left and the methode 
described in your Application-Developers-Manual (4.4.4 G4SDManager) doesn't 
work.
Can you tell me if my idea is working at all and how this can be achieved 
or if there is an example in which something simelar is done? (I looked 
there but found nothing fitting)
Thanks a lot
Sylvia

1 None: Re: Access to HitsCollection in EndOfRunAction   (Marc Verderi - 06 Dec, 2005)
2 None: Re: Access to HitsCollection in EndOfRunAction   (Makoto Asai - 06 Dec, 2005)
Question Problem with sensitivity of mother to doughter volumes   Keywords: Doughter volume is sensitive, but only for last mother volume layer. Problem with pointers?
by Petr Mikes <mikes@fzu.cz>,   24 Nov, 2005

I have some problem with sensitivity for mother and doughter volumes.

I have folowing Detector construction where logicSi is sensitive.

//----------------------------------------------------------
solidLayerAll = new G4Box("Layer_All", LayerThicknessAll/2, CalorSizeYZ/2,CalorSizeYZ/2);
logicLayerAll = new G4LogicalVolume(solidLayerAll, defaultMaterial,"Layer_All");
for (int i = 0; i<NbOfLayers1; i++)
{
posLayer = - i*LayerThicknessAll + CalorThickness/2 - LayerThicknessAll/2;
physiLayerAll = new G4PVPlacement(0,G4ThreeVector(posLayer,0,0),
	 			 logicLayerAll,
				 "Layer_All",
				 logicCalor,
				 false,
				 0);

}
//--------------------------------------------------------
solidLayer = new G4Box("Layer", LayerThickness/2, CalorSizeYZ/2,CalorSizeYZ/2);
logicLayer = new G4LogicalVolume(solidLayer, defaultMaterial,"Layer");
physiLayer = new G4PVPlacement(0,G4ThreeVector(LayerElThickness/2,0,0),
	 			 logicLayer,
				 "Layer",
				 logicLayerAll,
				 false,
				 0);

//--------------------------------------------
 G4double CrystalY = CalorSizeYZ/(nY);
 G4double CrystalZ = CalorSizeYZ/(nZ);

solidSi = new G4Box("Silicon", SiThickness/2, CrystalY/2, CrystalZ/2); logicSi = new G4LogicalVolume(solidSi,SiMaterial,"Silicon");

  G4int copyNo=0;
  G4double yTlate, zTlate;

   for (G4int j = 0; j < nY; j++)															
    {zTlate =-CalorSizeYZ/2+CrystalZ/2+j*CrystalZ;
     for (G4int i = 0; i < nZ; i++)
	{yTlate =-CalorSizeYZ/2+CrystalY/2+i*CrystalY;
	 physiSi = new G4PVPlacement(0,G4ThreeVector(-WThickness/2,yTlate,zTlate),logicSi,"Silicon",logicLayer,false,copyNo++);

	}
    }

And Si is sensitive:

//---------Senzitive Detector
  G4SDManager* SDman = G4SDManager::GetSDMpointer();
  SDman->AddNewDetector(EMCalorimetr);
  logicSi->SetSensitiveDetector(EMCalorimetr);

but the sensitivity for Si is set only for last layer.

When logicSi was doughter only of Calorimeter everything was ok. Is there some problem with poiners when I use this structure?

Thank you. Petr

1 None: Re: Problem with sensitivity of mother to doughter volumes   (Makoto Asai - 24 Nov, 2005)
1 Question: Re: Problem with sensitivity of mother to doughter volumes   (Petr Mikes - 28 Nov, 2005)
3 None: Re: Problem with sensitivity of mother to doughter volumes   (Luís Perles - 30 Nov, 2005)
Question How can I count all optical photons generated in each sensitive detector in my simulation?  by S.Fonseca UERJ/Brazil <sfonseca@uerj.br>,   10 Nov, 2005

 Hello, people

 How can I count all optical photons generated in each sensitive detector?

 Please, Would you make some suggest of this problems?

 best regards,

 Sandro Fonseca 
 Graduate student of State University of Rio de Janeiro (UERJ/Brazil)
  

Question daughter volumes not sensitive but should be pointed to?  Keywords: hits nested SD volumes daughter sensitive detector volumes
by Blair Smith <bmsmith@lsu.edu>,   07 Nov, 2005
The question is this:  Is there a G4 method for finding the deepest 
(top level) daughter volume at a given point?  Taking a G4ThreeVector 
in global cordinates and returning the top most physical volume at 
that point.  

(Consistent I think with confusing G4 terminology the 
"topmost" level is the deepest nested---which is the 0th level of the 
geometry tree.---to my mind nested hierarchies should have the World
volume as the "top" at level=0  but I guess G4 developers decided 
otherwise!  I think the "G4 User's Guide for App. Dev." should have a 
sentence or two about this because it caused me a lot of wasted time 
early on trying to test to see what "topmost" meant in relation to 
the geometry tree!)


A further question that I think has been covered but that I wish to 
clarify for certain is this: Is my following description of hits in 
nested SD volumes correct? 

My Description:
---------------
OK, I seem to find that my touchable history handle always starts with 
level=0 as the SD volume itself.  What if I need to know about the 
actual daughter subvolume that the hit occurs within?

When I set "/tracking/verbose 1" I can see all the daughter volumes in the 
output, but when I collect hits using ProcessHits() I only seem to be able
to access the geometry levels above the SD volume, not the deeper daughter 
levels that I'd like to also know about.

Earlier I posted a reply to message 18 for this topic (original post 
by I. Cornelius) in which I recounted a conversation with another geant 
user.  There I worried about Makoto's expert statement that daughter 
volumes do not inherit sensitivity.  Well, it turns out that upon 
actual experience I would say that Makoto was correct (I did not doubt 
that), but what pains me is that my interpretation was incorrect.

I had assumed that although daughter volumes might not inherit 
sensitivity they might yet at least be accessed by the touchable 
history.  It is still true that when a daughter volume's boundary
is crossed the SD calls ProcessHits() for the parent volume.  I see 
that in the log output. But within ProcessHits() it seems I loose
the information about any daughter volumes, unless I inspect by 
looking at the hit position and infer the deepest volume at 
that point by brute force inspection.

So rather than write code to look up a volume based upon position 
(is there a G4 method for that????) I will instead probably take 
the easy route of simply making all the daughter volumes sensitive
as needed, creating and maintaining of course more hit collections, 
which is a slight pain but not too burdensome.

***

One good thing that matches intuition is that it seems as though
when one has a SD volume inside a parent SD volume and a hit occurs
in the daughter SD volume, the ProcessHits() method only gets called 
ONCE and it gets called naturally for the daughter, not the parent.
Thus hits in nested SD volumes do not cause redundant calls to 
ProcessHits().  This is as I would've hoped!

You can then loop through all your hit collections knowing that 
you will not encounter the same hit more than once.



1 None: Re: daughter volumes not sensitive but should be pointed to?   (Makoto Asai - 08 Nov, 2005)
(_ Note: Re: daughter volumes not sensitive but should be pointed to?   (Blair Smith - 08 Nov, 2005)
Question What happens when a hit occurs in nested sensitive detector volumes?  Keywords: nested sensitive detector volumes ProcessHits()
by Blair Smith <bmsmith@lsu.edu>,   29 Oct, 2005

The question is, what will happen if I have say two volumes set as SD (using the same SD class) and one is a daughter volume of the other, say "logicModule" is a daughter of "logicHouse".

When a particle scatters in a physical placement of a logicModule what will happen? Will ProcessHit() get called for both of these sensitive volumes, or will ProcessHit() only get activated for the lower level daughter logicModule?

I ask because I would like to avoid setting up seperate hit collections and the behaviour I want is for each hit to activate ProcessHits() only once (and preferrably for the deepest embedded of the possibly nested sensitive volumes).

Regards,

Blair.

1 None: Re: What happens when a hit occurs in nested sensitive detector volumes?   (Makoto Asai - 05 Nov, 2005)
(_ Feedback: Re: What happens when a hit occurs in nested sensitive detector volumes?   (Blair Smith - 05 Nov, 2005)
Sad Quitting without error message when creating multiple Sensitive Detector volumes  Keywords: sensitive detector logical volumes segmentation error
by Blair Smith <bmsmith@lsu.edu>,   29 Oct, 2005

I need some help urgently!

In my Construct() method I am using a G4VSensitiveDetector class called CZTEcrdSD to set up a few volumes as sensitive regions. I want to use the same G4VHit class say CZTEcrdHit for storing hit collections for each sensitive detector. From reading previous posts I think this is OK. However, when I try to set up the sensitive regions in Construct() like this:

G4SDManager* SDman = G4SDManager::GetSDMpointer(); CZTEcrdSD* ecrdShieldSD = new CZTEcrdSD( "ECRD/Shield" ); SDman->AddNewDetector( ecrdShieldSD ); logicShield->SetSensitiveDetector( ecrdShieldSD ); CZTEcrdSD* ecrdHouseSD = new CZTEcrdSD( "ECRD/House" ); SDman->AddNewDetector( ecrdHouseSD ); logicHouse->SetSensitiveDetector( ecrdHouseSD ); CZTEcrdSD* ecrdAsicSD = new CZTEcrdSD( "ECRD/ASIC" ); SDman->AddNewDetector( ecrdAsicSD ); logicASIC->SetSensitiveDetector( ecrdAsicSD ); CZTEcrdSD* ecrdVoxelSD = new CZTEcrdSD( "ECRD/Voxel" ); SDman->AddNewDetector( ecrdVoxelSD ); logicVoxelElement->SetSensitiveDetector( ecrdVoxelSD );

I see that the CZTEcrdSD constructor gets executed twice, but after the second SD volume ecrdHouseSD = new CZTEcrdSD( "ECRD/House" ); constructor call my application quits. There is no error message given!

There does not appear to be any invocation of my

CZTEcrdSD::Initialize()

method, and the constructor exits seemlingly without error for the ecrdHouseSD, but my aplication never gets to the next line of code in Construct() which is the notification to the SDman:

SDman->AddNewDetector( ecrdHouseSD );

This line never gets executed, the application just halts without any given reason.

So I tried running under gdb. It said the error was a segmentation error, but I could not see what pointer address or assignment was causing the problem (I'm not very good at interpreting the gdb messages). Here is the gdb output:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -188163680 (LWP 4351)] 
0xf6fc3bb5 in G4LogicalVolume::SetSensitiveDetector (this=0x0, pSDetector=0x93b9818)
    at G4LogicalVolume.icc:281 
281       fSensitiveDetector = pSDetector;
(gdb) backtrace
#0  0xf6fc3bb5 in G4LogicalVolume::SetSensitiveDetector (this=0x0,
    pSDetector=0x93b9818) at G4LogicalVolume.icc:281 
#1  0xf6fc0224 in CZTDetectorConstruction::Construct (this=0x9396518)
    at src/CZTDetectorConstruction.cc:704 
#2  0xf56ff0a0 in G4RunManager::InitializeGeometry (this=0x9385220)
    at src/G4RunManager.cc:322
#3  0xf56ff001 in G4RunManager::Initialize (this=0x9385220) at src/G4RunManager.cc:308
#4  0x0804ab16 in main (argc=1, argv=0xfee335d4) at simpleCZT.cc:181

As far as I can tell me geometry is OK, there were no overaps, and the logicHouse volume should be fine, I have no reason to doubt that it's SetSensitiveDetector method would not work.

One thing I worry about is that my LogicHouse has daughter volumes that I also want to set up as SD volumes.

If someone could give my a hint at how to fix this problem I'd be most grateful.

Thanks, Blair.

1 Question: Re: Quitting without error message when creating multiple Sensitive Detector volumes   (Blair Smith - 29 Oct, 2005)
Question How can I count all optical photons generated in each sensitive detector?  by S.Fonseca (DFNAE/UERJ/Brazil) <sfonseca@uerj.br>,   24 Oct, 2005

Hello, people

How can I count all optical photons generated in each sensitive detector?

Please, Would you make some suggest of this problems?

best regards,

Sandro Fonseca 
Graduate student of State University of Rio de Janeiro (UERJ/Brazil)
 

Question Perfect detector   by Adrian Sevcenco <Adrian Sevcenco>,   22 Sep, 2005

Hi! i need (i think)to define a perfect detector. I mean that i am interested only physical process of interaction of neutrons with a iron plate and i want to record everything that comes out. i am not sure how to do it. Have someone an ideea ?

Question Secondary particle identification for a hit  Keywords: Particle identification
by Greg <garobison@manchester.edu>,   08 Aug, 2005

Hello to all,

I'm just an lowly REU student trying to get a Geant 4 simulation to run. I am looking at the decay of a muon as it passes through a series of drift chambers and copper plates. I'm haveing trouble figuring out how to get Geant to tell me whether a hit was caused by the muon or by the daughter electron (positron). I tried implimenting in my Hit.hh:

public:
   G4ParticleDefinition * the ParticleType;
...
   inline G4ParticleDefinition * GetParticleType() const {return theParticleType;}
   virtual G4ParticleDefinition* GetDefinition() const {return theParticleType;}

Then in my Hit.cc:

   const Hit& Hit::operator=(const Hit &right)
{
   ...
   theParticleType = right.GetDefinition();
}

But when I print theParticleType, all that I get are 0's. Unfortunately, my knowledge of C++ is limited, so I don't really know what to do (I snitched most of this coding from an example).

Any help would be appreciated.

Cheers, Greg

Question Identifying secondary particles associated with a hit  Keywords: Particle identification
by Greg <garobison@manchester.edu>,   08 Aug, 2005

Hello to all,

I'm just an lowly REU student trying to get a Geant 4 simulation to run. I am looking at the decay of a muon as it passes through a series of drift chambers and copper plates. I'm haveing trouble figuring out how to get Geant to tell me whether a hit was caused by the muon or by the daughter electron (positron). I tried implimenting in my Hit.hh:

public:
   G4ParticleDefinition * the ParticleType;
...
   inline G4ParticleDefinition * GetParticleType() const {return theParticleType;}
   virtual G4ParticleDefinition* GetDefinition() const {return theParticleType;}

Then in my Hit.cc:

   const Hit& Hit::operator=(const Hit &right)
{
   ...
   theParticleType = right.GetDefinition();
}

But when I print theParticleType, all that I get are 0's. Unfortunately, my knowledge of C++ is limited, so I don't really know what to do (I snitched most of this coding from an example).

Any help would be appreciated.

Cheers, Greg

None Energy of particle at each G4TrajectoryPoint  Keywords: Help/G4TrajectoryPoint/Energy of particle
by Steve Boyd <boyd@farfalle.phyast.pitt.edu>,   24 Jun, 2005

Hi all,

Potentially silly question from a G4 novice - is there any way to find out the energy of a particle at each of its G4TrajectoryPoints? The class contains the spatial position, but not momentum/energy....

1 None: Re: Energy of particle at each G4TrajectoryPoint   (Makoto Asai - 04 Aug, 2005)
None Energy of particle at each G4TrajectoryPoint  Keywords: Help/G4TrajectoryPoint/Energy of particle
by Steve Boyd <boyd@farfalle.phyast.pitt.edu>,   24 Jun, 2005

Hi all,

Potentially silly question from a G4 novice - is there any way to find out the energy of a particle at each of its G4TrajectoryPoints? The class contains the spatial position, but not momentum/energy....

Question neutron detector  Keywords: neutron detector
by <maryam@jlab.org>,   08 Jun, 2005

Dear all,
 I have recently been working with sensitive detectors and outputting their hit collection. 
However, my detector does not detect any neutrons!
 I basically used example N02 (trackerSD & trackerHit) as a guide to build my detector. 
Can anyone help me figure out how to make it neutron sensitive?
 I appreciate any small tip :)

Many thanks in advance,

Maryam

None Changing/Managing Sensitive Detectors  by Ben Morgan <Ben Morgan>,   18 May, 2005

Hi,

I've been writing an application using the N03 example as a model to change the geometry of my detector between runs. However, the nature of the simulation means that the number and type of the sensitive detectors used should also change as different detectors are changed. For instance, I might change the SD of a germanium crystal from one that simply records the energy deposited to one that records energy, time and position.

The problem is that I'm not sure how to correctly manage sensitive detectors in G4SDManager. Unlike the geometry stores (G4LogicalVolumeStore etc), there's no equivalent G4SDManager::Clean() method, and I can't delete the singleton instance of G4SDManager without incurring a segmentation fault (simply deleting the instance returned by GetSDMpointer or GetSDMpointerIfExist). So my question is what's the correct way to manage changes in the type and setup of sensitive detectors between runs? I'd be most grateful for any help or suggestions! Thanks,

Ben Morgan.

Question Who's responsible for deletion of hits and hits collection objects?  Keywords: deletion of hit and hits collection objects
by Kazuyoshi Furutaka <Kazuyoshi Furutaka>,   09 Mar, 2005
Dear all.

Who's responsible for deletion of hit and/or hits collection
objects which are new'ed in e.g. the user implementation of the
G4VSensitiveDetector (say in ProcessHits() method)?

Are they automagically deleted somewhere in the toolkit routine?

Or one has to write a fragment of code to delete them by him/herself?
(for example in G4VSensitiveDetector::EndOfEvent() or
G4UserEventAction::EndOfEventAction()?)
If so, where's the best place to do it?
What is the standard way?

Some geant4 executables are killed by the oom-killer
on my Linux system (Fedora core 3, g++/libstdc++ ver.3.4.2)
when run with millions of events, and I suspect memory
is leaking.

Thank you in advance.

Yours,
Kazuyoshi
1 None: Re: Who's responsible for deletion of hits and hits collection objects?   (Makoto Asai - 09 Mar, 2005)
(_ Question: Re: Who's responsible for deletion of hits and hits collection objects?   (Kazuyoshi Furutaka - 10 Mar, 2005)
(_ None: Re: Who's responsible for deletion of hits and hits collection objects?   (michel maire - 11 Mar, 2005)
(_ None: Re: Who's responsible for deletion of hits and hits collection objects?   (Kazuyoshi Furutaka - 11 Mar, 2005)
(_ Note: Re: Who's responsible for deletion of hits and hits collection objects?   (Kazuyoshi Furutaka - 13 Mar, 2005)
Question The better place to GetCollectionID()  Keywords: GetCollectionID()
by Kazuyoshi Furutaka <Kazuyoshi Furutaka>,   08 Mar, 2005
Hi all.

Which is the better place to invoke G4SDManager->GetCollectionID()
in a user event action class, in its constructor? or in the
BeginOfEventAction()?

I've tested using examples/novice/N02 and examples/extended/analysis/A01.
In the constructor of the former example, I couldn't get the correct
ID, while in the latter I could.
Are there any differences in the two examples?
(In both case I could obtain the correct ID in BeginOfEventAction())

Many thanks in advance.
Kazuyoshi
1 None: Re: The better place to GetCollectionID()   (Makoto Asai - 08 Mar, 2005)
1 Ok: Re: The better place to GetCollectionID()   (Kazuyoshi Furutaka - 09 Mar, 2005)
3 None: Re: The better place to GetCollectionID()   (Makoto Asai - 08 Mar, 2005)
Question Loops in A01EventAction (hits in multiply placed volume?)  Keywords: hits in multiply placed volume
by Kazuyoshi Furutaka <Kazuyoshi Furutaka>,   04 Mar, 2005
Hi all...

Would someone please explain why we need loops
which run "the number of multiple placement of
volumes"-times in A01EventAction of
examples/extended/analysis/A01 ?
(I'm afraid I don't understand concept of sensitive 
detectors and hit collections...)

In the example, there're 5 layers in the drift chamber 1,
which are physically placed using a loop.
Inside each layer there's a "virtual" wire plane, which
is placed once in the logical volume of the chamber and
is set as a sensitive detector.

So I thought that there's only one sensitive detector
for 5 layers; all hits in the virtual wire plane are 
in the corresponding hit collection, and the number of 
hits in the collection (for all the 5 layers) is equal
to 'n_hit = DHC1->entries()'.

Why do we need the outer loops in the following to
process hits in the drift chamber 1?:
  for(int i2=0;i2<5;i2++)
  {
    for(int i1=0;i1<n_hit;i1++)
    {
       (process each hit....)
    }
  }
It looks to me as counting of the same hits 5 times.

Thanks in advance.

Kazuyoshi
1 None: Re: Loops in A01EventAction (hits in multiply placed volume?)   (Makoto Asai - 07 Mar, 2005)
(_ Feedback: Re: Loops in A01EventAction (hits in multiply placed volume?)   (Kazuyoshi Furutaka - 07 Mar, 2005)
Question segmentation fault for sensitive detector  Keywords: segmentation fault for sensitive detector
by Petr Mikes <p.mikes@seznam.cz>,   02 Feb, 2005

Hello Everybody, I modified example N03 to be sensitive for hits. I used code from example N05. I changed geometry for one segment...

solidGap   = new G4Box("solidGap", GapThickness/2, CalorSizeYZ/2, CalorSizeYZ/2);
logicGap   = new G4LogicalVolume(solidGap,GapMaterial, "logicGap", 0,0,0);
physiGap   = new G4PVPlacement(0,
                 G4ThreeVector(),
		 		logicGap,
				GapMaterial->GetName(),
				logicCalor,
				false,
				0);

  G4int nY = 4;											//Pocet Detekcnich bloku Y
  G4int nZ = 4;											//Pocet Detekcnich bloku Z

  G4double CrystalX = AbsorberThickness/2;
  G4double CrystalY = CalorSizeYZ/(nY);
  G4double CrystalZ = CalorSizeYZ/(nZ);
  solidAbsorber     = new G4Box("solidAbsorber", CrystalX, CrystalY/2, CrystalZ/2);
  logicAbsorber     = new G4LogicalVolume(solidAbsorber,AbsorberMaterial,
					    "logicAbsorber", 0, 0, 0);

  G4String tName1("Crystal");	// Allow all target physicals to share

  // -- and placements inside the calorimeter:
  G4PVPlacement *physiAbsorber;
  G4int copyNo=0;
  G4double yTlate, zTlate;
  for (G4int j = 0; j < nZ; j++)
    {
      zTlate =-CalorSizeYZ/2+CrystalZ/2+j*CrystalZ;
     for (G4int i = 0; i < nY; i++)
	{
	  yTlate =-CalorSizeYZ/2+CrystalY/2+i*CrystalY;
	  physiAbsorber = new G4PVPlacement(0,G4ThreeVector(10,yTlate,zTlate),
    				logicAbsorber,
				AbsorberMaterial->GetName(),
				logicCalor,false,copyNo++);
	}
    }

It works for one segment. But when I changed nY and nZ for more than 1 it will show me segmention fault but geometry is ok. Does somebody help me where I can loo for a mistake.

1 None: Re: segmentation fault for sensitive detector   (Makoto Asai - 02 Feb, 2005)
(_ None: Re: segmentation fault for sensitive detector   (Petr Mikes - 04 Feb, 2005)
Question Access to hits collection  by Vlasios Vasileiou <Vlasios Vasileiou>,   25 Jan, 2005

I want to access my hits collections from myEventAction:EndOfEvent().

I suppose I could start with evt->GetHCofThisEvent()->GetHC(0) which returns a VHitsCollection

but the only info I can get from it is it's name and the SD name.

So my question is,

how can I access my hit collections from outside mySD classes?

Thanks

1 None: Re: Access to hits collection   (Jeremy McCormick - 27 Jan, 2005)
Question ProcessHits() problem in sensitive detector  Keywords: processhit, sensitive detector
by Wah-kai Ngai <Wah-kai Ngai>,   13 Jan, 2005

I am trying to implement a sensitive detector which is supposed to be a PMT. I have tried to follow Example4 to implement. I notice one thing that the ProcessHits() method will only be invoked when a particle enters the sensitive detector area. Am I right?

If so, what is the reason for the ProcessHits() method not being invoked if I am sure there are particles going inside the sensitive detector.

Thanks!

Wah-kai

1 None: Re: ProcessHits() problem in sensitive detector   (Jeremy McCormick - 14 Jan, 2005)
(_ None: Re: ProcessHits() problem in sensitive detector   (Wah-kai Ngai - 17 Jan, 2005)
(_ None: Re: ProcessHits() problem in sensitive detector   (Jeremy McCormick - 19 Jan, 2005)
None Untitled  by Wah-kai Ngai <Wah-kai Ngai>,   13 Jan, 2005

I am trying to implement a sensitive detector which is supposed to be a PMT. I have tried to follow Example4 to implement. I notice one thing that the ProcessHits() method will only be invoked when a particle enters the sensitive detector area. Am I right?

If so, what is the reason for the ProcessHits() method not being invoked if I am sure there are particles going inside the sensitive detector.

Thanks!

Daniel

1 None: Re: Untitled   (Makoto Asai - 06 Feb, 2005)
Question Hit Collection for multiple Sensitive Detectors  Keywords: hit collection, sensitive detector
by Matt Orr <orrm@uah.edu>,   12 Jan, 2005

I have a question regarding the Hit Collection when you have multiple sensitive detectors (SDs).

At the moment I have two identical PMTs set as SDs. Since they both have all of the same properties (except their position) I would like to use the same SD file for both PMTs and just have them inherit the properties from that file (initially I had two separate SD files for the two separate SDs). My problem is that I don't know how to give the two different SDs separate Hit Collections since the Hit Collection is defined in the SD file (and they both share the same file).

From looking at the LXe example it would appear that the Hit Collection is an array where each element of that array corresponds to a particular SD. Is this correct? If not, how can I have two SDs share the same SD file and still have separate Hit Collections?

Thanks for the help.

	- Matt Orr - 

1 None: Re: Hit Collection for multiple Sensitive Detectors   (Jeremy McCormick - 12 Jan, 2005)
Question why the time is so small   Keywords: time
by qp <qpzhong2002@yahoo.com.cn>,   07 Jan, 2005

Hi all users and Prof.

3.39314e-267 (nsec),?? I want to get tof of the particle, and I get it. But the time why is 3.39314e-267 (nsec)?

I want to know, something can give me the unexpectable result? I hope someone there is experience like this, and can give me the guide. what is the wrong?

Thank you very much for your concern.

Best Wishes from qp

Question How can I shoot gamma as Isotropic and parralel source on my Detector  Keywords: How can I shoot gamma as Isotropic and parralel source on my Detector
by jamil <jamil>,   02 Jan, 2005

Dear All,

Merry x-mass and Happy new year to all.

I am simulation gamma particle response on my Detector(RPC).

I want to shoot gamma as Isotropic source and Parallel source and then find out my detector response.

For Isotropic (gamma) I want to shoot gamma from theta_min=0 degree to theta_max=360

For Isotropic (gamma) I want to simulate from theta_min=0 to thta_max=90

Pls help me how can I do it.

Where in the examples I can find some helping src files.

which files and code lines I have to change?

Will be waiting for the reply,

cheers! jamil

Question Untitled  Keywords: How can I shoot gamma as Isotropic and parralel source on my Detector
by jamil <jamil>,   02 Jan, 2005

Dear All,

Merry x-mass and Happy new year to all.

I am simulation gamma particle response on my Detector(RPC).

I want to shoot gamma as Isotropic source and Parallel source and then find out my detector response.

For Isotropic (gamma) I want to shoot gamma from theta_min=0 degree to theta_max=360

For Isotropic (gamma) I want to simulate from theta_min=0 to thta_max=90

Pls help me how can I do it.

Where in the examples I can find some helping src files.

which files and code lines I have to change?

Will be waiting for the reply,

cheers! jamil

Question How to add some files in my code  Keywords: Geant4 Code help
by jamil <jamil>,   20 Dec, 2004

Dear all GEANT4 Users,
Hi !
 I need some help to built some files in my code;

I have built the code in GEANT4, I am getting the hits values in two sensitive gas gaps,

As Sensitive gas gap 1

and Sensitive Gas gap 2

         I want to make my calculations in        Gas gap 1

                                                  Gas gap 2

                                                  Gas gap 1 and 2

                                                  and Gas gap 1 Or gas gap 2.

I found in my G321 code I have these defined in GUSTEP.f and GUOUT.f

Which are givem as;

================================================================ SUBROUTINE GUSTEP

common / iprimary / iflag_prim

common / iflag_1 / iflag1,iflag2

common /iflag_2 /iflag_and,iflag_or

call hf2(21,vect(1),vect(2),1.)

call hf2(22,vect(1),vect(3),1.)

call hf2(23,vect(2),vect(3),1.)

if(ngkine.GT.0) call gsking(0) ! traccia tutti i secondari

if(ntmult.eq.1.and.ipart.eq.ikine) then ! primary particle gamma

iflag_prim = 1

endif

c particlle secondarie

c

if(ipart.eq.ikine) then

if(inwvol.eq.1.and.numed.eq.14) then

call hf1(30,GEKIN,1.)

endif

endif

if(abs(charge).gt.0) then ! solo particelle secondarie cariche

c I gap

c

if(inwvol.eq.1.and.numed.eq.1) then

iflag1=1

endif ! fine I gap

c II gap

c

if(inwvol.eq.1.and.numed.eq.2) then

iflag2=1

endif ! fine II gap

c

endif ! fine solo particelle secondarie cariche

c

C I AND II

C

if (iflag1.eq.1.and.iflag2.eq.1) then

iflag_and=1

endif

C

C

C I OR II

if(iflag1.eq.1) then

iflag_or = 1

endif

c call gdebug

END

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

c----------------------------------------------------------------------------

subroutine guout

COMMON /GCNUMX/ NALIVE,NTMSTO

common / iprimary / iflag_prim

common / iflag_1 / iflag1,iflag2

common /iflag_2 /iflag_and,iflag_or

common / itracce / nprim,isign1,isign2,isign_and,isign_or

if (iflag_prim.eq.1) then

nprim = nprim + 1

iflag_prim = 0

endif

if (iflag1.eq.1) then

isign1=isign1+1

iflag1=0

call hf2(24,vect(1),vect(2),1.)

call hf2(25,vect(1),vect(3),1.)

call hf2(26,vect(2),vect(3),1.)

endif

C

if (iflag2.eq.1) then

isign2=isign2+1

iflag2=0

call hf2(27,vect(1),vect(2),1.)

call hf2(28,vect(1),vect(3),1.)

call hf2(29,vect(2),vect(3),1.)

endif

C

if(iflag_and.eq.1)then

isign_and=isign_and+1

iflag_and=0

endif

C

if(iflag_or.eq.1)then

isign_or=isign_or+1

iflag_or=0

endif

return

end

I hope you will help me, I am waiting for your reply, jamil

Question Optical surface efficiency  Keywords: optical, efficiency
by Matt Orr <orrm@uah.edu>,   18 Nov, 2004

I have two questions regarding optical photon detection at a surface:

1) I've noticed that there are fluctations about the user specified efficiency value entered as an optical surface property. Specifically the efficiency appears NOT to be a simple multiplicative factor. I assume the fluctuations about this specified mean are Poisson in nature. Can this be confirmed as there is no documentation I have found that clarifies this?

2) I understand that I can give the efficiency as a function of optical photon energy. Is the efficiency array treated as a histogram (constant mean between array entries) or is there interpolation between array values?

Any information regarding this is very much appreciated. Thanks.

- Matt Orr -

1 Feedback: Re: Optical surface efficiency   (Peter Gumplinger - 10 Jan, 2005)
Question Detector Efficiency  Keywords: Detector Efficiency
by jamil <jamil>,   11 Nov, 2004

Dear All G4 Users,
I have code For Gamma simulation passing through my detectors (sensitive detector two gas gaps), I have passes 20 events through them, and got some 
just transportation of gammas and some particle interaction signals;
 as gamma pass through the RPC with 3GeV energy;
the results are as under:
Event: 0
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 1
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 2
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 3
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 4
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 5
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 6
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 7
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 8
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 9
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 10
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 11
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 12
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 13
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 14
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: e+ process: eIoni trackID: 3 energy deposit: 0.162143 keV
   hit in gas gap 2:  particle: e+ process: Transportation trackID: 3 energy deposit: 1.5138 keV
   hit in gas gap 2:  particle: e- process: eIoni trackID: 4 energy deposit: 10.1425 keV
   hit in gas gap 2:  particle: e- process: Transportation trackID: 2 energy deposit: 2.48988 keV
   hit in gas gap 2:  particle: e- process: Transportation trackID: 8 energy deposit: 1.42578 keV
Event: 15
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 16
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: e+ process: Transportation trackID: 3 energy deposit: 1.26141 keV
   hit in gas gap 1:  particle: e- process: Transportation trackID: 2 energy deposit: 3.19299 keV
   hit in gas gap 2:  particle: e+ process: Transportation trackID: 3 energy deposit: 3.88676 keV
   hit in gas gap 2:  particle: e- process: eIoni trackID: 5 energy deposit: 0.0940122 keV
   hit in gas gap 2:  particle: e- process: Transportation trackID: 5 energy deposit: 3.08192 keV
   hit in gas gap 2:  particle: e- process: eIoni trackID: 7 energy deposit: 1.52549 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 4 energy deposit: 0 keV
   hit in gas gap 2:  particle: e- process: Transportation trackID: 2 energy deposit: 2.2417 keV
Event: 17
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 18
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
Event: 19
   primary gamma position (0/0/-200)
   primary gamma momentum direction (0/0/1)
   primary gamma energy 3 GeV
   hit in gas gap 1:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV
   hit in gas gap 2:  particle: gamma process: Transportation trackID: 1 energy deposit: 0 keV

As I want to pass 10000 gammas and find the detector efficiency as; sen= Ni/No

 Where Ni= Number of charged particles reaching any of the GAS Gap I or IIin my RPC( detector) No is the number of orignal primary particles impinging on the RPC detector.

 1) where and in which Class I can define this efficiency formula? and How to define it?

Any suggestion , comments are welcomed.

Jamil

None Detection of particles going through a surface  by <benjamin.cocquelin@cea.fr>,   10 Nov, 2004

Hi!

I'm trying to simulate Cerenkov effect. I generate gamma inside a box filled with CO2 which generate electrons and optical photons. I'd like to get severals informations about these particles. From now on, I made a volume outside my box and I detected each particle going through it but when I put it in another volume, for example in the CO2 radiator, no particle is detected. There may be a conflict between two volumes at the same place...

How can I detect what's going on at different positions in a volume? Should I make a sensitive detector? Is there sensitive surface that can be placed in existing volumes?

Thanks for any help!

Question Where to define the Hits Collection class  Keywords: How To define the hits class
by jamil <mjamilbal@yhaoo.com>,   08 Nov, 2004

Dear all G4 fans,

Where I can get collection of hits, to my sensitive detector, In which class either separate calss or in detectorConstruction.cc class.

I will appreciate your help.

Jamil

Question How To define the Detector Efficiency  Keywords: How To define the Detector Efficiency in Which class and How?
by jamil <jamil>,   31 Oct, 2004

Hi ! Everybody, I dont know Why no body is helping, I am sending again my question may be some body help.

I hope this time I will be lucky to get an answer.

I have the following Detector set up which is like as:
                          0.005, // GND(copper)
                          0.100,//insulator
                          0.200, // bakelite1 ****
                          0.200, // Gas Gap I
                          0.200, // bakelite2 ****
                          0.000, //insulator
                          0.050, // strips(copper)
                          0.050, //base(bakelite)
                          0.050, //insulator
                          0.200, // bakelite3 ****
                          0.200, // Gas Gap II
                          0.200, // bakelite4 ****
                          0.100,Insulator
                          0.005  // GND(copper)
I want to simulate gamma particles in my sensitive
detector;
The Gas Gap I 
The Gas Gap II
which are the three regions of my sensitive detector.

I want to pass 10000 gammas and find the detector efficiency as; sen= Ni/No Where Ni= Number of charged particles reaching any of the GAS Gap I or IIin my RPC( detector) No is the numbr of orignal primary particles impinging on the RPC detector. 1) where and in which Class I can define this efficiency formula? and How to define it?

2) Because ,I want to plot the efficieny(my detector sensitivity) vs gamma energy graph( at different energy scales).

With best Wishes and regards.

Thanks for helping,

With best Wishes,

M. Jamil

1 None: How To define the Detector Efficiency   (jamil - 07 Nov, 2004)
Question Detector Efficiency( Sensitivity counts)  by jamil <jamil>,   20 Oct, 2004

Hi ! 
how you doing, I am beginner of G4.
I have the following Detector set up which is like as:
                          0.005, // GND(copper)
                          0.100,//insulator
                          0.200, // bakelite1 ****
                          0.200, // Gas Gap I
                          0.200, // bakelite2 ****
                          0.000, //insulator
                          0.050, // strips(copper)
                          0.050, //base(bakelite) 
                          0.050, //insulator
                          0.200, // bakelite3 ****
                          0.200, // Gas Gap II
                          0.200, // bakelite4 ****
                          0.100,Insulator
                          0.005  // GND(copper)
I want to simulate gamma particles in my sensitive detector;Which are

The Gas Gap I

Strips(copper)( copper strips I took as the charged particle get detected on it)

The Gas Gap II,

which are the three regions of my sensitive detector, 1) Should I use the calorimetr types sensitive detector Or the Tracker types detector? Which one would be better for this kinds of simulation work?

I want to pass 10000 gammas and find the detector efficiency as; sen= Ni/No Where Ni= Number of charged particles reaching any of the GAS Gap I or IIin my RPC( detector) No is the numbr of orignal primary particles impinging on the RPC detector.

2) I want to plot the efficieny(my detector sensitivity) vs gamma energy graph( at different energy scales).How to do it?

Pls guide me step by step, as I am new in this field, how to make mine code and do some changes;I have already made my detector geometry.

I am sorry If I have sent wrong questions to this forum of hits,digitization and pile up group.

Hope you will help me and give me some suggestions!

With best Wishes,

Jamil,

None detector efficiency shifted by 1.5cm  by micheal <micheal>,   29 Sep, 2004

Hello,
       I got a question. I stimulated the effiency of a lo-ax detector from Ortec with
diameter of 70 mm and z of 30 mm with gamma. The program is a combined of TestEm4 and TestEm3

Then I compare it to an experimental data of 137Cs source from the detector at various distances. The stimulation gave 30% counts more than experiment. I did include distance of Ge crystal from window = 4mm. However, If i shift the experimental distance by 1.5cm, the data fits theory.

funny the deltaz in the code is 1.5cm

The distance in gun I took to be (0,0,1.5 + z cm) where z is the distance from source to face of cylinder.

PrimaryGeneratorAction.cc

Detector construct.cc -----------------------------------------------------------------------

#include "DetectorConstruction.hh"
#include "DetectorMessenger.hh"
#include "G4Tubs.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4UserLimits.hh"

#include "G4GeometryManager.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4SolidStore.hh"

#include "G4UnitsTable.hh"
#include <iomanip>

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

DetectorConstruction::DetectorConstruction()
:defaultMaterial(0),solidWorld(0),logicWorld(0),physiWorld(0),
 solidCalor(0),logicCalor(0),physiCalor(0),
 solidLayer(0),logicLayer(0),physiLayer(0),
 magField(0)
{
  //--------------------------------------------------------------------
  // default parameter values of the calorimeter
  NbOfAbsor = 2;
  //AbsorThickness[0] = 5.0*mm;
  Rmin[0] = 0.000*cm;
  Rmax[0] = 3.525*cm;
  Rmin[1] = 3.525*cm;
  Rmax[1] = 3.625*cm;
  //Rmin[2] = 0.00*cm;
  //Rmax[2] = 0.40*cm;
  deltaZ[1] = 1.48*cm;
  deltaZ[2] = 5.5*cm;
  //deltaZ[3] = 0.15*cm;
  //AbsorThickness[1] = 5.0*cm;
  NbOfLayers        = 1;
  CalorSizeYZ       = 40.*cm;
  ComputeCalorParameters();

  // materials
  DefineMaterials();
  SetWorldMaterial("Galactic");
  SetAbsorMaterial(1,"Aluminium");
  SetAbsorMaterial(0,"HPGe");
  //SetAbsorMaterial(0,"Aluminium");
  //SetAbsorMaterial(1,"HPGe");
  //SetAbsorMaterial(2,"Aluminium");
  //SetAbsorMaterial(2,"Galactic");
  //------------------------------------------------------------------------------------
  // create UserLimits
  userLimits = new G4UserLimits();

  // create commands for interactive definition of the calorimeter
  detectorMessenger = new DetectorMessenger(this);
}

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

DetectorConstruction::~DetectorConstruction()
{
  delete userLimits;
  delete detectorMessenger;
}

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

G4VPhysicalVolume* DetectorConstruction::Construct()
{
  return ConstructCalorimeter();
}

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

void DetectorConstruction::DefineMaterials()
{
 //This function illustrates the possible ways to define materials

  //
  // define Elements
  //
  G4double z,a;

  G4Element* H  = new G4Element("Hydrogen",  "H" , z= 1.,  a= 1.008*g/mole);
  G4Element* C  = new G4Element("Carbon",    "C" , z= 6.,  a= 12.01*g/mole);
  G4Element* N  = new G4Element("Nitrogen",  "N" , z= 7.,  a= 14.01*g/mole);
  G4Element* O  = new G4Element("Oxygen",    "O" , z= 8.,  a= 16.00*g/mole);
  G4Element* Si = new G4Element("Silicon",   "Si", z= 14., a= 28.09*g/mole);
  G4Element* Ge = new G4Element("Germanium", "Ge", z= 32., a= 72.59*g/mole);
  G4Element* I  = new G4Element("Iodine",    "I" , z= 53., a= 126.90*g/mole);
  G4Element* Cs = new G4Element("Cesium",    "Cs", z= 55., a= 132.90*g/mole);
  G4Element* Bi = new G4Element("Bismuth",   "Bi", z= 83., a= 208.98*g/mole);

  //
  // define an Element from isotopes, by relative abundance
  //
  G4int iz, n;                       //iz=number of protons  in an isotope;
                                     // n=number of nucleons in an isotope;
  G4int   ncomponents;				     
  G4double abundance;				     

  G4Isotope* U5 = new G4Isotope("U235", iz=92, n=235, a=235.01*g/mole);
  G4Isotope* U8 = new G4Isotope("U238", iz=92, n=238, a=238.03*g/mole);

  G4Element* U  = new G4Element("enriched Uranium", "U", ncomponents=2);
  U->AddIsotope(U5, abundance= 90.*perCent);
  U->AddIsotope(U8, abundance= 10.*perCent);

  //
  // define simple materials
  //
  G4double density;

  new G4Material("liquidH2",    z=1.,  a= 1.008*g/mole,  density= 70.8*mg/cm3);
  new G4Material("Aluminium",   z=13., a= 26.98*g/mole,  density= 2.700*g/cm3);
  new G4Material("liquidArgon", z=18., a= 39.95*g/mole,  density= 1.390*g/cm3);
  new G4Material("Titanium",    z=22., a= 47.867*g/mole, density= 4.54*g/cm3);
  new G4Material("Iron",        z=26., a= 55.85*g/mole,  density= 7.870*g/cm3);
  new G4Material("Copper",      z=29., a= 63.55*g/mole,  density= 8.960*g/cm3);
  new G4Material("Tungsten",    z=74., a= 183.85*g/mole, density= 19.30*g/cm3);
  new G4Material("Gold",        z=79., a= 196.97*g/mole, density= 19.32*g/cm3);
  new G4Material("Lead",        z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
  new G4Material("Uranium",     z=92., a= 238.03*g/mole, density= 18.95*g/cm3);
  new G4Material("HPGe",        z=32., a= 72.59*g/mole,  density= 5.32*g/cm3);
  //
  // define a material from elements.   case 1: chemical molecule
  //
  G4int natoms;

  //
  // define a material from elements.   case 2: mixture by fractional mass
  //
  G4double fractionmass;

  G4Material* Air = 
  new G4Material("Air", density= 1.290*mg/cm3, ncomponents=2);
  Air->AddElement(N, fractionmass=0.7);
  Air->AddElement(O, fractionmass=0.3);

  G4Material* Air20 = 
  new G4Material("Air20", density= 1.205*mg/cm3, ncomponents=2,
                          kStateGas, 293.*kelvin, 1.*atmosphere);
  Air20->AddElement(N, fractionmass=0.7);
  Air20->AddElement(O, fractionmass=0.3);

  //
  // define a material from elements and others materials (mixture of mixtures)
  //

  G4Material* Aerog = 
  new G4Material("Aerogel", density= 0.200*g/cm3, ncomponents=3);
  Aerog->AddMaterial(SiO2, fractionmass=62.5*perCent);
  Aerog->AddMaterial(H2O , fractionmass=37.4*perCent);
  Aerog->AddElement (C   , fractionmass= 0.1*perCent);

  //
  // examples of gas in non STP conditions
  //
  G4double temperature, pressure;

  G4Material* CO2 = 
  new G4Material("CarbonicGas", density= 27.*mg/cm3, ncomponents=2,
                 kStateGas, temperature= 325.*kelvin, pressure= 50.*atmosphere);
  CO2->AddElement(C, natoms=1);
  CO2->AddElement(O, natoms=2);

  G4Material* steam = 
  new G4Material("WaterSteam", density= 0.3*mg/cm3, ncomponents=1,
                  kStateGas, temperature= 500.*kelvin, pressure= 2.*atmosphere);
  steam->AddMaterial(H2O, fractionmass=1.);

  //
  // examples of vacuum
  //

  density     = universe_mean_density;    //from PhysicalConstants.h
  pressure    = 3.e-18*pascal;
  temperature = 2.73*kelvin;
  new G4Material("Galactic", z=1., a=1.008*g/mole, density,
                             kStateGas,temperature,pressure);

  density     = 1.e-5*g/cm3;
  pressure    = 2.e-2*bar;
  temperature = STP_Temperature;         //from PhysicalConstants.h
  G4Material* beam = 
  new G4Material("Beam", density, ncomponents=1,
                         kStateGas,temperature,pressure);
  beam->AddMaterial(Air, fractionmass=1.);
}

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

void DetectorConstruction::ComputeCalorParameters()
{
  // Compute derived parameters of the calorimeter
     LayerThickness = 0.;
     for (G4int iAbs=0; iAbs<NbOfAbsor; iAbs++)
     LayerThickness += AbsorThickness[iAbs];
     CalorThickness = NbOfLayers*LayerThickness;

WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ; }

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

G4VPhysicalVolume* DetectorConstruction::ConstructCalorimeter()
{
  // complete the Calor parameters definition
  ComputeCalorParameters();

  // Cleanup old geometry
  G4GeometryManager::GetInstance()->OpenGeometry();
  G4PhysicalVolumeStore::GetInstance()->Clean();
  G4LogicalVolumeStore::GetInstance()->Clean();
  G4SolidStore::GetInstance()->Clean();

  //----------------------------------------------------------------------------
  //solidWorld = new G4Box("World",				//its name
  //                      WorldSizeX/2,WorldSizeYZ/2,WorldSizeYZ/2);	//its size
  //-------------------------------------------------------------------------------
 //Mother World
 //------------------------------------------------------------------------------
 //-Parameters for tubes
   G4double deltaZ= 1.48*cm, Phimin=0., deltaPhi=360*degree;

  solidWorld = new G4Tubs("World",
			   0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
  logicWorld = new G4LogicalVolume(solidWorld,		//its solid
                                   defaultMaterial,	//its material
                                   "World");		//its name

  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 operation
                                 0);			//copy number

  //solidCalor = new G4Box("Calorimeter",				     //its name
 //                     CalorThickness/2,CalorSizeYZ/2,CalorSizeYZ/2);//size
 //--------------------------------------------------------------------------
  // Calorimeter
  //

  solidCalor = new G4Tubs("Calorimeter",
			  0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
  logicCalor = new G4LogicalVolume(solidCalor,		//its solid
      				   defaultMaterial,	//its material
      				   "Calorimeter");	//its name

  physiCalor = new G4PVPlacement(0,			//no rotation
                                 G4ThreeVector(),	//at (0,0,0)
                                 logicCalor,		//its logical volume
                                 "Calorimeter",		//its name
                                 logicWorld,		//its mother  volume
                                 false,			//no boolean operation
                                 0);			//copy number

  //--------------------------------------------------------------------------------
  // Layers
  //

  //solidLayer = new G4Box("Layer",		                      //its name
 //                     LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size
  solidLayer = new G4Tubs("Layer",		                      //its name
                        0.0*cm,3.625*cm,1.48*cm,Phimin,deltaPhi);
  //LayerThickness/2,CalorSizeYZ/2,CalorSizeYZ/2); //size
  logicLayer = new G4LogicalVolume(solidLayer,		//its solid
                                   defaultMaterial,	//its material
                                   "Layer");		//its name
//if (NbOfLayers > 1)
// physiLayer = new G4PVReplica("Layer",		//its name
//		 logicLayer,		//its logical volume
//    				 logicCalor,		//its mother
//                               kXAxis,		//axis of replication
//                               NbOfLayers,		//number of replica
//                               LayerThickness);	//witdth of replica
//else
    physiLayer = new G4PVPlacement(0,			//no rotation
                                   G4ThreeVector(),	//at (0,0,0)
                                   logicLayer,		//its logical volume
                                   "Layer",		//its name
                                   logicCalor,		//its mother  volume
                                   false,		//no boolean operation
                                   0);			//copy number
    //-------------------------------------------------------------------------------------------
  //
  // Absorbers
  //

  //G4double xfront = -0.5*LayerThickness;
  for (G4int k=0; k<NbOfAbsor; k++)
    //{ solidAbsor[k] = new G4Box("Absorber",		//its name
    //                  AbsorThickness[k]/2,CalorSizeYZ/2,CalorSizeYZ/2);
       { solidAbsor[k] = new G4Tubs("Absorber",		//its name
                         Rmin[k],Rmax[k],deltaZ,Phimin,deltaPhi);//size;

      logicAbsor[k] = new G4LogicalVolume(solidAbsor[k],    //its solid
      			                  AbsorMaterial[k], //its material
      			                  AbsorMaterial[k]->GetName());

      logicAbsor[k]->SetUserLimits(userLimits);

      //G4double xcenter = xfront+0.5*AbsorThickness[k];
      //xfront += AbsorThickness[k];
      physiAbsor[k] = new G4PVPlacement(0,		   //no rotation
		       //G4ThreeVector(xcenter,0.,0.),      //its position
                        G4ThreeVector(),      //its position
                        logicAbsor[k],     		   //its logical volume	                    	
                        AbsorMaterial[k]->GetName(),	   //its name
                        logicLayer,        		   //its mother
                        false,             		   //no boulean operat
                        k);               		   //copy number

     }

  PrintCalorParameters();

  //always return the physical World
  //
  return physiWorld;
}

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

void DetectorConstruction::PrintCalorParameters()
{
  G4cout << "\n-------------------------------------------------------------"
         << "\n ---> The calorimeter is " << NbOfLayers << " layers of:";
  for (G4int i=0; i<NbOfAbsor; i++)
     {
      G4cout << "\n \t" << std::setw(12) << AbsorMaterial[i]->GetName() <<": "
              << std::setw(6) << G4BestUnit(AbsorThickness[i],"Length");
     }
  G4cout << "\n-------------------------------------------------------------\n";

  G4cout << "\n" << defaultMaterial << G4endl;    
  for (G4int j=0; j<NbOfAbsor; j++)
     G4cout << "\n" << AbsorMaterial[j] << G4endl;

G4cout << "\n-------------------------------------------------------------\n"; }

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

void DetectorConstruction::SetWorldMaterial(G4String material)
{
  // search the material by its name
  G4Material* pttoMaterial = G4Material::GetMaterial(material);
  if (pttoMaterial) defaultMaterial = pttoMaterial;
}

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

void DetectorConstruction::SetNbOfLayers(G4int ival)
{
  // set the number of Layers
  //
  if (ival < 1)
    { G4cout << "\n --->warning from SetNbOfLayers: "
             << ival << " must be at least 1. Command refused" << G4endl;
      return;
    }
  NbOfLayers = ival;
}

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

void DetectorConstruction::SetNbOfAbsor(G4int ival)
{
  // set the number of Absorbers
  //
  if (ival < 1 || ival > MaxAbsor)
    { G4cout << "\n ---> warning from SetNbOfAbsor: "
             << ival << " must be at least 1 and and most " << MaxAbsor
	     << ". Command refused" << G4endl;
      return;
    }
  NbOfAbsor = ival;
}

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

void DetectorConstruction::SetAbsorMaterial(G4int ival,G4String material)
{
  // search the material by its name
  //
  if (ival >= NbOfAbsor)
    { G4cout << "\n --->warning from SetAbsorMaterial: absor number "
             << ival << " out of range. Command refused" << G4endl;
      return;
    }

  G4Material* pttoMaterial = G4Material::GetMaterial(material);
  if (pttoMaterial) AbsorMaterial[ival] = pttoMaterial;
}

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

void DetectorConstruction::SetAbsorThickness(G4int ival,G4double val)
{
  // change Absorber thickness
  //
  if (ival >= NbOfAbsor)
    { G4cout << "\n --->warning from SetAbsorThickness: absor number "
             << ival << " out of range. Command refused" << G4endl;
      return;
    }
  if (val <= DBL_MIN)
    { G4cout << "\n --->warning from SetAbsorThickness: thickness "
             << val  << " out of range. Command refused" << G4endl;
      return;
    }
  AbsorThickness[ival] = val;
}

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

void DetectorConstruction::SetCalorSizeYZ(G4double val)
{
  // change the transverse size
  //
  if (val <= DBL_MIN)
    { G4cout << "\n --->warning from SetCalorSizeYZ: thickness "
             << val  << " out of range. Command refused" << G4endl;
      return;
    }
  CalorSizeYZ = val;
}

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

#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"

void DetectorConstruction::SetMagField(G4double fieldValue)
{
  //apply a global uniform magnetic field along Z axis
  //
  G4FieldManager* fieldMgr
   = G4TransportationManager::GetTransportationManager()->GetFieldManager();

  if(magField) delete magField;		//delete the existing magn field

  if(fieldValue!=0.)			// create a new one if non nul
  { magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
    fieldMgr->SetDetectorField(magField);
    fieldMgr->CreateChordFinder(magField);
  } else {
    magField = 0;
    fieldMgr->SetDetectorField(magField);
  }
}

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

void DetectorConstruction::SetMaxStepSize(G4double val)
{
  // set the maximum allowed step size
  //
  if (val <= DBL_MIN)
    { G4cout << "\n --->warning from SetMaxStepSize: maxStep "
             << val  << " out of range. Command refused" << G4endl;
      return;
    }
  userLimits->SetMaxAllowedStep(val);
}

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

#include "G4RunManager.hh"

void DetectorConstruction::UpdateGeometry()
{
  G4RunManager::GetRunManager()->DefineWorldVolume(ConstructCalorimeter());
}

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

Question hit question  Keywords: hit question
by Taylan Yetkin <tyetkin@fnal.gov>,   24 Aug, 2004

How can I use Tracker-like and Calorimeter-like hits at the same time? In CaloHit class we define SetEdep() and AddEdep() methods, but AddEdep() adds the edep as in the example novice/N05/. However I need to collect information of the positons let's say, how to do this?

// CaloHit
   inline void SetEdep(G4double de)
      { edep = de; };
   inline void AddEdep(G4double de)
      { edep += de; };
   inline G4double GetEdep()
      { return edep; };

//CaloSD

 if(CellID[copyID]==-1){
   ExN05CalorimeterHit* calHit =
   new ExN05CalorimeterHit(physVol->GetLogicalVolume());
   calHit->SetEdep( edep );
   calHit->SetPos(pos);
 }else{
    (*CalCollection)[CellID[copyID]]->AddEdep( edep );
     (*CalCollection)[CellID[copyID]]->SETPos(pos); ?????
 }

However I don't want to add (new+=pos) to the positions, I want to get individual positions as

//CaloEventAction
 if(CaloHC){ 
   int n_hit = CaloHC->entries();
   for(int i=0;i<n_hit;i++){
    CaloHit* aHit = (*CaloHC)[i];
    double a = aHit->GetEdep();
    double b = aHit->GetPos();
   }
  } 

 

Question Getting the initial energy of a particle that hit the detector?????  Keywords: Hit information, initial energy of particle
by Nicolas <nicolas.salem@polymtl.ca>,   27 Jul, 2004

Hi everyone,

           in my simulation, I am sending the following information about each hit to an output file:

Event #, Energy, Position of the hit

I would like to add to that information the initial energy of the particle which created that hit. How can I access to that information???

Thank you very much!

nicolas.salem@polymtl.ca

1 None: Re: Getting the initial energy of a particle that hit the detector?????   (Vladimir IVANTCHENKO - 28 Jul, 2004)
Question Can Geant4 simulates Plasma Focus experiment?  by San <San>,   24 Jun, 2004
Hi, I am new in Geant4 and am thinking of using Geant4 to simulate Plasma Focus experiment.
I hope the simulation can represent the particles and processes in the Plasma Focus device chamber, 
and be able to detect and specify the type of particles inside & outside of the chamber after triggering.
The working gas of this experiment can be deutrium gas.
I wish to know whether Geant4 is suitable to simulate such idea.

Hope to get some comments and ideas about this attempt.

Thank You!

Regards,
San
None Finding when a track enters a new volume in the readout geometry  by Trevor MacPhail <tmmacpha@triumf.ca>,   12 May, 2004

I would like to find out when a track is entering a new volume in a readout geometry. There is a sensitive detector attached to the volumes in the readout geometry and process hits gets called as the tracks pass through the various replicas. But asside from storing replica numbers and seeing when they change, is there a way to find this out?

1 None: neutron production and transport in BaBar detector   (William S. Lockman - 03 Jul, 2004)
Question How do I count the number of optical photons end in a reflective surface?  Keywords: optical photon, hits
by <nikx@astro.columbia.edu>,   20 Apr, 2004

In my simulation, a scintillator is located inside of a reflective surfaces. Once an event deposite energy in the scintillator, optical photons will be produced. The simulation program traces all the photons. Since the reflective surface is not 100%, I want to know how many photons are absorbed by the surface. While using G4HCofThisEvent, all the hits will be recorded, resulting a much larger number than the total number of photons. How can I just count the number of photon only when it get absorbed? Thanks!

Question Detecting optical photons  by Phil Matvey <phmatvey@yahoo.com>,   20 Apr, 2004
I'm a bit confused about how to use sensitive detectors when
the particle I need to detect is an optical photon. In my simulation,
I need to count photons hitting a steel box. I define the box as a
sensitive detector, but its ProcessHits function never gets called,
probably because box surface is treated as a dielectric-black material
boundary and the photon is stopped and killed without calling anything.
Defining an optical surface with zero reflectivity and 100% efficiency
doesn't help unless I also define a refraction index for steel - which
doesn't feel right, and will cause cerenkov photons beeng created inside 
the box, among other things.

What am I doing wrong ?

Thanks ...
1 None: Re: Detecting optical photons   (Vlasios Vasileiou - 22 Apr, 2004)
(_ None: Re: Detecting optical photons   (Phil Matvey - 23 Apr, 2004)
Question Multiple volumes as a single sensitive detector  by Kate Ross <kross@triumf.ca>,   19 Mar, 2004

Hello,

I'm wondering if it's possible to have different types of volumes be categorized as the same sensitive detector.

Specifically, I need to store hit information for Chambers, but the chambers have cells that can be one of two types of physical volumes. I eventually want to be able to access the ChamberHitsCollection to retrieve all hits for both of these types of volumes.

Any suggestions would be appreciated! If there is an example that I have overlooked which does this, please direct me to it. Thanks,

-Kate

1 None: Re: Multiple volumes as a single sensitive detector   (Vladimir IVANTCHENKO - 23 Mar, 2004)
Question Hits definition and Sensitive Detectors  Keywords: hits, sensitive detector
by Megan lehnherr <lehnherr@ku.edu>,   27 Jan, 2004

I'm having a bit of trouble figuring out what's going on with the hit collections. I have a calorimeter, and I wish to count the number of optical photons created in it. I was using a counter in StackingAction to keep track of the number. However, I'm trying to use the Hits to get information about particles.

Currently in my ProcessHits() function, all particles are neutral, which makes me think that somewhere a hit is defined as a neutral particle. Is this the case? And if so, where is a hit defined? Also, if I have different sections that would need different hit definitions, do I need to define a specific sensitive detector for each section?

Another thing that I'm confused about is that fact that currently for one event there are thousands of hits. How do I simply get the number of optical photons (or charged particles in another one of the sections) in a section of my calorimeter?

I hope this is clear enough. I would appreciate some direction. Thanks, Megan Lehnherr

1 None: Re: Hits definition and Sensitive Detectors   (Makoto Asai - 29 Jan, 2004)
Question Rayleigh scattering not getting counted  Keywords: Rayleigh Scattering
by Tom Lemeris <tlemeris@comptel.sr.unh.edu>,   26 Jan, 2004

Hello. I have a question about G4HitsCollection. It has come to my attention that Events that have the low energy Rayleigh Scattering physics process happening are not getting logged into the G4HitsCollection class. Is this normal or is there some way for me to make G4 count the the Rayleigh interactions as hits and put them in the G4Hits collection? Many Thanks.

Question EndOfEventAction and Hit information  Keywords: Hit s
by Taylan Yetkin <tyetkin@fnal.gov>,   29 Dec, 2003
Hi Everyone,

I'm filling a couple of histograms with total energy deposition inside 
calorimeter's one part by using the EndOfEventAction(). I defined my Hit and my 
Sensitive Detector classes for the relevant part of the detector. However I need 
to put a kind of cut for the particles which are hitting the sensitive 
detector: If the beta of the hitting particle is above from a certain value
fill 1st histogram, else fill 2nd histogram. To do this I need to reach particle's 
dynamical informations such as its total energy or its total momentum inside
 the EndOfEventAction(G4Event*) function. But I could'nt find a way
to reach that information just by using EndOfEventAction. If you have any idea 
could you please help me?

I tried one another thing: Inside my sensitive detector and hit classes definition I used 
another typedef for the desired beta cut

//MyDetHit.cc

typedef G4THitsCollection<MyDetHit> MyDetHitsCollection;  // for all hits with no cuts

typedef G4THitsCollection<MyDetHit> MyDetBetaHitsCollection; //for hits whic satisfy the condition  beta > aValue condition
....


//MyDetSD.cc


G4bool MyFiberBetaSD::ProcessHits(G4Step*,G4TouchableHistory*){
 .
 .
//By using the G4Step I reached the G4DynamicParticle and calculate the
// beta value for hits. 

if(pBeta > aValue){
     if(HCID[copyNo]==-1){
        MyDetHit* aHit = new MyDetHit();
        if(theDet == Detector->GetDet()) aHit->AddEdep(edep,stepl);
        HCID[copyNo] = DetBetaHitsCollection->insert(aHit) - 1;
        
     }else{
        if(theDet == Detector->GetDet())
           (*DetBetaHitsCollection)[HCID[copyNo]]->AddEdep(edep,stepl);
    }
 
}
.....
}

And then by using MyEventAction class I tried to fill histogram with Edep
which is calculated as above. Well, It didn't work
Question Bug in Hits Collection ??  Keywords: HitsCollection
by Sylvian Kahane <skahane@bgumail.bgu.ac.il>,   24 Dec, 2003
I have the following simple DetectorSD.cpp file in which I try to define 4
different hits collections corresponding to 4 physical volumes obtained
by different placements of the same logical volume:

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

#include "DetectorSD.hh"

#include "DetectorHit.hh"
#include "DetectorConstruction.hh"

#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"

#include "G4ios.hh"

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

DetectorSD::DetectorSD(G4String name, DetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
{
  collectionName.insert("Leaf1");
  collectionName.insert("Leaf2");
  collectionName.insert("Leaf3");
  collectionName.insert("Leaf4");
}

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

DetectorSD::~DetectorSD()
{;}

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

void DetectorSD::Initialize(G4HCofThisEvent*HCE)
{
  G4int CollID;

  Leaf1 = new DetectorHitsCollection(SensitiveDetectorName,collectionName[0]);
  Leaf1->insert(new DetectorHit());
  //CollID = GetCollectionID(collectionName[0]); 
  CollID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]); 
  HCE->AddHitsCollection(CollID,Leaf1);

  Leaf2 = new DetectorHitsCollection(SensitiveDetectorName,collectionName[1]);
  Leaf2->insert(new DetectorHit());
  //CollID = GetCollectionID(collectionName[1]); 
  CollID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[1]); 
  HCE->AddHitsCollection(CollID,Leaf2);

  Leaf3 = new DetectorHitsCollection(SensitiveDetectorName,collectionName[2]);
  Leaf3->insert(new DetectorHit());
  //CollID = GetCollectionID(collectionName[2]); 
  CollID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[2]); 
  HCE->AddHitsCollection(CollID,Leaf3);

  Leaf4 = new DetectorHitsCollection(SensitiveDetectorName,collectionName[3]);
  Leaf4->insert(new DetectorHit());
  //CollID = GetCollectionID(collectionName[3]); 
  CollID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[3]); 
  HCE->AddHitsCollection(CollID,Leaf4);
}

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

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

  G4TouchableHistory* theTouchable
    = (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());

  G4VPhysicalVolume* physVol = theTouchable->GetVolume(); 

  G4int copyNo;
  copyNo = theTouchable->GetReplicaNumber();

  if(copyNo==0) (*Leaf1)[0]->AddHit();
  if(copyNo==1) (*Leaf2)[0]->AddHit();
  if(copyNo==2) (*Leaf3)[0]->AddHit();
  if(copyNo==3) (*Leaf3)[0]->AddHit();

  return true;
}

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

void DetectorSD::EndOfEvent(G4HCofThisEvent* HCE)
{;}

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

void DetectorSD::clear()
{;}

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

void DetectorSD::DrawAll()
{;}

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

void DetectorSD::PrintAll()
{;}

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



In the run I am getting an error trigered by the line:

     if(copyNo==2) (*Leaf3)[0]->AddHit();

because it happened that copyNo=2. The error message is cryptical and
not usefull:

Unhandled exception at 0x0041d934 in SolidAngle2.exe: 0xC0000005: 
Access violation reading location 0xcdcdcdf9.


The debuger points to a location in the file g4thitscollection.hh and
gives the following assembly code:

  public: // with description

      inline T* operator[](size_t i) const

      { return (*((std::vector<T*>*)theCollection))[i]; }
0041D910  push        ebp  
0041D911  mov         ebp,esp 
0041D913  sub         esp,44h 
0041D916  push        ebx  
0041D917  push        esi  
0041D918  push        edi  
0041D919  push        ecx  
0041D91A  lea         edi,[ebp-44h] 
0041D91D  mov         ecx,11h 
0041D922  mov         eax,0CCCCCCCCh 
0041D927  rep stos    dword ptr [edi] 
0041D929  pop         ecx  
0041D92A  mov         dword ptr [ebp-4],ecx 
0041D92D  mov         eax,dword ptr [i] 
0041D930  push        eax  
0041D931  mov         ecx,dword ptr [this] 
0041D934  mov         ecx,dword ptr [ecx+2Ch] <-<-<-<- the debugger points here
0041D937  call        std::vector<DetectorHit *,std::allocator<DetectorHit *> >::operator[] (41DA00h) 
0041D93C  mov         eax,dword ptr [eax] 
0041D93E  pop         edi  
0041D93F  pop         esi  
0041D940  pop         ebx  
0041D941  add         esp,44h 
0041D944  cmp         ebp,esp 
0041D946  call        __chkesp (800C80h) 
0041D94B  mov         esp,ebp 
0041D94D  pop         ebp  
0041D94E  ret         4    


It seems that it has something to do with templates. I may add that
the method AddHit() I am trying to apply is a very simple hit counter:

              void AddHit () { nofHits += 1;};
              G4double GetnofHits() { return nofHits;


The program and all the libraries where compiled with VC++ 6 in the
most conservative mode, i.e. single threaded debug mode.


To all Geant gurus:  what's wrong with the program ?
None GetCollectionID does not find /detector/collection  Keywords: GetCollectionID, AddNewDetector, collectionName
by Peter Niessen <niessen@ifh.de>,   11 Dec, 2003
Dear GEANT4 gurus,

in my application I created a photon detector and want to read hits in
it. In my

class PhtonDetectorSD : public G4VSensitiveDetector {
PhotonDetectorSD {collectionName.insert ("phColl");}
....

and in my
class Detector : public G4VUserDetectorConstruction {
...
G4SDManager *SDman = G4SDManager::GetSDMpointer ();
G4String photon_sensor_SD_name = "/photo";
PhotonDetectorSD *photo_SD = new PhotonDetectorSD (photon_sensor_SD_name);
SDman->AddNewDetector (photo_SD);
PhotonDetector_log->SetSensitiveDetector (photo_SD);
...

However, in the EventAction class, 

SDman->GetCollectionID ("/photo/phColl")  does not work but only
SDman->GetCollectionID ("phColl") gives the right collection id.

Any clues?

Thanks, Peter.
Warning possible bug in G4HCofThisEvent  Keywords: G4HCofThisEvent
by Jeremy McCormick <Jeremy McCormick>,   27 Sep, 2003

I may have found a pointer-related bug in G4HCofThisEvent.

GetHC(G4int i) is supposed to return a NULL when the collection ID does not exist.

Here is the code (from UserEventAction):

  G4VHitsCollection *vHC = 0;
  vHC = HCE->GetHC(collID);

  // doesn't work when HC does not exist!
  if(!vHC || vHC == NULL || vHC == 0)
    G4cerr << "HC not found" << G4endl;

I am getting "0x9" as my pointer value for vHC instead of "0x0".

This means that I'm having a hard time checking whether or not a hits collection actually exists as GetHC is not correctly giving back a NULL when it doesn't.

1 None: Re: possible bug in G4HCofThisEvent   (Makoto Asai - 27 Sep, 2003)
(_ None: Re: possible bug in G4HCofThisEvent   (Jeremy - 01 Oct, 2003)
None Digitization  Keywords: Hits Digits totalenergydeposit
by COURTINE <courtine@clermont.in2p3.fr>,   16 Sep, 2003

i want to collect information about the total energy deposit in one event which + is the sum of all the hit of this event. So i use the method digitize() of the + class G4VDigitizerModule. Here found what i made: + PuitsDigitizer::PuitsDigitizer(const G4String& name) + :G4VDigitizerModule(name) + { + G4cout << "essai1" << G4endl; + } + + PuitsDigitizer::~PuitsDigitizer() + { + G4cout << "essai2" << G4endl; + } + + void PuitsDigitizer::Digitize() + { + G4cout << "essai3" << G4endl; + G4DigiManager* fDM = G4DigiManager::GetDMpionter(); + G4int myHitsCollID = fDM->GetHitsCollectionID("hits_collection_name"); + PuitsGeHitsCollection* HC = fDM->GetHitsCollection(myHitsCollID); + G4int n_hit = 0; + G4double totE=9, totL=0; + PuitsGeDigiCollection* digiCollection = 0; + n_hit = HC->entries(); + for (G4int i=0;i<n_hit;i++) + { + totE += (*HC) [i]->GetEdep(); + totL += (*HC) [i]->GetTrackL(); + G4cout << "essai5" << G4endl; + } + PuitsGeDigi* newDigi = new PuitsGeDigi(); + digiCollection->insert(newDigi); + newDigi->Print(); + G4cout << "essai6 << G4endl; + if (digiCollection) StoreDigiCollection(digiCollection); + if (verboseLevel==0){ + G4cout + << " Germanium total energy deposit " << G4BestUnit(totE,"Energy"); + << G4endl; + G4int NbDigi = digiCollection->entries(); + for (G4int i=0,i<NbDigi,i++) (*digiCollection) [i] ->Print(); + } + } + I can compile and run the program but when i have access to the digicollection + it return no digits. Moreover when i run i should view all the message essai1, + essai2... and i see none. + So I suupose that the class I derived don't work anymore but idon't know why + (this class is included in PuitsEventAction.cc where I took the value of digits) Here is the code for PuitsEventAction: #include "PuitsEventAction.hh"

#include "PuitsGeHit.hh"
#include "PuitsGeDigi.hh"
#include "PuitsDigitizer.hh"

#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4DCofThisEvent.hh"
#include "G4VDigiCollection.hh"
#include "G4TDigiCollection.hh"
#include "G4THitsCollection.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "G4DigiManager.hh"

PuitsEventAction::PuitsEventAction()
:PuitsgeID(-1),printModulo(1)
{}

PuitsEventAction::~PuitsEventAction() {}

void PuitsEventAction::BeginOfEventAction(const G4Event* evt) {

 G4int evtNb = evt->GetEventID();
 if (evtNb%printModulo == 0)
   {
    G4cout << "\n---> Begin of event: " << evtNb << G4endl;
   }

 if (PuitsgeID==-1)
   {
    G4SDManager * SDman = G4SDManager::GetSDMpointer();
    PuitsgeID = SDman->GetCollectionID("geCollection");
}
}

void PuitsEventAction::EndOfEventAction(const G4Event* evt)
{
  G4int evtNb = evt->GetEventID();

  // extracted from hits, compute the total energy deposit (and total 
  // track length) in all the germanium volume

  G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
  PuitsGeHitsCollection* CHC = 0;
  G4int n_hit = 0;
  G4double totEGe =0, totLGe=0;
  if (HCE) CHC = (PuitsGeHitsCollection*)(HCE->GetHC(PuitsgeID));

  if (CHC)
    {
     n_hit = CHC->entries();
     for (G4int i=0;i<n_hit;i++)
	{
	  totEGe += (*CHC)[i]->GetEdep(); 
	  totLGe += (*CHC)[i]->GetTrackL();
	}
     }

   // print this information event by event (modulo n)

  if (evtNb%printModulo == 0) {
    G4cout << "---> End of event: " << evtNb << G4endl;

    G4cout
       << "   Germanium : total energy: " << std::setw(7)
                                        << G4BestUnit(totEGe,"Energy")
       << "       total track length: " << std::setw(7)
                                        << G4BestUnit(totLGe,"Length")
       << G4endl;

    G4cout << "\n     " << n_hit
	   << " hits are stored in PuitsGeHitsCollection." << G4endl;
  }

  // extract the trajectories and draw them

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

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

G4DigiManager* fDM = G4DigiManager::GetDMpointer(); G4int myDigiCollID = fDM->GetDigiCollectionID("digi_collection_name"); G4DCofThisEvent* DCE = evt->GetDCofThisEvent(); //PuitsGeDigiCollection* CDC = 0; PuitsGeDigiCollection* CDC = new PuitsGeDigiCollection(); G4double totE = 0; G4double totL = 0; G4int n_digi = 0; G4cout << "test1" << G4endl; if (DCE) CDC = (PuitsGeDigiCollection*)(DCE->GetDC(myDigiCollID));

  {
G4cout << "test2" << G4endl;
n_digi = CDC->entries();
G4cout << "\n     " << n_digi
	   << " digits are stored in PuitsGeDigiCollection." << G4endl;

  for (G4int i=0;i<n_digi;i++)
  {
 G4cout << "test3" << G4endl;
 (*digiCollection) [i]->Print();
    }
    }
    G4cout << "---> End of event: " << evtNb << G4endl;	

    G4cout
       << "   Germanium : total energy: " << std::setw(7)
                                        << G4BestUnit(totE,"Energy")
       << "       total track length: " << std::setw(7)

                        << G4BestUnit(totL,"Length")
       << G4endl;

    G4cout << "\n     " << n_digi
	   << " digits are stored in PuitsGeDigiCollection." << G4endl;

}

+ Thank you for your help. + Best regards, + Fabien

Question HitCollections in SensitiveDetectors  Keywords: G4VSensitiveDetector, G4THitsCollection
by Volker Friese <v.friese@gsi.de>,   14 Aug, 2003

It is foreseen that one SensitiveDetector can create and handle multiple HitCollections. In what case may that make sense?

Regards

V. Friese

1 None: Re: HitCollections in SensitiveDetectors   (Makoto Asai - 14 Aug, 2003)
None Trajectories filter  by peter <ptr@msu.dubna.ru>,   04 Aug, 2003

There is a problem to me to draw tracks that goes trough the volume that i'm interested in. Wired has such future but when number of tracks is about 1000 my Atlon 2400 xp+ goes down... Can somebody help me with code edition? Where should i paste it? Something like this:

char VolumeName=[xx];
VolumeName=fTrack->GetVolume->GetName();
if(strcmp(VolumeName=="Segment"){
        DrawTrajectory();
}

Best Regards!

Question Range cuts and hit generation  Keywords: cuts, hits
by Kate Ross <jezzebel_kr@yahoo.com>,   11 Jun, 2003

Hello,

I have created a detector that has many small spheres (droplets with radii<1*mm) as the sensitive detectors. I wanted to put a max step value on these spheres, in order to monitor carefully the energy that is deposited in each one.

I have used the following code to set a specific cut value, in my DetectorConstruction.cc:

G4double maxStep = 0.1*mm; droplet_log->SetUserLimits(new G4UserLimits(maxStep));

The problem is that when any specific cut is set, there is an error message and an abortion after only a few hits are generated! The error message is:

-----------------------------------------------------------
    *** Dump for solid - droplet ***
    ===================================================
 Solid type: G4Sphere
 Parameters:
    inner radius: 0 mm
    outer radius: 0.0850065 mm
    starting phi of segment  : 0 degrees
    delta phi of segment     : 360 degrees
    starting theta of segment: 0 degrees
    delta theta of segment   : 180 degrees
-----------------------------------------------------------
Position:

p.x() = -0.0006890730625936925 mm p.y() = -0.002898995338824761 mm p.z() = 0.09993094979978423 mm

Direction:

v.x() = -0.02301604325057479 v.y() = 0.03179745399227318 v.z() = 0.9992292948431291

Proposed distance :

snxt = 9e+99 mm

G4Sphere::DistanceToOut() - Invalid enum

*** G4Exception: Aborting execution *** Abort (core dumped)

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

When the cut value is left as the default (ie, 1 mm), everything is fine. Does anyone know what could be the remedy to this situation?

Thanks so much!

-Kate

1 None: Re: Range cuts and hit generation   (Vladimir Grichine - 17 Jun, 2003)
1 More: Re: Range cuts and hit generation   (Kate Ross - 19 Jun, 2003)
2 None: Re: Range cuts and hit generation   (Jo User - 18 Aug, 2003)
Question Sensitive Detector and daughter volumes  by I Cornelius <I Cornelius>,   10 Jun, 2003

Dear All, 
 If I set a logical volume as a sensitive detector (as below). Are all daughter volumes of this volume considered sensitive detectors also? 

if(logicSOILayer)
    //call method of logicSOILayer class for setting volume as sensitive detector
    logicSOILayer->SetSensitiveDetector( aDetectorSD );

Cheers, Iwan

1 None: Re: Sensitive Detector and daughter volumes   (Makoto Asai - 11 Jun, 2003)
(_ Question: Re: Sensitive Detector and daughter volumes   (Blair Smith - 05 Nov, 2005)
Question secondary particle information via hit?  Keywords: secondary particles, hit
by Edwina Wolff <ewolff@uos.de>,   02 May, 2003
Hello

I'd like to connect information about secondary particles - if created in a hit - 
to this hit.
Yet, what I found is the direct way from "SteppingManager" to "SteppingVerbose", 
one can access "(*fSecondary)" and "fN2ndaries*DoIt".

I do not want to go via SteppingVerbose, anyway I do not know how I could shift 
this information in SteppingVerbose into step or hit or anything else. 
How do I retrieve secondary particle information for a hit that I can handle their 
statistics (name/numbers) via hitscollection event by event?

Any ideas are welcome,
Edwina Wolff


some information I can do connect with hit:
-------------------------------------------
edep=step->GetTotalEnergyDeposit();
sensitiveDetectorHit->SetEdep(edep);

processName=step->GetPostStepPoint()->GetProcessDefinedStep()->GetProcessName();
sensitiveDetectorHit->SetProcessName(processName);

particleName=step->GetTrack()->GetDefinition()->GetParticleName();
sensitiveDetectorHit->SetParticleName(particleName);
//this is the currently tracked particle which run the process




now I like to do something like:
---------------------------------
secondaries=step->GetSecondary; 
or 
secondaries=(*fSecondary);
sensitiveDetectorHit->SetSecondary( (*fSecondary) ); 
//to store information about the created secondaries of this hit

//(*fSecondary) in SteppingVerbose directly accessable via SteppingManager
secondaryName[i]=(*fSecondary)[i]->GetDefinition()->GetParticleName();
None Memory management in hits  by <vincenzo.innocente@cern.ch>,   21 Mar, 2003
I'm quite confused about the rational behind memory management in digis+hits
I see classes using G4Allocator and at the same time std::vector<T*>
whose whould then use the std default allocator.
what is the advantange to store a void* using G4Allocator and
a bunch of pointers to T using std allocator?

       cheers,
           vincenzo

None energy of first hit  by Jerome Roccaz <roccaz@csnsm.in2p3.fr>,   18 Feb, 2003

Hi everyone,

well i want to know the energy of the first Hit that is also the first interaction of my particle in the all detector. So I put conditions to verify this (using energy and physical volume of pre and post step points) and i obtain the curious result that for all the event satisfying the previous condition, the energy of the first hit is always the same!!!

I can't see where i could have done a mistake..if someone can help me to find it...

thanks

Jerome

1 More: Re: energy of first hit   (Jerome Roccaz - 18 Feb, 2003)
(_ More: Re: energy of first hit   (Jerome Roccaz - 19 Feb, 2003)
None access to a Hit  by Jerome Roccaz <roccaz@csnsm.in2p3.fr>,   06 Feb, 2003

Hi everyone,

Let's first have a look at these code lines :

G4HCofThisEvent* HCE=evt->GetHCofThisEvent();
  SimpleGeHitsCollection* CHC=0;
  G4int n_hit=0;
  G4double totEAbs=0, EHit1=0;
  G4double dumb=0;
  G4ThreeVector Hit1, Hit2;

  if(HCE) CHC=(SimpleGeHitsCollection*)(HCE->GetHC(simpleGeCollID));
  if(CHC){
    n_hit=CHC->entries();
    //dumb=(*CHC)[0]->GetG();
    //if(dumb==0){
    //Hit1=(*CHC)[0]->GetPos();
    //Hit2=(*CHC)[1]->GetPos();
    EHit1=(*CHC)[1]->GetEdep();
      //geRun->fillEn(EHit1);
      //geRun->fillLong(Hit1, Hit2);
    //}

    for(G4int i=0;i<n_hit;i++) {totEAbs+=(*CHC)[i]->GetEdepAbs();EHit1=(*CHC)[i]->GetEdep();};
    geRun->fillNabs(totEAbs);
    geRun->fillNdet(totEAbs);
    geRun->fillHist(totEAbs);
  }

When the line : EHit1=(*CHC)[1]->GetEdep(); is in comment, i have no problem executing my program. But when it is not, I obtain a "bus error" when i start a run. as you can see, I've also placed this line in the for loop, and no problem with it.

I don't have any error during compilation. I'd like to understand what can happen, and of course find a solution.

Thanks

None Hits collection  by Jerome Roccaz <roccaz@csnsm.in2p3.fr>,   28 Jan, 2003

Hi everyone,

I would like to access all the hits of a run (particularly the energy of each) at the end of a run. I haven't found any answer in the User's manual, cause (tell me if i'm wrong), each hits collection of an event is deleted after the end of the event.

So could you explain me how can i access to them ?

thanks

1 None: Re: Hits collection   (Makoto Asai - 29 Jan, 2003)
(_ None: Re: Hits collection   (Jerome Roccaz - 30 Jan, 2003)
(_ None: Re: Hits collection   (T.P.Lee - 28 Aug, 2003)
None Scintillator surface  Keywords: optical scintillator
by peng haiping <penghp@mail.ihep.ac.cn>,   20 Jan, 2003

hi,every one
   I want to simulate the optical photon tracking in the scintillator,
but i was confuse of the defination the surface, i did not know weather
or not the add some properties to the surface.
   The optical photon generate in the scintillator, and will detecter
by PMT at the end of scintillator, the surface between scintillator 
and air be defined, the surface is polished and the physis model is
unified, but i did not known weather or not to add the property 
such as "RINDEX","SPECULARLOBECONSTANT","SPECULARSPIKECONSTANT",
"BACKSCATTERCONSTANT","REFLECTIVITY","EFFICIENCY" to surface.
i did not understand the meaning of the surface properties.
regards
   ----Peng Haiping

1 Feedback: Re: Scintillator surface   (Peter Gumplinger - 27 Jan, 2003)
None how to calculate the detector efficiency?  by T.P.Lee <caltechprinceton@sina.com>,   31 Oct, 2002

Hi Everyone. I am also a beginner for geant4.now I have some problems.I want to simulate one measure system's efficiency which uses a BGO crystal as detector. the source emits gamma ray,then gamma ray pass through a measured object,detected by BGO crystal .my question is how to calculate the system's efficiency? sould I consider the BGO 's scintillation? should I count all gamma ray pass through BGO,then divided it by the total incident gamma ray particles(this result is the efficiency?)? thanks for your help!!

1 None: Re: how to calculate the detector efficiency?   (Makoto Asai - 31 Oct, 2002)
(_ None: Re: how to calculate the detector efficiency?   (T.P.Lee - 02 Nov, 2002)
(_ None: Re: how to calculate the detector efficiency?   (michel maire - 02 Nov, 2002)
None readoutgeometry associate with parameterisation  Keywords: readout geometry
by haiqu <hqug4@yahoo.com>,   25 Oct, 2002

I made three parallel chambers along Z axis by the parameterised class, I'd like to make each of them have read out geometry in segements in x,y,z axis, how can I associate read out geometry with the arguments which are changed by parameterised class?

1 None: Re: readoutgeometry associate with parameterisation   (Makoto Asai - 25 Oct, 2002)
(_ None: Re: readoutgeometry associate with parameterisation   (hai qu - 01 Nov, 2002)
Question Scintillator Photons  Keywords: scintillators, optical photons
by Michael Famiano <Michael Famiano>,   18 Jul, 2002

Hello;
  I'm trying to count the number of optical photons striking a 
photodiode attached to a light guide which is attached to a scintillator.  While the number is proportional to (alpha) particle energy incident on the
scintillator, the deviation is very large (~30%) even when I set the
resolution to 0.  Can anyone help me here, or tell me what might be causing this.  I'm following very closely the advanced example "underground physics."  I've tried many things including changing my cuts, but nothing seems to be changing the apparent low resolution.
Thanks,
mike

1 Feedback: Re: Scintillator Photons   (Gumplinger Peter - 26 Nov, 2002)
None scintillator  Keywords: scintillator
by Helena <Helena>,   11 Apr, 2002

Hi all! Help me please. I try to stimulate the process of passing photons trough the NaI detector. How mast I describe the energy resolution?(660 keV-8%) Borodina Helena.

None free hits?  Keywords: hits delete
by Hans Boie <h.boie@mpi-hd.mpg.de>,   03 Mar, 2002

Hi!

I'm generating hits in a SenesitiveDetector-class as described in the examples.

I wonder if I have to delete these hits anywhere or if this will be done automatically. At the moment the simulation seems to allocate more and more memory and I guess it might be due to not deleted hits.

If I have to delete the hits again, how and where should i do this in order not to leave any broken pointers behind.

Thanks,

hans

1 Idea: Re: free hits?   (Makoto Asai - 03 Mar, 2002)
(_ Note: Re: free hits? - solved after all, but still i don't understand why   (Hans Boie - 01 Feb, 2005)
Question Counting hits  Keywords: Countig particle hits
by Rui Bugalho de Moura <bugalho.moura@netc.pt>,   06 Feb, 2002

Hi everyone,

I want to count optical photons arriving at an APD surface.

Do I need to make the G4LogicalBorderSurface or the G4LogicalVolume (of the APD) a Sensitive Detector?

At present I'm attempting to count the optical photons in my UserSteppingAction method, where I check whether or not an optical photon has crossed the G4LogicalBorderSurface between pre and post step points. Is there a more elegant way to do this?

I also need to store the counts along side with the optical photons initial position, to histogramm the counts against their initial z coordinate. I'm not using hits for this, since I'm not extracting any physical information, I'm just counting the photons. Should I use hits?

I pretend to histogram through the ROOT's CINT interface. Can I store my data points to a file? Or do I need to book my histograms in my GEANT4 code?

If I am to store my data points to a file, where in my simulation code is more appropriate to do it? At EndOfEventAction? (I also noticed there is no GEANT4 library to deal with files. Is this true?)

I'm sorry if some of the questions aren't supposed to be in this "Hits, Digitization and Pileup" group.

Thanks in advance anyway, for any advice you can give me.

Best regards,

Rui Moura

1 None: Re: Counting hits   (Makoto Asai - 28 Feb, 2002)
Question checking for particle hit in SD  Keywords: hit, sensitive detector, neutron
by Sean Turnbull <Sean Turnbull>,   05 Feb, 2002

I have a Pb cylinder enclosing a smaller Au disk. When firing mu- at the Pb, if a mu- hits the Au a thermal neutron will be produced.

What I am having trouble is for the program to register a hit iff a thermal neutron is produced via a hit from the mu- on the Au.... So if a neutron is produced a hit will be produced and recorded. More info can be given if needed...

Thanks...

Sean

1 None: Re: checking for particle hit in SD   (Marc Verderi - 06 Feb, 2002)
(_ Feedback: Re: checking for particle hit in SD   (Sean Turnbull - 06 Feb, 2002)
(_ Feedback: Re: checking for particle hit in SD   (Sean Turnbull - 06 Feb, 2002)
None G4HitsStructure  by Mark Polsen <mpolsen@citrus.ucr.edu>,   27 Nov, 2001

Hello All,

I was came across a page on the Geant4 website containing the mission statements for Hits & Digitization, (http://wwwinfo.cern.ch/asd/geant4/OOAandD/analysis/class_spec/hits_digits/ClassSpec.html). Is this a new class that will be included in the upcoming release? I've looked through the source code of current and previous versions but have not found this class yet. The only class I've found that seems similar is the G4SDStructure for Sensitive Detectors.

I currently save hits in ROOT trees, but was curious if this class could be used as a more efficient way of storing hit information.

Thanks, Mark

1 None: Re: G4HitsStructure   (Makoto Asai - 27 Nov, 2001)
Question checking code...  Keywords: Hits, SDManager checking code
by Sean Turnbull <Sean Turnbull>,   02 Oct, 2001

Hello all, I have been working on my code testing the G4Hits and G4SDManager code specifically. I would really appreciate if somone could check over my code, since I seem to be getting a few strange run time results. It would be easier than exaplining situation here....

Thankyou in advance.... Sean

1 Feedback: Re: checking code...   (Makoto Asai - 09 Oct, 2001)
Question Statistical Error of Energy Deposited in My Detector ?  Keywords: statistics detector errors
by Michael Ahrens <miahrens@uke.uni-hamburg.de>,   09 Aug, 2001

Hello !

I have set up a detector which adds up the energy deposited from (mostly) photons in a water tank. To assess the error of the sum of the deposited energy, I must know the error of the compounds of the sum (e.g. the error/standard deviation of the values I get from a G4Step object with the member function GetTotalEnergyDeposit() ). Does Geant4 provide those errors ? And how do I get them ?

Thanks. Michael

1 None: Re: Statistical Error of Energy Deposited in My Detector ?   (Makoto Asai - 12 Aug, 2001)
(_ Question: Re: Statistical Error of Energy Deposited in My Detector ?   (Michael Ahrens - 13 Aug, 2001)
(_ Feedback: Re: Statistical Error of Energy Deposited in My Detector ?   (Makoto Asai - 15 Aug, 2001)
(_ Question: Re: Statistical Error of Energy Deposited in My Detector ?   (Michael Ahrens - 15 Aug, 2001)
(_ Feedback: Re: Statistical Error of Energy Deposited in My Detector ?   (Makoto Asai - 28 Aug, 2001)
Ok Welcome  by Makoto Asai <Makoto Asai>,   12 Jul, 2001
Welcome to "Hits, Digitization and Pileup" forum.

Makoto Asai (SLAC)
Geant4 "Run, Event & Detector Responses" category coordinator
1 Question: RPC/CMS detector Response for gammas   (muhammad jamil - 07 Sep, 2004)
 Add Message Add Message
to: "Hits, Digitization and Pileup"

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


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