75 MsgStream log(
msgSvc(), name());
77 log << MSG::INFO <<
"in initialize()" << endmsg;
81 NTuplePtr nt1(
ntupleSvc(),
"FILE1/DiGam");
82 if ( nt1 ) m_tuple1 = nt1;
85 m_tuple1 =
ntupleSvc()->book (
"FILE1/DiGam", CLID_ColumnWiseTuple,
"DiGam N-Tuple signal");
88 status = m_tuple1->addItem (
"run", m_run );
89 status = m_tuple1->addItem (
"rec", m_rec );
90 status = m_tuple1->addItem (
"time", m_time );
92 status = m_tuple1->addItem (
"ngood", m_ngood);
93 status = m_tuple1->addItem (
"nchrg", m_nchrg);
95 status = m_tuple1->addItem (
"Cms_e1", m_e1);
96 status = m_tuple1->addItem (
"Cms_e2", m_e2);
97 status = m_tuple1->addItem (
"Cms_e", m_e);
98 status = m_tuple1->addItem (
"Cms_costheta1", m_costheta1);
99 status = m_tuple1->addItem (
"Cms_costheta2", m_costheta2);
100 status = m_tuple1->addItem (
"Cms_dltphi", m_dltphi);
101 status = m_tuple1->addItem (
"Cms_dltphi_1", m_dltphi_1);
102 status = m_tuple1->addItem (
"Cms_dlttheta", m_dlttheta);
103 status = m_tuple1->addItem (
"Cms_phi1", m_phi1);
104 status = m_tuple1->addItem (
"Cms_phi2", m_phi2);
106 status = m_tuple1->addItem (
"Lab_e1", m_e1_lab);
107 status = m_tuple1->addItem (
"Lab_e2", m_e2_lab);
108 status = m_tuple1->addItem (
"Lab_e", m_e_lab);
109 status = m_tuple1->addItem (
"Lab_costheta1", m_costheta1_lab);
110 status = m_tuple1->addItem (
"Lab_costheta2", m_costheta2_lab);
111 status = m_tuple1->addItem (
"Lab_dltphi", m_dltphi_lab);
112 status = m_tuple1->addItem (
"Lab_dlttheta", m_dlttheta_lab);
113 status = m_tuple1->addItem (
"Lab_phi1", m_phi1_lab);
114 status = m_tuple1->addItem (
"Lab_phi2", m_phi2_lab);
116 status = m_tuple1->addItem (
"xBoost", m_xBoost);
117 status = m_tuple1->addItem (
"yBoost", m_yBoost);
118 status = m_tuple1->addItem (
"zBoost", m_zBoost);
122 log << MSG::ERROR <<
"Cannot book N-tuple1:"<<long(m_tuple1)<<endmsg;
123 return StatusCode::FAILURE;
130 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
131 return StatusCode::SUCCESS;
137 StatusCode sc=StatusCode::SUCCESS;
140 MsgStream log(
msgSvc(),name());
141 log<<MSG::INFO<<
"in execute()"<<endreq;
142 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
146 m_run = eventHeader->runNumber();
147 m_rec = eventHeader->eventNumber();
150 int time = eventHeader->time();
151 if(m_event > 1 &&
runNo != m_runNo)
return sc;
155 if(m_rec%1000==0)cout<<
"Run "<<m_run<<
" Event "<<m_rec<<endl;
157 HepLorentzVector p4psip(0.011*m_ecms, 0.0, 0.005, m_ecms);
158 double psipBeta = (p4psip.vect()).mag()/(p4psip.e());
162 int NCharge = evtRecEvent->totalCharged();
163 if(NCharge != 0)
return sc;
171 if(((evtRecEvent->totalTracks() - evtRecEvent->totalCharged() )<2) || ((evtRecEvent->totalTracks() - evtRecEvent->totalCharged() )>15))
return sc;
174 HepLorentzVector p4Gam_1;
175 HepLorentzVector p4Gam_2;
177 for(
int i=evtRecEvent->totalCharged(); i<evtRecEvent->totalTracks(); i++)
180 if(!(*itTrk)->isEmcShowerValid())
continue;
183 HepLorentzVector p4Gam;
184 double Phi = emcTrk->
phi();
185 double Theta = emcTrk->
theta();
186 double Ener=emcTrk->
energy();
188 p4Gam.setPx(Ener *
sin(Theta) *
cos(
Phi));
189 p4Gam.setPy(Ener *
sin(Theta) *
sin(
Phi));
190 p4Gam.setPz(Ener *
cos(Theta));
192 p4Gam.boost(-0.011, 0 ,-0.005 * 1.0 / 3.686);
212 m_e_lab = Emax1 + Emax2;
213 log << MSG::INFO <<
"Emax1 = " << Emax1 <<
"Emax2= "<<Emax2<< endreq;
214 if(Emax1 < m_max1 || Emax2 < m_max2)
return sc;
218 double emcphi[2],emctht[2];
219 for(
int i = 0;i < 2; i++)
221 if(i>=evtRecTrkCol->size())
break;
223 if(!(*itTrk)->isEmcShowerValid())
continue;
225 emcphi[i]=emcTrk->
phi();
226 emctht[i]=emcTrk->
theta();
228 double dltphi_lab = (fabs(emcphi[0] - emcphi[1]) -
pai) * 180.0 /
pai;
229 double dlttheta_lab = (fabs(emctht[0] + emctht[1]) -
pai) * 180.0 /
pai;
230 m_costheta1_lab =
cos(emctht[0]);
231 m_costheta2_lab =
cos(emctht[1]);
232 m_phi1_lab = emcphi[0] * 180.0 /
pai;
233 m_phi2_lab = emcphi[1] * 180.0 /
pai;
234 m_dlttheta_lab = dlttheta_lab;
235 m_dltphi_lab = dltphi_lab;
237 if(fabs(m_costheta1_lab) > m_costheta || fabs(m_costheta2_lab) > m_costheta)
return sc;
242 double px1 = p4Gam_1.px();
243 double py1 = p4Gam_1.py();
244 double pz1 = p4Gam_1.pz();
245 double pxy1 = sqrt(px1 * px1 + py1 * py1);
246 double e1 = p4Gam_1.e();
248 double px2 = p4Gam_2.px();
249 double py2 = p4Gam_2.py();
250 double pz2 = p4Gam_2.pz();
251 double pxy2 = sqrt(px2 * px2 + py2 * py2);
252 double e2 = p4Gam_2.e();
257 if(atan(py1 * 1.0 / px1) > 0){
258 if(px1 > 0)
phi1 = atan(py1 * 1.0 / px1);
259 else phi1 = -(
pai - atan(py1 * 1.0 / px1));
262 if(px1 > 0)
phi1 = atan(py1 * 1.0 / px1);
263 else phi1 =
pai + atan(py1 * 1.0 / px1);
266 if(atan(py2 * 1.0 / px2) > 0){
267 if(px2 > 0)
phi2 = atan(py2 * 1.0 / px2);
268 else phi2 = -(
pai - atan(py2 * 1.0 / px2));
271 if(px2 > 0)
phi2 = atan(py2 * 1.0 / px2);
272 else phi2 =
pai + atan(py2 * 1.0 / px2);
280 if(pz1 > 0)
theta1 = atan(pxy1 * 1.0 / pz1);
281 else theta1 = (
pai + atan(pxy1 * 1.0 / pz1));
283 if(pz2 > 0)
theta2 = atan(pxy2 * 1.0 / pz2);
284 else theta2 = (
pai + atan(pxy2 * 1.0 / pz2));
288 double xBoost = p4Gam_1.px() + p4Gam_2.px();
289 double yBoost = p4Gam_1.py() + p4Gam_2.py();
290 double zBoost = p4Gam_1.pz() + p4Gam_2.pz();
299 m_dlttheta = dlttheta;
306 if(fabs(m_dltphi) < m_dphi1) Ndata1++;
307 if(fabs(m_dltphi) > m_dphi1 && fabs(m_dltphi) < m_dphi2) Ndata2++;
313 return StatusCode::SUCCESS;