evtgen is hosted by Hepforge, IPPP Durham
EvtGen  2.0.0
Monte Carlo generator of particle decays, in particular the weak decays of heavy flavour particles such as B mesons.
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 <iostream>
25 #include <string>
26 
27 class EvtId {
28  public:
29  //need a default constructor
30  EvtId() : _id( -1 ), _alias( -1 ) {}
31 
32  EvtId( int id, int alias ) : _id( id ), _alias( alias ) {}
33 
34  friend std::ostream& operator<<( std::ostream& s, const EvtId& v );
35 
36  int operator==( const EvtId& id ) const { return _id == id._id; }
37  int operator!=( const EvtId& id ) const { return _id != id._id; }
38  int operator<( const EvtId& id ) const { return _id < id._id; }
39 
40  int isConjugate( const EvtId& id ) const;
41 
42  int getId() const { return _id; }
43 
44  int getAlias() const { return _alias; }
45 
46  int isAlias() const { return _id != _alias; }
47 
48  std::string getName() const;
49 
50  private:
51  //particle number 0..n. The order of particles are determined
52  //by the order in pdt.table
53  int _id;
54  //if the particle is an alias to another particle alias!=id
55  //The only place where the alias should be used is for looking
56  //up decays in the decay table.
57  int _alias;
58 };
59 
60 #endif
int operator!=(const EvtId &id) const
Definition: EvtId.hh:37
std::string getName() const
Definition: EvtId.cpp:41
friend std::ostream & operator<<(std::ostream &s, const EvtId &v)
int _id
Definition: EvtId.hh:53
int isConjugate(const EvtId &id) const
Definition: EvtId.cpp:36
Definition: EvtId.hh:27
EvtId(int id, int alias)
Definition: EvtId.hh:32
EvtId()
Definition: EvtId.hh:30
int operator<(const EvtId &id) const
Definition: EvtId.hh:38
int _alias
Definition: EvtId.hh:57
int getId() const
Definition: EvtId.hh:42
int operator==(const EvtId &id) const
Definition: EvtId.hh:36
int getAlias() const
Definition: EvtId.hh:44
int isAlias() const
Definition: EvtId.hh:46