CMS 3D CMS Logo

GenericDigi.h
Go to the documentation of this file.
1 #ifndef GEMValidation_GenericDigi_h
2 #define GEMValidation_GenericDigi_h
3 
17 //#include "Validation/MuonGEMHits/interface/BaseMatcher.h"
18 
20 
21 #include <iostream>
22 #include <tuple>
23 #include <vector>
24 
25 namespace matching {
26 
27  typedef enum {
28  INVALID = 0,
37  } DigiType;
38 
39  // digi info keeper: <detid, channel, bx, type, quality, bend, WireGroup>
40  typedef std::tuple<unsigned int, int, int, DigiType, int, int, int, float> Digi;
41 
42  // digi collection
43  typedef std::vector<Digi> DigiContainer;
44 
45  // digi makeres
46  inline Digi make_digi() { return std::make_tuple(0, 0, 0, INVALID, 0, 0, 0, 0.); }
47  inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t) {
48  return std::make_tuple(id, ch, bx, t, 0, 0, 0, 0.);
49  }
50  inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q) {
51  return std::make_tuple(id, ch, bx, t, q, 0, 0, 0.);
52  }
53  inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat) {
54  return std::make_tuple(id, ch, bx, t, q, pat, 0, 0.);
55  }
56  inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat, int wg) {
57  return std::make_tuple(id, ch, bx, t, q, pat, wg, 0.);
58  }
59  inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat, int wg, float dphi) {
60  return std::make_tuple(id, ch, bx, t, q, pat, wg, dphi);
61  }
62 
63  // digi accessors
64  inline bool is_valid(const Digi &d) { return std::get<0>(d) != INVALID; }
65 
66  inline unsigned int digi_id(const Digi &d) { return std::get<0>(d); }
67  inline int digi_channel(const Digi &d) { return std::get<1>(d); }
68  inline int digi_bx(const Digi &d) { return std::get<2>(d); }
69  inline DigiType digi_type(const Digi &d) { return std::get<3>(d); }
70  inline int digi_quality(const Digi &d) { return std::get<4>(d); }
71  inline int digi_pattern(const Digi &d) { return std::get<5>(d); }
72 
73  // can access and also modify the WG value by reference with this one
74  int &digi_wg(Digi &d);
75  // only read for const digi
76  int digi_wg(const Digi &d);
77 
78  // can access and also modify the dphi value by reference with this one
79  inline float &digi_dphi(Digi &d) { return std::get<7>(d); }
80  // only read for const digi
81  inline float digi_dphi(const Digi &d) { return std::get<7>(d); }
82 
83 } // namespace matching
84 
85 std::ostream &operator<<(std::ostream &o, const matching::Digi &d);
86 
87 #endif
float & digi_dphi(Digi &d)
Definition: GenericDigi.h:79
std::ostream & operator<<(std::ostream &o, const matching::Digi &d)
bool is_valid(const Digi &d)
Definition: GenericDigi.h:64
std::vector< Digi > DigiContainer
Definition: GenericDigi.h:43
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:40
DigiType digi_type(const Digi &d)
Definition: GenericDigi.h:69
int digi_pattern(const Digi &d)
Definition: GenericDigi.h:71
Definition: HeavyIon.h:7
int digi_bx(const Digi &d)
Definition: GenericDigi.h:68
int digi_quality(const Digi &d)
Definition: GenericDigi.h:70
d
Definition: ztail.py:151
int digi_channel(const Digi &d)
Definition: GenericDigi.h:67
Digi make_digi()
Definition: GenericDigi.h:46
int & digi_wg(Digi &d)
unsigned int digi_id(const Digi &d)
Definition: GenericDigi.h:66