EvtGen 2.2.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
Loading...
Searching...
No Matches
EvtId.hh
Go to the documentation of this file.
1
2/***********************************************************************
3* Copyright 1998-2020 CERN for the benefit of the EvtGen authors *
4* *
5* This file is part of EvtGen. *
6* *
7* EvtGen is free software: you can redistribute it and/or modify *
8* it under the terms of the GNU General Public License as published by *
9* the Free Software Foundation, either version 3 of the License, or *
10* (at your option) any later version. *
11* *
12* EvtGen is distributed in the hope that it will be useful, *
13* but WITHOUT ANY WARRANTY; without even the implied warranty of *
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15* GNU General Public License for more details. *
16* *
17* You should have received a copy of the GNU General Public License *
18* along with EvtGen. If not, see <https://www.gnu.org/licenses/>. *
19***********************************************************************/
20
21#ifndef EVTID_HH
22#define EVTID_HH
23
24#include <iosfwd>
25#include <string>
26
27class EvtId {
28 public:
29 EvtId() = default;
30
31 EvtId( int id, int alias ) : m_id{ id }, m_alias{ alias } {}
32
33 friend std::ostream& operator<<( std::ostream& s, const EvtId& v );
34
35 bool operator==( const EvtId& id ) const { return m_id == id.m_id; }
36 bool operator!=( const EvtId& id ) const { return m_id != id.m_id; }
37 bool operator<( const EvtId& id ) const { return m_id < id.m_id; }
38
39 bool isConjugate( const EvtId& id ) const;
40
41 int getId() const { return m_id; }
42
43 int getAlias() const { return m_alias; }
44
45 bool isAlias() const { return m_id != m_alias; }
46
47 std::string getName() const;
48
49 private:
50 //particle number 0..n. The order of particles are determined
51 //by the order in pdt.table
52 int m_id{ -1 };
53 //if the particle is an alias to another particle alias!=id
54 //The only place where the alias should be used is for looking
55 //up decays in the decay table.
56 int m_alias{ -1 };
57};
58
59#endif
Definition EvtId.hh:27
int getAlias() const
Definition EvtId.hh:43
std::string getName() const
Definition EvtId.cpp:38
EvtId()=default
bool operator==(const EvtId &id) const
Definition EvtId.hh:35
int getId() const
Definition EvtId.hh:41
EvtId(int id, int alias)
Definition EvtId.hh:31
int m_alias
Definition EvtId.hh:56
bool operator<(const EvtId &id) const
Definition EvtId.hh:37
bool operator!=(const EvtId &id) const
Definition EvtId.hh:36
bool isConjugate(const EvtId &id) const
Definition EvtId.cpp:33
friend std::ostream & operator<<(std::ostream &s, const EvtId &v)
Definition EvtId.cpp:27
int m_id
Definition EvtId.hh:52
bool isAlias() const
Definition EvtId.hh:45