HARPO  5.1.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HarpoDccMap.cxx
Go to the documentation of this file.
1 //
2 // File HarpoDccMap.cxx
3 //
11 #include "HarpoDccMap.h"
12 #include <iostream>
13 
14 ClassImp(HarpoDccMap)
15 
16 HarpoDccMap::HarpoDccMap() : map(NALL,NADC) , fEmptyCell(-1.0)
17 {
18  map = fEmptyCell;
19  fPedestal = NULL;
20 }
21 
22 // void HarpoDccMap::SetEmptyCell(Short_t val)
23 // {
24 // fEmptyCell = (Double_t) val;
25 // }
26 
27 void HarpoDccMap::SetEmptyCell(Double_t val)
28 {
29  fEmptyCell = val;
30 }
31 
32 
33 // void HarpoDccMap::SetPedestal(UShort_t ped)
34 // {
35 
36 // for(Int_t i = 0; i<NALL; i++)
37 // fPedestal[i] = (Double_t) ped;
38 // }
39 
40 // void HarpoDccMap::SetPedestal(Int_t i, Double_t ped){
41 // if(i<0 || i>=NALL) Warning("SetPedestal","index out of bounds (%d)",i);
42 // else fPedestal[i] = ped;
43 // }
44 
45 void HarpoDccMap::SetPedestal(Double_t ped)
46 {
47  fPedestal->SetMean(ped);
48 }
49 
50 Double_t HarpoDccMap::GetPedestal(Int_t i){
51  if(i<0 || i>=NALL){
52  Warning("GetPedestal","index out of bounds (%d)",i);
53  return -1;
54  }else return fPedestal->GetPed((UInt_t) i);
55 }
56 
57 
58 void HarpoDccMap::SetSigmaNoise(Double_t val)
59 {
60  fPedestal->SetSigma(val);
61 }
62 
63 // void HarpoDccMap::SetSigmaNoise(Int_t i, Double_t val){
64 // if(i<0 || i>=NALL) Warning("SetSigmaNoise","index out of bounds (%d)",i);
65 // else fSigmaNoise[i] = val;
66 // }
67 
68 Double_t HarpoDccMap::GetSigmaNoise(Int_t i){
69  if(i<0 || i>=NALL){
70  Warning("GetSigmaNoise","index out of bounds (%d)",i);
71  return -1;
72  }else return fPedestal->GetSigma((UInt_t) i);
73 }
74 
75 Double_t HarpoDccMap::GetRawData(Int_t i, Int_t j){
76  if(i>=0 && i<NALL && j>=0 && j<NADC) {
77  return map(i,j);
78  } else {
79  Warning("GetData","index out of matix boundd (%d,%d)",i,j);
80  return -2000.0;
81  }
82 }
83 
84 Double_t HarpoDccMap::GetData(Int_t i, Int_t j){
85  if(i>=0 && i<NALL && j>=0 && j<NADC) {
86  if(map(i,j) == -1) return -1000.0;
87  else return map(i,j) - fPedestal->GetPed((UInt_t) i);
88  } else {
89  Warning("GetData","index out of matix boundd (%d,%d)",i,j);
90  return -2000.0;
91  }
92 }
93 
94 void HarpoDccMap::SetRawData(Int_t i, Int_t j, Double_t val){
95  if(i>=0 && i<NALL && j>=0 && j<NADC) {
96  map(i,j) = val;
97  } else {
98  Warning("SetRawData","index out of matix boundd (%d,%d)",i,j);
99  }
100 }
101 
102 void HarpoDccMap::SetData(Int_t i, Int_t j, Double_t val){
103  if(i>=0 && i<NALL && j>=0 && j<NADC) {
104  map(i,j) = val + fPedestal->GetPed((UInt_t) i);
105  } else {
106  Warning("SetData","index out of matix boundd (%d,%d)",i,j);
107  }
108 }
109 
110 void HarpoDccMap::FillIf(HarpoDccMap *m, Int_t row, Int_t col, UShort_t word)
111 {
112  // std::cout << "row " << row << " col " << col << " val " << word << std::endl;
113  if ( ( row >= 0 ) && (row < m->map.GetNrows() )
114  && (col >= 0 ) && (col < m->map.GetNcols())) {
115  // m->map(row,col) = (Double_t) word;
116  m->SetRawData(row,col,(Double_t) word);
117  }
118  else
119  {
120  std::cout << "---DccMap--- Bad Row Col " << row << " " << col << std::endl;
121  }
122 }
123 
125 {
126  std::cout << "---DccMap--- : fEmptyCell " << fEmptyCell << std::endl;
127  // map.Print("f= %6.2f ");
128  map.Print(); // "%11.4g"
129 }
#define NALL
Definition: HarpoDccMap.h:15
void SetSigma(Double_t sigma)
set sigmas
void SetPedestal(Double_t ped)
Definition: HarpoDccMap.cxx:45
Double_t GetRawData(Int_t i, Int_t j)
Definition: HarpoDccMap.cxx:75
HarpoPedestal * fPedestal
Definition: HarpoDccMap.h:73
void FillIf(HarpoDccMap *m, Int_t row, Int_t col, UShort_t word)
Fill map only if index in map range (0..nRaws-1) (0..nCols-1)
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Definition: HarpoDccMap.cxx:84
void SetData(Int_t i, Int_t j, Double_t val)
virtual void print()
void SetSigmaNoise(Double_t val)
Definition: HarpoDccMap.cxx:58
void SetMean(Double_t mean)
set means
Double_t GetPedestal(Int_t i)
Definition: HarpoDccMap.cxx:50
Double_t GetPed(UInt_t chan)
! Get Channel Pedestal Mean Value
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
Definition: HarpoDccMap.h:29
Double_t GetSigma(UInt_t chan)
! Get Channael Pedestal Sigma Value
#define NADC
Definition: HarpoDccMap.h:18
AdcMap map
Definition: HarpoDccMap.h:71
Double_t GetSigmaNoise(Int_t i)
Definition: HarpoDccMap.cxx:68
Double_t fEmptyCell
Not store pedestal object.
Definition: HarpoDccMap.h:75
void SetEmptyCell(Double_t val)
Empy Cell value , default -1.0.
Definition: HarpoDccMap.cxx:27
void SetRawData(Int_t i, Int_t j, Double_t val)
Definition: HarpoDccMap.cxx:94