GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTMCTruthInfo.cpp
Go to the documentation of this file.
1 /*
2  * GGSTMCTruthInfo.cpp
3  *
4  * Created on: 17 Aug 2011
5  * Author: Nicola Mori
6  */
7 
10 #include "montecarlo/dataobjs/GGSTMCTruthInfo.h"
11 
12 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
13 /* **************************************** *
14  * GGSTMCTruthInfo class implementation *
15  * **************************************** */
16 
17 ClassImp(GGSTMCTruthInfo)
18 
19  //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
21  : eventID(-1), nDiscarded(0) {
22  _primaries = new TClonesArray("GGSTParticle");
23 }
24 
25 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
26 GGSTMCTruthInfo::~GGSTMCTruthInfo() { delete _primaries; }
27 
28 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
29 
31  nDiscarded = 0;
32  eventID = -1;
33  _primaries->Clear("C");
34 }
35 
36 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
37 
39 
40  if (particleNumber < (UInt_t)(_primaries->GetEntries())) {
41  return (GGSTParticle *)(_primaries->At(particleNumber));
42  } else
43  return NULL;
44 }
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 
50  Int_t n = _primaries->GetEntries();
51  new ((*_primaries)[n]) GGSTParticle(*primaryParticle);
52 }
53 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GGSTParticle * GetPrimaryParticle(UInt_t particleNumber)
Retrieves a primary particle.
void Reset()
Resets the object&#39;s properties.
Class to store G4 particles.
Definition: GGSTParticle.h:19
~GGSTMCTruthInfo()
Destructor.
void AddPrimaryParticle(GGSTParticle *primaryParticle)
Adds a primary particle to the particles&#39; array.
A class to store MC truth informations on ROOT files.
Int_t eventID
The event ID.
UInt_t nDiscarded
The number of discarded + killed events the current event and the previous event saved in file...