Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MbdOutV2.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MbdOutV2.cc
1 #include "MbdOutV2.h"
2 #include "MbdReturnCodes.h"
3 
4 #include <TClonesArray.h>
5 
6 #include <iostream>
7 
8 //______________________________________
9 MbdOutV2::MbdOutV2() = default;
10 
11 //______________________________________
13 {
14  bz = std::numeric_limits<Float_t>::quiet_NaN();
15  bzerr = std::numeric_limits<Float_t>::quiet_NaN();
16  bt0 = std::numeric_limits<Float_t>::quiet_NaN();
17  bt0err = std::numeric_limits<Float_t>::quiet_NaN();
18  bns = 0.;
19  bnn = 0.;
20  bqs = 0.;
21  bqn = 0.;
22  bts = std::numeric_limits<Float_t>::quiet_NaN();
23  btn = std::numeric_limits<Float_t>::quiet_NaN();
24  evt = -1;
25  clk = 0;
26  femclk = 0;
27 }
28 
29 //______________________________________
30 MbdOutV2::~MbdOutV2() = default;
31 
32 //______________________________________
33 int MbdOutV2::isValid() const
34 {
35  // compatible with old invalid setting of -9999.9
36  return ((std::isfinite(bt0) && (bt0 > -9999.)) ? 1 : 0);
37 }
38 
39 /*
40 //______________________________________
41 void MbdOutV2::Reset()
42 {
43  Init();
44 }
45 */
46 
47 //______________________________________
48 void MbdOutV2::identify(std::ostream &out) const
49 {
50  out << "identify yourself: I am a MbdOutV2 object" << std::endl;
51  out << "Vertex: " << bz << " Error: " << bzerr << std::endl;
52  out << "T0: " << bt0 << " Error: " << bt0err << std::endl;
53 }
54 
55 //______________________________________
56 void MbdOutV2::set_t0(const Float_t t0, const Float_t t0err)
57 {
58  bt0 = t0;
59  bt0err = t0err;
60 }
61 
62 //______________________________________
63 void MbdOutV2::set_zvtx(const Float_t vtx, const Float_t vtxerr)
64 {
65  bz = vtx;
66  bzerr = vtxerr;
67 }
68 
69 //______________________________________
70 void MbdOutV2::set_zvtxerr(const Float_t vtxerr)
71 {
72  bzerr = vtxerr;
73 }
74 
75 //______________________________________
76 void MbdOutV2::set_arm(const int iarm, const Short_t npmt, const Float_t charge, const Float_t timing)
77 {
78  if (iarm == 0)
79  {
80  bns = npmt;
81  bqs = charge;
82  bts = timing;
83  }
84  else if (iarm == 1)
85  {
86  bnn = npmt;
87  bqn = charge;
88  btn = timing;
89  }
90  else
91  {
92  std::cerr << "MbdOutV2::set_arm(): ERROR, invalid arm " << iarm << std::endl;
93  }
94 }
95 
96 //______________________________________
97 void MbdOutV2::set_clocks(const Int_t ievt, const UShort_t iclk, const UShort_t ifemclk)
98 {
99  evt = ievt;
100  clk = iclk;
101  femclk = ifemclk;
102 }
103 
104 //______________________________________
105 Short_t MbdOutV2::get_npmt(const int iarm) const
106 {
107  return (iarm == 0) ? bns : bnn;
108 }
109 
110 //______________________________________
111 Float_t MbdOutV2::get_q(const int iarm) const
112 {
113  return (iarm == 0) ? bqs : bqn;
114 }
115 
116 Float_t MbdOutV2::get_time(const int iarm) const
117 {
118  return (iarm == 0) ? bts : btn;
119 }
120 
121 Int_t MbdOutV2::get_evt() const
122 {
123  return evt;
124 }
125 
126 UShort_t MbdOutV2::get_clock() const
127 {
128  return clk;
129 }
130 
131 UShort_t MbdOutV2::get_femclock() const
132 {
133  return femclk;
134 }