BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
QCMCFilter.cxx
Go to the documentation of this file.
1// QCMCFilter-00-00-02 Jan. 2013 Dan Ambrose
2// Based on QCMCReweightProc program by Werner Sun
3// This version has a corrected Y input from original version
4#include "QCMCFilter.h"
5#include "D0To2pip2pim.h"
6#include "D0ToKSpipi.h"
7#include "D0ToKSpipipi0.h"
8#include "D0Topipipi0.h"
9#include "D0Topippim2pi0.h"
10#include "Dalitz.h"
11// #include "D0ToKSKK.h"
12#include "D0ToKLpipi.h"
13#include "D0ToKSLKK.h"
14// #include "D0ToKLpipi2018.h"
15// #include "D0ToKSpipi2018.h"
16#include "D0ToKKpipi.h"
17#include "D0ToKpipipiLHCb.h"
18#include "D0TopiKpipi.h"
19// #include "models/dcs_LHCb_BESIIIIMP.h"
20// #include "models/cf_LHCb_BESIIIIMP.h"
21
22#include "GaudiKernel/Bootstrap.h"
23#include "GaudiKernel/IDataProviderSvc.h"
24#include "GaudiKernel/ISvcLocator.h"
25#include "GaudiKernel/MsgStream.h"
26#include "GaudiKernel/PropertyMgr.h"
27#include "GaudiKernel/RegistryEntry.h"
28#include "GaudiKernel/SmartDataPtr.h"
29
30#include "TMath.h"
31
32#include "HepPDT/ParticleData.hh"
33#include "HepPDT/ParticleDataTable.hh"
34#include <cmath>
35// #include "PartPropSvc/PartPropSvc.h"
36#include "GaudiKernel/IPartPropSvc.h"
37
38// Monte-Carlo data
39#include "McTruth/McParticle.h"
40#include "McTruth/MdcMcHit.h"
41
42///////////////////
43#include "EventModel/Event.h"
44#include "EventModel/EventHeader.h"
45#include "EventModel/EventModel.h"
46// #include "EvtGenBase/EvtComplex.hh"
47// #include "EvtGenBase/EvtVector4R.hh"
48
49#include "EvtRecEvent/EvtRecEvent.h"
50
51#include "CLHEP/Matrix/Matrix.h"
52#include "CLHEP/Matrix/SymMatrix.h"
53#include "CLHEP/Matrix/Vector.h"
54#include "CLHEP/Random/RandFlat.h"
55#include "CLHEP/Vector/LorentzVector.h"
56#include "CLHEP/Vector/ThreeVector.h"
57#include "CLHEP/Vector/TwoVector.h"
58using CLHEP::Hep2Vector;
59using CLHEP::Hep3Vector;
60using CLHEP::HepLorentzVector;
61using CLHEP::HepVector;
62
63#include <complex>
64#include <vector>
65
66//
67// constants, enums and typedefs
68//
69// Partilcle masses
70const double xmpi0 = 0.134976; // BOSS 6.4.1 pdt.table value
71const double xmeta = 0.54784; // PDG08 = 0.547853, BOSS 6.4.1 pdt.table = 0.54784
72const double xmkaon = 0.49368;
73const double xmpion = 0.13957;
74const double xmk0 = 0.49761;
75const double xmrho = 0.77549;
76const double xmd0 = 1.86484; // PDG08
77
78const double PI = 3.1415926; // pi
79
80// Antiparticles have negative ID.
81
82static const int kPsi3770ID = 30443;
83static const int kD0ID = 421;
84static const int kD0BarID = -421;
85static const int kDpID = 411;
86static const int kDmID = -411;
87static const int kGammaID = 22;
88static const int kGammaFSRID = -22;
89static const int kPiPlusID = 211;
90static const int kPiMinusID = -211;
91static const int kPi0ID = 111;
92static const int kEtaID = 221;
93static const int kEtaPrimeID = 331;
94static const int kF0600ID = 9000221;
95static const int kF0ID = 9010221;
96static const int kFPrime0ID = 10221;
97static const int kF0m1500ID = 50221;
98static const int kF0m1710ID = 10331;
99static const int kF2ID = 225;
100static const int kA00ID = 10111;
101static const int kA0PlusID = 10211;
102static const int kA0MinusID = -10211;
103static const int kRhoPlusID = 213;
104static const int kRhoMinusID = -213;
105static const int kRho0ID = 113;
106static const int kRho2SPlusID = 30213;
107static const int kRho2SMinusID = -30213;
108static const int kRho2S0ID = 30113;
109static const int kA1PlusID = 20213;
110static const int kA1MinusID = -20213;
111static const int kA10ID = 20113;
112static const int kOmegaID = 223;
113static const int kPhiID = 333;
114static const int kKPlusID = 321;
115static const int kKMinusID = -321;
116static const int kK0SID = 310;
117static const int kK0LID = 130;
118static const int kK0ID = 311;
119static const int kK0BarID = -311;
120static const int kKStarPlusID = 323;
121static const int kKStarMinusID = -323;
122static const int kKStar0ID = 313;
123static const int kKStar0BarID = -313;
124static const int kKDPStar0ID = 30313;
125static const int kKDPStar0BarID = -30313;
126static const int kK0Star0ID = 10311;
127static const int kK0Star0BarID = -10311;
128static const int kK0StarPlusID = 10321;
129static const int kK0StarMinusID = -10321;
130static const int kK1PlusID = 10323;
131static const int kK1MinusID = -10323;
132static const int kK10ID = 10313;
133static const int kK10BarID = -10313;
134static const int kK1PrimePlusID = 20323;
135static const int kK1PrimeMinusID = -20323;
136static const int kK1Prime0ID = 20313;
137static const int kK1Prime0BarID = -20313;
138static const int kK2StarPlusID = 325;
139static const int kK2StarMinusID = -325;
140static const int kK2Star0ID = 315;
141static const int kK2Star0BarID = -315;
142static const int kEMinusID = 11;
143static const int kEPlusID = -11;
144static const int kMuMinusID = 13;
145static const int kMuPlusID = -13;
146static const int kNuEID = 12;
147static const int kNuEBarID = -12;
148static const int kNuMuID = 14;
149static const int kNuMuBarID = -14;
150
151// D0 decay modes
152static const int kFlavoredCF_0 = 0;
153static const int kFlavoredCFBar_0 = 1;
154static const int kFlavoredCF_1 = 2;
155static const int kFlavoredCFBar_1 = 3;
156static const int kFlavoredCF_3 = 4;
157static const int kFlavoredCFBar_3 = 5;
158static const int kFlavoredCS = 6;
159static const int kFlavoredCSBar = 7;
160static const int kSLPlus = 8;
161static const int kSLMinus = 9;
162static const int kCPPlus = 10;
163static const int kCPMinus = 11;
164static const int kDalitz = 12;
165static const int k2Pip2Pim = 13;
166static const int kPipPim2Pi0 = 14;
167static const int kK0PiPiPi0 = 15;
168static const int kKKPiPi = 16;
169static const int kK0KK = 17;
170static const int kPipPimPi0 = 18;
171static const int kNDecayTypes = 19;
172
173// Varibales to keep track of the Events
177int m_nD0bar = 0;
181int m_nCPPlus = 0;
190int m_nSL = 0;
191int m_nDalitz = 0;
195int m_nKKPiPi = 0;
196int m_nK0KK = 0;
198double m_dalitzNumer1 = 0;
199double m_dalitzNumer2 = 0;
200double m_dalitzDenom = 0;
222HepSymMatrix m_weights( 20, 0 );
223double m_rwsCF = 0.;
224double m_rwsCF_0 = 0.;
225double m_rwsCF_1 = 0.;
226double m_rwsCF_3 = 0.;
227double m_rwsCS = 0.;
228double m_deltaCF = 0.;
229double m_deltaCF_0 = 0.;
230double m_deltaCF_1 = 0.;
231double m_deltaCF_3 = 0.;
232double m_deltaCS = 0.;
233HepMatrix m_modeCounter( 21, 21, 0 );
234HepMatrix m_keptModeCounter( 21, 21, 0 );
235
237
238/////////////////////////////////////////////////////////////////
240
241QCMCFilter::QCMCFilter( const std::string& name, ISvcLocator* pSvcLocator )
242 : Algorithm( name, pSvcLocator ) {
243 // Declare the properties
244 declareProperty( "Debug", m_debug = true );
245 declareProperty( "x", m_x = 0.00407 );
246 declareProperty( "y", m_y = 0.00647 ); // For values outside of (-.11 , .06) measured y value
247 // may vary from input y
248
249 declareProperty( "rForCFModes",
250 m_rCF = 0.0621 ); // should be kept near this. based on MC for d0->kpi and
251 // d0bar->kpi 0.0621 = sqrt( .00015/.0389)
252 declareProperty( "zForCFModes", m_zCF = 2.0 );
253 declareProperty( "wSignForCFModes", m_wCFSign = true );
254 declareProperty( "rForCFMode_0",
255 m_rCF_0 = 0.0587 ); // should be kept near this. based on MC for d0->kpi and
256 // d0bar->kpi 0.0621 = sqrt( .00015/.0389)
257 declareProperty( "RForCFMode_0", m_RCF_0 = 1. ); // should be kept near this.
258 declareProperty( "zForCFMode_0", m_zCF_0 = 1.9585 );
259 declareProperty( "dForCFMode_0", m_dCF_0 = 191.7 * 3.14159 / 180. );
260 declareProperty( "wSignForCFMode_0", m_wCFSign_0 = true );
261 declareProperty( "rForCFModes_1",
262 m_rCF_1 = 0.044 ); // should be kept near this. based on MC for d0->kpi and
263 // d0bar->kpi 0.0621 = sqrt( .00015/.0389)
264 declareProperty( "RForCFMode_1", m_RCF_1 = 0.79 ); // should be kept near this.
265 declareProperty( "zForCFModes_1", m_zCF_1 = 1.9225 );
266 declareProperty( "dForCFMode_1", m_dCF_1 = 196. * 3.14159 / 180. );
267 declareProperty( "wSignForCFModes_1", m_wCFSign_1 = true );
268 declareProperty( "rForCFModes_3",
269 m_rCF_3 = 0.0549 ); // should be kept near this. based on MC for d0->kpi and
270 // d0bar->kpi 0.0621 = sqrt( .00015/.0389)
271 declareProperty( "RForCFMode_3", m_RCF_3 = 0.43 ); // should be kept near this.
272 declareProperty( "zForCFModes_3", m_zCF_3 = 1.2313 );
273 declareProperty( "dForCFMode_3", m_dCF_3 = 161. * 3.14159 / 180. );
274 declareProperty( "wSignForCFModes_3", m_wCFSign_3 = true );
275
276 declareProperty( "FCP_PiPiPi0", m_FCP_PiPiPi0 = 0.973 );
277
278 declareProperty( "rForCSModes", m_rCS = 1.0 );
279 declareProperty( "zForCSModes", m_zCS = -2.0 );
280 declareProperty( "wSignForCSModes", m_wCSSign = true );
281 declareProperty( "DplusDminusWeight", m_dplusDminusWeight = 0.5 );
282 declareProperty( "dalitzModel", m_dalitzModel = 0 ); // 0 CLEO-c, 1 Babar, 2 Belle
283 declareProperty( "UseNewWeights", m_useNewWeights = true );
284 declareProperty( "InvertSelection", m_invertSelection = false );
285}
286
287//***************************************************************
288
290 MsgStream log( msgSvc(), name() );
291
292 log << MSG::INFO << "in initialize()" << endmsg;
293
294 // Get the Particle Properties Service
295 IPartPropSvc* p_PartPropSvc;
296 static const bool CREATEIFNOTTHERE( true );
297 StatusCode PartPropStatus = service( "PartPropSvc", p_PartPropSvc, CREATEIFNOTTHERE );
298 if ( !PartPropStatus.isSuccess() || 0 == p_PartPropSvc )
299 {
300 log << MSG::ERROR << " Could not initialize Particle Properties Service" << endmsg;
301 return PartPropStatus;
302 }
303 m_particleTable = p_PartPropSvc->PDT();
304
305 // Calculates parameters here based on Parameter Input by User
306 // (e.g. run expensive algorithms that are based on parameters
307 // specified by user at run-time)
308
309 // m_y = (m_y - 0.008)/0.292;
310 // corrects the y input so that we get the desired measurable y from CP:Semi-leptonic
311 // doubletag method
312 // This equation is a result of solving equations for y dependence.
313 // If parent MC Branching ratio's this equation will need resolved. January 2013 -DA
314 double x = m_x;
315 double y = m_y;
316 double rCF_0 = m_rCF_0;
317 double dCF_0 = m_dCF_0;
318 double RCF_0 = m_RCF_0;
319 // double zCF_0 = m_zCF_0 ;
320 double zCF_0 = 2 * cos( dCF_0 );
321 double rCF2_0 = rCF_0 * rCF_0;
322 double zCF2_0 = zCF_0 * zCF_0;
323 double rCF_1 = m_rCF_1;
324 double dCF_1 = m_dCF_1;
325 double RCF_1 = m_RCF_1;
326 // double zCF_1 = m_zCF_1 ;
327 double zCF_1 = 2 * cos( dCF_1 );
328 double rCF2_1 = rCF_1 * rCF_1;
329 double zCF2_1 = zCF_1 * zCF_1;
330 double rCF_3 = m_rCF_3;
331 double dCF_3 = m_dCF_3;
332 double RCF_3 = m_RCF_3;
333 // double zCF_3 = m_zCF_3 ;
334 double zCF_3 = 2 * cos( dCF_3 );
335 double rCF2_3 = rCF_3 * rCF_3;
336 double zCF2_3 = zCF_3 * zCF_3;
337 double rCS = m_rCS;
338 double zCS = m_zCS;
339 double rCS2 = rCS * rCS;
340 double zCS2 = zCS * zCS;
341
342 double rmix = ( x * x + y * y ) / 2.;
343 double wCF_0 = 2 * cos( dCF_0 );
344 double wCF_1 = 2 * cos( dCF_1 );
345 double wCF_3 = 2 * cos( dCF_3 );
346 double wCS = ( m_wCSSign ? 1. : -1. ) * sqrt( 4. - zCS2 );
347 double vCF_0CSPlus = ( zCF_0 * zCS + wCF_0 * wCS ) / 2.;
348 double vCF_1CSPlus = ( zCF_1 * zCS + wCF_1 * wCS ) / 2.;
349 double vCF_3CSPlus = ( zCF_3 * zCS + wCF_3 * wCS ) / 2.;
350 double vCF_0CSMinus = ( zCF_0 * zCS - wCF_0 * wCS ) / 2.;
351 double vCF_1CSMinus = ( zCF_1 * zCS - wCF_1 * wCS ) / 2.;
352 double vCF_3CSMinus = ( zCF_3 * zCS - wCF_3 * wCS ) / 2.;
353
354 m_deltaCF_0 = acos( zCF_0 / 2. ) * ( m_wCFSign_0 ? 1. : -1. );
355 m_deltaCF_1 = acos( zCF_1 / 2. ) * ( m_wCFSign_1 ? 1. : -1. );
356 m_deltaCF_3 = acos( zCF_3 / 2. ) * ( m_wCFSign_3 ? 1. : -1. );
357 m_deltaCS = acos( zCS / 2. ) * ( m_wCSSign ? 1. : -1. );
358
359 double rCF = m_rCF;
360 double zCF = m_zCF;
361 double rCF2 = rCF * rCF;
362 double zCF2 = zCF * zCF;
363 double wCF = ( m_wCFSign ? 1. : -1. ) * sqrt( 4. - zCF2 );
364 double vCFCSPlus = ( zCF * zCS + wCF * wCS ) / 2.;
365 double vCFCSMinus = ( zCF * zCS - wCF * wCS ) / 2.;
366 m_deltaCF = acos( zCF / 2. ) * ( m_wCFSign ? 1. : -1. );
367
368 double bCF_0 = 1. + 0.5 * rCF_0 * ( zCF_0 * y + wCF_0 * x ) +
369 0.5 * ( y * y - x * x ); // second order y term added -DA
370 double bCF_1 = 1. + 0.5 * rCF_1 * ( zCF_1 * y + wCF_1 * x ) +
371 0.5 * ( y * y - x * x ); // second order y term added -DA
372 double bCF_3 = 1. + 0.5 * rCF_3 * ( zCF_3 * y + wCF_3 * x ) +
373 0.5 * ( y * y - x * x ); // second order y term added -DA
374 double bCS = 1. + 0.5 * rCS * ( zCS * y + wCS * x ) + 0.5 * ( y * y - x * x );
375 double bCPPlus = 1. - y;
376 double bCPMinus = 1. + y;
377
378 double bCPPlus_PiPiPi0 = 1. - ( 2. * m_FCP_PiPiPi0 - 1. ) * y;
379
380 if ( !m_useNewWeights )
381 {
382 bCF_0 = 1.;
383 bCF_1 = 1.;
384 bCF_3 = 1.;
385 m_rwsCF_0 = rCF2_0;
386 m_rwsCF_1 = rCF2_1;
387 m_rwsCF_3 = rCF2_3;
388 bCS = 1.;
389 m_rwsCS = rCS2;
390 bCPPlus = 1.;
391 bCPMinus = 1.;
392 }
393
394 m_rwsCF_0 = ( rCF2_0 + 0.5 * rCF_0 * ( zCF_0 * y - wCF_0 * x ) + rmix ) /
395 bCF_0; // though division by b not mentioned in memo it is correct
396 m_rwsCF_1 = ( rCF2_1 + 0.5 * rCF_1 * ( zCF_1 * y - wCF_1 * x ) + rmix ) /
397 bCF_1; // though division by b not mentioned in memo it is correct
398 m_rwsCF_3 = ( rCF2_3 + 0.5 * rCF_3 * ( zCF_3 * y - wCF_3 * x ) + rmix ) /
399 bCF_3; // though division by b not mentioned in memo it is correct
400 m_rwsCS = ( rCS2 + 0.5 * rCS * ( zCS * y - wCS * x ) + rmix ) / bCS;
401
402 double bfCF_0 = ( 1. - RCF_0 * rCF_0 * ( 0.5 * zCF_0 * y + 0.5 * wCF_0 * x ) +
403 0.5 * ( -1 * x * x + y * y ) ); // B(D0->F)=AF*AF*brCF_0
404 double bfCF_1 = ( 1. - RCF_1 * rCF_1 * ( 0.5 * zCF_1 * y + 0.5 * wCF_1 * x ) +
405 0.5 * ( -1 * x * x + y * y ) );
406 double bfCF_3 = ( 1. - RCF_3 * rCF_3 * ( 0.5 * zCF_3 * y + 0.5 * wCF_3 * x ) +
407 0.5 * ( -1 * x * x + y * y ) );
408 double bfCFbar_0 = ( rCF2_0 - RCF_0 * rCF_0 * ( 0.5 * zCF_0 * y - 0.5 * wCF_0 * x ) +
409 0.5 * ( x * x + y * y ) ); // B(D0->Fbar)=AF*AF*brCFbar_0
410 double bfCFbar_1 = ( rCF2_1 - RCF_1 * rCF_1 * ( 0.5 * zCF_1 * y - 0.5 * wCF_1 * x ) +
411 0.5 * ( x * x + y * y ) );
412 double bfCFbar_3 = ( rCF2_3 - RCF_3 * rCF_3 * ( 0.5 * zCF_3 * y - 0.5 * wCF_3 * x ) +
413 0.5 * ( x * x + y * y ) );
414
415 // Calculate reweighting factors, normalized to the largest factor.
416 // Note:A fake Dalitz weight is added in to just to make initial predictions
417 // These Dalitz weights are not used in actual code
418
419 // FlavoredCF
420
421 // First calculate rate factors.
422 // m_weights[ kFlavoredCF_0 ][ kFlavoredCF_0 ] = ( ( 1 - RCF_0 * RCF_0 ) / ( 1 - RCF_0 *
423 //(1./rCF_0) * (0.5*zCF_0*y - 0.5*wCF_0*x) + rmix/(2*rCF2_0) ) ) ; rmix *
424 //m_weights[ kFlavoredCF ][ kFlavoredCFBar ] ; m_weights[ kFlavoredCF_0 ][
425 // kFlavoredCFBar_0 ] = ( 1. + rCF2_0 * rCF2_0 - 2. * RCF_0 * RCF_0 * rCF2_0 ) / ( brCF_0 *
426 // brCF_0 );
427 // 1. + rCF2 * ( 2. - zCF2 ) + rCF2 * rCF2 ;
428
429 // Nov 2007: correct for r2 -> RWS and BR != A^2
430 // m_weights[ kFlavoredCF ][ kFlavoredCF ] /= m_rwsCF * bCF * bCF ;
431 // m_weights[ kFlavoredCF ][ kFlavoredCFBar ] /=
432 // ( 1. + m_rwsCF * m_rwsCF ) * bCF * bCF ;
433 // m_weights[ kFlavoredCF ][ kFlavoredCS ] /=
434 // ( m_rwsCF + m_rwsCS ) * bCF * bCS ;
435 // m_weights[ kFlavoredCF ][ kFlavoredCSBar ] /=
436 // ( 1. + m_rwsCF * m_rwsCS ) * bCF * bCS ;
437 m_weights[kFlavoredCF_0][kFlavoredCF_0] =
438 ( ( 1 - RCF_0 * RCF_0 ) /
439 ( 1 - RCF_0 * ( 1. / rCF_0 ) * ( 0.5 * zCF_0 * y - 0.5 * wCF_0 * x ) +
440 rmix / ( 2 * rCF2_0 ) ) );
441 m_weights[kFlavoredCF_0][kFlavoredCFBar_0] =
442 ( 1. + rCF2_0 * rCF2_0 - 2. * RCF_0 * RCF_0 * rCF2_0 ) / ( bfCF_0 * bfCF_0 );
443 m_weights[kFlavoredCF_0][kFlavoredCF_1] =
444 ( 1. + ( rCF2_0 / rCF2_1 ) * ( rCF2_0 / rCF2_1 ) -
445 2. * ( rCF2_0 / rCF2_1 ) * RCF_0 * RCF_1 * cos( dCF_0 - dCF_1 ) ) /
446 ( 1. + ( rCF2_0 / rCF2_1 ) * ( rCF2_0 / rCF2_1 ) -
447 RCF_1 * ( 1. / rCF_1 ) * ( 0.5 * zCF_1 * y - 0.5 * wCF_1 * x ) -
448 ( RCF_0 * rCF_1 / ( rCF_0 * rCF_0 ) ) * ( 0.5 * zCF_0 * y - 0.5 * wCF_0 * x ) +
449 rmix / ( rCF_0 * rCF_0 ) );
450 cout << ( 1. + ( rCF2_0 / rCF2_1 ) * ( rCF2_0 / rCF2_1 ) -
451 RCF_1 * ( 1. / rCF_1 ) * ( 0.5 * zCF_1 * y - 0.5 * wCF_1 * x ) -
452 ( RCF_0 * rCF_1 / ( rCF_0 * rCF_0 ) ) * ( 0.5 * zCF_0 * y - 0.5 * wCF_0 * x ) +
453 rmix / ( rCF_0 * rCF_0 ) )
454 << endl;
455 m_weights[kFlavoredCF_0][kFlavoredCFBar_1] =
456 ( 1. + rCF2_0 * rCF2_1 - 2. * RCF_0 * RCF_1 * rCF_0 * rCF_1 ) / ( bfCF_0 * bfCF_1 );
457 m_weights[kFlavoredCF_0][kFlavoredCF_3] =
458 ( 1. + ( rCF2_0 / rCF2_3 ) * ( rCF2_0 / rCF2_3 ) -
459 2. * ( rCF2_0 / rCF2_3 ) * RCF_0 * RCF_3 * cos( dCF_0 - dCF_3 ) ) /
460 ( 1. + ( rCF2_0 / rCF2_3 ) * ( rCF2_0 / rCF2_3 ) -
461 RCF_3 * ( 1. / rCF_3 ) * ( 0.5 * zCF_3 * y - 0.5 * wCF_3 * x ) -
462 ( RCF_0 / ( rCF_0 * rCF_0 ) ) * ( 0.5 * zCF_0 * y - 0.5 * wCF_0 * x ) +
463 rmix / ( rCF_0 * rCF_0 ) );
464 m_weights[kFlavoredCF_0][kFlavoredCFBar_3] =
465 ( 1. + rCF2_0 * rCF2_3 - 2. * RCF_0 * RCF_3 * rCF_0 * rCF_3 ) / ( bfCF_0 * bfCF_3 );
466 m_weights[kFlavoredCF_0][kFlavoredCSBar] = 1. + rCF2_0 * rCS2 - rCF_0 * rCS * vCFCSMinus;
467 m_weights[kFlavoredCF_0][kFlavoredCS] = rCF2_0 + rCS2 - rCF_0 * rCS * vCF_0CSPlus +
468 rmix * m_weights[kFlavoredCF_0][kFlavoredCSBar];
469
470 m_weights[kFlavoredCF_0][kSLPlus] = 1. / bfCF_0; // inexist
471 m_weights[kFlavoredCF_0][kSLMinus] = 1. / bfCF_0; //
472
473 // m_weights[ kFlavoredCF_0 ][ kCPPlus ] =
474 // ( 1. + rCF2_0 + rCF_0 * zCF_0 ) / ( 1. + m_rwsCF_0 ) / bCF_0 / bCPPlus ;
475 // m_weights[ kFlavoredCF_0 ][ kCPMinus ] =
476 // ( 1. + rCF2_0 - rCF_0 * zCF_0 ) / ( 1. + m_rwsCF_0 ) / bCF_0 / bCPMinus ;
477 m_weights[kFlavoredCF_0][kCPPlus] =
478 ( 1. + rCF2_0 - 2. * rCF_0 * RCF_0 * cos( dCF_0 ) ) /
479 ( ( 1. + rCF2_0 - 2. * rCF_0 * RCF_0 * cos( dCF_0 ) * y + y * y ) * bCPPlus );
480 m_weights[kFlavoredCF_0][kCPMinus] =
481 ( 1. + rCF2_0 + 2. * rCF_0 * RCF_0 * cos( dCF_0 ) ) /
482 ( ( 1. + rCF2_0 - 2. * rCF_0 * RCF_0 * cos( dCF_0 ) * y + y * y ) * bCPMinus );
483 m_weights[kFlavoredCF_0][kDalitz] = 1. / bfCF_0;
484 m_weights[kFlavoredCF_0][k2Pip2Pim] = 1. / bfCF_0;
485 m_weights[kFlavoredCF_0][kPipPim2Pi0] = 1. / bfCF_0;
486 m_weights[kFlavoredCF_0][kK0PiPiPi0] = 1. / bfCF_0;
487 m_weights[kFlavoredCF_0][kKKPiPi] = 1. / bfCF_0;
488 m_weights[kFlavoredCF_0][kK0KK] = 1. / bfCF_0;
489 m_weights[kFlavoredCF_0][kPipPimPi0] =
490 ( 1. + rCF2_0 - 2. * ( 2. * m_FCP_PiPiPi0 - 1. ) * rCF_0 * RCF_0 * cos( dCF_0 ) ) /
491 ( ( 1. + rCF2_0 - 2. * rCF_0 * RCF_0 * cos( dCF_0 ) * y + y * y ) * bCPPlus_PiPiPi0 );
492
493 // FlavoredCFBar
494 m_weights[kFlavoredCFBar_0][kFlavoredCFBar_0] = m_weights[kFlavoredCF_0][kFlavoredCF_0];
495 m_weights[kFlavoredCFBar_0][kFlavoredCF_1] = m_weights[kFlavoredCF_0][kFlavoredCFBar_1];
496 m_weights[kFlavoredCFBar_0][kFlavoredCFBar_1] = m_weights[kFlavoredCF_0][kFlavoredCF_1];
497 m_weights[kFlavoredCFBar_0][kFlavoredCF_3] = m_weights[kFlavoredCF_0][kFlavoredCFBar_3];
498 m_weights[kFlavoredCFBar_0][kFlavoredCFBar_3] = m_weights[kFlavoredCF_0][kFlavoredCF_3];
499 m_weights[kFlavoredCFBar_0][kFlavoredCS] = m_weights[kFlavoredCF_0][kFlavoredCSBar];
500 m_weights[kFlavoredCFBar_0][kFlavoredCSBar] = m_weights[kFlavoredCF_0][kFlavoredCS];
501 m_weights[kFlavoredCFBar_0][kSLPlus] = 1. / bCF_0;
502 m_weights[kFlavoredCFBar_0][kSLMinus] = 1. / bCF_0;
503 m_weights[kFlavoredCFBar_0][kCPPlus] = m_weights[kFlavoredCF_0][kCPPlus];
504 m_weights[kFlavoredCFBar_0][kCPMinus] = m_weights[kFlavoredCF_0][kCPMinus];
505 m_weights[kFlavoredCFBar_0][kDalitz] = 1. / bCF_0;
506 m_weights[kFlavoredCFBar_0][k2Pip2Pim] = 1. / bCF_0;
507 m_weights[kFlavoredCFBar_0][kPipPim2Pi0] = 1. / bCF_0;
508 m_weights[kFlavoredCFBar_0][kK0PiPiPi0] = 1. / bCF_0;
509 m_weights[kFlavoredCFBar_0][kKKPiPi] = 1. / bCF_0;
510 m_weights[kFlavoredCFBar_0][kK0KK] = 1. / bCF_0;
511 m_weights[kFlavoredCFBar_0][kPipPimPi0] = m_weights[kFlavoredCF_0][kPipPimPi0];
512
513 m_weights[kFlavoredCF_1][kFlavoredCF_1] =
514 ( ( 1 - RCF_1 * RCF_1 ) /
515 ( 1 - RCF_1 * ( 1. / rCF_1 ) * ( 0.5 * zCF_1 * y - 0.5 * wCF_1 * x ) +
516 rmix / ( 2 * rCF2_1 ) ) );
517 m_weights[kFlavoredCF_1][kFlavoredCFBar_1] =
518 ( 1. + rCF2_1 * rCF2_1 - 2. * RCF_1 * RCF_1 * rCF2_1 ) / ( bfCF_1 * bfCF_1 );
519 m_weights[kFlavoredCF_1][kFlavoredCF_3] =
520 ( 1. + ( rCF2_1 / rCF2_3 ) * ( rCF2_1 / rCF2_3 ) -
521 2. * ( rCF2_1 / rCF2_3 ) * RCF_1 * RCF_3 * cos( dCF_1 - dCF_3 ) ) /
522 ( 1. + ( rCF2_1 / rCF2_3 ) * ( rCF2_1 / rCF2_3 ) -
523 RCF_3 * ( 1. / rCF_3 ) * ( 0.5 * zCF_3 * y - 0.5 * wCF_3 * x ) -
524 ( RCF_1 / ( rCF_1 * rCF_1 ) ) * ( 0.5 * zCF_1 * y - 0.5 * wCF_1 * x ) +
525 rmix / ( rCF_1 * rCF_1 ) );
526 ;
527 m_weights[kFlavoredCF_1][kFlavoredCFBar_3] =
528 ( 1. + rCF2_1 * rCF2_3 - 2. * RCF_1 * RCF_3 * rCF_1 * rCF_3 ) / ( bfCF_1 * bfCF_3 );
529 ;
530 m_weights[kFlavoredCF_1][kFlavoredCSBar] = 1. + rCF2_1 * rCS2 - rCF_1 * rCS * vCFCSMinus;
531 m_weights[kFlavoredCF_1][kFlavoredCS] = rCF2_1 + rCS2 - rCF_1 * rCS * vCF_1CSPlus +
532 rmix * m_weights[kFlavoredCF_1][kFlavoredCSBar];
533
534 m_weights[kFlavoredCF_1][kSLPlus] = 1. / bfCF_1;
535 m_weights[kFlavoredCF_1][kSLMinus] = 1. / bfCF_1;
536
537 // m_weights[ kFlavoredCF_1 ][ kCPPlus ] =
538 // ( 1. + rCF2_1 + rCF_1 * zCF_1 ) / ( 1. + m_rwsCF_1 ) / bCF_1 / bCPPlus ;
539 // m_weights[ kFlavoredCF_1 ][ kCPMinus ] =
540 // ( 1. + rCF2_1 - rCF_1 * zCF_1 ) / ( 1. + m_rwsCF_1 ) / bCF_1 / bCPMinus ;
541 m_weights[kFlavoredCF_1][kCPPlus] =
542 ( 1. + rCF2_1 - 2. * rCF_1 * RCF_1 * cos( dCF_1 ) ) /
543 ( ( 1. + rCF2_1 - 2. * rCF_1 * RCF_1 * cos( dCF_1 ) * y + y * y ) * bCPPlus );
544 m_weights[kFlavoredCF_1][kCPMinus] =
545 ( 1. + rCF2_1 + 2. * rCF_1 * RCF_1 * cos( dCF_1 ) ) /
546 ( ( 1. + rCF2_1 - 2. * rCF_1 * RCF_1 * cos( dCF_1 ) * y + y * y ) * bCPMinus );
547 m_weights[kFlavoredCF_1][kDalitz] = 1. / bCF_1;
548 m_weights[kFlavoredCF_1][k2Pip2Pim] = 1. / bCF_1;
549 m_weights[kFlavoredCF_1][kPipPim2Pi0] = 1. / bCF_1;
550 m_weights[kFlavoredCF_1][kK0PiPiPi0] = 1. / bCF_1;
551 m_weights[kFlavoredCF_1][kKKPiPi] = 1. / bCF_1;
552 m_weights[kFlavoredCF_1][kK0KK] = 1. / bCF_1;
553 m_weights[kFlavoredCF_1][kPipPimPi0] =
554 ( 1. + rCF2_1 - 2. * ( 2. * m_FCP_PiPiPi0 - 1. ) * rCF_1 * RCF_1 * cos( dCF_1 ) ) /
555 ( ( 1. + rCF2_1 - 2. * rCF_1 * RCF_1 * cos( dCF_1 ) * y + y * y ) * bCPPlus_PiPiPi0 );
556
557 // FlavoredCFBar
558 m_weights[kFlavoredCFBar_1][kFlavoredCFBar_1] = m_weights[kFlavoredCF_1][kFlavoredCF_1];
559 m_weights[kFlavoredCFBar_1][kFlavoredCF_3] = m_weights[kFlavoredCF_1][kFlavoredCFBar_3];
560 m_weights[kFlavoredCFBar_1][kFlavoredCFBar_3] = m_weights[kFlavoredCF_1][kFlavoredCF_3];
561 m_weights[kFlavoredCFBar_1][kFlavoredCS] = m_weights[kFlavoredCF_1][kFlavoredCSBar];
562 m_weights[kFlavoredCFBar_1][kFlavoredCSBar] = m_weights[kFlavoredCF_1][kFlavoredCS];
563 m_weights[kFlavoredCFBar_1][kSLPlus] = 1. / bCF_1;
564 m_weights[kFlavoredCFBar_1][kSLMinus] = 1. / bCF_1;
565 m_weights[kFlavoredCFBar_1][kCPPlus] = m_weights[kFlavoredCF_1][kCPPlus];
566 m_weights[kFlavoredCFBar_1][kCPMinus] = m_weights[kFlavoredCF_1][kCPMinus];
567 m_weights[kFlavoredCFBar_1][kDalitz] = 1. / bCF_1;
568 m_weights[kFlavoredCFBar_1][k2Pip2Pim] = 1. / bCF_1;
569 m_weights[kFlavoredCFBar_1][kPipPim2Pi0] = 1. / bCF_1;
570 m_weights[kFlavoredCFBar_1][kK0PiPiPi0] = 1. / bCF_1;
571 m_weights[kFlavoredCFBar_1][kKKPiPi] = 1. / bCF_1;
572 m_weights[kFlavoredCFBar_1][kK0KK] = 1. / bCF_1;
573 m_weights[kFlavoredCFBar_1][kPipPimPi0] = m_weights[kFlavoredCF_1][kPipPimPi0];
574
575 m_weights[kFlavoredCF_3][kFlavoredCF_3] =
576 ( ( 1 - RCF_3 * RCF_3 ) /
577 ( 1 - RCF_3 * ( 1. / rCF_3 ) * ( 0.5 * zCF_3 * y - 0.5 * wCF_3 * x ) +
578 rmix / ( 2 * rCF2_3 ) ) );
579 m_weights[kFlavoredCF_3][kFlavoredCFBar_3] =
580 ( 1. + rCF2_3 * rCF2_3 - 2. * RCF_3 * RCF_3 * rCF2_3 ) / ( bfCF_3 * bfCF_3 );
581 m_weights[kFlavoredCF_3][kFlavoredCSBar] = 1. + rCF2_3 * rCS2 - rCF_3 * rCS * vCFCSMinus;
582 m_weights[kFlavoredCF_3][kFlavoredCS] = rCF2_3 + rCS2 - rCF_3 * rCS * vCF_3CSPlus +
583 rmix * m_weights[kFlavoredCF_3][kFlavoredCSBar];
584
585 m_weights[kFlavoredCF_3][kSLPlus] = 1. / bfCF_3;
586 m_weights[kFlavoredCF_3][kSLMinus] = 1. / bfCF_3;
587
588 // m_weights[ kFlavoredCF_3 ][ kCPPlus ] =
589 // ( 1. + rCF2_3 + rCF_3 * zCF_3 ) / ( 1. + m_rwsCF_3 ) / bCF_3 / bCPPlus ;
590 // m_weights[ kFlavoredCF_3 ][ kCPMinus ] =
591 // ( 1. + rCF2_3 - rCF_3 * zCF_3 ) / ( 1. + m_rwsCF_3 ) / bCF_3 / bCPMinus ;
592 m_weights[kFlavoredCF_3][kCPPlus] =
593 ( 1. + rCF2_3 - 2. * rCF_3 * RCF_3 * cos( dCF_3 ) ) /
594 ( ( 1. + rCF2_3 - 2. * rCF_3 * RCF_3 * cos( dCF_3 ) * y + y * y ) * bCPPlus );
595 m_weights[kFlavoredCF_3][kCPMinus] =
596 ( 1. + rCF2_3 + 2. * rCF_3 * RCF_3 * cos( dCF_3 ) ) /
597 ( ( 1. + rCF2_3 - 2. * rCF_3 * RCF_3 * cos( dCF_3 ) * y + y * y ) * bCPMinus );
598 m_weights[kFlavoredCF_3][kDalitz] = 1. / bCF_3;
599 m_weights[kFlavoredCF_3][k2Pip2Pim] = 1. / bCF_3;
600 m_weights[kFlavoredCF_3][kPipPim2Pi0] = 1. / bCF_3;
601 m_weights[kFlavoredCF_3][kK0PiPiPi0] = 1. / bCF_3;
602 m_weights[kFlavoredCF_3][kKKPiPi] = 1. / bCF_3;
603 m_weights[kFlavoredCF_3][kK0KK] = 1. / bCF_3;
604 m_weights[kFlavoredCF_3][kPipPimPi0] =
605 ( 1. + rCF2_3 - 2. * ( 2. * m_FCP_PiPiPi0 - 1. ) * rCF_3 * RCF_3 * cos( dCF_3 ) ) /
606 ( ( 1. + rCF2_3 - 2. * rCF_3 * RCF_3 * cos( dCF_3 ) * y + y * y ) * bCPPlus_PiPiPi0 );
607
608 // FlavoredCFBar
609 m_weights[kFlavoredCFBar_3][kFlavoredCFBar_3] = m_weights[kFlavoredCF_3][kFlavoredCF_3];
610 m_weights[kFlavoredCFBar_3][kFlavoredCS] = m_weights[kFlavoredCF_3][kFlavoredCSBar];
611 m_weights[kFlavoredCFBar_3][kFlavoredCSBar] = m_weights[kFlavoredCF_3][kFlavoredCS];
612 m_weights[kFlavoredCFBar_3][kSLPlus] = 1. / bCF_3;
613 m_weights[kFlavoredCFBar_3][kSLMinus] = 1. / bCF_3;
614 m_weights[kFlavoredCFBar_3][kCPPlus] = m_weights[kFlavoredCF_3][kCPPlus];
615 m_weights[kFlavoredCFBar_3][kCPMinus] = m_weights[kFlavoredCF_3][kCPMinus];
616 m_weights[kFlavoredCFBar_3][kDalitz] = 1. / bCF_3;
617 m_weights[kFlavoredCFBar_3][k2Pip2Pim] = 1. / bCF_3;
618 m_weights[kFlavoredCFBar_3][kPipPim2Pi0] = 1. / bCF_3;
619 m_weights[kFlavoredCFBar_3][kK0PiPiPi0] = 1. / bCF_3;
620 m_weights[kFlavoredCFBar_3][kKKPiPi] = 1. / bCF_3;
621 m_weights[kFlavoredCFBar_3][kK0KK] = 1. / bCF_3;
622 m_weights[kFlavoredCFBar_3][kPipPimPi0] = m_weights[kFlavoredCF_3][kPipPimPi0];
623
624 // FlavoredCS
625
626 // First calculate rate factors.
627 m_weights[kFlavoredCS][kFlavoredCSBar] = 1. + rCS2 * ( 2. - zCS2 ) + rCS2 * rCS2;
628 m_weights[kFlavoredCS][kFlavoredCS] = rmix * m_weights[kFlavoredCS][kFlavoredCSBar];
629
630 // Nov 2007: correct for r2 -> RWS and BR != A^2
631 m_weights[kFlavoredCS][kFlavoredCS] /= m_rwsCS * bCS * bCS;
632 m_weights[kFlavoredCS][kFlavoredCSBar] /= ( 1. + m_rwsCS * m_rwsCS ) * bCS * bCS;
633
634 m_weights[kFlavoredCS][kSLPlus] = 1. / bCS;
635 m_weights[kFlavoredCS][kSLMinus] = 1. / bCS;
636
637 m_weights[kFlavoredCS][kCPPlus] =
638 ( 1. + rCS2 + rCS * zCS ) / ( 1. + m_rwsCS ) / bCS / bCPPlus;
639 m_weights[kFlavoredCS][kCPMinus] =
640 ( 1. + rCS2 - rCS * zCS ) / ( 1. + m_rwsCS ) / bCS / bCPMinus;
641
642 m_weights[kFlavoredCS][kDalitz] = 1. / bCS;
643 m_weights[kFlavoredCS][k2Pip2Pim] = 1. / bCS;
644 m_weights[kFlavoredCS][kPipPim2Pi0] = 1. / bCS;
645 m_weights[kFlavoredCS][kK0PiPiPi0] = 1. / bCS;
646 m_weights[kFlavoredCS][kKKPiPi] = 1. / bCS;
647 m_weights[kFlavoredCS][kK0KK] = 1. / bCS;
648 m_weights[kFlavoredCS][kPipPimPi0] =
649 ( 1. + rCS2 + ( 2. * m_FCP_PiPiPi0 - 1. ) * rCS * zCS ) / ( 1. + m_rwsCS ) / bCS /
650 bCPPlus_PiPiPi0;
651
652 // FlavoredCSBar
653
654 m_weights[kFlavoredCSBar][kFlavoredCSBar] = m_weights[kFlavoredCS][kFlavoredCS];
655 m_weights[kFlavoredCSBar][kSLPlus] = 1. / bCS;
656 m_weights[kFlavoredCSBar][kSLMinus] = 1. / bCS;
657 m_weights[kFlavoredCSBar][kCPPlus] = m_weights[kFlavoredCS][kCPPlus];
658 m_weights[kFlavoredCSBar][kCPMinus] = m_weights[kFlavoredCS][kCPMinus];
659 m_weights[kFlavoredCSBar][kDalitz] = 1. / bCS;
660 m_weights[kFlavoredCSBar][k2Pip2Pim] = 1. / bCS;
661 m_weights[kFlavoredCSBar][kPipPim2Pi0] = 1. / bCS;
662 m_weights[kFlavoredCSBar][kK0PiPiPi0] = 1. / bCS;
663 m_weights[kFlavoredCSBar][kKKPiPi] = 1. / bCS;
664 m_weights[kFlavoredCSBar][kK0KK] = 1. / bCS;
665 m_weights[kFlavoredCSBar][kPipPimPi0] = m_weights[kFlavoredCS][kPipPimPi0];
666
667 // SLPlus
668
669 // SLPlus/SLPlus should have rate factor = Rmix, but none of these are
670 // generated in uncorrelated MC.
671 m_weights[kSLPlus][kSLPlus] = 0.;
672 m_weights[kSLPlus][kSLMinus] = 1.;
673 m_weights[kSLPlus][kCPPlus] = 1. / bCPPlus;
674 m_weights[kSLPlus][kCPMinus] = 1. / bCPMinus;
675 m_weights[kSLPlus][kDalitz] = 1.;
676 m_weights[kSLPlus][k2Pip2Pim] = 1.;
677 m_weights[kSLPlus][kPipPim2Pi0] = 1.;
678 m_weights[kSLPlus][kK0PiPiPi0] = 1.;
679 m_weights[kSLPlus][kKKPiPi] = 1.;
680 m_weights[kSLPlus][kK0KK] = 1.;
681 m_weights[kSLPlus][kPipPimPi0] = 1. / bCPPlus_PiPiPi0;
682
683 // SLMinus
684
685 m_weights[kSLMinus][kSLMinus] = 0.;
686 m_weights[kSLMinus][kCPPlus] = 1. / bCPPlus;
687 m_weights[kSLMinus][kCPMinus] = 1. / bCPMinus;
688 m_weights[kSLMinus][kDalitz] = 1.;
689 m_weights[kSLMinus][k2Pip2Pim] = 1.;
690 m_weights[kSLMinus][kPipPim2Pi0] = 1.;
691 m_weights[kSLMinus][kK0PiPiPi0] = 1.;
692 m_weights[kSLMinus][kKKPiPi] = 1.;
693 m_weights[kSLMinus][kK0KK] = 1.;
694 m_weights[kSLMinus][kPipPimPi0] = 1. / bCPPlus_PiPiPi0;
695
696 // CPPlus
697
698 m_weights[kCPPlus][kCPPlus] = 0.;
699 m_weights[kCPPlus][kCPMinus] = 2. / bCPPlus / bCPMinus;
700 m_weights[kCPPlus][kDalitz] = 1. / bCPPlus;
701 m_weights[kCPPlus][k2Pip2Pim] = 1. / bCPPlus;
702 m_weights[kCPPlus][kPipPim2Pi0] = 1. / bCPPlus;
703 m_weights[kCPPlus][kK0PiPiPi0] = 1. / bCPPlus;
704 m_weights[kCPPlus][kKKPiPi] = 1. / bCPPlus;
705 m_weights[kCPPlus][kK0KK] = 1. / bCPPlus;
706 m_weights[kCPPlus][kPipPimPi0] =
707 ( 1 - ( 2. * m_FCP_PiPiPi0 - 1. ) ) / bCPPlus / bCPPlus_PiPiPi0;
708
709 // CPMinus
710
711 m_weights[kCPMinus][kCPMinus] = 0.;
712 m_weights[kCPMinus][kDalitz] = 1. / bCPMinus;
713 m_weights[kCPMinus][k2Pip2Pim] = 1. / bCPMinus;
714 m_weights[kCPMinus][kPipPim2Pi0] = 1. / bCPMinus;
715 m_weights[kCPMinus][kK0PiPiPi0] = 1. / bCPMinus;
716 m_weights[kCPMinus][kKKPiPi] = 1. / bCPMinus;
717 m_weights[kCPMinus][kK0KK] = 1. / bCPMinus;
718 m_weights[kCPMinus][kPipPimPi0] =
719 2. * ( 1 - ( 2. * m_FCP_PiPiPi0 - 1. ) ) / bCPMinus / bCPPlus_PiPiPi0;
720
721 // Dalitz estimate
722 m_weights[kDalitz][kDalitz] = 1;
723 m_weights[kDalitz][k2Pip2Pim] = 1;
724 m_weights[kDalitz][kPipPim2Pi0] = 1;
725 m_weights[kDalitz][kK0PiPiPi0] = 1;
726 m_weights[kDalitz][kKKPiPi] = 1;
727 m_weights[kDalitz][kK0KK] = 1;
728 m_weights[kDalitz][kPipPimPi0] = 1;
729
730 m_weights[k2Pip2Pim][k2Pip2Pim] = 1;
731 m_weights[k2Pip2Pim][kPipPim2Pi0] = 1;
732 m_weights[k2Pip2Pim][kK0PiPiPi0] = 1;
733 m_weights[k2Pip2Pim][kKKPiPi] = 1;
734 m_weights[k2Pip2Pim][kK0KK] = 1;
735 m_weights[k2Pip2Pim][kPipPimPi0] = 1;
736
737 m_weights[kPipPim2Pi0][kPipPim2Pi0] = 1;
738 m_weights[kPipPim2Pi0][kK0PiPiPi0] = 1;
739 m_weights[kPipPim2Pi0][kKKPiPi] = 1;
740 m_weights[kPipPim2Pi0][kK0KK] = 1;
741 m_weights[kPipPim2Pi0][kPipPimPi0] = 1;
742
743 m_weights[kK0PiPiPi0][kK0PiPiPi0] = 1;
744 m_weights[kK0PiPiPi0][kKKPiPi] = 1;
745 m_weights[kK0PiPiPi0][kK0KK] = 1;
746 m_weights[kK0PiPiPi0][kPipPimPi0] = 1;
747
748 m_weights[kKKPiPi][kKKPiPi] = 1;
749 m_weights[kKKPiPi][kK0KK] = 1;
750 m_weights[kKKPiPi][kPipPimPi0] = 1;
751
752 m_weights[kK0KK][kK0KK] = 1;
753 m_weights[kK0KK][kPipPimPi0] = 1;
754
755 m_weights[kPipPimPi0][kPipPimPi0] =
756 ( 1 - ( 2. * m_FCP_PiPiPi0 - 1. ) * ( 2. * m_FCP_PiPiPi0 - 1. ) ) / bCPPlus_PiPiPi0 /
757 bCPPlus_PiPiPi0;
758
759 log << MSG::INFO << "Weight matrix" << m_weights << endmsg;
760
761 // Boss 6.6.2 MC Branching fractions
762 HepVector fractionsD0( kNDecayTypes + 1, 0 );
763 fractionsD0[kFlavoredCF_0] = 0.305;
764 fractionsD0[kFlavoredCFBar_0] = 0.0076;
765 fractionsD0[kFlavoredCF_1] = 0.144;
766 fractionsD0[kFlavoredCFBar_1] = 0.00031;
767 fractionsD0[kFlavoredCF_3] = 0.0822;
768 fractionsD0[kFlavoredCFBar_3] = 0.00027;
769 fractionsD0[kFlavoredCS] = 0.031;
770 fractionsD0[kFlavoredCSBar] = 0.031;
771 fractionsD0[kSLPlus] = 0.125;
772 fractionsD0[kSLMinus] = 0.;
773 fractionsD0[kCPPlus] = 0.113;
774 fractionsD0[kCPMinus] = 0.102;
775 fractionsD0[kDalitz] = 0.05855;
776 fractionsD0[k2Pip2Pim] = 0.00720;
777 fractionsD0[kPipPim2Pi0] = 0.0102;
778 fractionsD0[kK0PiPiPi0] = 0.105;
779 fractionsD0[kKKPiPi] = 0.00273;
780 fractionsD0[kK0KK] = 0.00902;
781 fractionsD0[kPipPimPi0] = 0.0149;
782 HepVector scales = m_weights * fractionsD0;
783 log << MSG::INFO << "Integrated scale factors " << scales << endmsg;
784
785 HepVector fractionsD0bar( kNDecayTypes + 1, 0 );
786 fractionsD0bar[kFlavoredCF_0] = 0.0076;
787 fractionsD0bar[kFlavoredCFBar_0] = 0.305;
788 fractionsD0bar[kFlavoredCF_1] = 0.00031;
789 fractionsD0bar[kFlavoredCFBar_1] = 0.144;
790 fractionsD0bar[kFlavoredCF_3] = 0.00027;
791 fractionsD0bar[kFlavoredCFBar_3] = 0.0822;
792 fractionsD0bar[kFlavoredCS] = 0.031;
793 fractionsD0bar[kFlavoredCSBar] = 0.031;
794 fractionsD0bar[kSLPlus] = 0.;
795 fractionsD0bar[kSLMinus] = 0.125;
796 fractionsD0bar[kCPPlus] = 0.113;
797 fractionsD0bar[kCPMinus] = 0.102;
798 fractionsD0bar[kDalitz] = 0.056;
799 fractionsD0bar[k2Pip2Pim] = 0.00720;
800 fractionsD0bar[kPipPim2Pi0] = 0.0102;
801 fractionsD0bar[kK0PiPiPi0] = 0.104;
802 fractionsD0bar[kKKPiPi] = 0.00273;
803 fractionsD0bar[kK0KK] = 0.00902;
804 fractionsD0bar[kPipPimPi0] = 0.0149;
805 HepVector weight_norm = fractionsD0bar.T() * scales;
806 log << MSG::INFO << "Overall scale factor " << fractionsD0bar.T() * scales << endmsg;
807
808 // Original MC
809 // Branching fraction predictions after weight
810 double brCF_0 =
811 ( fractionsD0bar[kFlavoredCFBar_0] * scales[kFlavoredCFBar_0] ) / weight_norm[0];
812 double brCF_1 =
813 ( fractionsD0bar[kFlavoredCFBar_1] * scales[kFlavoredCFBar_1] ) / weight_norm[0];
814 double brCF_3 =
815 ( fractionsD0bar[kFlavoredCFBar_3] * scales[kFlavoredCFBar_3] ) / weight_norm[0];
816 double brCS = ( fractionsD0bar[kFlavoredCS] * scales[kFlavoredCS] +
817 fractionsD0bar[kFlavoredCSBar] * scales[kFlavoredCSBar] ) /
818 weight_norm[0];
819 double brDCS_0 = ( fractionsD0bar[kFlavoredCF_0] * scales[kFlavoredCF_0] ) / weight_norm[0];
820 double brDCS_1 = ( fractionsD0bar[kFlavoredCF_1] * scales[kFlavoredCF_1] ) / weight_norm[0];
821 double brDCS_3 = ( fractionsD0bar[kFlavoredCF_3] * scales[kFlavoredCF_3] ) / weight_norm[0];
822 double brCPPlus = ( fractionsD0bar[kCPPlus] * scales[kCPPlus] ) / weight_norm[0];
823 double brCPMinus = ( fractionsD0bar[kCPMinus] * scales[kCPMinus] ) / weight_norm[0];
824
825 // y=0.0 dalitz example used for prediction
826 double dalitz_y_num = -0.000177536;
827 double dalitz_y_den = -0.0150846;
828
829 double numFactCF_0 = -rCF_0 * zCF_0 * ( 1. - 0.5 * rCF_0 * wCF_0 * m_x );
830 double numFactCF_1 = -rCF_1 * zCF_1 * ( 1. - 0.5 * rCF_1 * wCF_1 * m_x );
831 double numFactCF_3 = -rCF_3 * zCF_3 * ( 1. - 0.5 * rCF_3 * wCF_3 * m_x );
832 double numFactCS = -rCS * zCS * ( 1. - 0.5 * rCS * wCS * m_x );
833 double denFactCF_0 = 0.5 * rCF2_0 * zCF2_0;
834 double denFactCF_1 = 0.5 * rCF2_1 * zCF2_1;
835 double denFactCF_3 = 0.5 * rCF2_3 * zCF2_3;
836 double denFactCS = 0.5 * rCS2 * zCS2;
837
838 double num_pre = brCPPlus - brCPMinus + brCF_0 * numFactCF_0 + brCF_1 * numFactCF_1 +
839 brCF_3 * numFactCF_3 + 0.5 * brCS * numFactCS + dalitz_y_num;
840 double den_pre = 1. - brCPPlus - brCPMinus - brCF_0 * denFactCF_0 - brCF_1 * denFactCF_1 -
841 brCF_3 * denFactCF_3 - 0.5 * brCS * denFactCS + dalitz_y_den;
842 double y_pre = num_pre / den_pre;
843 double num = fractionsD0bar[kCPPlus] - fractionsD0bar[kCPMinus] +
844 fractionsD0bar[kFlavoredCFBar_0] * numFactCF_0 +
845 fractionsD0bar[kFlavoredCFBar_1] * numFactCF_1 +
846 fractionsD0bar[kFlavoredCFBar_3] * numFactCF_3 +
847 fractionsD0bar[kFlavoredCS] * numFactCS + dalitz_y_num;
848 double den = 1. - fractionsD0bar[kCPPlus] - fractionsD0bar[kCPMinus] -
849 fractionsD0bar[kFlavoredCFBar_0] * denFactCF_0 -
850 fractionsD0bar[kFlavoredCFBar_1] * denFactCF_1 -
851 fractionsD0bar[kFlavoredCFBar_3] * denFactCF_3 -
852 fractionsD0bar[kFlavoredCS] * denFactCS + dalitz_y_den;
853 double y_prematrix = num / den;
854 double y_test1 = 0.25 * ( ( ( scales[kCPMinus] * m_weights[kCPPlus][kSLPlus] ) /
855 ( scales[kCPPlus] * m_weights[kCPMinus][kSLPlus] ) ) -
856 ( ( scales[kCPPlus] * m_weights[kCPMinus][kSLPlus] ) /
857 ( scales[kCPMinus] * m_weights[kCPPlus][kSLPlus] ) ) );
858
859 log << MSG::INFO << "An Input Y of " << m_y << endmsg;
860 log << MSG::INFO << "Parent MC has an intrinsic value of y as " << y_prematrix << endmsg;
861 log << MSG::INFO << "The BR method predics a y of " << y_pre << endmsg;
862 log << MSG::INFO << "The CP-SL double tag method predicts y of " << y_test1 << endmsg;
863
864 // Renormalize
865 m_largestWeight = 0.;
866 for ( int i = 0; i < kNDecayTypes; ++i )
867 {
868 for ( int j = 0; j < kNDecayTypes; ++j )
869 {
870 if ( m_weights[i][j] < 0 )
871 m_weights[i][j] = 0; // gets rid of negative weights in early calculations
872 if ( m_weights[i][j] > m_largestWeight ) { m_largestWeight = m_weights[i][j]; }
873 }
874 }
875 m_weights /= m_largestWeight;
876
877 log << MSG::INFO << "Renormalized weight matrix " << m_weights << endmsg;
878
879 // Set up weight parameters
880 Dalitz t( 8 );
881 double D0Sum[10], D0barSum[10]; // last index is for sum over bins
882 TComplex D0D0barSum[10];
883 int points[10];
884
885 for ( int i = 0; i < 10; ++i )
886 {
887 D0Sum[i] = 0.;
888 D0barSum[i] = 0.;
889 D0D0barSum[i] = TComplex( 0., 0. );
890 points[i] = 0;
891 }
892
893 double m2min = 0.;
894 double m2max = 3.;
895 int nsteps = 1000;
896 double stepsize = ( m2max - m2min ) / (double)nsteps;
897
898 for ( int i = 0; i < nsteps; ++i )
899 {
900 double m2i = m2min + ( (double)i + 0.5 ) * stepsize;
901
902 for ( int j = 0; j < nsteps; ++j )
903 {
904 double m2j = m2min + ( (double)j + 0.5 ) * stepsize;
905
906 if ( t.Point_on_DP( m2i, m2j ) )
907 {
908 double m2k = 1.86450 * 1.86450 + 0.497648 * 0.497648 + 0.139570 * 0.139570 +
909 0.139570 * 0.139570 - m2i - m2j;
910
911 TComplex D0, D0bar;
912 if ( m_dalitzModel == 0 )
913 { // Cleo model
914 D0 = t.CLEO_Amplitude( m2i, m2j, m2k );
915 D0bar = t.CLEO_Amplitude( m2j, m2i, m2k );
916 }
917 if ( m_dalitzModel == 1 )
918 { // Babar model
919 D0 = t.Babar_Amplitude( m2i, m2j, m2k );
920 D0bar = t.Babar_Amplitude( m2j, m2i, m2k );
921 }
922 if ( m_dalitzModel == 2 )
923 { // Belle model
924 D0 = t.Amplitude( m2i, m2j, m2k );
925 D0bar = t.Amplitude( m2j, m2i, m2k );
926 }
927
928 if ( j <= i )
929 { // lower half only
930 int bin = t.getBin( m2i, m2j, m2k );
931 if ( bin == -1 ) bin = 8;
932
933 ++points[bin];
934 D0Sum[bin] += norm( D0 );
935 D0barSum[bin] += norm( D0bar );
936 D0D0barSum[bin] += D0 * conj( D0bar );
937
938 ++points[9];
939 D0Sum[9] += norm( D0 );
940 D0barSum[9] += norm( D0bar );
941 D0D0barSum[9] += D0 * conj( D0bar );
942 }
943 }
944 }
945 }
946
947 for ( int i = 0; i < 10; ++i )
948 {
949 double r2 = D0barSum[i] / D0Sum[i];
950 double c = real( D0D0barSum[i] ) / sqrt( D0barSum[i] ) / sqrt( D0Sum[i] );
951 double s = imag( D0D0barSum[i] ) / sqrt( D0barSum[i] ) / sqrt( D0Sum[i] );
952
953 cout << "BIN " << i << ": " << points[i] << " pts " << r2 << " " << c << " " << s << " "
954 << c * c + s * s << endmsg;
955 }
956
957 log << MSG::INFO << "successfully return from initialize()" << endmsg;
958 return StatusCode::SUCCESS;
959}
960
961//********************************************************************
963
964 // interface to event data service
965 ISvcLocator* svcLocator = Gaudi::svcLocator();
966 StatusCode sc = svcLocator->service( "EventDataSvc", m_evtSvc );
967 if ( sc.isFailure() ) std::cout << "Could not access EventDataSvc!" << std::endl;
968
969 // setFilterPassed(false);
970
971 MsgStream log( msgSvc(), name() );
972 log << MSG::INFO << "in execute()" << endmsg;
973
974 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
975
976 if ( !eventHeader )
977 {
978 cout << " eventHeader " << endl;
979 return StatusCode::FAILURE;
980 }
981 long runNo = eventHeader->runNumber();
982 long event = eventHeader->eventNumber();
983 log << MSG::DEBUG << "run, evtnum = " << runNo << " , " << event << endmsg;
984
985 unsigned int QC_status = 0;
986 // eventHeader->setEventTag(0);
987
988 // Get McParticle collection
989 SmartDataPtr<Event::McParticleCol> mcParticles( eventSvc(), EventModel::MC::McParticleCol );
990
991 // Check if event is Psi(3770)
992 int psipp_daughter = 0;
993 int d0_count = 0;
994 int chd_count = 0;
995 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
996 it++ )
997 {
998 int pdg_code = ( *it )->particleProperty();
999 if ( ( *it )->primaryParticle() ) continue;
1000 Event::McParticle it2 = ( *it )->mother();
1001 int mother_pdg = 0;
1002 // finds if the particle is daughter of Psi(3770)
1003 mother_pdg = it2.particleProperty();
1004 if ( mother_pdg == kPsi3770ID )
1005 {
1006 psipp_daughter++; // Found daughter
1007 if ( abs( pdg_code ) == kD0ID ) d0_count++;
1008 if ( abs( pdg_code ) == kDpID ) chd_count++;
1009 if ( pdg_code == kD0BarID ) m_nD0bar++;
1010 }
1011 }
1012
1013 if ( psipp_daughter == 0 ) // didn't find Psi(3770)
1014 {
1016
1017 if ( m_invertSelection )
1018 {
1019 // eventHeader->setEventTag(0);
1020 QC_status = 0;
1021 eventHeader->setEventTag( QC_status );
1022
1023 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1024 log << MSG::DEBUG << "Discarding event -- did not find psi(3770). " << endmsg;
1025 return StatusCode::SUCCESS; // discard event
1026 }
1027 else
1028 {
1029 // -------- Write to root file
1030 // setFilterPassed(true);
1031 // eventHeader->setEventTag(1);
1032 QC_status = 1;
1033 eventHeader->setEventTag( QC_status );
1034
1035 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1036
1037 return StatusCode::SUCCESS; // kept event
1038 }
1039 }
1040
1041 log << MSG::DEBUG << "Found psi(3770) -->" << endmsg;
1042
1043 // Check that top particle has only two daughters + possible FSR photon
1044 if ( psipp_daughter > 3 )
1045 {
1047
1048 if ( m_invertSelection )
1049 {
1050 // eventHeader->setEventTag(0);
1051 QC_status = 0;
1052 eventHeader->setEventTag( QC_status );
1053
1054 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1055 log << MSG::DEBUG << "Discarding event -- psi(3770) has >3 daughters." << endmsg;
1056 return StatusCode::SUCCESS; // discard event
1057 }
1058 else
1059 {
1060 // -------- Write to root file
1061 // eventHeader->setEventTag(1);
1062 QC_status = 1;
1063 eventHeader->setEventTag( QC_status );
1064
1065 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1066 // setFilterPassed(true);
1067
1068 return StatusCode::SUCCESS; // kept event
1069 }
1070 }
1071
1072 // Check if D+D- state
1073 if ( chd_count == 2 )
1074 { // D+D- event
1075 ++m_nDpDmEvents;
1076
1077 // D+D- must be rewieghted otherwise too many D+D- events relative to D0D0bar.
1078 double random = RandFlat::shoot();
1079
1080 if ( ( random < m_dplusDminusWeight && !m_invertSelection ) ||
1081 ( random > m_dplusDminusWeight && m_invertSelection ) )
1082 {
1083 // -------- Write to root file
1084 // setFilterPassed(true);
1085 // eventHeader->setEventTag(1);
1086 QC_status = 1;
1087 eventHeader->setEventTag( QC_status );
1088
1089 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1090
1091 return StatusCode::SUCCESS; // event kept
1092 }
1093 else
1094 {
1095 // eventHeader->setEventTag(0);
1096 QC_status = 0;
1097 eventHeader->setEventTag( QC_status );
1098
1099 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1100 log << MSG::DEBUG << "Discarding event -- D+D- event failed reweighting." << endmsg;
1102 return StatusCode::SUCCESS; // event discarded
1103 }
1104 }
1105
1106 // Check if D0D0Bar
1107 if ( d0_count != 2 )
1108 {
1109 if ( !m_invertSelection )
1110 {
1111 // eventHeader->setEventTag(0);
1112 QC_status = 0;
1113 eventHeader->setEventTag( QC_status );
1114
1115 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1116 log << MSG::DEBUG << "Discarding event -- non-D0-D0bar event." << endmsg;
1117 return StatusCode::SUCCESS; // discard event
1118 }
1119 else
1120 {
1121 // -------- Write to root file
1122 // eventHeader->setEventTag(1);
1123 QC_status = 1;
1124 eventHeader->setEventTag( QC_status );
1125
1126 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1127 // setFilterPassed(true);
1128
1129 return StatusCode::SUCCESS; // kept event
1130 }
1131 }
1132
1133 log << MSG::INFO << "D0-D0bar event." << endmsg;
1135
1136 m_rho_flag = 0;
1137
1138 // Get D0-D0bar modes and info
1139 vector<double> d0_decay = findD0Decay( 1 );
1140 vector<double> d0bar_decay = findD0Decay( -1 );
1141
1142 int d0mode = d0_decay[0];
1143 int d0barmode = d0bar_decay[0];
1144 if ( m_debug ) cout << "D0 " << d0mode << endl;
1145 if ( m_debug ) cout << "D0bar " << d0barmode << endl;
1146 m_modeCounter[d0mode][d0barmode]++;
1147
1148 // if any event unidentified remove
1149 if ( d0_decay[0] == 20 || d0bar_decay[0] == 20 )
1150 {
1151 if ( !m_invertSelection )
1152 {
1153 // eventHeader->setEventTag(0);
1154 QC_status = 0;
1155 eventHeader->setEventTag( QC_status );
1156
1157 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1158 log << MSG::DEBUG << "Discarding event -- unknown D0-D0bar event." << endmsg;
1159 return StatusCode::SUCCESS; // discard event
1160 }
1161 else
1162 {
1163 // -------- Write to root file
1164 // eventHeader->setEventTag(1);
1165 QC_status = 1;
1166 eventHeader->setEventTag( QC_status );
1167
1168 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1169 // setFilterPassed(true);
1170
1171 return StatusCode::SUCCESS; // kept event
1172 }
1173 }
1174
1175 // Loop over D's
1176 double r2D0 = d0_decay[1];
1177 double deltaD0 = d0_decay[2];
1178 double RD0 = d0_decay[3];
1179 double FCP = d0_decay[4];
1180 double r2D0bar = d0bar_decay[1];
1181 double deltaD0bar = d0bar_decay[2];
1182 double RD0bar = d0bar_decay[3];
1183 double FCPbar = d0bar_decay[4];
1184
1185 // Weight based on DDbar combination
1186 double weight;
1187 if ( d0_decay[0] == kDalitz || d0bar_decay[0] == kDalitz || d0_decay[0] == k2Pip2Pim ||
1188 d0bar_decay[0] == k2Pip2Pim || d0_decay[0] == kPipPim2Pi0 ||
1189 d0bar_decay[0] == kPipPim2Pi0 || d0_decay[0] == kK0PiPiPi0 ||
1190 d0bar_decay[0] == kK0PiPiPi0 || d0bar_decay[0] == kPipPimPi0 ||
1191 d0_decay[0] == kKKPiPi || d0bar_decay[0] == kKKPiPi || d0_decay[0] == kK0KK ||
1192 d0bar_decay[0] == kK0KK || d0bar_decay[0] == kFlavoredCF_3 ||
1193 d0bar_decay[0] == kFlavoredCFBar_3 || d0_decay[0] == kPipPimPi0 )
1194 {
1195 double r2prod = r2D0 * r2D0bar;
1196 double x = m_x;
1197 double y = m_y;
1198
1199 // double bD0 = 1. + sqrt( r2D0 ) * ( cos( deltaD0 ) * y + sin( deltaD0 ) * x ) ;
1200 // double rwsD0 = ( r2D0 + sqrt( r2D0 ) * ( cos( deltaD0 ) * y - sin( deltaD0 ) * x ) ) /
1201 // bD0 ; double bD0bar = 1. + sqrt( r2D0bar ) * ( cos( deltaD0bar ) * y + sin( deltaD0bar )
1202 // * x ) ; double rwsD0bar = ( r2D0bar + sqrt( r2D0bar ) * ( cos( deltaD0bar ) * y - sin(
1203 // deltaD0bar ) * x ) ) / bD0bar ;
1204
1205 // weight = 1. + r2prod - 2. * sqrt( r2prod ) * cos( deltaD0 + deltaD0bar ) ;
1206 // weight /= ( 1. + rwsD0 * rwsD0bar ) * bD0 * bD0bar ;
1207 double bD0 = 1. - ( 2 * FCP - 1. ) * RD0 * sqrt( r2D0 ) *
1208 ( cos( deltaD0 ) * y + sin( deltaD0 ) * x );
1209 double rwsD0 = ( r2D0 - ( 2 * FCP - 1. ) * RD0 * sqrt( r2D0 ) *
1210 ( cos( deltaD0 ) * y - sin( deltaD0 ) * x ) ) /
1211 bD0;
1212 double bD0bar = 1. - ( 2 * FCPbar - 1. ) * RD0bar * sqrt( r2D0bar ) *
1213 ( cos( deltaD0bar ) * y + sin( deltaD0bar ) * x );
1214 double rwsD0bar = ( r2D0bar - ( 2 * FCPbar - 1. ) * RD0bar * sqrt( r2D0bar ) *
1215 ( cos( deltaD0bar ) * y - sin( deltaD0bar ) * x ) ) /
1216 bD0bar;
1217
1218 log << MSG::INFO << "bD0 == " << bD0 << endmsg;
1219 log << MSG::INFO << "bD0bar == " << bD0bar << endmsg;
1220 log << MSG::INFO << "rwsD0 == " << rwsD0 << endmsg;
1221 log << MSG::INFO << "rwsD0bar == " << rwsD0bar << endmsg;
1222 weight = 1. + r2prod -
1223 2. * RD0 * ( 2 * FCP - 1. ) * ( 2 * FCPbar - 1. ) * sqrt( r2prod ) *
1224 cos( deltaD0 + deltaD0bar );
1225 log << MSG::INFO << "weight == " << weight << endmsg;
1226 weight /= ( 1. + rwsD0 * rwsD0bar ) * bD0 * bD0bar;
1227 log << MSG::INFO << "weight == " << weight << endmsg;
1228 weight /= m_largestWeight;
1229 log << MSG::INFO << "weight == " << weight << endmsg;
1230
1231 // get dalitz graph information before cut
1232 int k = -10;
1233 double m2i = 0;
1234 double m2j = 0;
1235 double m2k = 0;
1236 if ( d0_decay[0] == kDalitz )
1237 {
1238 k = d0bar_decay[0];
1239 m2i = d0_decay[4];
1240 m2j = d0_decay[5];
1241 m2k = d0_decay[7];
1242 }
1243 if ( d0bar_decay[0] == kDalitz )
1244 {
1245 k = d0_decay[0];
1246 m2i = d0bar_decay[4];
1247 m2j = d0bar_decay[5];
1248 m2k = d0bar_decay[7];
1249 }
1250 }
1251 else { weight = m_weights[d0_decay[0]][d0bar_decay[0]]; }
1252
1253 double random = RandFlat::shoot();
1254 log << MSG::DEBUG << "type: " << d0_decay[0] << " " << d0bar_decay[0] << ", weight "
1255 << weight << " <? random " << random << endmsg;
1256
1257 if ( ( random < weight && !m_invertSelection ) || ( random > weight && m_invertSelection ) )
1258 {
1259 // -------- Write to root file
1260 QC_status = 1;
1261 eventHeader->setEventTag( QC_status );
1262
1263 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1264 // eventHeader->setEventTag(1);
1265 // setFilterPassed(true);
1266
1267 // get dalitz graph information after filter
1268 /*int k = -10;
1269 double m2i= 0;
1270 double m2j= 0;
1271 double m2k= 0;
1272 double cosd = cos( deltaD0 ) ;
1273 double sind = sin( deltaD0 ) ;
1274 if( d0_decay[0] == kDalitz) {
1275 k = d0bar_decay[0];
1276 m2i= d0_decay[4];
1277 m2j= d0_decay[5];
1278 m2k= d0_decay[7];
1279 if ( m2j - m2i > 0. ) { //avoids doublecounting the branching fraction
1280 dalitzNumer1_fil += -2. * sqrt( r2D0 ) * cosd ;
1281 dalitzNumer2_fil += 2. * r2D0 * cosd * sind * m_x ;
1282 dalitzDenom_fil += -2. * r2D0 * cosd * cosd ; }
1283 }
1284 if( d0bar_decay[0] == kDalitz) {
1285 k = d0_decay[0];
1286 m2i= d0bar_decay[4];
1287 m2j= d0bar_decay[5];
1288 m2k= d0bar_decay[7];
1289 cosd = cos( deltaD0bar ) ;
1290 sind = sin( deltaD0bar ) ;
1291 if( m2j - m2i < 0. ) { //avoids doublecounting the branching fraction
1292 dalitzNumer1_fil += -2. * sqrt( r2D0bar ) * cosd ;
1293 dalitzNumer2_fil += 2. * r2D0bar * cosd * sind * m_x ;
1294 dalitzDenom_fil += -2. * r2D0bar * cosd * cosd ; }
1295 }
1296
1297 m_keptModeCounter[d0mode][d0barmode]++;*/
1298 return StatusCode::SUCCESS; // event kept
1299 }
1300 else
1301 {
1302 QC_status = 0;
1303 eventHeader->setEventTag( QC_status );
1304
1305 log << MSG::INFO << "QC_status " << QC_status << endmsg;
1306 // eventHeader->setEventTag(0);
1307 log << MSG::DEBUG << "Discarding event -- failed reweighting." << endmsg;
1308
1310 return StatusCode::SUCCESS; // event discarded
1311 }
1312}
1313
1314//*********************************************************************
1316 MsgStream log( msgSvc(), name() );
1317 log << MSG::INFO << "in finalize()" << endmsg;
1318 log << MSG::INFO << "Number of unknown events: " << m_nUnknownEvents << endmsg;
1319 log << MSG::INFO << "Number of D+D- events seen: " << m_nDpDmEvents << endmsg;
1320 log << MSG::INFO << "Number of D+D- events discarded: " << m_nDpDmDiscarded << endmsg;
1321 if ( m_nDpDmEvents > 0 )
1322 {
1323 log << MSG::INFO
1324 << "Fraction discarded: " << double( m_nDpDmDiscarded ) / double( m_nDpDmEvents )
1325 << endmsg;
1326 }
1327
1328 log << MSG::INFO << "Number of D0D0bar events seen: " << m_nD0D0barEvents << " " << m_nD0bar
1329 << endmsg;
1330 log << MSG::INFO << "Number of D0D0bar events discarded: " << m_nD0D0barDiscarded << endmsg;
1331 /*if( m_nD0D0barEvents > 0 && m_nCPPlus > 0 && m_nCPMinus > 0)
1332 {
1333 log << MSG::INFO << "Fraction discarded: " << double( m_nD0D0barDiscarded ) / double(
1334m_nD0D0barEvents ) << endl << "Fraction unknown decays: " << 0.5 * double( m_nUnknownDecays
1335) / double( m_nD0D0barEvents ) <<endmsg ;
1336
1337 double nD0 = 2. * m_nD0D0barEvents ;
1338 double brSL = m_nSL / nD0 ;
1339 double dBrSL = sqrt( brSL * ( 1. - brSL ) / nD0 ) ;
1340 double brCF_0 = m_nFlavoredCFD0_0 / nD0 ;
1341 double dBrCF_0 = sqrt( brCF_0 * ( 1. - brCF_0 ) / nD0 ) ;
1342 double brCF_1 = m_nFlavoredCFD0_1 / nD0 ;
1343 double dBrCF_1 = sqrt( brCF_1 * ( 1. - brCF_1 ) / nD0 ) ;
1344 double brCF_3 = m_nFlavoredCFD0_3 / nD0 ;
1345 double dBrCF_3 = sqrt( brCF_3 * ( 1. - brCF_3 ) / nD0 ) ;
1346 double brCS = m_nFlavoredCSD0 / nD0 ;
1347 double dBrCS = sqrt( brCS * ( 1. - brCS ) / nD0 ) ;
1348 double brDCS_0 = m_nFlavoredDCSD0_0 / nD0 ;
1349 double dBrDCS_0 = sqrt( brDCS_0 * ( 1. - brDCS_0 ) / nD0 ) ;
1350 double brDCS_1 = m_nFlavoredDCSD0_1 / nD0 ;
1351 double dBrDCS_1 = sqrt( brDCS_1 * ( 1. - brDCS_1 ) / nD0 ) ;
1352 double brDCS_3 = m_nFlavoredDCSD0_3 / nD0 ;
1353 double dBrDCS_3 = sqrt( brDCS_3 * ( 1. - brDCS_3 ) / nD0 ) ;
1354 double brCPPlus = m_nCPPlus / nD0 ;
1355 double dBrCPPlus = sqrt( brCPPlus * ( 1. - brCPPlus ) / nD0 ) ;
1356 double brCPMinus = m_nCPMinus / nD0 ;
1357 double dBrCPMinus = sqrt( brCPMinus * ( 1. - brCPMinus ) / nD0 ) ;
1358 double brDalitz = m_nDalitz / nD0 ;
1359 double dBrDalitz = sqrt( brDalitz * ( 1. - brDalitz ) / nD0 ) ;
1360 double fdBrDalitz = dBrDalitz / brDalitz ;
1361 double dalitzNumer1Norm = m_dalitzNumer1 / nD0 ;
1362 double dDalitzNumer1Norm = dalitzNumer1Norm * fdBrDalitz ;
1363 double dalitzNumer2Norm = m_dalitzNumer2 / nD0 ;
1364 double dDalitzNumer2Norm = dalitzNumer2Norm * fdBrDalitz ;
1365 double dalitzDenomNorm = m_dalitzDenom / nD0 ;
1366 double dDalitzDenomNorm = dalitzDenomNorm * fdBrDalitz ;
1367
1368 double br2Pip2Pim = m_n2Pip2Pim / nD0 ;
1369 double dBr2Pip2Pim = sqrt( br2Pip2Pim * ( 1. - br2Pip2Pim ) / nD0 ) ;
1370 double fdBr2Pip2Pim= dBr2Pip2Pim / br2Pip2Pim ;
1371 double Pip2Pim2Numer1Norm = m_2Pip2PimNumer1 / nD0 ;
1372 double d2Pip2PimNumer1Norm = Pip2Pim2Numer1Norm * fdBr2Pip2Pim ;
1373 double Pip2Pim2Numer2Norm = m_2Pip2PimNumer2 / nD0 ;
1374 double d2Pip2PimNumer2Norm = Pip2Pim2Numer2Norm * fdBr2Pip2Pim ;
1375 double Pip2Pim2DenomNorm = m_2Pip2PimDenom / nD0 ;
1376 double d2Pip2PimDenomNorm = Pip2Pim2DenomNorm * fdBr2Pip2Pim ;
1377
1378 double brPipPim2Pi0 = m_nPipPim2Pi0 / nD0 ;
1379 double dBrPipPim2Pi0 = sqrt( brPipPim2Pi0 * ( 1. - brPipPim2Pi0 ) / nD0 ) ;
1380 double fdBrPipPim2Pi0= dBrPipPim2Pi0 / brPipPim2Pi0 ;
1381 double Pip2Pim2Numer1Norm = m_PipPim2Pi0Numer1 / nD0 ;
1382 double dPipPim2Pi0Numer1Norm = Pip2Pim2Numer1Norm * fdBrPipPim2Pi0 ;
1383 double Pip2Pim2Numer2Norm = m_PipPim2Pi0Numer2 / nD0 ;
1384 double dPipPim2Pi0Numer2Norm = Pip2Pim2Numer2Norm * fdBrPipPim2Pi0 ;
1385 double Pip2Pim2DenomNorm = m_PipPim2Pi0Denom / nD0 ;
1386 double dPipPim2Pi0DenomNorm = Pip2Pim2DenomNorm * fdBrPipPim2Pi0 ;
1387
1388 double brKSPiPiPi0 = m_nKSPiPiPi0 / nD0 ;
1389 double dBrKSPiPiPi0 = sqrt( brKSPiPiPi0 * ( 1. - brKSPiPiPi0 ) / nD0 ) ;
1390 double fdBrKSPiPiPi0= dBrKSPiPiPi0 / brKSPiPiPi0 ;
1391 double Pip2Pim2Numer1Norm = m_KSPiPiPi0Numer1 / nD0 ;
1392 double dKSPiPiPi0Numer1Norm = Pip2Pim2Numer1Norm * fdBrKSPiPiPi0 ;
1393 double Pip2Pim2Numer2Norm = m_KSPiPiPi0Numer2 / nD0 ;
1394 double dKSPiPiPi0Numer2Norm = Pip2Pim2Numer2Norm * fdBrKSPiPiPi0 ;
1395 double Pip2Pim2DenomNorm = m_KSPiPiPi0Denom / nD0 ;
1396 double dKSPiPiPi0DenomNorm = Pip2Pim2DenomNorm * fdBrKSPiPiPi0 ;
1397
1398 //after the filter was applied
1399 double fil_SL = 0, fil_FlavoredCFD0_0 = 0, fil_FlavoredCFD0_1 = 0, fil_FlavoredCFD0_3 = 0,
1400fil_FlavoredCSD0 = 0, fil_FlavoredDCSD0_0 =0, fil_FlavoredDCSD0_1 =0, fil_FlavoredDCSD0_3 =0,
1401fil_CPPlus = 0, fil_CPMinus = 0, fil_Dalitz = 0, fil_2Pip2Pim = 0; for( int i = 0 ; i < 14 ;
1402++i )
1403 {
1404 fil_SL += m_keptModeCounter[i][9] + m_keptModeCounter[9][i] + m_keptModeCounter[i][8] +
1405m_keptModeCounter[8][i] ; fil_FlavoredCFD0_0 += m_keptModeCounter[i][1] +
1406m_keptModeCounter[0][i]; fil_FlavoredCFD0_1 += m_keptModeCounter[i][3] +
1407m_keptModeCounter[2][i]; fil_FlavoredCFD0_3 += m_keptModeCounter[i][5] +
1408m_keptModeCounter[4][i]; fil_FlavoredCSD0 += m_keptModeCounter[i][7] + m_keptModeCounter[7][i]
1409+ m_keptModeCounter[i][6] + m_keptModeCounter[6][i]; fil_FlavoredDCSD0_0 +=
1410m_keptModeCounter[i][0] + m_keptModeCounter[1][i]; fil_FlavoredDCSD0_1 +=
1411m_keptModeCounter[i][2] + m_keptModeCounter[3][i]; fil_FlavoredDCSD0_3 +=
1412m_keptModeCounter[i][4] + m_keptModeCounter[5][i]; fil_CPPlus += m_keptModeCounter[i][10] +
1413m_keptModeCounter[10][i]; fil_CPMinus += m_keptModeCounter[i][11] + m_keptModeCounter[11][i];
1414 fil_Dalitz += m_keptModeCounter[i][12] + m_keptModeCounter[12][i];
1415 fil_2Pip2Pim += m_keptModeCounter[i][13] + m_keptModeCounter[13][i];
1416 fil_PipPim2Pi0 += m_keptModeCounter[i][14] + m_keptModeCounter[14][i];
1417 fil_KSPiPiPi0 += m_keptModeCounter[i][15] + m_keptModeCounter[15][i];
1418}
1419double nD0_fil = 2. * ( m_nD0D0barEvents - m_nD0D0barDiscarded ) ;
1420double brSL_fil = fil_SL / nD0_fil ;
1421double dBrSL_fil = sqrt( brSL_fil * ( 1. - brSL_fil ) / nD0_fil ) ;
1422double brCF_0_fil = fil_FlavoredCFD0_0 / nD0_fil ;
1423double dBrCF_0_fil = sqrt( brCF_0_fil * ( 1. - brCF_0_fil ) / nD0_fil ) ;
1424double brCF_1_fil = fil_FlavoredCFD0_1 / nD0_fil ;
1425double dBrCF_1_fil = sqrt( brCF_1_fil * ( 1. - brCF_1_fil ) / nD0_fil ) ;
1426double brCF_3_fil = fil_FlavoredCFD0_3 / nD0_fil ;
1427double dBrCF_3_fil = sqrt( brCF_3_fil * ( 1. - brCF_3_fil ) / nD0_fil ) ;
1428double brCS_fil = fil_FlavoredCSD0 / nD0_fil ;
1429double dBrCS_fil = sqrt( brCS_fil * ( 1. - brCS_fil ) / nD0_fil ) ;
1430double brDCS_0_fil = fil_FlavoredDCSD0_0 / nD0_fil ;
1431double brDCS_1_fil = fil_FlavoredDCSD0_1 / nD0_fil ;
1432double brDCS_3_fil = fil_FlavoredDCSD0_3 / nD0_fil ;
1433double dBrDCS_0_fil = sqrt( brDCS_0_fil * ( 1. - brDCS_0_fil ) / nD0_fil ) ;
1434double dBrDCS_1_fil = sqrt( brDCS_1_fil * ( 1. - brDCS_1_fil ) / nD0_fil ) ;
1435double dBrDCS_3_fil = sqrt( brDCS_3_fil * ( 1. - brDCS_3_fil ) / nD0_fil ) ;
1436double brCPPlus_fil = fil_CPPlus / nD0_fil ;
1437double dBrCPPlus_fil = sqrt( brCPPlus_fil * ( 1. - brCPPlus_fil ) / nD0_fil ) ;
1438double brCPMinus_fil = fil_CPMinus / nD0_fil ;
1439double dBrCPMinus_fil = sqrt( brCPMinus_fil * ( 1. - brCPMinus_fil ) / nD0_fil ) ;
1440double brDalitz_fil = fil_Dalitz / nD0_fil ;
1441double dBrDalitz_fil = sqrt( brDalitz_fil * ( 1. - brDalitz_fil ) / nD0_fil ) ;
1442double fdBrDalitz_fil = dBrDalitz_fil / brDalitz_fil ;
1443double dalitzNumer1Norm_fil = dalitzNumer1_fil / nD0_fil ;
1444double dDalitzNumer1Norm_fil = dalitzNumer1Norm_fil * fdBrDalitz_fil ;
1445double dalitzNumer2Norm_fil = dalitzNumer2_fil / nD0_fil ;
1446double dDalitzNumer2Norm_fil = dalitzNumer2Norm_fil * fdBrDalitz_fil ;
1447double dalitzDenomNorm_fil = dalitzDenom_fil / nD0_fil ;
1448double dDalitzDenomNorm_fil = dalitzDenomNorm_fil * fdBrDalitz_fil ;
1449
1450double br2Pip2Pim_fil = fil_2Pip2Pim / nD0_fil ;
1451double dBr2Pip2Pim_fil = sqrt( br2Pip2Pim_fil * ( 1. - br2Pip2Pim_fil ) / nD0_fil ) ;
1452double fdBr2Pip2Pim_fil = dBr2Pip2Pim_fil / br2Pip2Pim_fil ;
1453double Pip2Pim2Numer1Norm_fil = Pip2Pim2Numer1_fil / nD0_fil ;
1454double d2Pip2PimNumer1Norm_fil = Pip2Pim2Numer1Norm_fil * fdBr2Pip2Pim_fil ;
1455double Pip2Pim2Numer2Norm_fil = Pip2Pim2Numer2_fil / nD0_fil ;
1456double d2Pip2PimNumer2Norm_fil = Pip2Pim2Numer2Norm_fil * fdBr2Pip2Pim_fil ;
1457double Pip2Pim2DenomNorm_fil = Pip2Pim2Denom_fil / nD0_fil ;
1458double d2Pip2PimDenomNorm_fil = Pip2Pim2DenomNorm_fil * fdBr2Pip2Pim_fil ;
1459
1460log << MSG::INFO <<
1461"Original number of SL decays: " << m_nSL <<" ==> Br(SL) = " << brSL << " +- " << dBrSL <<
1462endl << "Filtered number of SL decays: " << fil_SL <<" ==> Br(SL) = " << brSL_fil << " +- " <<
1463dBrSL_fil << endl << "Original number of D0->CF/CS/DCS or D0bar->CFbar/CSBar/DCSbar: "
1464<<m_nFlavoredCFD0_0 << "/" << m_nFlavoredCSD0 << "/" << m_nFlavoredDCSD0_0 << endl << " ==>
1465Br(CF) = " << brCF_0 << " +- " << dBrCF_0 << endl << "Original number of D0->CF1/DCS1 or
1466D0bar->CFbar3/DCSbar3: " <<m_nFlavoredCFD0_1 << "/" << m_nFlavoredDCSD0_1 << endl << " ==>
1467Br(CF) = " << brCF_1 << " +- " << dBrCF_1 << endl << "Original number of D0->CF1/DCS1 or
1468D0bar->CFbar3/DCSbar3: " <<m_nFlavoredCFD0_3 << "/" << m_nFlavoredDCSD0_3 << endl << " ==>
1469Br(CF) = " << brCF_3 << " +- " << dBrCF_3 << endl << " ==> Br(CS) = " << brCS << " +- " <<
1470dBrCS << endl << " ==> Br(DCS) = " << brDCS_0 << " +- " << dBrDCS_0 << endl << "Filtered
1471number of D0->CF/CS/DCS or D0bar->CFbar/CSBar/DCSbar: " <<fil_FlavoredCFD0_0 << "/" <<
1472fil_FlavoredCSD0 << "/" << fil_FlavoredDCSD0_0 << endl << " ==> Br(DCS) = " << brDCS_1 << " +-
1473" << dBrDCS_1 << endl << "Filtered number of D0->CF1/DCS1 or D0bar->CFbar3/DCSbar3: "
1474<<fil_FlavoredCFD0_1 << "/" << fil_FlavoredDCSD0_1 << endl << " ==> Br(DCS) = " << brDCS_3 <<
1475" +- " << dBrDCS_3 << endl << "Filtered number of D0->CF1/DCS1 or D0bar->CFbar3/DCSbar3: "
1476<<fil_FlavoredCFD0_3 << "/" << fil_FlavoredDCSD0_3 << endl << " ==> Br(CF) = " << brCF_0_fil
1477<< " +- " << dBrCF_0_fil << endl << " ==> Br(CF) = " << brCF_1_fil << " +- " << dBrCF_1_fil <<
1478endl << " ==> Br(CF) = " << brCF_3_fil << " +- " << dBrCF_3_fil << endl << " ==> Br(CS) = "
1479<< brCS_fil << " +- " << dBrCS_fil << endl << " ==> Br(DCS) = " << brDCS_0_fil << " +- " <<
1480dBrDCS_0_fil << endl << " ==> Br(DCS) = " << brDCS_1_fil << " +- " << dBrDCS_1_fil << endl <<
1481" ==> Br(DCS) = " << brDCS_3_fil << " +- " << dBrDCS_3_fil << endl <<
1482
1483"Original number of CP+/-: " << m_nCPPlus << "/" << m_nCPMinus <<endl <<
1484" ==> Br(CP+) = " << brCPPlus << " +- " << dBrCPPlus <<endl <<
1485" ==> Br(CP-) = " << brCPMinus << " +- " << dBrCPMinus << endl <<
1486"Filtered number of CP+/-: " << fil_CPPlus << "/" << fil_CPMinus <<endl <<
1487" ==> Br(CP+) = " << brCPPlus_fil << " +- " << dBrCPPlus_fil <<endl <<
1488" ==> Br(CP-) = " << brCPMinus_fil << " +- " << dBrCPMinus_fil << endl <<
1489
1490"Original number of Dalitz: " << m_nDalitz << endl <<
1491" ==> Br(Dalitz) = " << brDalitz << " +- " << dBrDalitz <<endl <<
1492" y contrib. numer1 " << dalitzNumer1Norm << " +- " << dDalitzNumer1Norm << endl <<
1493" numer2 " << dalitzNumer2Norm << " +- " << dDalitzNumer2Norm << endl <<
1494" denom " << dalitzDenomNorm << " +- " << dDalitzDenomNorm << endmsg <<
1495"Filtered number of Dalitz: " << fil_Dalitz << endl <<
1496" ==> Br(Dalitz) = " << brDalitz_fil << " +- " << dBrDalitz_fil <<endl <<
1497" y contrib. numer1 " << dalitzNumer1Norm_fil << " +- " << dDalitzNumer1Norm_fil << endl <<
1498" numer2 " << dalitzNumer2Norm_fil << " +- " << dDalitzNumer2Norm_fil << endl <<
1499" denom " << dalitzDenomNorm_fil << " +- " << dDalitzDenomNorm_fil << endmsg <<
1500
1501"Original number of 2Pip2Pim: " << m_n2Pip2Pim << endl <<
1502" ==> Br(2Pip2Pim) = " << br2Pip2Pim << " +- " << dBr2Pip2Pim <<endl <<
1503" y contrib. numer1 " << Pip2Pim2Numer1Norm << " +- " << d2Pip2PimNumer1Norm << endl <<
1504" numer2 " << Pip2Pim2Numer2Norm << " +- " << d2Pip2PimNumer2Norm << endl <<
1505" denom " << Pip2Pim2DenomNorm << " +- " << d2Pip2PimDenomNorm << endmsg <<
1506"Filtered number of 2Pip2Pim: " << fil_2Pip2Pim << endl <<
1507" ==> Br(2Pip2Pim) = " << br2Pip2Pim_fil << " +- " << dBr2Pip2Pim_fil <<endl <<
1508" y contrib. numer1 " << Pip2Pim2Numer1Norm_fil << " +- " << d2Pip2PimNumer1Norm_fil << endl
1509<< " numer2 " << Pip2Pim2Numer2Norm_fil << " +- " << d2Pip2PimNumer2Norm_fil << endl << "
1510denom " << Pip2Pim2DenomNorm_fil << " +- " << d2Pip2PimDenomNorm_fil << endmsg ;
1511
1512
1513HepMatrix differencetoWeight(17,17,0);
1514for( int i = 0 ; i < 16 ; ++i ) {
1515 for( int j = 0 ; j < 16 ; ++j ) {
1516 if (m_modeCounter[i][j] != 0) {
1517 differencetoWeight[i][j] = m_keptModeCounter[i][j] / m_modeCounter[i][j] -
1518m_weights[i][j]; } } }
1519
1520 log << MSG::INFO << "Weight matrix" << m_weights << endmsg ;
1521 log << MSG::INFO << "D0 Modes before filter" << m_modeCounter << endmsg ;
1522 log << MSG::INFO << "D0 Modes after filter" << m_keptModeCounter << endmsg ;
1523 log << MSG::INFO << "Compare percentage difference to weights " <<
1524differencetoWeight << endmsg ;
1525
1526 //Calculating and comparing Y before/after the filter
1527 // To calculate y, we want half the CS BF
1528 brCS /= 2. ;
1529 dBrCS /= 2. ;
1530 brCS_fil /= 2 ;
1531 dBrCS_fil /= 2 ;
1532
1533 double y, dy, y_fil, dy_fil ;
1534 double y_cpsl, dy_cpsl, y_fil_cpsl, dy_fil_cpsl ;
1535
1536 //Original MC
1537 double rCF_0 = m_rCF_0 ;
1538 double zCF_0 = m_zCF_0 ;
1539 double rCF2_0 = rCF_0 * rCF_0 ;
1540 double zCF2_0 = zCF_0 * zCF_0 ;
1541 double rCF_1 = m_rCF_1 ;
1542 double zCF_1 = m_zCF_1 ;
1543 double rCF2_1 = rCF_1 * rCF_1 ;
1544 double zCF2_1 = zCF_1 * zCF_1 ;
1545 double rCF_3 = m_rCF_3 ;
1546 double zCF_3 = m_zCF_3 ;
1547 double rCF2_3 = rCF_3 * rCF_3 ;
1548 double zCF2_3 = zCF_3 * zCF_3 ;
1549 double rCS = m_rCS ;
1550 double zCS = m_zCS ;
1551 double rCS2 = rCS * rCS ;
1552 double zCS2 = zCS * zCS ;
1553
1554 double wCF_0 = ( m_wCFSign_0 ? 1. : -1. ) * sqrt( 4. - zCF2_0 ) ;
1555 double wCF_1 = ( m_wCFSign_1 ? 1. : -1. ) * sqrt( 4. - zCF2_1 ) ;
1556 double wCF_3 = ( m_wCFSign_3 ? 1. : -1. ) * sqrt( 4. - zCF2_3 ) ;
1557 double wCS = ( m_wCSSign ? 1. : -1. ) * sqrt( 4. - zCS2 ) ;
1558
1559 double numFactCF_0 =
1560 -rCF_0 * zCF_0 * ( 1. - 0.5 * rCF_0 * wCF_0 * m_x ) ;
1561 double numFactCF_1 =
1562 -rCF_1 * zCF_1 * ( 1. - 0.5 * rCF_1 * wCF_1 * m_x ) ;
1563 double numFactCF_3 =
1564 -rCF_3 * zCF_3 * ( 1. - 0.5 * rCF_3 * wCF_3 * m_x ) ;
1565 double numFactCS =
1566 -rCS * zCS * ( 1. - 0.5 * rCS * wCS * m_x ) ;
1567 double denFactCF_0 = 0.5 * rCF2_0 * zCF2_0 ;
1568 double denFactCF_1 = 0.5 * rCF2_1 * zCF2_1 ;
1569 double denFactCF_3 = 0.5 * rCF2_3 * zCF2_3 ;
1570 double denFactCS = 0.5 * rCS2 * zCS2 ;
1571 double dalitzNumerNorm = dalitzNumer1Norm + dalitzNumer2Norm ;
1572 double Pip2Pim2NumerNorm = Pip2Pim2Numer1Norm + Pip2Pim2Numer2Norm ;
1573
1574 double num =
1575 brCPPlus - brCPMinus + brCF_0 * numFactCF_0 + brCF_1 * numFactCF_1 + brCF_3 *
1576numFactCF_3 + brCS * numFactCS + dalitzNumerNorm + Pip2Pim2NumerNorm; double den =
1577 1. - brCPPlus - brCPMinus - brCF_0 * denFactCF_0 - brCF_1 * denFactCF_1 -
1578brCF_3 * denFactCF_3 - brCS * denFactCS + dalitzDenomNorm + Pip2Pim2DenomNorm; y = num / den ;
1579 dy = sqrt(
1580 ( num + den ) * ( num + den ) * dBrCPPlus * dBrCPPlus +
1581 ( num - den ) * ( num - den ) * dBrCPMinus * dBrCPMinus +
1582 ( numFactCF_0 * den + denFactCF_0 * num ) * dBrCF_0 *
1583 ( numFactCF_0 * den + denFactCF_0 * num ) * dBrCF_0 +
1584 ( numFactCF_1 * den + denFactCF_1 * num ) * dBrCF_1 *
1585 ( numFactCF_1 * den + denFactCF_1 * num ) * dBrCF_1 +
1586 ( numFactCF_3 * den + denFactCF_3 * num ) * dBrCF_3 *
1587 ( numFactCF_3 * den + denFactCF_3 * num ) * dBrCF_3 +
1588 ( numFactCS * den + denFactCS * num ) * dBrCS *
1589 ( numFactCS * den + denFactCS * num ) * dBrCS +
1590 ( dalitzNumerNorm * den + dalitzDenomNorm * num ) *
1591fdBrDalitz * ( dalitzNumerNorm * den + dalitzDenomNorm * num ) * fdBrDalitz + (
1592Pip2Pim2NumerNorm * den + Pip2Pim2DenomNorm * num ) * fdBrDalitz * ( Pip2Pim2NumerNorm * den +
1593Pip2Pim2DenomNorm * num ) * fdBrDalitz ) / ( den * den ) ;
1594
1595 double n_cpplussl = m_modeCounter[6][4] + m_modeCounter[6][5] +
1596m_modeCounter[4][6] + m_modeCounter[5][6] ; double n_cpminussl = m_modeCounter[7][4] +
1597m_modeCounter[7][5] + m_modeCounter[4][7] + m_modeCounter[5][7] ; double a_cpsl = ( n_cpplussl
1598* m_nCPMinus ) / ( n_cpminussl * m_nCPPlus ) ; double b_cpsl = ( n_cpminussl * m_nCPPlus ) /
1599( n_cpplussl * m_nCPMinus ) ; y_cpsl = 0.25 * ( a_cpsl - b_cpsl ) ; dy_cpsl = 0.25 * ( a_cpsl
1600+ b_cpsl ) * sqrt( ( 1/n_cpplussl ) + ( 1/n_cpminussl ) + ( 1/m_nCPPlus ) + ( 1/m_nCPMinus ) )
1601;
1602
1603
1604 //Filtered MC
1605 double dalitzNumerNorm_fil = dalitzNumer1Norm_fil + dalitzNumer2Norm_fil ;
1606 double Pip2Pim2NumerNorm_fil = Pip2Pim2Numer1Norm_fil +
1607Pip2Pim2Numer2Norm_fil ; double num_fil = brCPPlus_fil - brCPMinus_fil + brCF_0_fil *
1608numFactCF_0 + brCF_1_fil * numFactCF_1 + brCF_3_fil * numFactCF_3 + brCS_fil * numFactCS +
1609 dalitzNumerNorm_fil + Pip2Pim2NumerNorm_fil;
1610 double den_fil =
1611 1. - brCPPlus_fil - brCPMinus_fil - brCF_0_fil * denFactCF_0 - brCF_1_fil *
1612denFactCF_1 - brCF_3_fil * denFactCF_3 - brCS_fil * denFactCS + dalitzDenomNorm_fil +
1613Pip2Pim2DenomNorm_fil; y_fil = num_fil / den_fil ; dy_fil = sqrt( ( num_fil + den_fil ) * (
1614num_fil + den_fil ) * dBrCPPlus_fil * dBrCPPlus_fil + ( num_fil - den_fil ) * ( num_fil -
1615den_fil ) * dBrCPMinus_fil * dBrCPMinus_fil + ( numFactCF_0 * den_fil + denFactCF_0 * num_fil )
1616* dBrCF_0_fil * ( numFactCF_0 * den_fil + denFactCF_0 * num_fil ) * dBrCF_0_fil + ( numFactCF_1
1617* den_fil + denFactCF_1 * num_fil ) * dBrCF_1_fil * ( numFactCF_1 * den_fil + denFactCF_1 *
1618num_fil ) * dBrCF_1_fil + ( numFactCF_3 * den_fil + denFactCF_3 * num_fil ) * dBrCF_3_fil * (
1619numFactCF_3 * den_fil + denFactCF_3 * num_fil ) * dBrCF_3_fil + ( numFactCS * den_fil +
1620denFactCS * num_fil ) * dBrCS_fil * ( numFactCS * den_fil + denFactCS * num_fil ) * dBrCS_fil +
1621 ( dalitzNumerNorm_fil * den_fil + dalitzDenomNorm_fil *
1622num_fil ) * fdBrDalitz_fil * ( dalitzNumerNorm_fil * den_fil + dalitzDenomNorm_fil * num_fil )
1623* fdBrDalitz_fil + ( Pip2Pim2NumerNorm_fil * den_fil + Pip2Pim2DenomNorm_fil * num_fil ) *
1624fdBr2Pip2Pim_fil * ( Pip2Pim2NumerNorm_fil * den_fil + Pip2Pim2DenomNorm_fil * num_fil ) *
1625fdBr2Pip2Pim_fil ) / ( den_fil * den_fil ) ;
1626
1627 double fil_cpplussl = m_keptModeCounter[6][4] + m_keptModeCounter[6][5] +
1628m_keptModeCounter[4][6] + m_keptModeCounter[5][6] ; double fil_cpminussl =
1629m_keptModeCounter[7][4] + m_keptModeCounter[7][5] + m_keptModeCounter[4][7] +
1630m_keptModeCounter[5][7] ; a_cpsl = ( fil_cpplussl * fil_CPMinus ) / ( fil_cpminussl *
1631fil_CPPlus ) ; b_cpsl = ( fil_cpminussl * fil_CPPlus ) / ( fil_cpplussl * fil_CPMinus ) ;
1632 y_fil_cpsl = 0.25 * ( a_cpsl - b_cpsl ) ;
1633 dy_fil_cpsl = 0.25 * ( a_cpsl + b_cpsl ) * sqrt( ( 1/n_cpplussl ) + (
16341/n_cpminussl ) + ( 1/fil_CPPlus ) + ( 1/fil_CPMinus ) ) ;
1635
1636
1637
1638 log << MSG::INFO <<"BR Method : Parent MC ==> y = " << y << " +- " << dy
1639<< endmsg ; log << MSG::INFO <<"BR Method : Filtered MC ==> y = " << y_fil << " +- " << dy_fil
1640<< endmsg ; log << MSG::INFO <<"CP-SL doubletag : Parent MC ==> y = " << y_cpsl << " +- " <<
1641dy_cpsl <<endl<<"Previous line should be equivalent with 0 as parent MC not correalated"<<
1642endmsg ; log << MSG::INFO <<"CP-SL doubletag : Filtered MC ==> y = " << y_fil_cpsl << " +- " <<
1643dy_fil_cpsl << endmsg ;
1644
1645 }*/
1646
1647 return StatusCode::SUCCESS;
1648}
1649
1650///////////////////////////////////////////////////////////////////////////////////////////
1651//////////////////////////////////////////////////////////////////////////////////////////
1652vector<double> QCMCFilter::findD0Decay( int charm ) {
1653 MsgStream log( msgSvc(), name() );
1654 log << MSG::INFO << " In findD0Decay " << endmsg;
1655 vector<double> d0_info( 9 );
1656 for ( int i = 0; i < 9; i++ ) d0_info[i] = 0;
1657 double decay_mode = 20; // d0_info[0] = decay mode;
1658 double r2D0 = -1; // d0_info[1] = r2D0;
1659 double deltaD0 = -1; // d0_info[2] = deltaD0;
1660 double RD0 = 1; // d0_info[3] = RD0;
1661 double FCP = 1; // d0_info[4] = FCP;
1662
1663 double num[26];
1664 for ( int i = 0; i < 26; i++ ) num[i] = 0;
1665 // Number of each partile type
1666 int kPiPlus = 0; // num[0] = Pi+, a0+
1667 int kPiMinus = 1; // num[1] = Pi-, a0-
1668 int kPi0 = 2; // num[2] = Pi0
1669 int kEta = 3; // num[3] = Eta
1670 int kEtaPrime = 4; // num[4] = Eta Prime
1671 int kNeutralScalar = 5; // num[5] = Neutral Scalar : f0, f'0, f0(1500), a0, (f_2 can be
1672 // included here because it is only used in f_2 pi0 decay)
1673 int kUFVPlus = 6; // num[6] = unflavored positive (axial) vectors: rho+, a1+, rho(2S)+
1674 int kUFVMinus = 7; // num[7] = unflavored negative (axial) vectors: rho-, a1-, rho(2S)-
1675 int kRho0 = 8; // num[8] = Rho0, Rho(2S)0
1676 int kOmega = 9; // num[9] = Omega
1677 int kPhi = 10; // num[10] = Phi
1678 int kKPlus = 11; // num[11] = K+
1679 int kKMinus = 12; // num[12] = K-
1680 int kK0S = 13; // num[13] = K short
1681 int kK0L = 14; // num[14] = K long
1682 int kFVPlus = 15; // num[15] = flavored positive (axial) vectors: K*+, K_1+, K_2*+
1683 int kFVMinus = 16; // num[16] = flavored negative (axial) vectors: K*-, K_1-, K_2*-
1684 int kKStar0 = 17; // num[17] = K*0
1685 int kKStar0Bar = 18; // num[18] = anti-K*0
1686 int kK10 = 19; // num[19] = K1_0
1687 int kK10Bar = 20; // num[20] = anti-K1_0
1688 int kLeptonPlus = 21; // num[21] = LeptonPlus: e+, mu+
1689 int kLeptonMinus = 22; // num[22] = LeptonMinus: e-, mu-
1690 int kNeutrino = 23; // num[23] = Neutrino: nu, nubar
1691 int kGamma = 24; // num[24] = gamma
1692 int kUnknown = 25; // num[25] = Not identified particle
1693 // int kGammaFSR GammaFSR is ignored as we are interested in the PreFSR quantum #
1694
1695 // Get McParticle collection
1696 SmartDataPtr<Event::McParticleCol> mcParticles( eventSvc(), EventModel::MC::McParticleCol );
1697 int d0_pdg = charm == 1 ? kD0ID : kD0BarID;
1698
1699 HepLorentzVector piPlus, piMinus, k0;
1700 vector<HepLorentzVector> piPlus_4pi, piMinus_4pi, pi0_p4;
1701 vector<HepLorentzVector> kPlus_kkpipi, kMinus_kkpipi;
1702 piPlus_4pi.clear();
1703 piMinus_4pi.clear(), pi0_p4.clear();
1704 kPlus_kkpipi.clear();
1705 kMinus_kkpipi.clear();
1706
1707 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
1708 it++ )
1709 {
1710 int pdg_code = ( *it )->particleProperty();
1711 if ( ( *it )->primaryParticle() ) continue;
1712 Event::McParticle it2 = ( *it )->mother();
1713 int mother_pdg = 0;
1714
1715 // finds if the particle is related to the d0 we need
1716 mother_pdg = it2.particleProperty();
1717
1718 // special cases
1719 if ( pdg_code == kKStar0ID || pdg_code == kKStar0BarID || pdg_code == kK0ID ||
1720 pdg_code == kK0BarID || pdg_code == kKDPStar0ID || pdg_code == kKDPStar0BarID ||
1721 pdg_code == kK10ID || pdg_code == kK10BarID || pdg_code == kK0Star0ID ||
1722 pdg_code == kK0Star0BarID || pdg_code == kK0StarPlusID || pdg_code == kK0BarID )
1723 continue; // don't count special intermediate states
1724
1725 if ( mother_pdg == kK0ID || mother_pdg == kK0BarID )
1726 { // Looks another step up if mother was k0 or k0bar
1727 it2 = it2.mother();
1728 mother_pdg = it2.particleProperty();
1729 }
1730
1731 if ( mother_pdg == kKStar0ID || mother_pdg == kKStar0BarID )
1732 { // Looks another step up if mother was k*0 or k*0bar
1733 // if code is found to be K*0 -> K+Pi- we save it as a KStar0 and K*0Bar -> K-Pi+ as
1734 // KStar0Bar if is it a neutral decay K*0(Bar)->K0(bar) Pi0 or Gamma. We save them as
1735 // K0(bar) and Pi0 or Gamma.
1736 if ( pdg_code == kPiPlusID || pdg_code == kPiMinusID ) continue;
1737 if ( mother_pdg == kKStar0ID && pdg_code == kKPlusID ) pdg_code = kKStar0ID;
1738 if ( mother_pdg == kKStar0BarID && pdg_code == kKMinusID ) pdg_code = kKStar0BarID;
1739 it2 = it2.mother();
1740 mother_pdg = it2.particleProperty();
1741 }
1742
1743 if ( mother_pdg == kK0Star0ID || mother_pdg == kK0Star0BarID )
1744 { // Looks another step up if mother was K_0
1745 it2 = it2.mother();
1746 mother_pdg = it2.particleProperty();
1747 }
1748
1749 if ( mother_pdg == kK10ID || mother_pdg == kK10BarID )
1750 { // Looks another step up if mother was k_10 or k_10bar
1751 it2 = it2.mother();
1752 mother_pdg = it2.particleProperty();
1753 }
1754
1755 // Identifies what particles are the daughters
1756 int nFSR( 0 );
1757 if ( mother_pdg == d0_pdg ) // Found daughter
1758 {
1759 // if(pdg_code == kGammaFSRID)continue;
1760 // if(m_debug)cout<<"pdgid = "<<pdg_code<<endl;
1761 if ( pdg_code == kPiPlusID || pdg_code == kA0PlusID ) num[0]++;
1762 else if ( pdg_code == kPiMinusID || pdg_code == kA0MinusID ) num[1]++;
1763 else if ( pdg_code == kPi0ID ) num[2]++;
1764 else if ( pdg_code == kEtaID ) num[3]++;
1765 else if ( pdg_code == kEtaPrimeID ) num[4]++;
1766 else if ( pdg_code == kF0ID || pdg_code == kA00ID || pdg_code == kFPrime0ID ||
1767 pdg_code == kF0m1500ID || pdg_code == kF2ID || pdg_code == kF0m1710ID ||
1768 pdg_code == kF0600ID )
1769 num[5]++;
1770 else if ( pdg_code == kRhoPlusID || pdg_code == kRho2SPlusID || pdg_code == kA1PlusID )
1771 num[6]++;
1772 else if ( pdg_code == kRhoMinusID || pdg_code == kRho2SMinusID ||
1773 pdg_code == kA1MinusID )
1774 num[7]++;
1775 else if ( pdg_code == kRho0ID || pdg_code == kRho2S0ID ) num[8]++;
1776 else if ( pdg_code == kOmegaID ) num[9]++;
1777 else if ( pdg_code == kPhiID ) num[10]++;
1778 else if ( pdg_code == kKPlusID ) num[11]++;
1779 else if ( pdg_code == kKMinusID ) num[12]++;
1780 else if ( pdg_code == kK0SID ) num[13]++;
1781 else if ( pdg_code == kK0LID ) num[14]++;
1782 else if ( pdg_code == kKStarPlusID || pdg_code == kK1PlusID ||
1783 pdg_code == kK2StarPlusID || pdg_code == kK1PrimePlusID ||
1784 pdg_code == kK0StarPlusID )
1785 num[15]++;
1786 else if ( pdg_code == kKStarMinusID || pdg_code == kK1MinusID ||
1787 pdg_code == kK2StarMinusID || pdg_code == kK1PrimeMinusID ||
1788 pdg_code == kK0StarMinusID )
1789 num[16]++;
1790 else if ( pdg_code == kKStar0ID ) num[17]++;
1791 else if ( pdg_code == kKStar0BarID ) num[18]++;
1792 else if ( pdg_code == kK10ID || pdg_code == kK1Prime0ID ) num[19]++;
1793 else if ( pdg_code == kK10BarID || pdg_code == kK1Prime0BarID ) num[20]++;
1794 else if ( pdg_code == kEPlusID || pdg_code == kMuPlusID ) num[21]++;
1795 else if ( pdg_code == kEMinusID || pdg_code == kMuMinusID ) num[22]++;
1796 else if ( pdg_code == kNuEID || pdg_code == kNuEBarID || pdg_code == kNuMuID ||
1797 pdg_code == kNuMuBarID )
1798 num[23]++;
1799 else if ( pdg_code == kGammaID ) num[24]++;
1800 else if ( pdg_code == kGammaFSRID ) continue;
1801 else
1802 {
1803 num[25]++;
1804 cout << "Unknown particle: " << pdg_code << endl;
1805 }
1806
1807 // if (pdg_code == kA10ID ) num[0]++; // not present
1808
1809 // Enter Momentums for Dalitz canidates
1810 // It would be prefered if we could get PreFSR Momentum
1811 // m_D0daughter_P4.push_back( (*it)->initialFourMomentum().vect() );
1812 // m_D0daughter_PID.push_back( pdg_code );
1813
1814 if ( pdg_code == kPiPlusID )
1815 piPlus.setVectM( ( *it )->initialFourMomentum().vect(), xmpion );
1816 if ( pdg_code == kPiMinusID )
1817 piMinus.setVectM( ( *it )->initialFourMomentum().vect(), xmpion );
1818 if ( pdg_code == kK0SID ) k0.setVectM( ( *it )->initialFourMomentum().vect(), xmk0 );
1819 if ( pdg_code == kK0LID ) k0.setVectM( ( *it )->initialFourMomentum().vect(), xmk0 );
1820 HepLorentzVector daughterP4;
1821 if ( piPlus_4pi.size() > 2 || piMinus_4pi.size() > 2 ) continue;
1822 if ( kPlus_kkpipi.size() > 1 || kMinus_kkpipi.size() > 1 ) continue;
1823 // log << MSG::INFO << "in D0->pipipipi;" << endmsg;
1824 if ( pdg_code == kPiPlusID )
1825 {
1826 daughterP4.setVectM( ( *it )->initialFourMomentum().vect(), xmpion );
1827 piPlus_4pi.push_back( daughterP4 );
1828 }
1829 if ( pdg_code == kPiMinusID )
1830 {
1831 daughterP4.setVectM( ( *it )->initialFourMomentum().vect(), xmpion );
1832 piMinus_4pi.push_back( daughterP4 );
1833 }
1834 if ( pdg_code == kKPlusID )
1835 {
1836 daughterP4.setVectM( ( *it )->initialFourMomentum().vect(), xmkaon );
1837 kPlus_kkpipi.push_back( daughterP4 );
1838 }
1839 if ( pdg_code == kKMinusID )
1840 {
1841 daughterP4.setVectM( ( *it )->initialFourMomentum().vect(), xmkaon );
1842 kMinus_kkpipi.push_back( daughterP4 );
1843 }
1844 if ( pdg_code == kPi0ID )
1845 {
1846 daughterP4.setVectM( ( *it )->initialFourMomentum().vect(), xmpi0 );
1847 pi0_p4.push_back( daughterP4 );
1848 }
1849 }
1850 }
1851
1852 // D decay daughters have been tabulated. Now, classify decay.
1853 int nDaughters = 0;
1854 for ( int i = 0; i < 26; i++ ) { nDaughters += num[i]; }
1855 // if(m_debug)cout<<nDaughters<<num[ kUFVPlus ]<<num[ kPiMinus ]<< nDaughters_RhoPlus<<
1856 // nDaughterPiPlus_RhoPlus << nDaughterPi0_RhoPlus<<endl;
1857 // if(m_debug)cout<<nDaughters<<num[ kUFVMinus ]<<num[ kPiPlus ]<< nDaughters_RhoMinus<<
1858 // nDaughterPiMinus_RhoMinus<< nDaughterPi0_RhoMinus<<endl;
1859 // if(m_debug)cout<<nDaughters<<num[ kRho0 ]<<num[ kPi0 ]<< nDaughters_Rho0 <<
1860 // nDaughterPiPlus_Rho0 << nDaughterPiMinus_Rho0<<endl;
1861 // if(m_debug)cout<<nDaughters<< nDaughters_F0600 << nDaughterPiPlus_F0600
1862 // << nDaughterPiMinus_F0600<<endl; if(m_debug)cout<<nDaughters<< nDaughters_F0
1863 // << nDaughterPiPlus_F0 << nDaughterPiMinus_F0<<endl;
1864 // if(m_debug)cout<<nDaughters<< nDaughters_FPrime0<< nDaughterPiPlus_FPrime0 <<
1865 // nDaughterPiMinus_FPrime0<<endl; if(m_debug)cout<<nDaughters<< nDaughters_F01500 <<
1866 // nDaughterPiPlus_F01500 << nDaughterPiMinus_F01500<<endl;
1867 // if(m_debug)cout<<nDaughters<< nDaughters_F01710 << nDaughterPiPlus_F01710 <<
1868 // nDaughterPiMinus_F01710<<endl; if(m_debug)cout<<nDaughters<< nDaughters_F2
1869 // << nDaughterPiPlus_F2 << nDaughterPiMinus_F2<<endl;
1870 // if(m_debug)cout<<nDaughters<< nDaughters_Omega << nDaughterPiPlus_Omega
1871 // << nDaughterPiMinus_Omega<<endl;
1872
1873 int nUFP0 = num[kPi0] + num[kEta] + num[kEtaPrime];
1874 int nUFV0 = num[kRho0] + num[kPhi] + num[kOmega] + num[kGamma];
1875 int nFV0 = num[kKStar0] + num[kK10];
1876 int nFV0Bar = num[kKStar0Bar] + num[kK10Bar];
1877 int nStrange = num[kKMinus] + num[kFVMinus] + nFV0Bar;
1878 int nAntiStrange = num[kKPlus] + num[kFVPlus] + nFV0;
1879 int nCPPlusEig =
1880 num[kNeutralScalar] + num[kRho0] + num[kOmega] + num[kPhi] + num[kK0S] + num[kGamma];
1881 int nCPMinusEig = num[kPi0] + num[kEta] + num[kEtaPrime] + num[kK0L];
1882 int nCPEig = nCPPlusEig + nCPMinusEig;
1883 int nChargedPiK = num[kPiPlus] + num[kPiMinus] + num[kKPlus] + num[kKMinus];
1884 int nK0 = num[kK0S] + num[kK0L];
1885
1886 // check Dalitz modes: KsPi+Pi- or KlPi+Pi-
1887 double mnm_gen = 0.;
1888 double mpn_gen = 0.;
1889 double mpm_gen = 0.;
1890 bool isKsPiPi = false;
1891 bool isKsKK = false;
1892 bool isKsPiPiPi0 = false;
1893
1894 // check K3Pi modes:
1895
1896 if ( nK0 == 1 && num[kPiPlus] == 1 && num[kPiMinus] && nDaughters == 3 )
1897 {
1898 decay_mode = kDalitz;
1899 // k0.boost(-0.011, 0, 0);
1900 // piMinus.boost(-0.011, 0, 0);
1901 // piPlus.boost(-0.011, 0, 0);
1902 // mnm_gen = (k0 + piMinus).m2();
1903 // mpn_gen = (k0 + piPlus).m2();
1904 // mpm_gen = (piPlus + piMinus).m2();
1905 if ( num[kK0S] == 1 ) isKsPiPi = true;
1906 }
1907 if ( num[kPiPlus] == 2 && num[kPiMinus] == 2 && nDaughters == 4 ) { decay_mode = k2Pip2Pim; }
1908 if ( num[kPiPlus] == 1 && num[kPiMinus] == 1 && num[kPi0] == 2 && nDaughters == 4 )
1909 { decay_mode = kPipPim2Pi0; }
1910 if ( nK0 == 1 && num[kPiPlus] == 1 && num[kPiMinus] == 1 && num[kPi0] == 1 &&
1911 nDaughters == 4 )
1912 {
1913 decay_mode = kK0PiPiPi0;
1914 if ( num[kK0S] == 1 ) isKsPiPiPi0 = true;
1915 }
1916 if ( num[kPiPlus] == 1 && num[kPiMinus] == 1 && num[kKPlus] == 1 && num[kKMinus] == 1 &&
1917 nDaughters == 4 )
1918 { decay_mode = kKKPiPi; }
1919 if ( num[kKPlus] == 1 && num[kKMinus] == 1 && nK0 == 1 && nDaughters == 3 )
1920 {
1921 decay_mode = kK0KK;
1922 if ( num[kK0S] == 1 ) isKsKK = true;
1923 }
1924
1925 int nDaughters_RhoPlus( 0 );
1926 int nDaughterPiPlus_RhoPlus( 0 );
1927 int nDaughterPi0_RhoPlus( 0 );
1928 int nDaughters_RhoMinus( 0 );
1929 int nDaughterPiMinus_RhoMinus( 0 );
1930 int nDaughterPi0_RhoMinus( 0 );
1931 int nDaughters_Rho0( 0 );
1932 int nDaughterPiPlus_Rho0( 0 );
1933 int nDaughterPiMinus_Rho0( 0 );
1934 int nDaughters_F0600( 0 );
1935 int nDaughterPiPlus_F0600( 0 );
1936 int nDaughterPiMinus_F0600( 0 );
1937 int nDaughters_F0( 0 );
1938 int nDaughterPiPlus_F0( 0 );
1939 int nDaughterPiMinus_F0( 0 );
1940 int nDaughters_FPrime0( 0 );
1941 int nDaughterPiPlus_FPrime0( 0 );
1942 int nDaughterPiMinus_FPrime0( 0 );
1943 int nDaughters_F01500( 0 );
1944 int nDaughterPiPlus_F01500( 0 );
1945 int nDaughterPiMinus_F01500( 0 );
1946 int nDaughters_F01710( 0 );
1947 int nDaughterPiPlus_F01710( 0 );
1948 int nDaughterPiMinus_F01710( 0 );
1949 int nDaughters_F2( 0 );
1950 int nDaughterPiPlus_F2( 0 );
1951 int nDaughterPiMinus_F2( 0 );
1952 int nDaughters_Omega( 0 );
1953 int nDaughterPiPlus_Omega( 0 );
1954 int nDaughterPiMinus_Omega( 0 );
1955
1956 for ( Event::McParticleCol::iterator it = mcParticles->begin(); it != mcParticles->end();
1957 it++ )
1958 {
1959 int pdg_code = ( *it )->particleProperty();
1960 if ( ( *it )->primaryParticle() ) continue;
1961 Event::McParticle it2 = ( *it )->mother();
1962 int mother_pdg = 0;
1963
1964 // finds if the particle is related to the d0 we need
1965 mother_pdg = it2.particleProperty();
1966 if ( mother_pdg == kRhoPlusID )
1967 {
1968 Event::McParticle it3 = it2.mother();
1969 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
1970 {
1971 nDaughters_RhoPlus++;
1972 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_RhoPlus++;
1973 if ( pdg_code == kPi0ID ) nDaughterPi0_RhoPlus++;
1974 }
1975 }
1976 if ( mother_pdg == kRhoMinusID )
1977 {
1978 Event::McParticle it3 = it2.mother();
1979 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
1980 {
1981 nDaughters_RhoMinus++;
1982 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_RhoMinus++;
1983 if ( pdg_code == kPi0ID ) nDaughterPi0_RhoMinus++;
1984 }
1985 }
1986 if ( mother_pdg == kRho0ID )
1987 {
1988 Event::McParticle it3 = it2.mother();
1989 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
1990 {
1991 nDaughters_Rho0++;
1992 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_Rho0++;
1993 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_Rho0++;
1994 }
1995 }
1996 if ( mother_pdg == kF0600ID )
1997 {
1998 Event::McParticle it3 = it2.mother();
1999 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2000 {
2001 nDaughters_F0600++;
2002 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_F0600++;
2003 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_F0600++;
2004 }
2005 }
2006 if ( mother_pdg == kF0ID )
2007 {
2008 Event::McParticle it3 = it2.mother();
2009 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2010 {
2011 nDaughters_F0++;
2012 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_F0++;
2013 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_F0++;
2014 }
2015 }
2016 if ( mother_pdg == kFPrime0ID )
2017 {
2018 Event::McParticle it3 = it2.mother();
2019 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2020 {
2021 nDaughters_FPrime0++;
2022 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_FPrime0++;
2023 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_FPrime0++;
2024 }
2025 }
2026 if ( mother_pdg == kF0m1500ID )
2027 {
2028 Event::McParticle it3 = it2.mother();
2029 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2030 {
2031 nDaughters_F01500++;
2032 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_F01500++;
2033 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_F01500++;
2034 }
2035 }
2036 if ( mother_pdg == kF0m1710ID )
2037 {
2038 Event::McParticle it3 = it2.mother();
2039 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2040 {
2041 nDaughters_F01710++;
2042 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_F01710++;
2043 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_F01710++;
2044 }
2045 }
2046 if ( mother_pdg == kF2ID )
2047 {
2048 Event::McParticle it3 = it2.mother();
2049 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2050 {
2051 nDaughters_F2++;
2052 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_F2++;
2053 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_F2++;
2054 }
2055 }
2056 if ( mother_pdg == kOmegaID )
2057 {
2058 Event::McParticle it3 = it2.mother();
2059 if ( it3.particleProperty() == d0_pdg && pdg_code != -22 )
2060 {
2061 nDaughters_Omega++;
2062 if ( pdg_code == kPiPlusID ) nDaughterPiPlus_Omega++;
2063 if ( pdg_code == kPiMinusID ) nDaughterPiMinus_Omega++;
2064 }
2065 }
2066 }
2067
2068 // The order of if-statements below matters.
2069 if ( decay_mode == kDalitz )
2070 {
2071 ++m_nDalitz;
2072
2073 // Dalitz t(8) ;
2074 // TComplex D0, D0bar;
2075 // if (m_dalitzModel == 0) { //Cleo model
2076 // D0 = t.CLEO_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2077 // D0bar = t.CLEO_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2078 // if (m_dalitzModel == 1) { //Babar model
2079 // D0 = t.Babar_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2080 // D0bar = t.Babar_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2081 // if (m_dalitzModel == 2) { //Belle model
2082 // D0 = t.Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2083 // D0bar = t.Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2084
2085 complex<double> D0, D0bar;
2086 vector<double> k0l;
2087 vector<double> pip;
2088 vector<double> pim;
2089 k0l.clear();
2090 pip.clear();
2091 pim.clear();
2092 k0l.push_back( k0[0] );
2093 k0l.push_back( k0[1] );
2094 k0l.push_back( k0[2] );
2095 k0l.push_back( k0[3] );
2096 pip.push_back( piPlus[0] );
2097 pip.push_back( piPlus[1] );
2098 pip.push_back( piPlus[2] );
2099 pip.push_back( piPlus[3] );
2100 pim.push_back( piMinus[0] );
2101 pim.push_back( piMinus[1] );
2102 pim.push_back( piMinus[2] );
2103 pim.push_back( piMinus[3] );
2104
2105 if ( isKsPiPi )
2106 {
2107 // D0ToKSpipi2018 tKSpipi;tKSpipi.init();
2108 D0ToKSpipi tKSpipi;
2109 tKSpipi.init();
2110 D0 = tKSpipi.Amp_PFT( k0l, pip, pim );
2111
2112 vector<double> cpk0l;
2113 vector<double> cppip;
2114 vector<double> cppim;
2115 cpk0l.clear();
2116 pip.clear();
2117 pim.clear();
2118 cpk0l.push_back( -k0l[0] );
2119 cpk0l.push_back( -k0l[1] );
2120 cpk0l.push_back( -k0l[2] );
2121 cpk0l.push_back( k0l[3] );
2122 cppim.push_back( -piPlus[0] );
2123 cppim.push_back( -piPlus[1] );
2124 cppim.push_back( -piPlus[2] );
2125 cppim.push_back( piPlus[3] );
2126 cppip.push_back( -piMinus[0] );
2127 cppip.push_back( -piMinus[1] );
2128 cppip.push_back( -piMinus[2] );
2129 cppip.push_back( piMinus[3] );
2130 D0bar = tKSpipi.Amp_PFT( cpk0l, cppip, cppim );
2131 }
2132 else
2133 {
2134 // D0ToKLpipi2018 tKLpipi;tKLpipi.init();//be aware of the convention in D0ToKLpipi.cxx
2135 // is not the same as used in other analyses
2136 D0ToKLpipi tKLpipi;
2137 tKLpipi.init(); // be aware of the convention in D0ToKLpipi.cxx is not the same as used
2138 // in other analyses
2139 D0 = tKLpipi.Amp_PFT( k0l, pip, pim );
2140 vector<double> cpk0l;
2141 vector<double> cppip;
2142 vector<double> cppim;
2143 cpk0l.clear();
2144 pip.clear();
2145 pim.clear();
2146 cpk0l.push_back( -k0l[0] );
2147 cpk0l.push_back( -k0l[1] );
2148 cpk0l.push_back( -k0l[2] );
2149 cpk0l.push_back( k0l[3] );
2150 cppim.push_back( -piPlus[0] );
2151 cppim.push_back( -piPlus[1] );
2152 cppim.push_back( -piPlus[2] );
2153 cppim.push_back( piPlus[3] );
2154 cppip.push_back( -piMinus[0] );
2155 cppip.push_back( -piMinus[1] );
2156 cppip.push_back( -piMinus[2] );
2157 cppip.push_back( piMinus[3] );
2158 D0bar = tKLpipi.Amp_PFT( cpk0l, cppip, cppim );
2159 }
2160
2161 if ( charm == 1 )
2162 {
2163
2164 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2165 double temp = std::arg( D0 ) - std::arg( D0bar );
2166 log << MSG::INFO << "D0 calculation " << sqrt( r2D0 ) << " " << temp << endmsg;
2167 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2168 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2169 deltaD0 = temp;
2170 deltaD0 = isKsPiPi ? deltaD0 : ( deltaD0 + PI );
2171
2172 double cosd = cos( deltaD0 );
2173 double sind = sin( deltaD0 );
2174 if ( mpn_gen - mnm_gen > 0. )
2175 {
2176 m_dalitzNumer1 += -2. * sqrt( r2D0 ) * cosd;
2177 m_dalitzNumer2 += 2. * r2D0 * cosd * sind * m_x;
2178 m_dalitzDenom += -2. * r2D0 * cosd * cosd;
2179 }
2180 }
2181 else
2182 {
2183 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2184 double temp = std::arg( D0bar ) - std::arg( D0 );
2185 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2186 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2187 deltaD0 = temp;
2188 deltaD0 = isKsPiPi ? deltaD0 : ( deltaD0 + PI );
2189
2190 double cosd = cos( deltaD0 );
2191 double sind = sin( deltaD0 );
2192 if ( mpn_gen - mnm_gen < 0. )
2193 {
2194 m_dalitzNumer1 += -2. * sqrt( r2D0 ) * cosd;
2195 m_dalitzNumer2 += 2. * r2D0 * cosd * sind * m_x;
2196 m_dalitzDenom += -2. * r2D0 * cosd * cosd;
2197 }
2198 }
2199 }
2200 else if ( decay_mode == k2Pip2Pim )
2201 {
2202
2203 ++m_n2Pip2Pim;
2204
2205 HepLorentzVector pip1_4pi = ( piPlus_4pi.at( 0 ) );
2206 HepLorentzVector pim1_4pi = ( piMinus_4pi.at( 0 ) );
2207 HepLorentzVector pip2_4pi = ( piPlus_4pi.at( 1 ) );
2208 HepLorentzVector pim2_4pi = ( piMinus_4pi.at( 1 ) );
2209 pip1_4pi.boost( -0.011, 0, 0 );
2210 pip2_4pi.boost( -0.011, 0, 0 );
2211 pim1_4pi.boost( -0.011, 0, 0 );
2212 pim2_4pi.boost( -0.011, 0, 0 );
2213 std::complex<double> D0, D0bar;
2214 // EvtVector4R pip1( pip1_4pi[3],pip1_4pi[0],pip1_4pi[1],pip1_4pi[2]);
2215 // EvtVector4R pip2( pip2_4pi[3],pip2_4pi[0],pip2_4pi[1],pip2_4pi[2]);
2216 // EvtVector4R pim1( pim1_4pi[3],pim1_4pi[0],pim1_4pi[1],pim1_4pi[2]);
2217 // EvtVector4R pim2( pim2_4pi[3],pim2_4pi[0],pim2_4pi[1],pim2_4pi[2]);
2218 std::vector<double> pip1;
2219 pip1.clear();
2220 pip1.push_back( pip1_4pi[0] );
2221 pip1.push_back( pip1_4pi[1] );
2222 pip1.push_back( pip1_4pi[2] );
2223 pip1.push_back( pip1_4pi[3] );
2224 std::vector<double> pim1;
2225 pim1.clear();
2226 pim1.push_back( pim1_4pi[0] );
2227 pim1.push_back( pim1_4pi[1] );
2228 pim1.push_back( pim1_4pi[2] );
2229 pim1.push_back( pim1_4pi[3] );
2230 std::vector<double> pip2;
2231 pip2.clear();
2232 pip2.push_back( pip2_4pi[0] );
2233 pip2.push_back( pip2_4pi[1] );
2234 pip2.push_back( pip2_4pi[2] );
2235 pip2.push_back( pip2_4pi[3] );
2236 std::vector<double> pim2;
2237 pim2.clear();
2238 pim2.push_back( pim2_4pi[0] );
2239 pim2.push_back( pim2_4pi[1] );
2240 pim2.push_back( pim2_4pi[2] );
2241 pim2.push_back( pim2_4pi[3] );
2242
2243 D0To2pip2pim t2pip2pim;
2244 t2pip2pim.init();
2245 D0 = t2pip2pim.Amp( pip1, pim1, pip2, pim2 );
2246 // EvtVector4R cppim1(pip1_4pi[3], -1*pip1_4pi[0], -1*pip1_4pi[1], -1*pip1_4pi[2]);
2247 // EvtVector4R cppip1(pim1_4pi[3], -1*pim1_4pi[0], -1*pim1_4pi[1], -1*pim1_4pi[2]);
2248 // EvtVector4R cppim2(pip2_4pi[3], -1*pip2_4pi[0], -1*pip2_4pi[1], -1*pip2_4pi[2]);
2249 // EvtVector4R cppip2(pim2_4pi[3], -1*pim2_4pi[0], -1*pim2_4pi[1], -1*pim2_4pi[2]);
2250 std::vector<double> cppip1;
2251 cppip1.clear();
2252 cppip1.push_back( -pim1_4pi[0] );
2253 cppip1.push_back( -pim1_4pi[1] );
2254 cppip1.push_back( -pim1_4pi[2] );
2255 cppip1.push_back( pim1_4pi[3] );
2256 std::vector<double> cppim1;
2257 cppim1.clear();
2258 cppim1.push_back( -pip1_4pi[0] );
2259 cppim1.push_back( -pip1_4pi[1] );
2260 cppim1.push_back( -pip1_4pi[2] );
2261 cppim1.push_back( pip1_4pi[3] );
2262 std::vector<double> cppip2;
2263 cppip2.clear();
2264 cppip2.push_back( -pim2_4pi[0] );
2265 cppip2.push_back( -pim2_4pi[1] );
2266 cppip2.push_back( -pim2_4pi[2] );
2267 cppip2.push_back( pim2_4pi[3] );
2268 std::vector<double> cppim2;
2269 cppim2.clear();
2270 cppim2.push_back( -pip2_4pi[0] );
2271 cppim2.push_back( -pip2_4pi[1] );
2272 cppim2.push_back( -pip2_4pi[2] );
2273 cppim2.push_back( pip2_4pi[3] );
2274
2275 D0bar = t2pip2pim.Amp( cppip1, cppim1, cppip2, cppim2 );
2276
2277 if ( charm == 1 )
2278 {
2279
2280 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2281 double temp = std::arg( D0 ) - std::arg( D0bar );
2282 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2283 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2284 deltaD0 = temp;
2285
2286 double cosd = cos( deltaD0 );
2287 double sind = sin( deltaD0 );
2288 // if( mpn_gen - mnm_gen > 0. )
2289 //{
2290 m_2Pip2PimNumer1 += -2. * sqrt( r2D0 ) * cosd;
2291 m_2Pip2PimNumer2 += 2. * r2D0 * cosd * sind * m_x;
2292 m_2Pip2PimDenom += -2. * r2D0 * cosd * cosd;
2293 //}
2294 }
2295 else
2296 {
2297 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2298 double temp = std::arg( D0bar ) - std::arg( D0 );
2299 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2300 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2301 deltaD0 = temp;
2302
2303 double cosd = cos( deltaD0 );
2304 double sind = sin( deltaD0 );
2305 // if( mpn_gen - mnm_gen < 0. )
2306 //{
2307 m_2Pip2PimNumer1 += -2. * sqrt( r2D0 ) * cosd;
2308 m_2Pip2PimNumer2 += 2. * r2D0 * cosd * sind * m_x;
2309 m_2Pip2PimDenom += -2. * r2D0 * cosd * cosd;
2310 //}
2311 }
2312 }
2313 else if ( decay_mode == kPipPim2Pi0 )
2314 {
2315
2316 ++m_nPipPim2Pi0;
2317
2318 HepLorentzVector pip1_4pi = ( piPlus_4pi.at( 0 ) );
2319 HepLorentzVector pim1_4pi = ( piMinus_4pi.at( 0 ) );
2320 HepLorentzVector pi01_p4 = ( pi0_p4.at( 0 ) );
2321 HepLorentzVector pi02_p4 = ( pi0_p4.at( 1 ) );
2322 pip1_4pi.boost( -0.011, 0, 0 );
2323 pim1_4pi.boost( -0.011, 0, 0 );
2324 pi01_p4.boost( -0.011, 0, 0 );
2325 pi02_p4.boost( -0.011, 0, 0 );
2326 std::complex<double> D0, D0bar;
2327 // EvtVector4R pip1( pip1_4pi[3],pip1_4pi[0],pip1_4pi[1],pip1_4pi[2]);
2328 // EvtVector4R pip2( pip2_4pi[3],pip2_4pi[0],pip2_4pi[1],pip2_4pi[2]);
2329 // EvtVector4R pim1( pim1_4pi[3],pim1_4pi[0],pim1_4pi[1],pim1_4pi[2]);
2330 // EvtVector4R pim2( pim2_4pi[3],pim2_4pi[0],pim2_4pi[1],pim2_4pi[2]);
2331 std::vector<double> pip1;
2332 pip1.clear();
2333 pip1.push_back( pip1_4pi[0] );
2334 pip1.push_back( pip1_4pi[1] );
2335 pip1.push_back( pip1_4pi[2] );
2336 pip1.push_back( pip1_4pi[3] );
2337 std::vector<double> pim1;
2338 pim1.clear();
2339 pim1.push_back( pim1_4pi[0] );
2340 pim1.push_back( pim1_4pi[1] );
2341 pim1.push_back( pim1_4pi[2] );
2342 pim1.push_back( pim1_4pi[3] );
2343 std::vector<double> pi01;
2344 pi01.clear();
2345 pi01.push_back( pi01_p4[0] );
2346 pi01.push_back( pi01_p4[1] );
2347 pi01.push_back( pi01_p4[2] );
2348 pi01.push_back( pi01_p4[3] );
2349 std::vector<double> pi02;
2350 pi02.clear();
2351 pi02.push_back( pi02_p4[0] );
2352 pi02.push_back( pi02_p4[1] );
2353 pi02.push_back( pi02_p4[2] );
2354 pi02.push_back( pi02_p4[3] );
2355
2356 D0Topippim2pi0 tpippim2pi0;
2357 tpippim2pi0.init();
2358 D0 = tpippim2pi0.Amp( pip1, pim1, pi01, pi02 );
2359 // EvtVector4R cppim1(pip1_4pi[3], -1*pip1_4pi[0], -1*pip1_4pi[1], -1*pip1_4pi[2]);
2360 // EvtVector4R cppip1(pim1_4pi[3], -1*pim1_4pi[0], -1*pim1_4pi[1], -1*pim1_4pi[2]);
2361 // EvtVector4R cppim2(pip2_4pi[3], -1*pip2_4pi[0], -1*pip2_4pi[1], -1*pip2_4pi[2]);
2362 // EvtVector4R cppip2(pim2_4pi[3], -1*pim2_4pi[0], -1*pim2_4pi[1], -1*pim2_4pi[2]);
2363 std::vector<double> cppip1;
2364 cppip1.clear();
2365 cppip1.push_back( -pim1_4pi[0] );
2366 cppip1.push_back( -pim1_4pi[1] );
2367 cppip1.push_back( -pim1_4pi[2] );
2368 cppip1.push_back( pim1_4pi[3] );
2369 std::vector<double> cppim1;
2370 cppim1.clear();
2371 cppim1.push_back( -pip1_4pi[0] );
2372 cppim1.push_back( -pip1_4pi[1] );
2373 cppim1.push_back( -pip1_4pi[2] );
2374 cppim1.push_back( pip1_4pi[3] );
2375 std::vector<double> cppi01;
2376 cppi01.clear();
2377 cppi01.push_back( -pi01_p4[0] );
2378 cppi01.push_back( -pi01_p4[1] );
2379 cppi01.push_back( -pi01_p4[2] );
2380 cppi01.push_back( pi01_p4[3] );
2381 std::vector<double> cppi02;
2382 cppi02.clear();
2383 cppi02.push_back( -pi02_p4[0] );
2384 cppi02.push_back( -pi02_p4[1] );
2385 cppi02.push_back( -pi02_p4[2] );
2386 cppi02.push_back( pi02_p4[3] );
2387
2388 D0bar = tpippim2pi0.Amp( cppip1, cppim1, cppi01, cppi02 );
2389
2390 if ( charm == 1 )
2391 {
2392
2393 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2394 double temp = std::arg( D0 ) - std::arg( D0bar );
2395 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2396 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2397 deltaD0 = temp;
2398
2399 double cosd = cos( deltaD0 );
2400 double sind = sin( deltaD0 );
2401 // if( mpn_gen - mnm_gen > 0. )
2402 //{
2403 m_PipPim2Pi0Numer1 += -2. * sqrt( r2D0 ) * cosd;
2404 m_PipPim2Pi0Numer2 += 2. * r2D0 * cosd * sind * m_x;
2405 m_PipPim2Pi0Denom += -2. * r2D0 * cosd * cosd;
2406 //}
2407 }
2408 else
2409 {
2410 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2411 double temp = std::arg( D0bar ) - std::arg( D0 );
2412 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2413 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2414 deltaD0 = temp;
2415
2416 double cosd = cos( deltaD0 );
2417 double sind = sin( deltaD0 );
2418
2419 m_PipPim2Pi0Numer1 += -2. * sqrt( r2D0 ) * cosd;
2420 m_PipPim2Pi0Numer2 += 2. * r2D0 * cosd * sind * m_x;
2421 m_PipPim2Pi0Denom += -2. * r2D0 * cosd * cosd;
2422 }
2423 }
2424 else if ( decay_mode == kK0PiPiPi0 )
2425 {
2426 ++m_nK0PiPiPi0;
2427
2428 // Dalitz t(8) ;
2429 // TComplex D0, D0bar;
2430 // if (m_dalitzModel == 0) { //Cleo model
2431 // D0 = t.CLEO_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2432 // D0bar = t.CLEO_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2433 // if (m_dalitzModel == 1) { //Babar model
2434 // D0 = t.Babar_Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2435 // D0bar = t.Babar_Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2436 // if (m_dalitzModel == 2) { //Belle model
2437 // D0 = t.Amplitude( mpn_gen, mnm_gen, mpm_gen ) ;
2438 // D0bar = t.Amplitude( mnm_gen, mpn_gen, mpm_gen ) ;}
2439 HepLorentzVector pip_kspipipi0 = ( piPlus_4pi.at( 0 ) );
2440 HepLorentzVector pim_kspipipi0 = ( piMinus_4pi.at( 0 ) );
2441 HepLorentzVector k0_kspipipi0 = k0;
2442 HepLorentzVector pi0_kspipipi0 = ( pi0_p4.at( 0 ) );
2443 pip_kspipipi0.boost( -0.011, 0, 0 );
2444 pim_kspipipi0.boost( -0.011, 0, 0 );
2445 k0_kspipipi0.boost( -0.011, 0, 0 );
2446 pi0_kspipipi0.boost( -0.011, 0, 0 );
2447
2448 complex<double> D0, D0bar;
2449 vector<double> k0l;
2450 vector<double> pip;
2451 vector<double> pim;
2452 vector<double> pi0;
2453 k0l.clear();
2454 pip.clear();
2455 pim.clear();
2456 pi0.clear();
2457 k0l.push_back( k0_kspipipi0[0] );
2458 k0l.push_back( k0_kspipipi0[1] );
2459 k0l.push_back( k0_kspipipi0[2] );
2460 k0l.push_back( k0_kspipipi0[3] );
2461 pip.push_back( pip_kspipipi0[0] );
2462 pip.push_back( pip_kspipipi0[1] );
2463 pip.push_back( pip_kspipipi0[2] );
2464 pip.push_back( pip_kspipipi0[3] );
2465 pim.push_back( pim_kspipipi0[0] );
2466 pim.push_back( pim_kspipipi0[1] );
2467 pim.push_back( pim_kspipipi0[2] );
2468 pim.push_back( pim_kspipipi0[3] );
2469 pi0.push_back( pi0_kspipipi0[0] );
2470 pi0.push_back( pi0_kspipipi0[1] );
2471 pi0.push_back( pi0_kspipipi0[2] );
2472 pi0.push_back( pi0_kspipipi0[3] );
2473
2474 if ( isKsPiPiPi0 )
2475 {
2476 D0ToKSpipipi0 tKSpipipi0;
2477 tKSpipipi0.init();
2478 D0 = tKSpipipi0.Amp( k0l, pip, pim, pi0 );
2479
2480 vector<double> cpk0l;
2481 vector<double> cppip;
2482 vector<double> cppim;
2483 vector<double> cppi0;
2484 cpk0l.clear();
2485 cppip.clear();
2486 cppim.clear();
2487 cppi0.clear();
2488 cpk0l.push_back( -k0l[0] );
2489 cpk0l.push_back( -k0l[1] );
2490 cpk0l.push_back( -k0l[2] );
2491 cpk0l.push_back( k0l[3] );
2492 cppim.push_back( -pip[0] );
2493 cppim.push_back( -pip[1] );
2494 cppim.push_back( -pip[2] );
2495 cppim.push_back( pip[3] );
2496 cppip.push_back( -pim[0] );
2497 cppip.push_back( -pim[1] );
2498 cppip.push_back( -pim[2] );
2499 cppip.push_back( pim[3] );
2500 cppi0.push_back( -pi0[0] );
2501 cppi0.push_back( -pi0[1] );
2502 cppi0.push_back( -pi0[2] );
2503 cppi0.push_back( pi0[3] );
2504 D0bar = tKSpipipi0.Amp( cpk0l, cppip, cppim, cppi0 );
2505 }
2506 else
2507 {
2508 D0ToKSpipipi0 tKSpipipi0;
2509 tKSpipipi0.init();
2510 D0 = tKSpipipi0.Amp( k0l, pip, pim, pi0 );
2511
2512 vector<double> cpk0l;
2513 vector<double> cppip;
2514 vector<double> cppim;
2515 vector<double> cppi0;
2516 cpk0l.clear();
2517 cppip.clear();
2518 cppim.clear();
2519 cppi0.clear();
2520 cpk0l.push_back( -k0l[0] );
2521 cpk0l.push_back( -k0l[1] );
2522 cpk0l.push_back( -k0l[2] );
2523 cpk0l.push_back( k0l[3] );
2524 cppim.push_back( -pip[0] );
2525 cppim.push_back( -pip[1] );
2526 cppim.push_back( -pip[2] );
2527 cppim.push_back( pip[3] );
2528 cppip.push_back( -pim[0] );
2529 cppip.push_back( -pim[1] );
2530 cppip.push_back( -pim[2] );
2531 cppip.push_back( pim[3] );
2532 cppi0.push_back( -pi0[0] );
2533 cppi0.push_back( -pi0[1] );
2534 cppi0.push_back( -pi0[2] );
2535 cppi0.push_back( pi0[3] );
2536 D0bar = tKSpipipi0.Amp( cpk0l, cppip, cppim, cppi0 );
2537 // D0ToKLpipi tKLpipi;tKLpipi.init();//be aware of the convention in D0ToKLpipi.cxx is
2538 // not the same as used in other analyses D0 = tKLpipi.Amp_PFT(k0l,pip,pim);
2539 // vector<double> cpk0l;vector<double> cppip;vector<double> cppim;
2540 // cpk0l.clear();pip.clear();pim.clear();
2541 // cpk0l.push_back(-k0l[0]);cpk0l.push_back(-k0l[1]);cpk0l.push_back(-k0l[2]);cpk0l.push_back(k0l[3]);
2542 // cppim.push_back(-piPlus[0]);cppim.push_back(-piPlus[1]);cppim.push_back(-piPlus[2]);cppim.push_back(piPlus[3]);
2543 // cppip.push_back(-piMinus[0]);cppip.push_back(-piMinus[1]);cppip.push_back(-piMinus[2]);cppip.push_back(piMinus[3]);
2544 // D0bar = tKLpipi.Amp_PFT(cpk0l, cppip, cppim);
2545 }
2546
2547 if ( charm == 1 )
2548 {
2549
2550 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2551 double temp = std::arg( D0 ) - std::arg( D0bar );
2552 log << MSG::INFO << "D0 calculation " << sqrt( r2D0 ) << " " << temp << endmsg;
2553 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2554 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2555 deltaD0 = temp;
2556 deltaD0 = isKsPiPiPi0 ? ( deltaD0 + PI ) : ( deltaD0 );
2557
2558 double cosd = cos( deltaD0 );
2559 double sind = sin( deltaD0 );
2560 if ( mpn_gen - mnm_gen > 0. )
2561 {
2562 m_KSPiPiPi0Numer1 += -2. * sqrt( r2D0 ) * cosd;
2563 m_KSPiPiPi0Numer2 += 2. * r2D0 * cosd * sind * m_x;
2564 m_KSPiPiPi0Denom += -2. * r2D0 * cosd * cosd;
2565 }
2566 }
2567 else
2568 {
2569 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2570 double temp = std::arg( D0bar ) - std::arg( D0 );
2571 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2572 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2573 deltaD0 = temp;
2574 deltaD0 = isKsPiPiPi0 ? ( deltaD0 + PI ) : ( deltaD0 );
2575
2576 double cosd = cos( deltaD0 );
2577 double sind = sin( deltaD0 );
2578 if ( mpn_gen - mnm_gen < 0. )
2579 {
2580 m_KSPiPiPi0Numer1 += -2. * sqrt( r2D0 ) * cosd;
2581 m_KSPiPiPi0Numer2 += 2. * r2D0 * cosd * sind * m_x;
2582 m_KSPiPiPi0Denom += -2. * r2D0 * cosd * cosd;
2583 }
2584 }
2585 }
2586 else if ( decay_mode == kKKPiPi )
2587 {
2588
2589 ++m_nKKPiPi;
2590
2591 complex<double> D0, D0bar;
2592 vector<double> kp;
2593 vector<double> km;
2594 vector<double> pip;
2595 vector<double> pim;
2596 double pdau[16];
2597 pip.clear();
2598 pim.clear();
2599 kp.clear();
2600 km.clear();
2601
2602 HepLorentzVector pip_kkpipi = ( piPlus_4pi.at( 0 ) );
2603 HepLorentzVector pim_kkpipi = ( piMinus_4pi.at( 0 ) );
2604 HepLorentzVector kp_kkpipi = ( kPlus_kkpipi.at( 0 ) );
2605 HepLorentzVector km_kkpipi = ( kMinus_kkpipi.at( 0 ) );
2606
2607 pip.push_back( pip_kkpipi[0] );
2608 pip.push_back( pip_kkpipi[1] );
2609 pip.push_back( pip_kkpipi[2] );
2610 pip.push_back( pip_kkpipi[3] );
2611 pim.push_back( pim_kkpipi[0] );
2612 pim.push_back( pim_kkpipi[1] );
2613 pim.push_back( pim_kkpipi[2] );
2614 pim.push_back( pim_kkpipi[3] );
2615 kp.push_back( kp_kkpipi[0] );
2616 kp.push_back( kp_kkpipi[1] );
2617 kp.push_back( kp_kkpipi[2] );
2618 kp.push_back( kp_kkpipi[3] );
2619 km.push_back( km_kkpipi[0] );
2620 km.push_back( km_kkpipi[1] );
2621 km.push_back( km_kkpipi[2] );
2622 km.push_back( km_kkpipi[3] );
2623
2624 pdau[0] = kp_kkpipi[0];
2625 pdau[1] = kp_kkpipi[1];
2626 pdau[2] = kp_kkpipi[2];
2627 pdau[3] = kp_kkpipi[3];
2628 pdau[4] = km_kkpipi[0];
2629 pdau[5] = km_kkpipi[1];
2630 pdau[6] = km_kkpipi[2];
2631 pdau[7] = km_kkpipi[3];
2632 pdau[8] = pip_kkpipi[0];
2633 pdau[9] = pip_kkpipi[1];
2634 pdau[10] = pip_kkpipi[2];
2635 pdau[11] = pip_kkpipi[3];
2636 pdau[12] = pim_kkpipi[0];
2637 pdau[13] = pim_kkpipi[1];
2638 pdau[14] = pim_kkpipi[2];
2639 pdau[15] = pim_kkpipi[3];
2640
2641 D0ToKKpipi tKKpipi;
2642 tKKpipi.init();
2643 D0 = tKKpipi.AMP( pdau, 1 );
2644
2645 pdau[0] = -km_kkpipi[0];
2646 pdau[1] = -km_kkpipi[1];
2647 pdau[2] = -km_kkpipi[2];
2648 pdau[3] = km_kkpipi[3];
2649 pdau[4] = -kp_kkpipi[0];
2650 pdau[5] = -kp_kkpipi[1];
2651 pdau[6] = -kp_kkpipi[2];
2652 pdau[7] = kp_kkpipi[3];
2653 pdau[8] = -pim_kkpipi[0];
2654 pdau[9] = -pim_kkpipi[1];
2655 pdau[10] = -pim_kkpipi[2];
2656 pdau[11] = pim_kkpipi[3];
2657 pdau[12] = -pip_kkpipi[0];
2658 pdau[13] = -pip_kkpipi[1];
2659 pdau[14] = -pip_kkpipi[2];
2660 pdau[15] = pip_kkpipi[3];
2661 D0bar = tKKpipi.AMP( pdau, 1 );
2662
2663 if ( charm == 1 )
2664 {
2665
2666 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2667 double temp = std::arg( D0 ) - std::arg( D0bar );
2668 log << MSG::INFO << "D0 calculation " << sqrt( r2D0 ) << " " << temp << endmsg;
2669 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2670 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2671 deltaD0 = temp;
2672 }
2673 else
2674 {
2675 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2676 double temp = std::arg( D0bar ) - std::arg( D0 );
2677 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2678 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2679 deltaD0 = temp;
2680 }
2681 }
2682 else if ( decay_mode == kK0KK )
2683 {
2684 ++m_nK0KK;
2685
2686 HepLorentzVector kPlus = ( kPlus_kkpipi.at( 0 ) );
2687 HepLorentzVector kMinus = ( kMinus_kkpipi.at( 0 ) );
2688 complex<double> D0, D0bar;
2689 vector<double> k0l;
2690 vector<double> kp;
2691 vector<double> km;
2692 k0l.clear();
2693 kp.clear();
2694 km.clear();
2695 k0l.push_back( k0[0] );
2696 k0l.push_back( k0[1] );
2697 k0l.push_back( k0[2] );
2698 k0l.push_back( k0[3] );
2699 kp.push_back( kPlus[0] );
2700 kp.push_back( kPlus[1] );
2701 kp.push_back( kPlus[2] );
2702 kp.push_back( kPlus[3] );
2703 km.push_back( kMinus[0] );
2704 km.push_back( kMinus[1] );
2705 km.push_back( kMinus[2] );
2706 km.push_back( kMinus[3] );
2707
2708 if ( isKsKK )
2709 {
2710 // D0ToKSKK tKSKK;tKSKK.init();
2711 // D0 = tKSKK.Amp_PFT(k0l,kp,km);
2712 D0ToKSLKK tKSLKK;
2713 tKSLKK.init( 310, 0 );
2714 D0 = tKSLKK.Amp( k0l, kp, km, 310, 0 );
2715
2716 vector<double> cpk0l;
2717 vector<double> cpkp;
2718 vector<double> cpkm;
2719 cpk0l.clear();
2720 kp.clear();
2721 km.clear();
2722 cpk0l.push_back( -k0l[0] );
2723 cpk0l.push_back( -k0l[1] );
2724 cpk0l.push_back( -k0l[2] );
2725 cpk0l.push_back( k0l[3] );
2726 cpkm.push_back( -kPlus[0] );
2727 cpkm.push_back( -kPlus[1] );
2728 cpkm.push_back( -kPlus[2] );
2729 cpkm.push_back( kPlus[3] );
2730 cpkp.push_back( -kMinus[0] );
2731 cpkp.push_back( -kMinus[1] );
2732 cpkp.push_back( -kMinus[2] );
2733 cpkp.push_back( kMinus[3] );
2734 // D0bar = tKSKK.Amp_PFT(cpk0l, cpkp, cpkm);
2735 D0bar = tKSLKK.Amp( cpk0l, cpkp, cpkm, 310, 0 );
2736 }
2737 else
2738 {
2739 // D0ToKSKK tKSKK;tKSKK.init();
2740 // D0 = tKSKK.Amp_PFT(k0l,kp,km);
2741 D0ToKSLKK tKSLKK;
2742 tKSLKK.init( 130, 1 );
2743 D0 = tKSLKK.Amp( k0l, kp, km, 130, 1 );
2744 vector<double> cpk0l;
2745 vector<double> cpkp;
2746 vector<double> cpkm;
2747 cpk0l.clear();
2748 kp.clear();
2749 km.clear();
2750 cpk0l.push_back( -k0l[0] );
2751 cpk0l.push_back( -k0l[1] );
2752 cpk0l.push_back( -k0l[2] );
2753 cpk0l.push_back( k0l[3] );
2754 cpkm.push_back( -kPlus[0] );
2755 cpkm.push_back( -kPlus[1] );
2756 cpkm.push_back( -kPlus[2] );
2757 cpkm.push_back( kPlus[3] );
2758 cpkp.push_back( -kMinus[0] );
2759 cpkp.push_back( -kMinus[1] );
2760 cpkp.push_back( -kMinus[2] );
2761 cpkp.push_back( kMinus[3] );
2762 // D0bar = tKSKK.Amp_PFT(cpk0l, cpkp, cpkm);
2763 D0bar = tKSLKK.Amp( cpk0l, cpkp, cpkm, 130, 1 );
2764 }
2765
2766 if ( charm == 1 )
2767 {
2768
2769 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2770 double temp = std::arg( D0 ) - std::arg( D0bar );
2771 log << MSG::INFO << "D0 calculation " << sqrt( r2D0 ) << " " << temp << endmsg;
2772 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2773 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2774 deltaD0 = temp;
2775 deltaD0 = isKsKK ? deltaD0 : ( deltaD0 + PI );
2776 }
2777 else
2778 {
2779 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2780 double temp = std::arg( D0bar ) - std::arg( D0 );
2781 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2782 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2783 deltaD0 = temp;
2784 deltaD0 = isKsKK ? deltaD0 : ( deltaD0 + PI );
2785 }
2786 }
2787 else if ( num[kLeptonPlus] == 1 )
2788 {
2789 decay_mode = kSLPlus;
2790 ++m_nSL;
2791
2792 r2D0 = 0.;
2793 deltaD0 = 0.;
2794 }
2795 else if ( num[kLeptonMinus] == 1 )
2796 {
2797 decay_mode = kSLMinus;
2798 ++m_nSL;
2799
2800 r2D0 = 0.;
2801 deltaD0 = 0.;
2802 }
2803 // check pipipi0 mode
2804 else if ( nDaughters == 3 && num[kPiPlus] == 1 && num[kPiMinus] == 1 && num[kPi0] == 1 )
2805 {
2806
2807 if ( m_debug ) cout << "PiPiPi0 mode" << endl;
2808 decay_mode = kPipPimPi0;
2809 ++m_nPiPiPi0;
2810
2811 HepLorentzVector pip1_4pi = ( piPlus_4pi.at( 0 ) );
2812 HepLorentzVector pim1_4pi = ( piMinus_4pi.at( 0 ) );
2813 HepLorentzVector pi01_p4 = ( pi0_p4.at( 0 ) );
2814 pip1_4pi.boost( -0.011, 0, 0 );
2815 pim1_4pi.boost( -0.011, 0, 0 );
2816 pi01_p4.boost( -0.011, 0, 0 );
2817 std::complex<double> D0, D0bar;
2818 // EvtVector4R pip1( pip1_4pi[3],pip1_4pi[0],pip1_4pi[1],pip1_4pi[2]);
2819 // EvtVector4R pip2( pip2_4pi[3],pip2_4pi[0],pip2_4pi[1],pip2_4pi[2]);
2820 // EvtVector4R pim1( pim1_4pi[3],pim1_4pi[0],pim1_4pi[1],pim1_4pi[2]);
2821 // EvtVector4R pim2( pim2_4pi[3],pim2_4pi[0],pim2_4pi[1],pim2_4pi[2]);
2822 std::vector<double> pip1;
2823 pip1.clear();
2824 pip1.push_back( pip1_4pi[0] );
2825 pip1.push_back( pip1_4pi[1] );
2826 pip1.push_back( pip1_4pi[2] );
2827 pip1.push_back( pip1_4pi[3] );
2828 std::vector<double> pim1;
2829 pim1.clear();
2830 pim1.push_back( pim1_4pi[0] );
2831 pim1.push_back( pim1_4pi[1] );
2832 pim1.push_back( pim1_4pi[2] );
2833 pim1.push_back( pim1_4pi[3] );
2834 std::vector<double> pi01;
2835 pi01.clear();
2836 pi01.push_back( pi01_p4[0] );
2837 pi01.push_back( pi01_p4[1] );
2838 pi01.push_back( pi01_p4[2] );
2839 pi01.push_back( pi01_p4[3] );
2840
2841 D0Topipipi0 tpipipi0;
2842 tpipipi0.init();
2843 D0 = tpipipi0.Amp( pip1, pim1, pi01 );
2844 // EvtVector4R cppim1(pip1_4pi[3], -1*pip1_4pi[0], -1*pip1_4pi[1], -1*pip1_4pi[2]);
2845 // EvtVector4R cppip1(pim1_4pi[3], -1*pim1_4pi[0], -1*pim1_4pi[1], -1*pim1_4pi[2]);
2846 // EvtVector4R cppim2(pip2_4pi[3], -1*pip2_4pi[0], -1*pip2_4pi[1], -1*pip2_4pi[2]);
2847 // EvtVector4R cppip2(pim2_4pi[3], -1*pim2_4pi[0], -1*pim2_4pi[1], -1*pim2_4pi[2]);
2848 std::vector<double> cppip1;
2849 cppip1.clear();
2850 cppip1.push_back( -pim1_4pi[0] );
2851 cppip1.push_back( -pim1_4pi[1] );
2852 cppip1.push_back( -pim1_4pi[2] );
2853 cppip1.push_back( pim1_4pi[3] );
2854 std::vector<double> cppim1;
2855 cppim1.clear();
2856 cppim1.push_back( -pip1_4pi[0] );
2857 cppim1.push_back( -pip1_4pi[1] );
2858 cppim1.push_back( -pip1_4pi[2] );
2859 cppim1.push_back( pip1_4pi[3] );
2860 std::vector<double> cppi01;
2861 cppi01.clear();
2862 cppi01.push_back( -pi01_p4[0] );
2863 cppi01.push_back( -pi01_p4[1] );
2864 cppi01.push_back( -pi01_p4[2] );
2865 cppi01.push_back( pi01_p4[3] );
2866
2867 D0bar = ( -1.0 ) * tpipipi0.Amp( cppip1, cppim1, cppi01 );
2868
2869 if ( charm == 1 )
2870 {
2871
2872 r2D0 = std::norm( D0bar ) / std::norm( D0 );
2873 double temp = std::arg( D0 ) - std::arg( D0bar );
2874 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2875 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2876 deltaD0 = temp;
2877
2878 double cosd = cos( deltaD0 );
2879 double sind = sin( deltaD0 );
2880 }
2881 else
2882 {
2883 r2D0 = std::norm( D0 ) / std::norm( D0bar );
2884 double temp = std::arg( D0bar ) - std::arg( D0 );
2885 while ( temp < -TMath::Pi() ) { temp += 2.0 * TMath::Pi(); }
2886 while ( temp > TMath::Pi() ) { temp -= 2.0 * TMath::Pi(); }
2887 deltaD0 = temp;
2888
2889 double cosd = cos( deltaD0 );
2890 double sind = sin( deltaD0 );
2891 }
2892 if ( m_debug ) cout << "deltaD0=" << deltaD0 << endl;
2893 if ( m_debug ) cout << "r2D0=" << r2D0 << endl;
2894 }
2895 // Check CP even modes
2896 else if ( ( nDaughters == 2 &&
2897 ( ( num[kPiPlus] == 1 && num[kPiMinus] == 1 ) || nUFP0 == 2 ||
2898 num[kNeutralScalar] == 2 || ( nUFP0 == 1 && nUFV0 == 1 ) ||
2899 ( num[kKPlus] == 1 && num[kKMinus] == 1 ) || num[kK0S] == 2 ||
2900 num[kK0L] == 2 || ( num[kK0L] == 1 && nUFP0 == 1 ) ||
2901 ( num[kK0S] == 1 && num[kNeutralScalar] == 1 ) ||
2902 ( num[kK0L] == 1 && nUFV0 == 1 ) ||
2903 ( num[kUFVPlus] == 1 && num[kPiMinus] == 1 ) ||
2904 ( num[kUFVMinus] == 1 && num[kPiPlus] == 1 ) ) ) ||
2905 ( nDaughters == 3 &&
2906 ( ( nCPPlusEig == 1 && num[kPi0] == 2 ) || ( num[kK0S] == 3 ) ||
2907 ( num[kK0S] == 1 && num[kK0L] == 2 ) ||
2908 ( num[kK0S] == 1 && num[kK0L] == 1 && nUFP0 == 1 ) ||
2909 ( num[kK0S] == 1 && nUFP0 == 2 ) ) ) ||
2910 ( nDaughters == 4 && ( num[kK0L] == 1 && nUFP0 == 3 ) ||
2911 ( ( num[kK0S] == 2 || num[kK0L] == 2 ) && nUFP0 == 2 ) ) )
2912 {
2913 decay_mode = kCPPlus;
2914 ++m_nCPPlus;
2915
2916 r2D0 = 1.;
2917 deltaD0 = 0.;
2918 }
2919 // Check CP odd modes
2920 else if ( ( nDaughters == 2 && ( ( num[kK0S] == 1 && nUFP0 == 1 ) ||
2921 ( num[kK0L] == 1 && num[kNeutralScalar] == 1 ) ||
2922 ( num[kK0S] == 1 && nUFV0 == 1 ) ||
2923 ( num[kNeutralScalar] == 1 && nUFV0 == 1 ) ||
2924 ( nUFP0 == 1 && num[kNeutralScalar] == 1 ) ) ) ||
2925 ( nDaughters == 3 && ( ( nCPMinusEig == 3 && num[kPi0] == 2 ) || // pi0 is subset
2926 // of CP-
2927 ( num[kPi0] == 3 ) || ( num[kK0L] == 3 ) ||
2928 ( num[kK0S] == 2 && num[kK0L] == 1 ) ||
2929 ( ( num[kK0S] == 2 || num[kK0L] == 2 ) && nUFP0 == 1 ) ||
2930 ( num[kK0L] == 1 && nUFP0 == 2 ) ) ) ||
2931 ( nDaughters == 4 && ( num[kK0S] == 1 && num[kPi0] == 3 ) ||
2932 ( ( num[kK0S] == 1 && num[kK0L] == 1 ) && nUFP0 == 2 ) ) )
2933 {
2934 decay_mode = kCPMinus;
2935 ++m_nCPMinus;
2936
2937 r2D0 = 1.;
2938 deltaD0 = PI;
2939 }
2940 else if ( nStrange == nAntiStrange + 1 )
2941 {
2942 if ( m_debug ) cout << nDaughters << endl;
2943 if ( m_debug ) cout << num[kKMinus] << endl;
2944 if ( m_debug ) cout << num[kPiMinus] << endl;
2945 if ( m_debug ) cout << num[kPiPlus] << endl;
2946 if ( charm == 1 )
2947 {
2948 if ( ( num[kKMinus] == 1 && num[kPiPlus] == 2 && num[kPiMinus] == 1 ) &&
2949 nDaughters == 4 )
2950 {
2951 if ( m_debug ) cout << "True K-3Pi " << endl;
2952 decay_mode = kFlavoredCF_3;
2954
2955 complex<double> D0, D0bar;
2956 vector<double> kp;
2957 vector<double> pi1;
2958 vector<double> pi2;
2959 vector<double> pi3;
2960 double pdau[16];
2961 pi1.clear();
2962 pi2.clear();
2963 pi3.clear();
2964 kp.clear();
2965
2966 HepLorentzVector kp_kpipipi = ( kMinus_kkpipi.at( 0 ) );
2967 HepLorentzVector pi1_kpipipi = ( piPlus_4pi.at( 0 ) );
2968 HepLorentzVector pi2_kpipipi = ( piPlus_4pi.at( 1 ) );
2969 HepLorentzVector pi3_kpipipi = ( piMinus_4pi.at( 0 ) );
2970
2971 kp.push_back( kp_kpipipi[0] );
2972 kp.push_back( kp_kpipipi[1] );
2973 kp.push_back( kp_kpipipi[2] );
2974 kp.push_back( kp_kpipipi[3] ); // k-
2975 pi1.push_back( pi1_kpipipi[0] );
2976 pi1.push_back( pi1_kpipipi[1] );
2977 pi1.push_back( pi1_kpipipi[2] );
2978 pi1.push_back( pi1_kpipipi[3] ); // pi+
2979 pi2.push_back( pi2_kpipipi[0] );
2980 pi2.push_back( pi2_kpipipi[1] );
2981 pi2.push_back( pi2_kpipipi[2] );
2982 pi2.push_back( pi2_kpipipi[3] ); // pi+
2983 pi3.push_back( pi3_kpipipi[0] );
2984 pi3.push_back( pi3_kpipipi[1] );
2985 pi3.push_back( pi3_kpipipi[2] );
2986 pi3.push_back( pi3_kpipipi[3] ); // pi-
2987
2988 pdau[0] = kp[0];
2989 pdau[1] = kp[1];
2990 pdau[2] = kp[2];
2991 pdau[3] = kp[3];
2992 pdau[4] = pi1[0];
2993 pdau[5] = pi1[1];
2994 pdau[6] = pi1[2];
2995 pdau[7] = pi1[3];
2996 pdau[8] = pi2[0];
2997 pdau[9] = pi2[1];
2998 pdau[10] = pi2[2];
2999 pdau[11] = pi2[3];
3000 pdau[12] = pi3[0];
3001 pdau[13] = pi3[1];
3002 pdau[14] = pi3[2];
3003 pdau[15] = pi3[3];
3004
3005 D0ToKpipipiLHCb tKpipipi;
3006 tKpipipi.init();
3007 D0 = tKpipipi.AMP( pdau, 1 );
3008
3009 D0TopiKpipi tpiKpipi;
3010 tpiKpipi.init();
3011 std::complex<double> dcs_offset =
3012 0.0601387 * exp( std::complex<double>( 0, 1 ) * 1.04827 * M_PI / 180. );
3013 D0bar = dcs_offset * tpiKpipi.AMP( pdau, 1 );
3014 deltaD0 = ( std::arg( D0 * std::conj( D0bar ) ) + m_dCF_3 );
3015 r2D0 = std::norm( D0bar ) / std::norm( D0 );
3016 }
3017 else if ( ( num[kKMinus] == 1 && num[kPiPlus] == 1 && num[kPi0] == 1 ) &&
3018 nDaughters == 3 )
3019 {
3020 decay_mode = kFlavoredCF_1;
3022 r2D0 = pow( m_rCF_1, 2 );
3023 deltaD0 = m_deltaCF_1;
3024 RD0 = m_RCF_1;
3025 }
3026 else
3027 {
3028 // if( ( num[ kKMinus ] == 1 && num[ kPiMinus ] == 1 ) && nDaughters == 2 )
3029 if ( m_debug ) cout << "True K-Pi " << endl;
3030 decay_mode = kFlavoredCF_0;
3032 r2D0 = pow( m_rCF_0, 2 );
3033 deltaD0 = m_deltaCF_0;
3034 RD0 = m_RCF_0;
3035 }
3036 }
3037 else
3038 {
3039 if ( ( num[kKMinus] == 1 && num[kPiPlus] == 2 && num[kPiMinus] == 1 ) &&
3040 nDaughters == 4 )
3041 {
3042 decay_mode = kFlavoredCF_3;
3044
3045 complex<double> D0, D0bar;
3046 vector<double> kp;
3047 vector<double> pi1;
3048 vector<double> pi2;
3049 vector<double> pi3;
3050 double pdau[16];
3051 pi1.clear();
3052 pi2.clear();
3053 pi3.clear();
3054 kp.clear();
3055
3056 HepLorentzVector kp_kpipipi = ( kMinus_kkpipi.at( 0 ) );
3057 HepLorentzVector pi1_kpipipi = ( piPlus_4pi.at( 0 ) );
3058 HepLorentzVector pi2_kpipipi = ( piPlus_4pi.at( 1 ) );
3059 HepLorentzVector pi3_kpipipi = ( piMinus_4pi.at( 0 ) );
3060
3061 kp.push_back( kp_kpipipi[0] );
3062 kp.push_back( kp_kpipipi[1] );
3063 kp.push_back( kp_kpipipi[2] );
3064 kp.push_back( kp_kpipipi[3] ); // k-
3065 pi1.push_back( pi1_kpipipi[0] );
3066 pi1.push_back( pi1_kpipipi[1] );
3067 pi1.push_back( pi1_kpipipi[2] );
3068 pi1.push_back( pi1_kpipipi[3] ); // pi+
3069 pi2.push_back( pi2_kpipipi[0] );
3070 pi2.push_back( pi2_kpipipi[1] );
3071 pi2.push_back( pi2_kpipipi[2] );
3072 pi2.push_back( pi2_kpipipi[3] ); // pi+
3073 pi3.push_back( pi3_kpipipi[0] );
3074 pi3.push_back( pi3_kpipipi[1] );
3075 pi3.push_back( pi3_kpipipi[2] );
3076 pi3.push_back( pi3_kpipipi[3] ); // pi-
3077
3078 pdau[0] = kp[0];
3079 pdau[1] = kp[1];
3080 pdau[2] = kp[2];
3081 pdau[3] = kp[3];
3082 pdau[4] = pi1[0];
3083 pdau[5] = pi1[1];
3084 pdau[6] = pi1[2];
3085 pdau[7] = pi1[3];
3086 pdau[8] = pi2[0];
3087 pdau[9] = pi2[1];
3088 pdau[10] = pi2[2];
3089 pdau[11] = pi2[3];
3090 pdau[12] = pi3[0];
3091 pdau[13] = pi3[1];
3092 pdau[14] = pi3[2];
3093 pdau[15] = pi3[3];
3094
3095 D0ToKpipipiLHCb tKpipipi;
3096 tKpipipi.init();
3097 D0 = tKpipipi.AMP( pdau, 1 );
3098
3099 D0TopiKpipi tpiKpipi;
3100 tpiKpipi.init();
3101 std::complex<double> dcs_offset =
3102 0.0601387 * exp( std::complex<double>( 0, 1 ) * 1.04827 * M_PI / 180. );
3103 D0bar = dcs_offset * tpiKpipi.AMP( pdau, 1 );
3104 deltaD0 = -( std::arg( D0 * std::conj( D0bar ) ) + m_dCF_3 );
3105 r2D0 = std::norm( D0 ) / std::norm( D0bar );
3106 }
3107 else if ( ( num[kKMinus] == 1 && num[kPiPlus] == 1 && num[kPi0] == 1 ) &&
3108 nDaughters == 3 )
3109 {
3110 decay_mode = kFlavoredCF_1;
3112 r2D0 = 1. / pow( m_rCF_1, 2 );
3113 deltaD0 = -m_deltaCF_1;
3114 RD0 = m_RCF_1;
3115 }
3116 else
3117 {
3118 // if( ( num[ kKMinus ] == 1 && num[ kPiPlus ] == 1 ) && nDaughters == 2 )
3119 decay_mode = kFlavoredCF_0;
3121 r2D0 = 1. / pow( m_rCF_0, 2 );
3122 deltaD0 = -m_deltaCF_0;
3123 RD0 = m_RCF_0;
3124 }
3125 }
3126 }
3127 else if ( nAntiStrange == nStrange + 1 )
3128 {
3129 if ( charm == -1 )
3130 {
3131 if ( ( num[kKPlus] == 1 && num[kPiMinus] == 2 && num[kPiPlus] == 1 ) && nDaughters == 4 )
3132 {
3133 decay_mode = kFlavoredCFBar_3;
3135
3136 complex<double> D0, D0bar;
3137 vector<double> kp;
3138 vector<double> pi1;
3139 vector<double> pi2;
3140 vector<double> pi3;
3141 double pdau[16];
3142 pi1.clear();
3143 pi2.clear();
3144 pi3.clear();
3145 kp.clear();
3146
3147 HepLorentzVector kp_kpipipi = ( kPlus_kkpipi.at( 0 ) );
3148 HepLorentzVector pi1_kpipipi = ( piMinus_4pi.at( 0 ) );
3149 HepLorentzVector pi2_kpipipi = ( piMinus_4pi.at( 1 ) );
3150 HepLorentzVector pi3_kpipipi = ( piPlus_4pi.at( 0 ) );
3151
3152 kp.push_back( -kp_kpipipi[0] );
3153 kp.push_back( -kp_kpipipi[1] );
3154 kp.push_back( -kp_kpipipi[2] );
3155 kp.push_back( kp_kpipipi[3] ); // k-
3156 pi1.push_back( -pi1_kpipipi[0] );
3157 pi1.push_back( -pi1_kpipipi[1] );
3158 pi1.push_back( -pi1_kpipipi[2] );
3159 pi1.push_back( pi1_kpipipi[3] ); // pi+
3160 pi2.push_back( -pi2_kpipipi[0] );
3161 pi2.push_back( -pi2_kpipipi[1] );
3162 pi2.push_back( -pi2_kpipipi[2] );
3163 pi2.push_back( pi2_kpipipi[3] ); // pi+
3164 pi3.push_back( -pi3_kpipipi[0] );
3165 pi3.push_back( -pi3_kpipipi[1] );
3166 pi3.push_back( -pi3_kpipipi[2] );
3167 pi3.push_back( pi3_kpipipi[3] ); // pi-
3168
3169 pdau[0] = kp[0];
3170 pdau[1] = kp[1];
3171 pdau[2] = kp[2];
3172 pdau[3] = kp[3];
3173 pdau[4] = pi1[0];
3174 pdau[5] = pi1[1];
3175 pdau[6] = pi1[2];
3176 pdau[7] = pi1[3];
3177 pdau[8] = pi2[0];
3178 pdau[9] = pi2[1];
3179 pdau[10] = pi2[2];
3180 pdau[11] = pi2[3];
3181 pdau[12] = pi3[0];
3182 pdau[13] = pi3[1];
3183 pdau[14] = pi3[2];
3184 pdau[15] = pi3[3];
3185
3186 D0ToKpipipiLHCb tKpipipi;
3187 tKpipipi.init();
3188 D0 = tKpipipi.AMP( pdau, 1 );
3189
3190 D0TopiKpipi tpiKpipi;
3191 tpiKpipi.init();
3192 std::complex<double> dcs_offset =
3193 0.0601387 * exp( std::complex<double>( 0, 1 ) * 1.04827 * M_PI / 180. );
3194 D0bar = dcs_offset * tpiKpipi.AMP( pdau, 1 );
3195 deltaD0 = ( std::arg( D0 * std::conj( D0bar ) ) + m_dCF_3 );
3196 r2D0 = std::norm( D0bar ) / std::norm( D0 );
3197 }
3198 else if ( ( num[kKPlus] == 1 && num[kPiMinus] == 1 && num[kPi0] == 1 ) &&
3199 nDaughters == 3 )
3200 {
3201 decay_mode = kFlavoredCFBar_1;
3203 r2D0 = pow( m_rCF_1, 2 );
3204 deltaD0 = m_deltaCF_1;
3205 RD0 = m_RCF_1;
3206 }
3207 else
3208 {
3209 // else if( ( num[ kKPlus ] == 1 && num[ kPiMinus ] == 1 ) && nDaughters == 2 )
3210 decay_mode = kFlavoredCFBar_0;
3212 r2D0 = pow( m_rCF_0, 2 );
3213 deltaD0 = m_deltaCF_0;
3214 RD0 = m_RCF_0;
3215 }
3216 }
3217 else
3218 {
3219 if ( ( num[kKPlus] == 1 && num[kPiMinus] == 2 && num[kPiPlus] == 1 ) && nDaughters == 4 )
3220 {
3221 decay_mode = kFlavoredCFBar_3;
3223
3224 complex<double> D0, D0bar;
3225 vector<double> kp;
3226 vector<double> pi1;
3227 vector<double> pi2;
3228 vector<double> pi3;
3229 double pdau[16];
3230 pi1.clear();
3231 pi2.clear();
3232 pi3.clear();
3233 kp.clear();
3234
3235 HepLorentzVector kp_kpipipi = ( kPlus_kkpipi.at( 0 ) );
3236 HepLorentzVector pi1_kpipipi = ( piMinus_4pi.at( 0 ) );
3237 HepLorentzVector pi2_kpipipi = ( piMinus_4pi.at( 1 ) );
3238 HepLorentzVector pi3_kpipipi = ( piPlus_4pi.at( 0 ) );
3239
3240 kp.push_back( -kp_kpipipi[0] );
3241 kp.push_back( -kp_kpipipi[1] );
3242 kp.push_back( -kp_kpipipi[2] );
3243 kp.push_back( kp_kpipipi[3] ); // k-
3244 pi1.push_back( -pi1_kpipipi[0] );
3245 pi1.push_back( -pi1_kpipipi[1] );
3246 pi1.push_back( -pi1_kpipipi[2] );
3247 pi1.push_back( pi1_kpipipi[3] ); // pi+
3248 pi2.push_back( -pi2_kpipipi[0] );
3249 pi2.push_back( -pi2_kpipipi[1] );
3250 pi2.push_back( -pi2_kpipipi[2] );
3251 pi2.push_back( pi2_kpipipi[3] ); // pi+
3252 pi3.push_back( -pi3_kpipipi[0] );
3253 pi3.push_back( -pi3_kpipipi[1] );
3254 pi3.push_back( -pi3_kpipipi[2] );
3255 pi3.push_back( pi3_kpipipi[3] ); // pi-
3256
3257 pdau[0] = kp[0];
3258 pdau[1] = kp[1];
3259 pdau[2] = kp[2];
3260 pdau[3] = kp[3];
3261 pdau[4] = pi1[0];
3262 pdau[5] = pi1[1];
3263 pdau[6] = pi1[2];
3264 pdau[7] = pi1[3];
3265 pdau[8] = pi2[0];
3266 pdau[9] = pi2[1];
3267 pdau[10] = pi2[2];
3268 pdau[11] = pi2[3];
3269 pdau[12] = pi3[0];
3270 pdau[13] = pi3[1];
3271 pdau[14] = pi3[2];
3272 pdau[15] = pi3[3];
3273
3274 D0ToKpipipiLHCb tKpipipi;
3275 tKpipipi.init();
3276 D0 = tKpipipi.AMP( pdau, 1 );
3277
3278 D0TopiKpipi tpiKpipi;
3279 tpiKpipi.init();
3280 std::complex<double> dcs_offset =
3281 0.0601387 * exp( std::complex<double>( 0, 1 ) * 1.04827 * M_PI / 180. );
3282 D0bar = dcs_offset * tpiKpipi.AMP( pdau, 1 );
3283 deltaD0 = -( std::arg( D0 * std::conj( D0bar ) ) + m_dCF_3 );
3284 r2D0 = std::norm( D0 ) / std::norm( D0bar );
3285 }
3286 else if ( ( num[kKPlus] == 1 && num[kPiMinus] == 1 && num[kPi0] == 1 ) &&
3287 nDaughters == 3 )
3288 {
3289 decay_mode = kFlavoredCFBar_1;
3291 r2D0 = 1. / pow( m_rCF_1, 2 );
3292 deltaD0 = -m_deltaCF_1;
3293 RD0 = m_RCF_1;
3294 }
3295 else
3296 {
3297 // if( ( num[ kKMinus ] == 1 && num[ kPiMinus ] == 1 ) && nDaughters == 2 )
3298 decay_mode = kFlavoredCFBar_0;
3300 r2D0 = 1. / pow( m_rCF_0, 2 );
3301 deltaD0 = -m_deltaCF_0;
3302 RD0 = m_RCF_0;
3303 }
3304 }
3305 }
3306 else if ( nStrange == nAntiStrange ) // Unflavored or Cabibbo-suppressed
3307 {
3308 if ( ( num[kKPlus] > 0 && ( num[kKPlus] == num[kFVMinus] ||
3309 num[kKPlus] == nFV0Bar ) ) || // for anti-K*0 K+ pi-
3310 ( nK0 > 0 && nFV0 != nFV0Bar && nK0 == nFV0Bar ) ||
3311 ( num[kPiPlus] > 0 && num[kPiPlus] == num[kUFVMinus] ) )
3312 {
3313 decay_mode = kFlavoredCS;
3315
3316 if ( charm == 1 )
3317 {
3318 r2D0 = pow( m_rCS, 2 );
3319 deltaD0 = m_deltaCS;
3320 }
3321 else
3322 {
3323 r2D0 = 1. / pow( m_rCS, 2 );
3324 deltaD0 = -m_deltaCS;
3325 }
3326 }
3327 else if ( ( num[kKMinus] > 0 &&
3328 ( num[kKMinus] == num[kFVPlus] || num[kKMinus] == nFV0 ) ) || // for K*0 K- pi+
3329 ( nK0 > 0 && nFV0 != nFV0Bar && nK0 == nFV0 ) ||
3330 ( num[kPiMinus] > 0 && num[kPiMinus] == num[kUFVPlus] ) )
3331 {
3332 decay_mode = kFlavoredCSBar;
3334
3335 if ( charm == -1 )
3336 {
3337 r2D0 = pow( m_rCS, 2 );
3338 deltaD0 = m_deltaCS;
3339 }
3340 else
3341 {
3342 r2D0 = 1. / pow( m_rCS, 2 );
3343 deltaD0 = -m_deltaCS;
3344 }
3345 }
3346
3347 // Self-conjugate mixed-CP final states -- pick CP or non-CP at
3348 // random. If CP, pick + or - at random. If non-CP, pick
3349 // flavored or flavoredBar according to the appropriate value of r.
3350 else if ( ( nDaughters >= 3 && num[kPiPlus] == num[kPiMinus] &&
3351 num[kKPlus] == num[kKMinus] && nChargedPiK + nCPEig == nDaughters ) ||
3352 nUFV0 == nDaughters || ( num[kKStar0] > 0 && num[kKStar0] == num[kKStar0Bar] ) ||
3353 ( num[kK10] > 0 && num[kK10] == num[kK10Bar] ) ||
3354 ( num[kUFVPlus] == 1 && num[kUFVMinus] == 1 )
3355 // for rho+rho-; no a1+a1- and rhoa1 final states in DECAY.DEC
3356 )
3357 {
3358 log << MSG::DEBUG << " [ Self-conjugate mixed-CP ]" << endmsg;
3359
3360 if ( RandFlat::shoot() > 0.5 )
3361 {
3362 if ( RandFlat::shoot() > 0.5 )
3363 {
3364 decay_mode = kCPPlus;
3365 ++m_nCPPlus;
3366
3367 r2D0 = 1.;
3368 deltaD0 = PI;
3369 }
3370 else
3371 {
3372 decay_mode = kCPMinus;
3373 ++m_nCPMinus;
3374
3375 r2D0 = 1.;
3376 deltaD0 = 0.;
3377 }
3378 }
3379 else
3380 {
3381 // Odd # of K0S or K0L = CF; even # of K0S or K0L = SC.
3382 if ( nK0 % 2 )
3383 {
3384 // Nov 2007: correct for r2 -> RWS and BR != A^2
3385 double cutoff = m_rwsCF_0 / ( 1. + m_rwsCF_0 );
3386
3387 if ( charm == -1 ) { cutoff = 1. - cutoff; }
3388
3389 log << MSG::DEBUG << " [ cutoff = " << cutoff << " ]" << endmsg;
3390
3391 decay_mode = ( RandFlat::shoot() > cutoff ) ? kFlavoredCF_0 : kFlavoredCFBar_0;
3392
3393 if ( ( decay_mode == kFlavoredCF_0 && charm == 1 ) ||
3394 ( decay_mode == kFlavoredCFBar_0 && charm == -1 ) )
3395 {
3397
3398 r2D0 = sqrt( m_rCF_0 );
3399 deltaD0 = m_deltaCF_0;
3400 }
3401 else
3402 {
3404
3405 r2D0 = 1. / sqrt( m_rCF_0 );
3406 deltaD0 = -m_deltaCF_0;
3407 }
3408 }
3409 else
3410 {
3411 // Nov 2007: correct for r2 -> RWS and BR != A^2
3412 double cutoff = m_rwsCS / ( 1. + m_rwsCS );
3413
3414 if ( charm == -1 ) { cutoff = 1. - cutoff; }
3415
3416 log << MSG::DEBUG << " [ cutoff = " << cutoff << " ]" << endmsg;
3417
3418 decay_mode = ( RandFlat::shoot() > cutoff ) ? kFlavoredCS : kFlavoredCSBar;
3420
3421 if ( ( decay_mode == kFlavoredCS && charm == 1 ) ||
3422 ( decay_mode == kFlavoredCSBar && charm == -1 ) )
3423 {
3424 r2D0 = sqrt( m_rCS );
3425 deltaD0 = m_deltaCS;
3426 }
3427 else
3428 {
3429 r2D0 = 1. / sqrt( m_rCS );
3430 deltaD0 = -m_deltaCS;
3431 }
3432 }
3433 }
3434 }
3435 }
3436
3437 if ( num[kUnknown] >= 1 )
3438 {
3439 cout << "decay mode " << decay_mode << endl;
3440 cout << "D #" << charm << endl;
3441 cout << "pi+: " << num[kPiPlus] << endl;
3442 cout << "pi-: " << num[kPiMinus] << endl;
3443 cout << "pi0: " << num[kPi0] << endl;
3444 cout << "eta: " << num[kEta] << endl;
3445 cout << "eta': " << num[kEtaPrime] << endl;
3446 cout << "f0/a0: " << num[kNeutralScalar] << endl;
3447 cout << "UFV+: " << num[kUFVPlus] << endl;
3448 cout << "UFV-: " << num[kUFVMinus] << endl;
3449 cout << "rho0: " << num[kRho0] << endl;
3450 cout << "omega: " << num[kOmega] << endl;
3451 cout << "phi: " << num[kPhi] << endl;
3452 cout << "K+: " << num[kKPlus] << endl;
3453 cout << "K-: " << num[kKMinus] << endl;
3454 cout << "K0S: " << num[kK0S] << endl;
3455 cout << "K0L: " << num[kK0L] << endl;
3456 cout << "FV+: " << num[kFVPlus] << endl;
3457 cout << "FV-: " << num[kFVMinus] << endl;
3458 cout << "K*0: " << num[kKStar0] << endl;
3459 cout << "K*0b: " << num[kKStar0Bar] << endl;
3460 cout << "K10: " << num[kK10] << endl;
3461 cout << "K10b: " << num[kK10Bar] << endl;
3462 cout << "l+: " << num[kLeptonPlus] << endl;
3463 cout << "l-: " << num[kLeptonMinus] << endl;
3464 cout << "nu: " << num[kNeutrino] << endl;
3465 cout << "gamma: " << num[kGamma] << endl;
3466 cout << "Unknown: " << num[25] << endl;
3467 }
3468
3469 d0_info[0] = decay_mode;
3470 d0_info[1] = r2D0;
3471 d0_info[2] = deltaD0;
3472 d0_info[3] = RD0;
3473 d0_info[4] = FCP;
3474 d0_info[5] = mnm_gen;
3475 d0_info[6] = mpn_gen;
3476 d0_info[7] = double( isKsPiPi );
3477 d0_info[8] = mpm_gen;
3478 return d0_info;
3479}
DECLARE_COMPONENT(BesBdkRc)
int runNo
Definition DQA_TO_DB.cxx:13
complex< double > TComplex
Definition Dalitz.h:14
character *LEPTONflag integer iresonances real pi2
Evt3Rank3C conj(const Evt3Rank3C &t2)
double imag(const EvtComplex &c)
EvtComplex exp(const EvtComplex &c)
#define PI
*******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
Definition FoamA.h:85
XmlRpcServer s
*********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
Definition KarFin.h:34
const double xmeta
double Pip2Pim2Denom_fil
double Pip2Pim2Numer1_fil
double m_rwsCS
const double xmpion
double m_PipPim2Pi0Numer2
double m_rwsCF_3
int m_nCPPlus
double dalitzNumer2_fil
int m_n2Pip2Pim
const double xmk0
int m_nCPMinus
double m_deltaCF_1
double m_deltaCF
int m_nUnknownEvents
double m_dalitzNumer1
double m_2Pip2PimNumer1
double m_deltaCF_0
double m_rwsCF
int m_nPiPiPi0
int m_nSL
double m_rwsCF_0
int m_nKKPiPi
int m_nDalitz
double PipPim2Pi0Denom_fil
double m_PipPim2Pi0Numer1
HepMatrix m_modeCounter(21, 21, 0)
HepMatrix m_keptModeCounter(21, 21, 0)
int m_nD0D0barDiscarded
int m_nDpDmEvents
int m_nK0KK
double PipPim2Pi0Numer1_fil
double Pip2Pim2Numer2_fil
double m_dalitzDenom
double KSPiPiPi0Denom_fil
int m_nK0PiPiPi0
const double xmd0
int m_rho_flag
int m_nFlavoredCFD0_3
double m_2Pip2PimNumer2
HepSymMatrix m_weights(20, 0)
double m_PipPim2Pi0Denom
const double xmkaon
int m_nD0bar
int m_nFlavoredCFD0_0
double m_KSPiPiPi0Numer1
double KSPiPiPi0Numer1_fil
int m_nDpDmDiscarded
double PipPim2Pi0Numer2_fil
int m_nFlavoredDCSD0_3
int m_nFlavoredDCSD0_0
double m_dalitzNumer2
double m_KSPiPiPi0Numer2
double dalitzDenom_fil
double m_rwsCF_1
int m_nFlavoredCSD0
int m_nUnknownDecays
int m_nFlavoredDCSD0_1
double dalitzNumer1_fil
double m_KSPiPiPi0Denom
int m_nD0D0barEvents
double m_deltaCS
double m_deltaCF_3
int m_nPipPim2Pi0
int m_nFlavoredCFD0_1
double KSPiPiPi0Numer2_fil
double m_2Pip2PimDenom
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations xmb DOUBLE PRECISION xcb DOUBLE PRECISION xmpi0
Definition RRes.h:32
***************************************************************************************Pseudo Class RRes *****************************************************************************************Parameters and physical constants **Maarten sept ************************************************************************DOUBLE PRECISION xsmu **************************************************************************PARTICLE DATA all others are from PDG *Only resonances with known widths into electron pairs are sept ************************************************************************C Declarations xmb DOUBLE PRECISION xcb DOUBLE PRECISION xmDcs DOUBLE PRECISION xmBbc DOUBLE PRECISION xmrho
Definition RRes.h:34
IMessageSvc * msgSvc()
#define M_PI
Definition TConstant.h:4
complex< double > Amp(vector< double > Pip1, vector< double > Pim1, vector< double > Pip2, vector< double > Pim2)
void init()
complex< double > AMP(double const *x0, const int &x1)
complex< double > Amp_PFT(vector< double > k0l, vector< double > pip, vector< double > pim)
void init()
void init(int Daug0Id, int Uspin)
Definition D0ToKSLKK.cxx:34
complex< double > Amp(vector< double > k0l, vector< double > kp, vector< double > km, int Daug0Id, int Uspin)
complex< double > Amp_PFT(vector< double > k0l, vector< double > pip, vector< double > pim)
void init()
complex< double > Amp(vector< double > ks0, vector< double > pip, vector< double > pim, vector< double > pi0)
std::complex< double > AMP(const double *x0, const int &x1)
complex< double > AMP(double const *x0, const int &x1)
complex< double > Amp(vector< double > Pip, vector< double > Pim, vector< double > Pi0)
complex< double > Amp(vector< double > Pip, vector< double > Pim, vector< double > Pi01, vector< double > Pi02)
const McParticle & mother() const
access to the mother particle
StdHepId particleProperty() const
Retrieve particle property.
Definition McParticle.cxx:7
StatusCode initialize()
StatusCode finalize()
QCMCFilter(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< double > findD0Decay(int charm)
StatusCode execute()
int t()
Definition t.c:1