75 MsgStream log(
msgSvc(), name());
79 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
81 log << MSG::FATAL <<
"Could not find Event Header" << endreq;
82 return( StatusCode::FAILURE);
98 unsigned int idBarrel_Endcap,iphi;
103 if(tofDataVec.size()>1){
104 TofDataVector::iterator iterTOF=tofDataVec.begin();
105 for(;iterTOF!= tofDataVec.end();iterTOF++) {
106 if((*iterTOF)->barrel()) {
108 int id=(*iterTOF)->tofId();
111 double t1=(*iterTOF)->tdc1();
112 double t2=(*iterTOF)->tdc2();
114 if(t1<1500&&t2<1500&&t1>0&&t2>0) tof=0.5*(t1+t2);
115 else if(t1<1500&&t1>0) tof=t1;
116 else if(t2<1500&&t2>0) tof=t2;
118 log <<MSG::DEBUG<<
"hit: " <<
"("<<idBarrel_Endcap<<
","<<ilayer<<
","<<iphi<<
")-->"<< tof <<
" ns"<<endreq;
123 topTOF.push_back(
EFTofHitsCol(idBarrel_Endcap,ilayer,iphi,tof));
125 else if(iphi>46&&iphi<85){
126 bottomTOF.push_back(
EFTofHitsCol(idBarrel_Endcap,ilayer,iphi,tof));
130 int iphi=(*iterTOF)->tofId();
131 double tof=(*iterTOF)->tdc();
136 else idBarrel_Endcap=0;
137 if(iphi>1&&iphi<22&&tof>0&&tof<1500){
138 topTOF.push_back(
EFTofHitsCol(idBarrel_Endcap,0,iphi,tof));
140 else if(iphi>25&&iphi<46&&tof>0&&tof<1500){
141 bottomTOF.push_back(
EFTofHitsCol(idBarrel_Endcap,0,iphi,tof));
150 if(topTOF.size()>=1&&bottomTOF.size()>=1){
151 for(
unsigned int i=0;i<topTOF.size();i++){
153 if(topTOF[i].ib_e()==1){
154 topPhi=topTOF[i].iphi()*360./88.;
156 else if(topTOF[i].ib_e()==0||topTOF[i].ib_e()==2){
157 topPhi=topTOF[i].iphi()*360./48.;
160 log << MSG::ERROR <<
"TOF Barrel_Encap ID not right!" << endreq;
162 for(
unsigned int j=0;j<bottomTOF.size();j++){
164 if(bottomTOF[j].ib_e()==1){
165 bottomPhi=bottomTOF[j].iphi()*360./88.;
167 else if(bottomTOF[j].ib_e()==0||bottomTOF[j].ib_e()==2){
168 bottomPhi=bottomTOF[j].iphi()*360./48.;
171 log << MSG::ERROR <<
"TOF Barrel_Encap ID not right!" << endreq;
173 double tmp1=fabs(topTOF[i].GetT()-bottomTOF[j].GetT());
174 double tmp2=fabs(topTOF[i].GetT()-bottomTOF[j].GetT()+7.);
175 if(tmp2<fabs(dtof2+7.)){
176 dtof2=topTOF[i].GetT()-bottomTOF[j].GetT();
177 dphi2=
abs(fabs(topPhi-bottomPhi)-180.);
179 if(tmp1<fabs(dtof1)){
180 dphi1=
abs(fabs(topPhi-bottomPhi)-180.);
181 dtof1=topTOF[i].GetT()-bottomTOF[j].GetT();
187 log << MSG::INFO <<
"dtof1=" << dtof1 <<
", dphi1=" << dphi1
188 <<
"dtof2=" << dtof2 <<
", dphi2=" << dphi2 <<endreq;
203 return StatusCode::SUCCESS;