59 MsgStream log(
msgSvc(), name());
61 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
62 unsigned long t1 = eventHeader->etsT1();
63 unsigned long t2 = eventHeader->etsT2();
71 cout <<
"GetRawETS::execute() m_interval = " << m_interval << endl;
72 m_printInterval =
false;
75 double dt1 = (double(t1)/double(2000000.));
76 double dt2 = (double(t2)/double(2000000.));
78 std::cout <<
"Event: " << eventHeader->eventNumber()
79 <<
" run: " << eventHeader->runNumber()
80 <<
" time: " << eventHeader->time()
86 if ( t2 != 0 && t2 != m_ets2 ) {
88 m_vec.push_back(m_ets2);
99 return StatusCode::SUCCESS;
104 if ( m_vec.empty() ) {
107 return StatusCode::SUCCESS;
110 std::sort(m_vec.begin(), m_vec.end());
111 m_vec.erase(std::unique(m_vec.begin(), m_vec.end()), m_vec.end());
113 unsigned long _interval = m_interval * 2000;
117 unsigned long tmp = m_vec.front();
118 for (
int j = m_nfill; j > 0; --j ) {
119 if ( tmp <= _interval*j )
continue;
121 m_ets2 = tmp - _interval*j;
128 for (
unsigned int i = 1; i < m_vec.size(); ++i ) {
129 unsigned long diff = m_vec[i] - m_vec[i-1];
130 bool _1stEvtInTopUp =
false;
132 if ( diff > _interval*(m_nfill+1)*2+10000 ) {
133 _1stEvtInTopUp =
true;
134 for (
int j = 1; j < m_nfill+1; ++j ) {
136 m_ets2 = m_vec[i-1] + _interval*j;
139 for (
int j = m_nfill; j > 0; --j ) {
141 m_ets2 = m_vec[i] - _interval*j;
145 else if ( diff > _interval+10000 ) {
146 for (
int j = 1; j < 10; ++j ) {
148 m_ets2 = m_vec[i-1] + _interval*j;
149 if ( m_ets2 >= m_vec[i] || m_vec[i]-m_ets2 < 10000 ) {
156 m_flag = _1stEvtInTopUp ? m_1stFlag : 0;
161 unsigned long tmp = m_vec.back();
162 for (
int j = 1; j < m_nfill+1; ++j ) {
164 m_ets2 = tmp + _interval*j;
172 return StatusCode::SUCCESS;