Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RawTower_Temperature.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RawTower_Temperature.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef PROTOTYPE4_RAWTOWERTEMPERATURE_H
4 #define PROTOTYPE4_RAWTOWERTEMPERATURE_H
5 
6 #include <calobase/RawTower.h>
7 #include <calobase/RawTowerDefs.h>
8 
9 #include <ctime>
10 #include <iostream> // for cout, ostream
11 #include <vector>
12 
14 {
15  public:
17  RawTower_Temperature(const unsigned int icol, const unsigned int irow);
19  virtual ~RawTower_Temperature() {}
20 
21  void Reset() override;
22  int isValid() const override { return get_nr_entries(); }
23  void identify(std::ostream &os = std::cout) const override;
24  void print(std::ostream &os = std::cout) const;
25 
26  int get_column() const override { return RawTowerDefs::decode_index1(towerid); }
27  int get_row() const override { return RawTowerDefs::decode_index2(towerid); }
28 
29  void set_id(RawTowerDefs::keytype id) override { towerid = id; }
30  RawTowerDefs::keytype get_id() const override { return towerid; }
31 
32  int get_nr_entries() const { return temperatures.size(); }
33 
34  int add_entry(const int eventnr, const time_t t, const float temp)
35  {
36  eventnumbers.push_back(eventnr);
37  times.push_back(t);
38  temperatures.push_back(temp);
39  return get_nr_entries();
40  }
41 
42  float get_temperature_from_entry(const unsigned int entry) const
43  {
44  if (entry >= temperatures.size())
45  return -1;
46  return temperatures[entry];
47  }
48 
49  time_t get_time_from_entry(const unsigned int entry) const
50  {
51  if (entry >= times.size())
52  return 0; // 1970...
53  return times[entry];
54  }
55 
56  int get_eventnumber_from_entry(const unsigned int entry) const
57  {
58  if (entry >= eventnumbers.size())
59  return -1;
60  return eventnumbers[entry];
61  }
62 
63  float get_temperature_from_time(const time_t t) const;
64 
65  //---Raw data
66  //access------------------------------------------------------------
67 
68  protected:
70 
75  std::vector<int> eventnumbers;
76  std::vector<time_t> times;
77  std::vector<float> temperatures;
78 
79  ClassDefOverride(RawTower_Temperature, 1)
80 };
81 
82 #endif