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