10 const SniperJSON& c1 = json[
"Ets1MissingSecond"];
12 it != c1[
"RunRanges"].
vec_end();
15 m_runRanges.push_back(std::make_pair(
16 (*it)[
"From"].get<int>(),
17 (*it)[
"To"].get<int>() ));
20 m_runs = c1[
"Runs"].
get<std::vector<int> >();
31 m_tRoundSwitch = json[
"TimeRoundSwitch"].
get<
int>();
43 if ( run == m_lastRun ) {
44 goodFlag = m_lastFlag;
47 for ( std::vector<std::pair<int, int> >::iterator it = m_runRanges.begin();
48 it != m_runRanges.end();
51 if ( run >= it->first && run <= it->second ) {
57 if ( goodFlag && std::find(m_runs.begin(), m_runs.end(), run) != m_runs.end() ) {
61 m_lastFlag = goodFlag;
64 m_t0Sec = header->
time();
80 long tNow = header->
time() - m_t0Sec;
81 unsigned long _ets1 = header->
etsT1();
82 long ets1NanoSec = _ets1 % 2000000;
85 long _shift0 = ets1NanoSec % 2000000;
86 if ( _shift0 > m_t0NanoShift0 ) {
87 m_t0NanoShift0 = _shift0;
90 else if ( tNow == 1 ) {
91 if ( m_t0NanoShift1 == -1 ) {
92 if ( ets1NanoSec > m_t0NanoShift0 ) {
93 m_t0NanoShift1 = ets1NanoSec;
99 if ( m_t0NanoShift1 > 0 && ets1NanoSec >= m_t0NanoShift1 ) {
103 unsigned long ets1 = tNow*2000000 + ets1NanoSec;
107 if ( labs(ets1-m_lastEts1) < 1000000 &&
abs(evtDiff) < 100 ) {
111 if ( ets1NanoSec > m_t0NanoShift0-200000 ) {
112 long tDiff = ets1NanoSec - m_lastEts1%2000000;
113 if ( tDiff > 1000000 ) {
114 if ( evtDiff < 100 ) {
115 tNow = m_lastEts1/2000000 - 1;
118 else if ( tDiff < -1000000 ) {
119 if ( evtDiff > 100 ) {
120 tNow = m_lastEts1/2000000 + 1;
124 tNow = m_lastEts1/2000000;
126 ets1 = tNow*2000000 + ets1NanoSec;
132 if (
abs(evtDiff) < 100 ) {
139 unsigned long _ets2 = header->
etsT2();
142 if ( _ets2 == m_lastEts2Old ) {
146 unsigned long ets1 = header->
etsT1();
147 long ets1NanoSec = ets1%2000000;
148 long tNow = ets1/2000000;
150 long ets2NanoSec = _ets2 % 2000000;
152 long tDiff = ets2NanoSec - ets1NanoSec;
153 if ( tDiff > 1000000 ) {
156 else if ( tDiff < -1000000 ) {
160 unsigned long ets2 = tNow*2000000 + ets2NanoSec;
163 m_lastEts2Old = _ets2;
164 m_lastEts2New = ets2;
OfflineRevise(const SniperJSON &json)
void fixHeader(Event::EventHeader *header)
std::vector< SniperJSON >::const_iterator vec_iterator
vec_iterator vec_end() const