Message: Re: Event by Event Data Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Event by Event Data 

Forum: Hits, Digitization and Pileup
Re: Question Event by Event Data (Matt Worden)
Date: 20 Feb, 2011
From: Tsukasa Aso <Tsukasa Aso>


 The Run::RecordEvent is suitable for recording event by event data.
(Or EventAction::EndOfEventAction() will be OK too.)

The following line in your code gets a hits collection (G4THisMap)
corresponding to a give collection ID (id).

    // Get the hit collection corresponding to "id"
    G4THitsMap<G4double>* eventHitsMap                                       
      = dynamic_cast< G4THitsMap<G4double>* >(eventHitCollection->GetHC(id));

You can access each value inside eventHitsMap by using a copy number of cell (CellID) as follows:

    G4double* ptr = (*eventHitsMap)[cellID];

 The "ptr" is a pointer to the value of the cell. 
If the pointer "ptr" is null, it means that it has no data in the cell.
(For example, there was no track in the cell)

 You may prefer to set zero if there is no data in the cell.
  f.e.   if ( !ptr )  ptr = new double(0.0);

 You can get the quantity of the "ptr" using (*ptr).
 For example,

    G4double quantity = (*ptr);

In examples/extended/runAndEvent/RE02/, you can find an example how to do it.  
Please look at src/ and

 Best regards,
 Tsukasa ASO

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

1 Question: Re: Event by Event Data   (Matt Worden - 26 Feb, 2011)
2 None: Re: Event by Event Data   (Tsukasa Aso - 27 Feb, 2011)
 Add Message Add Message
to: "Re: Event by Event Data"

 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 ]