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