GGS(GenericGEANT4Simulation)Software  2.7.0
 All Data Structures Namespaces Files Functions Variables Typedefs Macros
Public Member Functions
GGSTHadrIntReader Class Reference

Class for reading output of GGSHadrIntAction. More...

#include <GGSTHadrIntReader.h>

Inheritance diagram for GGSTHadrIntReader:
Inheritance graph
[legend]
Collaboration diagram for GGSTHadrIntReader:
Collaboration graph
[legend]

Public Member Functions

 GGSTHadrIntReader ()
 Constructor.
 
 ~GGSTHadrIntReader ()
 Destructor.
 
bool SetChain (TChain *hadrIntChain)
 Sets the chain. More...
 
void GetEntry (Long64_t entry)
 
GGSTHadrIntInfoGetInelastic (Int_t trackID=1)
 Retrieves the inelastic interaction for the given primary. More...
 
Int_t GetNQuasiElastic (Int_t trackID=1)
 Retrieves the number of quasi-elastic interactions for the given primary. More...
 
GGSTHadrIntInfoGetQuasiElastic (Int_t nQE, Int_t trackID=1)
 Retrieves a quasi-elastic interaction for the given primary. More...
 
- Public Member Functions inherited from GGSTChainReader
virtual ~GGSTChainReader ()
 Destructor.
 

Detailed Description

Class for reading output of GGSHadrIntAction.

This class provides methods to read the information about hadronic interactions as saved by GGSHadrIntAction.

Definition at line 26 of file GGSTHadrIntReader.h.

Member Function Documentation

void GGSTHadrIntReader::GetEntry ( Long64_t  entry)
virtual

@ brief Reads the specified entry from the hadronic interaction branch.

Parameters
entryThe desired entry.

Implements GGSTChainReader.

Definition at line 37 of file GGSTHadrIntReader.cpp.

37  {
38  if (entry != _hadrIntChain->GetEntries()) {
39  _hadrIntChain->GetEntry(entry);
40  }
41 }
GGSTHadrIntInfo * GGSTHadrIntReader::GetInelastic ( Int_t  trackID = 1)

Retrieves the inelastic interaction for the given primary.

Parameters
trackIDThe track ID of the primary particle.
Returns
Pointer to inelastic interaction info (NULL if no inelastic interaction is found).

Definition at line 44 of file GGSTHadrIntReader.cpp.

44  {
45 
46  GGSTHadrIntInfo *interaction;
47  for (int i = 0; i < _inelastic->GetEntries(); i++) {
48  interaction = (GGSTHadrIntInfo *)(_inelastic->At(i));
49  if (interaction->originalTrackID == trackID)
50  return interaction;
51  }
52 
53  return NULL;
54 }
Int_t originalTrackID
Track ID of the original primary particle.
A simple class to carry informations about hadronic interactions.
Int_t GGSTHadrIntReader::GetNQuasiElastic ( Int_t  trackID = 1)

Retrieves the number of quasi-elastic interactions for the given primary.

Parameters
trackIDThe track ID of the primary particle.
Returns
The number of quasi-elastic interactions.

Definition at line 58 of file GGSTHadrIntReader.cpp.

58  {
59 
60  Int_t nInt = 0;
61  for (int i = 0; i < _quasiElastic->GetEntries(); i++) {
62  if (((GGSTHadrIntInfo *)(_quasiElastic->At(i)))->originalTrackID == trackID)
63  nInt++;
64  }
65 
66  return nInt;
67 }
A simple class to carry informations about hadronic interactions.
GGSTHadrIntInfo * GGSTHadrIntReader::GetQuasiElastic ( Int_t  nQE,
Int_t  trackID = 1 
)

Retrieves a quasi-elastic interaction for the given primary.

Note that ordering is random, so first interaction is not guaranteed to be happened before the second, and so on.

Parameters
nQEThe desired quasi-elastic interaction.
trackIDThe track ID of the primary particle.
Returns
Pointer to quasi-elastic interaction info.
NULL if no quasi-elastic interaction is found or if nQE >= GetNQuasiElastic.

Definition at line 71 of file GGSTHadrIntReader.cpp.

71  {
72 
73  Int_t nInt = 0;
74  GGSTHadrIntInfo *interaction;
75  for (int i = 0; i < _quasiElastic->GetEntries(); i++) {
76  interaction = (GGSTHadrIntInfo *)(_quasiElastic->At(i));
77  if (interaction->originalTrackID == trackID) {
78  if (nInt == nQE)
79  return interaction;
80  else
81  nInt++;
82  }
83  }
84 
85  return NULL;
86 }
Int_t originalTrackID
Track ID of the original primary particle.
A simple class to carry informations about hadronic interactions.
bool GGSTHadrIntReader::SetChain ( TChain *  hadrIntChain)
virtual

Sets the chain.

This method sets the hadronic interactions chain, from which the informations will be read.

Parameters
hadrIntChainThe chain containing the hadronic interactions.

Implements GGSTChainReader.

Definition at line 25 of file GGSTHadrIntReader.cpp.

25  {
26 
27  _hadrIntChain = hadrIntChain;
28  if (_hadrIntChain->SetBranchAddress("inelastic", &_inelastic) == 0 &&
29  _hadrIntChain->SetBranchAddress("quasiElastic", &_quasiElastic) == 0) {
30  return true;
31  } else
32  return false;
33 }

The documentation for this class was generated from the following files: