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