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