diff --git a/History.md b/History.md index 5eaa7aa..46502ef 100644 --- a/History.md +++ b/History.md @@ -1,771 +1,775 @@ # History file for EvtGen From version 2.0.0, Tabc labels refer to [Maniphest tasks](https://phab.hepforge.org/maniphest/query/nkBRd9OhPCBN/), while Dxyz labels refer to [Differential code reviews](https://phab.hepforge.org/differential/query/YDY8EgjNGd.e/) on HepForge: https://phab.hepforge.org/Tabc https://phab.hepforge.org/Dxyz === ## R02-02-0X +3 Feb 2023 John Back +* D91: Check for non-zero momentum for EvtSLBaryonAmp parent spin density matrix. + Print out integrals of JSON test histograms. + 16 Dec 2022 John Back * D89: Added probabilities for B_c -> V pi+ and V pi+ pi0 EvtBcVHad modes. 16 Nov 2022 Tom Latham * T123: Provide documention of how to contribute bug reports, feature requests, new/modified code 8 Sep 2022 Fernando Abudinen, John Back, Michal Kreps, Tom Latham, Alex Ward * T108: Implement JSON test framework for all decay models 9 June 2022 Michal Kreps * D84: Improve efficiency of RareLbToLll decay model for final states with e+e- pair. === ## R02-02-00 12 May 2022 Michal Kreps * D83: Fix double counting of charmonia with K0 decays for B0. 11 May 2022 Tom Latham * D80: Add CMake options for enabling clang-tidy static analysis checks during build 14 Apr 2022 John Back * D82: EvtDecayProb: initialise data members and remove empty destructor 14 Apr 2022 Michal Kreps * D81: Derive EvtFlatSqDalitz from EvtDecayIncoherent since we directly provide final kinematics 2nd Mar 2022 John Back * D78: Add Bc -> J/psi K+ pi- pi+ pi- pi+, Bc -> J/psi K+ K- pi+ pi- pi+ & Bc -> J/psi 4pi+ 3pi- decay modes to the BC_VHAD model, courtesy of Aleksei Luchinsky, Anna Danilina, Dmitrii Pereima & Vanya Belyaev (LHCb) === ## R02-01-01 8th Sep 2021 Michal Kreps * Update location of web page for Pythia8 download in setup script. 8th Sep 2021 Markus Prim, Lu Cao, Chaoyi Lyu and Michel De Cian (Michal Kreps) * D73: Add new model for semileptonic B decays with BCL and BGL form-factors 8th June 2021 Michal Kreps * T110, D71: Fix B+ --> eta' l nu BF which was order of magnitude too high. Balance the decrease by increasing B+ --> D0 l nu, which is after change still bit smaller than PDG 2021. 8th Jun 2021 Michal Kreps * D71: Fix B+ --> eta' l nu BF. 20th Apr 2021 Tom Lathem * D68: Fix compilation with Pythia 8.304 17th Mar 2021 Michal Kreps * D62: Improve PI0DALITZ model to dynamically work out maximum probability to make it usuable also for eta --> llgamma decays. Remove ETA2MUMUGAMMA since it is a pure one-to-one copy of PI0DALITZ. 15th Jan 2021 Michal Kreps * D47: Model to generate 4-body phase-space decays in restricted part of the m12-m34 space 12th Jan 2021 Michal Kreps * D48: Fix bug in calculation of the daughter momentum in decay model EvtBsMuMuKK 7th Jan 2021 Michal Kreps * D43: Allow to pass particle properties table in form of stringstream to constructor of EvtGen for use case where these are created on fly. 10th Dec 2020 Michal Kreps * D36: EvtFlatSqDalitz model to be more efficient and to avoid cut-off around the edges 21st Aug 2020 John Back * T109: Add EvtEtaLLPiPi model for eta' -> l l pi pi decays (l = e or mu), - courtesy of Aleksei Luchinsky (LHCb). 29th Jun 2020 Michal Kreps * T103: Add missing include in EvtGenBase/EvtMatrix.hh. 15th May 2020 Michal Kreps * D28: Add EvtThreeBodyPhsp (rectangular Dalitz plot selection) and EvtPhspDecaytimeCut (minimum decay time requirement) models. * D27: Fix initialisation of constants in EvtBTo3hCP model. === ## R02-00-00 24th Apr 2020 Michal Kreps * Update particle properties file evt.pdl to 2019 version of RPP by PDG. 23rd Apr 2020 Tom Latham * Apply copyright and licence notices to all relevant files. 17th Apr 2020 Tom Latham * Add text of GNU GPLv3 in COPYING, add (preliminary) list of authors in AUTHORS, and clean-up all source files, prior to applying copyright and licence notices. 9th Apr 2020 Tom Latham * Improve, and document use of, standalone installation script. * Apply clang-format formatting to all C++ source files. 8th Apr 2020 Tom Latham * One small modernisation change to EvtPhotosEngine to match that already applied in EvtTauolaEngine. 8th Apr 2020 John Back * Fixed NonReson amplitude and the 4-momentum boosts used for angles in EvtLambdacPHH, - courtesy of Elisabeth Niel (LHCb). 7th Apr 2020 Gerhard Raven, Tom Latham, Michal Kreps and John Back * Incorporate C++ modernization changes from Gerhard Raven (LHCb). - Merged modernize branch into master. 9th Mar 2020 John Back * Add EvtAbsExternalGen::getDecayProb() to allow external generators to return a probability that can be used in EvtDecayProb (default = 1). 6th Mar 2020 Andrii Verbytskyi and Tom Latham * Implement HepMC3 support: EvtHepMCEvent, external engines & cmake files. 15th Nov 2019 John Back * Added EvtPsi2JpsiPiPi model for psi2S -> J/psi pi+ pi- decays based on hep-ph/1507.07985, - courtesy of Aleksei Luchinsky (LHCb). 21st August 2019 Michal Kreps * Added the EvtDToKpienu decay model for D -> K pi e nu decays from BESIII, - courtesy of Liaoyuan Dong. 16th July 2019 John Back * Correct imaginary sign for EvtComplex /= (EvtComplex c) operator. 3rd July 2019 John Back * Added the EvtLambdacPHH decay model for Lc -> p K pi decays with K*(890), Delta++(1232) and Lambda(1520) resonances, based on the Fermilab E791 analysis hep-ex/9912003v1, - courtesy of Elisabeth Niel and Patrick Robbe (LHCb). * Modified EvtResonance2 to accept other barrier factor radii. 3rd July 2019 Michal Kreps * Make sure minimum mass for resonances with non-zero widths is larger than 1e-4 GeV in EvtRelBreitWignerBarrierFact. 3rd May 2019 John Back * Corrected EvtSLDiBaryonAmp bugs/issues in the BToDiBaryonlnupQCD model: - parity, amplitude terms and B momentum reference frame variables. * Corrected treament of spinor indices in EvtRareLb2Lll, - courtesy of Tom Blake and Michal Kreps (LHCb). * Updated the EvtBcVHad model to also handle Bc -> psi Ks K decays, - courtesy of Aleksei Luchinsky (LHCb). * Add new decay model EvtBsMuMuKK (BS_MUMUKK) for Bs to J/psi (mu+mu-) K+K-, - courtesy of Veronika Chobanova, Jeremy Dalseno, Diego Martinez Santos and Marcos Romero Lamas (LHCb). * Fix infinite loop during initialisation of the EvtBTo3hCP model via EvtCBTo3piP00 and EvtCBTo3piMPP, - courtesy of Peter Richardson (Durham). 15th March 2019 Tom Latham * Implement cmake build system, replacing the old config method. 30th Jan 2019 John Back * Fix modernization compiler errors and warnings. 29th Jan 2019 Michal Kreps * Allow reading decay files which are missing end-of-line before end-of-file. 21st December 2018 John Back * Imported C++ modernization changes from Gerhard Raven (LHCb). 7th December 2018 John Back * Added the EvtBLLNuL (BLLNUL) model that generates rare B -> ell ell nu ell decays, where ell = e or mu, - courtesy of Anna Danilina and Nikolai Nikitin (LHCb). * Removed the EvtB2MuMuMuNu (BUTOMMMN) model, since its now replaced by the more general BLLNuL one. 5th November 2018 John Back * Added the BToDiBaryonlnupQCD model for generating B to p N* l nu decays, where N can be any (exited) charged baryon (spin 1/2 or 3/2), - courtesy of Mark Smith and Ryan Newcombe (LHCb), with added code optimisations. 17th October 2018 John Back * Added various decay models from LHCb EvtGenExtras package: - EvtBcVHad ("BC_VHAD"), - Evtbs2llGammaMNT ("BSTOGLLMNT"), - Evtbs2llGammaISRFSR ("BSTOGLLISRFSR"), - EvtbTosllMS ("BTOSLLMS"), - EvtbTosllMSExt ("BTOSLLMSEXT"), - EvtLb2Baryonlnu ("Lb2Baryonlnu"), - EvtLb2plnuLCSR ("Lb2plnuLCSR"), - EvtLb2plnuLQCD ("Lb2plnuLQCD"), - EvtFlatSqDalitz ("FLATSQDALITZ"), - EvtPhspFlatLifetime ("PHSPFLATLIFETIME"). 5th October 2018 John Back * Updated setupEvtGen.sh to work with the new HepForge Phabricator site. 13th March 2018 John Back * Updated EvtPythiaEngine to correctly handle updates of various particle properties so that Pythia uses the same information as EvtGen (evt.pdl) for the generic and alias PYTHIA decay model. 12th March 2018 John Back * Updated EvtBcXMuNu models (X = Scalar, Vector, Tensor) to generate Bc to D0(star) mu nu decays, with associated form factors in EvtBCXFF, - courtesy of Aleksei Luchinsky (LHCb). * Also generalised the calculation of their maximum probabilities by reusing the CalcMaxProb method in EvtSemiLeptonicAmp, which now allows for different Q^2 binning (default remains at 25 bins). === ## R01-07-00 13th December 2017 John Back * New tag incorporating all changes below. * Recommended external packages are (as used in the setupEvtGen.sh script): - HepMC 2.06.09, - pythia 8.230, - Photos++ 3.61 - Tauola++ 1.1.6c. 12th December 2017 John Back * Changed Pythia validation example decay files to use Pythia8 codes. 6th December 2017 John Back * Modified the examples to use DECAY.DEC (see 25th April 2016) instead of DECAY_2010.DEC. Changed EvtExternalGenList to assume Pythia8 codes are used in decay files by default, which is the case for DECAY.DEC. Also updated the setupEvtGen.sh script to work with Pythia 8.2x versions. 29th November 2017 John Back * Modified EvtSVP, EvtVVP and EvtTVP models to handle both radiative and two-lepton decays, - courtesy of Aleksei Luchinsky (LHCb). 14th July 2017 John Back * Only create external generator objects if they don't already exist in EvtExternalGenFactory. * Modified configure script to work with Pythia 8.2x 5th July 2017 Michal Kreps * Register the VTOSLL model. 14th June 2017 John Back * Add isNeutralKaon() boolean function and corrected comments in EvtDDalitz. 8th May 2017 Michal Kreps * Fix bug in EvtbTosllVectorAmp to recognise Bs --> K*bar mu mu decay as b --> d ll transition. 8th May 2017 Michal Kreps * Significantly simplify way how we decide on decay mode and daughters ordering in DDalitz model. - With new code by definition all orderings of daughters in the decay file will yield same output. 4th May 2017 John Back * Further fixes to DDalitz particle ordering (including charge-conjugates): - Mode 5: D0 -> K- K0bar K+ and K+ K- K0bar - Mode 12: D0 -> pi0 pi- pi+ and pi+ pi0 pi- - Removed unneeded index ordering checks for mode 10 (D+ -> pi- pi+ pi+) and mode 11 (Ds+ -> pi- pi+ pi+) 27th April 2017 John Back * Fixed DDalitz particle ordering for mode 7: D+ -> pi+ K- K+ and K+ pi+ K- and their charge-conjugates 7th April 2017 John Back * Modified EvtGenExternal/EvtPythiaEngine to ensure that the EvtGen-based instances of Pythia8 (for generic and alias decays) use the same particle properties as defined by EvtGen, - courtesy Patrick Robbe (LHCb). 5th April 2017 Michal Kreps * Fixed indexing in copy constructor of Evt3Rank3C, which would otherwise produce an infinite loop; - bug report from David Grellscheid. 3rd November 2016 John Back * Modified EvtFlatQ2 model to work for all B -> X lepton lepton modes, as well as adding an extra phase space factor to correct for the dip at low q^2, which is enabled by using "FLATQ2 1" instead of just "FLATQ2" in the decay file, - courtesy of Marcin Chrzaszcz & Thomas Blake (LHCb). 13th October 2016 John Back * Added the TauolaCurrentOption decfile keyword to select the hadronic current in Tauola; default is the BaBar-tuned current option (int = 1). * EvtParticles can store double attributes using the functions setAttributeDouble(name, double) and getAttributeDouble(name), which can be useful for storing and retrieving amplitude weights, for example. - The analogous EvtParticle integer attribute interface remains unchanged: setAttribute(name, int) and getAttribute(name). 13th September 2016 John Back * Modified EvtTauolaEngine to use internal Tauola spin matrices for tau pair events by temporarily setting the PDG id of the mother as a boson, keeping the same 4-momentum. * The BaBar hadronic currents are now used by default. * Also added the ability to change some Tauola parameters using the "Define" keyword in decay files. * Added an example decay file illustrating the new features: validation/TauolaFiles/Btautau.dec 9th September 2016 Michal Kreps * Reimplement code in EvtBTo3pi.F, EvtBTo3piMPP.F, EvtBTo3piP00.F and EvtBToKpipi.F in C++ in order to remove dependence on Fortran compiler. - With this, there is no internal Fortran code in EvtGen. === ## R01-06-00 1st June 2016 John Back * New tag incorporating all changes below. * Recommended external packages are - HepMC 2.06.09 - pythia 8.186 - Photos++ 3.61 - Tauola++ 1.1.5 28th April 2016 Michal Kreps * For Ds+ --> 2pi+ pi- there was double counting of branching fraction resulting in total branching fraction being 1.5 times larger than measured one. - Fix by revisiting submodes, which now fill total Ds --> 3pi. 25th April 2016 Michal Kreps * Added DECAY.DEC/XML, which contain updated semileptonic charm and beauty branching fractions using the 2014 PDG, tuned to minimize disagreements between measurements and EvtGen for both inclusive and exclusive decays. * Updated the evt.pdl particle properties file to the PDG 2014 edition. * Implemented new LQCD form factors for Lb --> L mu mu from arXiv paper 1602.01399 (EvtRareLbToLllFFlQCD); old LQCD form factors are removed. 18th March 2016 John Back * Fixed incorrect spinor algebra used in S1 -> 1/2 S2, 1/2 -> S3 S4 decays in EvtDiracParticle::rotateToHelicityBasis() functions, - courtesy of Luis Miguel Garcia Martin and the IFIC Valencia LHCb group. 19th Feburary 2016 John Back * Fixed bug in the definition of the initial spinor term Sinit in EvtRareLbToLll::HadronicAmpRS(), - from Tom Blake (LHCb). 12th February 2016 John Back * From LHCb, added extensions to the EvtHQET2(FF) model for semitauonic decays from Brian Hamilton, which needs a patch to EvtSemiLeptonicAmp from Jack Wimberley to ensure that the q^2 range is physical when finding the maximum amplitude probability. 2nd December 2015 John Back * From LHCb, added EvtKStopizmumu model for KS -> pi0 mu mu decays based on JHEP08(1998)004, - courtesy of Veronika Chobanova, Diego Martinez Santos and Jeremy Dalseno. * Added EvtConst::Fermi for Fermi coupling constant. === ## R01-05-00 21st October 2015 John Back * New tag incorporating all changes below. * Recommended external packages are - HepMC 2.06.09 - pythia 8.186 - Photos++ 3.61 - Tauola++ 1.1.5 * Added the EvtB2MuMuMuNu model for simulating the very rare four-leptonic decays B- -> mu+ mu- anti-nu_mu mu-, - courtesy Nikolai Nikitin. 16th October 2015 John Back * Updated the configure script to automatically select the library names for PHOTOS++; version 3.56 and below uses Fortran, version 3.61 and above uses C++ only (default). Avoid using v3.60, since it does not work. This needs the PHOTOS libraries built before EvtGen is configured. Modified setupEvtGen.sh to use Photos++ v3.61. 7th October 2015 John Back * Updated EvtGenExternal/EvtPhotosEngine to check that additional particles from the outgoing vertex are indeed (FSR) photons, since later versions of PHOTOS introduce pair emission, where particles may not always be photons. * Added the genRootDecayChain.cc validation program to create ROOT files containing information about the complete decay tree. Two example test decay files BKstarGamma.dec and BuDst0rhop.dec can be used with this; the first tests PHOTOS, the second looks at sequential decay chain storage. The plotBKstarGamma.C ROOT macro can be used for B -> K* gamma plots. 2nd October 2015 John Back * Modified EvtSVPHelAmp and added a new EvtSVPHelCPMix model, implementing the complete mixing phenomenology of Bs to vector gamma decays, - courtesy of Clara Remon (LHCb). * EvtD0mixDalitz code: cleanup, inverted q/p for decays of D0bar (simplifies user decay files) and fixed y parameter bug, - courtesy of Jordi Tico (LHCb). * Changed the initialisation order of the infrared cut-off in EvtPhotosEngine. This actually has no effect, since the exponentiation function sets it to the same 1e-7 value, but it is now in the correct order if we need to update it. * Removed all remaining obsolete pragma (Win32) warnings from some classes. 23rd September 2015 Michal Kreps * Reimplement the real Spence function in C++ and removed its fortran implementation. 15th September 2015 Michal Kreps * Fixed accessed uninitialised memory in EvtPDL.cpp, line 213. * Modified the configure and setupEvtGen.sh scripts to work on Mac; needed Mac compilation patch files added to the new "platform" subdirectory. 10th September 2015 John Back * Updated setupEvtGen.sh to use the recommended external packages: - HepMC 2.06.09, pythia 8.186, Photos++ 3.56 and Tauola++ 1.1.5. * Fixed form-factor calculations for the BTOSLLBALL model 6 used to generate b -> sll decays, - courtesy of Christoph Langenbruch and David Loh (LHCb). - Affects B->K*ll, B->rholl and B->omegall, particularly the electron modes. * In the validation directory, added runPhotosTest.sh for testing FSR in Upsilon(4S) -> e+ e- decays, and changed the plot comparison scripts to use the 2nd directory "oldRootFiles" (which could be a soft-link) for including ROOT histograms made from a previous version of EvtGen. 27th August 2015 John Back * Added Mersenne-Twister random number generator (RNG) EvtMTRandomEngine. - It requires c++11 compiler features (>= gcc 4.7), which should automatically be enabled by the configure script. - Introduced the preprocessor environment variable EVTGEN_CPP11 for c++11 features. - EvtMTRandomEngine is the default RNG for the validation and test examples if c++11 features are enabled. * Added a phase-space test validation/genPHSP.sh and PhaseSpacePlots.C to visually check the flatness of Dalitz plots in order to ensure that the RNG is not producing biased results that depend on particle ordering. * Added the models EvtbsToLLLLAmp and EvtbsToLLLLHyperCP for B0_q -> l+ l- l+ l- decays (SM and one supersymmetric scenario), - courtesy of Nikolai Nikitin and Konstantin Toms. - Documentation provided in doc/evt_BQTOLLLL_model.pdf and doc/evt_BQTOLLLLHYPERCP_model.pdf. * Changed the installation and set-up script name to be just setupEvtGen.sh; it uses the VERSION variable to specify the required tag. List of tags are available using either "svn ls -v http://svn.cern.ch/guest/evtgen/tags" or by going to http://svn.cern.ch/guest/evtgen/tags in a web browser. 12th June 2015 John Back * Changed the width of chi_b1 in evt.pdl from 9.8928 GeV (!) to zero. 1st May 2015 John Back * Added Bc -> scalar ell nu (EvtBcSMuNu) and Bc -> tensor ell nu (EvtBcTMuNu) decays, - courtesy of Jack Wimberley, LHCb. - Also included the chi_c1 mode for EvtBcVMuNu. === ## R01-04-00 2nd April 2015 John Back * Removed the EvtStdlibRandomEngine class since this can produce biases to kinematic distributions when one or more of the daughters is a resonance, such as B0 -> K pi psi - (thanks to Antonio Augusto Alves Jr who discovered this issue). - EvtSimpleRandomEngine is now the default random number generator in the validation and test examples. * Incorporated several additions and modifications from LHCb: a) From Michal Kreps, Tom Blake & Christoph Langenbruch, added rare Lb --> Lambda^(*) ell ell models described in arXiv:1108.6129, with various form factors from Gutsche et al. (arXiv:1301.3737) and lattice QCD (arXiv:1212.4827) b) From Andrew Crocombe, implemented Bs --> K* form factors from Ball-Zwicky and z-parametrization form factors from arXiv:1006.4945 for EvtbTosllBallFF c) Christoph Langenbruch fixed the Bs -> phi ll form factors in EvtbTosllBallFF; T3 showed a non-physical pole at very low q2 which significantly affected the electron mode d) From Michal Kreps, removed semicolons from wrong places to clear warnings when compiled with the "-pedantic" option. 9th October 2014 John Back * Change svnweb.cern.ch to svn.cern.ch in the setup script. 1st April 2014 John Back * In EvtReport, modified the logging output severity status flags to have the "EVTGEN_" prefix, e.g. INFO becomes EVTGEN_INFO. * The global report() function has been renamed to EvtGenReport(). 31st March 2014 John Back * Added the ability to store named attributes for EvtParticles in the form of a map. The setAttribute(name, value) stores the required value, while getAttribute(name) retrieves the integer value. This is used in EvtPhotosEngine to specify the final-state radiation "FSR" attribute to 1 for any additional photons (EvtPhotonParticles) created by Photos++. It also stores the "ISR" attribute, but this is always set to zero, since only FSR photons are created. If the named attribute does not exist, then getAttribute() returns zero. 29th January 2014 Daniel Craik * Removed mass assertion on GS shape in EvtDalitzReso to allow it to also be used for charged rho resonances. 27th January 2014 John Back * Minor corrections to Vub models to remove further gcc 4.8 warnings. * Updated configure script to work for MacOS clang (from Genser team). === ## R01-03-00 9th January 2014 John Back * New tag version "1.3.0", incorporating all changes below. * Replaced auto-install script to work with this version as well as the latest versions of all external generator packages. * Updated README to mention the new CERN-based web pages for Photos++ and Tauola++. 8th January 2014 John Back * Fix gcc 4.6 and 4.8 compilation warnings, - courtesy of Patrick Robbe (LHCb); - main changes are removal of unused variables. * Changed the EvtPythiaEngine class and configure script to use new Pythia 8 header locations; Pythia 8.180 or above is now required. 7th January 2014 John Back * Modified EvtBCVFF to correct the Kiselev form factors - from Jack Wimberley (LHCb). 9th October 2013 Daniel Craik * Added Gounaris-Sakurai and Gaussian shapes to EvtGenericDalitz and set sensible defaults for LASS parameters. 19th September 2013 John Back * Modified EvtGenExternal/EvtPythiaEngine to keep track of any new particles that are added to the default Pythia database to avoid duplicating particle/anti-particle entries that could override previously defined Pythia decay chains. 18th September 2013 John Back * Added Mac OS flags for the configure script and src/Makefile. 15th July 2013 Daniel Craik * Added flag to turn on scaling of LASS amplitude by M/q in EvtDalitzReso 15th July 2013 Daniel Craik * EvtParserXML now accepts file names containing environment variables, exponential non-resonant shape in EvtDalitzReso now defined as exp(-alpha*m^2), LASS shape in EvtDalitzReso now takes a cutoff parameter 4th July 2013 Daniel Craik * Added LASS, exponential non-resonant and linear non-resonant shapes to EvtGenericDalitz. 3rd July 2013 Daniel Craik * Fixed auto-install script for R01-02-00. 1st July 2013 Daniel Craik * Added auto-install script for R01-02-00. === ## R01-02-00 15th May 2013 John Back * New tag, version "1.2.0", incorporating all changes below. 14th May 2013 Michal Kreps * Added Blatt-Weisskopf barrier factors up to L=5 in EvtGenBase/EvtBlattWeisskopf::compute(). 14th May 2013 John Back * Added additional entries (appended at the end) to the evt.pdl particle data file - courtesy of Romulus Godang and Belle II colleagues. 14th March 2013 John Back * Added the method EvtParticle::getPDGId() to get the PDG integer for a particle directly (which just calls EvtPDL::getStdHep()). * Added a check in EvtPhotosEngine::doDecay to skip Photos if a given particle has too many daughters (>= 10) to avoid a problem with a hard coded upper limit in the Photos PHOENE subroutine. 2nd February 2013 Daniel Craik * Updated EvtDalitzTable to estimate probMax when it is missing from a Dalitz model. 1st February 2013 John Back * Added the ability to read in Pythia 6 commands in ascii decay files in EvtDecayTable::readDecayFile (this was already possible in xml files). * Modified the Photos++ engine default settings to be more suited to B decays (from LHCb defaults). 31st January 2013 John Back * Added the ability to read in Pythia 8 commands in ascii decay files in EvtDecayTable::readDecayFile. They can be set using the syntax: "PythiaTypeParam module:variable=value", where Type = Generic, Alias or Both for specifying whether the parameter is for the generic or alias Pythia decay engines (or both). The 2nd argument must not contain any spaces. Fixed the list of commands strings being used in the EvtPythiaEngine class (i.e. Pythia parameters that can be set via decay files). 31st January 2013 Daniel Craik * Added named parameters to various decay models. 30th January 2013 John Back * Fixed some of the parameter arguments used in the EvtSVSCPiso model. 24th January 2013 John Back * Set the Photos++ and Tauola++ models to use the EvtGen random number engine when useEvtGenRandom is set to true in the EvtExternalGenList constructor. 23rd January 2013 John Back * Added EvtGenExternal/EvtPythiaRandom to allow the use of the EvtGen random number engine to also be used for the random engine for Pythia 8. * Added a boolean (useEvtGenRandom, default = true) within the EvtExternalGenList constructor to use this feature. 18th December 2012 John Back * Corrected some wrong daughter ordering assignments for decay modes 5 and 12 in EvtDDalitz. Updated validation/DalitzDecays.xml to also contain D decay mode 12, as well as various modes that may use K_S0 and K_L0. * Added validation/genDDalitzModes.sh and updated validation/compareDalitz.C to do a complete comparison of the D Dalitz modes with the xml versions. 11th December 2012 Daniel Craik * Updated the Xml parser to support named model parameters. * Updated the generic Dalitz model to use named model parameters as an example. 15th October 2012 John Back * Make EvtSimpleRandomEngine inherit from EvtRandomEngine to avoid crash in EvtGen.cpp when no random engine is defined - (from Bjoern Spruck). === ## R01-01-00 4th October 2012 John Back * New tag, version "1.1.0", incorporating all changes below. * Provide proper default constructors for EvtVector4R and EvtPhotonParticle. Modified the validation and test code to also compile/link in the case of no external generators being included. 3rd October 2012 John Back * Corrected the t3 vector form factor values for the Ball-Zwicky 2005 model (modelId = 6) in EvtbTosllBallFF::getVectorFF(), which were set to t3tilde instead. 18th September 2012 John Back * Moved the external generator engines to a new sub-directory EvtGenExternal. Building the code now creates 2 libraries: libEvtGen.so (Base+Models) and libEvtGenExternal.so. - This allows anyone to ignore using the new external generators if required (by not creating/loading the 2nd library). * Added prefix option to the configure script/Makefile to allow the user to specify an installation directory for the include files, libraries, DECAY.DEC and evt.pdl files (for Genser). 14th September 2012 Michal Kreps * Fixed the calculation of the angle between decay planes in the function EvtKine::EvtDecayAngleChi. Fixed typo in EvtLb2Lll decay model. Only some NP scenarious could be affected, SM one is definitely unaffected. 13th September 2012 John Back * Added the use of the environment variables EVTGEN_PHOTOS, EVTGEN_PYTHIA and EVTGEN_TAUOLA to specify if the Photos, Pythia and/or Tauola engine classes are used or not. These variables are set by the configure script, depending if the library paths are specified for these generators. === ## R01-00-01 12th September 2012 John Back * New tag incorporating all changes below, since R01-00-00. 11th September 2012 John Back * Modified the Photos and Tauola engine classes to use the new Photospp and Tauolapp namespaces that are present in the latest versions of Photos++(3.5) and Tauola++(1.0.7). * Updated the configure file to get the correct location of the Tauola++ include files. * Added the D0->pi+pi-pi0 decay mode in EvtDDalitz - from Marco Gersabeck and Frederic Dreyer (LHCb). * Added new decay models/classes from Alexey Luchinsky (LHCb): EvtBcVMuNu, EvtTVP, EvtWnPi, EvtSVP, EvtXPsiGamma, EvtBcVNpi 29th June 2012 John Back * Corrected mass(squared) variables filled in the Dalitz TTree in validation/genExampleRootFiles. 15th May 2012 Daniel Craik * Updated EvtD0gammaDalitz to deal with D mesons from neutral B->DK * Added save function to validation/compareDalitz.C. 11th May 2012 Daniel Craik * Replaced BaBar specific configuration for BlattWeisskopf birth factors. * Updated XML conversion script to handle new configuration. * Fixed some bugs in the XML conversion script related to particle modifications. 9th May 2012 Daniel Craik * Added latex documentation for xml decay files. 2nd May 2012 Daniel Craik * Added resDaughters attribute to the Dalitz resonance xml tag to simplify defining symmetric resonances. Updated validation xml files to use the new functionality. 27th April 2012 Daniel Craik * Upgraded EvtGenericDalitz to use EvtDalitzReso for resonances. * Added validation to compare EvtGenericDalitz to all 11 EvtDDalitz modes. * Added a root macro to quickly compare two Dalitz decays for validation. 24th April 2012 John Back * Solved two bugs in the EvtD0gammaDalitz model (from Jordi Tico, LHCb): configuration of the conjugated model, and using only the B charge to determine the model used, not the D flavour. 17th April 2012 Daniel Craik * Updated the GenericDalitz validation code to use the same probMax values as DDalitz. * Added XML decay file parsing to EvtGen::readUDecay. - Dec files are still the default. 30th March 2012 John Back * Update maximum probability values in EvtDDalitz::initProbMax() for all DDalitz modes. 23rd March 2012 John Back * Added the EvtEta2MuMuGamma decay model from LHCb. 21st March 2012 John Back * Added EvtD0gammaDalitz decay model from LHCb. 20th March 2012 Daniel Craik * Added backwards compatibility for Pythia 6 commands in the XML configuration. * Updated decay file conversion tool to convert JetSetPar lines to pythia6Param tags. 19th March 2012 Daniel Craik * Added infrastructure to pass commands to external generators. * XML config now takes Pythia8 configuration commands. 16th March 2012 Daniel Craik * Added the ability to define particles from the PDL for Dalitz decay resonances instead of defining mass, width and spin seperately. * Renamed the lifetime attribute of Dalitz decay resonaces to width to avoid confusion. * Added further validation code for the generic Dalitz model. 15th March 2012 Daniel Craik * Added validation code for xml decay files and the generic Dalitz model. === ## R01-00-00 6th March 2012 John Back * First official version for Genser (evtgen 1.0.0) that includes support for external generators: Pythia8, Photos++ and Tauola++. * This also includes a preliminary version of creating Dalitz plot decay models using EvtGenericDalitz. diff --git a/src/EvtGenModels/EvtSLBaryonAmp.cpp b/src/EvtGenModels/EvtSLBaryonAmp.cpp index 277d5e1..2523662 100644 --- a/src/EvtGenModels/EvtSLBaryonAmp.cpp +++ b/src/EvtGenModels/EvtSLBaryonAmp.cpp @@ -1,849 +1,849 @@ /*********************************************************************** * Copyright 1998-2020 CERN for the benefit of the EvtGen authors * * * * This file is part of EvtGen. * * * * EvtGen is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * EvtGen is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with EvtGen. If not, see . * ***********************************************************************/ #include "EvtGenModels/EvtSLBaryonAmp.hh" #include "EvtGenBase/EvtAmp.hh" #include "EvtGenBase/EvtDiracParticle.hh" #include "EvtGenBase/EvtDiracSpinor.hh" #include "EvtGenBase/EvtGammaMatrix.hh" #include "EvtGenBase/EvtGenKine.hh" #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRaritaSchwinger.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtSemiLeptonicFF.hh" #include "EvtGenBase/EvtTensor4C.hh" #include "EvtGenBase/EvtVector4C.hh" #include using std::endl; EvtSLBaryonAmp::~EvtSLBaryonAmp() { } void EvtSLBaryonAmp::CalcAmp( EvtParticle* parent, EvtAmp& amp, EvtSemiLeptonicFF* FormFactors ) { static EvtId EM = EvtPDL::getId( "e-" ); static EvtId MUM = EvtPDL::getId( "mu-" ); static EvtId TAUM = EvtPDL::getId( "tau-" ); static EvtId EP = EvtPDL::getId( "e+" ); static EvtId MUP = EvtPDL::getId( "mu+" ); static EvtId TAUP = EvtPDL::getId( "tau+" ); //Add the lepton and neutrino 4 momenta to find q2 EvtVector4R q = parent->getDaug( 1 )->getP4() + parent->getDaug( 2 )->getP4(); double q2 = ( q.mass2() ); double f1v, f1a, f2v, f2a; double m_meson = parent->getDaug( 0 )->mass(); FormFactors->getbaryonff( parent->getId(), parent->getDaug( 0 )->getId(), q2, m_meson, &f1v, &f1a, &f2v, &f2a ); EvtVector4R p4b; p4b.set( parent->mass(), 0.0, 0.0, 0.0 ); EvtVector4C temp_00_term1; EvtVector4C temp_00_term2; EvtVector4C temp_01_term1; EvtVector4C temp_01_term2; EvtVector4C temp_10_term1; EvtVector4C temp_10_term2; EvtVector4C temp_11_term1; EvtVector4C temp_11_term2; EvtDiracSpinor p0 = parent->sp( 0 ); EvtDiracSpinor p1 = parent->sp( 1 ); EvtDiracSpinor d0 = parent->getDaug( 0 )->spParent( 0 ); EvtDiracSpinor d1 = parent->getDaug( 0 )->spParent( 1 ); temp_00_term1.set( 0, f1v * ( d0 * ( EvtGammaMatrix::g0() * p0 ) ) ); temp_00_term2.set( 0, f1a * ( d0 * ( ( EvtGammaMatrix::g0() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_01_term1.set( 0, f1v * ( d0 * ( EvtGammaMatrix::g0() * p1 ) ) ); temp_01_term2.set( 0, f1a * ( d0 * ( ( EvtGammaMatrix::g0() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_10_term1.set( 0, f1v * ( d1 * ( EvtGammaMatrix::g0() * p0 ) ) ); temp_10_term2.set( 0, f1a * ( d1 * ( ( EvtGammaMatrix::g0() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_11_term1.set( 0, f1v * ( d1 * ( EvtGammaMatrix::g0() * p1 ) ) ); temp_11_term2.set( 0, f1a * ( d1 * ( ( EvtGammaMatrix::g0() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_00_term1.set( 1, f1v * ( d0 * ( EvtGammaMatrix::g1() * p0 ) ) ); temp_00_term2.set( 1, f1a * ( d0 * ( ( EvtGammaMatrix::g1() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_01_term1.set( 1, f1v * ( d0 * ( EvtGammaMatrix::g1() * p1 ) ) ); temp_01_term2.set( 1, f1a * ( d0 * ( ( EvtGammaMatrix::g1() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_10_term1.set( 1, f1v * ( d1 * ( EvtGammaMatrix::g1() * p0 ) ) ); temp_10_term2.set( 1, f1a * ( d1 * ( ( EvtGammaMatrix::g1() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_11_term1.set( 1, f1v * ( d1 * ( EvtGammaMatrix::g1() * p1 ) ) ); temp_11_term2.set( 1, f1a * ( d1 * ( ( EvtGammaMatrix::g1() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_00_term1.set( 2, f1v * ( d0 * ( EvtGammaMatrix::g2() * p0 ) ) ); temp_00_term2.set( 2, f1a * ( d0 * ( ( EvtGammaMatrix::g2() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_01_term1.set( 2, f1v * ( d0 * ( EvtGammaMatrix::g2() * p1 ) ) ); temp_01_term2.set( 2, f1a * ( d0 * ( ( EvtGammaMatrix::g2() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_10_term1.set( 2, f1v * ( d1 * ( EvtGammaMatrix::g2() * p0 ) ) ); temp_10_term2.set( 2, f1a * ( d1 * ( ( EvtGammaMatrix::g2() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_11_term1.set( 2, f1v * ( d1 * ( EvtGammaMatrix::g2() * p1 ) ) ); temp_11_term2.set( 2, f1a * ( d1 * ( ( EvtGammaMatrix::g2() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_00_term1.set( 3, f1v * ( d0 * ( EvtGammaMatrix::g3() * p0 ) ) ); temp_00_term2.set( 3, f1a * ( d0 * ( ( EvtGammaMatrix::g3() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_01_term1.set( 3, f1v * ( d0 * ( EvtGammaMatrix::g3() * p1 ) ) ); temp_01_term2.set( 3, f1a * ( d0 * ( ( EvtGammaMatrix::g3() * EvtGammaMatrix::g5() ) * p1 ) ) ); temp_10_term1.set( 3, f1v * ( d1 * ( EvtGammaMatrix::g3() * p0 ) ) ); temp_10_term2.set( 3, f1a * ( d1 * ( ( EvtGammaMatrix::g3() * EvtGammaMatrix::g5() ) * p0 ) ) ); temp_11_term1.set( 3, f1v * ( d1 * ( EvtGammaMatrix::g3() * p1 ) ) ); temp_11_term2.set( 3, f1a * ( d1 * ( ( EvtGammaMatrix::g3() * EvtGammaMatrix::g5() ) * p1 ) ) ); EvtVector4C l1, l2; EvtId l_num = parent->getDaug( 1 )->getId(); if ( l_num == EM || l_num == MUM || l_num == TAUM ) { l1 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 0 ), parent->getDaug( 2 )->spParentNeutrino() ); l2 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 1 ), parent->getDaug( 2 )->spParentNeutrino() ); } else { if ( l_num == EP || l_num == MUP || l_num == TAUP ) { l1 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 0 ) ); l2 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 1 ) ); } else { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Wrong lepton number" << endl; } } amp.vertex( 0, 0, 0, l1.cont( temp_00_term1 + temp_00_term2 ) ); amp.vertex( 0, 0, 1, l2.cont( temp_00_term1 + temp_00_term2 ) ); amp.vertex( 0, 1, 0, l1.cont( temp_01_term1 + temp_01_term2 ) ); amp.vertex( 0, 1, 1, l2.cont( temp_01_term1 + temp_01_term2 ) ); amp.vertex( 1, 0, 0, l1.cont( temp_10_term1 + temp_10_term2 ) ); amp.vertex( 1, 0, 1, l2.cont( temp_10_term1 + temp_10_term2 ) ); amp.vertex( 1, 1, 0, l1.cont( temp_11_term1 + temp_11_term2 ) ); amp.vertex( 1, 1, 1, l2.cont( temp_11_term1 + temp_11_term2 ) ); return; } double EvtSLBaryonAmp::CalcMaxProb( EvtId parent, EvtId baryon, EvtId lepton, EvtId nudaug, EvtSemiLeptonicFF* FormFactors, EvtComplex r00, EvtComplex r01, EvtComplex r10, EvtComplex r11 ) { //This routine takes the arguements parent, baryon, and lepton //number, and a form factor model, and returns a maximum //probability for this semileptonic form factor model. A //brute force method is used. The 2D cos theta lepton and //q2 phase space is probed. //Start by declaring a particle at rest. //It only makes sense to have a scalar parent. For now. //This should be generalized later. // EvtScalarParticle *scalar_part; // scalar_part=new EvtScalarParticle; EvtDiracParticle* dirac_part; EvtParticle* root_part; dirac_part = new EvtDiracParticle; //cludge to avoid generating random numbers! // scalar_part->noLifeTime(); dirac_part->noLifeTime(); EvtVector4R p_init; p_init.set( EvtPDL::getMass( parent ), 0.0, 0.0, 0.0 ); // scalar_part->init(parent,p_init); // root_part=(EvtParticle *)scalar_part; // root_part->set_type(EvtSpinType::SCALAR); dirac_part->init( parent, p_init ); root_part = (EvtParticle*)dirac_part; root_part->setDiagonalSpinDensity(); EvtParticle *daughter, *lep, *trino; EvtAmp amp; EvtId listdaug[3]; listdaug[0] = baryon; listdaug[1] = lepton; listdaug[2] = nudaug; amp.init( parent, 3, listdaug ); root_part->makeDaughters( 3, listdaug ); daughter = root_part->getDaug( 0 ); lep = root_part->getDaug( 1 ); trino = root_part->getDaug( 2 ); //cludge to avoid generating random numbers! daughter->noLifeTime(); lep->noLifeTime(); trino->noLifeTime(); //Initial particle is unpolarized, well it is a scalar so it is //trivial EvtSpinDensity rho; rho.setDiag( root_part->getSpinStates() ); double mass[3]; double m = root_part->mass(); EvtVector4R p4baryon, p4lepton, p4nu, p4w; double q2max; double q2, elepton, plepton; int i, j; double erho, prho, costl; double maxfoundprob = 0.0; double prob = -10.0; int massiter; for ( massiter = 0; massiter < 3; massiter++ ) { mass[0] = EvtPDL::getMass( baryon ); mass[1] = EvtPDL::getMass( lepton ); mass[2] = EvtPDL::getMass( nudaug ); if ( massiter == 1 ) { mass[0] = EvtPDL::getMinMass( baryon ); } if ( massiter == 2 ) { mass[0] = EvtPDL::getMaxMass( baryon ); } q2max = ( m - mass[0] ) * ( m - mass[0] ); //loop over q2 for ( i = 0; i < 25; i++ ) { q2 = ( ( i + 0.5 ) * q2max ) / 25.0; erho = ( m * m + mass[0] * mass[0] - q2 ) / ( 2.0 * m ); prho = sqrt( erho * erho - mass[0] * mass[0] ); p4baryon.set( erho, 0.0, 0.0, -1.0 * prho ); p4w.set( m - erho, 0.0, 0.0, prho ); //This is in the W rest frame elepton = ( q2 + mass[1] * mass[1] ) / ( 2.0 * sqrt( q2 ) ); plepton = sqrt( elepton * elepton - mass[1] * mass[1] ); double probctl[3]; for ( j = 0; j < 3; j++ ) { costl = 0.99 * ( j - 1.0 ); //These are in the W rest frame. Need to boost out into //the B frame. p4lepton.set( elepton, 0.0, plepton * sqrt( 1.0 - costl * costl ), plepton * costl ); p4nu.set( plepton, 0.0, -1.0 * plepton * sqrt( 1.0 - costl * costl ), -1.0 * plepton * costl ); EvtVector4R boost( ( m - erho ), 0.0, 0.0, 1.0 * prho ); p4lepton = boostTo( p4lepton, boost ); p4nu = boostTo( p4nu, boost ); //Now initialize the daughters... daughter->init( baryon, p4baryon ); lep->init( lepton, p4lepton ); trino->init( nudaug, p4nu ); CalcAmp( root_part, amp, FormFactors, r00, r01, r10, r11 ); //Now find the probability at this q2 and cos theta lepton point //and compare to maxfoundprob. //Do a little magic to get the probability!! prob = rho.normalizedProb( amp.getSpinDensity() ); probctl[j] = prob; } //probclt contains prob at ctl=-1,0,1. //prob=a+b*ctl+c*ctl^2 double a = probctl[1]; double b = 0.5 * ( probctl[2] - probctl[0] ); double c = 0.5 * ( probctl[2] + probctl[0] ) - probctl[1]; prob = probctl[0]; if ( probctl[1] > prob ) prob = probctl[1]; if ( probctl[2] > prob ) prob = probctl[2]; if ( fabs( c ) > 1e-20 ) { double ctlx = -0.5 * b / c; if ( fabs( ctlx ) < 1.0 ) { double probtmp = a + b * ctlx + c * ctlx * ctlx; if ( probtmp > prob ) prob = probtmp; } } //EvtGenReport(EVTGEN_DEBUG,"EvtGen") << "prob,probctl:"< maxfoundprob ) { maxfoundprob = prob; } } if ( EvtPDL::getWidth( baryon ) <= 0.0 ) { //if the particle is narrow dont bother with changing the mass. massiter = 4; } } root_part->deleteTree(); maxfoundprob *= 1.1; return maxfoundprob; } void EvtSLBaryonAmp::CalcAmp( EvtParticle* parent, EvtAmp& amp, EvtSemiLeptonicFF* FormFactors, EvtComplex r00, EvtComplex r01, EvtComplex r10, EvtComplex r11 ) { // Leptons static EvtId EM = EvtPDL::getId( "e-" ); static EvtId MUM = EvtPDL::getId( "mu-" ); static EvtId TAUM = EvtPDL::getId( "tau-" ); // Anti-Leptons static EvtId EP = EvtPDL::getId( "e+" ); static EvtId MUP = EvtPDL::getId( "mu+" ); static EvtId TAUP = EvtPDL::getId( "tau+" ); // Baryons static EvtId LAMCP = EvtPDL::getId( "Lambda_c+" ); static EvtId LAMC1P = EvtPDL::getId( "Lambda_c(2593)+" ); static EvtId LAMC2P = EvtPDL::getId( "Lambda_c(2625)+" ); static EvtId LAMB = EvtPDL::getId( "Lambda_b0" ); static EvtId PRO = EvtPDL::getId( "p+" ); static EvtId N1440 = EvtPDL::getId( "N(1440)+" ); static EvtId N1520 = EvtPDL::getId( "N(1520)+" ); static EvtId N1535 = EvtPDL::getId( "N(1535)+" ); static EvtId N1720 = EvtPDL::getId( "N(1720)+" ); static EvtId N1650 = EvtPDL::getId( "N(1650)+" ); static EvtId N1700 = EvtPDL::getId( "N(1700)+" ); static EvtId N1710 = EvtPDL::getId( "N(1710)+" ); static EvtId N1875 = EvtPDL::getId( "N(1875)+" ); static EvtId N1900 = EvtPDL::getId( "N(1900)+" ); // Anti-Baryons static EvtId LAMCM = EvtPDL::getId( "anti-Lambda_c-" ); static EvtId LAMC1M = EvtPDL::getId( "anti-Lambda_c(2593)-" ); static EvtId LAMC2M = EvtPDL::getId( "anti-Lambda_c(2625)-" ); static EvtId LAMBB = EvtPDL::getId( "anti-Lambda_b0" ); static EvtId PROB = EvtPDL::getId( "anti-p-" ); static EvtId N1440B = EvtPDL::getId( "anti-N(1440)-" ); static EvtId N1520B = EvtPDL::getId( "anti-N(1520)-" ); static EvtId N1535B = EvtPDL::getId( "anti-N(1535)-" ); static EvtId N1720B = EvtPDL::getId( "anti-N(1720)-" ); static EvtId N1650B = EvtPDL::getId( "anti-N(1650)-" ); static EvtId N1700B = EvtPDL::getId( "anti-N(1700)-" ); static EvtId N1710B = EvtPDL::getId( "anti-N(1710)-" ); static EvtId N1875B = EvtPDL::getId( "anti-N(1875)-" ); static EvtId N1900B = EvtPDL::getId( "anti-N(1900)-" ); // Set the spin density matrix of the parent baryon EvtSpinDensity rho; rho.setDim( 2 ); rho.set( 0, 0, r00 ); rho.set( 0, 1, r01 ); rho.set( 1, 0, r10 ); rho.set( 1, 1, r11 ); EvtVector4R vector4P = parent->getP4Lab(); double pmag = vector4P.d3mag(); - double cosTheta = vector4P.get( 3 ) / pmag; + double cosTheta = pmag > 0.0 ? vector4P.get( 3 ) / pmag : 1.0; double theta = acos( cosTheta ); double phi = atan2( vector4P.get( 2 ), vector4P.get( 1 ) ); parent->setSpinDensityForwardHelicityBasis( rho, phi, theta, 0.0 ); //parent->setSpinDensityForward(rho); // Set the four momentum of the parent baryon in it's rest frame EvtVector4R p4b; p4b.set( parent->mass(), 0.0, 0.0, 0.0 ); // Get the four momentum of the daughter baryon in the parent's rest frame EvtVector4R p4daught = parent->getDaug( 0 )->getP4(); // Add the lepton and neutrino 4 momenta to find q (q^2) EvtVector4R q = parent->getDaug( 1 )->getP4() + parent->getDaug( 2 )->getP4(); double q2 = q.mass2(); EvtId l_num = parent->getDaug( 1 )->getId(); EvtId bar_num = parent->getDaug( 0 )->getId(); EvtId par_num = parent->getId(); double baryonmass = parent->getDaug( 0 )->mass(); // Handle spin-1/2 daughter baryon Dirac spinor cases if ( EvtPDL::getSpinType( parent->getDaug( 0 )->getId() ) == EvtSpinType::DIRAC ) { // Set the form factors double f1, f2, f3, g1, g2, g3; FormFactors->getdiracff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &g1, &g2, &g3 ); - const double form_fact[6] = {f1, f2, f3, g1, g2, g3}; + const double form_fact[6] = { f1, f2, f3, g1, g2, g3 }; EvtVector4C b11, b12, b21, b22, l1, l2; // Lepton Current if ( l_num == EM || l_num == MUM || l_num == TAUM ) { l1 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 0 ), parent->getDaug( 2 )->spParentNeutrino() ); l2 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 1 ), parent->getDaug( 2 )->spParentNeutrino() ); } else if ( l_num == EP || l_num == MUP || l_num == TAUP ) { l1 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 0 ) ); l2 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 1 ) ); } else { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Wrong lepton number \n"; ::abort(); } // Baryon current // Flag for particle/anti-particle parent, daughter with same/opp. parity // pflag = 0 => particle, same parity parent, daughter // pflag = 1 => particle, opp. parity parent, daughter // pflag = 2 => anti-particle, same parity parent, daughter // pflag = 3 => anti-particle, opp. parity parent, daughter int pflag = 0; // Handle 1/2+ -> 1/2+ first if ( ( par_num == LAMB && bar_num == LAMCP ) || ( par_num == LAMBB && bar_num == LAMCM ) || ( par_num == LAMB && bar_num == PRO ) || ( par_num == LAMBB && bar_num == PROB ) || ( par_num == LAMB && bar_num == N1440 ) || ( par_num == LAMBB && bar_num == N1440B ) || ( par_num == LAMB && bar_num == N1710 ) || ( par_num == LAMBB && bar_num == N1710B ) ) { // Set particle/anti-particle flag if ( bar_num == LAMCP || bar_num == PRO || bar_num == N1440 || bar_num == N1710 ) pflag = 0; else if ( bar_num == LAMCM || bar_num == PROB || bar_num == N1440B || bar_num == N1710B ) pflag = 2; b11 = EvtBaryonVACurrent( parent->getDaug( 0 )->spParent( 0 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b21 = EvtBaryonVACurrent( parent->getDaug( 0 )->spParent( 0 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); b12 = EvtBaryonVACurrent( parent->getDaug( 0 )->spParent( 1 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b22 = EvtBaryonVACurrent( parent->getDaug( 0 )->spParent( 1 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); } // Handle 1/2+ -> 1/2- second else if ( ( par_num == LAMB && bar_num == LAMC1P ) || ( par_num == LAMBB && bar_num == LAMC1M ) || ( par_num == LAMB && bar_num == N1535 ) || ( par_num == LAMBB && bar_num == N1535B ) || ( par_num == LAMB && bar_num == N1650 ) || ( par_num == LAMBB && bar_num == N1650B ) ) { // Set particle/anti-particle flag if ( bar_num == LAMC1P || bar_num == N1535 || bar_num == N1650 ) pflag = 1; else if ( bar_num == LAMC1M || bar_num == N1535B || bar_num == N1650B ) pflag = 3; b11 = EvtBaryonVACurrent( ( parent->getDaug( 0 )->spParent( 0 ) ), ( EvtGammaMatrix::g5() * parent->sp( 0 ) ), p4b, p4daught, form_fact, pflag ); b21 = EvtBaryonVACurrent( ( parent->getDaug( 0 )->spParent( 0 ) ), ( EvtGammaMatrix::g5() * parent->sp( 1 ) ), p4b, p4daught, form_fact, pflag ); b12 = EvtBaryonVACurrent( ( parent->getDaug( 0 )->spParent( 1 ) ), ( EvtGammaMatrix::g5() * parent->sp( 0 ) ), p4b, p4daught, form_fact, pflag ); b22 = EvtBaryonVACurrent( ( parent->getDaug( 0 )->spParent( 1 ) ), ( EvtGammaMatrix::g5() * parent->sp( 1 ) ), p4b, p4daught, form_fact, pflag ); } else { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Dirac semilep. baryon current " << "not implemented for this decay sequence." << std::endl; ::abort(); } amp.vertex( 0, 0, 0, l1 * b11 ); amp.vertex( 0, 0, 1, l2 * b11 ); amp.vertex( 1, 0, 0, l1 * b21 ); amp.vertex( 1, 0, 1, l2 * b21 ); amp.vertex( 0, 1, 0, l1 * b12 ); amp.vertex( 0, 1, 1, l2 * b12 ); amp.vertex( 1, 1, 0, l1 * b22 ); amp.vertex( 1, 1, 1, l2 * b22 ); } // Need special handling for the spin-3/2 daughter baryon // Rarita-Schwinger spinor cases else if ( EvtPDL::getSpinType( parent->getDaug( 0 )->getId() ) == EvtSpinType::RARITASCHWINGER ) { // Set the form factors double f1, f2, f3, f4, g1, g2, g3, g4; FormFactors->getraritaff( par_num, bar_num, q2, baryonmass, &f1, &f2, &f3, &f4, &g1, &g2, &g3, &g4 ); - const double form_fact[8] = {f1, f2, f3, f4, g1, g2, g3, g4}; + const double form_fact[8] = { f1, f2, f3, f4, g1, g2, g3, g4 }; EvtId l_num = parent->getDaug( 1 )->getId(); EvtVector4C b11, b12, b21, b22, b13, b23, b14, b24, l1, l2; // Lepton Current if ( l_num == EM || l_num == MUM || l_num == TAUM ) { // Lepton Current l1 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 0 ), parent->getDaug( 2 )->spParentNeutrino() ); l2 = EvtLeptonVACurrent( parent->getDaug( 1 )->spParent( 1 ), parent->getDaug( 2 )->spParentNeutrino() ); } else if ( l_num == EP || l_num == MUP || l_num == TAUP ) { l1 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 0 ) ); l2 = EvtLeptonVACurrent( parent->getDaug( 2 )->spParentNeutrino(), parent->getDaug( 1 )->spParent( 1 ) ); } else { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Wrong lepton number \n"; } // Baryon Current // Declare particle, anti-particle flag, same/opp. parity // pflag = 0 => particle // pflag = 1 => anti-particle int pflag = 0; // Handle cases of 1/2+ -> 3/2- or 3/2+ if ( ( par_num == LAMB && bar_num == LAMC2P ) || ( par_num == LAMB && bar_num == N1720 ) || ( par_num == LAMB && bar_num == N1520 ) || ( par_num == LAMB && bar_num == N1700 ) || ( par_num == LAMB && bar_num == N1875 ) || ( par_num == LAMB && bar_num == N1900 ) ) { // Set flag for particle case pflag = 0; } else if ( ( par_num == LAMBB && bar_num == LAMC2M ) || ( par_num == LAMBB && bar_num == N1520B ) || ( par_num == LAMBB && bar_num == N1700B ) || ( par_num == LAMBB && bar_num == N1875B ) ) { // Set flag for anti-particle opposite parity case pflag = 1; } // Handle anti-particle case for 1/2+ -> 3/2+ else if ( ( par_num == LAMBB && bar_num == N1720B ) || ( par_num == LAMBB && bar_num == N1900B ) ) { pflag = 2; } else { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Rarita-Schwinger semilep. baryon current " << "not implemented for this decay sequence." << std::endl; ::abort(); } // Baryon current b11 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 0 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b21 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 0 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); b12 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 1 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b22 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 1 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); b13 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 2 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b23 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 2 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); b14 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 3 ), parent->sp( 0 ), p4b, p4daught, form_fact, pflag ); b24 = EvtBaryonVARaritaCurrent( parent->getDaug( 0 )->spRSParent( 3 ), parent->sp( 1 ), p4b, p4daught, form_fact, pflag ); amp.vertex( 0, 0, 0, l1 * b11 ); amp.vertex( 0, 0, 1, l2 * b11 ); amp.vertex( 1, 0, 0, l1 * b21 ); amp.vertex( 1, 0, 1, l2 * b21 ); amp.vertex( 0, 1, 0, l1 * b12 ); amp.vertex( 0, 1, 1, l2 * b12 ); amp.vertex( 1, 1, 0, l1 * b22 ); amp.vertex( 1, 1, 1, l2 * b22 ); amp.vertex( 0, 2, 0, l1 * b13 ); amp.vertex( 0, 2, 1, l2 * b13 ); amp.vertex( 1, 2, 0, l1 * b23 ); amp.vertex( 1, 2, 1, l2 * b23 ); amp.vertex( 0, 3, 0, l1 * b14 ); amp.vertex( 0, 3, 1, l2 * b14 ); amp.vertex( 1, 3, 0, l1 * b24 ); amp.vertex( 1, 3, 1, l2 * b24 ); } } EvtVector4C EvtSLBaryonAmp::EvtBaryonVACurrent( const EvtDiracSpinor& Bf, const EvtDiracSpinor& Bi, EvtVector4R parent, EvtVector4R daught, const double* ff, int pflag ) { // flag == 0 => particle // flag == 1 => particle, opposite parity // flag == 2 => anti-particle, same parity // flag == 3 => anti-particle, opposite parity // particle EvtComplex cv = EvtComplex( 1.0, 0. ); EvtComplex ca = EvtComplex( 1.0, 0. ); EvtComplex cg0 = EvtComplex( 1.0, 0. ); EvtComplex cg5 = EvtComplex( 1.0, 0. ); // antiparticle- same parity parent & daughter if ( pflag == 2 ) { cv = EvtComplex( -1.0, 0. ); ca = EvtComplex( 1.0, 0. ); cg0 = EvtComplex( 1.0, 0.0 ); // Changed cg5 from -i to -1 as appears to fix particle - anti-particle discrepency cg5 = EvtComplex( -1.0, 0.0 ); } // antiparticle- opposite parity parent & daughter else if ( pflag == 3 ) { cv = EvtComplex( 1.0, 0. ); ca = EvtComplex( -1.0, 0. ); // Changed cg0 from -i to -1 as appears to fix particle - anti-particle discrepency cg0 = EvtComplex( -1.0, 0.0 ); cg5 = EvtComplex( 1.0, 0.0 ); } EvtVector4C t[6]; // Term 1 = \bar{u}(p',s')*(F_1(q^2)*\gamma_{mu})*u(p,s) t[0] = cv * EvtLeptonVCurrent( Bf, Bi ); // Term 2 = \bar{u}(p',s')*(F_2(q^2)*(p_{mu}/m_{\Lambda_Q}))*u(p,s) t[1] = cg0 * EvtLeptonSCurrent( Bf, Bi ) * ( parent / parent.mass() ); // Term 3 = \bar{u}(p',s')*(F_3(q^2)*(p'_{mu}/m_{\Lambda_q}))*u(p,s) t[2] = cg0 * EvtLeptonSCurrent( Bf, Bi ) * ( daught / daught.mass() ); // Term 4 = \bar{u}(p',s')*(G_1(q^2)*\gamma_{mu}*\gamma_5)*u(p,s) t[3] = ca * EvtLeptonACurrent( Bf, Bi ); // Term 5 = \bar{u}(p',s')*(G_2(q^2)*(p_{mu}/m_{\Lambda_Q})*\gamma_5)*u(p,s) t[4] = cg5 * EvtLeptonPCurrent( Bf, Bi ) * ( parent / parent.mass() ); // Term 6 = \bar{u}(p',s')*(G_3(q^2)*(p'_{mu}/m_{\Lambda_q})*\gamma_5)*u(p,s) t[5] = cg5 * EvtLeptonPCurrent( Bf, Bi ) * ( daught / daught.mass() ); // Sum the individual terms EvtVector4C current = ( ff[0] * t[0] + ff[1] * t[1] + ff[2] * t[2] - ff[3] * t[3] - ff[4] * t[4] - ff[5] * t[5] ); return current; } EvtVector4C EvtSLBaryonAmp::EvtBaryonVARaritaCurrent( const EvtRaritaSchwinger& Bf, const EvtDiracSpinor& Bi, EvtVector4R parent, EvtVector4R daught, const double* ff, int pflag ) { // flag == 0 => particle // flag == 1 => anti-particle // particle EvtComplex cv = EvtComplex( 1.0, 0. ); EvtComplex ca = EvtComplex( 1.0, 0. ); EvtComplex cg0 = EvtComplex( 1.0, 0. ); EvtComplex cg5 = EvtComplex( 1.0, 0. ); // antiparticle opposite parity if ( pflag == 1 ) { cv = EvtComplex( -1.0, 0. ); ca = EvtComplex( 1.0, 0. ); cg0 = EvtComplex( 1.0, 0.0 ); cg5 = EvtComplex( -1.0, 0.0 ); } // antiparticle same parity else if ( pflag == 2 ) { cv = EvtComplex( 1.0, 0. ); ca = EvtComplex( -1.0, 0. ); cg0 = EvtComplex( -1.0, 0.0 ); cg5 = EvtComplex( 1.0, 0.0 ); } EvtVector4C t[8]; EvtTensor4C id; id.setdiag( 1.0, 1.0, 1.0, 1.0 ); EvtDiracSpinor tmp; for ( int i = 0; i < 4; i++ ) { tmp.set_spinor( i, Bf.getVector( i ) * parent ); } EvtVector4C v1, v2; for ( int i = 0; i < 4; i++ ) { v1.set( i, EvtLeptonSCurrent( Bf.getSpinor( i ), Bi ) ); v2.set( i, EvtLeptonPCurrent( Bf.getSpinor( i ), Bi ) ); } // Term 1 = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q})*(F_1(q^2)*\gamma_{mu})*u(p,s) t[0] = ( cv / parent.mass() ) * EvtLeptonVCurrent( tmp, Bi ); // Term 2 // = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q})*(F_2(q^2)*(p_{mu}/m_{\Lambda_Q}))*u(p,s) t[1] = ( ( cg0 / parent.mass() ) * EvtLeptonSCurrent( tmp, Bi ) ) * ( parent / parent.mass() ); // Term 3 // = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q})*(F_3(q^2)*(p'_{mu}/m_{\Lambda_q}))*u(p,s) t[2] = ( ( cg0 / parent.mass() ) * EvtLeptonSCurrent( tmp, Bi ) ) * ( daught / daught.mass() ); // Term 4 = \bar{u}^{\alpha}(p',s')*(F_4(q^2)*g_{\alpha,\mu})*u(p,s) t[3] = cg0 * ( id.cont2( v1 ) ); // Term 5 // = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q})*(G_1(q^2)*\gamma_{mu}*\gamma_5)*u(p,s) t[4] = ( ca / parent.mass() ) * EvtLeptonACurrent( tmp, Bi ); // Term 6 // = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q}) // *(G_2(q^2)*(p_{mu}/m_{\Lambda_Q})*\gamma_5)*u(p,s) t[5] = ( ( cg5 / parent.mass() ) * EvtLeptonPCurrent( tmp, Bi ) ) * ( parent / parent.mass() ); // Term 7 // = \bar{u}^{\alpha}(p',s')*(p_{\alpha}/m_{\Lambda_Q}) // *(G_3(q^2)*(p'_{mu}/m_{\Lambda_q})*\gamma_5)*u(p,s) t[6] = ( ( cg5 / parent.mass() ) * EvtLeptonPCurrent( tmp, Bi ) ) * ( daught / daught.mass() ); // Term 8 = \bar{u}^{\alpha}(p',s')*(G_4(q^2)*g_{\alpha,\mu}*\gamma_5))*u(p,s) t[7] = cg5 * ( id.cont2( v2 ) ); // Sum the individual terms EvtVector4C current = ( ff[0] * t[0] + ff[1] * t[1] + ff[2] * t[2] + ff[3] * t[3] - ff[4] * t[4] - ff[5] * t[5] - ff[6] * t[6] - ff[7] * t[7] ); return current; } diff --git a/test/testDecayModel.cc b/test/testDecayModel.cc index 92e6cb1..a540ee4 100644 --- a/test/testDecayModel.cc +++ b/test/testDecayModel.cc @@ -1,1215 +1,1221 @@ /*********************************************************************** * Copyright 1998-2020 CERN for the benefit of the EvtGen authors * * * * This file is part of EvtGen. * * * * EvtGen is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * EvtGen is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with EvtGen. If not, see . * ***********************************************************************/ #include "testDecayModel.hh" #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtConst.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtId.hh" #include "EvtGenBase/EvtKine.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtVector4R.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include #include #include #include using nlohmann::json; TestDecayModel::TestDecayModel( const json& config ) : m_config{ config } { } bool TestDecayModel::checkMandatoryFields() { const std::array mandatoryFields{ "parent", "daughters", "models", "parameters", "outfile", "events", "reference", "histograms" }; const std::array mandatoryHistoFields{ "title", "variable", "d1", "d2", "nbins", "xmin", "xmax" }; const std::array extra2DHistoFields{ "variableY", "d1Y", "d2Y", "nbinsY", "ymin", "ymax" }; bool allMandatoryFields{ true }; for ( const auto& field : mandatoryFields ) { if ( !m_config.contains( field ) ) { std::cerr << "ERROR : json does not contain required field: " << field << std::endl; allMandatoryFields = false; continue; } if ( field == "histograms" ) { const json& jHistos{ m_config.at( "histograms" ) }; for ( const auto& hInfo : jHistos ) { for ( const auto& hField : mandatoryHistoFields ) { if ( !hInfo.contains( hField ) ) { std::cerr << "ERROR : json does not contain required field for histogram definition: " << hField << std::endl; allMandatoryFields = false; } } if ( hInfo.contains( extra2DHistoFields[0] ) ) { for ( const auto& hField : extra2DHistoFields ) { if ( !hInfo.contains( hField ) ) { std::cerr << "ERROR : json does not contain required field for 2D histogram definition: " << hField << std::endl; allMandatoryFields = false; } } } } } } return allMandatoryFields; } bool TestDecayModel::run() { // Check that we have, and then get all the mandatory fields first if ( !checkMandatoryFields() ) { std::cerr << "ERROR : json does not contain all mandatory fields - dumping config for debugging:\n"; std::cerr << m_config << std::endl; return false; } const auto parentName{ m_config.at( "parent" ).get() }; const auto daughterNames{ m_config.at( "daughters" ).get>() }; const auto modelNames{ m_config.at( "models" ).get>() }; const auto modelParameters{ m_config.at( "parameters" ).get>>() }; const auto outFileName{ m_config.at( "outfile" ).get() }; const auto nEvents{ m_config.at( "events" ).get() }; const auto refFileName{ m_config.at( "reference" ).get() }; // Then check for optional fields, setting default values if not present const auto grandDaughterNames{ ( m_config.contains( "grand_daughters" ) && m_config.at( "grand_daughters" ).is_array() ) ? m_config.at( "grand_daughters" ) .get>>() : std::vector>{} }; const auto extraCommands{ ( m_config.contains( "extras" ) && m_config.at( "extras" ).is_array() ) ? m_config.at( "extras" ).get>() : std::vector{} }; const auto debugFlag{ ( m_config.contains( "debug_flag" ) && m_config.at( "debug_flag" ).is_boolean() ) ? m_config.at( "debug_flag" ).get() : false }; std::vector doConjDecay; if ( m_config.contains( "do_conjugate_decay" ) && m_config.at( "do_conjugate_decay" ).is_array() ) { doConjDecay = m_config.at( "do_conjugate_decay" ).get>(); } if ( doConjDecay.size() != modelNames.size() ) { doConjDecay.resize( modelNames.size(), false ); } // Initialise the EvtGen object and hence the EvtPDL tables // The EvtGen object is used by generateEvents, while the // latter are also used within createDecFile // Define the random number generator auto randomEngine{ std::make_unique() }; EvtAbsRadCorr* radCorrEngine{ nullptr }; std::list extraModels; #ifdef EVTGEN_EXTERNAL bool convertPythiaCodes( false ); bool useEvtGenRandom( true ); EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom ); radCorrEngine = genList.getPhotosModel(); extraModels = genList.getListOfModels(); #endif EvtGen theGen( "../DECAY.DEC", "../evt.pdl", randomEngine.get(), radCorrEngine, &extraModels ); /*! Creates a decay file based on json file input. */ const std::string decFileName{ outFileName.substr( 0, outFileName.size() - 5 ) }; const std::string decFile{ createDecFile( parentName, daughterNames, grandDaughterNames, modelNames, modelParameters, doConjDecay, extraCommands, decFileName ) }; /*! Define the root output file and histograms to be saved. */ std::unique_ptr outFile{ TFile::Open( outFileName.c_str(), "recreate" ) }; defineHistos( outFile.get() ); /*! Generate events and fill histograms. */ generateEvents( theGen, decFile, parentName, doConjDecay[0], nEvents, debugFlag ); // Normalize histograms. for ( auto& [_, hist] : m_1DhistVect ) { const double area{ hist->Integral() }; if ( area > 0.0 ) { hist->Scale( 1.0 / area ); } } for ( auto& [_, hist] : m_2DhistVect ) { const double area{ hist->Integral() }; if ( area > 0.0 ) { hist->Scale( 1.0 / area ); } } /*! Compare with reference histograms. */ compareHistos( refFileName ); // Write output. outFile->cd(); for ( auto& [_, hist] : m_1DhistVect ) { hist->Write(); } for ( auto& [_, hist] : m_2DhistVect ) { hist->Write(); } if ( m_mixedHist ) { m_mixedHist->Write(); } outFile->Close(); std::cout << "Created output file: " << outFileName.c_str() << std::endl; return true; } std::string TestDecayModel::createDecFile( const std::string& parent, const std::vector& daughterNames, const std::vector>& grandDaughterNames, const std::vector& modelNames, const std::vector>& parameters, const std::vector& doConjDecay, const std::vector& extras, const std::string decFileName ) const { // Create (or overwrite) the decay file std::string decName( decFileName + ".dec" ); std::ofstream decFile; decFile.open( decName.c_str() ); // Create daughter aliases if needed std::vector aliasPrefix; for ( long unsigned int daughter_index{ 0 }; daughter_index < daughterNames.size(); daughter_index++ ) { if ( !grandDaughterNames.empty() && !grandDaughterNames[daughter_index].empty() ) { decFile << "Alias My" << daughterNames[daughter_index] << " " << daughterNames[daughter_index] << std::endl; if ( doConjDecay[daughter_index + 1] ) { const EvtId daugID{ EvtPDL::getId( daughterNames[daughter_index] ) }; const EvtId daugConjID{ EvtPDL::chargeConj( daugID ) }; const std::string conjName{ daugConjID.getName() }; std::string conjName_Alias{ daugConjID.getName() }; if ( std::find( std::begin( daughterNames ), std::end( daughterNames ), daugConjID.getName() ) != std::end( daughterNames ) ) { conjName_Alias = conjName_Alias + "_" + daughter_index; } decFile << "Alias My" << conjName_Alias << " " << conjName << std::endl; decFile << "ChargeConj My" << daughterNames[daughter_index] << " My" << conjName_Alias << std::endl; } else if ( doConjDecay[0] ) { decFile << "ChargeConj My" << daughterNames[daughter_index] << " My" << daughterNames[daughter_index] << std::endl; } aliasPrefix.push_back( "My" ); } else { aliasPrefix.push_back( "" ); } } for ( const auto& iExtra : extras ) { decFile << iExtra << std::endl; } // Parent decay decFile << "Decay " << parent << std::endl; decFile << "1.0"; for ( long unsigned int daughter_index{ 0 }; daughter_index < daughterNames.size(); daughter_index++ ) { decFile << " " << aliasPrefix[daughter_index] << daughterNames[daughter_index]; } decFile << " " << modelNames[0]; for ( const auto& par : parameters[0] ) { decFile << " " << par; } decFile << ";" << std::endl; decFile << "Enddecay" << std::endl; if ( doConjDecay[0] ) { EvtId parID{ EvtPDL::getId( parent ) }; EvtId parConjID{ EvtPDL::chargeConj( parID ) }; decFile << "CDecay " << parConjID.getName() << std::endl; } // Daughter decays into granddaughters for ( long unsigned int daughter_index{ 0 }; daughter_index < grandDaughterNames.size(); daughter_index++ ) { if ( grandDaughterNames[daughter_index].empty() ) continue; decFile << "Decay " << aliasPrefix[daughter_index] << daughterNames[daughter_index] << std::endl; decFile << "1.0"; for ( long unsigned int grandDaughter_index{ 0 }; grandDaughter_index < grandDaughterNames[daughter_index].size(); grandDaughter_index++ ) { decFile << " " << grandDaughterNames[daughter_index][grandDaughter_index]; } decFile << " " << modelNames[daughter_index + 1]; for ( const auto& par : parameters[daughter_index + 1] ) { decFile << " " << par; } decFile << ";" << std::endl; decFile << "Enddecay" << std::endl; if ( doConjDecay[daughter_index + 1] ) { EvtId daugID{ EvtPDL::getId( daughterNames[daughter_index] ) }; EvtId daugConjID{ EvtPDL::chargeConj( daugID ) }; std::string conjName_Alias{ daugConjID.getName() }; if ( std::find( std::begin( daughterNames ), std::end( daughterNames ), daugConjID.getName() ) != std::end( daughterNames ) ) { conjName_Alias = conjName_Alias + "_" + daughter_index; } decFile << "CDecay " << aliasPrefix[daughter_index] << conjName_Alias << std::endl; } } decFile << "End" << std::endl; decFile.close(); return decName; } void TestDecayModel::defineHistos( TFile* outFile ) { // Histogram information const json& jHistos{ m_config.at( "histograms" ) }; const size_t nHistos{ jHistos.size() }; m_1DhistVect.reserve( nHistos ); m_2DhistVect.reserve( nHistos ); for ( const auto& hInfo : jHistos ) { const auto varTitle{ hInfo.at( "title" ).get() }; const auto varName{ hInfo.at( "variable" ).get() }; // Integer values that define what particles need to be used // for invariant mass combinations or helicity angles etc const auto d1{ hInfo.at( "d1" ).get() }; const auto d2{ hInfo.at( "d2" ).get() }; const auto nBins{ hInfo.at( "nbins" ).get() }; const auto xmin{ hInfo.at( "xmin" ).get() }; const auto xmax{ hInfo.at( "xmax" ).get() }; std::string histName( varName.c_str() ); if ( d1 != 0 ) { histName += "_"; histName += std::to_string( d1 ); } if ( d2 != 0 ) { histName += "_"; histName += std::to_string( d2 ); } if ( !hInfo.contains( "variableY" ) ) { TH1* hist{ new TH1D{ histName.c_str(), varTitle.c_str(), nBins, xmin, xmax } }; hist->SetDirectory( outFile ); m_1DhistVect.emplace_back( std::make_pair( TestInfo( varName, d1, d2 ), hist ) ); continue; } else { const auto varNameY{ hInfo.at( "variableY" ).get() }; const auto d1Y{ hInfo.at( "d1Y" ).get() }; const auto d2Y{ hInfo.at( "d2Y" ).get() }; const auto nBinsY{ hInfo.at( "nbinsY" ).get() }; const auto ymin{ hInfo.at( "ymin" ).get() }; const auto ymax{ hInfo.at( "ymax" ).get() }; histName += "_"; histName += varNameY; if ( d1Y != 0 ) { histName += "_"; histName += std::to_string( d1Y ); } if ( d2Y != 0 ) { histName += "_"; histName += std::to_string( d2Y ); } TH2* hist{ new TH2D{ histName.c_str(), varTitle.c_str(), nBins, xmin, xmax, nBinsY, ymin, ymax } }; hist->SetDirectory( outFile ); m_2DhistVect.emplace_back( std::make_pair( TestInfo( varName, d1, d2, varNameY, d1Y, d2Y ), hist ) ); } } // For the case where the parent is either a neutral B or D add a mixed/unmixed histogram const auto parentName{ m_config.at( "parent" ).get() }; const int parentID{ abs( EvtPDL::getStdHep( EvtPDL::getId( parentName ) ) ) }; if ( parentID == 511 || parentID == 531 || parentID == 421 ) { const std::string varTitle{ parentName + " mixed" }; m_mixedHist = new TH1D{ "mixed", varTitle.c_str(), 2, 0.0, 2.0 }; // TODO maybe set bin labels? m_mixedHist->SetDirectory( outFile ); } } void TestDecayModel::generateEvents( EvtGen& theGen, const std::string& decFile, const std::string& parentName, const bool doConjDecay, const int nEvents, const bool debug_flag ) { // Read the decay file theGen.readUDecay( decFile.c_str() ); // Generate the decays EvtId parId{ EvtPDL::getId( parentName.c_str() ) }; EvtId conjId{ doConjDecay ? EvtPDL::chargeConj( parId ) : parId }; for ( int i{ 0 }; i < nEvents; i++ ) { if ( i % 1000 == 0 ) { std::cout << "Event " << nEvents - i << std::endl; } // Initial 4-momentum and particle EvtVector4R pInit( EvtPDL::getMass( parId ), 0.0, 0.0, 0.0 ); EvtParticle* parent{ nullptr }; if ( EvtRandom::Flat() < 0.5 ) { parent = EvtParticleFactory::particleFactory( parId, pInit ); } else { parent = EvtParticleFactory::particleFactory( conjId, pInit ); } theGen.generateDecay( parent ); // Check for mixing (and fill histogram) EvtParticle* prodParent{ nullptr }; if ( m_mixedHist ) { if ( parent->getNDaug() == 1 ) { prodParent = parent; parent = prodParent->getDaug( 0 ); m_mixedHist->Fill( 1 ); } else { m_mixedHist->Fill( 0 ); } } // To debug if ( debug_flag ) { std::cout << "Parent PDG code: " << parent->getPDGId() << " has daughters " << parent->getNDaug() << std::endl; for ( size_t iDaughter{ 0 }; iDaughter < parent->getNDaug(); iDaughter++ ) { std::cout << "Parent PDG code of daughter " << iDaughter << " : " << parent->getDaug( iDaughter )->getPDGId() << " has daughters " << parent->getDaug( iDaughter )->getNDaug() << std::endl; for ( size_t iGrandDaughter{ 0 }; iGrandDaughter < parent->getDaug( iDaughter )->getNDaug(); iGrandDaughter++ ) { std::cout << "Parent PDG code of grand daughter " << iGrandDaughter << " : " << parent->getDaug( iDaughter ) ->getDaug( iGrandDaughter ) ->getPDGId() << " has daughters " << parent->getDaug( iDaughter ) ->getDaug( iGrandDaughter ) ->getNDaug() << std::endl; } } } // Store information for ( auto& [info, hist] : m_1DhistVect ) { const double value{ getValue( parent, info.getName(), info.getd1(), info.getd2() ) }; if ( hist ) { hist->Fill( value ); } } for ( auto& [info, hist] : m_2DhistVect ) { const double valueX{ getValue( parent, info.getName(), info.getd1(), info.getd2() ) }; const double valueY{ getValue( parent, info.getName( 2 ), info.getd1( 2 ), info.getd2( 2 ) ) }; if ( hist ) { hist->Fill( valueX, valueY ); } } if ( debug_flag ) { if ( prodParent ) { prodParent->printTree(); } else { parent->printTree(); } } // Cleanup if ( prodParent ) { prodParent->deleteTree(); } else { parent->deleteTree(); } } } double TestDecayModel::getValue( const EvtParticle* parent, const std::string& varName, const int d1, const int d2 ) const { double value{ std::numeric_limits::quiet_NaN() }; if ( !parent ) { return value; } const int NDaugMax( parent->getNDaug() ); // If variable name contains "_daugX", we are interested in daughters of daughter X // Else we are interested in daughters const EvtParticle* selectedParent{ parent }; std::string selectedVarName{ varName }; if ( varName.find( "_daug" ) != std::string::npos ) { // Get daughter index from last character in string const int iDaughter{ varName.back() - '0' }; selectedVarName = varName.substr( 0, varName.size() - 6 ); if ( iDaughter > 0 && iDaughter <= NDaugMax ) { selectedParent = parent->getDaug( iDaughter - 1 ); } else { return value; } } const int sel_NDaugMax( selectedParent->getNDaug() ); const EvtParticle* par1{ d1 > 0 && d1 <= sel_NDaugMax ? selectedParent->getDaug( d1 - 1 ) : nullptr }; const EvtParticle* par2{ d2 > 0 && d2 <= sel_NDaugMax ? selectedParent->getDaug( d2 - 1 ) : nullptr }; const EvtParticle* par3{ sel_NDaugMax > 0 ? selectedParent->getDaug( sel_NDaugMax - 1 ) : nullptr }; // 4-momenta in parent rest frame const EvtVector4R p1{ par1 != nullptr ? par1->getP4() : EvtVector4R() }; const EvtVector4R p2{ par2 != nullptr ? par2->getP4() : EvtVector4R() }; const EvtVector4R p3{ par3 != nullptr ? par3->getP4() : EvtVector4R() }; // 4-momenta in lab frame (1st parent in decay tree) const EvtVector4R p1_lab{ par1 != nullptr ? par1->getP4Lab() : EvtVector4R() }; const EvtVector4R p2_lab{ par2 != nullptr ? par2->getP4Lab() : EvtVector4R() }; const EvtVector4R p3_lab{ par3 != nullptr ? par3->getP4Lab() : EvtVector4R() }; if ( !selectedVarName.compare( "id" ) ) { // StdHep ID of one of the daughters (controlled by d1) or the parent if ( par1 ) { value = par1->getPDGId(); } else { value = selectedParent->getPDGId(); } } else if ( !selectedVarName.compare( "parMass" ) ) { // Parent invariant mass value = selectedParent->mass(); } else if ( !selectedVarName.compare( "mass" ) ) { // Invariant mass if ( d2 != 0 ) { // Invariant 4-mass combination of particles d1 and d2 value = ( p1 + p2 ).mass(); } else { // Invariant mass of particle d1 only value = p1.mass(); } } else if ( !selectedVarName.compare( "massSq" ) ) { // Invariant mass if ( d2 != 0 ) { // Invariant 4-mass combination of particles d1 and d2 value = ( p1 + p2 ).mass2(); } else { // Invariant mass of particle d1 only value = p1.mass2(); } } else if ( !selectedVarName.compare( "mPrime" ) ) { // pick up first unused particle rather than last one if ( sel_NDaugMax != 3 ) { return -1; } int unused{ 0 }; for ( int ii{ 1 }; ii <= sel_NDaugMax; ++ii ) { if ( ii != d1 && ii != d2 ) { unused = ii; break; } } if ( unused == 0 ) { unused = sel_NDaugMax; } const auto parL{ selectedParent->getDaug( unused - 1 ) }; // const auto& pL = parL->getP4(); const double mB{ selectedParent->mass() }; const double m1{ par1->mass() }; const double m2{ par2->mass() }; const double m3{ parL->mass() }; const double m12{ ( p1 + p2 ).mass() }; const double m12norm{ 2 * ( ( m12 - ( m1 + m2 ) ) / ( mB - ( m1 + m2 + m3 ) ) ) - 1 }; value = acos( m12norm ) / EvtConst::pi; } else if ( !selectedVarName.compare( "thetaPrime" ) ) { // pick up first unused particle rather than last one if ( sel_NDaugMax != 3 ) { return -1; } int unused{ 0 }; for ( int ii{ 1 }; ii <= sel_NDaugMax; ++ii ) { if ( ii != d1 && ii != d2 ) { unused = ii; break; } } if ( unused == 0 ) { unused = sel_NDaugMax; } const auto parL{ selectedParent->getDaug( unused - 1 ) }; const auto& pL{ parL->getP4() }; const double mB{ selectedParent->mass() }; const double m1{ p1.mass() }; const double m2{ p2.mass() }; const double m3{ pL.mass() }; double mBSq{ mB * mB }; double m1Sq{ m1 * m1 }; double m2Sq{ m2 * m2 }; double m3Sq{ m3 * m3 }; const double m12{ ( p1 + p2 ).mass() }; const double m13{ ( p1 + p3 ).mass() }; const double m12Sq{ m12 * m12 }; const double m13Sq{ m13 * m13 }; double en1{ ( m12Sq - m2Sq + m1Sq ) / ( 2.0 * m12 ) }; double en3{ ( mBSq - m12Sq - m3Sq ) / ( 2.0 * m12 ) }; double p1_12{ std::sqrt( en1 * en1 - m1Sq ) }; double p3_12{ std::sqrt( en3 * en3 - m3Sq ) }; double cosTheta{ ( -m13Sq + m1Sq + m3Sq + 2. * en1 * en3 ) / ( 2. * p1_12 * p3_12 ) }; value = acos( cosTheta ) / EvtConst::pi; } else if ( !selectedVarName.compare( "pSumSq" ) ) { // Invariant momentum sum squared value = ( p1 + p2 ).mass2(); } else if ( !selectedVarName.compare( "pDiffSq" ) ) { // Invariant momentum difference squared value = ( p1 - p2 ).mass2(); } else if ( !selectedVarName.compare( "mass3" ) ) { // Invariant mass of 3 daughters value = ( p1 + p2 + p3 ).mass(); } else if ( !selectedVarName.compare( "mass3_specified" ) ) { // Invariant mass of 3 daughters, d1 is first daughter // second daughter is d1 + 1, d2 is last daughter const EvtParticle* daug2{ selectedParent->getDaug( d1 ) }; const EvtParticle* daug3{ selectedParent->getDaug( d2 - 1 ) }; const EvtVector4R p2_specified{ daug2 != nullptr ? daug2->getP4Lab() : EvtVector4R() }; const EvtVector4R p3_specified{ daug3 != nullptr ? daug3->getP4Lab() : EvtVector4R() }; value = ( p1 + p2_specified + p3_specified ).mass(); } else if ( !selectedVarName.compare( "cosTheta3" ) ) { // Cosine of the polar angle of the momentum of d1 + d2 + d3 const EvtVector4R p123{ p1 + p2 + p3 }; if ( p123.d3mag() > 0.0 ) { value = p123.get( 3 ) / p123.d3mag(); } } else if ( !selectedVarName.compare( "pLab" ) ) { // Momentum of particle d1 in lab frame value = p1_lab.d3mag(); } else if ( !selectedVarName.compare( "p" ) ) { // Momentum of particle d1 in parent rest frame value = p1.d3mag(); } else if ( !selectedVarName.compare( "pLabSq" ) ) { // Momentum squared of particle d1 (in lab frame) const double p1_lab_x{ p1_lab.get( 1 ) }; const double p1_lab_y{ p1_lab.get( 2 ) }; const double p1_lab_z{ p1_lab.get( 3 ) }; value = p1_lab_x * p1_lab_x + p1_lab_y * p1_lab_y + p1_lab_z * p1_lab_z; } else if ( !selectedVarName.compare( "pSq" ) ) { // Momentum squared of particle d1 (in lab frame) const double p1_x{ p1.get( 1 ) }; const double p1_y{ p1.get( 2 ) }; const double p1_z{ p1.get( 3 ) }; value = p1_x * p1_x + p1_y * p1_y + p1_z * p1_z; } else if ( !selectedVarName.compare( "pxLab" ) ) { // x momentum of particle d1 in lab frame value = p1_lab.get( 1 ); } else if ( !selectedVarName.compare( "px" ) ) { // x momentum of particle d1 in parent frame value = p1.get( 1 ); } else if ( !selectedVarName.compare( "pyLab" ) ) { // y momentum of particle d1 in lab frame value = p1_lab.get( 2 ); } else if ( !selectedVarName.compare( "py" ) ) { // y momentum of particle d1 in parent frame value = p1.get( 2 ); } else if ( !selectedVarName.compare( "pzLab" ) ) { // z momentum of particle d1 in lab frame value = p1_lab.get( 3 ); } else if ( !selectedVarName.compare( "pz" ) ) { // z momentum of particle d1 in parent frame value = p1.get( 3 ); } else if ( !selectedVarName.compare( "cosHel" ) || !selectedVarName.compare( "absCosHel" ) ) { // Cosine of helicity angle EvtVector4R p12; EvtVector4R p1Res; if ( d2 != 0 ) { // Resonance center-of-mass system (d1 and d2) p12 = p1_lab + p2_lab; // Boost vector const EvtVector4R boost{ p12.get( 0 ), -p12.get( 1 ), -p12.get( 2 ), -p12.get( 3 ) }; // Momentum of particle d1 in resonance frame, p1Res p1Res = boostTo( p1_lab, boost ); } else { // The resonance is d1 p12 = p1; // Find its first daughter const EvtParticle* gpar{ par1 != nullptr ? par1->getDaug( 0 ) : nullptr }; p1Res = gpar != nullptr ? gpar->getP4() : EvtVector4R(); } // Cosine of angle between p1Res and momentum of resonance in parent frame const double p1ResMag{ p1Res.d3mag() }; const double p12Mag{ p12.d3mag() }; if ( p1ResMag > 0.0 && p12Mag > 0.0 ) { value = -p1Res.dot( p12 ) / ( p1ResMag * p12Mag ); } if ( !selectedVarName.compare( "absCosHel" ) ) { value = std::abs( value ); } } else if ( !selectedVarName.compare( "cosHelTau" ) ) { // Works only for B -> X nu_1 tau -> pi nu_2. // Cosine of helicity angle between pi momentum and opposite W momentum -(nu_1 + tau) // in the tau rest frame. Index d1 must match with tau. // p3 (momentum of last daughter) is taken as the neutrino momentum // W momentum const EvtVector4R p_W{ p1_lab + p3_lab }; // Index d2 must match the index of the pion (daughter of tau) const EvtParticle* pion{ selectedParent->getDaug( d1 - 1 )->getDaug( d2 - 1 ) }; const EvtVector4R p_pion{ pion != nullptr ? pion->getP4Lab() : EvtVector4R() }; // Boost vector to tau frame const EvtVector4R boost{ p1_lab.get( 0 ), -p1_lab.get( 1 ), -p1_lab.get( 2 ), -p1_lab.get( 3 ) }; // Boost both momenta to tau frame const EvtVector4R p_W_boosted{ boostTo( p_W, boost ) }; const EvtVector4R p_pion_boosted{ boostTo( p_pion, boost ) }; // Cosine of angle between opposite W momentum and pion momentum in tau frame const double p_W_boostedMag{ p_W_boosted.d3mag() }; const double p_pion_boostedMag{ p_pion_boosted.d3mag() }; if ( p_W_boostedMag > 0.0 && p_pion_boostedMag > 0.0 ) { value = -p_W_boosted.dot( p_pion_boosted ) / ( p_W_boostedMag * p_pion_boostedMag ); } } else if ( !selectedVarName.compare( "cosHelDiTau" ) || !selectedVarName.compare( "cosHelDiTau_over05" ) || !selectedVarName.compare( "cosHelDiTau_under05" ) ) { // Works for B -> tau (pi nu) tau -> (pi nu), B -> phi (-> KK) l l decays, // B -> 4 pions, or similar decays.. // Cosine of helicity angle between pi momentum and opposite B momentum in tau rest frame. // Index d1 must match with tau if ( sel_NDaugMax < 2 || sel_NDaugMax > 4 ) { return value; } // B momentum const EvtVector4R p_B{ selectedParent->getP4Lab() }; // Index d2 must match the index of the pion (daughter of tau) const EvtParticle* pion_1{ sel_NDaugMax <= 3 ? selectedParent->getDaug( d1 - 1 )->getDaug( d2 - 1 ) : selectedParent->getDaug( d1 - 1 ) }; const EvtVector4R p_pion_1{ pion_1 != nullptr ? pion_1->getP4Lab() : EvtVector4R() }; const EvtVector4R p_first_daughter{ sel_NDaugMax <= 3 ? selectedParent->getDaug( d1 - 1 )->getP4Lab() : selectedParent->getDaug( d1 - 1 )->getP4Lab() + selectedParent->getDaug( d1 )->getP4Lab() }; // Boost vector to tau frame const EvtVector4R boost_1{ p_first_daughter.get( 0 ), -p_first_daughter.get( 1 ), -p_first_daughter.get( 2 ), -p_first_daughter.get( 3 ) }; // Boost both momenta to tau frame const EvtVector4R p_B_boosted_1{ boostTo( p_B, boost_1 ) }; const EvtVector4R p_pion_boosted_1{ boostTo( p_pion_1, boost_1 ) }; // Cosine of angle between opposite W momentum and pion momentum in tau frame const double p_B_boosted_1_Mag{ p_B_boosted_1.d3mag() }; const double p_pion_boosted_1_Mag{ p_pion_boosted_1.d3mag() }; double hel1{ std::numeric_limits::quiet_NaN() }; double hel{ std::numeric_limits::quiet_NaN() }; if ( p_B_boosted_1_Mag > 0.0 && p_pion_boosted_1_Mag > 0.0 ) { hel1 = -p_B_boosted_1.dot( p_pion_boosted_1 ) / ( p_B_boosted_1_Mag * p_pion_boosted_1_Mag ); } if ( ( !selectedVarName.compare( "cosHelDiTau_over05" ) ) || ( !selectedVarName.compare( "cosHelDiTau_under05" ) ) ) { // Works for B -> tau (pi nu) tau -> (pi nu) or similar decays. // Cosine of helicity angle between pi momentum and opposite B momentum in tau rest frame // Index d1 must match with tau; cosHelicity above +0.5 or below -0.5 // Index d2 must match the index of the pion (daughter of tau) const EvtParticle* pion{ sel_NDaugMax <= 3 ? selectedParent->getDaug( 0 )->getDaug( d2 - 1 ) : selectedParent->getDaug( 0 ) }; const EvtVector4R p_pion{ pion != nullptr ? pion->getP4Lab() : EvtVector4R() }; // Boost vector to tau frame const EvtVector4R p_second_daughter{ sel_NDaugMax == 2 ? selectedParent->getDaug( 0 )->getP4Lab() : selectedParent->getDaug( 0 )->getP4Lab() + selectedParent->getDaug( 1 )->getP4Lab() }; const EvtVector4R boost{ p_second_daughter.get( 0 ), -p_second_daughter.get( 1 ), -p_second_daughter.get( 2 ), -p_second_daughter.get( 3 ) }; // Boost both momenta to tau frame const EvtVector4R p_B_boosted{ boostTo( p_B, boost ) }; const EvtVector4R p_pion_boosted{ boostTo( p_pion, boost ) }; // Cosine of angle between opposite W momentum and pion momentum in tau frame const double p_B_boostedMag{ p_B_boosted.d3mag() }; const double p_pion_boostedMag{ p_pion_boosted.d3mag() }; if ( p_B_boostedMag > 0.0 && p_pion_boostedMag > 0.0 ) { hel = -p_B_boosted.dot( p_pion_boosted ) / ( p_B_boostedMag * p_pion_boostedMag ); } } if ( !selectedVarName.compare( "cosHelDiTau" ) || ( hel > 0.5 && !selectedVarName.compare( "cosHelDiTau_over05" ) ) || ( hel < -0.5 && !selectedVarName.compare( "cosHelDiTau_under05" ) ) ) { value = hel1; } } else if ( !selectedVarName.compare( "cosAcoplanarityAngle" ) || !selectedVarName.compare( "acoplanarityAngle" ) ) { // Acoplanarity angle or cosine for B -> tau (pi nu) tau -> (pi nu), // B -> phi (-> KK) l l decays, B -> 4 pions, or similar decays value = getCosAcoplanarityAngle( selectedParent, sel_NDaugMax, d1, d2 ); if ( !selectedVarName.compare( "acoplanarityAngle" ) ) { value = std::acos( value ) * 180.0 / EvtConst::pi; // degrees } } else if ( !selectedVarName.compare( "cosTheta" ) ) { // Cosine of polar angle of first daughter in lab frame const double p1_lab_mag{ p1_lab.d3mag() }; if ( p1_lab_mag > 0.0 ) { value = p1_lab.get( 3 ) / p1_lab_mag; } } else if ( !selectedVarName.compare( "phi" ) ) { // Azimuthal angle of first daughter in lab frame (degrees) const double p1_lab_mag{ p1_lab.d3mag() }; if ( p1_lab_mag > 0.0 ) { value = atan2( p1_lab.get( 1 ), p1_lab.get( 2 ) ) * 180.0 / EvtConst::pi; } } else if ( !selectedVarName.compare( "decayangle" ) ) { // Polar angle between first and second daughters in lab frame const EvtVector4R p{ selectedParent->getP4() }; const EvtVector4R q{ p1 + p2 }; const EvtVector4R d{ p1 }; const double cost{ EvtDecayAngle( p, q, d ) }; value = acos( cost ) * 180.0 / EvtConst::pi; } else if ( !selectedVarName.compare( "decayangle3" ) ) { // Polar angle between combined first and second daughters // with the third daughter in lab frame const EvtVector4R p{ selectedParent->getP4() }; const EvtVector4R q{ p1 + p2 + p3 }; const EvtVector4R d{ p1 + p2 }; const double cost{ EvtDecayAngle( p, q, d ) }; value = acos( cost ) * 180.0 / EvtConst::pi; } else if ( !selectedVarName.compare( "decayangle_BTO4PI" ) ) { // Polar angle between first and second daughters in lab frame. // Used in PIPIPI (BTO4PI_CP) model const EvtVector4R p{ p1 + p2 + p3 }; const EvtVector4R q{ p1 + p2 }; const EvtVector4R d{ p1 }; const double cost{ EvtDecayAngle( p, q, d ) }; value = acos( cost ) * 180.0 / EvtConst::pi; } else if ( !selectedVarName.compare( "chi" ) ) { // Chi angle (degrees) using all 4 daughters and parent 4 mom const EvtParticle* daug1{ selectedParent->getDaug( d1 - 1 ) }; const EvtParticle* daug2{ selectedParent->getDaug( d1 ) }; const EvtParticle* daug3{ selectedParent->getDaug( d1 + 1 ) }; const EvtParticle* daug4{ selectedParent->getDaug( d1 + 2 ) }; const EvtVector4R p_parent{ selectedParent->getP4() }; const EvtVector4R p_daug1{ daug1 != nullptr ? daug1->getP4() : EvtVector4R() }; const EvtVector4R p_daug2{ daug2 != nullptr ? daug2->getP4() : EvtVector4R() }; const EvtVector4R p_daug3{ daug3 != nullptr ? daug3->getP4() : EvtVector4R() }; const EvtVector4R p_daug4{ daug4 != nullptr ? daug4->getP4() : EvtVector4R() }; const double chi{ EvtDecayAngleChi( p_parent, p_daug1, p_daug2, p_daug3, p_daug4 ) }; value = chi * 180.0 / EvtConst::pi; } else if ( !selectedVarName.compare( "E" ) ) { // Energy of first daughter in lab frame value = p1_lab.get( 0 ); } else if ( !selectedVarName.compare( "E_over_Eparent" ) ) { // Energy of first daughter w.r.t parent energy (lab frame) value = p1_lab.get( 0 ) / selectedParent->getP4Lab().get( 0 ); } else if ( !selectedVarName.compare( "E_over_Eparent_over05" ) ) { // First daughter E_over_Eparent (lab frame) if d2 granddaughter E ratio > 0.5 const double E_over_Eparent_2{ parent->getDaug( 0 )->getDaug( d2 - 1 )->getP4Lab().get( 0 ) / parent->getDaug( 0 )->getP4Lab().get( 0 ) }; if ( E_over_Eparent_2 > 0.5 ) { value = p1_lab.get( 0 ) / selectedParent->getP4Lab().get( 0 ); } } else if ( !selectedVarName.compare( "totE_over_Mparent" ) ) { // Energy of given daughters w.r.t parent mass (lab frame) value = ( p1_lab.get( 0 ) + p2_lab.get( 0 ) ) / selectedParent->mass(); } else if ( !selectedVarName.compare( "prob" ) ) { // Decay probability const double* dProb{ selectedParent->decayProb() }; if ( dProb ) { value = *dProb; } } else if ( !selectedVarName.compare( "lifetime" ) ) { // Lifetime of particle d1 (ps) if ( d1 ) { value = par1 != nullptr ? par1->getLifetime() * 1e12 / EvtConst::c : 0.0; } else { value = parent != nullptr ? parent->getLifetime() * 1e12 / EvtConst::c : 0.0; } } else if ( !selectedVarName.compare( "deltaT" ) ) { // Lifetime difference between particles d1 and d2 const double t1{ par1 != nullptr ? par1->getLifetime() * 1e12 / EvtConst::c : 0.0 }; const double t2{ par2 != nullptr ? par2->getLifetime() * 1e12 / EvtConst::c : 0.0 }; value = t1 - t2; } else if ( !selectedVarName.compare( "decTime" ) ) { // Decay flight time of particle d1 in picoseconds. // Decay vertex = position of (1st) decay particle of d1 const EvtParticle* gpar{ par1 != nullptr ? par1->getDaug( 0 ) : nullptr }; const EvtVector4R vtxPos{ gpar != nullptr ? gpar->get4Pos() : EvtVector4R() }; const double p{ p1_lab.d3mag() }; value = p > 0.0 ? 1e12 * vtxPos.d3mag() * p1_lab.mass() / ( p * EvtConst::c ) : 0.0; } else { std::cerr << "Warning: Did not recognise variable name " << selectedVarName << std::endl; } return value; } void TestDecayModel::compareHistos( const std::string& refFileName ) const { // Compare histograms with the same name, calculating the chi-squared std::unique_ptr refFile{ TFile::Open( refFileName.c_str(), "read" ) }; if ( !refFile ) { std::cerr << "Could not open reference file " << refFileName << std::endl; return; } // TODO - should we plot the (signed) chisq histogram? and save it as pdf/png? for ( auto& [_, hist] : m_1DhistVect ) { const std::string histName{ hist->GetName() }; // Get equivalent reference histogram const TH1* refHist{ dynamic_cast( refFile->Get( histName.c_str() ) ) }; if ( refHist ) { double chiSq{ 0.0 }; int nDof{ 0 }; int iGood{ 0 }; - double pValue{ refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; + const double pValue{ + refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; + const double integral{ refHist->Integral() }; std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq - << "/" << nDof << ", pValue = " << pValue << std::endl; + << "/" << nDof << ", pValue = " << pValue + << ", integral = " << integral << std::endl; } else { std::cerr << "Could not find reference histogram " << histName << std::endl; } } for ( auto& [_, hist] : m_2DhistVect ) { const std::string histName{ hist->GetName() }; // Get equivalent reference histogram const TH2* refHist{ dynamic_cast( refFile->Get( histName.c_str() ) ) }; if ( refHist ) { double chiSq{ 0.0 }; int nDof{ 0 }; int iGood{ 0 }; - double pValue{ refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; + const double pValue{ + refHist->Chi2TestX( hist, chiSq, nDof, iGood, "WW" ) }; + const double integral{ refHist->Integral() }; std::cout << "Histogram " << histName << " chiSq/nDof = " << chiSq - << "/" << nDof << ", pValue = " << pValue << std::endl; + << "/" << nDof << ", pValue = " << pValue + << ", integral = " << integral << std::endl; } else { std::cerr << "Could not find reference histogram " << histName << std::endl; } } refFile->Close(); } double TestDecayModel::getCosAcoplanarityAngle( const EvtParticle* selectedParent, const int sel_NDaugMax, const int d1, const int d2 ) const { // Given a two-body decay, the acoplanarity angle is defined as the angle between the // two decay planes (normal vectors) in the reference frame of the mother. // Each normal vector is the cross product of the momentum of one daughter (in the frame of the mother) // and the momentum of one of the granddaughters (in the reference frame of the daughter). // In case of 3 daughters, we build an intermediate daughter (2+3) from the last 2 daughters // (which are then treated as grand daughters), and in case of 4 daughters, we build // 2 intermediate daughters (1+2) and (3+4) double cosAco{ 0.0 }; if ( sel_NDaugMax < 2 || sel_NDaugMax > 4 ) { return cosAco; } const EvtParticle* daughter1{ selectedParent->getDaug( 0 ) }; const EvtParticle* daughter2{ selectedParent->getDaug( 1 ) }; const EvtParticle* daughter3{ selectedParent->getDaug( 2 ) }; const EvtParticle* daughter4{ selectedParent->getDaug( 3 ) }; const EvtParticle* grandDaughter1{ daughter1->getDaug( d1 - 1 ) }; const EvtParticle* grandDaughter2{ daughter2->getDaug( d2 - 1 ) }; const EvtVector4R parent4Vector{ selectedParent->getP4Lab() }; const EvtVector4R daughter4Vector1{ sel_NDaugMax <= 3 ? daughter1->getP4Lab() : daughter1->getP4Lab() + daughter2->getP4Lab() }; const EvtVector4R daughter4Vector2{ sel_NDaugMax == 2 ? daughter2->getP4Lab() : sel_NDaugMax == 3 ? daughter2->getP4Lab() + daughter3->getP4Lab() : daughter3->getP4Lab() + daughter4->getP4Lab() }; const EvtVector4R grandDaughter4Vector1{ sel_NDaugMax <= 3 ? grandDaughter1->getP4Lab() : daughter1->getP4Lab() }; const EvtVector4R grandDaughter4Vector2{ sel_NDaugMax == 2 ? grandDaughter2->getP4Lab() : sel_NDaugMax == 3 ? daughter2->getP4Lab() : daughter3->getP4Lab() }; const EvtVector4R parentBoost{ parent4Vector.get( 0 ), -parent4Vector.get( 1 ), -parent4Vector.get( 2 ), -parent4Vector.get( 3 ) }; const EvtVector4R daughter1Boost{ daughter4Vector1.get( 0 ), -daughter4Vector1.get( 1 ), -daughter4Vector1.get( 2 ), -daughter4Vector1.get( 3 ) }; const EvtVector4R daughter2Boost{ daughter4Vector2.get( 0 ), -daughter4Vector2.get( 1 ), -daughter4Vector2.get( 2 ), -daughter4Vector2.get( 3 ) }; // Boosting daughters to reference frame of the mother EvtVector4R daughter4Vector1_boosted{ boostTo( daughter4Vector1, parentBoost ) }; EvtVector4R daughter4Vector2_boosted{ boostTo( daughter4Vector2, parentBoost ) }; // Boosting each granddaughter to reference frame of its mother EvtVector4R grandDaughter4Vector1_boosted{ boostTo( grandDaughter4Vector1, daughter1Boost ) }; EvtVector4R grandDaughter4Vector2_boosted{ boostTo( grandDaughter4Vector2, daughter2Boost ) }; // We calculate the normal vectors of the decay two planes const EvtVector4R normalVector1{ daughter4Vector1_boosted.cross( grandDaughter4Vector1_boosted ) }; const EvtVector4R normalVector2{ daughter4Vector2_boosted.cross( grandDaughter4Vector2_boosted ) }; const double normalVector1Mag{ normalVector1.d3mag() }; const double normalVector2Mag{ normalVector2.d3mag() }; if ( normalVector1Mag > 0.0 && normalVector2Mag > 0.0 ) { cosAco = normalVector1.dot( normalVector2 ) / ( normalVector1Mag * normalVector2Mag ); } return cosAco; } int main( int argc, char* argv[] ) { if ( argc != 2 ) { std::cerr << "Expecting one argument: json input file" << std::endl; return 1; } /*! Load input file in json format. */ json config; std::ifstream inputStr{ argv[1] }; inputStr >> config; inputStr.close(); bool allOK{ true }; if ( config.is_array() ) { for ( const auto& cc : config ) { TestDecayModel test{ cc }; allOK &= test.run(); } } else { TestDecayModel test{ config }; allOK &= test.run(); } return allOK ? 0 : 1; }