Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawTower_Prototype3.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawTower_Prototype3.cc
1 #include "RawTower_Prototype3.h"
2 
3 #include "PROTOTYPE3_FEM.h"
4 
5 #include <calobase/RawTowerDefs.h>
6 
7 #include <algorithm>
8 #include <cassert>
9 #include <cmath>
10 #include <iostream>
11 #include <vector> // for vector
12 
13 using namespace std;
14 
16  : towerid(~0)
17  , // initialize all bits on
18  energy(0)
19  , time(NAN)
20  , HBD_channel(-1)
21 {
22  fill_n(signal_samples, NSAMPLES, -9999);
23 }
24 
26  : towerid(id)
27  , energy(0)
28  , time(NAN)
29  , HBD_channel(-1)
30 {
31  fill_n(signal_samples, NSAMPLES, -9999);
32 }
33 
35  const unsigned int irow)
36  : towerid(0)
37  , energy(0)
38  , time(NAN)
39  , HBD_channel(-1)
40 {
42  fill_n(signal_samples, NSAMPLES, -9999);
43 }
44 
46  const RawTowerDefs::CalorimeterId caloid, const unsigned int ieta,
47  const unsigned int iphi)
48  : towerid(0)
49  , energy(0)
50  , time(NAN)
51  , HBD_channel(-1)
52 {
53  towerid = RawTowerDefs::encode_towerid(caloid, ieta, iphi);
54  fill_n(signal_samples, NSAMPLES, -9999);
55 }
56 
58 {
59  energy = 0;
60  time = NAN;
61  fill_n(signal_samples, NSAMPLES, -9999);
62 }
63 
64 int RawTower_Prototype3::isValid() const { return get_energy() != 0; }
65 
66 void RawTower_Prototype3::identify(std::ostream &os) const
67 {
68  os << "RawTower_Prototype3: etabin: " << get_bineta()
69  << ", phibin: " << get_binphi() << " energy=" << get_energy() << std::endl;
70 }
71 
74 {
75  assert(i >= 0);
76  assert(i < NSAMPLES);
77  signal_samples[i] = sig;
78 }
79 
82 {
83  assert(i >= 0);
84  assert(i < NSAMPLES);
85  return signal_samples[i];
86 }
87 
89 {
90  double peak = NAN;
91  double peak_sample = NAN;
92  double pedstal = NAN;
93 
94  vector<double> vec_signal_samples;
95  for (int i = 0; i < NSAMPLES; i++)
96  {
97  vec_signal_samples.push_back(signal_samples[i]);
98  }
99 
100  PROTOTYPE3_FEM::SampleFit_PowerLawExp(vec_signal_samples, peak, peak_sample,
101  pedstal, verbosity);
102 
103  return peak;
104 }