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