GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
GGSTPrimaryDisReader.cpp
Go to the documentation of this file.
1 /*
2  * GGSTPrimaryDisReader.cpp
3  *
4  * Created on: 25 Aug 2011
5  * Author: Nicola Mori
6  */
7 
11 
12 GGSTPrimaryDisReader::GGSTPrimaryDisReader() : _disInfo(nullptr), _disInfoChain(nullptr) {}
13 
15 
16 bool GGSTPrimaryDisReader::SetChain(TChain *disInfoChain) {
17 
18  _disInfoChain = disInfoChain;
19  if (_disInfoChain->SetBranchAddress("primaryDisInfo", &_disInfo) == 0) {
20  return true;
21  } else {
22  return false;
23  }
24 }
25 
26 void GGSTPrimaryDisReader::GetEntry(Long64_t entry) {
27  if (entry != _disInfoChain->GetEntries()) {
28  _disInfoChain->GetEntry(entry);
29  }
30 }
31 
33 
34  GGSTPrimaryDisInfo *interaction;
35  for (int i = 0; i < _disInfo->GetEntries(); i++) {
36  interaction = (GGSTPrimaryDisInfo *)(_disInfo->At(i));
37  if (interaction->primary.trackID == trackID) {
38  return interaction;
39  }
40  }
41 
42  return nullptr;
43 }
GGSTPrimaryDisReader()
Constructor.
GGSTParticle primary
Descriptor for the primary particle.
~GGSTPrimaryDisReader()
Destructor.
A simple class to carry informations about the disappearance of the primary particle.
Int_t trackID
Track ID.
Definition: GGSTParticle.h:22
void GetEntry(Long64_t entry)
GGSTPrimaryDisInfo * GetDisInfo(Int_t trackID=1)
Retrieves the disappearance information for the given primary.
bool SetChain(TChain *disInfoChain)
Sets the chain.