CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
iEventHistoPET.cc
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2019 all CASToR contributors listed below:
18 
19  --> Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Thibaut MERLIN, Mael MILLARDET, Simon STUTE, Valentin VIELZEUF
20 
21 This is CASToR version 3.0.
22 */
23 
31 #include "iEventHistoPET.hh"
32 #include "vDataFile.hh"
33 #include "sOutputManager.hh"
34 
35 // =====================================================================
36 // ---------------------------------------------------------------------
37 // ---------------------------------------------------------------------
38 // =====================================================================
39 
41 {
45  m_eventNbTOFBins = 1;
46  mp_eventValue = NULL;
47  mp_eventScatRate = NULL;
48  m_nbLines = 1;
49 }
50 
51 // =====================================================================
52 // ---------------------------------------------------------------------
53 // ---------------------------------------------------------------------
54 // =====================================================================
55 
57 {
58  if (mp_eventValue != NULL) free(mp_eventValue);
59  if (mp_eventScatRate != NULL) free(mp_eventScatRate);
60 }
61 
62 // =====================================================================
63 // ---------------------------------------------------------------------
64 // ---------------------------------------------------------------------
65 // =====================================================================
66 
68 {
70  // Check that the number of TOF bins is correct
71  if (m_eventNbTOFBins<1)
72  {
73  Cerr("***** iEventHistoPET::AllocateSpecificData() -> Number of TOF bins has not been initialized (<1) !");
74  return 1;
75  }
76  // Allocate values depending on the number of TOF bins
77  mp_eventValue = (FLTNB*)malloc(m_eventNbTOFBins*sizeof(FLTNB));
78  mp_eventScatRate = (FLTNB*)malloc(m_eventNbTOFBins*sizeof(FLTNB));
79  // Deault initialization
80  for(int tb=0 ; tb<m_eventNbTOFBins ; tb++)
81  {
82  mp_eventValue[tb] = 1.;
83  mp_eventScatRate[tb] = 0.;
84  }
85  // End
86  return 0;
87 }
88 
89 // =====================================================================
90 // ---------------------------------------------------------------------
91 // ---------------------------------------------------------------------
92 // =====================================================================
93 
95 {
98 }
99 
100 // =====================================================================
101 // ---------------------------------------------------------------------
102 // ---------------------------------------------------------------------
103 // =====================================================================
104 
106 {
108  Cout("iEventHistoPET::Describe() -> Display contents" << endl);
109  Cout("Time: " << m_timeInMs << " ms" << endl);
110  Cout("Number of lines: " << m_nbLines << endl);
111  for (uint16_t l=0; l<m_nbLines; l++) Cout(" --> ID1: " << mp_ID1[l] << " | ID2: " << mp_ID2[l] << endl);
112  Cout("Random rate: " << m_eventRdmRate << endl);
113  Cout("Normalization factor: " << m_eventNormFactor << endl);
114  Cout("ACF: " << m_atnCorrFactor << endl);
115  Cout("Number of TOF bins: " << m_eventNbTOFBins << endl);
116  for (uint16_t t=0; t<m_eventNbTOFBins; t++) Cout(" --> Event value: " << mp_eventValue[t] << " | Scatter rate: " << mp_eventScatRate[t] << endl);
117  Cout(flush);
118 }
119 
120 // =====================================================================
121 // ---------------------------------------------------------------------
122 // ---------------------------------------------------------------------
123 // =====================================================================
~iEventHistoPET()
iEventHistoPET destructor.
void Describe()
This function can be used to get a description of the event printed out.
#define VERBOSE_DEBUG_EVENT
#define MODE_HISTOGRAM
Definition: vDataFile.hh:58
#define TYPE_PET
Definition: vDataFile.hh:73
int AllocateSpecificData()
Function allowing the allocation of specific data. Instantiate and initialize the mp_eventValue and...
#define FLTNB
Definition: gVariables.hh:81
int m_verbose
Definition: vEvent.hh:232
uint32_t * mp_ID2
Definition: vEvent.hh:227
FLTNB m_eventRdmRate
Definition: iEventPET.hh:161
FLTNB m_eventNormFactor
Definition: iEventPET.hh:162
int m_dataType
Definition: vEvent.hh:229
iEventHistoPET()
iEventHistoPET constructor. Initialize the member variables to their default values.
Declaration of class iEventHistoPET.
#define Cerr(MESSAGE)
#define VERBOSE_DEBUG_LIGHT
uint32_t * mp_ID1
Definition: vEvent.hh:226
FLTNB * mp_eventScatRate
Declaration of class vDataFile.
FLTNB m_atnCorrFactor
Definition: iEventPET.hh:163
uint16_t m_eventNbTOFBins
FLTNB GetAdditiveCorrections(int a_bin)
Inherit from vEvent. Main PET class for the Event objects.
Definition: iEventPET.hh:41
int m_dataMode
Definition: vEvent.hh:230
Declaration of class sOutputManager.
#define SPEC_EMISSION
Definition: vDataFile.hh:90
#define DEBUG_VERBOSE(IGNORED1, IGNORED2)
#define Cout(MESSAGE)
uint16_t m_nbLines
Definition: vEvent.hh:225
uint32_t m_timeInMs
Definition: vEvent.hh:224
int m_dataSpec
Definition: vEvent.hh:231