GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Peak.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004-2006 by Olivier Stezowski & Christophe Theisen *
3  * stezow(AT)ipnl.in2p3.fr, christophe.theisen(AT)cea.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef GW_PEAK_H
24 #include "Peak.h"
25 #endif
26 
27 #include <iostream>
28 #include <fstream>
29 
30 using namespace std;
31 using namespace GwD;
32 
33 // ROOT dictionnary
34 ClassImp(Peak);
35 
36 Peak::Peak() //Default constructor (dimansion = 1)
37 {
38  fDim = 1;
39  fPos = new TArrayD(1);
40  fRes = new TArrayD(1);
41  fInt = 0.0;
42 }
43 
44 Peak::Peak(Int_t n) //Constructor (n dimensions)
45 {
46  if (n <= 0 ) Peak();
47  else {
48  fDim = n;
49  fPos = new TArrayD(n);
50  fRes = new TArrayD(n);
51  fInt = 0.0;
52  }
53 }
54 
55 Peak::Peak(const Peak& p):TObject(p)
56 {
57  this->fDim = p.fDim;
58  this->fPos = new TArrayD(this->fDim,(p.fPos)->GetArray());
59  this->fRes = new TArrayD(this->fDim,(p.fRes)->GetArray());
60  this->fInt = p.fInt;
61 }
62 
63 
65  delete fPos;
66  delete fRes;
67 }
68 
69 void Peak::Set(Int_t n)
70 {
71  if (n <= 0) fDim = 1; else fDim = n;
72  fPos->Set(fDim);
73  fRes->Set(fDim);
74 }
75 
76 
77 void Peak::SetPosition(const Double_t x, const Double_t y, const Double_t z)
78 {
79  Double_t *tab = new Double_t[3]; tab[0] = x; tab[1] = y; tab[2] = z;
80  fPos->Set(fDim,tab);
81  delete [] tab;
82 }
83 
84 void Peak::SetPosition(const Double_t *array)
85 {
86  fPos->Set(fDim,array);
87 }
88 
89 void Peak::SetResolution(const Double_t x, const Double_t y, const Double_t z)
90 {
91  Double_t *tab = new Double_t[3]; tab[0] = x; tab[1] = y; tab[2] = z;
92  fRes->Set(fDim,tab);
93  delete [] tab;
94 }
95 
96 void Peak::SetResolution(const Double_t *array)
97 {
98  fRes->Set(fDim,array);
99 }
100 
101 void Peak::SetIntensity(const Double_t val)
102 {
103  fInt = val;
104 }
105 
107  return fDim;
108 }
109 
110 Double_t Peak::GetPosition(const Int_t i)
111 {
112  return fPos->At(i);
113 }
114 
115 const Double_t* Peak::GetPosition()
116 {
117  return fPos->GetArray();
118 }
119 
120 Double_t Peak::GetResolution(const Int_t i)
121 {
122  return fRes->At(i);
123 }
124 
125 const Double_t* Peak::GetResolution()
126 {
127  return fRes->GetArray();
128 }
129 
131 {
132  return fInt;
133 }
134 
135 
136 
137 
138 
139 
140 
141 
142 
void SetResolution(const Double_t x, const Double_t y=0.0, const Double_t z=0.0)
Definition: Peak.cpp:89
const Double_t * GetResolution()
Definition: Peak.cpp:125
Double_t GetIntensity()
Definition: Peak.cpp:130
Int_t GetSize()
Definition: Peak.cpp:106
const Double_t * GetPosition()
Definition: Peak.cpp:115
void SetPosition(const Double_t x, const Double_t y=0.0, const Double_t z=0.0)
Definition: Peak.cpp:77
header file for the calibration facility
void Set(Int_t n)
Set the dimension. A new array for position (resolution) is created, the old contents copied to new a...
Definition: Peak.cpp:69
void Peak()
Definition: Peak.C:3
Description of the class.
Definition: Peak.h:43
void SetIntensity(const Double_t val)
Definition: Peak.cpp:101
ClassImp(Peak)
virtual ~Peak()
Definition: Peak.cpp:64