Message: question on how to use G4THitsMap Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None question on how to use G4THitsMap 

Keywords: G4THitsMap, CopyNo
Forum: Hits, Digitization and Pileup
Date: 04 Jun, 2007
From: long <long>

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!


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;

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

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)
 Add Message Add Message
to: "question on how to use G4THitsMap"

 Subscribe Subscribe

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

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