64 MsgStream log(
msgSvc(), name() );
66 log << MSG::INFO <<
"in initialize()" << endmsg;
70 NTuplePtr nt1(
ntupleSvc(),
"FILE1/DiGam" );
71 if ( nt1 ) m_tuple1 = nt1;
75 ntupleSvc()->book(
"FILE1/DiGam", CLID_ColumnWiseTuple,
"DiGam N-Tuple signal" );
78 status = m_tuple1->addItem(
"run", m_run );
79 status = m_tuple1->addItem(
"rec", m_rec );
80 status = m_tuple1->addItem(
"time", m_time );
82 status = m_tuple1->addItem(
"ngood", m_ngood );
83 status = m_tuple1->addItem(
"nchrg", m_nchrg );
85 status = m_tuple1->addItem(
"Cms_e1", m_e1 );
86 status = m_tuple1->addItem(
"Cms_e2", m_e2 );
87 status = m_tuple1->addItem(
"Cms_e", m_e );
88 status = m_tuple1->addItem(
"Cms_costheta1", m_costheta1 );
89 status = m_tuple1->addItem(
"Cms_costheta2", m_costheta2 );
90 status = m_tuple1->addItem(
"Cms_dltphi", m_dltphi );
91 status = m_tuple1->addItem(
"Cms_dltphi_1", m_dltphi_1 );
92 status = m_tuple1->addItem(
"Cms_dlttheta", m_dlttheta );
93 status = m_tuple1->addItem(
"Cms_phi1", m_phi1 );
94 status = m_tuple1->addItem(
"Cms_phi2", m_phi2 );
96 status = m_tuple1->addItem(
"Lab_e1", m_e1_lab );
97 status = m_tuple1->addItem(
"Lab_e2", m_e2_lab );
98 status = m_tuple1->addItem(
"Lab_e", m_e_lab );
99 status = m_tuple1->addItem(
"Lab_costheta1", m_costheta1_lab );
100 status = m_tuple1->addItem(
"Lab_costheta2", m_costheta2_lab );
101 status = m_tuple1->addItem(
"Lab_dltphi", m_dltphi_lab );
102 status = m_tuple1->addItem(
"Lab_dlttheta", m_dlttheta_lab );
103 status = m_tuple1->addItem(
"Lab_phi1", m_phi1_lab );
104 status = m_tuple1->addItem(
"Lab_phi2", m_phi2_lab );
106 status = m_tuple1->addItem(
"xBoost", m_xBoost );
107 status = m_tuple1->addItem(
"yBoost", m_yBoost );
108 status = m_tuple1->addItem(
"zBoost", m_zBoost );
112 log << MSG::ERROR <<
"Cannot book N-tuple1:" << long( m_tuple1 ) << endmsg;
113 return StatusCode::FAILURE;
120 log << MSG::INFO <<
"successfully return from initialize()" << endmsg;
121 return StatusCode::SUCCESS;
126 StatusCode sc = StatusCode::SUCCESS;
129 MsgStream log(
msgSvc(), name() );
130 log << MSG::INFO <<
"in execute()" << endmsg;
131 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
135 m_run = eventHeader->runNumber();
136 m_rec = eventHeader->eventNumber();
139 int time = eventHeader->time();
140 if ( m_event > 1 &&
runNo != m_runNo )
return sc;
144 if ( m_rec % 1000 == 0 ) cout <<
"Run " << m_run <<
" Event " << m_rec << endl;
146 HepLorentzVector p4psip( 0.011 * m_ecms, 0.0, 0.005, m_ecms );
147 double psipBeta = ( p4psip.vect() ).mag() / ( p4psip.e() );
151 int NCharge = evtRecEvent->totalCharged();
152 if ( NCharge != 0 )
return sc;
160 if ( ( ( evtRecEvent->totalTracks() - evtRecEvent->totalCharged() ) < 2 ) ||
161 ( ( evtRecEvent->totalTracks() - evtRecEvent->totalCharged() ) > 15 ) )
165 HepLorentzVector p4Gam_1;
166 HepLorentzVector p4Gam_2;
168 for (
int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
171 if ( !( *itTrk )->isEmcShowerValid() )
continue;
174 HepLorentzVector p4Gam;
175 double Phi = emcTrk->
phi();
176 double Theta = emcTrk->
theta();
177 double Ener = emcTrk->
energy();
179 p4Gam.setPx( Ener *
sin( Theta ) *
cos(
Phi ) );
180 p4Gam.setPy( Ener *
sin( Theta ) *
sin(
Phi ) );
181 p4Gam.setPz( Ener *
cos( Theta ) );
183 p4Gam.boost( -0.011, 0, -0.005 * 1.0 / 3.686 );
203 m_e_lab = Emax1 + Emax2;
204 log << MSG::INFO <<
"Emax1 = " << Emax1 <<
"Emax2= " << Emax2 << endmsg;
205 if ( Emax1 < m_max1 || Emax2 < m_max2 )
return sc;
209 double emcphi[2], emctht[2];
210 for (
int i = 0; i < 2; i++ )
212 if ( i >= evtRecTrkCol->size() )
break;
214 if ( !( *itTrk )->isEmcShowerValid() )
continue;
216 emcphi[i] = emcTrk->
phi();
217 emctht[i] = emcTrk->
theta();
219 double dltphi_lab = ( fabs( emcphi[0] - emcphi[1] ) -
pai ) * 180.0 /
pai;
220 double dlttheta_lab = ( fabs( emctht[0] + emctht[1] ) -
pai ) * 180.0 /
pai;
221 m_costheta1_lab =
cos( emctht[0] );
222 m_costheta2_lab =
cos( emctht[1] );
223 m_phi1_lab = emcphi[0] * 180.0 /
pai;
224 m_phi2_lab = emcphi[1] * 180.0 /
pai;
225 m_dlttheta_lab = dlttheta_lab;
226 m_dltphi_lab = dltphi_lab;
228 if ( fabs( m_costheta1_lab ) > m_costheta || fabs( m_costheta2_lab ) > m_costheta )
234 double px1 = p4Gam_1.px();
235 double py1 = p4Gam_1.py();
236 double pz1 = p4Gam_1.pz();
237 double pxy1 = sqrt( px1 * px1 + py1 * py1 );
238 double e1 = p4Gam_1.e();
240 double px2 = p4Gam_2.px();
241 double py2 = p4Gam_2.py();
242 double pz2 = p4Gam_2.pz();
243 double pxy2 = sqrt( px2 * px2 + py2 * py2 );
244 double e2 = p4Gam_2.e();
248 if ( atan( py1 * 1.0 / px1 ) > 0 )
250 if ( px1 > 0 )
phi1 = atan( py1 * 1.0 / px1 );
251 else phi1 = -(
pai - atan( py1 * 1.0 / px1 ) );
255 if ( px1 > 0 )
phi1 = atan( py1 * 1.0 / px1 );
256 else phi1 =
pai + atan( py1 * 1.0 / px1 );
259 if ( atan( py2 * 1.0 / px2 ) > 0 )
261 if ( px2 > 0 )
phi2 = atan( py2 * 1.0 / px2 );
262 else phi2 = -(
pai - atan( py2 * 1.0 / px2 ) );
266 if ( px2 > 0 )
phi2 = atan( py2 * 1.0 / px2 );
267 else phi2 =
pai + atan( py2 * 1.0 / px2 );
275 if ( pz1 > 0 )
theta1 = atan( pxy1 * 1.0 / pz1 );
276 else theta1 = (
pai + atan( pxy1 * 1.0 / pz1 ) );
278 if ( pz2 > 0 )
theta2 = atan( pxy2 * 1.0 / pz2 );
279 else theta2 = (
pai + atan( pxy2 * 1.0 / pz2 ) );
283 double xBoost = p4Gam_1.px() + p4Gam_2.px();
284 double yBoost = p4Gam_1.py() + p4Gam_2.py();
285 double zBoost = p4Gam_1.pz() + p4Gam_2.pz();
294 m_dlttheta = dlttheta;
301 if ( fabs( m_dltphi ) < m_dphi1 ) Ndata1++;
302 if ( fabs( m_dltphi ) > m_dphi1 && fabs( m_dltphi ) < m_dphi2 ) Ndata2++;
304 m_tuple1->write().ignore();
307 return StatusCode::SUCCESS;