BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
EsTimeCalibData.cxx
Go to the documentation of this file.
1/** @class EsTimeCalibData
2 * Implementation of EsTimeCalibData calibration TCDS class
3 */
4
5#include "CalibData/EsTime/EsTimeCalibData.h"
6#include "GaudiKernel/MsgStream.h"
7namespace CalibData {
8 EsTimeCalibData::EsTimeCalibData() : m_TestCalibConst( 0 ) {
9 // if( m_TestCalibConst) { delete m_TestCalibConst; }
10 if ( m_toffsetb.size() > 0 ) { m_toffsetb.clear(); }
11 if ( m_toffsete.size() > 0 ) { m_toffsete.clear(); }
12 if ( m_bunchtime.size() > 0 ) { m_bunchtime.clear(); }
13 if ( m_runFrom.size() > 0 ) { m_runFrom.clear(); }
14 if ( m_runTo.size() > 0 ) { m_runTo.clear(); }
15 if ( m_eventFrom.size() > 0 ) { m_eventFrom.clear(); }
16 if ( m_eventTo.size() > 0 ) { m_eventTo.clear(); }
17 return;
18 }
19
20 StatusCode EsTimeCalibData::update( CalibBase1& other, MsgStream* log ) {
21 EsTimeCalibData& other1 = dynamic_cast<EsTimeCalibData&>( other );
22 std::cout << "========================================"
23 << "\n"
24 << "here is the update in the EsTimeCalibData"
25 << "\n"
26 << "==================================================" << std::endl;
27 CalibBase1::update( other, log );
28 // set the Calibration Data
29 if ( m_TestCalibConst ) { delete m_TestCalibConst; }
30 if ( m_toffsetb.size() > 0 ) { m_toffsetb.clear(); }
31 if ( m_toffsete.size() > 0 ) { m_toffsete.clear(); }
32 if ( m_bunchtime.size() > 0 ) { m_bunchtime.clear(); }
33 if ( m_runFrom.size() > 0 ) { m_runFrom.clear(); }
34 if ( m_runTo.size() > 0 ) { m_runTo.clear(); }
35 if ( m_eventFrom.size() > 0 ) { m_eventFrom.clear(); }
36 if ( m_eventTo.size() > 0 ) { m_eventTo.clear(); }
37
38 m_TestCalibConst = new vector<double>( *other1.m_TestCalibConst );
39 m_toffsetb = other1.m_toffsetb;
40 m_toffsete = other1.m_toffsete;
41 m_bunchtime = other1.m_bunchtime;
42 m_runFrom = other1.m_runFrom;
43 m_runTo = other1.m_runTo;
44 m_eventFrom = other1.m_eventFrom;
45 m_eventTo = other1.m_eventTo;
46
47 return StatusCode::SUCCESS;
48 }
49
50 // set the Calibdata of EsTime
51 void EsTimeCalibData::setTestCalibConst( const vector<double>* TestCalibConst ) {
52 if ( m_TestCalibConst ) delete m_TestCalibConst;
53 m_TestCalibConst = new vector<double>( *TestCalibConst );
54 }
55
56 // set time of offset
57 void EsTimeCalibData::setToffsetb( const double toffset ) {
58 m_toffsetb.push_back( toffset );
59 return;
60 }
61
62 void EsTimeCalibData::setToffsete( const double toffset ) {
63 m_toffsete.push_back( toffset );
64 return;
65 }
66
67 // set the time interval of each bunch
68 void EsTimeCalibData::setBunchTime( const int bunchtime ) {
69 m_bunchtime.push_back( bunchtime );
70 return;
71 }
72
73 void EsTimeCalibData::setRunFrom( const int runFrom ) {
74 m_runFrom.push_back( runFrom );
75 return;
76 }
77
78 void EsTimeCalibData::setRunTo( const int runTo ) {
79 m_runTo.push_back( runTo );
80 return;
81 }
82
83 void EsTimeCalibData::setEventFrom( const int eventFrom ) {
84 m_eventFrom.push_back( eventFrom );
85 return;
86 }
87
88 void EsTimeCalibData::setEventTo( const int eventTo ) {
89 m_eventTo.push_back( eventTo );
90 return;
91 }
92
93 double EsTimeCalibData::getToffsetb() { return getToffsetb( 0 ); }
94
95 double EsTimeCalibData::getToffsetb( unsigned int No ) {
96 double toffsetb = 0.0;
97 if ( m_toffsetb.size() != 0 )
98 {
99 vector<double>::iterator it = m_toffsetb.begin() + No;
100 toffsetb = ( *it );
101 }
102 return toffsetb;
103 }
104
106
107 double EsTimeCalibData::getToffsete( unsigned int No ) {
108 double toffsete = 0.0;
109 if ( m_toffsete.size() != 0 )
110 {
111 vector<double>::iterator it = m_toffsete.begin() + No;
112 toffsete = ( *it );
113 }
114 return toffsete;
115 }
116
118
119 double EsTimeCalibData::getBunchTime( unsigned int No ) {
120 double bunchtime = 0.0;
121 if ( m_bunchtime.size() != 0 )
122 {
123 vector<int>::iterator it = m_bunchtime.begin() + No;
124 bunchtime = ( *it );
125 }
126 return bunchtime;
127 }
128
130
131 int EsTimeCalibData::getRunFrom( unsigned int No ) {
132 int runFrom = 0.0;
133 if ( m_runFrom.size() != 0 )
134 {
135 vector<int>::iterator it = m_runFrom.begin() + No;
136 runFrom = ( *it );
137 }
138 return runFrom;
139 }
140
141 int EsTimeCalibData::getRunTo() { return getRunTo( 0 ); }
142
143 int EsTimeCalibData::getRunTo( unsigned int No ) {
144 int runTo = 0.0;
145 if ( m_runTo.size() != 0 )
146 {
147 vector<int>::iterator it = m_runTo.begin() + No;
148 runTo = ( *it );
149 }
150 return runTo;
151 }
152
153 int EsTimeCalibData::getEventFrom( unsigned int No ) {
154 int eventFrom = 0.0;
155 if ( m_eventFrom.size() != 0 )
156 {
157 vector<int>::iterator it = m_eventFrom.begin() + No;
158 eventFrom = ( *it );
159 }
160 return eventFrom;
161 }
162
164
165 int EsTimeCalibData::getEventTo( unsigned int No ) {
166 int eventTo = 0.0;
167 if ( m_eventTo.size() != 0 )
168 {
169 vector<int>::iterator it = m_eventTo.begin() + No;
170 eventTo = ( *it );
171 }
172 return eventTo;
173 }
174
175} // namespace CalibData
virtual StatusCode update(CalibBase1 &obj, MsgStream *)
void setTestCalibConst(const vector< double > *TestCalibConst)
void setRunFrom(const int runFrom)
void setEventTo(const int eventTo)
void setToffsetb(const double toffsetb)
void setEventFrom(const int eventFrom)
virtual StatusCode update(CalibBase1 &other, MsgStream *log)
void setBunchTime(const int bunchtime)
void setRunTo(const int runTo)
void setToffsete(const double toffsete)