CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
32 #include "iEventHistoPET.hh"
33 #include "vDataFile.hh"
34 #include "sOutputManager.hh"
35 
36 // =====================================================================
37 // ---------------------------------------------------------------------
38 // ---------------------------------------------------------------------
39 // =====================================================================
40 
42 {
46  m_eventNbTOFBins = 1;
47  mp_eventValue = NULL;
48  mp_eventScatRate = NULL;
49  m_nbLines = 1;
50 }
51 
52 // =====================================================================
53 // ---------------------------------------------------------------------
54 // ---------------------------------------------------------------------
55 // =====================================================================
56 
58 {
59  if (mp_eventValue != NULL) free(mp_eventValue);
60  if (mp_eventScatRate != NULL) free(mp_eventScatRate);
61 }
62 
63 // =====================================================================
64 // ---------------------------------------------------------------------
65 // ---------------------------------------------------------------------
66 // =====================================================================
67 
69 {
71  // Check that the number of TOF bins is correct
72  if (m_eventNbTOFBins<1)
73  {
74  Cerr("***** iEventHistoPET::AllocateSpecificData() -> Number of TOF bins has not been initialized (<1) !");
75  return 1;
76  }
77  // Allocate values depending on the number of TOF bins
78  mp_eventValue = (FLTNB*)malloc(m_eventNbTOFBins*sizeof(FLTNB));
79  mp_eventScatRate = (FLTNB*)malloc(m_eventNbTOFBins*sizeof(FLTNB));
80  // Deault initialization
81  for(int tb=0 ; tb<m_eventNbTOFBins ; tb++)
82  {
83  mp_eventValue[tb] = 1.;
84  mp_eventScatRate[tb] = 0.;
85  }
86  // End
87  return 0;
88 }
89 
90 // =====================================================================
91 // ---------------------------------------------------------------------
92 // ---------------------------------------------------------------------
93 // =====================================================================
94 
96 {
99 }
100 
101 // =====================================================================
102 // ---------------------------------------------------------------------
103 // ---------------------------------------------------------------------
104 // =====================================================================
105 
107 {
109  Cout("iEventHistoPET::Describe() -> Display contents" << endl);
110  Cout("Time: " << m_timeInMs << " ms" << endl);
111  Cout("Number of lines: " << m_nbLines << endl);
112  for (uint16_t l=0; l<m_nbLines; l++) Cout(" --> ID1: " << mp_ID1[l] << " | ID2: " << mp_ID2[l] << endl);
113  Cout("Random rate: " << m_eventRdmRate << endl);
114  Cout("Normalization factor: " << m_eventNormFactor << endl);
115  Cout("ACF: " << m_atnCorrFactor << endl);
116  Cout("Number of TOF bins: " << m_eventNbTOFBins << endl);
117  for (uint16_t t=0; t<m_eventNbTOFBins; t++) Cout(" --> Event value: " << mp_eventValue[t] << " | Scatter rate: " << mp_eventScatRate[t] << endl);
118  Cout(flush);
119 }
120 
121 // =====================================================================
122 // ---------------------------------------------------------------------
123 // ---------------------------------------------------------------------
124 // =====================================================================
~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:59
#define TYPE_PET
Definition: vDataFile.hh:74
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:233
uint32_t * mp_ID2
Definition: vEvent.hh:228
FLTNB m_eventRdmRate
Definition: iEventPET.hh:162
FLTNB m_eventNormFactor
Definition: iEventPET.hh:163
int m_dataType
Definition: vEvent.hh:230
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:227
FLTNB * mp_eventScatRate
Declaration of class vDataFile.
FLTNB m_atnCorrFactor
Definition: iEventPET.hh:164
uint16_t m_eventNbTOFBins
FLTNB GetAdditiveCorrections(int a_bin)
Inherit from vEvent. Main PET class for the Event objects.
Definition: iEventPET.hh:42
int m_dataMode
Definition: vEvent.hh:231
Declaration of class sOutputManager.
#define SPEC_EMISSION
Definition: vDataFile.hh:91
#define DEBUG_VERBOSE(IGNORED1, IGNORED2)
#define Cout(MESSAGE)
uint16_t m_nbLines
Definition: vEvent.hh:226
uint32_t m_timeInMs
Definition: vEvent.hh:225
int m_dataSpec
Definition: vEvent.hh:232