a Code for the Combination of Indirect and Direct Constraints on High Energy Physics Models Logo
MassSpectrum.cpp
Go to the documentation of this file.
1/*
2 * MassSpectrum.cpp
3 *
4 * Created on: Jan 8, 2012
5 * Author: Ben O'Leary (benjamin.oleary@gmail.com)
6 * Copyright 2012 Ben O'Leary
7 *
8 * This file is part of LesHouchesParserClasses, released under the
9 * GNU General Public License. Please see the accompanying
10 * README.LHPC_CPP.txt file for a full list of files, brief documentation
11 * on how to use these classes, and further details on the license.
12 */
13
14#include "MEC.hpp"
16
17namespace LHPC
18{
19 std::vector< bool > const
21 false );
22 std::vector< bool > const
24 BOL::StdVectorFiller< bool >( true )( false ).end( false ) );
25 std::vector< bool > const
27 BOL::StdVectorFiller< bool >( false )( true ).end( false ) );
28 std::vector< bool > const
30 BOL::StdVectorFiller< bool >( false )( false ).end( true ) );
31
32 MassSpectrum::MassSpectrum( bool const isVerbose,
33 std::vector< bool > const* defaultFlags ) :
34 allMassEigenstates(),
35 unknownMassEigenstates(),
36 pdgCodeMap(),
37 isVerbose( isVerbose ),
38 mapAndVectorAndBools( pdgCodeMap,
39 allMassEigenstates,
40 isVerbose )
41 {
42 if( NULL == defaultFlags )
43 {
45 }
47 }
48
50 {
51 for( int deletionIndex( unknownMassEigenstates.size() - 1 );
52 0 <= deletionIndex;
53 --deletionIndex )
54 {
55 delete unknownMassEigenstates[ deletionIndex ];
56 }
57 }
58
59
62 /* this looks for a MassEigenstate with code pdgCode, & if it doesn't find
63 * one, it creates a new MassEigenstate instance with a name that is just
64 * pdgCode as a string, & also its charge conjugate, & notes their pointers
65 * in unknownMassEigenstates so that they can be deleted by this MassSpectrum
66 * instance's destructor.
67 */
68 {
70 massEigenstatePointer( MassEigenstate::findPointerWithCode( pdgCode,
71 pdgCodeMap ) );
72 if( NULL == massEigenstatePointer )
73 // if the requested MassEigenstate could not be found...
74 {
75 std::string codeAsName( BOL::StringParser::intToString( pdgCode,
76 1 ) );
77 // the code is turned into a name.
78 massEigenstatePointer = new MassEigenstate( pdgCode,
80 false,
81 codeAsName,
82 codeAsName );
83 // the MassEigenstate is constructed with default flags.
84 unknownMassEigenstates.push_back( massEigenstatePointer );
85 // the pointer is noted so that it can be deleted when appropriate.
86 codeAsName.assign( BOL::StringParser::intToString( -pdgCode,
87 1 ) );
88 // the charge conjugate's name is made, & then used for the creation of
89 // the charge conjugate itself, while storing its pointer for deletion:
91 *massEigenstatePointer,
92 codeAsName,
93 codeAsName ) );
94 }
95 return *massEigenstatePointer;
96 }
97
98}
static std::string intToString(int inputInt, int const minimumNumberOfDigits, std::string const prefixForPositiveNumbers="+", std::string const prefixForNegativeNumbers="-", char const paddingChar='0')
MapAndVectorAndBools< PointerClass > & withBools(std::vector< bool > const *const boolVector)
static MassEigenstate * findPointerWithCode(int pdgCode, MassEigenstateCodeMap const &codeMap)
std::vector< MassEigenstate * > unknownMassEigenstates
MassSpectrum(bool const isVerbose=false, std::vector< bool > const *defaultFlags=NULL)
MassEigenstateMapAndVectorAndBools mapAndVectorAndBools
static std::vector< bool > const defaultIsLightLeptonBoolVector
virtual ~MassSpectrum()
MassEigenstateCodeToPointerMap pdgCodeMap
static std::vector< bool > const defaultIsJetBoolVector
static std::vector< bool > const defaultBoolVector
MassEigenstate & ensureMassEigenstateExists(int const pdgCode)
static std::vector< bool > const defaultEscapesDetectorBoolVector