97 {
98 StatusCode sc = StatusCode::SUCCESS;
99
100 MsgStream log(
msgSvc(), name() );
101 log << MSG::INFO << "in execute()" << endmsg;
102
103 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
105
106 log << MSG::DEBUG << "ncharg, nneu, tottks = " << evtRecEvent->totalCharged() << " , "
107 << evtRecEvent->totalNeutral() << " , " << evtRecEvent->totalTracks() << endmsg;
109
110 log << MSG::DEBUG << "ncharg, nneu, tottks = " << evtRecEvent->totalCharged() << " , "
111 << evtRecEvent->totalNeutral() << " , " << evtRecEvent->totalTracks() << endmsg;
112 SmartDataPtr<RecEsTimeCol> evTimeCol( eventSvc(), "/Event/Recon/RecEsTimeCol" );
113
114 int interval = 200;
115 interval = m_intervalSvc->getTInterval();
116 log << MSG::DEBUG << "interval = " << interval << endmsg;
117 m_topup = false;
118 if ( interval <= 0 )
119 {
120 log << MSG::FATAL << "error in reading the interval!" << endmsg;
121 return StatusCode::FAILURE;
122 }
123 else if ( interval < 100 )
124 {
125 m_topup = true;
126 }
127
128 double time = eventHeader->time();
129 log << MSG::DEBUG <<
"time = " <<
time << endmsg;
130 if (
time <= 0 )
return StatusCode::SUCCESS;
132 m_etsT1 = eventHeader->etsT1() / 2000000.;
133 log << MSG::DEBUG << "ets time = " << m_etsT1 << endmsg;
134
135 m_run = eventHeader->runNumber();
136 m_rec = eventHeader->eventNumber();
137
138 if ( m_rec % 1000 == 0 )
139 log << MSG::INFO << "Run " << m_run << " Event " << m_rec << endmsg;
140
141 double Emax1 = -1;
142 double Emax2 = -1;
143 int Imax[2];
144
145 if ( ( evtRecEvent->totalTracks() >= 2 ) )
146 {
148 for ( int i = 0; i < evtRecEvent->totalTracks(); i++ )
149 {
150 if ( i >= evtRecTrkCol->size() ) break;
152 if ( !( *itTrk )->isEmcShowerValid() ) continue;
153 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
154 double Ener = emcTrk->
energy();
155 if ( Ener > Emax2 )
156 {
157 Emax2 = Ener;
158 Imax[1] = i;
159 }
160 if ( Ener > Emax1 )
161 {
162 Emax2 = Emax1;
163 Imax[1] = Imax[0];
164 Emax1 = Ener;
165 Imax[0] = i;
166 }
168 }
169
171 m_e1 = Emax1;
172 m_e2 = Emax2;
173
174 log << MSG::INFO << "Emax1 = " << Emax1 << "Emax2= " << Emax2 << endmsg;
175 if ( Emax1 > 0 && Emax2 > 0 )
176 {
177 double emcphi[2], emctht[2];
178 for ( int i = 0; i < 2; i++ )
179 {
180 if ( i >= evtRecTrkCol->size() ) break;
182 if ( !( *itTrk )->isEmcShowerValid() ) continue;
183 RecEmcShower* emcTrk = ( *itTrk )->emcShower();
184 emcphi[i] = emcTrk->
phi();
185 emctht[i] = emcTrk->
theta();
186 }
187
188 double dltphi = ( fabs( emcphi[0] - emcphi[1] ) -
pai ) * 180. /
pai;
189 double dlttht = ( fabs( emctht[0] + emctht[1] ) -
pai ) * 180. /
pai;
190 m_costht1 =
cos( emctht[0] );
191 m_costht2 =
cos( emctht[1] );
192 m_phi1 = emcphi[0];
193 m_phi2 = emcphi[1];
194 m_dlttht = dlttht;
196 }
197 else
198 {
199 m_etot = -1;
200 m_e1 = -1;
201 m_e2 = -1;
202 m_costht1 = -1;
203 m_costht2 = -1;
204 m_phi1 = -1;
205 m_phi2 = -1;
206 m_dlttht = -1;
207 m_dltphi = -1;
208 }
209 }
210 else
211 {
212 m_etot = -1;
213 m_e1 = -1;
214 m_e2 = -1;
215 m_costht1 = -1;
216 m_costht2 = -1;
217 m_phi1 = -1;
218 m_phi2 = -1;
219 m_dlttht = -1;
220 m_dltphi = -1;
221 }
222
223
224
225 StatusCode DiskWrite = m_tuple2->write();
226 if ( DiskWrite != StatusCode::SUCCESS )
227 {
228 log << MSG::FATAL << "ERROR In LumTau DiskWrite!" << endmsg;
229 exit( 1 );
230 }
231
232 return StatusCode::SUCCESS;
233}
EvtRecTrackCol::iterator EvtRecTrackIterator
double cos(const BesAngle a)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol