103{
104 if ( m_vec.empty() ) {
105
106 m_root->Write();
107 return StatusCode::SUCCESS;
108 }
109
110 std::sort(m_vec.begin(), m_vec.end());
111 m_vec.erase(std::unique(m_vec.begin(), m_vec.end()), m_vec.end());
112
113 unsigned long _interval = m_interval * 2000;
114
115
116 {
117 unsigned long tmp = m_vec.front();
118 for ( int j = m_nfill; j > 0; --j ) {
119 if ( tmp <= _interval*j ) continue;
120 m_flag = 10 + j;
121 m_ets2 = tmp - _interval*j;
122 m_tree->Fill();
123 }
124 m_flag = m_1stFlag;
125 m_ets2 = tmp;
126 m_tree->Fill();
127 }
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;
131
132 if ( diff > _interval*(m_nfill+1)*2+10000 ) {
133 _1stEvtInTopUp = true;
134 for ( int j = 1; j < m_nfill+1; ++j ) {
135 m_flag = 20 + j;
136 m_ets2 = m_vec[i-1] + _interval*j;
137 m_tree->Fill();
138 }
139 for ( int j = m_nfill; j > 0; --j ) {
140 m_flag = 10 + j;
141 m_ets2 = m_vec[i] - _interval*j;
142 m_tree->Fill();
143 }
144 }
145 else if ( diff > _interval+10000 ) {
146 for ( int j = 1; j < 10; ++j ) {
147 m_flag = 1;
148 m_ets2 = m_vec[i-1] + _interval*j;
149 if ( m_ets2 >= m_vec[i] || m_vec[i]-m_ets2 < 10000 ) {
150 break;
151 }
152 m_tree->Fill();
153 }
154 }
155
156 m_flag = _1stEvtInTopUp ? m_1stFlag : 0;
157 m_ets2 = m_vec[i];
158 m_tree->Fill();
159 }
160 {
161 unsigned long tmp = m_vec.back();
162 for ( int j = 1; j < m_nfill+1; ++j ) {
163 m_flag = 20 + j;
164 m_ets2 = tmp + _interval*j;
165 m_tree->Fill();
166 }
167 }
168
169
170 m_root->Write();
171
172 return StatusCode::SUCCESS;
173}