]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | /******************************************************************************* |
2 | * Project: BaBar detector at the SLAC PEP-II B-factory | |
3 | * Package: EvtGenBase | |
4 | * File: $Id: EvtCyclic3.hh,v 1.12 2009/02/15 18:09:01 ryd Exp $ | |
5 | * Author: Alexei Dvoretskii, dvoretsk@slac.stanford.edu, 2001-2002 | |
6 | * | |
7 | * Copyright (C) 2002 Caltech | |
8 | *******************************************************************************/ | |
9 | ||
10 | // Cyclic permutations of three indices A,B,C and their parings | |
11 | ||
12 | #ifndef EVT_CYCLIC3_HH | |
13 | #define EVT_CYCLIC3_HH | |
14 | ||
15 | #include <iosfwd> | |
16 | ||
17 | namespace EvtCyclic3 { | |
18 | ||
19 | ||
20 | enum Index {A=0,B=1,C=2}; | |
21 | enum Pair {BC=0,CB=BC,CA=1,AC=CA,AB=2,BA=AB}; | |
22 | enum Perm {ABC=0,BCA=1,CAB=2,CBA=3,BAC=4,ACB=5}; | |
23 | ||
24 | // Permutations (multiplication is not transitive) | |
25 | ||
26 | Index permute(Index i, Perm p); | |
27 | Perm permutation(Index i1,Index i2,Index i3); | |
28 | Perm permute(Perm i, Perm p); | |
29 | Pair permute(Pair i, Perm p); | |
30 | ||
31 | Pair i2pair(int i); | |
32 | ||
33 | // Index-to-index | |
34 | ||
35 | Index prev(Index i); | |
36 | Index next(Index i) ; | |
37 | Index other(Index i, Index j); | |
38 | ||
39 | // Index-to-pair | |
40 | ||
41 | Pair other(Index i); | |
42 | Pair combine(Index i, Index j); | |
43 | ||
44 | ||
45 | // Pair-to-pair conversions | |
46 | ||
47 | Pair prev(Pair i); | |
48 | Pair next(Pair i); | |
49 | Pair other(Pair i, Pair j); | |
50 | ||
51 | // Pair-to-index conversions | |
52 | ||
53 | ||
54 | Index first(Pair i); | |
55 | Index second(Pair i); | |
56 | Index other(Pair i) ; | |
57 | Index common(Pair i, Pair j); | |
58 | ||
59 | // String to Index, Pair | |
60 | ||
61 | Index strToIndex(const char* str); | |
62 | Pair strToPair(const char* str); | |
63 | ||
64 | // To string conversions | |
65 | ||
66 | const char* c_str(Index i); | |
67 | const char* c_str(Pair i); | |
68 | const char* c_str(Perm i); | |
69 | ||
70 | // Useful name strings | |
71 | ||
72 | char* append(const char* str, EvtCyclic3::Index i); | |
73 | char* append(const char* str, EvtCyclic3::Pair i); | |
74 | ||
75 | } | |
76 | ||
77 | //where should these go? | |
78 | //ostream& operator<<(ostream&, EvtCyclic3::Index); | |
79 | //ostream& operator<<(ostream&, EvtCyclic3::Pair); | |
80 | ||
81 | #endif |