GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasePeak.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004-2006 by Olivier Stezowski & Christian Finck *
3  * stezow(AT)ipnl.in2p3.fr, cfinck(AT)ires.in2p3.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_BasePeak
24 #include "BasePeak.h"
25 #endif
26 
27 Gw::BasePeak::GateColor Gw::BasePeak::gGateColor = { kRed-9, kBlue-7, kGreen-8, kYellow-6 };
28 
29 using namespace Gw;
30 
32 
33 //__________________________________________________________
34 BasePeak::BasePeak(const char* name, const char* title) : TNamed(name, title),
35  fHeight(0.0),
36  fIntensity(0.0),
37  fDimension(0),
38  fIsFitOn(false),
39  fIsCombined(false)
40 {
41  //Default Constructor
42 
43 }
44 
45 //__________________________________________________________
47 {
48 // default destructor
49 }
50 
51 
52 //__________________________________________________________
53 BasePeak::BasePeak(const BasePeak& p) : TNamed(p),
54  fHeight(p.fHeight),
55  fIntensity(p.fIntensity),
56  fDimension(p.fDimension),
57  fIsFitOn(p.fIsFitOn),
58  fIsCombined(p.fIsCombined)
59 {
60  // copy constructor
61 }
62 
63 
64 //__________________________________________________________
66 {
67  if (this == &p)
68  return *this;
69 
70  ((TNamed &)p).TNamed::Copy((*this));
71 
72  fHeight = p.fHeight;
75  fIsFitOn = p.fIsFitOn;
77 
78  return *this;
79 }
80 
81 //__________________________________________________________
82 Bool_t BasePeak::IsvalideGateColor(Color_t co)
83 {
84  if (co == gGateColor.k0) return true;
85  if (co == gGateColor.k1) return true;
86  if (co == gGateColor.k2) return true;
87  if (co == gGateColor.k3) return true;
88 
89  return false;
90 }
91 
92 //__________________________________________________________
93 Color_t BasePeak::GetGateColor(Int_t idx)
94 {
95  switch (idx) {
96  case 0:
97  return gGateColor.k0;
98  case 2:
99  return gGateColor.k1;
100  case 3:
101  return gGateColor.k2;
102  case 4:
103  return gGateColor.k3;
104  default:
105  return -1;
106  }
107 
108 }
109 
110 //__________________________________________________________
111 Int_t BasePeak::GetGateAxis(Color_t co)
112 {
113  if (co == gGateColor.k0)
114  return 0;
115  else if (co == gGateColor.k1)
116  return 1;
117  else if (co == gGateColor.k2)
118  return 2;
119  else if (co == gGateColor.k3)
120  return 3;
121  else
122  return -1;
123 }
124 
125 //__________________________________________________________
126 void BasePeak::FitOn(Bool_t fit_on)
127 {
128  fIsFitOn = fit_on;
129 }
130 
131 //__________________________________________________________
132 void BasePeak::Print(Option_t* /*opt*/) const
133 {
134  printf("Height: %6.1f\n", fHeight);
135  if (fIntensity > 0.)
136  printf("Intensity: %7.1f\n", fIntensity);
137 }
138 
139 
140 
141 
142 
printf("******************************************************************** \n")
Bool_t fIsCombined
flag to stated peak is part of a combined fit
Definition: BasePeak.h:133
Double_t fIntensity
intensity of the peak
Definition: BasePeak.h:130
static GateColor gGateColor
Definition: BasePeak.h:30
UShort_t fDimension
dimension of the peak
Definition: BasePeak.h:131
virtual void FitOn(Bool_t fit_on=true)
Definition: BasePeak.cpp:126
static Int_t GetGateAxis(Color_t co)
Definition: BasePeak.cpp:111
Bool_t fIsFitOn
flag for fitted peak
Definition: BasePeak.h:132
BasePeak(const char *name, const char *title)
virtual void Print(Option_t *opt="") const
print current peak
Definition: BasePeak.cpp:132
ClassImp(BasePeak) BasePeak
Definition: BasePeak.cpp:31
virtual ~BasePeak()
Definition: BasePeak.cpp:46
Double_t fHeight
height of the Peak
Definition: BasePeak.h:129
static Bool_t IsvalideGateColor(Color_t co)
Definition: BasePeak.cpp:82
A BasePeak is defined by a height, intensity and a dimension of the peak.
Definition: BasePeak.h:19
BasePeak & operator=(const BasePeak &p)
Definition: BasePeak.cpp:65
static Color_t GetGateColor(Int_t idx)
Definition: BasePeak.cpp:93