7#include "GaudiKernel/MsgStream.h"
8#include "GaudiKernel/AlgFactory.h"
9#include "GaudiKernel/ISvcLocator.h"
10#include "GaudiKernel/SmartDataPtr.h"
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/PropertyMgr.h"
13#include "GaudiKernel/Bootstrap.h"
14#include "GaudiKernel/RegistryEntry.h"
19#include "HepPDT/ParticleDataTable.hh"
20#include "HepPDT/ParticleData.hh"
22#include "GaudiKernel/IPartPropSvc.h"
35#include "CLHEP/Random/RandFlat.h"
36#include "CLHEP/Matrix/Vector.h"
37#include "CLHEP/Matrix/Matrix.h"
38#include "CLHEP/Matrix/SymMatrix.h"
39#include "CLHEP/Vector/ThreeVector.h"
40#include "CLHEP/Vector/LorentzVector.h"
41#include "CLHEP/Vector/TwoVector.h"
42using CLHEP::HepVector;
43using CLHEP::Hep3Vector;
44using CLHEP::Hep2Vector;
45using CLHEP::HepLorentzVector;
57const double xmk0 = 0.49761;
59const double xmd0 = 1.86484;
61const double PI = 3.1415926;
65static const int kPsi3770ID = 30443 ;
66static const int kD0ID = 421 ;
67static const int kD0BarID = -421 ;
68static const int kDpID = 411 ;
69static const int kDmID = -411 ;
70static const int kGammaID = 22 ;
71static const int kGammaFSRID = -22 ;
72static const int kPiPlusID = 211 ;
73static const int kPiMinusID = -211 ;
74static const int kPi0ID = 111 ;
75static const int kEtaID = 221 ;
76static const int kEtaPrimeID = 331 ;
77static const int kF0ID = 9010221;
78static const int kFPrime0ID = 10221 ;
79static const int kF0m1500ID = 50221;
80static const int kF2ID = 225;
81static const int kA00ID = 10111 ;
82static const int kA0PlusID = 10211 ;
83static const int kA0MinusID = -10211 ;
84static const int kRhoPlusID = 213 ;
85static const int kRhoMinusID = -213 ;
86static const int kRho0ID = 113 ;
87static const int kRho2SPlusID = 30213 ;
88static const int kRho2SMinusID = -30213 ;
89static const int kRho2S0ID = 30113 ;
90static const int kA1PlusID = 20213 ;
91static const int kA1MinusID = -20213 ;
92static const int kA10ID = 20113 ;
93static const int kOmegaID = 223 ;
94static const int kPhiID = 333 ;
95static const int kKPlusID = 321 ;
96static const int kKMinusID = -321 ;
97static const int kK0SID = 310 ;
98static const int kK0LID = 130 ;
99static const int kK0ID = 311 ;
100static const int kK0BarID = -311 ;
101static const int kKStarPlusID = 323 ;
102static const int kKStarMinusID = -323 ;
103static const int kKStar0ID = 313 ;
104static const int kKStar0BarID = -313 ;
105static const int kK0Star0ID = 10311;
106static const int kK0Star0BarID = -10311;
107static const int kK0StarPlusID = 10321;
108static const int kK0StarMinusID = -10321;
109static const int kK1PlusID = 10323 ;
110static const int kK1MinusID = -10323 ;
111static const int kK10ID = 10313 ;
112static const int kK10BarID = -10313 ;
113static const int kK1PrimePlusID = 20323 ;
114static const int kK1PrimeMinusID = -20323 ;
115static const int kK1Prime0ID = 20313 ;
116static const int kK1Prime0BarID = -20313 ;
117static const int kK2StarPlusID = 325 ;
118static const int kK2StarMinusID = -325 ;
119static const int kK2Star0ID = 315 ;
120static const int kK2Star0BarID = -315 ;
121static const int kEMinusID = 11 ;
122static const int kEPlusID = -11 ;
123static const int kMuMinusID = 13 ;
124static const int kMuPlusID = -13 ;
125static const int kNuEID = 12 ;
126static const int kNuEBarID = -12 ;
127static const int kNuMuID = 14 ;
128static const int kNuMuBarID = -14 ;
131static const int kFlavoredCF = 0;
132static const int kFlavoredCFBar = 1;
133static const int kFlavoredCS = 2;
134static const int kFlavoredCSBar = 3;
135static const int kSLPlus = 4;
136static const int kSLMinus = 5;
137static const int kCPPlus = 6;
138static const int kCPMinus = 7;
139static const int kDalitz = 8;
140static const int kNDecayTypes = 9;
179 Algorithm(name, pSvcLocator){
181 declareProperty(
"x", m_x=0.);
182 declareProperty(
"y", m_y= 0.0);
183 declareProperty(
"rForCFModes", m_rCF= 0.0621);
184 declareProperty(
"zForCFModes", m_zCF= 2.0);
185 declareProperty(
"wSignForCFModes", m_wCFSign=
true);
186 declareProperty(
"rForCSModes", m_rCS= 1.0);
187 declareProperty(
"zForCSModes", m_zCS= -2.0);
188 declareProperty(
"wSignForCSModes", m_wCSSign=
true);
189 declareProperty(
"DplusDminusWeight", m_dplusDminusWeight= 0.5);
190 declareProperty(
"dalitzModel", m_dalitzModel= 0);
191 declareProperty(
"UseNewWeights", m_useNewWeights=
true);
192 declareProperty(
"InvertSelection", m_invertSelection=
false);
198 MsgStream log(
msgSvc(), name());
200 log << MSG::INFO <<
"in initialize()" << endmsg;
203 IPartPropSvc* p_PartPropSvc;
204 static const bool CREATEIFNOTTHERE(
true);
205 StatusCode PartPropStatus = service(
"PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE);
206 if (!PartPropStatus.isSuccess() || 0 == p_PartPropSvc)
208 log << MSG::ERROR <<
" Could not initialize Particle Properties Service" << endmsg;
209 return PartPropStatus;
211 m_particleTable = p_PartPropSvc->PDT();
218 m_y = (m_y - 0.008)/0.292;
226 double rCF2 = rCF * rCF ;
227 double zCF2 = zCF * zCF ;
230 double rCS2 = rCS * rCS ;
231 double zCS2 = zCS * zCS ;
233 double rmix = (
x *
x +
y *
y ) / 2. ;
234 double wCF = ( m_wCFSign ? 1. : -1. ) * sqrt( 4. - zCF2 ) ;
235 double wCS = ( m_wCSSign ? 1. : -1. ) * sqrt( 4. - zCS2 ) ;
236 double vCFCSPlus = ( zCF * zCS + wCF * wCS ) / 2. ;
237 double vCFCSMinus = ( zCF * zCS - wCF * wCS ) / 2. ;
239 m_deltaCF = acos( zCF / 2. ) * ( m_wCFSign ? 1. : -1. ) ;
240 m_deltaCS = acos( zCS / 2. ) * ( m_wCSSign ? 1. : -1. ) ;
242 double bCF = 1. + 0.5 * rCF * ( zCF *
y + wCF *
x ) + 0.5 * (
y *
y -
x *
x );
243 double bCS = 1. + 0.5 * rCS * ( zCS *
y + wCS *
x ) + 0.5 * (
y *
y -
x *
x );
244 double bCPPlus = 1. -
y ;
245 double bCPMinus = 1. +
y ;
247 if( !m_useNewWeights )
257 m_rwsCF = ( rCF2 + 0.5 * rCF * ( zCF *
y - wCF *
x ) + rmix ) / bCF;
258 m_rwsCS = ( rCS2 + 0.5 * rCS * ( zCS *
y - wCS *
x ) + rmix ) / bCS;
268 m_weights[ kFlavoredCF ][ kFlavoredCFBar ] =
269 1. + rCF2 * ( 2. - zCF2 ) + rCF2 * rCF2 ;
270 m_weights[ kFlavoredCF ][ kFlavoredCF ] =
271 rmix *
m_weights[ kFlavoredCF ][ kFlavoredCFBar ] ;
272 m_weights[ kFlavoredCF ][ kFlavoredCSBar ] =
273 1. + rCF2 * rCS2 - rCF * rCS * vCFCSMinus ;
274 m_weights[ kFlavoredCF ][ kFlavoredCS ] =
275 rCF2 + rCS2 - rCF * rCS * vCFCSPlus +
276 rmix *
m_weights[ kFlavoredCF ][ kFlavoredCSBar ] ;
279 m_weights[ kFlavoredCF ][ kFlavoredCF ] /= m_rwsCF * bCF * bCF ;
280 m_weights[ kFlavoredCF ][ kFlavoredCFBar ] /=
281 ( 1. + m_rwsCF * m_rwsCF ) * bCF * bCF ;
282 m_weights[ kFlavoredCF ][ kFlavoredCS ] /=
283 ( m_rwsCF + m_rwsCS ) * bCF * bCS ;
284 m_weights[ kFlavoredCF ][ kFlavoredCSBar ] /=
285 ( 1. + m_rwsCF * m_rwsCS ) * bCF * bCS ;
287 m_weights[ kFlavoredCF ][ kSLPlus ] = 1. / bCF ;
288 m_weights[ kFlavoredCF ][ kSLMinus ] = 1. / bCF ;
291 ( 1. + rCF2 + rCF * zCF ) / ( 1. + m_rwsCF ) / bCF / bCPPlus ;
293 ( 1. + rCF2 - rCF * zCF ) / ( 1. + m_rwsCF ) / bCF / bCPMinus ;
294 m_weights[ kFlavoredCF ][ kDalitz ] = 1. / bCF;
297 m_weights[ kFlavoredCFBar ][ kFlavoredCFBar ] =
m_weights[ kFlavoredCF ][ kFlavoredCF ] ;
298 m_weights[ kFlavoredCFBar ][ kFlavoredCS ] =
m_weights[ kFlavoredCF ][ kFlavoredCSBar ] ;
299 m_weights[ kFlavoredCFBar ][ kFlavoredCSBar ] =
m_weights[ kFlavoredCF ][ kFlavoredCS ] ;
300 m_weights[ kFlavoredCFBar ][ kSLPlus ] = 1. / bCF ;
301 m_weights[ kFlavoredCFBar ][ kSLMinus ] = 1. / bCF ;
304 m_weights[ kFlavoredCFBar ][ kDalitz ] = 1. / bCF;
309 m_weights[ kFlavoredCS ][ kFlavoredCSBar ] = 1. + rCS2 * ( 2. - zCS2 ) + rCS2 * rCS2 ;
310 m_weights[ kFlavoredCS ][ kFlavoredCS ] = rmix *
m_weights[ kFlavoredCS ][ kFlavoredCSBar ] ;
313 m_weights[ kFlavoredCS ][ kFlavoredCS ] /= m_rwsCS * bCS * bCS ;
314 m_weights[ kFlavoredCS ][ kFlavoredCSBar ] /= ( 1. + m_rwsCS * m_rwsCS ) * bCS * bCS ;
316 m_weights[ kFlavoredCS ][ kSLPlus ] = 1. / bCS ;
317 m_weights[ kFlavoredCS ][ kSLMinus ] = 1. / bCS ;
319 m_weights[ kFlavoredCS ][ kCPPlus ] = ( 1. + rCS2 + rCS * zCS ) / ( 1. + m_rwsCS ) / bCS / bCPPlus ;
320 m_weights[ kFlavoredCS ][ kCPMinus ] = ( 1. + rCS2 - rCS * zCS ) / ( 1. + m_rwsCS ) / bCS / bCPMinus ;
322 m_weights[ kFlavoredCS ][ kDalitz ] = 1. / bCS;
326 m_weights[ kFlavoredCSBar ][ kFlavoredCSBar ] =
m_weights[ kFlavoredCS ][ kFlavoredCS ] ;
327 m_weights[ kFlavoredCSBar ][ kSLPlus ] = 1. / bCS ;
328 m_weights[ kFlavoredCSBar ][ kSLMinus ] = 1. / bCS ;
331 m_weights[ kFlavoredCSBar ][ kDalitz ] = 1. / bCS;
339 m_weights[ kSLPlus ][ kCPPlus ] = 1. / bCPPlus ;
340 m_weights[ kSLPlus ][ kCPMinus ] = 1. / bCPMinus ;
346 m_weights[ kSLMinus ][ kCPPlus ] = 1. / bCPPlus ;
347 m_weights[ kSLMinus ][ kCPMinus ] = 1. / bCPMinus ;
353 m_weights[ kCPPlus ][ kCPMinus ] = 2. / bCPPlus / bCPMinus ;
354 m_weights[ kCPPlus ][ kDalitz ] = 1. / bCPPlus;
359 m_weights[ kCPMinus ][ kDalitz ] = 1. / bCPMinus;
364 log << MSG::FATAL <<
"Weight matrix" <<
m_weights << endmsg ;
367 HepVector fractionsD0( kNDecayTypes+1, 0 ) ;
368 fractionsD0[ kFlavoredCF ] = 0.531 ;
369 fractionsD0[ kFlavoredCFBar ] = 0.0082 ;
370 fractionsD0[ kFlavoredCS ] = 0.031 ;
371 fractionsD0[ kFlavoredCSBar ] = 0.031 ;
372 fractionsD0[ kSLPlus ] = 0.125 ;
373 fractionsD0[ kSLMinus ] = 0. ;
374 fractionsD0[ kCPPlus ] = 0.113 ;
375 fractionsD0[ kCPMinus ] = 0.102 ;
376 fractionsD0[ kDalitz ] = 0.0588 ;
377 HepVector scales =
m_weights * fractionsD0 ;
378 log << MSG::INFO <<
"Integrated scale factors " <<scales << endmsg ;
381 HepVector fractionsD0bar( kNDecayTypes+1, 0 ) ;
382 fractionsD0bar[ kFlavoredCF ] = 0.0082 ;
383 fractionsD0bar[ kFlavoredCFBar ] = 0.531 ;
384 fractionsD0bar[ kFlavoredCS ] = 0.031 ;
385 fractionsD0bar[ kFlavoredCSBar ] = 0.031 ;
386 fractionsD0bar[ kSLPlus ] = 0. ;
387 fractionsD0bar[ kSLMinus ] = 0.125 ;
388 fractionsD0bar[ kCPPlus ] = 0.113 ;
389 fractionsD0bar[ kCPMinus ] = 0.102 ;
390 fractionsD0bar[ kDalitz ] = 0.0588 ;
391 HepVector weight_norm = fractionsD0bar.T() * scales;
392 log << MSG::INFO <<
"Overall scale factor " << fractionsD0bar.T() * scales << endmsg ;
398 double brCF = ( fractionsD0bar[ kFlavoredCFBar ] * scales[ kFlavoredCFBar ] ) / weight_norm[0] ;
399 double brCS = ( fractionsD0bar[ kFlavoredCS ] * scales[ kFlavoredCS ] + fractionsD0bar[ kFlavoredCSBar ] * scales[ kFlavoredCSBar ] ) / weight_norm[0] ;
400 double brDCS = ( fractionsD0bar[ kFlavoredCF ] * scales[ kFlavoredCF ] ) / weight_norm[0] ;
401 double brCPPlus = ( fractionsD0bar[ kCPPlus ] * scales[ kCPPlus ] ) / weight_norm[0] ;
402 double brCPMinus = ( fractionsD0bar[ kCPMinus ] * scales[ kCPMinus ] ) / weight_norm[0] ;
405 double dalitz_y_num = -0.000177536;
406 double dalitz_y_den = -0.0150846;
409 -rCF * zCF * ( 1. - 0.5 * rCF * wCF * m_x ) ;
411 -rCS * zCS * ( 1. - 0.5 * rCS * wCS * m_x ) ;
412 double denFactCF = 0.5 * rCF2 * zCF2 ;
413 double denFactCS = 0.5 * rCS2 * zCS2 ;
416 brCPPlus - brCPMinus + brCF * numFactCF + 0.5 * brCS * numFactCS + dalitz_y_num;
418 1. - brCPPlus - brCPMinus - brCF * denFactCF - 0.5 * brCS * denFactCS + dalitz_y_den ;
419 double y_pre = num_pre / den_pre ;
421 fractionsD0bar[ kCPPlus ] - fractionsD0bar[ kCPMinus ] + fractionsD0bar[ kFlavoredCFBar ] * numFactCF + fractionsD0bar[ kFlavoredCS ] * numFactCS + dalitz_y_num;
423 1. - fractionsD0bar[ kCPPlus ] - fractionsD0bar[ kCPMinus ] - fractionsD0bar[ kFlavoredCFBar ] * denFactCF - fractionsD0bar[ kFlavoredCS ] * denFactCS + dalitz_y_den;
424 double y_prematrix =
num / den ;
425 double y_test1 = 0.25 * ( ( ( scales[ kCPMinus ] *
m_weights[ kCPPlus ][ kSLPlus ] ) / ( scales[ kCPPlus ] *
m_weights[ kCPMinus ][ kSLPlus ] ) ) -
426 ( ( scales[ kCPPlus ] *
m_weights[ kCPMinus ][ kSLPlus ] ) / ( scales[ kCPMinus ] *
m_weights[ kCPPlus ][ kSLPlus ] ) ) ) ;
428 log << MSG::INFO <<
"An Input Y of " << m_y << endmsg ;
429 log << MSG::INFO <<
"Parent MC has an intrinsic value of y as " << y_prematrix << endmsg ;
430 log << MSG::INFO <<
"The BR method predics a y of " << y_pre << endmsg ;
431 log << MSG::INFO <<
"The CP-SL double tag method predicts y of " <<y_test1 << endmsg ;
434 m_largestWeight = 0. ;
435 for(
int i = 0 ; i < kNDecayTypes ; ++i )
437 for(
int j = 0 ; j < kNDecayTypes ; ++j )
440 if(
m_weights[ i ][ j ] > m_largestWeight )
448 log << MSG::INFO <<
"Renormalized weight matrix " <<
m_weights << endmsg ;
453 double D0Sum[ 10 ], D0barSum[ 10 ] ;
457 for(
int i = 0 ; i < 10 ; ++i )
461 D0D0barSum[ i ] =
TComplex( 0., 0. ) ;
468 double stepsize = ( m2max - m2min ) / (
double ) nsteps ;
470 for(
int i = 0 ; i < nsteps ; ++i )
472 double m2i = m2min + ( ( double ) i + 0.5 ) * stepsize ;
474 for(
int j = 0 ; j < nsteps ; ++j )
476 double m2j = m2min + ( ( double ) j + 0.5 ) * stepsize ;
478 if(
t.Point_on_DP( m2i, m2j ) )
480 double m2k = 1.86450*1.86450 + 0.497648*0.497648 +
481 0.139570*0.139570 + 0.139570*0.139570 - m2i - m2j ;
484 if (m_dalitzModel == 0) {
485 D0 =
t.CLEO_Amplitude( m2i, m2j, m2k ) ;
486 D0bar =
t.CLEO_Amplitude( m2j, m2i, m2k ) ;}
487 if (m_dalitzModel == 1) {
488 D0 =
t.Babar_Amplitude( m2i, m2j, m2k ) ;
489 D0bar =
t.Babar_Amplitude( m2j, m2i, m2k ) ;}
490 if (m_dalitzModel == 2) {
491 D0 =
t.Amplitude( m2i, m2j, m2k ) ;
492 D0bar =
t.Amplitude( m2j, m2i, m2k ) ;}
495 int bin =
t.getBin( m2i, m2j, m2k ) ;
499 D0Sum[
bin ] += norm( D0 ) ;
500 D0barSum[
bin ] += norm( D0bar ) ;
501 D0D0barSum[
bin ] += D0 *
conj( D0bar ) ;
504 D0Sum[ 9 ] += norm( D0 ) ;
505 D0barSum[ 9 ] += norm( D0bar ) ;
506 D0D0barSum[ 9 ] += D0 *
conj( D0bar ) ;
513 for(
int i = 0 ; i < 10 ; ++i )
515 double r2 = D0barSum[ i ] / D0Sum[ i ] ;
516 double c =
real( D0D0barSum[ i ] ) / sqrt( D0barSum[ i ] ) / sqrt( D0Sum[ i ] ) ;
517 double s =
imag( D0D0barSum[ i ] ) / sqrt( D0barSum[ i ] ) / sqrt( D0Sum[ i ] ) ;
519 cout <<
"BIN " << i <<
": "
520 << points[ i ] <<
" pts "
521 << r2 <<
" " << c <<
" " <<
s <<
" " << c*c+
s*
s
525 log << MSG::INFO <<
"successfully return from initialize()" <<endmsg;
526 return StatusCode::SUCCESS;
533 ISvcLocator* svcLocator = Gaudi::svcLocator();
534 StatusCode sc=svcLocator->service(
"EventDataSvc", m_evtSvc);
536 std::cout<<
"Could not access EventDataSvc!"<<std::endl;
538 setFilterPassed(
false);
540 MsgStream log(
msgSvc(), name());
541 log<< MSG::INFO <<
"in execute()" << endmsg;
543 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
547 cout<<
" eventHeader "<<endl;
548 return StatusCode::FAILURE;
550 long runNo = eventHeader->runNumber();
551 long event = eventHeader->eventNumber();
552 log << MSG::DEBUG <<
"run, evtnum = "
560 int psipp_daughter = 0;
563 for( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end(); it++)
565 int pdg_code = (*it)->particleProperty();
566 if ((*it)->primaryParticle())
continue;
571 if (mother_pdg == kPsi3770ID)
574 if (
abs(pdg_code) == kD0ID) d0_count++;
575 if (
abs(pdg_code) == kDpID) chd_count++;
576 if (pdg_code == kD0BarID) m_nD0bar++;
580 if( psipp_daughter == 0 )
584 if( m_invertSelection )
586 log<< MSG::DEBUG <<
"Discarding event -- did not find psi(3770). " << endmsg ;
587 return StatusCode::SUCCESS;
592 setFilterPassed(
true);
594 return StatusCode::SUCCESS;
598 log<< MSG::DEBUG <<
"Found psi(3770) -->" << endmsg ;
601 if ( psipp_daughter > 3 )
605 if( m_invertSelection )
607 log<< MSG::DEBUG <<
"Discarding event -- psi(3770) has >3 daughters." << endmsg ;
608 return StatusCode::SUCCESS;
613 setFilterPassed(
true);
616 return StatusCode::SUCCESS;
621 if (chd_count == 2) {
625 double random = RandFlat::shoot() ;
627 if( ( random < m_dplusDminusWeight && !m_invertSelection ) ||
628 ( random > m_dplusDminusWeight && m_invertSelection ) )
631 setFilterPassed(
true);
634 return StatusCode::SUCCESS;
638 log<< MSG::DEBUG <<
"Discarding event -- D+D- event failed reweighting." << endmsg ;
640 return StatusCode::SUCCESS;
646 if( !m_invertSelection )
648 log<< MSG::DEBUG <<
"Discarding event -- non-D0-D0bar event." << endmsg ;
649 return StatusCode::SUCCESS;
654 setFilterPassed(
true);
657 return StatusCode::SUCCESS;
661 log<< MSG::INFO <<
"D0-D0bar event." << endmsg ;
670 int d0mode = d0_decay[0];
671 int d0barmode = d0bar_decay[0];
677 if (d0_decay[0] == 9 || d0bar_decay[0] == 9 ) {
678 if( !m_invertSelection )
680 log<< MSG::DEBUG <<
"Discarding event -- unknown D0-D0bar event." << endmsg ;
681 return StatusCode::SUCCESS;
686 setFilterPassed(
true);
690 return StatusCode::SUCCESS;
695 double r2D0 = d0_decay[1] ;
696 double deltaD0 = d0_decay[2] ;
697 double r2D0bar = d0bar_decay[1] ;
698 double deltaD0bar = d0bar_decay[2] ;
703 if( d0_decay[0] == kDalitz || d0bar_decay[0] == kDalitz )
705 double r2prod = r2D0 * r2D0bar ;
709 double bD0 = 1. + sqrt( r2D0 ) * (
cos( deltaD0 ) *
y +
sin( deltaD0 ) *
x ) ;
710 double rwsD0 = ( r2D0 + sqrt( r2D0 ) * (
cos( deltaD0 ) *
y -
sin( deltaD0 ) *
x ) ) / bD0 ;
711 double bD0bar = 1. + sqrt( r2D0bar ) * (
cos( deltaD0bar ) *
y +
sin( deltaD0bar ) *
x ) ;
712 double rwsD0bar = ( r2D0bar + sqrt( r2D0bar ) * (
cos( deltaD0bar ) *
y -
sin( deltaD0bar ) *
x ) ) / bD0bar ;
714 weight = 1. + r2prod - 2. * sqrt( r2prod ) *
cos( deltaD0 + deltaD0bar ) ;
715 weight /= ( 1. + rwsD0 * rwsD0bar ) * bD0 * bD0bar ;
716 weight /= m_largestWeight ;
723 if( d0_decay[0] == kDalitz) {
728 if( d0bar_decay[0] == kDalitz) {
732 m2k= d0bar_decay[6];}
740 double random = RandFlat::shoot() ;
741 log<< MSG::DEBUG <<
"type: " << d0_decay[0] <<
" " << d0bar_decay[0] <<
", weight " <<
742 weight <<
" <? random " << random << endmsg ;
744 if( ( random <
weight && !m_invertSelection ) || ( random >
weight && m_invertSelection ) )
747 setFilterPassed(
true);
754 double cosd =
cos( deltaD0 ) ;
755 double sind =
sin( deltaD0 ) ;
756 if( d0_decay[0] == kDalitz) {
761 if ( m2j - m2i > 0. ) {
766 if( d0bar_decay[0] == kDalitz) {
771 cosd =
cos( deltaD0bar ) ;
772 sind =
sin( deltaD0bar ) ;
773 if( m2j - m2i < 0. ) {
780 return StatusCode::SUCCESS;
784 log << MSG::DEBUG <<
"Discarding event -- failed reweighting." << endmsg ;
786 ++m_nD0D0barDiscarded ;
787 return StatusCode::SUCCESS;
794 MsgStream log(
msgSvc(), name());
795 log << MSG::INFO <<
"in finalize()" << endmsg;
796 log << MSG::INFO <<
"Number of unknown events: " << m_nUnknownEvents << endmsg ;
797 log << MSG::INFO <<
"Number of D+D- events seen: " << m_nDpDmEvents << endmsg ;
798 log << MSG::INFO <<
"Number of D+D- events discarded: " << m_nDpDmDiscarded << endmsg ;
799 if( m_nDpDmEvents > 0 )
801 log << MSG::INFO <<
"Fraction discarded: " << double( m_nDpDmDiscarded ) / double( m_nDpDmEvents ) << endmsg ;
804 log << MSG::INFO <<
"Number of D0D0bar events seen: " << m_nD0D0barEvents <<
" " << m_nD0bar << endmsg ;
805 log << MSG::INFO <<
"Number of D0D0bar events discarded: " << m_nD0D0barDiscarded << endmsg ;
806 if( m_nD0D0barEvents > 0 && m_nCPPlus > 0 && m_nCPMinus > 0)
808 log << MSG::INFO <<
"Fraction discarded: " << double( m_nD0D0barDiscarded ) / double( m_nD0D0barEvents ) << endl <<
809 "Fraction unknown decays: " << 0.5 * double( m_nUnknownDecays ) / double( m_nD0D0barEvents ) <<endmsg ;
811 double nD0 = 2. * m_nD0D0barEvents ;
812 double brSL = m_nSL /
nD0 ;
813 double dBrSL = sqrt( brSL * ( 1. - brSL ) /
nD0 ) ;
814 double brCF = m_nFlavoredCFD0 /
nD0 ;
815 double dBrCF = sqrt( brCF * ( 1. - brCF ) /
nD0 ) ;
816 double brCS = m_nFlavoredCSD0 /
nD0 ;
817 double dBrCS = sqrt( brCS * ( 1. - brCS ) /
nD0 ) ;
818 double brDCS = m_nFlavoredDCSD0 /
nD0 ;
819 double dBrDCS = sqrt( brDCS * ( 1. - brDCS ) /
nD0 ) ;
820 double brCPPlus = m_nCPPlus /
nD0 ;
821 double dBrCPPlus = sqrt( brCPPlus * ( 1. - brCPPlus ) /
nD0 ) ;
822 double brCPMinus = m_nCPMinus /
nD0 ;
823 double dBrCPMinus = sqrt( brCPMinus * ( 1. - brCPMinus ) /
nD0 ) ;
824 double brDalitz = m_nDalitz /
nD0 ;
825 double dBrDalitz = sqrt( brDalitz * ( 1. - brDalitz ) /
nD0 ) ;
826 double fdBrDalitz = dBrDalitz / brDalitz ;
827 double dalitzNumer1Norm = m_dalitzNumer1 /
nD0 ;
828 double dDalitzNumer1Norm = dalitzNumer1Norm * fdBrDalitz ;
829 double dalitzNumer2Norm = m_dalitzNumer2 /
nD0 ;
830 double dDalitzNumer2Norm = dalitzNumer2Norm * fdBrDalitz ;
831 double dalitzDenomNorm = m_dalitzDenom /
nD0 ;
832 double dDalitzDenomNorm = dalitzDenomNorm * fdBrDalitz ;
835 double fil_SL = 0, fil_FlavoredCFD0 = 0, fil_FlavoredCSD0 = 0, fil_FlavoredDCSD0 =0, fil_CPPlus = 0, fil_CPMinus = 0, fil_Dalitz = 0;
836 for(
int i = 0 ; i < 9 ; ++i )
846 double nD0_fil = 2. * ( m_nD0D0barEvents - m_nD0D0barDiscarded ) ;
847 double brSL_fil = fil_SL / nD0_fil ;
848 double dBrSL_fil = sqrt( brSL_fil * ( 1. - brSL_fil ) / nD0_fil ) ;
849 double brCF_fil = fil_FlavoredCFD0 / nD0_fil ;
850 double dBrCF_fil = sqrt( brCF_fil * ( 1. - brCF_fil ) / nD0_fil ) ;
851 double brCS_fil = fil_FlavoredCSD0 / nD0_fil ;
852 double dBrCS_fil = sqrt( brCS_fil * ( 1. - brCS_fil ) / nD0_fil ) ;
853 double brDCS_fil = fil_FlavoredDCSD0 / nD0_fil ;
854 double dBrDCS_fil = sqrt( brDCS_fil * ( 1. - brDCS_fil ) / nD0_fil ) ;
855 double brCPPlus_fil = fil_CPPlus / nD0_fil ;
856 double dBrCPPlus_fil = sqrt( brCPPlus_fil * ( 1. - brCPPlus_fil ) / nD0_fil ) ;
857 double brCPMinus_fil = fil_CPMinus / nD0_fil ;
858 double dBrCPMinus_fil = sqrt( brCPMinus_fil * ( 1. - brCPMinus_fil ) / nD0_fil ) ;
859 double brDalitz_fil = fil_Dalitz / nD0_fil ;
860 double dBrDalitz_fil = sqrt( brDalitz_fil * ( 1. - brDalitz_fil ) / nD0_fil ) ;
861 double fdBrDalitz_fil = dBrDalitz_fil / brDalitz_fil ;
863 double dDalitzNumer1Norm_fil = dalitzNumer1Norm_fil * fdBrDalitz_fil ;
865 double dDalitzNumer2Norm_fil = dalitzNumer2Norm_fil * fdBrDalitz_fil ;
867 double dDalitzDenomNorm_fil = dalitzDenomNorm_fil * fdBrDalitz_fil ;
871 "Original number of SL decays: " << m_nSL <<
" ==> Br(SL) = " << brSL <<
" +- " << dBrSL << endl <<
872 "Filtered number of SL decays: " << fil_SL <<
" ==> Br(SL) = " << brSL_fil <<
" +- " << dBrSL_fil << endl <<
873 "Original number of D0->CF/CS/DCS or D0bar->CFbar/CSBar/DCSbar: " <<m_nFlavoredCFD0 <<
"/" << m_nFlavoredCSD0 <<
"/" << m_nFlavoredDCSD0 << endl <<
874 " ==> Br(CF) = " << brCF <<
" +- " << dBrCF << endl <<
875 " ==> Br(CS) = " << brCS <<
" +- " << dBrCS << endl <<
876 " ==> Br(DCS) = " << brDCS <<
" +- " << dBrDCS << endl <<
877 "Filtered number of D0->CF/CS/DCS or D0bar->CFbar/CSBar/DCSbar: " <<fil_FlavoredCFD0 <<
"/" << fil_FlavoredCSD0 <<
"/" << fil_FlavoredDCSD0 << endl <<
878 " ==> Br(CF) = " << brCF_fil <<
" +- " << dBrCF_fil << endl <<
879 " ==> Br(CS) = " << brCS_fil <<
" +- " << dBrCS_fil << endl <<
880 " ==> Br(DCS) = " << brDCS_fil <<
" +- " << dBrDCS_fil << endl <<
882 "Original number of CP+/-: " << m_nCPPlus <<
"/" << m_nCPMinus <<endl <<
883 " ==> Br(CP+) = " << brCPPlus <<
" +- " << dBrCPPlus <<endl <<
884 " ==> Br(CP-) = " << brCPMinus <<
" +- " << dBrCPMinus << endl <<
885 "Filtered number of CP+/-: " << fil_CPPlus <<
"/" << fil_CPMinus <<endl <<
886 " ==> Br(CP+) = " << brCPPlus_fil <<
" +- " << dBrCPPlus_fil <<endl <<
887 " ==> Br(CP-) = " << brCPMinus_fil <<
" +- " << dBrCPMinus_fil << endl <<
889 "Original number of Dalitz: " << m_nDalitz << endl <<
890 " ==> Br(Dalitz) = " << brDalitz <<
" +- " << dBrDalitz <<endl <<
891 " y contrib. numer1 " << dalitzNumer1Norm <<
" +- " << dDalitzNumer1Norm << endl <<
892 " numer2 " << dalitzNumer2Norm <<
" +- " << dDalitzNumer2Norm << endl <<
893 " denom " << dalitzDenomNorm <<
" +- " << dDalitzDenomNorm << endmsg <<
894 "Filtered number of Dalitz: " << fil_Dalitz << endl <<
895 " ==> Br(Dalitz) = " << brDalitz_fil <<
" +- " << dBrDalitz_fil <<endl <<
896 " y contrib. numer1 " << dalitzNumer1Norm_fil <<
" +- " << dDalitzNumer1Norm_fil << endl <<
897 " numer2 " << dalitzNumer2Norm_fil <<
" +- " << dDalitzNumer2Norm_fil << endl <<
898 " denom " << dalitzDenomNorm_fil <<
" +- " << dDalitzDenomNorm_fil << endmsg ;
902 HepMatrix differencetoWeight(10,10,0);
903 for(
int i = 0 ; i < 9 ; ++i ) {
904 for(
int j = 0 ; j < 9 ; ++j ) {
908 log << MSG::INFO <<
"Weight matrix" <<
m_weights << endmsg ;
909 log << MSG::INFO <<
"D0 Modes before filter" <<
m_modeCounter << endmsg ;
911 log << MSG::INFO <<
"Compare percentage difference to weights " << differencetoWeight << endmsg ;
920 double y, dy, y_fil, dy_fil ;
921 double y_cpsl, dy_cpsl, y_fil_cpsl, dy_fil_cpsl ;
926 double rCF2 = rCF * rCF ;
927 double zCF2 = zCF * zCF ;
930 double rCS2 = rCS * rCS ;
931 double zCS2 = zCS * zCS ;
933 double wCF = ( m_wCFSign ? 1. : -1. ) * sqrt( 4. - zCF2 ) ;
934 double wCS = ( m_wCSSign ? 1. : -1. ) * sqrt( 4. - zCS2 ) ;
937 -rCF * zCF * ( 1. - 0.5 * rCF * wCF * m_x ) ;
939 -rCS * zCS * ( 1. - 0.5 * rCS * wCS * m_x ) ;
940 double denFactCF = 0.5 * rCF2 * zCF2 ;
941 double denFactCS = 0.5 * rCS2 * zCS2 ;
942 double dalitzNumerNorm = dalitzNumer1Norm + dalitzNumer2Norm ;
945 brCPPlus - brCPMinus + brCF * numFactCF + brCS * numFactCS +
948 1. - brCPPlus - brCPMinus - brCF * denFactCF - brCS * denFactCS +
952 (
num + den ) * (
num + den ) * dBrCPPlus * dBrCPPlus +
953 (
num - den ) * (
num - den ) * dBrCPMinus * dBrCPMinus +
954 ( numFactCF * den + denFactCF *
num ) * dBrCF *
955 ( numFactCF * den + denFactCF *
num ) * dBrCF +
956 ( numFactCS * den + denFactCS *
num ) * dBrCS *
957 ( numFactCS * den + denFactCS *
num ) * dBrCS +
958 ( dalitzNumerNorm * den + dalitzDenomNorm *
num ) * fdBrDalitz *
959 ( dalitzNumerNorm * den + dalitzDenomNorm *
num ) * fdBrDalitz
964 double a_cpsl = ( n_cpplussl * m_nCPMinus ) / ( n_cpminussl * m_nCPPlus ) ;
965 double b_cpsl = ( n_cpminussl *
m_nCPPlus ) / ( n_cpplussl * m_nCPMinus ) ;
966 y_cpsl = 0.25 * ( a_cpsl - b_cpsl ) ;
967 dy_cpsl = 0.25 * ( a_cpsl + b_cpsl ) * sqrt( ( 1/n_cpplussl ) + ( 1/n_cpminussl ) + ( 1/
m_nCPPlus ) + ( 1/
m_nCPMinus ) ) ;
971 double dalitzNumerNorm_fil = dalitzNumer1Norm_fil + dalitzNumer2Norm_fil ;
973 brCPPlus_fil - brCPMinus_fil + brCF_fil * numFactCF + brCS_fil * numFactCS +
974 dalitzNumerNorm_fil ;
976 1. - brCPPlus_fil - brCPMinus_fil - brCF_fil * denFactCF - brCS_fil * denFactCS +
977 dalitzDenomNorm_fil ;
978 y_fil = num_fil / den_fil ;
980 ( num_fil + den_fil ) * ( num_fil + den_fil ) * dBrCPPlus_fil * dBrCPPlus_fil +
981 ( num_fil - den_fil ) * ( num_fil - den_fil ) * dBrCPMinus_fil * dBrCPMinus_fil +
982 ( numFactCF * den_fil + denFactCF * num_fil ) * dBrCF_fil *
983 ( numFactCF * den_fil + denFactCF * num_fil ) * dBrCF_fil +
984 ( numFactCS * den_fil + denFactCS * num_fil ) * dBrCS_fil *
985 ( numFactCS * den_fil + denFactCS * num_fil ) * dBrCS_fil +
986 ( dalitzNumerNorm_fil * den_fil + dalitzDenomNorm_fil * num_fil ) * fdBrDalitz_fil *
987 ( dalitzNumerNorm_fil * den_fil + dalitzDenomNorm_fil * num_fil ) * fdBrDalitz_fil
988 ) / ( den_fil * den_fil ) ;
992 a_cpsl = ( fil_cpplussl * fil_CPMinus ) / ( fil_cpminussl * fil_CPPlus ) ;
993 b_cpsl = ( fil_cpminussl * fil_CPPlus ) / ( fil_cpplussl * fil_CPMinus ) ;
994 y_fil_cpsl = 0.25 * ( a_cpsl - b_cpsl ) ;
995 dy_fil_cpsl = 0.25 * ( a_cpsl + b_cpsl ) * sqrt( ( 1/n_cpplussl ) + ( 1/n_cpminussl ) + ( 1/fil_CPPlus ) + ( 1/fil_CPMinus ) ) ;
999 log << MSG::INFO <<
"BR Method : Parent MC ==> y = " <<
y <<
" +- " << dy << endmsg ;
1000 log << MSG::INFO <<
"BR Method : Filtered MC ==> y = " << y_fil <<
" +- " << dy_fil << endmsg ;
1001 log << MSG::INFO <<
"CP-SL doubletag : Parent MC ==> y = " << y_cpsl <<
" +- " << dy_cpsl <<endl<<
"Previous line should be equivalent with 0 as parent MC not corrilated"<< endmsg ;
1002 log << MSG::INFO <<
"CP-SL doubletag : Filtered MC ==> y = " << y_fil_cpsl <<
" +- " << dy_fil_cpsl << endmsg ;
1006 return StatusCode::SUCCESS;
1014 MsgStream log(
msgSvc(), name());
1015 log << MSG::INFO <<
" In findD0Decay " << endmsg ;
1017 vector<double> d0_info(7);
1018 for(
int i=0; i< 7; i++) d0_info[i]=0;
1019 double decay_mode = 9;
1021 double deltaD0 = -1;
1024 for(
int i=0; i< 26; i++)
num[i]=0;
1031 int kNeutralScalar = 5;
1044 int kKStar0Bar = 18;
1047 int kLeptonPlus = 21;
1048 int kLeptonMinus = 22;
1056 int d0_pdg = charm == 1 ? kD0ID : kD0BarID;
1058 HepLorentzVector piPlus, piMinus, k0;
1060 for( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end(); it++)
1062 int pdg_code = (*it)->particleProperty();
1063 if ((*it)->primaryParticle())
continue;
1071 if (pdg_code == kKStar0ID || pdg_code == kKStar0BarID || pdg_code == kK0ID || pdg_code == kK0BarID
1072 || pdg_code == kK10ID || pdg_code == kK10BarID
1073 || pdg_code == kK0Star0ID || pdg_code == kK0Star0BarID || pdg_code == kK0StarPlusID || pdg_code == kK0BarID )
continue;
1075 if (mother_pdg == kK0ID || mother_pdg == kK0BarID) {
1079 if (mother_pdg == kKStar0ID || mother_pdg == kKStar0BarID) {
1082 if (pdg_code == kPiPlusID || pdg_code == kPiMinusID)
continue;
1083 if (mother_pdg == kKStar0ID && pdg_code == kKPlusID) pdg_code = kKStar0ID;
1084 if (mother_pdg == kKStar0BarID && pdg_code == kKMinusID) pdg_code = kKStar0BarID;
1089 if ( mother_pdg == kK0Star0ID || mother_pdg == kK0Star0BarID ) {
1094 if (mother_pdg == kK10ID || mother_pdg == kK10BarID) {
1102 if (mother_pdg == d0_pdg)
1104 if (pdg_code == kPiPlusID || pdg_code == kA0PlusID )
num[0]++;
1105 else if (pdg_code == kPiMinusID || pdg_code == kA0MinusID )
num[1]++;
1106 else if (pdg_code == kPi0ID )
num[2]++;
1107 else if (pdg_code == kEtaID )
num[3]++;
1108 else if (pdg_code == kEtaPrimeID )
num[4]++;
1109 else if (pdg_code == kF0ID || pdg_code == kA00ID
1110 || pdg_code == kFPrime0ID|| pdg_code == kF0m1500ID
1111 || pdg_code == kF2ID)
num[5]++;
1112 else if (pdg_code == kRhoPlusID || pdg_code == kRho2SPlusID
1113 || pdg_code == kA1PlusID )
num[6]++;
1114 else if (pdg_code == kRhoMinusID || pdg_code == kRho2SMinusID
1115 || pdg_code == kA1MinusID)
num[7]++;
1116 else if (pdg_code == kRho0ID || pdg_code == kRho2S0ID)
num[8]++;
1117 else if (pdg_code == kOmegaID )
num[9]++;
1118 else if (pdg_code == kPhiID )
num[10]++;
1119 else if (pdg_code == kKPlusID )
num[11]++;
1120 else if (pdg_code == kKMinusID )
num[12]++;
1121 else if (pdg_code == kK0SID )
num[13]++;
1122 else if (pdg_code == kK0LID )
num[14]++;
1123 else if (pdg_code == kKStarPlusID || pdg_code == kK1PlusID
1124 || pdg_code == kK2StarPlusID || pdg_code == kK1PrimePlusID
1125 || pdg_code == kK0StarPlusID)
num[15]++;
1126 else if (pdg_code == kKStarMinusID || pdg_code == kK1MinusID
1127 || pdg_code == kK2StarMinusID || pdg_code == kK1PrimeMinusID
1128 || pdg_code == kK0StarMinusID )
num[16]++;
1129 else if (pdg_code == kKStar0ID )
num[17]++;
1130 else if (pdg_code == kKStar0BarID )
num[18]++;
1131 else if (pdg_code == kK10ID || pdg_code == kK1Prime0ID)
num[19]++;
1132 else if (pdg_code == kK10BarID || pdg_code == kK1Prime0BarID)
num[20]++;
1133 else if (pdg_code == kEPlusID || pdg_code == kMuPlusID )
num[21]++;
1134 else if (pdg_code == kEMinusID || pdg_code == kMuMinusID )
num[22]++;
1135 else if (pdg_code == kNuEID || pdg_code == kNuEBarID
1136 || pdg_code == kNuMuID || pdg_code == kNuMuBarID )
num[23]++;
1137 else if (pdg_code == kGammaID )
num[24]++;
1138 else if (pdg_code == kGammaFSRID )
continue;
1141 cout <<
"Unknown particle: "<< pdg_code << endl;
1148 if (pdg_code == kPiPlusID) piPlus.setVectM((*it)->initialFourMomentum().vect(),
xmpion);
1149 if (pdg_code == kPiMinusID) piMinus.setVectM((*it)->initialFourMomentum().vect(),
xmpion);
1150 if (pdg_code == kK0SID) k0.setVectM((*it)->initialFourMomentum().vect(),
xmk0);
1151 if (pdg_code == kK0LID) k0.setVectM((*it)->initialFourMomentum().vect(),
xmk0);
1156 int nDaughters = 0 ;
1157 for(
int i = 0 ; i < 26 ; i++ )
1159 nDaughters +=
num[ i ] ;
1162 int nUFP0 =
num[ kPi0 ] +
num[ kEta ] +
num[ kEtaPrime ] ;
1163 int nUFV0 =
num[ kRho0 ] +
num[ kPhi ] +
num[ kOmega ] +
num[ kGamma ] ;
1164 int nFV0 =
num[ kKStar0 ] +
num[ kK10 ] ;
1165 int nFV0Bar =
num[ kKStar0Bar ] +
num[ kK10Bar ] ;
1166 int nStrange =
num[ kKMinus ] +
num[ kFVMinus ] + nFV0Bar ;
1167 int nAntiStrange =
num[ kKPlus ] +
num[ kFVPlus ] + nFV0 ;
1168 int nCPPlusEig =
num[ kNeutralScalar ] +
num[ kRho0 ] +
num[ kOmega ] +
num[ kPhi ] +
num[ kK0S ] +
num[ kGamma ] ;
1169 int nCPMinusEig =
num[ kPi0 ] +
num[ kEta ] +
num[ kEtaPrime ] +
num[ kK0L ] ;
1170 int nCPEig = nCPPlusEig + nCPMinusEig ;
1171 int nChargedPiK =
num[ kPiPlus ] +
num[ kPiMinus ] +
num[ kKPlus ] +
num[ kKMinus ] ;
1172 int nK0 =
num[ kK0S ] +
num[ kK0L ] ;
1176 double mnm_gen = 0. ;
1177 double mpn_gen = 0. ;
1178 double mpm_gen = 0. ;
1179 bool isKsPiPi =
false ;
1181 if( nK0 == 1 &&
num[ kPiPlus ] == 1 &&
num[ kPiMinus ] && nDaughters == 3 )
1183 decay_mode = kDalitz ;
1184 k0.boost(-0.011, 0, 0);
1185 piMinus.boost(-0.011, 0, 0);
1186 piPlus.boost(-0.011, 0, 0);
1187 mnm_gen = (k0 + piMinus).m2();
1188 mpn_gen = (k0 + piPlus).m2();
1189 mpm_gen = (piPlus + piMinus).m2();
1190 if(
num[ kK0S ] == 1) isKsPiPi =
true ;
1194 if( decay_mode == kDalitz )
1200 if (m_dalitzModel == 0) {
1201 D0 =
t.CLEO_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
1202 D0bar =
t.CLEO_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
1203 if (m_dalitzModel == 1) {
1204 D0 =
t.Babar_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
1205 D0bar =
t.Babar_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
1206 if (m_dalitzModel == 2) {
1207 D0 =
t.Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
1208 D0bar =
t.Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
1211 r2D0 = norm( D0bar ) / norm( D0 ) ;
1212 deltaD0 =
arg( D0 *
conj( D0bar ) ) + ( isKsPiPi ?
PI : 0. );
1214 double cosd =
cos( deltaD0 ) ;
1215 double sind =
sin( deltaD0 ) ;
1216 if( mpn_gen - mnm_gen > 0. )
1218 m_dalitzNumer1 += -2. * sqrt( r2D0 ) * cosd ;
1219 m_dalitzNumer2 += 2. * r2D0 * cosd * sind * m_x ;
1220 m_dalitzDenom += -2. * r2D0 * cosd * cosd ;
1224 r2D0 = norm( D0 ) / norm( D0bar ) ;
1225 deltaD0 =
arg( D0bar *
conj( D0 ) ) + ( isKsPiPi ?
PI : 0. ) ;
1227 double cosd =
cos( deltaD0 ) ;
1228 double sind =
sin( deltaD0 ) ;
1229 if( mpn_gen - mnm_gen < 0. )
1231 m_dalitzNumer1 += -2. * sqrt( r2D0 ) * cosd ;
1232 m_dalitzNumer2 += 2. * r2D0 * cosd * sind * m_x ;
1233 m_dalitzDenom += -2. * r2D0 * cosd * cosd ;
1237 else if(
num[ kLeptonPlus ] == 1 )
1239 decay_mode = kSLPlus ;
1245 else if(
num[ kLeptonMinus ] == 1 )
1247 decay_mode = kSLMinus ;
1255 ( nDaughters == 2 &&
1256 ( (
num[ kPiPlus ] == 1 &&
num[ kPiMinus ] == 1 ) ||
1258 num[ kNeutralScalar ] == 2 ||
1259 ( nUFP0 == 1 && nUFV0 == 1 ) ||
1260 (
num[ kNeutralScalar ] == 1 && nUFV0 == 1 ) ||
1261 (
num[ kKPlus ] == 1 &&
num[ kKMinus ] == 1 ) ||
1264 (
num[ kK0L ] == 1 && nUFP0 == 1 ) ||
1265 (
num[ kK0S ] == 1 &&
num[ kNeutralScalar ] == 1 ) ||
1266 (
num[ kK0L ] == 1 && nUFV0 == 1 ) ) ) ||
1267 ( nDaughters == 3 &&
1268 ( ( nCPPlusEig == 1 &&
num[ kPi0 ] == 2 ) ||
1269 (
num[ kK0S ] == 3 ) ) ) ||
1270 ( nDaughters == 4 &&
1271 num[ kK0L ] == 1 &&
num[ kPi0 ] == 3 )
1274 decay_mode = kCPPlus ;
1282 ( nDaughters == 2 &&
1283 ( (
num[ kK0S ] == 1 && nUFP0 == 1 ) ||
1284 (
num[ kK0L ] == 1 &&
num[ kNeutralScalar ] == 1 ) ||
1285 (
num[ kK0S ] == 1 && nUFV0 == 1 ) ||
1286 ( nUFP0 == 1 &&
num[ kNeutralScalar ] == 1 ) ) ) ||
1287 ( nDaughters == 3 &&
1288 ( ( nCPMinusEig == 3 &&
num[ kPi0 ] == 2 ) ||
1289 (
num[ kPi0 ] == 3 ) ||
1290 (
num[ kK0L ] == 3 ) ) ) ||
1291 ( nDaughters == 4 &&
1292 num[ kK0S ] == 1 &&
num[ kPi0 ] == 3 )
1295 decay_mode = kCPMinus ;
1301 else if( nStrange == nAntiStrange + 1 )
1303 decay_mode = kFlavoredCF ;
1308 r2D0 = pow(m_rCF,2) ;
1309 deltaD0 = m_deltaCF ;
1313 ++m_nFlavoredDCSD0 ;
1314 r2D0 = 1. / pow( m_rCF,2 ) ;
1315 deltaD0 = -m_deltaCF ;
1318 else if( nAntiStrange == nStrange + 1 )
1320 decay_mode = kFlavoredCFBar ;
1325 r2D0 = pow( m_rCF, 2) ;
1326 deltaD0 = m_deltaCF ;
1330 ++m_nFlavoredDCSD0 ;
1331 r2D0 = 1. / pow( m_rCF, 2) ;
1332 deltaD0 = -m_deltaCF ;
1335 else if( nStrange == nAntiStrange )
1337 if( (
num[ kKPlus ] > 0 &&
1338 (
num[ kKPlus ] ==
num[ kFVMinus ] ||
1339 num[ kKPlus ] == nFV0Bar ) ) ||
1343 (
num[ kPiPlus ] > 0 &&
1344 num[ kPiPlus ] ==
num[ kUFVMinus ] ) )
1346 decay_mode = kFlavoredCS ;
1351 r2D0 = pow( m_rCS, 2 ) ;
1352 deltaD0 = m_deltaCS ;
1356 r2D0 = 1. / pow( m_rCS, 2 ) ;
1357 deltaD0 = -m_deltaCS ;
1360 else if( (
num[ kKMinus ] > 0 && (
num[ kKMinus ] ==
num[ kFVPlus ] ||
num[ kKMinus ] == nFV0 ) ) ||
1361 ( nK0 > 0 && nFV0 != nFV0Bar && nK0 == nFV0 ) ||
1362 (
num[ kPiMinus ] > 0 &&
num[ kPiMinus ] ==
num[ kUFVPlus ] ) )
1364 decay_mode = kFlavoredCSBar ;
1369 r2D0 = pow( m_rCS, 2 ) ;
1370 deltaD0 = m_deltaCS ;
1374 r2D0 = 1. / pow( m_rCS, 2 ) ;
1375 deltaD0 = -m_deltaCS ;
1382 else if( ( nDaughters >= 3 &&
num[ kPiPlus ] ==
num[ kPiMinus ] &&
1383 num[ kKPlus ] ==
num[ kKMinus ] && nChargedPiK + nCPEig == nDaughters ) ||
1384 nUFV0 == nDaughters ||
1385 (
num[ kKStar0 ] > 0 &&
num[ kKStar0 ] ==
num[ kKStar0Bar ] ) ||
1386 (
num[ kK10 ] > 0 &&
num[ kK10 ] ==
num[ kK10Bar ] ) ||
1387 (
num[ kUFVPlus ] == 1 &&
num[ kUFVMinus ] == 1 )
1391 log << MSG::DEBUG <<
" [ Self-conjugate mixed-CP ]" << endmsg ;
1393 if( RandFlat::shoot() > 0.5 )
1395 if( RandFlat::shoot() > 0.5 )
1397 decay_mode = kCPPlus ;
1405 decay_mode = kCPMinus ;
1418 double cutoff = m_rwsCF / ( 1. + m_rwsCF ) ;
1422 cutoff = 1. - cutoff ;
1425 log << MSG::DEBUG <<
" [ cutoff = " << cutoff <<
" ]" << endmsg ;
1427 decay_mode = ( RandFlat::shoot() > cutoff ) ? kFlavoredCF : kFlavoredCFBar ;
1429 if( ( decay_mode == kFlavoredCF && charm == 1 ) ||
1430 ( decay_mode == kFlavoredCFBar && charm == -1 ) )
1434 r2D0 = sqrt( m_rCF ) ;
1435 deltaD0 = m_deltaCF ;
1439 ++m_nFlavoredDCSD0 ;
1441 r2D0 = 1. / sqrt( m_rCF ) ;
1442 deltaD0 = -m_deltaCF ;
1448 double cutoff = m_rwsCS / ( 1. + m_rwsCS ) ;
1452 cutoff = 1. - cutoff ;
1455 log << MSG::DEBUG <<
" [ cutoff = " << cutoff <<
" ]" << endmsg ;
1457 decay_mode = ( RandFlat::shoot() > cutoff ) ?
1458 kFlavoredCS : kFlavoredCSBar ;
1461 if( ( decay_mode == kFlavoredCS && charm == 1 ) ||
1462 ( decay_mode == kFlavoredCSBar && charm == -1 ) )
1464 r2D0 = sqrt( m_rCS ) ;
1465 deltaD0 = m_deltaCS ;
1469 r2D0 = 1. / sqrt( m_rCS ) ;
1470 deltaD0 = -m_deltaCS ;
1477 if (
num[kUnknown] >= 1)
1479 cout <<
"decay mode " << decay_mode << endl ;
1480 cout <<
"D #" << charm << endl ;
1481 cout <<
"pi+: " <<
num[ kPiPlus ] << endl ;
1482 cout <<
"pi-: " <<
num[ kPiMinus ] << endl ;
1483 cout <<
"pi0: " <<
num[ kPi0 ] << endl ;
1484 cout <<
"eta: " <<
num[ kEta ] << endl ;
1485 cout <<
"eta': " <<
num[ kEtaPrime ] << endl ;
1486 cout <<
"f0/a0: " <<
num[ kNeutralScalar ] << endl ;
1487 cout <<
"UFV+: " <<
num[ kUFVPlus ] << endl ;
1488 cout <<
"UFV-: " <<
num[ kUFVMinus ] << endl ;
1489 cout <<
"rho0: " <<
num[ kRho0 ] << endl ;
1490 cout <<
"omega: " <<
num[ kOmega ] << endl ;
1491 cout <<
"phi: " <<
num[ kPhi ] << endl ;
1492 cout <<
"K+: " <<
num[ kKPlus ] << endl ;
1493 cout <<
"K-: " <<
num[ kKMinus ] << endl ;
1494 cout <<
"K0S: " <<
num[ kK0S ] << endl ;
1495 cout <<
"K0L: " <<
num[ kK0L ] << endl ;
1496 cout <<
"FV+: " <<
num[ kFVPlus ] << endl ;
1497 cout <<
"FV-: " <<
num[ kFVMinus ] << endl ;
1498 cout <<
"K*0: " <<
num[ kKStar0 ] << endl ;
1499 cout <<
"K*0b: " <<
num[ kKStar0Bar ] << endl ;
1500 cout <<
"K10: " <<
num[ kK10 ] << endl ;
1501 cout <<
"K10b: " <<
num[ kK10Bar ] << endl ;
1502 cout <<
"l+: " <<
num[ kLeptonPlus ] << endl ;
1503 cout <<
"l-: " <<
num[ kLeptonMinus ] << endl ;
1504 cout <<
"nu: " <<
num[ kNeutrino ] << endl ;
1505 cout <<
"gamma: " <<
num[ kGamma ] << endl ;
1506 cout <<
"Unknown: " <<
num[ 25 ] << endl ;
1510 d0_info[0]=decay_mode;
1515 d0_info[5]= double (isKsPiPi);
double sin(const BesAngle a)
double cos(const BesAngle a)
complex< double > TComplex
Evt3Rank3C conj(const Evt3Rank3C &t2)
double imag(const EvtComplex &c)
double arg(const EvtComplex &c)
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
*********Class see also m_nmax DOUBLE PRECISION m_MasPhot DOUBLE PRECISION m_phsu DOUBLE PRECISION m_Xenph DOUBLE PRECISION m_r2 DOUBLE PRECISION m_WtMass INTEGER m_nmax INTEGER m_Nevgen INTEGER m_IsFSR INTEGER m_MarTot *COMMON c_KarFin $ !Output file $ !Event serial number $ !alpha QED at Thomson limit $ !minimum energy at CMS for remooval $ !infrared dimensionless $ !dummy photon IR regulator $ !crude photon multiplicity enhancement factor *EVENT $ !MC crude volume of PhhSpace *Sfactors $ !YFS formfactor IR part only $ !YFS formfactor non IR finite part $ !mass weight
HepSymMatrix m_weights(10, 0)
HepMatrix m_modeCounter(10, 10, 0)
HepMatrix m_keptModeCounter(10, 10, 0)
const McParticle & mother() const
access to the mother particle
StdHepId particleProperty() const
Retrieve particle property.
QCMCFilter(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< double > findD0Decay(int charm)
_EXTERN_ std::string McParticleCol