diff --git a/History.md b/History.md index 82ff1b0..4121459 100644 --- a/History.md +++ b/History.md @@ -1,908 +1,912 @@ # 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-0X-00 + +23 Apr 2024 Thomas Latham +* Drop redundant EVTGEN\_CPP11 preprocessor switch + 22 Apr 2024 Fernando Abudinen * D116: Replaced PHOTOS with FSR flags in examples and tests. 17 Apr 2024 Fernando Abudinen * D114: Simplified pre-processor behaviour for PHOTOS. 12 Apr 2024 Fernando Abudinen * D113: Introduced new FSR flag and deprecated PHOTOS flag. Implemented proper use of neverRadCorr. 12 Apr 2024 Fernando Abudinen * D112: Removed EvtPhotosEngine and moved its functionality EvtPHOTOS class. Moved initialisation of fsrEngine to setRadCorrEngine. 11 Apr 2024 Thomas Latham * D109: Remove broken or obsolete models - Models removed: * BHADRONIC * BQTOLLLLHYPERCP * BQTOLLLL * D\_MULTIBODY * KSTARSTARGAMMA * LAMBDAB2LAMBDAV and subsidiary models LAMBDA2PPIFORLAMBDAB2LAMBDAV and V2VPVMFORLAMBDAB2LAMBDAV * Lb2Lhh * PROPSLPOLE * VPHOTOV * VPHOTOVISR * VUB\_AC - Classes in EvtGenBase already unused or used only by the above models also removed * Evt3Rank3C * EvtAbsBinning * EvtAmpAmpPdf * EvtAmpIndex * EvtAmpSubIndex * EvtBreitWignerPdf * EvtDecayParm * EvtIntegPdf1D * EvtMBreitWigner * EvtMHelAmp * EvtMNode * EvtMParticle * EvtMLineShape * EvtMRes * EvtMTree * EvtMTrivialLS * EvtPointPred * EvtPto3PAmpSmpResolution * EvtSpinAmp 9 Apr 2024 Fernando Abudinen * D111: Added tests for decays with FSR and implemented const correctness for getP4LabBeforeFSR() function. 19 Feb 2024 Fernando Abudinen * D108: Bugfix protect polarisation vector for vector and tensor particles against wrong indices 19 Feb 2024 Fernando Abudinen * D107: Implement const correctness for epsPhoton and epsParentPhoton 3 Feb 2024 John Back * T230: Add EvtBcVPPHad model for Bc to Jpsi p pbar pi decays and generalised particle ordering for EvtBcVHad decay files, courtesy of Aleksei Luchinsky, Dmitrii Pereima & Vanya Belyaev (LHCb). Updated EvtPhiDalitz model to use helicity amplitudes and fixed the indices used in EvtVector3R::dot(), courtesy of Arnau Brossa Gonzalo & Antonio Romero Vidal (LHCb). 31 Oct 2023 Fernando Abudinen * D102: Bugfix probmax issue for X38722-+\_PSI\_GAMMA model - Calculation of amplitude moved to dedicated calcAmp function and fixed initialisation. - Introduced weighting to compensate for phase-space changes due to resonance width. - Fixed bugs in rho couplings and loops over photon and vector states. 16 Oct 2023 Fernando Abudinen * D99: Add tests for PHOTOS - EvtParticle::getAttribute function made const - Added variables for testing of FSR to testing framework - Added dedicated tests for FSR with Photos - Turned off Photos for all other tests 16 Oct 2023 Thomas Latham * D98: Modernise EvtIdSet and other improvements - Modernise and greatly simplify EvtIdSet implementation - Fixes in EvtPropSLPole to avoid unnecessary dynamic allocations - Other minor fixes and tidy-ups * Credit to Heather Ratcliffe and Chris Brady for providing and/or inspiring several of these improvements 22 Aug 2023 Fernando Abudinen * D97: Bugfix probmax issue and introduced pole compensation for VTOSLL model - Calculation of amplitude moved to dedicated calcAmp function and fixed initialisation. 22 Aug 2023 Tom Latham * CMake updates - Update default C++ standard to 17 - Suppress 'up-to-date' messages during install - Add 'EvtGen' prefix to file names of custom CMake modules - Remove unused CMake module * Update CI config - Update default LCG version to 103 - Add builds for el9 OS using LCG 104 - Allow switching on/off building against each external - Test stage: attempt to improve selection of commits to diff in different cases - Update CVMFS tags as per https://cern.service-now.com/service-portal?id=outage&n=OTG0079356 * Fix script for generating src dependencies - Adapted to behaviour of newer CMake version in LCG 103 * Apply clang-format - Few small changes after update of CI clang version to 12 - Document version of clang-format to be used * Updates to install script - Update to latest Pythia8 and HepMC3 versions - Fix to ensure dependencies are picked up from the local install 22 Aug 2023 Andrii Verbytskyi * Patch for finding Pythia8 xmldoc path 21 Aug 2023 Tom Latham * D96: Work around change of interface for setRndmEnginePtr in Pythia8 310 22 Jun 2023 Ludovico Massaccesi * T219: Fixed amplitudes for D_DALITZ model of D0 -> pi+ pi- pi0. 1 March 2023 Fernando Abudinen * D92: Bugfix probmax issue for TENSOR daughter in EvtSSD_DirectCP model. Calculation of amplitude in EvtSSD_DirectCP model moved to dedicated calcAmp function. Got rid of a few static variables along the way. 8 Feb 2023 Alexei Sibidanov and Tom Latham * D90: Apply clang format and enable checking of formatting in gitlab CI 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 Dec 2022 Alexei Sibidanov * D88: Applied clang-tidy modernize-use-nullptr 13 Dec 2022 Fernando Abudinen and Tom Latham * Various improvements to testing framework 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/CMakeLists.txt b/src/CMakeLists.txt index e13e2d2..5be4ed0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,271 +1,265 @@ ######################################################################## # 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 . # ######################################################################## # Use glob to find the sources for the main and external libraries file(GLOB EVTGEN_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/EvtGenBase/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/EvtGenModels/*.cpp ) file(GLOB EVTGEN_EXTERNAL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/EvtGenExternal/*.cpp ) # Add the main EvtGen library... # First build all the object files (with PIC enabled) so they can be used to # build both the shared and static libs add_library(objlib OBJECT ${EVTGEN_SOURCES}) set_target_properties(objlib PROPERTIES POSITION_INDEPENDENT_CODE 1) -target_compile_definitions(objlib PRIVATE EVTGEN_CPP11) target_include_directories(objlib PRIVATE ${CMAKE_SOURCE_DIR}) if(EVTGEN_HEPMC3) target_compile_definitions(objlib PRIVATE EVTGEN_HEPMC3) if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib SYSTEM PRIVATE ${HEPMC3_INCLUDE_DIR}) else() target_include_directories(objlib PRIVATE ${HEPMC3_INCLUDE_DIR}) endif() else() if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib SYSTEM PRIVATE ${HEPMC2_INCLUDE_DIR}) else() target_include_directories(objlib PRIVATE ${HEPMC2_INCLUDE_DIR}) endif() endif() # Now make the shared library from the object files add_library(EvtGen SHARED $) set_target_properties(EvtGen PROPERTIES OUTPUT_NAME EvtGen) set_target_properties(EvtGen PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) set_target_properties(EvtGen PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -target_compile_definitions(EvtGen PUBLIC EVTGEN_CPP11) target_include_directories(EvtGen PUBLIC $ $) if(EVTGEN_HEPMC3) target_compile_definitions(EvtGen PUBLIC EVTGEN_HEPMC3) target_include_directories(EvtGen PUBLIC ${HEPMC3_INCLUDE_DIR}) target_link_libraries(EvtGen PUBLIC ${HEPMC3_LIB} ${HEPMC3_SEARCH_LIB}) else() target_include_directories(EvtGen PUBLIC ${HEPMC2_INCLUDE_DIR}) target_link_libraries(EvtGen PUBLIC ${HEPMC2_LIBRARIES}) endif() # Now make the static library from the object files add_library(EvtGenStatic STATIC $) set_target_properties(EvtGenStatic PROPERTIES OUTPUT_NAME EvtGen) set_target_properties(EvtGenStatic PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -target_compile_definitions(EvtGenStatic PUBLIC EVTGEN_CPP11) target_include_directories(EvtGenStatic PUBLIC $ $) if(EVTGEN_HEPMC3) target_compile_definitions(EvtGenStatic PUBLIC EVTGEN_HEPMC3) target_include_directories(EvtGenStatic PUBLIC ${HEPMC3_INCLUDE_DIR}) target_link_libraries(EvtGenStatic PUBLIC ${HEPMC3_LIB} ${HEPMC3_SEARCH_LIB}) else() target_include_directories(EvtGenStatic PUBLIC ${HEPMC2_INCLUDE_DIR}) target_link_libraries(EvtGenStatic PUBLIC ${HEPMC2_LIBRARIES}) endif() # Add the EvtGenExternal library (if required)... if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA ) # Again, first build all the object files (with PIC enabled) so they can be # used to build both the shared and static libs add_library(objlib_ext OBJECT ${EVTGEN_EXTERNAL_SOURCES}) set_target_properties(objlib_ext PROPERTIES POSITION_INDEPENDENT_CODE 1) - target_compile_definitions(objlib_ext PRIVATE EVTGEN_CPP11) target_include_directories(objlib_ext PRIVATE ${CMAKE_SOURCE_DIR}) if(EVTGEN_HEPMC3) target_compile_definitions(objlib_ext PRIVATE EVTGEN_HEPMC3) if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib_ext SYSTEM PRIVATE ${HEPMC3_INCLUDE_DIR}) else() target_include_directories(objlib_ext PRIVATE ${HEPMC3_INCLUDE_DIR}) endif() else() if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib_ext SYSTEM PRIVATE ${HEPMC2_INCLUDE_DIR}) else() target_include_directories(objlib_ext PRIVATE ${HEPMC2_INCLUDE_DIR}) endif() endif() if(EVTGEN_PYTHIA) target_compile_definitions(objlib_ext PRIVATE EVTGEN_PYTHIA) if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib_ext SYSTEM PRIVATE ${PYTHIA8_INCLUDE_DIRS}) else() target_include_directories(objlib_ext PRIVATE ${PYTHIA8_INCLUDE_DIRS}) endif() endif() if(EVTGEN_PHOTOS) target_compile_definitions(objlib_ext PRIVATE EVTGEN_PHOTOS) if(Photos++_pp_FOUND) target_compile_definitions(objlib_ext PRIVATE EVTGEN_PHOTOS_NEWLIBS) endif() if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib_ext SYSTEM PRIVATE ${Photos++_INCLUDE_DIRS}) else() target_include_directories(objlib_ext PRIVATE ${Photos++_INCLUDE_DIRS}) endif() endif() if(EVTGEN_TAUOLA) target_compile_definitions(objlib_ext PRIVATE EVTGEN_TAUOLA) if (EVTGEN_SUPPRESS_EXTERNAL_WARNINGS) target_include_directories(objlib_ext SYSTEM PRIVATE ${Tauola++_INCLUDE_DIRS}) else() target_include_directories(objlib_ext PRIVATE ${Tauola++_INCLUDE_DIRS}) endif() endif() # Now make the shared library from the object files add_library(EvtGenExternal SHARED $) set_target_properties(EvtGenExternal PROPERTIES OUTPUT_NAME EvtGenExternal) set_target_properties(EvtGenExternal PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} ) set_target_properties(EvtGenExternal PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) - target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_CPP11) target_include_directories(EvtGenExternal PUBLIC $ $) if(EVTGEN_PYTHIA) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_PYTHIA) target_include_directories(EvtGenExternal PUBLIC ${PYTHIA8_INCLUDE_DIRS}) target_link_libraries(EvtGenExternal PUBLIC ${PYTHIA8_LIBRARIES}) endif() if(EVTGEN_HEPMC3) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_HEPMC3) target_include_directories(EvtGenExternal PUBLIC ${HEPMC3_INCLUDE_DIR}) target_link_libraries(EvtGenExternal PUBLIC ${HEPMC3_LIB} ${HEPMC3_SEARCH_LIB}) if(EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_PHOTOS_NEWLIBS) target_include_directories(EvtGenExternal PUBLIC ${Photos++_INCLUDE_DIRS}) # From version 3.64 Photos has HepMC3 support target_link_libraries(EvtGenExternal PUBLIC ${Photos++_pp_LIBRARY} ${Photos++_ppHepMC3_LIBRARY}) endif() if(EVTGEN_TAUOLA) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_TAUOLA) target_include_directories(EvtGenExternal PUBLIC ${Tauola++_INCLUDE_DIRS}) # From version 1.1.8 Tauola has HepMC3 support target_link_libraries(EvtGenExternal PUBLIC ${Tauola++_CxxInterface_LIBRARY} ${Tauola++_Fortran_LIBRARY} ${Tauola++_HepMC3_LIBRARY}) endif() else() target_include_directories(EvtGenExternal PUBLIC ${HEPMC2_INCLUDE_DIR}) target_link_libraries(EvtGenExternal PUBLIC ${HEPMC2_LIBRARIES}) if(EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_PHOTOS) target_include_directories(EvtGenExternal PUBLIC ${Photos++_INCLUDE_DIRS}) # Photos has different library structures for versions before and after 3.58 # so we need to check which one we have if(Photos++_pp_FOUND AND Photos++_ppHepMC_FOUND) message(STATUS "EvtGen: PHOTOS has pp and ppHepMC components") target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_PHOTOS_NEWLIBS) target_link_libraries(EvtGenExternal PUBLIC ${Photos++_pp_LIBRARY} ${Photos++_ppHepMC_LIBRARY}) elseif(Photos++_CxxInterface_FOUND AND Photos++_Fortran_FOUND) message(STATUS "EvtGen: PHOTOS has CxxInterface and Fortran components") target_link_libraries(EvtGenExternal PUBLIC ${Photos++_CxxInterface_LIBRARY} ${Photos++_Fortran_LIBRARY}) else() message(ERROR "EvtGen: PHOTOS lacks pp+ppHepMC or CxxInterface+Fortran components") endif() endif() if(EVTGEN_TAUOLA) target_compile_definitions(EvtGenExternal PUBLIC EVTGEN_TAUOLA) target_include_directories(EvtGenExternal PUBLIC ${Tauola++_INCLUDE_DIRS}) target_link_libraries(EvtGenExternal PUBLIC ${Tauola++_CxxInterface_LIBRARY} ${Tauola++_Fortran_LIBRARY}) # Older versions of Tauola don't have the HepMC component, the HepMC2 interface is in CxxInterface if(Tauola++_HepMC_FOUND) target_link_libraries(EvtGenExternal PUBLIC ${Tauola++_HepMC_LIBRARY}) endif() endif() endif() # Now make the static library from the object files add_library(EvtGenExternalStatic STATIC $) set_target_properties(EvtGenExternalStatic PROPERTIES OUTPUT_NAME EvtGenExternal) set_target_properties(EvtGenExternalStatic PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) - target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_CPP11) target_include_directories(EvtGenExternalStatic PUBLIC $ $) if(EVTGEN_PYTHIA) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_PYTHIA) target_include_directories(EvtGenExternalStatic PUBLIC ${PYTHIA8_INCLUDE_DIRS}) target_link_libraries(EvtGenExternalStatic PUBLIC ${PYTHIA8_LIBRARIES}) endif() if(EVTGEN_HEPMC3) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_HEPMC3) target_include_directories(EvtGenExternalStatic PUBLIC ${HEPMC3_INCLUDE_DIR}) target_link_libraries(EvtGenExternalStatic PUBLIC ${HEPMC3_LIB} ${HEPMC3_SEARCH_LIB}) if(EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_PHOTOS_NEWLIBS) target_include_directories(EvtGenExternalStatic PUBLIC ${Photos++_INCLUDE_DIRS}) # From version 3.64 Photos has HepMC3 support target_link_libraries(EvtGenExternalStatic PUBLIC ${Photos++_pp_LIBRARY} ${Photos++_ppHepMC3_LIBRARY}) endif() if(EVTGEN_TAUOLA) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_TAUOLA) target_include_directories(EvtGenExternalStatic PUBLIC ${Tauola++_INCLUDE_DIRS}) # From version 1.1.8 Tauola has HepMC3 support target_link_libraries(EvtGenExternalStatic PUBLIC ${Tauola++_CxxInterface_LIBRARY} ${Tauola++_Fortran_LIBRARY} ${Tauola++_HepMC3_LIBRARY}) endif() else() target_include_directories(EvtGenExternalStatic PUBLIC ${HEPMC2_INCLUDE_DIR}) target_link_libraries(EvtGenExternalStatic PUBLIC ${HEPMC2_LIBRARIES}) if(EVTGEN_PHOTOS) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_PHOTOS) target_include_directories(EvtGenExternalStatic PUBLIC ${Photos++_INCLUDE_DIRS}) # Photos has different library structures for versions before and after 3.58 # so we need to check which one we have if(Photos++_pp_FOUND AND Photos++_ppHepMC_FOUND) #message(STATUS "EvtGen: PHOTOS has pp and ppHepMC components") target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_PHOTOS_NEWLIBS) target_link_libraries(EvtGenExternalStatic PUBLIC ${Photos++_pp_LIBRARY} ${Photos++_ppHepMC_LIBRARY}) elseif(Photos++_CxxInterface_FOUND AND Photos++_Fortran_FOUND) #message(STATUS "EvtGen: PHOTOS has CxxInterface and Fortran components") target_link_libraries(EvtGenExternalStatic PUBLIC ${Photos++_CxxInterface_LIBRARY} ${Photos++_Fortran_LIBRARY}) else() message(ERROR "EvtGen: PHOTOS lacks pp+ppHepMC or CxxInterface+Fortran components") endif() endif() if(EVTGEN_TAUOLA) target_compile_definitions(EvtGenExternalStatic PUBLIC EVTGEN_TAUOLA) target_include_directories(EvtGenExternalStatic PUBLIC ${Tauola++_INCLUDE_DIRS}) target_link_libraries(EvtGenExternalStatic PUBLIC ${Tauola++_CxxInterface_LIBRARY} ${Tauola++_Fortran_LIBRARY}) # Older versions of Tauola don't have the HepMC component, the HepMC2 interface is in CxxInterface if(Tauola++_HepMC_FOUND) target_link_libraries(EvtGenExternalStatic PUBLIC ${Tauola++_HepMC_LIBRARY}) endif() endif() endif() endif() # Install the libraries install( TARGETS EvtGen EvtGenStatic EXPORT "EvtGenTargets" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) if( EVTGEN_PYTHIA OR EVTGEN_PHOTOS OR EVTGEN_TAUOLA ) install( TARGETS EvtGenExternal EvtGenExternalStatic EXPORT "EvtGenTargets" LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) endif() diff --git a/test/evt_dalitz.cc b/test/evt_dalitz.cc index c2fdf6b..9133cd9 100644 --- a/test/evt_dalitz.cc +++ b/test/evt_dalitz.cc @@ -1,172 +1,166 @@ /*********************************************************************** * 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 . * ***********************************************************************/ /* * Generate the kinematics of a Dalitz decay * according to a decay file. */ #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #include "EvtGenBase/EvtVector4R.hh" #include #include #include #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include #include #include using std::endl; using std::fstream; using std::ifstream; using std::ofstream; void usage( const char* cmd ) { printf( "Usage: %s -d -m -n -f -r \n", cmd ); } int main( int argc, char* argv[] ) { std::string mother( "B+" ); int N = 10; std::string datfile( "output.dat" ); std::string decfile = ( "../DECAY.DEC" ); // Get options extern char* optarg; int c; while ( ( c = getopt( argc, argv, "d:m:n:f:" ) ) != EOF ) { switch ( c ) { case 'm': mother = std::string( optarg ); break; case 'n': N = atoi( optarg ); break; case 'f': datfile = std::string( optarg ); break; case 'd': decfile = std::string( optarg ); break; } } // Initialize EvtGen // Define the random number generator - EvtRandomEngine* eng = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - eng = new EvtMTRandomEngine(); -#else - eng = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* eng = new EvtMTRandomEngine(); EvtRandom::setRandomEngine( eng ); 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 myGenerator( decfile.c_str(), "../evt.pdl", eng, radCorrEngine, &extraModels ); // Initialize decay EvtId id = EvtPDL::getId( mother ); // generate ofstream df( datfile.c_str() ); int count = 1; do { EvtVector4R p_init( EvtPDL::getMass( id ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( id, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); int nDaug = root_part->getNDaug(); if ( nDaug == 3 ) { EvtVector4R p0 = root_part->getDaug( 0 )->getP4Lab(); EvtVector4R p1 = root_part->getDaug( 1 )->getP4Lab(); EvtVector4R p2 = root_part->getDaug( 2 )->getP4Lab(); double qAB = ( p0 + p1 ).mass2(); double qBC = ( p1 + p2 ).mass2(); double qCA = ( p2 + p0 ).mass2(); df << qAB << " " << qBC << " " << qCA << " " << endl; } root_part->deleteTree(); } while ( count++ < N ); delete eng; } // Macro for displaying resutls /* TTree* readTree(const char* file, int N) { double qAB,qBC,qCA; TTree* t = new TTree(); t->Branch("qAB",&qAB,"qAB/D"); t->Branch("qBC",&qBC,"qBC/D"); t->Branch("qCA",&qCA,"qCA/D"); ifstream f(file); int i=0; while(i < N) { i++; f >> qAB >> qBC >> qCA; t->Fill(); } return t; } */ diff --git a/test/evtgenlhc_test1.cc b/test/evtgenlhc_test1.cc index ded4760..a8adebd 100644 --- a/test/evtgenlhc_test1.cc +++ b/test/evtgenlhc_test1.cc @@ -1,5782 +1,5776 @@ /*********************************************************************** * 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 . * ***********************************************************************/ //#@# Dalitz plot for D0 --> K- pi+ pi0 decay: //#@# 1: Mass(K-, pi+) //#@# 2: Mass(pi+,pi0) // // Description: // // This program invokes the EvtGen event generator package // for testing various decay models that are implemented. #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtComplex.hh" #include "EvtGenBase/EvtConst.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtDecayTable.hh" #include "EvtGenBase/EvtDiracSpinor.hh" #include "EvtGenBase/EvtGammaMatrix.hh" #include "EvtGenBase/EvtIdSet.hh" #include "EvtGenBase/EvtKine.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParser.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtRadCorr.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtRandomEngine.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtSecondary.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #include "EvtGenBase/EvtStdHep.hh" #include "EvtGenBase/EvtTensor4C.hh" #include "EvtGenBase/EvtVector4C.hh" #include "EvtGenBase/EvtVector4R.hh" #include "EvtGenBase/EvtVectorParticle.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include "TApplication.h" #include "TFile.h" #include "TH1.h" #include "TH2.h" #include "TROOT.h" #include "TString.h" #include "TTree.h" #include #include #include #include #include #include #include using std::vector; void runFile( int nevent, char* fname, EvtGen& myGenerator ); void runPrint( int nevent, char* fname, EvtGen& myGenerator ); void runFileVpho( int nevent, char* fname, EvtGen& myGenerator ); void runTest1( int nevent, EvtGen& myGenerator ); void runTest2( int nevent, EvtGen& myGenerator ); void runOmega( int nevent, EvtGen& myGenerator ); void runChi1Kstar( int nevent, EvtGen& myGenerator ); void runPi0Dalitz( int nevent, EvtGen& myGenerator ); void runMix( int nevent, EvtGen& myGenerator ); void runBMix( int nevent, EvtGen& myGenerator, std::string userFile, std::string rootFile ); void runDDalitz( int nevent, EvtGen& myGenerator ); void runPiPiCPT( int nevent, EvtGen& myGenerator ); void runPiPiPiPi( int nevent, EvtGen& myGenerator ); void runD2Pi( int nevent, EvtGen& myGenerator ); void runJetsetTab3( int nevent, EvtGen& myGenerator ); void runHelAmp( int nevent, EvtGen& myGenerator, std::string userFile, std::string rootFile ); void runHelAmp2( int nevent, EvtGen& myGenerator ); void runJpsiKs( int nevent, EvtGen& myGenerator ); void runDump( int nevent, EvtGen& myGenerator ); void runD1( int nevent, EvtGen& myGenerator ); void runGenericCont( int nevent, EvtGen& myGenerator ); void runPiPiPi( int nevent, EvtGen& myGenerator ); void runSingleB( int nevent, EvtGen& myGenerator ); void runA2Pi( int nevent, EvtGen& myGenerator ); void runAlias(); void runRepeat( int nevent ); void runFSR( int nevent, EvtGen& myGenerator ); void runTrackMult( int nevent, EvtGen& myGenerator ); void runGeneric( int neventOrig, EvtGen& myGenerator, std::string listfile ); void runFinalStates( int nevent, EvtGen& myGenerator ); std::vector findFinalState( EvtParticle* p ); void runKstarnunu( int nevent, EvtGen& myGenerator ); void runBsmix( int nevent, EvtGen& myGenerator ); void runTauTauPiPi( int nevent, EvtGen& myGenerator ); void runTauTauEE( int nevent, EvtGen& myGenerator ); void runTauTau2Pi2Pi( int nevent, EvtGen& myGenerator ); void runTauTau3Pi3Pi( int nevent, EvtGen& myGenerator ); void runJPsiKstar( int nevent, EvtGen& myGenerator, int modeInt ); void runSVVCPLH( int nevent, EvtGen& myGenerator ); void runSVSCPLH( int nevent, EvtGen& myGenerator ); void runSSDCP( int nevent, EvtGen& myGenerator ); void runDSTARPI( int nevent, EvtGen& myGenerator ); void runETACPHIPHI( int nevent, EvtGen& myGenerator ); void runVVPiPi( int nevent, EvtGen& myGenerator ); void runSVVHelAmp( int nevent, EvtGen& myGenerator ); void runSVVHelAmp2( int nevent, EvtGen& myGenerator ); void runPartWave( int nevent, EvtGen& myGenerator ); void runPartWave2( int nevent, EvtGen& myGenerator ); void runTwoBody( int nevent, EvtGen& myGenerator, std::string decfile, std::string rootFile ); void runPiPi( int nevent, EvtGen& myGenerator ); void runA1Pi( int nevent, EvtGen& myGenerator ); void runCPTest( int nevent, EvtGen& myGenerator ); void runSemic( int nevent, EvtGen& myGenerator ); void runKstarll( int nevent, EvtGen& myGenerator ); void runKll( int nevent, EvtGen& myGenerator ); void runHll( int nevent, EvtGen& myGenerator, char* mode ); void runVectorIsr( int nevent, EvtGen& myGenerator ); void runBsquark( int nevent, EvtGen& myGenerator ); void runK3gamma( int nevent, EvtGen& myGenerator ); void runLambda( int nevent, EvtGen& myGenerator ); void runBtoXsgamma( int nevent, EvtGen& myGenerator ); void runBtoK1273gamma( int nevent, EvtGen& myGenerator ); void runCheckRotBoost(); void runMassCheck( int nevent, EvtGen& myGenerator, int partnum ); void runJpsiPolarization( int nevent, EvtGen& myGenerator ); void runDDK( int nevent, EvtGen& myGenerator ); void runPhspDecaytimeCut( int nevent, EvtGen& myGenerator ); int countInclusive( std::string name, EvtParticle* root, TH1F* mom = nullptr, TH1F* mass = nullptr ); int countInclusiveParent( std::string name, EvtParticle* root, EvtIdSet setIds, TH1F* mom = nullptr ); int countInclusiveSubTree( std::string name, EvtParticle* root, EvtIdSet setIds, TH1F* mom = nullptr ); void runBaryonic( int nEvent, EvtGen& myGenerator ); void run3BPhspRegion( int nEvent, EvtGen& myGenerator ); void runFourBody( int nevent, EvtGen& myGenerator ); int main( int argc, char* argv[] ) { // Define the random number generator - EvtRandomEngine* myRandomEngine = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - myRandomEngine = new EvtMTRandomEngine(); -#else - myRandomEngine = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* myRandomEngine = new EvtMTRandomEngine(); if ( !TROOT::Initialized() ) { static TROOT root( "RooTuple", "RooTuple ROOT in EvtGen" ); } if ( argc == 1 ) { EvtVector4R p( 0.0, 1.0, 0.0, 0.0 ); EvtVector4R k( 0.0, 0.0, 1.0, 0.0 ); EvtTensor4C T = dual( EvtGenFunctions::directProd( p, k ) ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "p:" << p << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "k:" << k << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "T=dual(directProd(p,k)):" << T << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "T03:" << T.get( 0, 3 ) << std::endl; return 1; } 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 myGenerator( "../DECAY.DEC", "../evt.pdl", myRandomEngine, radCorrEngine, &extraModels ); if ( !strcmp( argv[1], "file" ) ) { int nevent = atoi( argv[2] ); runFile( nevent, argv[3], myGenerator ); } if ( !strcmp( argv[1], "print" ) ) { int nevent = atoi( argv[2] ); runPrint( nevent, argv[3], myGenerator ); } if ( !strcmp( argv[1], "filevpho" ) ) { int nevent = atoi( argv[2] ); runFileVpho( nevent, argv[3], myGenerator ); } if ( !strcmp( argv[1], "test1" ) ) { int nevent = atoi( argv[2] ); runTest1( nevent, myGenerator ); } if ( !strcmp( argv[1], "chi1kstar" ) ) { int nevent = atoi( argv[2] ); runChi1Kstar( nevent, myGenerator ); } if ( !strcmp( argv[1], "test2" ) ) { int nevent = atoi( argv[2] ); runTest2( nevent, myGenerator ); } if ( !strcmp( argv[1], "omega" ) ) { int nevent = atoi( argv[2] ); runOmega( nevent, myGenerator ); } if ( !strcmp( argv[1], "alias" ) ) { runAlias(); } if ( !strcmp( argv[1], "repeat" ) ) { int nevent = atoi( argv[2] ); runRepeat( nevent ); } if ( !strcmp( argv[1], "fsr" ) ) { int nevent = atoi( argv[2] ); runFSR( nevent, myGenerator ); } if ( !strcmp( argv[1], "trackmult" ) ) { int nevent = atoi( argv[2] ); runTrackMult( nevent, myGenerator ); } if ( !strcmp( argv[1], "generic" ) ) { int nevent = atoi( argv[2] ); std::string listfile( "" ); if ( argc == 4 ) listfile = argv[3]; runGeneric( nevent, myGenerator, listfile ); } if ( !strcmp( argv[1], "finalstates" ) ) { int nevent = atoi( argv[2] ); runFinalStates( nevent, myGenerator ); } if ( !strcmp( argv[1], "kstarnunu" ) ) { int nevent = atoi( argv[2] ); runKstarnunu( nevent, myGenerator ); } if ( !strcmp( argv[1], "bsmix" ) ) { int nevent = atoi( argv[2] ); runBsmix( nevent, myGenerator ); } if ( !strcmp( argv[1], "BtoXsgamma" ) ) { int nevent = atoi( argv[2] ); runBtoXsgamma( nevent, myGenerator ); } if ( !strcmp( argv[1], "BtoK1273gamma" ) ) { int nevent = atoi( argv[2] ); runBtoK1273gamma( nevent, myGenerator ); } if ( !strcmp( argv[1], "pi0dalitz" ) ) { int nevent = atoi( argv[2] ); runPi0Dalitz( nevent, myGenerator ); } if ( !strcmp( argv[1], "ddalitz" ) ) { int nevent = atoi( argv[2] ); runDDalitz( nevent, myGenerator ); } if ( !strcmp( argv[1], "kstarll" ) ) { int nevent = atoi( argv[2] ); runKstarll( nevent, myGenerator ); } if ( !strcmp( argv[1], "kll" ) ) { int nevent = atoi( argv[2] ); runKll( nevent, myGenerator ); } if ( !strcmp( argv[1], "hll" ) ) { int nevent = atoi( argv[2] ); runHll( nevent, myGenerator, argv[3] ); } if ( !strcmp( argv[1], "vectorisr" ) ) { int nevent = atoi( argv[2] ); runVectorIsr( nevent, myGenerator ); } if ( !strcmp( argv[1], "bsquark" ) ) { int nevent = atoi( argv[2] ); runBsquark( nevent, myGenerator ); } if ( !strcmp( argv[1], "k3gamma" ) ) { int nevent = atoi( argv[2] ); runK3gamma( nevent, myGenerator ); } if ( !strcmp( argv[1], "lambda" ) ) { int nevent = atoi( argv[2] ); runLambda( nevent, myGenerator ); } if ( !strcmp( argv[1], "tautaupipi" ) ) { int nevent = atoi( argv[2] ); runTauTauPiPi( nevent, myGenerator ); } if ( !strcmp( argv[1], "tautauee" ) ) { int nevent = atoi( argv[2] ); runTauTauEE( nevent, myGenerator ); } if ( !strcmp( argv[1], "tautau2pi2pi" ) ) { int nevent = atoi( argv[2] ); runTauTau2Pi2Pi( nevent, myGenerator ); } if ( !strcmp( argv[1], "tautau3pi3pi" ) ) { int nevent = atoi( argv[2] ); runTauTau3Pi3Pi( nevent, myGenerator ); } if ( !strcmp( argv[1], "jpsikstar" ) ) { int nevent = atoi( argv[2] ); int modeInt = atoi( argv[3] ); runJPsiKstar( nevent, myGenerator, modeInt ); } if ( !strcmp( argv[1], "svvcplh" ) ) { int nevent = atoi( argv[2] ); runSVVCPLH( nevent, myGenerator ); } if ( !strcmp( argv[1], "svscplh" ) ) { int nevent = atoi( argv[2] ); runSVSCPLH( nevent, myGenerator ); } if ( !strcmp( argv[1], "ssdcp" ) ) { int nevent = atoi( argv[2] ); runSSDCP( nevent, myGenerator ); } if ( !strcmp( argv[1], "dstarpi" ) ) { int nevent = atoi( argv[2] ); runDSTARPI( nevent, myGenerator ); } if ( !strcmp( argv[1], "etacphiphi" ) ) { int nevent = atoi( argv[2] ); runETACPHIPHI( nevent, myGenerator ); } if ( !strcmp( argv[1], "vvpipi" ) ) { int nevent = atoi( argv[2] ); runVVPiPi( nevent, myGenerator ); } if ( !strcmp( argv[1], "svvhelamp" ) ) { int nevent = atoi( argv[2] ); runSVVHelAmp( nevent, myGenerator ); } if ( !strcmp( argv[1], "partwave" ) ) { int nevent = atoi( argv[2] ); runPartWave( nevent, myGenerator ); } if ( !strcmp( argv[1], "partwave2" ) ) { int nevent = atoi( argv[2] ); runPartWave2( nevent, myGenerator ); } if ( !strcmp( argv[1], "twobody" ) ) { int nevent = atoi( argv[2] ); runTwoBody( nevent, myGenerator, argv[3], argv[4] ); } if ( !strcmp( argv[1], "pipipi" ) ) { int nevent = atoi( argv[2] ); runPiPiPi( nevent, myGenerator ); } if ( !strcmp( argv[1], "singleb" ) ) { int nevent = atoi( argv[2] ); runSingleB( nevent, myGenerator ); } if ( !strcmp( argv[1], "pipi" ) ) { int nevent = atoi( argv[2] ); runPiPi( nevent, myGenerator ); } if ( !strcmp( argv[1], "pipipipi" ) ) { int nevent = atoi( argv[2] ); runPiPiPiPi( nevent, myGenerator ); } if ( !strcmp( argv[1], "a2pi" ) ) { int nevent = atoi( argv[2] ); runA2Pi( nevent, myGenerator ); } if ( !strcmp( argv[1], "helamp" ) ) { int nevent = atoi( argv[2] ); runHelAmp( nevent, myGenerator, argv[3], argv[4] ); } if ( !strcmp( argv[1], "helamp2" ) ) { int nevent = atoi( argv[2] ); runHelAmp2( nevent, myGenerator ); } if ( !strcmp( argv[1], "d2pi" ) ) { int nevent = atoi( argv[2] ); runD2Pi( nevent, myGenerator ); } if ( !strcmp( argv[1], "a1pi" ) ) { int nevent = atoi( argv[2] ); runA1Pi( nevent, myGenerator ); } if ( !strcmp( argv[1], "cptest" ) ) { int nevent = atoi( argv[2] ); runCPTest( nevent, myGenerator ); } if ( !strcmp( argv[1], "pipicpt" ) ) { int nevent = atoi( argv[2] ); runPiPiCPT( nevent, myGenerator ); } if ( !strcmp( argv[1], "jpsiks" ) ) { int nevent = atoi( argv[2] ); runJpsiKs( nevent, myGenerator ); } if ( !strcmp( argv[1], "dump" ) ) { int nevent = atoi( argv[2] ); runDump( nevent, myGenerator ); } if ( !strcmp( argv[1], "genericcont" ) ) { int nevent = atoi( argv[2] ); runGenericCont( nevent, myGenerator ); } if ( !strcmp( argv[1], "d1" ) ) { int nevent = atoi( argv[2] ); runD1( nevent, myGenerator ); } if ( !strcmp( argv[1], "mix" ) ) { int nevent = atoi( argv[2] ); runMix( nevent, myGenerator ); } if ( !strcmp( argv[1], "bmix" ) ) { int nevent = atoi( argv[2] ); runBMix( nevent, myGenerator, argv[3], argv[4] ); } if ( !strcmp( argv[1], "semic" ) ) { int nevent = atoi( argv[2] ); runSemic( nevent, myGenerator ); } if ( !strcmp( argv[1], "ddk" ) ) { int nevent = atoi( argv[2] ); runDDK( nevent, myGenerator ); } if ( !strcmp( argv[1], "checkmass" ) ) { int nevent = atoi( argv[2] ); int partnum = atoi( argv[3] ); runMassCheck( nevent, myGenerator, partnum ); } if ( !strcmp( argv[1], "jpsipolarization" ) ) { int nevent = atoi( argv[2] ); runJpsiPolarization( nevent, myGenerator ); } if ( !strcmp( argv[1], "phspdecaytimecut" ) ) { int nevent = atoi( argv[2] ); runPhspDecaytimeCut( nevent, myGenerator ); } if ( !strcmp( argv[1], "3bodyPhsp" ) ) { int nevent = atoi( argv[2] ); EvtRadCorr::setNeverRadCorr(); run3BPhspRegion( nevent, myGenerator ); } if ( !strcmp( argv[1], "4bodyPhsp" ) ) { int nevent = atoi( argv[2] ); EvtRadCorr::setNeverRadCorr(); runFourBody( nevent, myGenerator ); } //******************************************************* //test of the rotations and boosts performed in EvtGen. // Added by Lange and Ryd Jan 5,2000. //******************************************************* if ( !strcmp( argv[1], "checkrotboost" ) ) { runCheckRotBoost(); } if ( !strcmp( argv[1], "baryonic" ) ) { runBaryonic( atoi( argv[2] ), myGenerator ); } delete myRandomEngine; return 0; } void runFile( int nevent, char* fname, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int count; char udecay_name[100]; strcpy( udecay_name, fname ); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); root_part->deleteTree(); } while ( count++ < nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPrint( int nevent, char* fname, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int count; char udecay_name[100]; strcpy( udecay_name, fname ); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); root_part->printTree(); root_part->deleteTree(); } while ( count++ < nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runFileVpho( int nevent, char* fname, EvtGen& myGenerator ) { static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int count; char udecay_name[100]; strcpy( udecay_name, fname ); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); root_part->deleteTree(); } while ( count++ < nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } /////////////// void runJpsiPolarization( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId JPSI = EvtPDL::getId( std::string( "J/psi" ) ); int count; myGenerator.readUDecay( "exampleFiles/GENERIC.DEC" ); myGenerator.readUDecay( "exampleFiles/JPSITOLL.DEC" ); TFile* file = new TFile( "jpsipolar.root", "RECREATE" ); TH1F* coshel = new TH1F( "h1", "cos hel", 50, -1.0, 1.0 ); TH1F* coshelHigh = new TH1F( "h2", "cos hel pstar gt 1.1", 50, -1.0, 1.0 ); TH1F* coshelLow = new TH1F( "h3", "cos hel pstar lt 1.1", 50, -1.0, 1.0 ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* p = root_part; do { if ( p->getId() == JPSI ) { EvtVector4R p4psi = p->getP4Lab(); EvtVector4R p4Daug = p->getDaug( 0 )->getP4Lab(); double dcostheta = EvtDecayAngle( p_init, p4psi, p4Daug ); coshel->Fill( dcostheta ); if ( p4psi.d3mag() > 1.1 ) { coshelHigh->Fill( dcostheta ); } else { coshelLow->Fill( dcostheta ); } } p = p->nextIter( root_part ); } while ( p != nullptr ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runMassCheck( int nevent, EvtGen& /*myGenerator*/, int partnum ) { int count; static EvtId myPart = EvtPDL::evtIdFromStdHep( partnum ); TFile* file = new TFile( "checkmass.root", "RECREATE" ); TH1F* mass = new TH1F( "h1", "Mass", 500, 0.0, 2.5 ); count = 1; do { mass->Fill( EvtPDL::getMass( myPart ) ); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPi0Dalitz( int nevent, EvtGen& myGenerator ) { static EvtId PI0 = EvtPDL::getId( std::string( "pi0" ) ); TFile* file = new TFile( "pi0dalitz.root", "RECREATE" ); TH1F* q2 = new TH1F( "h1", "q2", 50, 0.0, 0.02 ); int count; myGenerator.readUDecay( "exampleFiles/PI0DALITZ.DEC" ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( PI0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( PI0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R ep = root_part->getDaug( 0 )->getP4Lab(); EvtVector4R em = root_part->getDaug( 1 )->getP4Lab(); //EvtVector4R gamma=root_part->getDaug(2)->getP4Lab(); q2->Fill( ( ep + em ).mass2() ); // EvtGenReport(EVTGEN_INFO,"EvtGen") << ep << em << gamma <deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } //******************************************************************************* void runTest1( int nevent, EvtGen& myGenerator ) { // TFile *file=new TFile("test1.root", "RECREATE"); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); // int first=0; // char **second; // TApplication *theApp = new TApplication("App", &first, second); TFile* file = new TFile( "test1.root", "RECREATE", "Example" ); TH1F* costhetaB = new TH1F( "hcosthetaB", "costhetaB", 50, -1.0, 1.0 ); TH1F* phiB = new TH1F( "hphiB", "phiB", 50, -EvtConst::pi, EvtConst::pi ); TH1F* Elep = new TH1F( "hEl", "E?l!", 50, 0.0, 2.5 ); TH1F* q2 = new TH1F( "hq2", "q^2!", 44, 0.0, 11.0 ); TH1F* ctv = new TH1F( "hctv", "ctv", 50, -1.0, 1.0 ); TH1F* chi_low_ctv = new TH1F( "hcostv1", "[h] for cos[Q]?V!\"L#0", 50, 0.0, EvtConst::twoPi ); TH1F* chi_high_ctv = new TH1F( "hcostv2", "[h] for cos[Q]?V!\"G#0", 50, 0.0, EvtConst::twoPi ); TH1F* dt = new TH1F( "hdt", "dt", 50, -5.0, 5.0 ); int count; EvtVector4R p4b0, p4b0b, p4dstar, p4e, p4nu, p4d, p4pi, p4pip, p4pim; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TEST1.DEC" ); // EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); double costhetaV; count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p4b0 = root_part->getDaug( 0 )->getP4Lab(); p4b0b = root_part->getDaug( 1 )->getP4Lab(); p4dstar = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4e = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4nu = root_part->getDaug( 0 )->getDaug( 2 )->getP4Lab(); p4d = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4pi = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4pip = root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab(); p4pim = root_part->getDaug( 1 )->getDaug( 1 )->getP4Lab(); costhetaB->Fill( p4b0.get( 3 ) / p4b0.d3mag() ); phiB->Fill( atan2( p4b0.get( 1 ), p4b0.get( 2 ) ) ); Elep->Fill( p4b0 * p4e / p4b0.mass() ); q2->Fill( ( p4e + p4nu ).mass2() ); dt->Fill( root_part->getDaug( 1 )->getLifetime() - root_part->getDaug( 0 )->getLifetime() ); costhetaV = EvtDecayAngle( p4b0, p4d + p4pi, p4d ); ctv->Fill( costhetaV ); if ( costhetaV < 0.0 ) { chi_low_ctv->Fill( EvtDecayAngleChi( p4b0, p4d, p4pi, p4e, p4nu ) ); } else { chi_high_ctv->Fill( EvtDecayAngleChi( p4b0, p4d, p4pi, p4e, p4nu ) ); } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); // delete theApp; // hfile.write(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } //******************************************************************************* void runDDK( int nevent, EvtGen& myGenerator ) { // TFile *file=new TFile("test1.root", "RECREATE"); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int count; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/GENERIC.DEC" ); myGenerator.readUDecay( udecay_name ); count = 1; static EvtId kp = EvtPDL::getId( std::string( "K+" ) ); static EvtId km = EvtPDL::getId( std::string( "K-" ) ); static EvtId ks = EvtPDL::getId( std::string( "K_S0" ) ); static EvtId kl = EvtPDL::getId( std::string( "K_L0" ) ); static EvtId k0 = EvtPDL::getId( std::string( "K0" ) ); static EvtId kb = EvtPDL::getId( std::string( "anti-K0" ) ); static EvtId d0 = EvtPDL::getId( std::string( "D0" ) ); static EvtId dp = EvtPDL::getId( std::string( "D+" ) ); static EvtId dm = EvtPDL::getId( std::string( "D-" ) ); static EvtId db = EvtPDL::getId( std::string( "anti-D0" ) ); static EvtIdSet theKs{ kp, km, ks, kl, k0, kb }; static EvtIdSet theDs{ d0, dp, dm, db }; static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); static EvtId BP = EvtPDL::getId( std::string( "B+" ) ); static EvtId BM = EvtPDL::getId( std::string( "B-" ) ); static EvtIdSet theBs{ B0B, B0, BP, BM }; int nDDK = 0; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* theB01 = root_part->getDaug( 0 ); EvtParticle* theB02 = root_part->getDaug( 1 ); int nD = 0; int nK = 0; EvtParticle* p = theB01; do { EvtId type = p->getId(); EvtId typePar = p->getParent()->getId(); if ( theDs.contains( type ) ) nD++; if ( theKs.contains( type ) && theBs.contains( typePar ) ) nK++; p = p->nextIter( theB01 ); } while ( p != nullptr ); if ( nD == 2 && nK == 1 ) nDDK++; nD = 0; nK = 0; p = theB02; do { EvtId type = p->getId(); EvtId typePar = p->getParent()->getId(); if ( theDs.contains( type ) ) nD++; if ( theKs.contains( type ) && theBs.contains( typePar ) ) nK++; p = p->nextIter( theB02 ); } while ( p != nullptr ); if ( nD == 2 && nK == 1 ) nDDK++; root_part->deleteTree(); } while ( count++ < nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << nDDK << " " << ( count - 1 ) << " " << nDDK / float( 2 * ( count - 1 ) ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } //******************************************************************************* void runTest2( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "test2.root", "RECREATE" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); TH1F* costhetaB = new TH1F( "h1", "cos[Q]?B!", 50, -1.0, 1.0 ); TH1F* phiB = new TH1F( "h2", "[f]?B!", 50, -EvtConst::pi, EvtConst::pi ); TH1F* dt = new TH1F( "h3", "[D]t", 100, -5.0, 5.0 ); TH1F* costhetaJpsi = new TH1F( "h4", "cos[Q]?J/[y]!", 50, -1.0, 1.0 ); TH1F* costhetaKstar = new TH1F( "h5", "cos[Q]?K*!", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h6", "[h]", 50, 0.0, EvtConst::twoPi ); TH1F* chi1 = new TH1F( "h26", "[h] [D]t\"L#0", 50, 0.0, EvtConst::twoPi ); TH1F* chi2 = new TH1F( "h27", "[h] [D]t\"G#0", 50, 0.0, EvtConst::twoPi ); TH1F* costhetaomega = new TH1F( "h7", "costhetaomega", 50, -1.0, 1.0 ); TH1F* costhetaomega1 = new TH1F( "h20", "costhetaomega1", 50, -1.0, 1.0 ); TH1F* costhetaomega2 = new TH1F( "h21", "costhetaomega2", 50, -1.0, 1.0 ); TH1F* costhetaomega3 = new TH1F( "h22", "costhetaomega3", 50, -1.0, 1.0 ); TH1F* omegaamp = new TH1F( "h8", "omegaamp", 50, 0.0, 0.05 ); TH1F* omegaamp1 = new TH1F( "h9", "omegaamp1", 50, 0.0, 0.05 ); TH1F* omegaamp2 = new TH1F( "h10", "omegaamp2", 50, 0.0, 0.05 ); TH1F* omegaamp3 = new TH1F( "h11", "omegaamp3", 50, 0.0, 0.05 ); TH2F* chi1vscoskstarl = new TH2F( "h30", "[h] vs. cos[Q]?J/[y]! [D]t\"L#0", 20, 0.0, EvtConst::twoPi, 20, -1.0, 1.0 ); TH2F* chi1vscoskstarg = new TH2F( "h31", "[h] vs. cos[Q]?J/[y]! [D]t\"G#0", 20, 0.0, EvtConst::twoPi, 20, -1.0, 1.0 ); int count = 1; EvtVector4R p4_b0, p4_b0b, p4_psi, p4_kstar, p4_mup, p4_mum; EvtVector4R p4_kz, p4_pi0, p4_pi1, p4_pi2, p4_pi3, p4_omega; EvtVector4R p4_pi1_omega, p4_pi2_omega, p4_pi3_omega; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TEST2.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p4_b0 = root_part->getDaug( 0 )->getP4Lab(); p4_b0b = root_part->getDaug( 1 )->getP4Lab(); p4_psi = root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab(); p4_kstar = root_part->getDaug( 1 )->getDaug( 1 )->getP4Lab(); p4_mup = root_part->getDaug( 1 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4_mum = root_part->getDaug( 1 )->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4_kz = root_part->getDaug( 1 )->getDaug( 1 )->getDaug( 0 )->getP4Lab(); p4_pi0 = root_part->getDaug( 1 )->getDaug( 1 )->getDaug( 1 )->getP4Lab(); p4_omega = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4_pi1 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4_pi2 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4_pi3 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 2 )->getP4Lab(); //get momentum in the omega restframe p4_pi1_omega = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4(); p4_pi2_omega = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 1 )->getP4(); p4_pi3_omega = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 2 )->getP4(); EvtVector3R p3_perp = cross( EvtVector3R( p4_pi2_omega.get( 0 ), p4_pi2_omega.get( 1 ), p4_pi2_omega.get( 2 ) ), EvtVector3R( p4_pi3_omega.get( 0 ), p4_pi3_omega.get( 1 ), p4_pi3_omega.get( 2 ) ) ); EvtVector4R p4_perp( p3_perp.d3mag(), p3_perp.get( 0 ), p3_perp.get( 1 ), p3_perp.get( 2 ) ); root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->setP4( p4_perp ); p4_perp = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); EvtVector4R p4_perpprime = p4_omega - p4_perp; double d_omegaamp = EvtVector3R( p4_pi1_omega.get( 0 ), p4_pi1_omega.get( 1 ), p4_pi1_omega.get( 2 ) ) * p3_perp; d_omegaamp *= d_omegaamp; d_omegaamp *= 20.0; double d_dt = root_part->getDaug( 1 )->getLifetime() - root_part->getDaug( 0 )->getLifetime(); double d_costhetaJpsi = EvtDecayAngle( p4_b0b, p4_mup + p4_mum, p4_mup ); double d_costhetaKstar = EvtDecayAngle( p4_b0b, p4_pi0 + p4_kz, p4_pi0 ); double d_chi = EvtDecayAngleChi( p4_b0b, p4_pi0, p4_kz, p4_mup, p4_mum ); costhetaB->Fill( p4_b0.get( 3 ) / p4_b0.d3mag() ); phiB->Fill( atan2( p4_b0.get( 1 ), p4_b0.get( 2 ) ) ); dt->Fill( d_dt ); costhetaJpsi->Fill( d_costhetaJpsi ); costhetaKstar->Fill( d_costhetaKstar ); chi->Fill( d_chi ); if ( d_dt < 0.0 ) { chi1->Fill( d_chi ); chi1vscoskstarl->Fill( d_chi, d_costhetaJpsi, 1.0 ); } if ( d_dt > 0.0 ) { chi2->Fill( d_chi ); chi1vscoskstarg->Fill( d_chi, d_costhetaJpsi, 1.0 ); } double d_costhetaomega = EvtDecayAngle( p4_b0b, p4_perp + p4_perpprime, p4_perp ); costhetaomega->Fill( d_costhetaomega ); if ( d_omegaamp < 0.001 ) costhetaomega1->Fill( d_costhetaomega ); if ( d_omegaamp > 0.02 ) costhetaomega2->Fill( d_costhetaomega ); if ( std::fabs( d_omegaamp - 0.015 ) < 0.005 ) costhetaomega3->Fill( d_costhetaomega ); omegaamp->Fill( d_omegaamp ); if ( d_costhetaomega < -0.5 ) omegaamp1->Fill( d_omegaamp ); if ( d_costhetaomega > 0.5 ) omegaamp2->Fill( d_omegaamp ); if ( std::fabs( d_costhetaomega ) < 0.5 ) omegaamp3->Fill( d_omegaamp ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runOmega( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "omega.root", "RECREATE" ); static EvtId OMEGA = EvtPDL::getId( std::string( "omega" ) ); TH2F* dalitz = new TH2F( "h1", "E1 vs E2", 50, 0.0, 0.5, 50, 0.0, 0.5 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/OMEGA.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMeanMass( OMEGA ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( OMEGA, p_init ); //root_part->setDiagonalSpinDensity(); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); dalitz->Fill( root_part->getDaug( 0 )->getP4().get( 0 ), root_part->getDaug( 1 )->getP4().get( 0 ), 1.0 ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runChi1Kstar( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "chi1kstar.root", "RECREATE" ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); TH1F* costhetaChi1 = new TH1F( "h1", "cos[Q]?J/[x]!", 50, -1.0, 1.0 ); TH1F* costhetaKstar = new TH1F( "h2", "cos[Q]?K*!", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h3", "[x]", 50, -EvtConst::pi, EvtConst::pi ); int count = 1; EvtVector4R p4_b, p4_chi, p4_kstar, p4_gamma, p4_psi, p4_k, p4_p; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/CHI1KSTAR.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); myGenerator.generateDecay( root_part ); p4_b = root_part->getP4Lab(); p4_chi = root_part->getDaug( 0 )->getP4Lab(); p4_kstar = root_part->getDaug( 1 )->getP4Lab(); p4_psi = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4_gamma = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4_k = root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab(); p4_p = root_part->getDaug( 1 )->getDaug( 1 )->getP4Lab(); double d_costhetaChi1 = EvtDecayAngle( p4_b, p4_chi, p4_psi ); double d_costhetaKstar = EvtDecayAngle( p4_b, p4_kstar, p4_k ); double d_chi = EvtDecayAngleChi( p4_b, p4_k, p4_p, p4_psi, p4_gamma ); if ( d_chi > EvtConst::pi ) d_chi -= EvtConst::twoPi; costhetaChi1->Fill( d_costhetaChi1 ); costhetaKstar->Fill( d_costhetaKstar ); chi->Fill( d_chi ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runAlias() { EvtId idpip = EvtPDL::getId( std::string( "pi+" ) ); EvtPDL::alias( idpip, std::string( "my_pi+" ) ); EvtId myidpip = EvtPDL::getId( std::string( "my_pi+" ) ); EvtId idpim = EvtPDL::getId( std::string( "pi-" ) ); EvtPDL::alias( idpim, std::string( "my_pi-" ) ); EvtId myidpim = EvtPDL::getId( std::string( "my_pi-" ) ); EvtId idpi0 = EvtPDL::getId( std::string( "pi0" ) ); EvtPDL::alias( idpi0, std::string( "my_pi0" ) ); EvtId myidpi0 = EvtPDL::getId( std::string( "my_pi0" ) ); EvtPDL::aliasChgConj( myidpip, myidpim ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id pi+:" << idpip << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id pi-:" << idpim << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id pi0:" << idpi0 << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id my_pi+:" << myidpip << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id my_pi-:" << myidpim << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Id my_pi0:" << myidpi0 << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj pi+:" << EvtPDL::chargeConj( idpip ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj pi-:" << EvtPDL::chargeConj( idpim ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj pi0:" << EvtPDL::chargeConj( idpi0 ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj my_pi+:" << EvtPDL::chargeConj( myidpip ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj my_pi-:" << EvtPDL::chargeConj( myidpim ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Chg conj my_pi0:" << EvtPDL::chargeConj( myidpi0 ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runRepeat( int nevent ) { int i; for ( i = 0; i < nevent; i++ ) { EvtDecayTable::getInstance()->readDecayFile( std::string( "../DECAY.DEC" ) ); } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runFSR( int nevent, EvtGen& myGenerator ) { static EvtId PSI = EvtPDL::getId( std::string( "J/psi" ) ); TFile* file = new TFile( "fsr.root", "RECREATE" ); TH1F* mee = new TH1F( "h1", "mee", 60, 3.0, 3.12 ); int count = 1; EvtVector4R e1, e2; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/FSR.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( PSI ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( PSI, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); e1 = root_part->getDaug( 0 )->getP4Lab(); e2 = root_part->getDaug( 1 )->getP4Lab(); mee->Fill( ( e1 + e2 ).mass() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runFinalStates( int nevent, EvtGen& myGenerator ) { //Parse the table of particles to find.. EvtParser parser; parser.read( std::string( "exampleFiles/finalstates.list" ) ); std::vector dList[20]; int dListNum[20]; std::vector* dListItem = nullptr; std::string dListName[20]; int ik, lk; std::string tk = ""; int tline = -1; std::string parent; for ( ik = 0; ik < parser.getNToken(); ik++ ) { lk = tline; tline = parser.getLineofToken( ik ); tk = parser.getToken( ik ); if ( lk != tline && tline > 2 ) { if ( tline > 1 ) { dList[tline - 3] = *dListItem; dListItem = new std::vector; dListNum[tline - 3] = 0; dListName[tline - 2] = parser.getToken( ik ); } } else { if ( tline == 1 ) { //This is the parent particle name parent = parser.getToken( ik ); dListItem = new std::vector; } else { //This is one of the daughters if ( tline != 2 || ( lk == tline ) ) { dListItem->push_back( parser.getToken( ik ) ); } if ( tline == 2 && ( lk != tline ) ) { dListName[tline - 2] = parser.getToken( ik ); } } } } dList[tline - 2] = *dListItem; dListNum[tline - 2] = 0; static EvtId parId = EvtPDL::getId( parent ); int count = 0; do { if ( count == 1000 * ( count / 1000 ) ) { //if (count==1*(count/1)) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Event:" << count << std::endl; //EvtGenReport(EVTGEN_INFO,"EvtGen") << HepRandom::getTheSeed()<setVectorSpinDensity(); } else { root_part->setDiagonalSpinDensity(); } myGenerator.generateDecay( root_part ); EvtParticle* p = root_part; std::vector fs = findFinalState( p ); int j; for ( j = 0; j < ( tline - 1 ); j++ ) { std::vector temp = dList[j]; if ( temp.size() == fs.size() ) { bool foundIt = true; unsigned int k, l; std::vector alreadyUsed( temp.size() ); for ( k = 0; k < temp.size(); k++ ) { bool foundThisOne = false; for ( l = 0; l < temp.size(); l++ ) { if ( k == 0 ) alreadyUsed[l] = false; if ( foundThisOne || alreadyUsed[l] ) continue; if ( temp[k] == fs[l] ) { alreadyUsed[l] = true; foundThisOne = true; // EvtGenReport(EVTGEN_INFO,"EvtGen") << "found daughter " << k << " " << l << std::endl; } } if ( !foundThisOne ) foundIt = false; } if ( foundIt ) { //EvtGenReport(EVTGEN_INFO,"EvtGen") << "found a cand \n"; (histo1[j])->Fill(0.5); //EvtGenReport(EVTGEN_INFO,"EvtGen") << "found one " << j << std::endl; dListNum[j]++; } } } root_part->deleteTree(); count++; } while ( count < nevent ); int j; for ( j = 0; j < ( tline - 1 ); j++ ) EvtGenReport( EVTGEN_INFO, "EvtGen" ) << dListName[j].c_str() << " " << j << " " << dListNum[j] << " " << count << " " << ( dListNum[j] / ( 1.0 * count ) ) << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } std::vector findFinalState( EvtParticle* tree ) { EvtParticle* p = tree; std::vector fs; static EvtId ep = EvtPDL::getId( std::string( "e+" ) ); static EvtId em = EvtPDL::getId( std::string( "e-" ) ); static EvtId kp = EvtPDL::getId( std::string( "K+" ) ); static EvtId km = EvtPDL::getId( std::string( "K-" ) ); static EvtId mup = EvtPDL::getId( std::string( "mu+" ) ); static EvtId mum = EvtPDL::getId( std::string( "mu-" ) ); static EvtId pip = EvtPDL::getId( std::string( "pi+" ) ); static EvtId pim = EvtPDL::getId( std::string( "pi-" ) ); static EvtId pi0 = EvtPDL::getId( std::string( "pi0" ) ); static EvtId pr = EvtPDL::getId( std::string( "p+" ) ); static EvtId apr = EvtPDL::getId( std::string( "anti-p-" ) ); static EvtId ne = EvtPDL::getId( std::string( "n0" ) ); static EvtId ane = EvtPDL::getId( std::string( "anti-n0" ) ); do { EvtId type = p->getId(); if ( type == ep ) fs.push_back( std::string( "e+" ) ); if ( type == em ) fs.push_back( std::string( "e-" ) ); if ( type == mup ) fs.push_back( std::string( "mu+" ) ); if ( type == mum ) fs.push_back( std::string( "mu-" ) ); if ( type == kp ) fs.push_back( std::string( "K+" ) ); if ( type == km ) fs.push_back( std::string( "K-" ) ); if ( type == pip ) fs.push_back( std::string( "pi+" ) ); if ( type == pim ) fs.push_back( std::string( "pi-" ) ); if ( type == pi0 ) fs.push_back( std::string( "pi0" ) ); if ( type == pr ) fs.push_back( std::string( "p+" ) ); if ( type == apr ) fs.push_back( std::string( "anti-p-" ) ); if ( type == ne ) fs.push_back( std::string( "n0" ) ); if ( type == ane ) fs.push_back( std::string( "anti-n0" ) ); p = p->nextIter(); } while ( p != nullptr ); return fs; } void runTrackMult( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "trackmult.root", "RECREATE" ); TH1F* trackAll = new TH1F( "trackAll", "trackAll", 12, 1.0, 25.0 ); TH1F* trackNoSL = new TH1F( "trackNoSL", "trackNoSL", 12, 1.0, 25.0 ); TH1F* track1SL = new TH1F( "track1SL", "track1SL", 12, 1.0, 25.0 ); TH1F* track2SL = new TH1F( "track2SL", "track2SL", 12, 1.0, 25.0 ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); static EvtId BP = EvtPDL::getId( std::string( "B+" ) ); static EvtId BM = EvtPDL::getId( std::string( "B-" ) ); //look for these tracks in generic events static EvtId ep = EvtPDL::getId( std::string( "e+" ) ); static EvtId em = EvtPDL::getId( std::string( "e-" ) ); static EvtId mup = EvtPDL::getId( std::string( "mu+" ) ); static EvtId mum = EvtPDL::getId( std::string( "mu-" ) ); static EvtId pip = EvtPDL::getId( std::string( "pi+" ) ); static EvtId pim = EvtPDL::getId( std::string( "pi-" ) ); static EvtId kp = EvtPDL::getId( std::string( "K+" ) ); static EvtId km = EvtPDL::getId( std::string( "K-" ) ); static EvtId pp = EvtPDL::getId( std::string( "p+" ) ); static EvtId pm = EvtPDL::getId( std::string( "anti-p-" ) ); static EvtIdSet theTracks{ ep, em, mup, mum, pip, pim, kp, km, pp, pm }; static EvtIdSet theLeptons{ ep, em, mup, mum }; static EvtIdSet theBs{ B0, B0B, BP, BM }; int count = 1; EvtParticle* p; myGenerator.readUDecay( "exampleFiles/GENERIC.DEC" ); int totTracks = 0; int totTracksNoSL = 0; int totTracks1SL = 0; int totTracks2SL = 0; int totNoSL = 0; int tot1SL = 0; int tot2SL = 0; do { int evTracks = 0; if ( count == 1000 * ( count / 1000 ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << count << std::endl; //EvtGenReport(EVTGEN_INFO,"EvtGen") << HepRandom::getTheSeed()<setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p = root_part; int howManySL = 0; do { if ( theTracks.contains( p->getId() ) ) { totTracks += 1; evTracks += 1; } if ( theLeptons.contains( p->getId() ) ) { if ( p->getParent() ) { if ( theBs.contains( p->getParent()->getId() ) ) howManySL += 1; } } p = p->nextIter( root_part ); } while ( p != nullptr ); //Now need to figure out which histogram to book trackAll->Fill( evTracks ); if ( howManySL == 0 ) { trackNoSL->Fill( evTracks ); totNoSL += 1; totTracksNoSL += evTracks; } if ( howManySL == 1 ) { track1SL->Fill( evTracks ); tot1SL += 1; totTracks1SL += evTracks; } if ( howManySL == 2 ) { track2SL->Fill( evTracks ); tot2SL += 1; totTracks2SL += evTracks; } root_part->deleteTree(); } while ( count++ < nevent ); double aveMulti = float( totTracks ) / float( nevent ); double aveMultiNoSL = float( totTracksNoSL ) / float( totNoSL ); double aveMulti1SL = float( totTracks1SL ) / float( tot1SL ); double aveMulti2SL = float( totTracks2SL ) / float( tot2SL ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Your average multiplicity=" << aveMulti << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Your average multiplicity for no B->semileptonic events=" << aveMultiNoSL << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Your average multiplicity for 1 B->semileptonic events=" << aveMulti1SL << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Your average multiplicity for 2 B->semileptonic events=" << aveMulti2SL << std::endl; file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runGeneric( int neventOrig, EvtGen& myGenerator, std::string listfile ) { int nevent = abs( neventOrig ); //Parse the table of particles to find.. TFile* file = new TFile( "generic.root", "RECREATE" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); static EvtId BP = EvtPDL::getId( std::string( "B+" ) ); static EvtId BM = EvtPDL::getId( std::string( "B-" ) ); static EvtIdSet theBs{ B0B, B0, BP, BM }; static EvtIdSet theB0B{ B0B }; static EvtIdSet theB0{ B0 }; static EvtIdSet theBP{ BP }; static EvtIdSet theBM{ BM }; static EvtId D0 = EvtPDL::getId( std::string( "D0" ) ); static EvtId D0B = EvtPDL::getId( std::string( "anti-D0" ) ); static EvtId DP = EvtPDL::getId( std::string( "D+" ) ); static EvtId DM = EvtPDL::getId( std::string( "D-" ) ); static EvtIdSet theDs{ D0B, D0, DP, DM }; static EvtIdSet theD0B{ D0B }; static EvtIdSet theD0{ D0 }; static EvtIdSet theDP{ DP }; static EvtIdSet theDM{ DM }; int count; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/GENERIC.DEC" ); myGenerator.readUDecay( udecay_name ); if ( listfile != "" ) { EvtParser parser; if ( parser.read( listfile ) != 0 ) { EvtGenReport( EVTGEN_ERROR, "EvtGen" ) << "Will terminate." << std::endl; exit( -1 ); } std::vector histo1( parser.getNToken() ); std::vector histo2( parser.getNToken() ); std::vector massHisto( parser.getNToken() ); int ik; std::string tk, tkname; for ( ik = 0; ik < ( parser.getNToken() / 2 ); ik++ ) { tk = parser.getToken( 2 * ik ); tkname = parser.getToken( 1 + 2 * ik ); histo1[ik] = new TH1F( tkname.c_str(), tkname.c_str(), 30, 0.0, 3.0 ); char* directName; directName = new char[( strlen( tkname.c_str() ) + 8 )]; directName = strcpy( directName, tkname.c_str() ); directName = strcat( directName, "Direct" ); histo2[ik] = new TH1F( directName, directName, 30, 0.0, 3.0 ); delete[] directName; char* massName; massName = new char[( strlen( tkname.c_str() ) + 4 )]; massName = strcpy( massName, tkname.c_str() ); massName = strcat( massName, "Mass" ); massHisto[ik] = new TH1F( massName, massName, 3000, 0.0, 5.0 ); delete[] massName; } count = 1; std::vector temp( parser.getNToken() / 2, 0 ); std::vector tempB( parser.getNToken() / 2, 0 ); std::vector tempB0B( parser.getNToken() / 2, 0 ); std::vector tempB0( parser.getNToken() / 2, 0 ); std::vector tempBP( parser.getNToken() / 2, 0 ); std::vector tempBM( parser.getNToken() / 2, 0 ); std::vector tempD( parser.getNToken() / 2, 0 ); std::vector tempD0B( parser.getNToken() / 2, 0 ); std::vector tempD0( parser.getNToken() / 2, 0 ); std::vector tempDP( parser.getNToken() / 2, 0 ); std::vector tempDM( parser.getNToken() / 2, 0 ); do { //EvtGenReport(EVTGEN_INFO,"EvtGen") << "new event\n"; if ( count == 1000 * ( count / 1000 ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << count << std::endl; //EvtGenReport(EVTGEN_INFO,"EvtGen") << HepRandom::getTheSeed()< 0 ) { root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); } else { root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); } root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); //EvtStdHep stdhep; //stdhep.init(); //root_part->makeStdHep(stdhep); //EvtGenReport(EVTGEN_INFO,"EvtGen") <printTree(); root_part->deleteTree(); } while ( count++ < nevent ); int itok; std::string token; for ( itok = 0; itok < ( parser.getNToken() / 2 ); itok++ ) { token = parser.getToken( 2 * itok ); float br = 0.5 * float( temp[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << temp[itok] << " " << token.c_str() << " in " << nevent << " events. Average number of " << token.c_str() << " per B meson=" << br << std::endl; br = 0.5 * float( tempB[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << tempB[itok] << " " << token.c_str() << " produced directly in decays of B mesons avg. br.fr.=" << br << std::endl; br = 2.0 * float( tempB0[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << tempB0[itok] << " " << token.c_str() << " in decay tree of B0, br.fr.=" << br << std::endl; br = 2.0 * float( tempB0B[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << tempB0B[itok] << " " << token.c_str() << " in decay tree of anti-B0, br.fr.=" << br << std::endl; br = 2.0 * float( tempBP[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << tempBP[itok] << " " << token.c_str() << " in decay tree of B+, br.fr.=" << br << std::endl; br = 2.0 * float( tempBM[itok] ) / float( nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Found " << tempBM[itok] << " " << token.c_str() << " in decay tree of B-, br.fr.=" << br << std::endl; // br=0.5*float(tempD[itok])/float(numd0+numd0b+numdm+numdp); // EvtGenReport(EVTGEN_INFO,"EvtGen") << "Found "< 0 ) { root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); } else { root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); } root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); root_part->deleteTree(); } while ( count++ < nevent ); } file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runKstarnunu( int nevent, EvtGen& myGenerator ) { static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); //static EvtId B0B=EvtPDL::getId(std::string("anti-B0")); TFile* file = new TFile( "kstarnunu.root", "RECREATE" ); TH1F* q2 = new TH1F( "h1", "q2", 50, 0.0, 25.0 ); TH1F* enu = new TH1F( "h2", "Neutrino energy", 50, 0.0, 5.0 ); TH1F* x = new TH1F( "h3", "Total neutrino energy/B mass", 50, 0.5, 0.9 ); int count; EvtVector4R kstar, nu, nub; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/KSTARNUNU.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); kstar = root_part->getDaug( 0 )->getP4Lab(); nu = root_part->getDaug( 1 )->getP4Lab(); nub = root_part->getDaug( 2 )->getP4Lab(); q2->Fill( ( nu + nub ).mass2() ); enu->Fill( nu.get( 0 ) ); x->Fill( ( nu.get( 0 ) + nub.get( 0 ) ) / root_part->mass() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runBsmix( int nevent, EvtGen& myGenerator ) { static EvtId BS0 = EvtPDL::getId( std::string( "B_s0" ) ); static EvtId BSB = EvtPDL::getId( std::string( "anti-B_s0" ) ); TFile* file = new TFile( "bsmix.root", "RECREATE" ); TH1F* tmix = new TH1F( "h1", "tmix (mm)", 100, 0.0, 5.0 ); TH1F* tnomix = new TH1F( "h2", "tnomix (mm)", 100, 0.0, 5.0 ); int count; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/BSMIX.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( BS0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( BS0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); double t = root_part->getLifetime(); int mix = 0; if ( root_part->getNDaug() == 1 ) { if ( root_part->getDaug( 0 )->getId() == BSB ) { mix = 1; } } if ( mix == 0 ) tnomix->Fill( t ); if ( mix == 1 ) tmix->Fill( t ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSemic( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId EP = EvtPDL::getId( std::string( "e+" ) ); static EvtId EM = EvtPDL::getId( std::string( "e-" ) ); static EvtId DST0 = EvtPDL::getId( std::string( "D*0" ) ); static EvtId DSTB = EvtPDL::getId( std::string( "anti-D*0" ) ); static EvtId DSTP = EvtPDL::getId( std::string( "D*+" ) ); static EvtId DSTM = EvtPDL::getId( std::string( "D*-" ) ); static EvtId D0 = EvtPDL::getId( std::string( "D0" ) ); static EvtId D0B = EvtPDL::getId( std::string( "anti-D0" ) ); static EvtId DP = EvtPDL::getId( std::string( "D+" ) ); static EvtId DM = EvtPDL::getId( std::string( "D-" ) ); static EvtId D1P1P = EvtPDL::getId( std::string( "D_1+" ) ); static EvtId D1P1N = EvtPDL::getId( std::string( "D_1-" ) ); static EvtId D1P10 = EvtPDL::getId( std::string( "D_10" ) ); static EvtId D1P1B = EvtPDL::getId( std::string( "anti-D_10" ) ); static EvtId D3P2P = EvtPDL::getId( std::string( "D_2*+" ) ); static EvtId D3P2N = EvtPDL::getId( std::string( "D_2*-" ) ); static EvtId D3P20 = EvtPDL::getId( std::string( "D_2*0" ) ); static EvtId D3P2B = EvtPDL::getId( std::string( "anti-D_2*0" ) ); static EvtId D3P1P = EvtPDL::getId( std::string( "D'_1+" ) ); static EvtId D3P1N = EvtPDL::getId( std::string( "D'_1-" ) ); static EvtId D3P10 = EvtPDL::getId( std::string( "D'_10" ) ); static EvtId D3P1B = EvtPDL::getId( std::string( "anti-D'_10" ) ); static EvtId D3P0P = EvtPDL::getId( std::string( "D_0*+" ) ); static EvtId D3P0N = EvtPDL::getId( std::string( "D_0*-" ) ); static EvtId D3P00 = EvtPDL::getId( std::string( "D_0*0" ) ); static EvtId D3P0B = EvtPDL::getId( std::string( "anti-D_0*0" ) ); static EvtId D23S1P = EvtPDL::getId( std::string( "D*(2S)+" ) ); static EvtId D23S1N = EvtPDL::getId( std::string( "D*(2S)-" ) ); static EvtId D23S10 = EvtPDL::getId( std::string( "D*(2S)0" ) ); static EvtId D23S1B = EvtPDL::getId( std::string( "anti-D*(2S)0" ) ); static EvtIdSet radExitDstar{ D23S1P, D23S1N, D23S10, D23S1B }; TFile* file = new TFile( "semic.root", "RECREATE" ); TH1F* Dpe_q2 = new TH1F( "h11", "q2 for B0B ->D+ e- nu", 50, 0.0, 12.0 ); TH1F* Dpe_elep = new TH1F( "h12", "Elep for B0B ->D+ e- nu", 50, 0.0, 2.5 ); TH1F* Dme_q2 = new TH1F( "h13", "q2 for B0 ->D- e+ nu", 50, 0.0, 12.0 ); TH1F* Dme_elep = new TH1F( "h14", "Elep for B0 ->D- e+ nu", 50, 0.0, 2.5 ); TH1F* D0e_q2 = new TH1F( "h15", "q2 for B- ->D0 e- nu", 50, 0.0, 12.0 ); TH1F* D0e_elep = new TH1F( "h16", "Elep for B- ->D0 e- nu", 50, 0.0, 2.5 ); TH1F* D0Be_q2 = new TH1F( "h17", "q2 for B+ ->D0B e+ nu", 50, 0.0, 12.0 ); TH1F* D0Be_elep = new TH1F( "h18", "Elep for B+ ->D0B e+ nu", 50, 0.0, 2.5 ); TH1F* Dstpe_q2 = new TH1F( "h21", "q2 for B0B ->D*+ e- nu", 50, 0.0, 12.0 ); TH1F* Dstpe_elep = new TH1F( "h22", "Elep for B0B ->D*+ e- nu", 50, 0.0, 2.5 ); TH1F* Dstme_q2 = new TH1F( "h23", "q2 for B0 ->D*- e+ nu", 50, 0.0, 12.0 ); TH1F* Dstme_elep = new TH1F( "h24", "Elep for B0 ->D*- e+ nu", 50, 0.0, 2.5 ); TH1F* Dst0e_q2 = new TH1F( "h25", "q2 for B- ->D*0 e- nu", 50, 0.0, 12.0 ); TH1F* Dst0e_elep = new TH1F( "h26", "Elep for B*- ->D*0 e- nu", 50, 0.0, 2.5 ); TH1F* Dst0Be_q2 = new TH1F( "h27", "q2 for B+ ->D*0B e+ nu", 50, 0.0, 12.0 ); TH1F* Dst0Be_elep = new TH1F( "h28", "Elep for B+ ->D*0B e+ nu", 50, 0.0, 2.5 ); TH1F* D1P1pe_q2 = new TH1F( "h31", "q2 for B0B ->1P1+ e- nu", 50, 0.0, 12.0 ); TH1F* D1P1pe_elep = new TH1F( "h32", "Elep for B0B ->1P1+ e- nu", 50, 0.0, 2.5 ); TH1F* D1P1me_q2 = new TH1F( "h33", "q2 for B0 ->1P1- e+ nu", 50, 0.0, 12.0 ); TH1F* D1P1me_elep = new TH1F( "h34", "Elep for B0 ->1P1- e+ nu", 50, 0.0, 2.5 ); TH1F* D1P10e_q2 = new TH1F( "h35", "q2 for B- ->1P10 e- nu", 50, 0.0, 12.0 ); TH1F* D1P10e_elep = new TH1F( "h36", "Elep for B*- ->1P10 e- nu", 50, 0.0, 2.5 ); TH1F* D1P10Be_q2 = new TH1F( "h37", "q2 for B+ ->1P1B e+ nu", 50, 0.0, 12.0 ); TH1F* D1P10Be_elep = new TH1F( "h38", "Elep for B+ ->1P1B e+ nu", 50, 0.0, 2.5 ); TH1F* D3P0pe_q2 = new TH1F( "h41", "q2 for B0B ->3P0+ e- nu", 50, 0.0, 12.0 ); TH1F* D3P0pe_elep = new TH1F( "h42", "Elep for B0B ->3P0+ e- nu", 50, 0.0, 2.5 ); TH1F* D3P0me_q2 = new TH1F( "h43", "q2 for B0 ->3P0- e+ nu", 50, 0.0, 12.0 ); TH1F* D3P0me_elep = new TH1F( "h44", "Elep for B0 ->3P0- e+ nu", 50, 0.0, 2.5 ); TH1F* D3P00e_q2 = new TH1F( "h45", "q2 for B- ->3P00 e- nu", 50, 0.0, 12.0 ); TH1F* D3P00e_elep = new TH1F( "h46", "Elep for B*- ->3P00 e- nu", 50, 0.0, 2.5 ); TH1F* D3P00Be_q2 = new TH1F( "h47", "q2 for B+ ->3P0B e+ nu", 50, 0.0, 12.0 ); TH1F* D3P00Be_elep = new TH1F( "h48", "Elep for B+ ->3P0B e+ nu", 50, 0.0, 2.5 ); TH1F* D3P1pe_q2 = new TH1F( "h51", "q2 for B0B ->3P1+ e- nu", 50, 0.0, 12.0 ); TH1F* D3P1pe_elep = new TH1F( "h52", "Elep for B0B ->3P1+ e- nu", 50, 0.0, 2.5 ); TH1F* D3P1me_q2 = new TH1F( "h53", "q2 for B0 ->3P1- e+ nu", 50, 0.0, 12.0 ); TH1F* D3P1me_elep = new TH1F( "h54", "Elep for B0 ->3P1- e+ nu", 50, 0.0, 2.5 ); TH1F* D3P10e_q2 = new TH1F( "h55", "q2 for B- ->3P10 e- nu", 50, 0.0, 12.0 ); TH1F* D3P10e_elep = new TH1F( "h56", "Elep for B*- ->3P10 e- nu", 50, 0.0, 2.5 ); TH1F* D3P10Be_q2 = new TH1F( "h57", "q2 for B+ ->3P1B e+ nu", 50, 0.0, 12.0 ); TH1F* D3P10Be_elep = new TH1F( "h58", "Elep for B+ ->3P1B e+ nu", 50, 0.0, 2.5 ); TH1F* D3P2pe_q2 = new TH1F( "h61", "q2 for B0B ->3P2+ e- nu", 50, 0.0, 12.0 ); TH1F* D3P2pe_elep = new TH1F( "h62", "Elep for B0B ->3P2+ e- nu", 50, 0.0, 2.5 ); TH1F* D3P2me_q2 = new TH1F( "h63", "q2 for B0 ->3P2- e+ nu", 50, 0.0, 12.0 ); TH1F* D3P2me_elep = new TH1F( "h64", "Elep for B0 ->3P2- e+ nu", 50, 0.0, 2.5 ); TH1F* D3P20e_q2 = new TH1F( "h65", "q2 for B- ->3P20 e- nu", 50, 0.0, 12.0 ); TH1F* D3P20e_elep = new TH1F( "h66", "Elep for B*- ->3P20 e- nu", 50, 0.0, 2.5 ); TH1F* D3P20Be_q2 = new TH1F( "h67", "q2 for B+ ->3P2B e+ nu", 50, 0.0, 12.0 ); TH1F* D3P20Be_elep = new TH1F( "h68", "Elep for B+ ->3P2B e+ nu", 50, 0.0, 2.5 ); TH1F* phiL = new TH1F( "h69", "phi", 50, -3.1416, 3.1416 ); int count; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/SEMIC.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); int i; for ( i = 0; i < 2; i++ ) { EvtId meson = root_part->getDaug( i )->getDaug( 0 )->getId(); EvtId lepton = root_part->getDaug( i )->getDaug( 1 )->getId(); EvtVector4R lep = root_part->getDaug( i )->getDaug( 1 )->getP4Lab(); phiL->Fill( atan2( lep.get( 1 ), lep.get( 2 ) ) ); EvtVector4R nu = root_part->getDaug( i )->getDaug( 2 )->getP4Lab(); double q2 = ( lep + nu ).mass2(); double elep = root_part->getDaug( i )->getDaug( 1 )->getP4().get( 0 ); if ( meson == DP && lepton == EM ) { Dpe_q2->Fill( q2 ); Dpe_elep->Fill( elep ); } if ( meson == DM && lepton == EP ) { Dme_q2->Fill( q2 ); Dme_elep->Fill( elep ); } if ( meson == D0 && lepton == EM ) { D0e_q2->Fill( q2 ); D0e_elep->Fill( elep ); } if ( meson == D0B && lepton == EP ) { D0Be_q2->Fill( q2 ); D0Be_elep->Fill( elep ); } if ( meson == DSTP && lepton == EM ) { Dstpe_q2->Fill( q2 ); Dstpe_elep->Fill( elep ); } if ( meson == DSTM && lepton == EP ) { Dstme_q2->Fill( q2 ); Dstme_elep->Fill( elep ); } if ( meson == DST0 && lepton == EM ) { Dst0e_q2->Fill( q2 ); Dst0e_elep->Fill( elep ); } if ( meson == DSTB && lepton == EP ) { Dst0Be_q2->Fill( q2 ); Dst0Be_elep->Fill( elep ); } if ( meson == D1P1P && lepton == EM ) { D1P1pe_q2->Fill( q2 ); D1P1pe_elep->Fill( elep ); } if ( meson == D1P1N && lepton == EP ) { D1P1me_q2->Fill( q2 ); D1P1me_elep->Fill( elep ); } if ( meson == D1P10 && lepton == EM ) { D1P10e_q2->Fill( q2 ); D1P10e_elep->Fill( elep ); } if ( meson == D1P1B && lepton == EP ) { D1P10Be_q2->Fill( q2 ); D1P10Be_elep->Fill( elep ); } if ( meson == D3P0P && lepton == EM ) { D3P0pe_q2->Fill( q2 ); D3P0pe_elep->Fill( elep ); } if ( meson == D3P0N && lepton == EP ) { D3P0me_q2->Fill( q2 ); D3P0me_elep->Fill( elep ); } if ( meson == D3P00 && lepton == EM ) { D3P00e_q2->Fill( q2 ); D3P00e_elep->Fill( elep ); } if ( meson == D3P0B && lepton == EP ) { D3P00Be_q2->Fill( q2 ); D3P00Be_elep->Fill( elep ); } if ( meson == D3P1P && lepton == EM ) { D3P1pe_q2->Fill( q2 ); D3P1pe_elep->Fill( elep ); } if ( meson == D3P1N && lepton == EP ) { D3P1me_q2->Fill( q2 ); D3P1me_elep->Fill( elep ); } if ( meson == D3P10 && lepton == EM ) { D3P10e_q2->Fill( q2 ); D3P10e_elep->Fill( elep ); } if ( meson == D3P1B && lepton == EP ) { D3P10Be_q2->Fill( q2 ); D3P10Be_elep->Fill( elep ); } if ( meson == D3P2P && lepton == EM ) { D3P2pe_q2->Fill( q2 ); D3P2pe_elep->Fill( elep ); } if ( meson == D3P2N && lepton == EP ) { D3P2me_q2->Fill( q2 ); D3P2me_elep->Fill( elep ); } if ( meson == D3P20 && lepton == EM ) { D3P20e_q2->Fill( q2 ); D3P20e_elep->Fill( elep ); } if ( meson == D3P2B && lepton == EP ) { D3P20Be_q2->Fill( q2 ); D3P20Be_elep->Fill( elep ); } } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runKstarll( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "kstkmm.root", "RECREATE" ); TH2F* _dalitz = new TH2F( "h1", "q^2! vs Elep", 70, 0.0, 3.5, 60, 0.0, 30.0 ); TH1F* _ctl = new TH1F( "h2", "ctl", 50, -1.0, 1.0 ); TH1F* _q2 = new TH1F( "h3", "q2", 50, 0.0, 25.0 ); TH1F* _q2low = new TH1F( "h4", "q2 (low)", 50, 0.0, 1.0 ); TH1F* _q2lowlow = new TH1F( "h5", "q2 (lowlow)", 50, 0.0, 0.00001 ); TH1F* _phi = new TH1F( "h6", "phi", 50, -EvtConst::pi, EvtConst::pi ); TH1F* _chi = new TH1F( "h7", "chi", 50, 0.0, EvtConst::twoPi ); TH1F* _chictl = new TH1F( "h8", "chictl", 50, 0.0, EvtConst::twoPi ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); int count = 1; EvtVector4R kstar, l1, l2; EvtVector4R k, pi, b; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/KSTARLL.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); std::vector q2low( 5 ); std::vector q2high( 5 ); std::vector counts( 5 ); //kee //int n=4; //q2low[0]=0.0; q2high[0]=4.5; //q2low[1]=4.5; q2high[1]=8.41; //q2low[2]=10.24; q2high[2]=12.96; //q2low[3]=14.06; q2high[3]=30.0; //kmm //int n=4; //q2low[0]=0.0; q2high[0]=4.5; //q2low[1]=4.5; q2high[1]=9.0; //q2low[2]=10.24; q2high[2]=12.96; //q2low[3]=14.06; q2high[3]=30.0; //K*ee int n = 5; q2low[0] = 0.0; q2high[0] = 0.1; q2low[1] = 0.1; q2high[1] = 4.5; q2low[2] = 4.5; q2high[2] = 8.41; q2low[3] = 10.24; q2high[3] = 12.96; q2low[4] = 14.06; q2high[4] = 30.0; //K*mm //int n=5; //q2low[0]=0.0; q2high[0]=0.1; //q2low[1]=0.1; q2high[1]=4.5; //q2low[2]=4.5; q2high[2]=9.0; //q2low[3]=10.24; q2high[3]=12.96; //q2low[4]=14.06; q2high[4]=30.0; do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); // root_part->printTree(); //root_part->getDaug(0)->printTree(); //root_part->getDaug(1)->printTree(); //root_part->getDaug(2)->printTree(); kstar = root_part->getDaug( 0 )->getP4Lab(); l1 = root_part->getDaug( 1 )->getP4Lab(); l2 = root_part->getDaug( 2 )->getP4Lab(); b = root_part->getP4(); k = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); pi = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); double qsq = ( l1 + l2 ).mass2(); for ( int j = 0; j < n; j++ ) { if ( qsq > q2low[j] && qsq < q2high[j] ) counts[j]++; } _q2->Fill( ( l1 + l2 ).mass2() ); _q2low->Fill( ( l1 + l2 ).mass2() ); _q2lowlow->Fill( ( l1 + l2 ).mass2() ); _ctl->Fill( EvtDecayAngle( ( l1 + l2 + kstar ), ( l1 + l2 ), l1 ) ); _dalitz->Fill( l1.get( 0 ), ( l1 + l2 ).mass2(), 1.0 ); root_part->deleteTree(); _phi->Fill( atan2( l1.get( 1 ), l1.get( 2 ) ) ); _chi->Fill( EvtDecayAngleChi( b, k, pi, l1, l2 ) ); if ( EvtDecayAngle( ( l1 + l2 + kstar ), ( l1 + l2 ), l1 ) > 0 ) { _chictl->Fill( EvtDecayAngleChi( b, k, pi, l1, l2 ) ); } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "count:" << count << " " << ( l1 + l2 ).mass2() << std::endl; } while ( count++ < nevent ); for ( int j = 0; j < n; j++ ) { std::cout << "[" << q2low[j] << ".." << q2high[j] << "]=" << counts[j] << std::endl; } file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runKll( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "ksem.root", "RECREATE" ); TH2F* _dalitz = new TH2F( "h1", "q^2! vs Elep", 70, 0.0, 3.5, 60, 0.0, 30.0 ); TH1F* _ctl = new TH1F( "h2", "ctl", 50, -1.0, 1.0 ); TH1F* _q2 = new TH1F( "h3", "q2", 50, 0.0, 25.0 ); TH1F* _q2low = new TH1F( "h4", "q2 (low)", 50, 0.0, 1.0 ); TH1F* _q2lowlow = new TH1F( "h5", "q2 (lowlow)", 50, 0.0, 0.00001 ); TH1F* _phi = new TH1F( "h6", "phi", 50, -EvtConst::pi, EvtConst::pi ); // TH1F* _chi = new TH1F("h7","chi",50,0.0,EvtConst::twoPi); // TH1F* _chictl = new TH1F("h8","chictl",50,0.0,EvtConst::twoPi); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); int count = 1; EvtVector4R k, l1, l2; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/KLL.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); std::vector q2low( 5 ); std::vector q2high( 5 ); std::vector counts( 5 ); //kee // int n=4; //q2low[0]=0.0; q2high[0]=4.5; //q2low[1]=4.5; q2high[1]=8.41; //q2low[2]=10.24; q2high[2]=12.96; //q2low[3]=14.06; q2high[3]=30.0; //kmm int n = 4; q2low[0] = 0.0; q2high[0] = 4.5; q2low[1] = 4.5; q2high[1] = 9.0; q2low[2] = 10.24; q2high[2] = 12.96; q2low[3] = 14.06; q2high[3] = 30.0; //K*ee //int n=5; //q2low[0]=0.0; q2high[0]=0.1; //q2low[1]=0.1; q2high[1]=4.5; //q2low[2]=4.5; q2high[2]=8.41; //q2low[3]=10.24; q2high[3]=12.96; //q2low[4]=14.06; q2high[4]=30.0; //K*mm //int n=5; //q2low[0]=0.0; q2high[0]=0.1; //q2low[1]=0.1; q2high[1]=4.5; //q2low[2]=4.5; q2high[2]=9.0; //q2low[3]=10.24; q2high[3]=12.96; //q2low[4]=14.06; q2high[4]=30.0; do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); // root_part->printTree(); //root_part->getDaug(0)->printTree(); //root_part->getDaug(1)->printTree(); //root_part->getDaug(2)->printTree(); k = root_part->getDaug( 0 )->getP4Lab(); l1 = root_part->getDaug( 1 )->getP4Lab(); l2 = root_part->getDaug( 2 )->getP4Lab(); //b=root_part->getP4(); // k=root_part->getDaug(0)->getDaug(0)->getP4Lab(); // pi=root_part->getDaug(0)->getDaug(1)->getP4Lab(); double qsq = ( l1 + l2 ).mass2(); for ( int j = 0; j < n; j++ ) { if ( qsq > q2low[j] && qsq < q2high[j] ) counts[j]++; } _q2->Fill( ( l1 + l2 ).mass2() ); _q2low->Fill( ( l1 + l2 ).mass2() ); _q2lowlow->Fill( ( l1 + l2 ).mass2() ); _ctl->Fill( EvtDecayAngle( ( l1 + l2 + k ), ( l1 + l2 ), l1 ) ); _dalitz->Fill( l1.get( 0 ), ( l1 + l2 ).mass2(), 1.0 ); root_part->deleteTree(); _phi->Fill( atan2( l1.get( 1 ), l1.get( 2 ) ) ); //_chi->Fill(EvtDecayAngleChi(b,k,pi,l1,l2)); //if (EvtDecayAngle((l1+l2+kstar),(l1+l2),l1)>0){ // _chictl->Fill(EvtDecayAngleChi(b,k,pi,l1,l2)); // } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "count:" << count << " " << ( l1 + l2 ).mass2() << std::endl; } while ( count++ < nevent ); for ( int j = 0; j < n; j++ ) { std::cout << "[" << q2low[j] << ".." << q2high[j] << "]=" << counts[j] << std::endl; } file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runHll( int nevent, EvtGen& myGenerator, char* mode ) { TString modename = mode; TString filename; filename = modename; filename = filename + "_nnlo.root"; TFile* file = new TFile( filename, "RECREATE" ); TString decname; decname += modename; decname.ToUpper(); decname = "exampleFiles/" + decname + ".DEC"; char udecay_name[100]; strcpy( udecay_name, decname ); TH2F* _dalitz = new TH2F( "h1", "q^2! vs Elep", 70, 0.0, 3.5, 60, 0.0, 30.0 ); TH1F* _ctl = new TH1F( "h2", "ctl", 50, -1.0, 1.0 ); TH1F* _q2 = new TH1F( "h3", "q2", 50, 0.0, 25.0 ); TH1F* _q2low = new TH1F( "h4", "q2 (low)", 50, 0.0, 1.0 ); TH1F* _q2lowlow = new TH1F( "h5", "q2 (lowlow)", 50, 0.0, 0.00001 ); TH1F* _phi = new TH1F( "h6", "phi", 50, -EvtConst::pi, EvtConst::pi ); TH1F* _chi = new TH1F( "h7", "chi", 50, 0.0, EvtConst::twoPi ); TH1F* _chictl = new TH1F( "h8", "chictl", 50, 0.0, EvtConst::twoPi ); EvtId B; if ( modename == "kee" || modename == "kmm" || modename == "kstksee" || modename == "kstksmm" || modename == "piee" || modename == "pimm" || modename == "rhoee" || modename == "rhomm" ) { B = EvtPDL::getId( std::string( "B+" ) ); } else { B = EvtPDL::getId( std::string( "B0" ) ); } int count = 1; EvtVector4R b, h, l1, l2; EvtVector4R hdaug1, hdaug2; myGenerator.readUDecay( udecay_name ); std::vector q2low( 7 ); std::vector q2high( 7 ); std::vector counts( 7 ); int n( 0 ); if ( modename == "kee" || modename == "ksee" || modename == "piee" || modename == "pi0ee" || modename == "etaee" || modename == "etapee" ) { //kee n = 6; q2low[0] = 0.0; q2high[0] = 4.5; q2low[1] = 4.5; q2high[1] = 8.41; q2low[2] = 8.41; q2high[2] = 10.24; q2low[3] = 10.24; q2high[3] = 12.96; q2low[4] = 12.96; q2high[4] = 14.06; q2low[5] = 14.06; q2high[5] = 30.0; } else if ( modename == "kmm" || modename == "ksmm" || modename == "pimm" || modename == "pi0mm" || modename == "etamm" || modename == "etapmm" ) { //kmm n = 6; q2low[0] = 0.0; q2high[0] = 4.5; q2low[1] = 4.5; q2high[1] = 9.0; q2low[2] = 9.0; q2high[2] = 10.24; q2low[3] = 10.24; q2high[3] = 12.96; q2low[4] = 12.96; q2high[4] = 14.06; q2low[5] = 14.06; q2high[5] = 30.0; } else if ( modename == "kstkee" || modename == "kstksee" || modename == "rhoee" || modename == "rho0ee" || modename == "omegaee" ) { //K*ee n = 7; q2low[0] = 0.0; q2high[0] = 0.1; q2low[1] = 0.1; q2high[1] = 4.5; q2low[2] = 4.5; q2high[2] = 8.41; q2low[3] = 8.41; q2high[3] = 10.24; q2low[4] = 10.24; q2high[4] = 12.96; q2low[5] = 12.96; q2high[5] = 14.06; q2low[6] = 14.06; q2high[6] = 30.0; } else if ( modename == "kstkmm" || modename == "kstksmm" || modename == "rhomm" || modename == "rho0mm" || modename == "omegamm" ) { //K*mm n = 7; q2low[0] = 0.0; q2high[0] = 0.1; q2low[1] = 0.1; q2high[1] = 4.5; q2low[2] = 4.5; q2high[2] = 9.0; q2low[3] = 9.0; q2high[3] = 10.24; q2low[4] = 10.24; q2high[4] = 12.96; q2low[5] = 12.96; q2high[5] = 14.06; q2low[6] = 14.06; q2high[6] = 30.0; } float q2binlow[n + 1]; for ( int i = 0; i < n; i++ ) { q2binlow[i] = q2low[i]; } q2binlow[n] = 30.0; TH1F* _q2var = new TH1F( "h9", "q2var", n, q2binlow ); do { EvtVector4R p_init( EvtPDL::getMass( B ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); // root_part->printTree(); //root_part->getDaug(0)->printTree(); //root_part->getDaug(1)->printTree(); //root_part->getDaug(2)->printTree(); h = root_part->getDaug( 0 )->getP4Lab(); l1 = root_part->getDaug( 1 )->getP4Lab(); l2 = root_part->getDaug( 2 )->getP4Lab(); double qsq = ( l1 + l2 ).mass2(); for ( int j = 0; j < n; j++ ) { if ( qsq > q2low[j] && qsq < q2high[j] ) counts[j]++; } _q2->Fill( ( l1 + l2 ).mass2() ); _q2var->Fill( ( l1 + l2 ).mass2() ); _q2low->Fill( ( l1 + l2 ).mass2() ); _q2lowlow->Fill( ( l1 + l2 ).mass2() ); _ctl->Fill( EvtDecayAngle( ( l1 + l2 + h ), ( l1 + l2 ), l1 ) ); _dalitz->Fill( l1.get( 0 ), ( l1 + l2 ).mass2(), 1.0 ); _phi->Fill( atan2( l1.get( 1 ), l1.get( 2 ) ) ); if ( modename == "kstkee" || modename == "kstkmm" || modename == "kstksee" || modename == "kstksmm" || modename == "rhoee" || modename == "rhomm" || modename == "rho0ee" || modename == "rho0mm" ) { b = root_part->getP4(); hdaug1 = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); hdaug2 = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); _chi->Fill( EvtDecayAngleChi( b, hdaug1, hdaug2, l1, l2 ) ); if ( EvtDecayAngle( ( l1 + l2 + h ), ( l1 + l2 ), l1 ) > 0 ) { _chictl->Fill( EvtDecayAngleChi( b, hdaug1, hdaug2, l1, l2 ) ); } } if ( count % 1000 == 0 ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "count:" << count << " " << ( l1 + l2 ).mass2() << std::endl; } root_part->deleteTree(); } while ( count++ < nevent ); for ( int j = 0; j < n; j++ ) { std::cout << "[" << q2low[j] << ".." << q2high[j] << "] = " << counts[j] << std::endl; } file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runVectorIsr( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); TFile* file = new TFile( "vectorisr.root", "RECREATE" ); TH1F* cosv = new TH1F( "h1", "Cos vector in e+e- frame", 50, -1.0, 1.0 ); TH1F* cosd1 = new TH1F( "h2", "Cos helang 1st dau of vector", 50, -1.0, 1.0 ); TH1F* cosd1d1 = new TH1F( "h3", "Cos helang 1st dau of 1st dau", 50, -1.0, 1.0 ); TH1F* cosd2d1 = new TH1F( "h4", "Cos helang 1st dau of 2nd dau", 50, -1.0, 1.0 ); TH2F* d1vsd1d1 = new TH2F( "h5", "Cos helangs d1 vs d1d1", 20, -1.0, 1.0, 20, -1.0, 1.0 ); TH2F* d2vsd2d1 = new TH2F( "h6", "Cos helangs d2 vs d2d1", 20, -1.0, 1.0, 20, -1.0, 1.0 ); TH2F* d1d1vsd2d1 = new TH2F( "h7", "Cos helangs d1d1 vs d2d1", 20, -1.0, 1.0, 20, -1.0, 1.0 ); TH1F* chidd = new TH1F( "h8", "Chi - angle between decay planes", 60, 0., 360.0 ); TH2F* chi12vsd1d1 = new TH2F( "h9", "Chi 1-2 vs d1d1", 30, 0., 360.0, 20, -1.0, 1.0 ); TH2F* chi12vsd2d1 = new TH2F( "h10", "Chi 1-2 vs d2d1", 30, 0., 360.0, 20, -1.0, 1.0 ); TH2F* chi21vsd1d1 = new TH2F( "h11", "Chi 2-1 vs d1d1", 30, 0., 360.0, 20, -1.0, 1.0 ); TH2F* chi21vsd2d1 = new TH2F( "h12", "Chi 2-1 vs d2d1", 30, 0., 360.0, 20, -1.0, 1.0 ); int count = 1; char udecay_name[100]; EvtVector4R cm, v, d1, d2, d1d1, d1d2, d2d1, d2d2; strcpy( udecay_name, "exampleFiles/VECTORISR.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); cm = root_part->getP4Lab(); v = root_part->getDaug( 0 )->getP4Lab(); d1 = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); d2 = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); cosv->Fill( v.get( 3 ) / v.d3mag() ); double cosdecayd1 = EvtDecayAngle( cm, v, d1 ); double cosdecayd2 = EvtDecayAngle( cm, v, d2 ); cosd1->Fill( cosdecayd1 ); // now get daughters of the daughters // // first daughter of first daughter if ( root_part->getDaug( 0 )->getDaug( 0 )->getNDaug() >= 2 ) { d1d1 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); double cosdecayd1d1 = EvtDecayAngle( v, d1, d1d1 ); cosd1d1->Fill( cosdecayd1d1 ); d1vsd1d1->Fill( cosdecayd1, cosdecayd1d1, 1.0 ); } // first daughter of second daughter if ( root_part->getDaug( 0 )->getDaug( 1 )->getNDaug() >= 2 ) { d2d1 = root_part->getDaug( 0 )->getDaug( 1 )->getDaug( 0 )->getP4Lab(); double cosdecayd2d1 = EvtDecayAngle( v, d2, d2d1 ); cosd2d1->Fill( cosdecayd2d1 ); d2vsd2d1->Fill( cosdecayd2, cosdecayd2d1, 1.0 ); if ( root_part->getDaug( 0 )->getDaug( 0 )->getNDaug() >= 2 ) { d1d1 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); double cosdecayd1d1 = EvtDecayAngle( v, d1, d1d1 ); d1d1vsd2d1->Fill( cosdecayd1d1, cosdecayd2d1, 1.0 ); //second daughters of daughters 1 and 2 d1d2 = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 1 )->getP4Lab(); d2d2 = root_part->getDaug( 0 )->getDaug( 1 )->getDaug( 1 )->getP4Lab(); double chi21 = 57.29578 * EvtDecayAngleChi( v, d2d1, d2d2, d1d1, d1d2 ); double chi12 = 57.29578 * EvtDecayAngleChi( v, d1d1, d1d2, d2d1, d2d2 ); chidd->Fill( chi12 ); chi12vsd1d1->Fill( chi12, cosdecayd1d1, 1.0 ); chi12vsd2d1->Fill( chi12, cosdecayd2d1, 1.0 ); chi21vsd1d1->Fill( chi21, cosdecayd1d1, 1.0 ); chi21vsd2d1->Fill( chi21, cosdecayd2d1, 1.0 ); } } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runBsquark( int nevent, EvtGen& myGenerator ) { static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); TFile* file = new TFile( "bsquark.root", "RECREATE" ); TH1F* elep = new TH1F( "h1", "Elep", 50, 0.0, 1.5 ); TH1F* q2 = new TH1F( "h2", "q2", 50, 0.0, 3.0 ); TH2F* dalitz = new TH2F( "h3", "q2 vs. Elep", 50, 0.0, 1.5, 50, 0.0, 3.0 ); TH1F* elepbar = new TH1F( "h11", "Elep bar", 50, 0.0, 1.5 ); TH1F* q2bar = new TH1F( "h12", "q2 bar", 50, 0.0, 3.0 ); TH2F* dalitzbar = new TH2F( "h13", "q2 vs. Elep bar", 50, 0.0, 1.5, 50, 0.0, 3.0 ); int count = 1; char udecay_name[100]; EvtVector4R cm, v, d1, d2, d1d1, d1d2, d2d1, d2d2; strcpy( udecay_name, "exampleFiles/BSQUARK.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( 10.55, 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* p = root_part->nextIter(); while ( p ) { if ( p->getId() == B0 ) { //EvtParticle *dstar=p->getDaug(0); EvtParticle* lepton = p->getDaug( 1 ); EvtParticle* sneutrino = p->getDaug( 2 ); //EvtVector4R p4dstar=dstar->getP4(); EvtVector4R p4lepton = lepton->getP4(); EvtVector4R p4sneutrino = sneutrino->getP4(); elep->Fill( p4lepton.get( 0 ) ); q2->Fill( ( p4lepton + p4sneutrino ).mass2() ); dalitz->Fill( p4lepton.get( 0 ), ( p4lepton + p4sneutrino ).mass2(), 1.0 ); } if ( p->getId() == B0B ) { //EvtParticle *dstar=p->getDaug(0); EvtParticle* lepton = p->getDaug( 1 ); EvtParticle* sneutrino = p->getDaug( 2 ); //EvtVector4R p4dstar=dstar->getP4(); EvtVector4R p4lepton = lepton->getP4(); EvtVector4R p4sneutrino = sneutrino->getP4(); elepbar->Fill( p4lepton.get( 0 ) ); q2bar->Fill( ( p4lepton + p4sneutrino ).mass2() ); dalitzbar->Fill( p4lepton.get( 0 ), ( p4lepton + p4sneutrino ).mass2(), 1.0 ); } p = p->nextIter(); } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runK3gamma( int nevent, EvtGen& myGenerator ) { static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); TFile* file = new TFile( "k3gamma.root", "RECREATE" ); TH1F* costheta = new TH1F( "h1", "cosTheta", 100, -1.0, 1.0 ); int count = 1; char udecay_name[100]; EvtVector4R cm, v, d1, d2, d1d1, d1d2, d2d1, d2d2; strcpy( udecay_name, "exampleFiles/K3GAMMA.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* k3 = root_part->getDaug( 0 ); EvtParticle* k = k3->getDaug( 0 ); EvtVector4R p4b = root_part->getP4Lab(); EvtVector4R p4k3 = k3->getP4Lab(); EvtVector4R p4k = k->getP4Lab(); costheta->Fill( EvtDecayAngle( p4b, p4k3, p4k ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runLambda( int nevent, EvtGen& myGenerator ) { static EvtId LAMBDA = EvtPDL::getId( std::string( "Lambda0" ) ); TFile* file = new TFile( "lambda.root", "RECREATE" ); TH1F* costheta = new TH1F( "h1", "cosTheta", 100, -1.0, 1.0 ); int count = 1; char udecay_name[100]; EvtVector4R cm, v, d1, d2, d1d1, d1d2, d2d1, d2d2; strcpy( udecay_name, "exampleFiles/LAMBDA.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( LAMBDA ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( LAMBDA, p_init ); EvtSpinDensity rho; rho.setDim( 2 ); rho.set( 0, 0, 1.0 ); rho.set( 0, 1, 0.0 ); rho.set( 1, 0, 0.0 ); rho.set( 1, 1, 0.0 ); root_part->setSpinDensityForwardHelicityBasis( rho ); myGenerator.generateDecay( root_part ); EvtParticle* p = root_part->getDaug( 0 ); //EvtVector4R p4lambda=root_part->getP4Lab(); EvtVector4R p4p = p->getP4Lab(); costheta->Fill( p4p.get( 3 ) / p4p.d3mag() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runTauTauPiPi( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); TFile* file = new TFile( "tautaupipi.root", "RECREATE" ); TH1F* cospi1 = new TH1F( "h1", "cos theta pi1", 50, -1.0, 1.0 ); TH1F* cospi2 = new TH1F( "h2", "cos theta pi2", 50, -1.0, 1.0 ); TH1F* costheta = new TH1F( "h3", "cos theta", 50, -1.0, 1.0 ); std::ofstream outmix; outmix.open( "tautaupipi.dat" ); int count = 1; EvtVector4R tau1, tau2, pi1, pi2; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TAUTAUPIPI.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); tau1 = root_part->getDaug( 0 )->getP4Lab(); tau2 = root_part->getDaug( 1 )->getP4Lab(); pi1 = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); pi2 = root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab(); cospi1->Fill( EvtDecayAngle( tau1 + tau2, tau1, pi1 ) ); cospi2->Fill( EvtDecayAngle( tau1 + tau2, tau2, pi2 ) ); costheta->Fill( tau1.get( 3 ) / tau1.d3mag() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runTauTauEE( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); TFile* file = new TFile( "tautauee.root", "RECREATE" ); TH1F* e1 = new TH1F( "h1", "e1", 55, 0.0, 5.5 ); TH1F* e2 = new TH1F( "h2", "e2", 55, 0.0, 5.5 ); TH2F* e1vse2 = new TH2F( "h3", "e1 vs e2", 55, 0.0, 5.5, 55, 0.0, 5.5 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TAUTAUEE.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); e1->Fill( root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab().get( 0 ) ); e2->Fill( root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab().get( 0 ) ); e1vse2->Fill( root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab().get( 0 ), root_part->getDaug( 1 )->getDaug( 0 )->getP4Lab().get( 0 ), 1.0 ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runTauTau2Pi2Pi( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); TFile* file = new TFile( "tautau2pi2pi.root", "RECREATE" ); TH1F* e1 = new TH1F( "h1", "mrho", 200, 0.0, 2.0 ); TH1F* e2 = new TH1F( "h2", "coshel", 200, -1.0, 1.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TAUTAU2PI2PI.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R p4tau = root_part->getDaug( 0 )->getP4(); EvtVector4R p4rho = root_part->getDaug( 0 )->getDaug( 0 )->getP4() + root_part->getDaug( 0 )->getDaug( 1 )->getP4(); EvtVector4R p4pi = root_part->getDaug( 0 )->getDaug( 0 )->getP4(); e1->Fill( p4rho.mass() ); double dcostheta = EvtDecayAngle( p4tau, p4rho, p4pi ); e2->Fill( dcostheta ); p4tau = root_part->getDaug( 1 )->getP4(); p4rho = root_part->getDaug( 1 )->getDaug( 0 )->getP4() + root_part->getDaug( 1 )->getDaug( 1 )->getP4(); p4pi = root_part->getDaug( 1 )->getDaug( 0 )->getP4(); e1->Fill( p4rho.mass() ); dcostheta = EvtDecayAngle( p4tau, p4rho, p4pi ); e2->Fill( dcostheta ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runTauTau3Pi3Pi( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); TFile* file = new TFile( "tautau3pi3pi.root", "RECREATE" ); TH1F* e1 = new TH1F( "h1", "a1", 200, 0.0, 2.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/TAUTAU3PI3PI.DEC" ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R p4tau = root_part->getDaug( 0 )->getP4(); EvtVector4R p4a1 = root_part->getDaug( 0 )->getDaug( 0 )->getP4() + root_part->getDaug( 0 )->getDaug( 1 )->getP4() + root_part->getDaug( 0 )->getDaug( 2 )->getP4(); e1->Fill( p4a1.mass() ); p4tau = root_part->getDaug( 1 )->getP4(); p4a1 = root_part->getDaug( 1 )->getDaug( 0 )->getP4() + root_part->getDaug( 1 )->getDaug( 1 )->getP4() + root_part->getDaug( 1 )->getDaug( 2 )->getP4(); e1->Fill( p4a1.mass() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runJPsiKstar( int nevent, EvtGen& myGenerator, int modeInt ) { std::ofstream outmix; outmix.open( "jpsikstar.dat" ); int count = 1; char udecay_name[100]; if ( modeInt == 0 ) strcpy( udecay_name, "exampleFiles/JPSIKSTAR.DEC" ); if ( modeInt == 1 ) strcpy( udecay_name, "exampleFiles/JPSIKSTAR1.DEC" ); if ( modeInt == 2 ) strcpy( udecay_name, "exampleFiles/JPSIKSTAR2.DEC" ); if ( modeInt == 3 ) strcpy( udecay_name, "exampleFiles/JPSIKSTAR3.DEC" ); if ( modeInt == 4 ) strcpy( udecay_name, "exampleFiles/JPSIKSTAR4.DEC" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); myGenerator.readUDecay( udecay_name ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *btag, *bcp; if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } EvtParticle *p_b, *p_psi, *p_kstar, *p_pi0, *p_kz, *p_ep, *p_em; EvtVector4R p4_b, p4_psi, p4_kstar, p4_pi0, p4_kz, p4_ep, p4_em; p_b = bcp; p_psi = p_b->getDaug( 0 ); p_kstar = p_b->getDaug( 1 ); p_pi0 = p_kstar->getDaug( 0 ); p_kz = p_kstar->getDaug( 1 ); p_ep = p_psi->getDaug( 0 ); p_em = p_psi->getDaug( 1 ); p4_b = p_b->getP4Lab(); p4_psi = p_psi->getP4Lab(); p4_kstar = p_kstar->getP4Lab(); p4_pi0 = p_pi0->getP4Lab(); p4_kz = p_kz->getP4Lab(); p4_ep = p_ep->getP4Lab(); p4_em = p_em->getP4Lab(); outmix << tag.getId() << " "; outmix << root_part->getDaug( 0 )->getLifetime() << " "; outmix << root_part->getDaug( 1 )->getLifetime() << " "; outmix << EvtDecayAngle( p4_b, p4_ep + p4_em, p4_ep ) << " "; outmix << EvtDecayAngle( p4_b, p4_pi0 + p4_kz, p4_pi0 ) << " "; outmix << EvtDecayAngleChi( p4_b, p4_pi0, p4_kz, p4_ep, p4_em ) << "\n"; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSVVCPLH( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "svvcplh.root", "RECREATE" ); TH1F* t = new TH1F( "h1", "t", 50, 0.0, 5.0 ); TH1F* cospsi = new TH1F( "h2", "cos theta e+", 50, -1.0, 1.0 ); TH1F* cosphi = new TH1F( "h3", "cos theta k+", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h4", "chi", 50, 0.0, 2.0 * EvtConst::pi ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/SVVCPLH.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId BS0 = EvtPDL::getId( std::string( "B_s0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( BS0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( BS0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_psi, *p_phi, *p_kp, *p_km, *p_ep, *p_em; EvtVector4R p4_b, p4_psi, p4_phi, p4_kp, p4_km, p4_ep, p4_em; p_b = root_part; if ( p_b->getNDaug() == 1 ) p_b = p_b->getDaug( 0 ); p_psi = p_b->getDaug( 0 ); p_phi = p_b->getDaug( 1 ); p_kp = p_phi->getDaug( 0 ); p_km = p_phi->getDaug( 1 ); p_ep = p_psi->getDaug( 0 ); p_em = p_psi->getDaug( 1 ); p4_b = p_b->getP4Lab(); p4_psi = p_psi->getP4Lab(); p4_phi = p_phi->getP4Lab(); p4_kp = p_kp->getP4Lab(); p4_km = p_km->getP4Lab(); p4_ep = p_ep->getP4Lab(); p4_em = p_em->getP4Lab(); t->Fill( root_part->getLifetime() ); cospsi->Fill( EvtDecayAngle( p4_b, p4_ep + p4_em, p4_ep ) ); cosphi->Fill( EvtDecayAngle( p4_b, p4_kp + p4_km, p4_kp ) ); chi->Fill( EvtDecayAngleChi( p4_b, p4_kp, p4_km, p4_ep, p4_em ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSVSCPLH( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "svscplh.root", "RECREATE" ); TH1F* t = new TH1F( "h1", "t", 200, -5.0, 5.0 ); TH1F* tB0tag = new TH1F( "h2", "dt B0 tag (ps)", 200, -15.0, 15.0 ); TH1F* tB0Btag = new TH1F( "h3", "dt B0B tag (ps)", 200, -15.0, 15.0 ); TH1F* ctheta = new TH1F( "h4", "costheta", 50, -1.0, 1.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/SVSCPLH.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); std::ofstream outmix; outmix.open( "svscplh.dat" ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_tag, *p_cp, *p_jpsi, *p_ep; EvtVector4R p4_tag, p4_cp, p4_jpsi, p4_ep; p_tag = root_part->getDaug( 0 ); p_cp = root_part->getDaug( 1 ); p_jpsi = p_cp->getDaug( 0 ); p_ep = p_jpsi->getDaug( 0 ); p4_tag = p_tag->getP4Lab(); p4_cp = p_cp->getP4Lab(); p4_jpsi = p_jpsi->getP4Lab(); p4_ep = p_ep->getP4Lab(); double dt = p_cp->getLifetime() - p_tag->getLifetime(); dt = dt / ( 1e-12 * 3e11 ); t->Fill( dt ); if ( p_tag->getId() == B0 ) { tB0tag->Fill( dt ); outmix << dt << " 1" << std::endl; } if ( p_tag->getId() == B0B ) { tB0Btag->Fill( dt ); outmix << dt << " -1" << std::endl; } ctheta->Fill( EvtDecayAngle( p4_cp, p4_jpsi, p4_ep ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSSDCP( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "ssdcp.root", "RECREATE" ); TH1F* t = new TH1F( "h1", "dt", 100, -15.0, 15.0 ); TH1F* tB0tag = new TH1F( "h2", "dt B0 tag (ps)", 100, -15.0, 15.0 ); TH1F* tB0Btag = new TH1F( "h3", "dt B0B tag (ps)", 100, -15.0, 15.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/SSDCP.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); std::ofstream outmix; do { EvtVector4R pinit( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, pinit ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_tag, *p_cp, *p_jpsi; EvtVector4R p4_tag, p4_cp, p4_jpsi, p4_ep; p_tag = root_part->getDaug( 0 ); p_cp = root_part->getDaug( 1 ); p_jpsi = p_cp->getDaug( 0 ); //p_ep=p_jpsi->getDaug(0); p4_tag = p_tag->getP4Lab(); p4_cp = p_cp->getP4Lab(); p4_jpsi = p_jpsi->getP4Lab(); //p4_ep=p_ep->getP4Lab(); double dt = p_cp->getLifetime() - p_tag->getLifetime(); dt = dt / ( 1e-12 * EvtConst::c ); t->Fill( dt ); if ( p_tag->getId() == B0 ) { tB0tag->Fill( dt ); } if ( p_tag->getId() == B0B ) { tB0Btag->Fill( dt ); } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runDSTARPI( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "dstarpi.root", "RECREATE" ); TH1F* t = new TH1F( "h1", "dt", 100, -15.0, 15.0 ); TH1F* tB0tagpip = new TH1F( "h2", "dt B0 tag pi+ (ps)", 100, -15.0, 15.0 ); TH1F* tB0Btagpip = new TH1F( "h3", "dt B0B tag pi+(ps)", 100, -15.0, 15.0 ); TH1F* tB0tagpim = new TH1F( "h4", "dt B0 tag pi- (ps)", 100, -15.0, 15.0 ); TH1F* tB0Btagpim = new TH1F( "h5", "dt B0B tag pi- (ps)", 100, -15.0, 15.0 ); int count = 1; myGenerator.readUDecay( "exampleFiles/DSTARPI.DEC" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); static EvtId PIP = EvtPDL::getId( std::string( "pi+" ) ); static EvtId PIM = EvtPDL::getId( std::string( "pi-" ) ); std::ofstream outmix; do { EvtVector4R pinit( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, pinit ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_tag, *p_cp, *p_pi; p_tag = root_part->getDaug( 0 ); p_cp = root_part->getDaug( 1 ); //p_dstar=p_cp->getDaug(1); p_pi = p_cp->getDaug( 0 ); double dt = p_cp->getLifetime() - p_tag->getLifetime(); dt = dt / ( 1e-12 * EvtConst::c ); t->Fill( dt ); if ( p_tag->getId() == B0 ) { if ( p_pi->getId() == PIP ) tB0tagpip->Fill( dt ); if ( p_pi->getId() == PIM ) tB0tagpim->Fill( dt ); } if ( p_tag->getId() == B0B ) { if ( p_pi->getId() == PIP ) tB0Btagpip->Fill( dt ); if ( p_pi->getId() == PIM ) tB0Btagpim->Fill( dt ); } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runETACPHIPHI( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "etacphiphi.root", "RECREATE" ); TH2F* cosphi12 = new TH2F( "h1", "cos phi1 vs phi2", 50, -1.0, 1.0, 50, -1.0, 1.0 ); TH1F* cosphi1 = new TH1F( "h2", "cos phi1", 50, -1.0, 1.0 ); TH1F* cosphi2 = new TH1F( "h3", "cos phi2", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h4", "chi", 50, 0.0, 2.0 * EvtConst::pi ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/ETACPHIPHI.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId ETAC = EvtPDL::getId( std::string( "eta_c" ) ); do { EvtVector4R p_init( EvtPDL::getMass( ETAC ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( ETAC, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_etac, *p_phi1, *p_phi2, *p_kp1, *p_km1, *p_kp2, *p_km2; EvtVector4R p4_etac, p4_phi1, p4_phi2, p4_kp1, p4_km1, p4_kp2, p4_km2; p_etac = root_part; p_phi1 = p_etac->getDaug( 0 ); p_phi2 = p_etac->getDaug( 1 ); p_kp1 = p_phi1->getDaug( 0 ); p_km1 = p_phi1->getDaug( 1 ); p_kp2 = p_phi2->getDaug( 0 ); p_km2 = p_phi2->getDaug( 1 ); p4_etac = p_etac->getP4Lab(); p4_phi1 = p_phi1->getP4Lab(); p4_phi2 = p_phi2->getP4Lab(); p4_kp1 = p_kp1->getP4Lab(); p4_km1 = p_km1->getP4Lab(); p4_kp2 = p_kp2->getP4Lab(); p4_km2 = p_km2->getP4Lab(); cosphi12->Fill( EvtDecayAngle( p4_etac, p4_phi1, p4_kp1 ), EvtDecayAngle( p4_etac, p4_phi2, p4_kp2 ), 1.0 ); cosphi1->Fill( EvtDecayAngle( p4_etac, p4_phi1, p4_kp1 ) ); cosphi2->Fill( EvtDecayAngle( p4_etac, p4_phi2, p4_kp2 ) ); chi->Fill( EvtDecayAngleChi( p4_etac, p4_kp1, p4_km1, p4_kp2, p4_km2 ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runVVPiPi( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "vvpipi.root", "RECREATE" ); TH1F* cospsi = new TH1F( "h1", "cos theta J/psi ", 50, -1.0, 1.0 ); TH1F* cose = new TH1F( "h2", "cos theta e+ ", 50, -1.0, 1.0 ); TH1F* mpipi = new TH1F( "h3", "m pipi ", 50, 0.0, 1.0 ); TH2F* cosevspsi = new TH2F( "h4", "cos theta e+vs cos thete J/psi ", 25, -1.0, 1.0, 25, -1.0, 1.0 ); TH1F* cose1 = new TH1F( "h5", "cos theta e+ 1 ", 50, -1.0, 1.0 ); TH1F* cose2 = new TH1F( "h6", "cos theta e+ 2 ", 50, -1.0, 1.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/VVPIPI.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_psip, *p_psi, *p_ep, *p_pi1, *p_pi2; EvtVector4R p4_b, p4_psip, p4_psi, p4_ep, p4_pi1, p4_pi2; p_b = root_part; p_psip = p_b->getDaug( 0 ); p_psi = p_psip->getDaug( 0 ); p_pi1 = p_psip->getDaug( 1 ); p_pi2 = p_psip->getDaug( 2 ); p_ep = p_psi->getDaug( 0 ); p4_b = p_b->getP4Lab(); p4_psip = p_psip->getP4Lab(); p4_psi = p_psi->getP4Lab(); p4_pi1 = p_pi1->getP4Lab(); p4_pi2 = p_pi2->getP4Lab(); p4_ep = p_ep->getP4Lab(); cospsi->Fill( EvtDecayAngle( p4_b, p4_psip, p4_psi ) ); cose->Fill( EvtDecayAngle( p4_psip, p4_psi, p4_ep ) ); mpipi->Fill( ( p4_pi1 + p4_pi2 ).mass() ); cosevspsi->Fill( EvtDecayAngle( p4_b, p4_psip, p4_psi ), EvtDecayAngle( p4_psip, p4_psi, p4_ep ), 1.0 ); if ( std::fabs( EvtDecayAngle( p4_b, p4_psip, p4_psi ) ) > 0.95 ) { cose1->Fill( EvtDecayAngle( p4_psip, p4_psi, p4_ep ) ); } if ( std::fabs( EvtDecayAngle( p4_b, p4_psip, p4_psi ) ) < 0.05 ) { cose2->Fill( EvtDecayAngle( p4_psip, p4_psi, p4_ep ) ); } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSVVHelAmp( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "svvhelamp.root", "RECREATE" ); TH1F* cospip = new TH1F( "h1", "cos theta pi+", 50, -1.0, 1.0 ); TH1F* cospim = new TH1F( "h2", "cos theta pi-", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h3", "chi pi+ to pi- in D+ direction", 50, 0.0, EvtConst::twoPi ); TH1F* chicospipp = new TH1F( "h4", "chi pi+ to pi- in D+ direction (cospip>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chicospipn = new TH1F( "h5", "chi pi+ to pi- in D+ direction (cospip<0", 50, 0.0, EvtConst::twoPi ); TH1F* chipp = new TH1F( "h6", "chi pi+ to pi- in D+ direction (cospip>0,cospim>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chipn = new TH1F( "h7", "chi pi+ to pi- in D+ direction (cospip>0,cospim<0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinp = new TH1F( "h8", "chi pi+ to pi- in D+ direction (cospip<0,cospim>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinn = new TH1F( "h9", "chi pi+ to pi- in D+ direction (cospip<0,cospim<0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinnnn = new TH1F( "h10", "chi pi+ to pi- in D+ direction (cospip<-0.5,cospim<-0.5)", 50, 0.0, EvtConst::twoPi ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/SVVHELAMP.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_dstp, *p_dstm, *p_pip, *p_pim, *p_d0, *p_d0b; EvtVector4R p4_b, p4_dstp, p4_dstm, p4_pip, p4_pim, p4_d0, p4_d0b; p_b = root_part; p_dstp = p_b->getDaug( 0 ); p_dstm = p_b->getDaug( 1 ); p_pip = p_dstp->getDaug( 1 ); p_pim = p_dstm->getDaug( 1 ); p_d0 = p_dstp->getDaug( 0 ); p_d0b = p_dstm->getDaug( 0 ); p4_b = p_b->getP4Lab(); p4_dstp = p_dstp->getP4Lab(); p4_dstm = p_dstm->getP4Lab(); p4_pip = p_pip->getP4Lab(); p4_pim = p_pim->getP4Lab(); p4_d0 = p_d0->getP4Lab(); p4_d0b = p_d0b->getP4Lab(); double costhpip = EvtDecayAngle( p4_b, p4_pip + p4_d0, p4_pip ); double costhpim = EvtDecayAngle( p4_b, p4_pim + p4_d0b, p4_pim ); double chiang = EvtDecayAngleChi( p4_b, p4_pip, p4_d0, p4_pim, p4_d0b ); cospip->Fill( costhpip ); cospim->Fill( costhpim ); chi->Fill( chiang ); if ( costhpip > 0 ) chicospipp->Fill( chiang ); if ( costhpip < 0 ) chicospipn->Fill( chiang ); if ( costhpip > 0 && costhpim > 0 ) chipp->Fill( chiang ); if ( costhpip > 0 && costhpim < 0 ) chipn->Fill( chiang ); if ( costhpip < 0 && costhpim > 0 ) chinp->Fill( chiang ); if ( costhpip < 0 && costhpim < 0 ) chinn->Fill( chiang ); if ( costhpip < -0.5 && costhpim < -0.5 ) chinnnn->Fill( chiang ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPartWave( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "partwave.root", "RECREATE" ); TH1F* cospip = new TH1F( "h1", "cos theta pi+", 50, -1.0, 1.0 ); TH1F* cospim = new TH1F( "h2", "cos theta pi-", 50, -1.0, 1.0 ); TH1F* chi = new TH1F( "h3", "chi pi+ to pi- in D+ direction", 50, 0.0, EvtConst::twoPi ); TH1F* chicospipp = new TH1F( "h4", "chi pi+ to pi- in D+ direction (cospip>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chicospipn = new TH1F( "h5", "chi pi+ to pi- in D+ direction (cospip<0", 50, 0.0, EvtConst::twoPi ); TH1F* chipp = new TH1F( "h6", "chi pi+ to pi- in D+ direction (cospip>0,cospim>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chipn = new TH1F( "h7", "chi pi+ to pi- in D+ direction (cospip>0,cospim<0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinp = new TH1F( "h8", "chi pi+ to pi- in D+ direction (cospip<0,cospim>0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinn = new TH1F( "h9", "chi pi+ to pi- in D+ direction (cospip<0,cospim<0)", 50, 0.0, EvtConst::twoPi ); TH1F* chinnnn = new TH1F( "h10", "chi pi+ to pi- in D+ direction (cospip<-0.5,cospim<-0.5)", 50, 0.0, EvtConst::twoPi ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/PARTWAVE.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_dstp, *p_dstm, *p_pip, *p_pim, *p_d0, *p_d0b; EvtVector4R p4_b, p4_dstp, p4_dstm, p4_pip, p4_pim, p4_d0, p4_d0b; p_b = root_part; p_dstp = p_b->getDaug( 0 ); p_dstm = p_b->getDaug( 1 ); p_pip = p_dstp->getDaug( 1 ); p_pim = p_dstm->getDaug( 1 ); p_d0 = p_dstp->getDaug( 0 ); p_d0b = p_dstm->getDaug( 0 ); p4_b = p_b->getP4Lab(); p4_dstp = p_dstp->getP4Lab(); p4_dstm = p_dstm->getP4Lab(); p4_pip = p_pip->getP4Lab(); p4_pim = p_pim->getP4Lab(); p4_d0 = p_d0->getP4Lab(); p4_d0b = p_d0b->getP4Lab(); double costhpip = EvtDecayAngle( p4_b, p4_pip + p4_d0, p4_pip ); double costhpim = EvtDecayAngle( p4_b, p4_pim + p4_d0b, p4_pim ); double chiang = EvtDecayAngleChi( p4_b, p4_pip, p4_d0, p4_pim, p4_d0b ); cospip->Fill( costhpip ); cospim->Fill( costhpim ); chi->Fill( chiang ); if ( costhpip > 0 ) chicospipp->Fill( chiang ); if ( costhpip < 0 ) chicospipn->Fill( chiang ); if ( costhpip > 0 && costhpim > 0 ) chipp->Fill( chiang ); if ( costhpip > 0 && costhpim < 0 ) chipn->Fill( chiang ); if ( costhpip < 0 && costhpim > 0 ) chinp->Fill( chiang ); if ( costhpip < 0 && costhpim < 0 ) chinn->Fill( chiang ); if ( costhpip < -0.5 && costhpim < -0.5 ) chinnnn->Fill( chiang ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPartWave2( int nevent, EvtGen& myGenerator ) { TFile file( "partwave2.root", "RECREATE" ); TH1F* cthetapi = new TH1F( "h1", "cos theta pi", 50, -1.0, 1.0 ); TH1F* cthetapi2 = new TH1F( "h2", "cos theta pi (|cosrho|<0.1)", 50, -1.0, 1.0 ); TH1F* cthetan = new TH1F( "h3", "cos thetan", 50, -1.0, 1.0 ); //TH1F* cthetan2 = new TH1F("h4","cos thetan costhetapi>0 ", // 50,-1.0,1.0); TH1F* cthetarho = new TH1F( "h4", "cos thetarho ", 50, -1.0, 1.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/PARTWAVE2.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_jpsi, *p_rho, *p_pi1, *p_pi2; EvtVector4R p4_b, p4_jpsi, p4_rho, p4_pi1, p4_pi2; p_b = root_part; p_jpsi = root_part->getDaug( 0 ); p_rho = nullptr; if ( p_jpsi->getDaug( 0 )->getNDaug() == 2 ) { p_rho = p_jpsi->getDaug( 0 ); } if ( p_jpsi->getDaug( 1 )->getNDaug() == 2 ) { p_rho = p_jpsi->getDaug( 1 ); } assert( p_rho != 0 ); p_pi1 = p_rho->getDaug( 0 ); p_pi2 = p_rho->getDaug( 1 ); p4_b = p_b->getP4Lab(); p4_jpsi = p_jpsi->getP4Lab(); p4_rho = p_rho->getP4Lab(); p4_pi1 = p_pi1->getP4Lab(); p4_pi2 = p_pi2->getP4Lab(); double costhetan = EvtDecayPlaneNormalAngle( p4_b, p4_jpsi, p4_pi1, p4_pi2 ); //EvtGenReport(EVTGEN_INFO,"EvtGen") << "costhetan:"<Fill( costhetan ); double costhpi = EvtDecayAngle( p4_jpsi, p4_rho, p4_pi1 ); double costhrho = EvtDecayAngle( p4_b, p4_jpsi, p4_rho ); //EvtGenReport(EVTGEN_INFO,"EvtGen") << "costhetarho:"<Fill( costhrho ); //if (((p4_rho.get(3)/p4_rho.d3mag()))<-0.95) cthetan2->Fill( costhetan ); cthetapi->Fill( costhpi ); if ( ( p4_rho.get( 3 ) / p4_rho.d3mag() ) > 0.9 ) { cthetapi2->Fill( costhpi ); } root_part->deleteTree(); } while ( count++ < nevent ); file.Write(); file.Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runTwoBody( int nevent, EvtGen& myGenerator, std::string decFile, std::string rootFile ) { TFile* file = new TFile( rootFile.c_str(), "RECREATE" ); int count = 0; myGenerator.readUDecay( decFile.c_str() ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); vector histograms; do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); //root_part->printTree(); myGenerator.generateDecay( root_part ); int nhist = 0; EvtParticle* p = root_part; do { int nDaug = p->getNDaug(); if ( !( nDaug == 0 || nDaug == 2 ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "nDaug=" << nDaug << " but can only handle 0 or 2!" << std::endl; abort(); } if ( nDaug == 2 ) { if ( p->getParent() == nullptr ) { EvtVector4R p4 = p->getDaug( 0 )->getP4(); double ctheta = p4.get( 3 ) / p4.d3mag(); double phi = atan2( p4.get( 2 ), p4.get( 1 ) ); if ( count == 0 ) { histograms.push_back( new TH1F( "h1", "cos theta", 50, -1.0, 1.0 ) ); histograms.push_back( new TH1F( "h2", "phi", 50, -EvtConst::pi, EvtConst::pi ) ); } histograms[nhist++]->Fill( ctheta ); histograms[nhist++]->Fill( phi ); } else { double ctheta = EvtDecayAngle( p->getParent()->getP4Lab(), p->getP4Lab(), p->getDaug( 0 )->getP4Lab() ); if ( count == 0 ) { // char* tmp=new char[10]; // std::ostrstream strm(tmp,9); // strm << (nhist+1) << '\0'<< std::endl; // histograms.push_back(new TH1F(TString("h")+tmp,TString("cos theta")+tmp,50,-1.0,1.0)); std::ostringstream strm; strm << ( nhist + 1 ); histograms.push_back( new TH1F( TString( "h" ) + strm.str().c_str(), TString( "cos theta" ) + strm.str().c_str(), 50, -1.0, 1.0 ) ); } histograms[nhist++]->Fill( ctheta ); if ( p->getDaug( 0 )->getNDaug() == 2 ) { double costhetan = EvtDecayPlaneNormalAngle( p->getParent()->getP4Lab(), p->getP4Lab(), p->getDaug( 0 )->getDaug( 0 )->getP4Lab(), p->getDaug( 0 )->getDaug( 1 )->getP4Lab() ); if ( count == 0 ) { // char* tmp=new char[10]; // std::ostrstream strm(tmp,9); // strm << (nhist+1) << '\0'<< std::endl; // histograms.push_back(new TH1F(TString("h")+tmp,TString("cos thetan")+tmp,50,-1.0,1.0)); std::ostringstream strm; strm << ( nhist + 1 ); histograms.push_back( new TH1F( TString( "h" ) + strm.str().c_str(), TString( "cos theta" ) + strm.str().c_str(), 50, -1.0, 1.0 ) ); } histograms[nhist++]->Fill( costhetan ); } if ( p->getDaug( 1 )->getNDaug() == 2 ) { double costhetan = EvtDecayPlaneNormalAngle( p->getParent()->getP4Lab(), p->getP4Lab(), p->getDaug( 1 )->getDaug( 0 )->getP4Lab(), p->getDaug( 1 )->getDaug( 1 )->getP4Lab() ); if ( count == 0 ) { // char* tmp=new char[10]; // std::ostrstream strm(tmp,9); // strm << (nhist+1) << '\0'<< std::endl; // histograms.push_back(new TH1F(TString("h")+tmp,TString("cos thetan")+tmp,50,-1.0,1.0)); std::ostringstream strm; strm << ( nhist + 1 ); histograms.push_back( new TH1F( TString( "h" ) + strm.str().c_str(), TString( "cos theta" ) + strm.str().c_str(), 50, -1.0, 1.0 ) ); } histograms[nhist++]->Fill( costhetan ); } } } p = p->nextIter( root_part ); } while ( p != nullptr ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPiPi( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "pipi.dat" ); TFile* file = new TFile( "pipi.root", "RECREATE" ); TH1F* tB0Hist = new TH1F( "h1", "dt in B->pipi with B0 tag", 50, -5.0, 5.0 ); TH1F* tB0BHist = new TH1F( "h2", "dt in B->pipi with B0B tag", 50, -5.0, 5.0 ); TH1F* tB0 = new TH1F( "h3", "t in B->pipi for B0 tag", 25, 0.0, 5.0 ); TH1F* tB0B = new TH1F( "h4", "t in B->pipi for B0B tag", 25, 0.0, 5.0 ); char udecay_name[100]; strcpy( udecay_name, "exampleFiles/PIPI.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); EvtParticle *bcp, *btag; int count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } // int a1=bcp->getDaug(0)->getId(); if ( tag == B0 ) tB0Hist->Fill( bcp->getLifetime() - btag->getLifetime() ); if ( tag == B0 ) tB0->Fill( btag->getLifetime() ); if ( tag == B0B ) tB0BHist->Fill( bcp->getLifetime() - btag->getLifetime() ); if ( tag == B0B ) tB0B->Fill( btag->getLifetime() ); outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << tag.getId() << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runA1Pi( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "a1pi.dat" ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/A1PI.DEC" ); myGenerator.readUDecay( udecay_name ); EvtParticle *bcp, *btag; EvtParticle *a1, *rho0, *pi1, *pi2, *pi3, *pi4; EvtVector4R p4bcp, p4a1, p4rho0, p4pi1, p4pi2, p4pi3, p4pi4; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } a1 = bcp->getDaug( 0 ); pi1 = bcp->getDaug( 1 ); rho0 = a1->getDaug( 0 ); pi2 = a1->getDaug( 1 ); pi3 = rho0->getDaug( 0 ); pi4 = rho0->getDaug( 1 ); p4bcp = bcp->getP4Lab(); p4a1 = a1->getP4Lab(); p4pi1 = pi1->getP4Lab(); p4rho0 = rho0->getP4Lab(); p4pi2 = pi2->getP4Lab(); p4pi3 = pi3->getP4Lab(); p4pi4 = pi4->getP4Lab(); EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << EvtDecayAngle( p4bcp, p4rho0 + p4pi2, p4rho0 ) << " " << EvtDecayAngle( p4a1, p4pi3 + p4pi4, p4pi3 ) << " " << EvtPDL::getStdHep( tag ) << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runCPTest( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "cptest.dat" ); int count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); char udecay_name[100]; strcpy( udecay_name, "exampleFiles/CPTEST.DEC" ); //EvtGen myGenerator(decay_name,pdttable_name,myRandomEngine); myGenerator.readUDecay( udecay_name ); EvtParticle *bcp, *btag; do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << tag.getId() << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runBtoXsgamma( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); TFile* file = new TFile( "BtoXsgamma.root", "RECREATE" ); int count = 1; EvtParticle* root_part; EvtVectorParticle* vector_part; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/BTOXSGAMMA.DEC" ); myGenerator.readUDecay( udecay_name ); // Plot kinematics for b->s,gamma int strangeid, antistrangeid; int Bmulti, bId1a, bId1b, bId2a, bId2b, b1Id, b2Id; do { vector_part = new EvtVectorParticle; EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); vector_part->init( UPS4, p_init ); root_part = (EvtParticle*)vector_part; root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* B1 = root_part->getDaug( 0 ); Bmulti = B1->getNDaug(); if ( Bmulti == 1 ) B1 = B1->getDaug( 0 ); EvtId BId1a = B1->getDaug( 0 )->getId(); bId1a = EvtPDL::getStdHep( BId1a ); EvtId BId1b = B1->getDaug( 1 )->getId(); bId1b = EvtPDL::getStdHep( BId1b ); if ( Bmulti == 1 ) EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "B1" << " bId1a=" << bId1a << " bId1b=" << bId1b << " ndaug=" << B1->getNDaug() << " Bid=" << EvtPDL::getStdHep( B1->getId() ) << std::endl; EvtParticle* B2 = root_part->getDaug( 1 ); Bmulti = B2->getNDaug(); if ( Bmulti == 1 ) B2 = B2->getDaug( 0 ); // B has a daughter which is a string EvtId BId2a = B2->getDaug( 0 )->getId(); bId2a = EvtPDL::getStdHep( BId2a ); EvtId BId2b = B2->getDaug( 1 )->getId(); bId2b = EvtPDL::getStdHep( BId2b ); if ( Bmulti == 1 ) EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "B2" << " bId2a=" << bId2a << " bId2b=" << bId2b << " ndaug=" << B2->getNDaug() << " Bid=" << EvtPDL::getStdHep( B2->getId() ) << std::endl; EvtId B1Id = B1->getId(); b1Id = EvtPDL::getStdHep( B1Id ); EvtId B2Id = B2->getId(); b2Id = EvtPDL::getStdHep( B2Id ); strangeid = 0; antistrangeid = 0; if ( ( b1Id == 511 ) || ( b1Id == -511 ) || ( b2Id == 511 ) || ( b2Id == -511 ) ) { strangeid = 30343; antistrangeid = -30343; } else if ( ( b1Id == 521 ) || ( b1Id == -521 ) || ( b2Id == 521 ) || ( b2Id == -521 ) ) { strangeid = 30353; antistrangeid = -30353; } else if ( ( b1Id == 531 ) || ( b1Id == -531 ) || ( b2Id == 531 ) || ( b2Id == -531 ) ) { strangeid = 30363; antistrangeid = -30363; } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "bId1a " << bId1a << " bId1b " << bId1b << " bId2a " << bId2a << " bId2b " << bId2b << " for event " << count << std::endl; EvtParticle* Bpeng = nullptr; //int bnum=0; int pengcount = 0; if ( ( ( bId1a == strangeid ) && ( bId1b == 22 ) ) || ( ( bId1a == antistrangeid ) && ( bId1b == 22 ) ) || ( ( bId1b == strangeid ) && ( bId1a == 22 ) ) || ( ( bId1b == antistrangeid ) && ( bId1a == 22 ) ) ) { Bpeng = B1; //bnum=1; pengcount++; } if ( ( ( bId2a == strangeid ) && ( bId2b == 22 ) ) || ( ( bId2a == antistrangeid ) && ( bId2b == 22 ) ) || ( ( bId2b == strangeid ) && ( bId2a == 22 ) ) || ( ( bId2b == antistrangeid ) && ( bId2a == 22 ) ) ) { Bpeng = B2; //bnum=2; pengcount++; } if ( pengcount == 0 ) { Bpeng = B1; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "No penguin decay for event " << count << std::endl; //bnum=0; } else if ( pengcount == 2 ) { Bpeng = B1; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Two penguin decays in event " << count << std::endl; //bnum=0; } Bmulti = Bpeng->getNDaug(); EvtParticle* Xs = Bpeng->getDaug( 0 ); //EvtParticle *gam = Bpeng->getDaug(1); //EvtVector4R p4Xs = Xs->getP4Lab(); //EvtId BId = Bpeng->getId(); //EvtId XsId = Xs->getId(); int Xsmulti = Xs->getNDaug(); //EvtId gamId = gam->getId(); //int bId = EvtPDL::getStdHep(BId); //int XId = EvtPDL::getStdHep(XsId); //int gId = EvtPDL::getStdHep(gamId); //float XsMass = p4Xs.mass(); //double gmass = p4gam.mass(); //double genergy = p4gam.get(0); // debug stuff: EvtGenReport(EVTGEN_INFO,"EvtGen") << "bnum=" << bnum << " pengcount=" << pengcount << " bId=" << bId << " Bmulti=" << Bmulti << " XsId=" << XId << " gId=" << gId << std::endl; //need to change this to root...I don't have the energy now //tuple->column("bnum", bnum); //tuple->column("pengcount", pengcount); //tuple->column("bId", bId); //tuple->column("Bmulti", Bmulti); //tuple->column("XsId", XId); //tuple->column("gId", gId); //tuple->column("XsMass", XsMass); //tuple->column("Xsmulti", Xsmulti, 0,"Xs", HTRange(0,200)); //tuple->column("gmass", gmass); //tuple->column("genergy", genergy); //HTValOrderedVector XDaugId, XDaugNephewId; //HTValOrderedVector XsDaugMass, XsDaugNephewMass; int nTot( 0 ); for ( int i = 0; i < Xsmulti; i++ ) { EvtParticle* XsDaug = Xs->getDaug( i ); //EvtVector4R p4XsDaug = XsDaug->getP4Lab(); EvtId XsDaugId = XsDaug->getId(); //XDaugId.push_back(EvtPDL::getStdHep(XsDaugId)); //XsDaugMass.push_back( p4XsDaug.mass()); int Daumulti = XsDaug->getNDaug(); if ( abs( EvtPDL::getStdHep( XsDaugId ) ) == 321 || EvtPDL::getStdHep( XsDaugId ) == 310 || EvtPDL::getStdHep( XsDaugId ) == 111 || abs( EvtPDL::getStdHep( XsDaugId ) ) == 211 || Daumulti == 0 ) { nTot++; //EvtVector4R p4XsDaugNephew = XsDaug->getP4Lab(); //EvtId XsDaugNephewId =XsDaug->getId() ; //XDaugNephewId.push_back(EvtPDL::getStdHep(XsDaugId)); //XsDaugNephewMass.push_back( p4XsDaug.mass()); } else if ( Daumulti != 0 ) { for ( int k = 0; k < Daumulti; k++ ) { EvtParticle* XsDaugNephew = XsDaug->getDaug( k ); EvtId XsDaugNephewId = XsDaugNephew->getId(); int Nephmulti = XsDaugNephew->getNDaug(); if ( Nephmulti == 0 || abs( EvtPDL::getStdHep( XsDaugNephewId ) ) == 321 || EvtPDL::getStdHep( XsDaugNephewId ) == 310 || EvtPDL::getStdHep( XsDaugNephewId ) == 111 || abs( EvtPDL::getStdHep( XsDaugNephewId ) ) == 211 ) { nTot++; //EvtVector4R p4XsDaugNephew = XsDaugNephew->getP4Lab(); //XDaugNephewId.push_back(EvtPDL::getStdHep(XsDaugNephewId)); //XsDaugNephewMass.push_back( p4XsDaugNephew.mass()); } else { for ( int g = 0; g < Nephmulti; g++ ) { nTot++; //EvtParticle *XsDaugNephewNephew = XsDaugNephew->getDaug(g); //EvtVector4R p4XsDaugNephewNephew = XsDaugNephewNephew->getP4Lab(); //EvtId XsDaugNephewNephewId = XsDaugNephewNephew->getId(); //XDaugNephewId.push_back(EvtPDL::getStdHep(XsDaugNephewNephewId)); //XsDaugNephewMass.push_back( p4XsDaugNephewNephew.mass()); } } } } } //tuple->column("XsDaugId", XDaugId,"Xsmulti", 0, "Xs"); //tuple->column("XsDaugMass", XsDaugMass,"Xsmulti", 0, "Xs"); //tuple->column("nTot", nTot, 0,"nTot", HTRange(0,200)); //tuple->column("XsDaugNephewId", XDaugNephewId,"nTot", 0, "nTot"); //tuple->column("XsDaugNephewMass", XsDaugNephewMass,"nTot", 0, "nTot"); //tuple->dumpData(); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "End EvtGen. Ran on " << nevent << " events." << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runBtoK1273gamma( int nevent, EvtGen& myGenerator ) { static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); TFile* file = new TFile( "BtoK1273gamma.root", "RECREATE" ); //HepTuple *tuple = hfile.ntuple("BtoK1273gamma", 1); int count = 1; EvtParticle* root_part; EvtVectorParticle* vector_part; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/BTOK1273GAMMA.DEC" ); myGenerator.readUDecay( udecay_name ); // Plot kinematics for b->s,gamma int strangeid, antistrangeid; int Bmulti, bId1a, bId1b, bId2a, bId2b, b1Id, b2Id; do { vector_part = new EvtVectorParticle; EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); vector_part->init( UPS4, p_init ); root_part = (EvtParticle*)vector_part; root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle* B1 = root_part->getDaug( 0 ); Bmulti = B1->getNDaug(); if ( Bmulti == 1 ) B1 = B1->getDaug( 0 ); EvtId BId1a = B1->getDaug( 0 )->getId(); bId1a = EvtPDL::getStdHep( BId1a ); EvtId BId1b = B1->getDaug( 1 )->getId(); bId1b = EvtPDL::getStdHep( BId1b ); if ( Bmulti == 1 ) EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "B1" << " bId1a=" << bId1a << " bId1b=" << bId1b << " ndaug=" << B1->getNDaug() << " Bid=" << EvtPDL::getStdHep( B1->getId() ) << std::endl; EvtParticle* B2 = root_part->getDaug( 1 ); Bmulti = B2->getNDaug(); if ( Bmulti == 1 ) B2 = B2->getDaug( 0 ); // B has a daughter which is a string EvtId BId2a = B2->getDaug( 0 )->getId(); bId2a = EvtPDL::getStdHep( BId2a ); EvtId BId2b = B2->getDaug( 1 )->getId(); bId2b = EvtPDL::getStdHep( BId2b ); if ( Bmulti == 1 ) EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "B2" << " bId2a=" << bId2a << " bId2b=" << bId2b << " ndaug=" << B2->getNDaug() << " Bid=" << EvtPDL::getStdHep( B2->getId() ) << std::endl; EvtId B1Id = B1->getId(); b1Id = EvtPDL::getStdHep( B1Id ); EvtId B2Id = B2->getId(); b2Id = EvtPDL::getStdHep( B2Id ); strangeid = 0; antistrangeid = 0; if ( ( b1Id == 511 ) || ( b1Id == -511 ) || ( b2Id == 511 ) || ( b2Id == -511 ) ) { strangeid = 10313; antistrangeid = -10313; } else if ( ( b1Id == 521 ) || ( b1Id == -521 ) || ( b2Id == 521 ) || ( b2Id == -521 ) ) { strangeid = 10323; antistrangeid = -10323; } EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "bId1a " << bId1a << " bId1b " << bId1b << " bId2a " << bId2a << " bId2b " << bId2b << " for event " << count << std::endl; EvtParticle* Bpeng = nullptr; //int bnum=0; int pengcount = 0; if ( ( ( bId1a == strangeid ) && ( bId1b == 22 ) ) || ( ( bId1a == antistrangeid ) && ( bId1b == 22 ) ) || ( ( bId1b == strangeid ) && ( bId1a == 22 ) ) || ( ( bId1b == antistrangeid ) && ( bId1a == 22 ) ) ) { Bpeng = B1; //bnum=1; pengcount++; } if ( ( ( bId2a == strangeid ) && ( bId2b == 22 ) ) || ( ( bId2a == antistrangeid ) && ( bId2b == 22 ) ) || ( ( bId2b == strangeid ) && ( bId2a == 22 ) ) || ( ( bId2b == antistrangeid ) && ( bId2a == 22 ) ) ) { Bpeng = B2; //bnum=2; pengcount++; } if ( pengcount == 0 ) { Bpeng = B1; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "No penguin decay for event " << count << std::endl; //bnum=0; } else if ( pengcount == 2 ) { Bpeng = B1; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Two penguin decays in event " << count << std::endl; //bnum=0; } Bmulti = Bpeng->getNDaug(); //EvtParticle *Ks = Bpeng->getDaug(0); //EvtParticle *gam = Bpeng->getDaug(1); //EvtVector4R p4Ks = Ks->getP4Lab(); //const EvtVector4R& p4gam = gam->getP4(); // gamma 4-mom in parent's rest frame //EvtId BId = Bpeng->getId(); //EvtId KsId = Ks->getId(); //int Ksmulti = Ks->getNDaug(); //EvtId gamId = gam->getId(); //int bId = EvtPDL::getStdHep(BId); //int XId = EvtPDL::getStdHep(KsId); //int gId = EvtPDL::getStdHep(gamId); //double KsMass = p4Ks.mass(); //double gmass = p4gam.mass(); //double genergy = p4gam.get(0); // debug stuff: EvtGenReport(EVTGEN_INFO,"EvtGen") << "bnum=" << bnum << " pengcount=" << pengcount << " bId=" << bId << " Bmulti=" << Bmulti << " KsId=" << XId << " gId=" << gId << std::endl; //tuple->column("bnum", bnum); //tuple->column("pengcount", pengcount); //tuple->column("bId", bId); //tuple->column("Bmulti", Bmulti); //tuple->column("KsId", XId); //tuple->column("gId", gId); //tuple->column("KsMass", KsMass); //tuple->column("Ksmulti", Ksmulti); //tuple->column("gmass", gmass); //tuple->column("genergy", genergy); //for(int i=0;igetDaug(i); //EvtVector4R p4KsDaug = KsDaug->getP4Lab(); //EvtId KsDaugId = KsDaug->getId(); //int XDaugId = EvtPDL::getStdHep(KsDaugId); //double KsDaugMass = p4KsDaug.mass(); //tuple->column("KsDaugId", XDaugId); //tuple->column("KsDaugMass", KsDaugMass); //} //tuple->dumpData(); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "End EvtGen. Ran on " << nevent << " events." << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runCheckRotBoost() { EvtDiracSpinor sp1, sp2; //Generate ryd/lange random spinors. sp1.set( EvtComplex( 1.0, -2.0 ), EvtComplex( 3.0, 1.0 ), EvtComplex( -4.5, 0.5 ), EvtComplex( 0.2, -0.5 ) ); sp2.set( EvtComplex( 0.1, -1.0 ), EvtComplex( 1.2, -0.5 ), EvtComplex( 3.6, 1.8 ), EvtComplex( -0.2, -0.6 ) ); EvtComplex s = EvtLeptonSCurrent( sp1, sp2 ); EvtComplex p = EvtLeptonPCurrent( sp1, sp2 ); EvtVector4C a = EvtLeptonACurrent( sp1, sp2 ); EvtVector4C v = EvtLeptonVCurrent( sp1, sp2 ); EvtVector4C va = EvtLeptonVACurrent( sp1, sp2 ); EvtTensor4C t = EvtLeptonTCurrent( sp1, sp2 ); //start with boosts... EvtVector4R ranBoost( 2.0, 0.4, -0.8, 0.3 ); EvtDiracSpinor sp1Boost = boostTo( sp1, ranBoost ); EvtDiracSpinor sp2Boost = boostTo( sp2, ranBoost ); EvtComplex sBoost = EvtLeptonSCurrent( sp1Boost, sp2Boost ); EvtComplex pBoost = EvtLeptonPCurrent( sp1Boost, sp2Boost ); EvtVector4C aBoost = EvtLeptonACurrent( sp1Boost, sp2Boost ); EvtVector4C vBoost = EvtLeptonVCurrent( sp1Boost, sp2Boost ); EvtVector4C vaBoost = EvtLeptonVACurrent( sp1Boost, sp2Boost ); EvtTensor4C tBoost = EvtLeptonTCurrent( sp1Boost, sp2Boost ); EvtVector4C aDirBoost = boostTo( a, ranBoost ); EvtVector4C vDirBoost = boostTo( v, ranBoost ); EvtVector4C vaDirBoost = boostTo( va, ranBoost ); EvtTensor4C tDirBoost( t ); tDirBoost.applyBoostTo( ranBoost ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Comparing after doing a random boost" << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Scalar " << s << " " << sBoost << s - sBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "PseudoScalar " << p << " " << pBoost << p - pBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "AxialVector " << aDirBoost << " " << aBoost << aDirBoost - aBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Vector " << vDirBoost << " " << vBoost << vDirBoost - vBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "V-A " << vaDirBoost << " " << vaBoost << vaDirBoost - vaBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Tensor " << tDirBoost << " " << tBoost << tDirBoost - tBoost << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Done comparing after doing a random boost" << std::endl; //Now do rotations... //start with boosts... double alpha = 0.4; double beta = -0.61; double gamma = 3.0; EvtDiracSpinor sp1Rot = rotateEuler( sp1, alpha, beta, gamma ); EvtDiracSpinor sp2Rot = rotateEuler( sp2, alpha, beta, gamma ); EvtComplex sRot = EvtLeptonSCurrent( sp1Rot, sp2Rot ); EvtComplex pRot = EvtLeptonPCurrent( sp1Rot, sp2Rot ); EvtVector4C aRot = EvtLeptonACurrent( sp1Rot, sp2Rot ); EvtVector4C vRot = EvtLeptonVCurrent( sp1Rot, sp2Rot ); EvtVector4C vaRot = EvtLeptonVACurrent( sp1Rot, sp2Rot ); EvtTensor4C tRot = EvtLeptonTCurrent( sp1Rot, sp2Rot ); EvtVector4C aDirRot( a ); EvtVector4C vDirRot( v ); EvtVector4C vaDirRot( va ); EvtTensor4C tDirRot( t ); aDirRot.applyRotateEuler( alpha, beta, gamma ); vDirRot.applyRotateEuler( alpha, beta, gamma ); vaDirRot.applyRotateEuler( alpha, beta, gamma ); tDirRot.applyRotateEuler( alpha, beta, gamma ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Comparing after doing a random rotation" << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Scalar " << s << " " << sRot << s - sRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "PseudoScalar " << p << " " << pRot << p - pRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "AxialVector " << aDirRot << " " << aRot << aDirRot - aRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Vector " << vDirRot << " " << vRot << vDirRot - vRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "V-A " << vaDirRot << " " << vaRot << vaDirRot - vaRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Tensor " << tDirRot << " " << tRot << tDirRot - tRot << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Done comparing after doing a random rotation" << std::endl; EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } int countInclusive( std::string name, EvtParticle* root_part, TH1F* mom, TH1F* mass ) { EvtParticle* p = root_part; int temp = 0; EvtId searchFor = EvtPDL::getId( name ); do { EvtId type = p->getId(); if ( type == searchFor ) { temp += 1; if ( mom ) mom->Fill( p->getP4Lab().d3mag() ); if ( mass ) mass->Fill( p->mass() ); //if ( theBs.contains(p->getParent()->getId()) ) { //dirPsimom->Fill(p->getP4Lab().d3mag()); //} //EvtGenReport(EVTGEN_INFO,"EvtGen") << "LANGE " << p->getP4Lab().d3mag() << " " << p->getP4Lab().get(3)/p->getP4Lab().d3mag() << std::endl; } p = p->nextIter( root_part ); } while ( p != nullptr ); return temp; } int countInclusiveSubTree( std::string name, EvtParticle* root_part, EvtIdSet setIds, TH1F* /*mom*/ ) { int temp = 0; EvtParticle* p = root_part; do { if ( setIds.contains( p->getId() ) ) { temp += countInclusive( name, p ); } //p->printTree(); p = p->nextIter( root_part ); } while ( p != nullptr ); //EvtGenReport(EVTGEN_INFO,"EvtGen") << "done"<getId(); if ( type == searchFor ) { if ( p->getParent() ) { if ( setIds.contains( p->getParent()->getId() ) ) { temp += 1; if ( mom ) mom->Fill( p->getP4Lab().d3mag() ); } } } p = p->nextIter( root_part ); } while ( p != nullptr ); return temp; } void runBMix( int nevent, EvtGen& myGenerator, std::string userFile, std::string rootFile ) { TFile* file = new TFile( rootFile.c_str(), "RECREATE" ); TH1F* b0_b0 = new TH1F( "h1", "dt B0-B0", 100, -15.0, 15.0 ); TH1F* b0b_b0b = new TH1F( "h2", "dt B0B-B0B", 100, -15.0, 15.0 ); TH1F* b0b_b0 = new TH1F( "h3", "dt B0B-B0", 100, -15.0, 15.0 ); TH1F* b0_b0b = new TH1F( "h4", "dt B0-B0B", 100, -15.0, 15.0 ); int count = 1; myGenerator.readUDecay( userFile.c_str() ); EvtId b0 = EvtPDL::getId( "B0" ); EvtId b0b = EvtPDL::getId( "anti-B0" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); std::ofstream outmix; TString outFileName( rootFile.c_str() ); outFileName.ReplaceAll( ".root", ".dat" ); outmix.open( outFileName.Data() ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtId id1 = root_part->getDaug( 0 )->getId(); EvtId id2 = root_part->getDaug( 1 )->getId(); double t1 = root_part->getDaug( 0 )->getLifetime(); double t2 = root_part->getDaug( 1 )->getLifetime(); double dt = ( t1 - t2 ) / ( 1e-12 * 3e11 ); if ( id1 == b0 && id2 == b0 ) { b0_b0->Fill( dt ); outmix << dt << " 1" << std::endl; } if ( id1 == b0b && id2 == b0b ) { b0b_b0b->Fill( dt ); outmix << dt << " 2" << std::endl; } if ( id1 == b0b && id2 == b0 ) { b0b_b0->Fill( dt ); outmix << dt << " 0" << std::endl; } if ( id1 == b0 && id2 == b0b ) { b0_b0b->Fill( dt ); outmix << dt << " 0" << std::endl; } root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runDDalitz( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "ddalitz.root", "RECREATE" ); TH2F* dalitz = new TH2F( "h1", "m^2!?[K-[p]+! vs m^2!?[K-[p]0!", 70, 0.0, 3.5, 70, 0.0, 3.5 ); TH2F* dalitz2 = new TH2F( "h5", "m^2!([p]^-![p]^0!) vs m^2!([K-[p]+!", 100, 0.0, 3.5, 100, 0.0, 2.0 ); TH1F* m12 = new TH1F( "h2", "m?[K-[p]+!", 100, 0.0, 3.0 ); TH1F* m13 = new TH1F( "h3", "m?[K-[p]0!", 100, 0.0, 3.0 ); TH1F* m23 = new TH1F( "h4", "m?[[p]+[p]0!", 100, 0.0, 2.0 ); int count; myGenerator.readUDecay( "exampleFiles/DDALITZ.DEC" ); count = 1; static EvtId D0 = EvtPDL::getId( std::string( "D0" ) ); std::ofstream outmix; outmix.open( "ddalitz.dat" ); do { EvtVector4R p_init( EvtPDL::getMass( D0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( D0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R p1 = root_part->getDaug( 0 )->getP4Lab(); EvtVector4R p2 = root_part->getDaug( 1 )->getP4Lab(); EvtVector4R p3 = root_part->getDaug( 2 )->getP4Lab(); dalitz->Fill( ( p1 + p2 ).mass2(), ( p1 + p3 ).mass2(), 1.0 ); dalitz2->Fill( ( p1 + p2 ).mass2(), ( p2 + p3 ).mass2(), 1.0 ); m12->Fill( ( p1 + p2 ).mass2() ); m13->Fill( ( p1 + p3 ).mass2() ); m23->Fill( ( p2 + p3 ).mass2() ); outmix << ( p1 + p2 ).mass2() << " " << ( p2 + p3 ).mass2() << " " << ( p1 + p3 ).mass2() << std::endl; root_part->deleteTree(); if ( count == nevent - 1 ) { std::ofstream testi( "testi.dat" ); double val = m12->GetMean(); double errval = m12->GetMeanError(); testi << "evtgenlhc_test1 1 " << val << " " << errval << std::endl; val = m23->GetMean(); errval = m23->GetMeanError(); testi << "evtgenlhc_test1 2 " << val << " " << errval << std::endl; } } while ( count++ < nevent ); file->Write(); file->Close(); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPiPiPi( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "pipipi.dat" ); int count; EvtVector4R p4pip, p4pim, p4pi0; myGenerator.readUDecay( "exampleFiles/PIPIPI.DEC" ); count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p4pip = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); p4pim = root_part->getDaug( 0 )->getDaug( 1 )->getP4Lab(); p4pi0 = root_part->getDaug( 0 )->getDaug( 2 )->getP4Lab(); outmix << root_part->getDaug( 0 )->getLifetime() << " " << root_part->getDaug( 1 )->getLifetime() << " "; outmix << ( p4pip + p4pim ).mass2() << " " << ( p4pip + p4pi0 ).mass2() << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runSingleB( int nevent, EvtGen& myGenerator ) { int count; static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); count = 1; do { EvtVector4R p_init( EvtPDL::getMass( B0 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B0, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); root_part->deleteTree(); } while ( count++ < nevent ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPiPiPiPi( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "pipipipi.dat" ); int count; EvtVector4R p4pi1, p4pi2, p4pi3, p4pi4; myGenerator.readUDecay( "exampleFiles/PIPIPIPI.DEC" ); count = 1; EvtParticle *bcp, *btag; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } p4pi1 = bcp->getDaug( 0 )->getP4Lab(); p4pi2 = bcp->getDaug( 1 )->getP4Lab(); p4pi3 = bcp->getDaug( 2 )->getP4Lab(); p4pi4 = bcp->getDaug( 3 )->getP4Lab(); EvtVector4R p4bcp, p4rho0, p4a2; p4rho0 = p4pi1 + p4pi2; p4a2 = p4rho0 + p4pi3; p4bcp = p4a2 + p4pi4; outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << tag.getId() << " " << ( p4pi1 + p4pi2 + p4pi3 ).mass() << " " << ( p4pi1 + p4pi2 ).mass() << " " << EvtDecayAngle( p4bcp, p4rho0 + p4pi3, p4rho0 ) << " " << EvtDecayAngle( p4a2, p4pi1 + p4pi2, p4pi1 ) << std::endl; root_part->deleteTree(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "count:" << count << std::endl; } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runA2Pi( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "a2pi.dat" ); int count; myGenerator.readUDecay( "exampleFiles/A2PI.DEC" ); EvtParticle *bcp, *btag; EvtParticle *a2, *rho0, *pi1, *pi2, *pi3, *pi4; EvtVector4R p4bcp, p4a2, p4rho0, p4pi1, p4pi2, p4pi3, p4pi4; count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } a2 = bcp->getDaug( 0 ); pi1 = bcp->getDaug( 1 ); rho0 = a2->getDaug( 0 ); pi2 = a2->getDaug( 1 ); pi3 = rho0->getDaug( 0 ); pi4 = rho0->getDaug( 1 ); p4bcp = bcp->getP4Lab(); p4a2 = a2->getP4Lab(); p4pi1 = pi1->getP4Lab(); p4rho0 = rho0->getP4Lab(); p4pi2 = pi2->getP4Lab(); p4pi3 = pi3->getP4Lab(); p4pi4 = pi4->getP4Lab(); EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << EvtDecayAngle( p4bcp, p4rho0 + p4pi2, p4rho0 ) << " " << EvtDecayAngle( p4a2, p4pi3 + p4pi4, p4pi3 ) << " " << EvtPDL::getStdHep( tag ) << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runHelAmp( int nevent, EvtGen& myGenerator, std::string userFile, std::string rootFile ) { TFile* file = new TFile( rootFile.c_str(), "RECREATE" ); TH1F* costheta = new TH1F( "h1", "costheta", 100, -1.0, 1.0 ); TH1F* costheta2 = new TH1F( "h2", "costheta2", 100, -1.0, 1.0 ); int count; myGenerator.readUDecay( userFile.c_str() ); count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R d14 = root_part->getDaug( 0 )->getP4Lab(); double c = d14.get( 3 ) / d14.d3mag(); costheta->Fill( c ); EvtVector4R p = root_part->getP4Lab(); EvtVector4R q = root_part->getDaug( 0 )->getP4Lab(); EvtVector4R d = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); costheta2->Fill( EvtDecayAngle( p, q, d ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runHelAmp2( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "helamp2.root", "RECREATE" ); TH1F* costheta = new TH1F( "h1", "costheta", 100, -1.0, 1.0 ); int count; myGenerator.readUDecay( "exampleFiles/HELAMP2.DEC" ); count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtVector4R p = root_part->getDaug( 0 )->getDaug( 0 )->getP4Lab(); EvtVector4R q = root_part->getDaug( 0 )->getDaug( 0 )->getDaug( 0 )->getP4Lab(); EvtVector4R d = root_part->getDaug( 0 ) ->getDaug( 0 ) ->getDaug( 0 ) ->getDaug( 0 ) ->getP4Lab(); costheta->Fill( EvtDecayAngle( p, q, d ) ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runD2Pi( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "d2pi.root", "RECREATE" ); TH1F* cospi = new TH1F( "h1", "cos[Q]?[p]!", 50, -1.0, 1.0 ); TH1F* ptpi = new TH1F( "h2", "Pt of pion", 50, 0.0, 1.5 ); TH1F* ppi = new TH1F( "h3", "P?[p]! in [Y](4S) rest frame", 50, 0.0, 1.5 ); int count; myGenerator.readUDecay( "exampleFiles/D2PI.DEC" ); EvtParticle* b; EvtParticle *d2, *pi; EvtVector4R p4b, p4d2, p4pi; count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); b = root_part->getDaug( 0 ); d2 = b->getDaug( 0 ); pi = d2->getDaug( 1 ); p4b = b->getP4Lab(); p4d2 = d2->getP4Lab(); p4pi = pi->getP4Lab(); cospi->Fill( EvtDecayAngle( p4b, p4d2, p4pi ) ); ptpi->Fill( sqrt( p4pi.get( 2 ) * p4pi.get( 2 ) + p4pi.get( 3 ) * p4pi.get( 3 ) ) ); ppi->Fill( p4pi.d3mag() ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPiPiCPT( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "pipicpt.dat" ); int count; myGenerator.readUDecay( "exampleFiles/PIPICPT.DEC" ); EvtParticle *bcp, *btag; count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << tag.getId() << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runJpsiKs( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "jpsiks.dat" ); int count; myGenerator.readUDecay( "exampleFiles/JPSIKS.DEC" ); EvtParticle *bcp, *btag; count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId B0 = EvtPDL::getId( std::string( "B0" ) ); static EvtId B0B = EvtPDL::getId( std::string( "anti-B0" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); if ( root_part->getDaug( 0 )->getNDaug() == 3 ) { btag = root_part->getDaug( 0 ); bcp = root_part->getDaug( 1 ); } else { bcp = root_part->getDaug( 0 ); btag = root_part->getDaug( 1 ); } EvtId tag; //cp tag if ( btag->getId() == B0B ) { tag = B0; } else { tag = B0B; } outmix << bcp->getLifetime() << " " << btag->getLifetime() << " " << tag.getId() << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runDump( int nevent, EvtGen& myGenerator ) { int count; std::ofstream outmix; outmix.open( "dump.dat" ); EvtParticle* p; myGenerator.readUDecay( "exampleFiles/DUMP.DEC" ); count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId PIP = EvtPDL::getId( std::string( "pi+" ) ); static EvtId PIM = EvtPDL::getId( std::string( "pi-" ) ); static EvtId EP = EvtPDL::getId( std::string( "e+" ) ); static EvtId KP = EvtPDL::getId( std::string( "K+" ) ); static EvtId MUP = EvtPDL::getId( std::string( "mu+" ) ); static EvtId EM = EvtPDL::getId( std::string( "e-" ) ); static EvtId KM = EvtPDL::getId( std::string( "K-" ) ); static EvtId MUM = EvtPDL::getId( std::string( "mu-" ) ); static EvtId GAMM = EvtPDL::getId( std::string( "gamma" ) ); static EvtId K0L = EvtPDL::getId( std::string( "K_L0" ) ); do { if ( count == 100 * ( count / 100 ) ) { EvtGenReport( EVTGEN_INFO, "EvtGen" ) << count << std::endl; } EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p = root_part; EvtParticle* otherb = root_part->getDaug( 1 ); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "Event:" << count << std::endl; root_part->printTree(); outmix << "B" << " " << otherb->getP4Lab().get( 0 ) << " " << otherb->getP4Lab().get( 1 ) << " " << otherb->getP4Lab().get( 2 ) << " " << otherb->getP4Lab().get( 3 ) << std::endl; do { if ( p->getId() == PIP || p->getId() == EP || p->getId() == KP || p->getId() == MUP ) { outmix << "chg +1" << " " << p->getP4Lab().get( 1 ) << " " << p->getP4Lab().get( 2 ) << " " << p->getP4Lab().get( 3 ) << std::endl; } if ( p->getId() == PIM || p->getId() == EM || p->getId() == KM || p->getId() == MUM ) { outmix << "chg -1" << " " << p->getP4Lab().get( 1 ) << " " << p->getP4Lab().get( 2 ) << " " << p->getP4Lab().get( 3 ) << std::endl; } if ( p->getId() == GAMM || p->getId() == K0L ) { outmix << "neu" << " " << p->getP4Lab().get( 1 ) << " " << p->getP4Lab().get( 2 ) << " " << p->getP4Lab().get( 3 ) << std::endl; } p = p->nextIter(); } while ( p != nullptr ); outmix << "event" << std::endl; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runGenericCont( int nevent, EvtGen& myGenerator ) { int count; std::ofstream outmix; outmix.open( "genericcont.dat" ); EvtParticle* p; myGenerator.readUDecay( "exampleFiles/GENERIC.DEC" ); count = 1; static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); static EvtId VPHO = EvtPDL::getId( std::string( "vpho" ) ); do { if ( count == 1000 * ( count / 1000 ) ) { EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << count << std::endl; } EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( VPHO, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); p = root_part; do { outmix << p->getId().getId() << " " << p->getP4Lab().d3mag() << std::endl; p = p->nextIter(); } while ( p != nullptr ); //root_part->printTree(); root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runD1( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "d1.dat" ); int count = 1; myGenerator.readUDecay( "exampleFiles/D1.DEC" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); EvtParticle *p_b, *p_d1, *p_e, *p_nu, *p_pi1, *p_dstar, *p_pi2, *p_d; EvtVector4R p4_b, p4_d1, p4_e, p4_nu, p4_pi1, p4_dstar, p4_pi2, p4_d; // code for analyzing B->D1 e nu ; D1 -> D* pi ; D* -> D pi p_b = root_part->getDaug( 1 ); p_d1 = p_b->getDaug( 0 ); p_e = p_b->getDaug( 1 ); p_nu = p_b->getDaug( 2 ); p_dstar = p_d1->getDaug( 0 ); p_pi1 = p_d1->getDaug( 1 ); p_d = p_dstar->getDaug( 0 ); p_pi2 = p_dstar->getDaug( 1 ); p4_b = p_b->getP4Lab(); p4_d1 = p_d1->getP4Lab(); p4_e = p_e->getP4Lab(); p4_nu = p_nu->getP4Lab(); p4_dstar = p_dstar->getP4Lab(); p4_pi1 = p_pi1->getP4Lab(); p4_pi2 = p_pi2->getP4Lab(); p4_d = p_d->getP4Lab(); outmix << p4_e.get( 0 ) << " "; outmix << ( p4_e + p4_nu ) * ( p4_e + p4_nu ) << " "; outmix << EvtDecayAngle( p4_b, p4_e + p4_nu, p4_e ) << " "; outmix << EvtDecayAngle( p4_b, p4_dstar + p4_pi1, p4_dstar ) << " "; outmix << EvtDecayAngle( p4_d1, p4_d + p4_pi2, p4_d ) << " "; outmix << EvtDecayAngleChi( p4_b, p4_e, p4_nu, p4_dstar, p4_pi1 ) << "\n"; root_part->deleteTree(); EvtGenReport( EVTGEN_DEBUG, "EvtGen" ) << "count:" << count << std::endl; } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runMix( int nevent, EvtGen& myGenerator ) { std::ofstream outmix; outmix.open( "mix.dat" ); int count = 1; myGenerator.readUDecay( "exampleFiles/MIX.DEC" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); do { EvtVector4R p_init( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( UPS4, p_init ); root_part->setVectorSpinDensity(); myGenerator.generateDecay( root_part ); outmix << root_part->getDaug( 0 )->getId().getId() << " "; outmix << root_part->getDaug( 0 )->getLifetime() << " "; outmix << root_part->getDaug( 1 )->getId().getId() << " "; outmix << root_part->getDaug( 1 )->getLifetime() << "\n"; root_part->deleteTree(); } while ( count++ < nevent ); outmix.close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runBaryonic( int nEvent, EvtGen& myGenerator ) { TFile* f = new TFile( "baryonic.root", "RECREATE" ); TH1D* q2Hist = new TH1D( "q2Hist", "q square", 50, 0.0, 25.00 ); EvtId BMINUS = EvtPDL::getId( "B-" ); EvtVector4R p_init( EvtPDL::getMass( BMINUS ), 0.0, 0.0, 0.0 ); EvtParticle* root_part; myGenerator.readUDecay( "exampleFiles/BARYONIC.DEC" ); EvtVector4R l; EvtVector4R p; EvtVector4R g; EvtVector4R sum; for ( int i = 0; i < nEvent; ++i ) { root_part = EvtParticleFactory::particleFactory( BMINUS, p_init ); root_part->setDiagonalSpinDensity(); myGenerator.generateDecay( root_part ); l = root_part->getDaug( 0 )->getP4Lab(); // lambda momentum p = root_part->getDaug( 1 )->getP4Lab(); // pBar momentum g = root_part->getDaug( 2 )->getP4Lab(); // gamma momentum sum = p + g; q2Hist->Fill( sum.mass2() ); root_part->deleteTree(); } f->Write(); f->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runPhspDecaytimeCut( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "phspdecaytimecut.root", "RECREATE" ); TH1F* thist = new TH1F( "h1", "t [ps]", 100, 0.0, 10.0 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/PhspDecaytimeCut.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B = EvtPDL::getId( std::string( "B+" ) ); std::ofstream outmix; do { EvtVector4R pinit( EvtPDL::getMass( B ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B, pinit ); myGenerator.generateDecay( root_part ); double t = root_part->getLifetime() / ( 1e-12 * EvtConst::c ); thist->Fill( t ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void run3BPhspRegion( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "3BodyPhspRegion.root", "RECREATE" ); TH1F* pxhist = new TH1F( "h1", "p_x ", 100, -3.0, 3.0 ); TH1F* pyhist = new TH1F( "h2", "p_y ", 100, -3.0, 3.0 ); TH1F* pzhist = new TH1F( "h3", "p_z ", 100, -3.0, 3.0 ); TH2F* dalitz = new TH2F( "h4", "Dalitz", 50, 12.5, 27., 50, 0.35, 4.8 ); TH2F* pxpyhist = new TH2F( "h5", "px-py", 50, -1.8, 1.8, 50, -1.8, 1.8 ); TH2F* pxpzhist = new TH2F( "h6", "px-pz", 50, -1.8, 1.8, 50, -1.8, 1.8 ); TH2F* pypzhist = new TH2F( "h7", "py-pz", 50, -1.8, 1.8, 50, -1.8, 1.8 ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/3BodyPhspRegion.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B = EvtPDL::getId( std::string( "B+" ) ); std::ofstream outmix; do { EvtVector4R pinit( EvtPDL::getMass( B ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B, pinit ); myGenerator.generateDecay( root_part ); EvtParticle* daug1 = root_part->getDaug( 0 ); EvtParticle* daug2 = root_part->getDaug( 1 ); EvtParticle* daug3 = root_part->getDaug( 2 ); pxhist->Fill( daug1->getP4().get( 1 ) ); pyhist->Fill( daug1->getP4().get( 2 ) ); pzhist->Fill( daug1->getP4().get( 3 ) ); pxpyhist->Fill( daug1->getP4().get( 1 ), daug1->getP4().get( 2 ) ); pxpzhist->Fill( daug1->getP4().get( 1 ), daug1->getP4().get( 3 ) ); pypzhist->Fill( daug1->getP4().get( 2 ), daug1->getP4().get( 3 ) ); double m12 = ( daug1->getP4() + daug2->getP4() ).mass(); double m23 = ( daug2->getP4() + daug3->getP4() ).mass(); dalitz->Fill( m12 * m12, m23 * m23 ); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } void runFourBody( int nevent, EvtGen& myGenerator ) { TFile* file = new TFile( "fourBody.root", "RECREATE" ); double m12, m13, m14, m23, m24, m34, m123, m124, m234; double mB, m1, m2, m3, m4; double pBe, pBx, pBy, pBz; double p1e, p1x, p1y, p1z; double p2e, p2x, p2y, p2z; double p3e, p3x, p3y, p3z; double p4e, p4x, p4y, p4z; double theta1, theta3, chi; TTree* tree = new TTree( "tree", "" ); tree->Branch( "m12", &m12, "m12/D" ); tree->Branch( "m13", &m13, "m13/D" ); tree->Branch( "m14", &m14, "m14/D" ); tree->Branch( "m23", &m23, "m23/D" ); tree->Branch( "m24", &m24, "m24/D" ); tree->Branch( "m34", &m34, "m34/D" ); tree->Branch( "m123", &m123, "m123/D" ); tree->Branch( "m124", &m124, "m124/D" ); tree->Branch( "m234", &m234, "m234/D" ); tree->Branch( "mB", &mB, "mB/D" ); tree->Branch( "m1", &m1, "m1/D" ); tree->Branch( "m2", &m2, "m2/D" ); tree->Branch( "m3", &m3, "m3/D" ); tree->Branch( "m4", &m4, "m4/D" ); tree->Branch( "pBe", &pBe, "pBe/D" ); tree->Branch( "pBx", &pBx, "pBx/D" ); tree->Branch( "pBy", &pBy, "pBy/D" ); tree->Branch( "pBz", &pBz, "pBz/D" ); tree->Branch( "p1e", &p1e, "p1e/D" ); tree->Branch( "p1x", &p1x, "p1x/D" ); tree->Branch( "p1y", &p1y, "p1y/D" ); tree->Branch( "p1z", &p1z, "p1z/D" ); tree->Branch( "p2e", &p2e, "p2e/D" ); tree->Branch( "p2x", &p2x, "p2x/D" ); tree->Branch( "p2y", &p2y, "p2y/D" ); tree->Branch( "p2z", &p2z, "p2z/D" ); tree->Branch( "p3e", &p3e, "p3e/D" ); tree->Branch( "p3x", &p3x, "p3x/D" ); tree->Branch( "p3y", &p3y, "p3y/D" ); tree->Branch( "p3z", &p3z, "p3z/D" ); tree->Branch( "p4e", &p4e, "p4e/D" ); tree->Branch( "p4x", &p4x, "p4x/D" ); tree->Branch( "p4y", &p4y, "p4y/D" ); tree->Branch( "p4z", &p4z, "p4z/D" ); tree->Branch( "theta1", &theta1, "theta1/D" ); tree->Branch( "theta3", &theta3, "theta3/D" ); tree->Branch( "chi", &chi, "chi/D" ); int count = 1; char udecay_name[100]; strcpy( udecay_name, "exampleFiles/4BodyPhsp.DEC" ); myGenerator.readUDecay( udecay_name ); static EvtId B = EvtPDL::getId( std::string( "B+" ) ); do { EvtVector4R pinit( EvtPDL::getMass( B ), 0.0, 0.0, 0.0 ); EvtParticle* root_part = EvtParticleFactory::particleFactory( B, pinit ); myGenerator.generateDecay( root_part ); mB = root_part->mass(); m1 = root_part->getDaug( 0 )->mass(); m2 = root_part->getDaug( 1 )->mass(); m3 = root_part->getDaug( 2 )->mass(); m4 = root_part->getDaug( 3 )->mass(); EvtParticle* daug1 = root_part->getDaug( 0 ); EvtParticle* daug2 = root_part->getDaug( 1 ); EvtParticle* daug3 = root_part->getDaug( 2 ); EvtParticle* daug4 = root_part->getDaug( 3 ); m12 = ( daug1->getP4() + daug2->getP4() ).mass(); m13 = ( daug1->getP4() + daug3->getP4() ).mass(); m14 = ( daug1->getP4() + daug4->getP4() ).mass(); m23 = ( daug2->getP4() + daug3->getP4() ).mass(); m24 = ( daug2->getP4() + daug4->getP4() ).mass(); m34 = ( daug3->getP4() + daug4->getP4() ).mass(); m123 = ( daug1->getP4() + daug2->getP4() + daug3->getP4() ).mass(); m124 = ( daug1->getP4() + daug2->getP4() + daug4->getP4() ).mass(); m234 = ( daug2->getP4() + daug3->getP4() + daug4->getP4() ).mass(); pBe = root_part->getP4().get( 0 ); pBx = root_part->getP4().get( 1 ); pBy = root_part->getP4().get( 2 ); pBz = root_part->getP4().get( 3 ); p1e = daug1->getP4().get( 0 ); p1x = daug1->getP4().get( 1 ); p1y = daug1->getP4().get( 2 ); p1z = daug1->getP4().get( 3 ); p2e = daug2->getP4().get( 0 ); p2x = daug2->getP4().get( 1 ); p2y = daug2->getP4().get( 2 ); p2z = daug2->getP4().get( 3 ); p3e = daug3->getP4().get( 0 ); p3x = daug3->getP4().get( 1 ); p3y = daug3->getP4().get( 2 ); p3z = daug3->getP4().get( 3 ); p4e = daug4->getP4().get( 0 ); p4x = daug4->getP4().get( 1 ); p4y = daug4->getP4().get( 2 ); p4z = daug4->getP4().get( 3 ); theta1 = EvtDecayAngle( root_part->getP4(), daug1->getP4() + daug2->getP4(), daug1->getP4() ); theta3 = EvtDecayAngle( root_part->getP4(), daug3->getP4() + daug4->getP4(), daug3->getP4() ); chi = EvtDecayAngleChi( root_part->getP4(), daug1->getP4(), daug2->getP4(), daug3->getP4(), daug4->getP4() ); tree->Fill(); root_part->deleteTree(); } while ( count++ < nevent ); file->Write(); file->Close(); EvtGenReport( EVTGEN_INFO, "EvtGen" ) << "SUCCESS\n"; } diff --git a/test/example1.cc b/test/example1.cc index e45e634..97433e0 100644 --- a/test/example1.cc +++ b/test/example1.cc @@ -1,113 +1,107 @@ /*********************************************************************** * 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 . * ***********************************************************************/ // // Sample test program for running EvtGen // #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtHepMCEvent.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include #include #include int main( int /*argc*/, char** /*argv*/ ) { EvtParticle* parent( nullptr ); // Define the random number generator - EvtRandomEngine* eng = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - eng = new EvtMTRandomEngine(); -#else - eng = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* eng = new EvtMTRandomEngine(); EvtRandom::setRandomEngine( eng ); 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 //Initialize the generator - read in the decay table and particle properties EvtGen myGenerator( "../DECAY.DEC", "../evt.pdl", eng, radCorrEngine, &extraModels ); //If I wanted a user decay file, I would read it in now. //myGenerator.readUDecay("../user.dec"); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int nEvents( 100 ); // Loop to create nEvents, starting from an Upsilon(4S) int i; for ( i = 0; i < nEvents; i++ ) { std::cout << "Event number " << i << std::endl; // Set up the parent particle EvtVector4R pInit( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); parent = EvtParticleFactory::particleFactory( UPS4, pInit ); parent->setVectorSpinDensity(); // Generate the event myGenerator.generateDecay( parent ); // Write out the results EvtHepMCEvent theEvent; theEvent.constructEvent( parent ); GenEvent* genEvent = theEvent.getEvent(); #ifdef EVTGEN_HEPMC3 HepMC3::Print::line( *genEvent ); #else genEvent->print( std::cout ); #endif parent->deleteTree(); } delete eng; return 0; } diff --git a/test/exampleWriteHepMC.cc b/test/exampleWriteHepMC.cc index d98aa78..f7e175a 100644 --- a/test/exampleWriteHepMC.cc +++ b/test/exampleWriteHepMC.cc @@ -1,154 +1,148 @@ /*********************************************************************** * 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 . * ***********************************************************************/ // // Sample test program for running EvtGen // #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtHepMCEvent.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtReport.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include #include #include #include #ifdef EVTGEN_HEPMC3 #include typedef HepMC3::WriterAsciiHepMC2 output_writer; #else class output_writer : public std::ofstream { public: output_writer( const char* a ) : std::ofstream( a ) {} bool write_event( HepMC::GenEvent& e ) { ( *this ) << e; return true; } }; #endif bool filter( GenEvent* event ) { bool hasLepton = false; bool hasCharm = false; #ifdef EVTGEN_HEPMC3 for ( auto p : event->particles() ) { #else for ( HepMC::GenEvent::particle_iterator it = event->particles_begin(); it != event->particles_end(); ++it ) { GenParticlePtr p = *it; #endif if ( abs( p->pdg_id() ) == 11 || abs( p->pdg_id() ) == 13 ) { hasLepton = true; } int id = abs( p->pdg_id() ); if ( id > 400 && id < 500 ) { hasCharm = true; } } return ( hasLepton && ( !hasCharm ) ); } int main( int /*argc*/, char** /*argv*/ ) { EvtParticle* parent( nullptr ); // Define the random number generator - EvtRandomEngine* eng = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - eng = new EvtMTRandomEngine(); -#else - eng = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* eng = new EvtMTRandomEngine(); EvtRandom::setRandomEngine( eng ); 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 //Initialize the generator - read in the decay table and particle properties EvtGen myGenerator( "../DECAY.DEC", "../evt.pdl", eng, radCorrEngine, &extraModels ); //If I wanted a user decay file, I would read it in now. myGenerator.readUDecay( "exampleFiles/Btousemileptonic.dec" ); static EvtId UPS4 = EvtPDL::getId( std::string( "Upsilon(4S)" ) ); int nEvents( 40000 ); output_writer hepmcFile( "hepMCtest" ); // Loop to create nEvents, starting from an Upsilon(4S) int i; for ( i = 0; i < nEvents; i++ ) { std::cout << "Event number " << i << std::endl; // Set up the parent particle EvtVector4R pInit( EvtPDL::getMass( UPS4 ), 0.0, 0.0, 0.0 ); parent = EvtParticleFactory::particleFactory( UPS4, pInit ); parent->setVectorSpinDensity(); // Generate the event myGenerator.generateDecay( parent ); // Write out the results EvtHepMCEvent theEvent; theEvent.constructEvent( parent ); GenEvent* genEvent = theEvent.getEvent(); if ( filter( genEvent ) ) hepmcFile.write_event( *genEvent ); parent->deleteTree(); } hepmcFile.close(); delete eng; return 0; } diff --git a/validation/genExampleRootFiles.cc b/validation/genExampleRootFiles.cc index 5b0c8a7..04f164b 100644 --- a/validation/genExampleRootFiles.cc +++ b/validation/genExampleRootFiles.cc @@ -1,291 +1,285 @@ /*********************************************************************** * 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 . * ***********************************************************************/ // Program to create ROOT files for EvtGen validation plots. // This looks at the 1st generation daughters and stores 4-momenta // info into a ROOT file for further analysis. // Useful for Pythia, Photos and Tauola decay tests. #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include "EvtGenBase/EvtHepMCEvent.hh" #include "TFile.h" #include "TTree.h" #include #include #include using std::cout; using std::endl; int main( int argc, char** argv ) { std::string decayFileName( "../DECAY.DEC" ); if ( argc > 1 ) { decayFileName = argv[1]; } cout << "Decay file name is " << decayFileName << endl; std::string rootFileName( "evtgenTest.root" ); if ( argc > 2 ) { rootFileName = argv[2]; } cout << "Root file name is " << rootFileName << endl; std::string parentName( "Upsilon(4S)" ); if ( argc > 3 ) { parentName = argv[3]; } cout << "Parent name is " << parentName << endl; int nEvents( 10 ); if ( argc > 4 ) { nEvents = atoi( argv[4] ); } bool useXml = false; if ( argc > 5 ) { useXml = ( atoi( argv[5] ) == 1 ); } bool useEvtGenRandom = true; if ( argc > 6 ) { useEvtGenRandom = ( atoi( argv[6] ) == 1 ); } cout << "Number of events is " << nEvents << endl; TFile* theFile = new TFile( rootFileName.c_str(), "recreate" ); TTree* theTree = new TTree( "Data", "Data" ); TTree* nDaugTree = new TTree( "nDaugTree", "nDaugTree" ); TTree* dalitzTree = new TTree( "dalitzTree", "dalitzTree" ); theTree->SetDirectory( theFile ); nDaugTree->SetDirectory( theFile ); dalitzTree->SetDirectory( theFile ); int event( 0 ), nDaug( 0 ), daugId( 0 ); double E( 0.0 ), p( 0.0 ), px( 0.0 ), py( 0.0 ), pz( 0.0 ); double t( 0.0 ), x( 0.0 ), y( 0.0 ), z( 0.0 ); double mass( 0.0 ), lifetime( 0.0 ); double inv12( 0.0 ), inv13( 0.0 ), inv23( 0.0 ); double inv12Sq( 0.0 ), inv13Sq( 0.0 ), inv23Sq( 0.0 ); theTree->Branch( "event", &event, "event/I" ); theTree->Branch( "nDaug", &nDaug, "nDaug/I" ); theTree->Branch( "id", &daugId, "id/I" ); theTree->Branch( "E", &E, "E/D" ); theTree->Branch( "p", &p, "p/D" ); theTree->Branch( "px", &px, "px/D" ); theTree->Branch( "py", &py, "py/D" ); theTree->Branch( "pz", &pz, "pz/D" ); theTree->Branch( "t", &t, "t/D" ); theTree->Branch( "x", &x, "x/D" ); theTree->Branch( "y", &y, "x/D" ); theTree->Branch( "z", &z, "x/D" ); theTree->Branch( "mass", &mass, "mass/D" ); theTree->Branch( "lifetime", &lifetime, "lifetime/D" ); nDaugTree->Branch( "event", &event, "event/I" ); nDaugTree->Branch( "nDaug", &nDaug, "nDaug/I" ); dalitzTree->Branch( "invMass12", &inv12, "invMass12/D" ); dalitzTree->Branch( "invMass13", &inv13, "invMass13/D" ); dalitzTree->Branch( "invMass23", &inv23, "invMass23/D" ); dalitzTree->Branch( "invMass12Sq", &inv12Sq, "invMass12Sq/D" ); dalitzTree->Branch( "invMass13Sq", &inv13Sq, "invMass13Sq/D" ); dalitzTree->Branch( "invMass23Sq", &inv23Sq, "invMass23Sq/D" ); EvtParticle* baseParticle( nullptr ); EvtParticle* theParent( nullptr ); // Define the random number generator - EvtRandomEngine* myRandomEngine = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - myRandomEngine = new EvtMTRandomEngine(); -#else - myRandomEngine = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* myRandomEngine = new EvtMTRandomEngine(); // Initialize the generator - read in the decay table and particle properties. // For our validation purposes, we just want to read in one decay file and create // plots from that. EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; #ifdef EVTGEN_EXTERNAL bool convertPythiaCodes( false ); EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom ); radCorrEngine = genList.getPhotosModel(); extraModels = genList.getListOfModels(); #endif int mixingType( 1 ); EvtGen myGenerator( decayFileName.c_str(), "../evt.pdl", myRandomEngine, radCorrEngine, &extraModels, mixingType, useXml ); // If I wanted a user decay file, I would read it in now, e.g: // myGenerator.readUDecay(otherFileName); EvtId theId = EvtPDL::getId( parentName ); if ( theId.getId() == -1 && theId.getAlias() == -1 ) { cout << "Error. Could not find valid EvtId for " << parentName << endl; return -1; } static EvtId stringId = EvtPDL::getId( std::string( "string" ) ); // Loop to create nEvents int i; for ( i = 0; i < nEvents; i++ ) { if ( i % 1000 == 0 ) { cout << "Event number = " << i + 1 << " out of " << nEvents << std::endl; } // Set up the parent particle EvtVector4R pInit( EvtPDL::getMass( theId ), 0.0, 0.0, 0.0 ); baseParticle = EvtParticleFactory::particleFactory( theId, pInit ); if ( baseParticle->getSpinStates() == 3 ) { baseParticle->setVectorSpinDensity(); } // Generate the event myGenerator.generateDecay( baseParticle ); // Alternative way to generate decays and print out information: // int PDGId = EvtPDL::getStdHep(theId); // EvtVector4R origin(0.0, 0.0, 0.0, 0.0); // EvtHepMCEvent* theEvent = myGenerator.generateDecay(PDGId, pInit, origin); // HepMC::GenEvent* hepMCEvent = theEvent->getEvent(); // hepMCEvent->print(); // Extract other info from the HepMC event. Then delete it: // delete theEvent; // Now get the particle decay information, looping through daughter tracks (1st generation only) // Find out if the first daughter is a string. // If so, set this as the new parent particle. EvtId daugEvtId( -1, -1 ); EvtParticle* baseDaughter = baseParticle->getDaug( 0 ); if ( baseDaughter != nullptr ) { daugEvtId = baseDaughter->getId(); } if ( daugEvtId == stringId ) { theParent = baseDaughter; } else { theParent = baseParticle; } nDaug = theParent->getNDaug(); int iDaug( 0 ); nDaugTree->Fill(); //theParent->printTree(); // Loop over the daughter tracks for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* daug = theParent->getDaug( iDaug ); if ( daug != nullptr ) { EvtVector4R p4Lab = daug->getP4Lab(); EvtVector4R pos4 = daug->get4Pos(); // PDG id daugId = EvtPDL::getStdHep( daug->getId() ); // 4-momenta E = p4Lab.get( 0 ); px = p4Lab.get( 1 ); py = p4Lab.get( 2 ); pz = p4Lab.get( 3 ); p = sqrt( px * px + py * py + pz * pz ); // 4-position t = pos4.get( 0 ); x = pos4.get( 1 ); y = pos4.get( 2 ); z = pos4.get( 3 ); mass = daug->mass(); lifetime = daug->getLifetime(); theTree->Fill(); } // Daughter exists } // Number of daughters if ( nDaug == 3 ) { EvtVector4R p4_d1 = theParent->getDaug( 0 )->getP4Lab(); EvtVector4R p4_d2 = theParent->getDaug( 1 )->getP4Lab(); EvtVector4R p4_d3 = theParent->getDaug( 2 )->getP4Lab(); inv12Sq = ( p4_d1 + p4_d2 ) * ( p4_d1 + p4_d2 ); inv13Sq = ( p4_d1 + p4_d3 ) * ( p4_d1 + p4_d3 ); inv23Sq = ( p4_d2 + p4_d3 ) * ( p4_d2 + p4_d3 ); inv12 = sqrt( inv12Sq ); inv13 = sqrt( inv13Sq ); inv23 = sqrt( inv23Sq ); dalitzTree->Fill(); } // Cleanup baseParticle->deleteTree(); } // Write out the TTree information to the ROOT file theFile->cd(); theTree->Write(); nDaugTree->Write(); dalitzTree->Write(); theFile->Close(); cout << "Done." << endl; delete myRandomEngine; return 0; } diff --git a/validation/genRootDecayChain.cc b/validation/genRootDecayChain.cc index 4e6e88a..c05050a 100644 --- a/validation/genRootDecayChain.cc +++ b/validation/genRootDecayChain.cc @@ -1,406 +1,401 @@ /*********************************************************************** * 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 . * ***********************************************************************/ // Program to create ROOT files for EvtGen validation plots, // generalising storage of daughter information for each decay chain step. // There are three integers to keep track of the decay tree history: // dVtx = present decay vertex integer number // pVtx = parent decay vertex integer number // daug = daughter order number for the given particle // // Consider the following decay chain history, where Vj is vertex number j: // V1 // A -> B + C <---- First chain level // | | // +--> B1 + B2 +--> C1 C2 C3 <---- Second chain level // V2 | V5 | // +--> B1a B1b +--> C1a C1b C1c <---- Third chain level // V3 | V6 // +--> d1 d2 <---- Fourth chain level // V4 // // Since the decay tree is stored recursively, the information order follows // the immediate, sequential, sub-decay vertex order V1, V2, V3, V4, V5, V6: // A, B, B1, B1a, B1b, d1, d2, B2, C, C1, C1a, C1b, C1c, C2, C3 // // The unique set of integer "attributes" for each particle is as follows: // // Particle dVtx pVtx daug // A 0 0 0 The mother particle // B 1 0 1 // B1 2 1 1 // B1a 3 2 1 // B1b 3 2 2 // d1 4 3 1 // d2 4 3 2 // B2 2 1 2 // C 1 0 2 // C1 5 1 1 // C1a 6 5 1 // C1b 6 5 2 // C1c 6 5 3 // C2 5 1 2 // C3 5 1 3 // // The decay tree will be defined by the decay file. Additional photons from FSR will // only appear as appended, extra daughters on the RHS of a given vertex, e.g. if an FSR // photon is added to the RHS of V4, there will be a "d3" particle with attributes (4,3,3) #include "genRootDecayChain.hh" #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandomEngine.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include "TROOT.h" #include "TStyle.h" #include #include #include using std::cout; using std::endl; using std::string; genRootDecayChain::genRootDecayChain( const string& decayFileName, const string& rootFileName, const string& parentName, int nEvents, bool storeMtmXYZ ) : _decayFileName( decayFileName ), _rootFileName( rootFileName ), _parentName( parentName ), _nEvents( nEvents ), _storeMtmXYZ( storeMtmXYZ ), _theFile( nullptr ), _theTree( nullptr ), _probHist( nullptr ), _theCanvas( nullptr ) { _theFile = new TFile( rootFileName.c_str(), "recreate" ); _theTree = new TTree( "Data", "Data" ); _theTree->SetDirectory( _theFile ); _probHist = new TH1D( "probHist", "probHist", 100, 0.0, 0.0 ); _probHist->SetXTitle( "Prob/MaxProb" ); _probHist->SetDirectory( _theFile ); gROOT->SetStyle( "Plain" ); gStyle->SetOptStat( 0 ); _theCanvas = new TCanvas( "theCanvas", "", 900, 700 ); _theCanvas->Clear(); _theCanvas->UseCurrentStyle(); } genRootDecayChain::~genRootDecayChain() { _theFile->Close(); delete _theCanvas; } void genRootDecayChain::run() { this->initTree(); this->generateEvents(); this->writeTree(); } void genRootDecayChain::initTree() { // Initialise internal variables _eventId = 0; _PDGId = 0; _dVtx = 0, _pVtx = 0, _daug = 0; _px = 0.0, _py = 0.0, _pz = 0.0; _p = 0.0, _E = 0.0, _m = 0.0, _t = 0.0; // Set-up the TTree _theTree->Branch( "eventId", &_eventId, "eventId/I" ); _theTree->Branch( "PDGId", &_PDGId, "PDGId/I" ); _theTree->Branch( "dVtx", &_dVtx, "dVtx/I" ); _theTree->Branch( "pVtx", &_pVtx, "pVtx/I" ); _theTree->Branch( "daug", &_daug, "daug/I" ); _theTree->Branch( "p", &_p, "p/D" ); _theTree->Branch( "E", &_E, "E/D" ); _theTree->Branch( "pL", &_pL, "pL/D" ); _theTree->Branch( "EL", &_EL, "EL/D" ); _theTree->Branch( "m", &_m, "m/D" ); if ( _storeMtmXYZ ) { // Store momentum components as well _theTree->Branch( "px", &_px, "px/D" ); _theTree->Branch( "py", &_py, "py/D" ); _theTree->Branch( "pz", &_pz, "pz/D" ); _theTree->Branch( "pxL", &_pxL, "pxL/D" ); _theTree->Branch( "pyL", &_pyL, "pyL/D" ); _theTree->Branch( "pzL", &_pzL, "pzL/D" ); } // Lifetime _theTree->Branch( "t", &_t, "t/D" ); } void genRootDecayChain::writeTree() { _theFile->cd(); _theTree->Write(); _probHist->Write(); } void genRootDecayChain::generateEvents() { - EvtRandomEngine* randomEngine = nullptr; EvtAbsRadCorr* radCorrEngine = nullptr; std::list extraModels; // Define the random number generator -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - randomEngine = new EvtMTRandomEngine(); -#else - randomEngine = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* randomEngine = new EvtMTRandomEngine(); // Initialize the generator - read in the decay table and particle properties. // For our validation purposes, we just want to read in one decay file #ifdef EVTGEN_EXTERNAL bool convertPythiaCodes( false ); bool useEvtGenRandom( true ); EvtExternalGenList genList( convertPythiaCodes, "", "gamma", useEvtGenRandom ); radCorrEngine = genList.getPhotosModel(); extraModels = genList.getListOfModels(); #endif int mixingType( 1 ); bool useXml( false ); EvtGen evtGen( _decayFileName.c_str(), "../evt.pdl", randomEngine, radCorrEngine, &extraModels, mixingType, useXml ); EvtParticle* theParent( nullptr ); EvtId theId = EvtPDL::getId( _parentName ); if ( theId.getId() == -1 && theId.getAlias() == -1 ) { cout << "Error. Could not find valid EvtId for " << _parentName << endl; return; } // Loop to create nEvents int i; for ( i = 0; i < _nEvents; i++ ) { // Parent particle 4-momentum EvtVector4R pInit( EvtPDL::getMass( theId ), 0.0, 0.0, 0.0 ); _eventId = i; if ( i % 1000 == 0 ) { cout << "Event number = " << i + 1 << " out of " << _nEvents << std::endl; } theParent = EvtParticleFactory::particleFactory( theId, pInit ); if ( theParent->getSpinStates() == 3 ) { theParent->setVectorSpinDensity(); } // Generate the event evtGen.generateDecay( theParent ); // Decay vertex index theParent->setAttribute( "dVtx", 0 ); // Parent vertex index theParent->setAttribute( "pVtx", 0 ); // Daughter index theParent->setAttribute( "daug", 0 ); int nDaug = theParent->getNDaug(); int iDaug( 0 ); storeTreeInfo( theParent ); //cout<<"Event number = "<printTree(); // Initialise the vertex number _vertexNo = 1; // Loop over the daughter tracks for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* daug = theParent->getDaug( iDaug ); // Decay vertex index daug->setAttribute( "dVtx", 1 ); // Parent decay vertex daug->setAttribute( "pVtx", 0 ); // Daughter index: 1,2,..,nDaug daug->setAttribute( "daug", iDaug + 1 ); // Recursively store the daughter information this->storeDaughterInfo( daug ); } // daughter loop // Store probability/max probability const double* dProb = theParent->decayProb(); if ( dProb ) { _probHist->Fill( *dProb ); } theParent->deleteTree(); } // event loop delete randomEngine; } void genRootDecayChain::storeDaughterInfo( EvtParticle* theParticle ) { if ( !theParticle ) { return; } // Store the particle information in the TTree storeTreeInfo( theParticle ); // Loop over the particle's own daughter tracks and call this function // recursively, keeping track of the decay chain order number int nDaug = theParticle->getNDaug(); int iDaug( 0 ); // Increment the decay vertex integer if this particle has daughters if ( nDaug > 0 ) { _vertexNo++; } // The parent vertex index for the daughters is equal to the // current particle decay vertex index int parentVtx = theParticle->getAttribute( "dVtx" ); // First, we need to loop over the given particle's daughters and set the // attributes so we keep track of the decay tree history at this chain level for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* daug = theParticle->getDaug( iDaug ); // Set the attributes for the daughters daug->setAttribute( "dVtx", _vertexNo ); daug->setAttribute( "pVtx", parentVtx ); daug->setAttribute( "daug", iDaug + 1 ); } // Now loop over the daughters again and recursively call this function to // follow the rest of the decay tree history for ( iDaug = 0; iDaug < nDaug; iDaug++ ) { EvtParticle* daug = theParticle->getDaug( iDaug ); storeDaughterInfo( daug ); } } void genRootDecayChain::storeTreeInfo( EvtParticle* theParticle ) { if ( !theParticle ) { return; } // Store the particle information in the TTree by first setting the internal // variables and then calling Fill() _dVtx = theParticle->getAttribute( "dVtx" ); _pVtx = theParticle->getAttribute( "pVtx" ); _daug = theParticle->getAttribute( "daug" ); //cout<<"Particle "<getName()<<", dVtx = "<<_dVtx //<<", pVtx = "<<_pVtx<<", daug = "<<_daug<getP4Lab(); // lab frame = mother frame EvtVector4R p4 = theParticle->getP4(); // frame = parents frame // PDG id _PDGId = EvtPDL::getStdHep( theParticle->getId() ); // 4-momenta in parent frame _E = p4.get( 0 ); _px = p4.get( 1 ); _py = p4.get( 2 ); _pz = p4.get( 3 ); _p = sqrt( _px * _px + _py * _py + _pz * _pz ); // 4-momenta in lab frame _EL = p4Lab.get( 0 ); _pxL = p4Lab.get( 1 ); _pyL = p4Lab.get( 2 ); _pzL = p4Lab.get( 3 ); _pL = sqrt( _pxL * _pxL + _pyL * _pyL + _pzL * _pzL ); // Rest mass and lifetime _m = theParticle->mass(); _t = theParticle->getLifetime(); // Store the information in the TTree _theTree->Fill(); } int main( int argc, char** argv ) { // Use the B0 -> K'*0 gamma, K'*0 -> K+ pi- decays as an example string decayFileName( "BKstarGamma.dec" ); //string decayFileName("BuDst0rhop.dec"); if ( argc > 1 ) { decayFileName = argv[1]; } cout << "Decay file name is " << decayFileName << endl; string rootFileName( "BKstarGamma.root" ); //string rootFileName("BuDst0rhop.root"); if ( argc > 2 ) { rootFileName = argv[2]; } cout << "Root file name is " << rootFileName << endl; string parentName( "B0" ); //string parentName("B-"); if ( argc > 3 ) { parentName = argv[3]; } cout << "Parent name is " << parentName << endl; int nEvents( 100000 ); if ( argc > 4 ) { nEvents = atoi( argv[4] ); } bool storeMtmXYZ = true; genRootDecayChain myGen( decayFileName, rootFileName, parentName, nEvents, storeMtmXYZ ); myGen.run(); return 0; } diff --git a/validation/testCPVDecays.cc b/validation/testCPVDecays.cc index 9e64770..07ecaf0 100644 --- a/validation/testCPVDecays.cc +++ b/validation/testCPVDecays.cc @@ -1,477 +1,470 @@ /*********************************************************************** * 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 . * ***********************************************************************/ // Program to create ROOT files for EvtGen validation plots. // This looks at the 1st generation daughters and stores 4-momenta // info into a ROOT file for further analysis. // Useful for Pythia, Photos and Tauola decay tests. #include "EvtGen/EvtGen.hh" #include "EvtGenBase/EvtAbsRadCorr.hh" #include "EvtGenBase/EvtCPUtil.hh" #include "EvtGenBase/EvtComplex.hh" #include "EvtGenBase/EvtDecayBase.hh" #include "EvtGenBase/EvtHepMCEvent.hh" #include "EvtGenBase/EvtMTRandomEngine.hh" #include "EvtGenBase/EvtPDL.hh" #include "EvtGenBase/EvtParticle.hh" #include "EvtGenBase/EvtParticleFactory.hh" #include "EvtGenBase/EvtPatches.hh" #include "EvtGenBase/EvtRandom.hh" #include "EvtGenBase/EvtSimpleRandomEngine.hh" #include "EvtGenBase/EvtSpinDensity.hh" #include "EvtGenBase/EvtSpinType.hh" #ifdef EVTGEN_EXTERNAL #include "EvtGenExternal/EvtExternalGenList.hh" #endif #include "TCanvas.h" #include "TF1.h" #include "TFile.h" #include "TH1.h" #include "TLine.h" #include "TROOT.h" #include "TStyle.h" #include "TTree.h" #include #include #include #include using std::cout; using std::endl; using std::string; // Flight-time histograms for B0, B0bar TH1F* H_total = new TH1F( "Total", "", 300, 0.0, 12.0 ); TH1F* H_B0 = new TH1F( "B0", "", 300, 0.0, 12.0 ); TH1F* H_B0bar = new TH1F( "B0bar", "", 300, 0.0, 12.0 ); int B0Id( 511 ), B0barId( -511 ); void storeBFlightTimes( GenEvent* theEvent ); bool checkSignal( std::vector& daugIdVect ); double calcFlightTime( FourVector& BDecayVtx, FourVector& B4mtm ); double sineFitFun( double* x, double* p ); double timeFitFun( double* x, double* p ); int main( int argc, char** argv ) { string decayFileName( "CPVDecayFiles/Bd_JpsiKSeeCPV.dec" ); if ( argc > 1 ) { decayFileName = argv[1]; } cout << "Decay file name is " << decayFileName << endl; string rootFileName( "rootFiles/CPVDecayTest.root" ); if ( argc > 2 ) { rootFileName = argv[2]; } cout << "Root file name is " << rootFileName << endl; string parentName( "Upsilon(4S)" ); if ( argc > 3 ) { parentName = argv[3]; } cout << "Parent name is " << parentName << endl; int nEvents( 10000 ); if ( argc > 4 ) { nEvents = atoi( argv[4] ); } double sin2Beta = sin( 0.775 ); if ( argc > 5 ) { sin2Beta = atof( argv[5] ); } cout << "Number of events is " << nEvents << endl; cout << "sin2Beta = " << sin2Beta << " (used to draw oscillation maxima lines)" << endl; // Define the random number generator - - EvtRandomEngine* myRandomEngine = nullptr; - -#ifdef EVTGEN_CPP11 - // Use the Mersenne-Twister generator (C++11 only) - myRandomEngine = new EvtMTRandomEngine(); -#else - myRandomEngine = new EvtSimpleRandomEngine(); -#endif + // Use the Mersenne-Twister generator + EvtRandomEngine* myRandomEngine = new EvtMTRandomEngine(); 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 int mixingType = EvtCPUtil::Incoherent; // Initialize the generator - read in the decay table and particle properties. EvtGen myGenerator( "../DECAY.DEC", "../evt.pdl", myRandomEngine, radCorrEngine, &extraModels, mixingType ); myGenerator.readUDecay( decayFileName.c_str() ); EvtId theId = EvtPDL::getId( parentName ); if ( theId.getId() == -1 && theId.getAlias() == -1 ) { cout << "Error. Could not find valid EvtId for " << parentName << endl; return -1; } // Start all initial (parent) decays at the origin EvtVector4R origin( 0.0, 0.0, 0.0, 0.0 ); EvtSpinDensity* spinDensity = nullptr; EvtSpinType::spintype baseSpin = EvtPDL::getSpinType( theId ); if ( baseSpin == EvtSpinType::VECTOR ) { cout << "Setting spin density for vector particle " << parentName << endl; spinDensity = new EvtSpinDensity(); spinDensity->setDiag( EvtSpinType::getSpinStates( EvtSpinType::VECTOR ) ); spinDensity->set( 1, 1, EvtComplex( 0.0, 0.0 ) ); } // Loop to create nEvents int i; for ( i = 0; i < nEvents; i++ ) { if ( i % 1000 == 0 ) { cout << "Event number = " << i + 1 << " out of " << nEvents << std::endl; } // Set up the parent particle int PDGId = EvtPDL::getStdHep( theId ); EvtVector4R pInit( EvtPDL::getMass( theId ), 0.0, 0.0, 0.0 ); // Generate a new HepMC event with the decays. We own this pointer, so we must // delete it after using the HepMC event information. EvtHepMCEvent* theEvent = myGenerator.generateDecay( PDGId, pInit, origin, spinDensity ); // Retrieve the HepMC event information GenEvent* hepMCEvent = theEvent->getEvent(); //hepMCEvent->print(); // Fill the B0/B0bar flight time histograms storeBFlightTimes( hepMCEvent ); // Cleanup the event to avoid memory leaks delete theEvent; } H_total->Sumw2(); H_B0->Sumw2(); H_B0bar->Sumw2(); TH1F* H_Diff = dynamic_cast( H_B0->Clone( "H_Diff" ) ); H_Diff->Add( H_B0bar, -1.0 ); TH1F* H_DiffSum = dynamic_cast( H_Diff->Clone( "H_DiffSum" ) ); H_DiffSum->Divide( H_total ); TF1* sineFit = new TF1( "sineFit", sineFitFun, 0.0, 12.0, 3 ); sineFit->SetParName( 0, "N" ); sineFit->SetParName( 1, "a" ); sineFit->SetParName( 2, "#phi" ); sineFit->SetParameter( 0, 0.5 ); sineFit->SetParameter( 1, 0.7 ); sineFit->SetParameter( 2, -0.7 ); H_DiffSum->Fit( sineFit ); TF1* timeFit = new TF1( "timeFit", timeFitFun, 0.0, 12.0, 2 ); timeFit->SetParName( 0, "N" ); timeFit->SetParName( 1, "#Gamma" ); timeFit->SetParameter( 0, 500 ); timeFit->SetParameter( 1, 0.6 ); timeFit->SetParLimits( 1, 0.0, 1.0 ); H_total->Fit( timeFit ); gROOT->SetStyle( "Plain" ); gStyle->SetOptFit( 1111 ); TCanvas* theCanvas = new TCanvas( "theCanvas", "", 900, 700 ); theCanvas->UseCurrentStyle(); H_DiffSum->SetXTitle( "t (ps)" ); H_DiffSum->Draw(); // Plot +- sin(2beta) lines TLine line1( 0.0, sin2Beta, 12.0, sin2Beta ); line1.Draw(); TLine line2( 0.0, -sin2Beta, 12.0, -sin2Beta ); line2.Draw(); theCanvas->Print( "BCPVSinFit.gif" ); H_total->SetXTitle( "t (ps)" ); H_total->Draw(); theCanvas->Print( "BTimeFit.gif" ); TFile* theFile = new TFile( rootFileName.c_str(), "recreate" ); theFile->cd(); H_B0->Write(); H_B0bar->Write(); H_total->Write(); H_Diff->Write(); H_DiffSum->Write(); theFile->Close(); // Cleanup delete theCanvas; delete spinDensity; delete myRandomEngine; cout << "Done." << endl; return 0; } #ifdef EVTGEN_HEPMC3 void storeBFlightTimes( GenEvent* theEvent ) { std::list allVertices; // Loop over vertices in the event for ( auto theVertex : theEvent->vertices() ) { if ( theVertex == nullptr ) { continue; } // Check to see if the incoming particle is a B candidate. // If so, also look at the outgoing particles to see if we have a signal decay. // For these, get the B decay vertex position and the B 4-momentum to calculate // the B lifetime. bool gotB0( false ), gotB0bar( false ); FourVector B4mtm; for ( auto inParticle : theVertex->particles_in() ) { if ( inParticle == nullptr ) { continue; } int inPDGId = inParticle->pdg_id(); if ( inPDGId == B0Id ) { gotB0 = true; } else if ( inPDGId == B0barId ) { gotB0bar = true; } if ( gotB0 == true || gotB0bar == true ) { B4mtm = inParticle->momentum(); } } // Loop over ingoing vertex particles if ( gotB0 == true || gotB0bar == true ) { // Check outgoing particles std::vector daugIdVect; for ( auto outParticle : theVertex->particles_out() ) { if ( outParticle != nullptr ) { int outPDGId = outParticle->pdg_id(); daugIdVect.push_back( outPDGId ); } } // Loop over outgoing vertex particles // Check if we have the signal decay bool gotSignal = checkSignal( daugIdVect ); // Fill the flight time histograms for signal B decays if ( gotSignal == true ) { FourVector BDecayVtx = theVertex->position(); double flightTime = calcFlightTime( BDecayVtx, B4mtm ); if ( gotB0 == true ) { H_B0->Fill( flightTime ); H_total->Fill( flightTime ); } else { H_B0bar->Fill( flightTime ); H_total->Fill( flightTime ); } } // Got signal B decay (for flight-time histograms) } // Got a B candidate } // Loop over event vertices } #else void storeBFlightTimes( GenEvent* theEvent ) { std::list allVertices; HepMC::GenEvent::vertex_iterator vertexIter; // Loop over vertices in the event for ( vertexIter = theEvent->vertices_begin(); vertexIter != theEvent->vertices_end(); ++vertexIter ) { // Get the vertex HepMC::GenVertex* theVertex = *vertexIter; if ( theVertex == nullptr ) { continue; } // Check to see if the incoming particle is a B candidate. // If so, also look at the outgoing particles to see if we have a signal decay. // For these, get the B decay vertex position and the B 4-momentum to calculate // the B lifetime. bool gotB0( false ), gotB0bar( false ); FourVector B4mtm; HepMC::GenVertex::particles_in_const_iterator inIter; for ( inIter = theVertex->particles_in_const_begin(); inIter != theVertex->particles_in_const_end(); ++inIter ) { HepMC::GenParticle* inParticle = *inIter; if ( inParticle == nullptr ) { continue; } int inPDGId = inParticle->pdg_id(); if ( inPDGId == B0Id ) { gotB0 = true; } else if ( inPDGId == B0barId ) { gotB0bar = true; } if ( gotB0 == true || gotB0bar == true ) { B4mtm = inParticle->momentum(); } } // Loop over ingoing vertex particles if ( gotB0 == true || gotB0bar == true ) { // Check outgoing particles std::vector daugIdVect; HepMC::GenVertex::particles_out_const_iterator outIter; for ( outIter = theVertex->particles_out_const_begin(); outIter != theVertex->particles_out_const_end(); ++outIter ) { HepMC::GenParticle* outParticle = *outIter; if ( outParticle != nullptr ) { int outPDGId = outParticle->pdg_id(); daugIdVect.push_back( outPDGId ); } } // Loop over outgoing vertex particles // Check if we have the signal decay bool gotSignal = checkSignal( daugIdVect ); // Fill the flight time histograms for signal B decays if ( gotSignal == true ) { HepMC::FourVector BDecayVtx = theVertex->position(); double flightTime = calcFlightTime( BDecayVtx, B4mtm ); if ( gotB0 == true ) { H_B0->Fill( flightTime ); H_total->Fill( flightTime ); } else { H_B0bar->Fill( flightTime ); H_total->Fill( flightTime ); } } // Got signal B decay (for flight-time histograms) } // Got a B candidate } // Loop over event vertices } #endif double calcFlightTime( FourVector& BDecayVtx, FourVector& B4mtm ) { double flightTime( 0.0 ); #ifdef EVTGEN_HEPMC3 double distance = BDecayVtx.length() * 1e-3; // metres double momentum = B4mtm.length(); // GeV/c #else double distance = BDecayVtx.rho() * 1e-3; // metres double momentum = B4mtm.rho(); // GeV/c #endif double BMass = 5.2795; // GeV/c^2 double c0 = 299792458.0; // m/s if ( momentum > 0.0 ) { flightTime = 1.0e12 * distance * BMass / ( momentum * c0 ); // picoseconds } return flightTime; } bool checkSignal( std::vector& daugIdVect ) { bool gotSignal( false ); int nDaug = daugIdVect.size(); // Check for J/psi Ks decays if ( nDaug == 2 ) { int daug1Id = daugIdVect[0]; int daug2Id = daugIdVect[1]; if ( ( daug1Id == 443 && daug2Id == 310 ) || ( daug1Id == 310 && daug2Id == 443 ) ) { gotSignal = true; } } return gotSignal; } double sineFitFun( double* x, double* p ) { double t = x[0]; double N = p[0]; double a = p[1]; double phi = p[2]; double funcVal = N * sin( a * t + phi ); return funcVal; } double timeFitFun( double* x, double* p ) { double t = x[0]; double N0 = p[0]; double gamma = p[1]; double funcVal = N0 * ( exp( -gamma * t ) ); return funcVal; }