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 <vector>
22 #include <tuple>
23 #include <iostream>
24 
25 namespace matching {
26 
28 
29 // digi info keeper: <detid, channel, bx, type, quality, bend, WireGroup>
30 typedef std::tuple<unsigned int, int, int, DigiType, int, int, int, float> Digi;
31 
32 // digi collection
33 typedef std::vector<Digi> DigiContainer;
34 
35 // digi makeres
36 inline Digi make_digi() { return std::make_tuple(0, 0, 0, INVALID, 0, 0, 0, 0.); }
37 inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t) { return std::make_tuple(id, ch, bx, t, 0, 0, 0, 0.); }
38 inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q) { return std::make_tuple(id, ch, bx, t, q, 0, 0, 0.); }
39 inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat) { return std::make_tuple(id, ch, bx, t, q, pat, 0, 0.); }
40 inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat, int wg) { return std::make_tuple(id, ch, bx, t, q, pat, wg, 0.); }
41 inline Digi make_digi(unsigned int id, int ch, int bx, DigiType t, int q, int pat, int wg, float dphi) { return std::make_tuple(id, ch, bx, t, q, pat, wg, dphi); }
42 
43 // digi accessors
44 inline bool is_valid(const Digi& d) {return std::get<0>(d) != INVALID; }
45 
46 inline unsigned int digi_id(const Digi& d) { return std::get<0>(d); }
47 inline int digi_channel(const Digi& d) { return std::get<1>(d); }
48 inline int digi_bx(const Digi& d) { return std::get<2>(d); }
49 inline DigiType digi_type(const Digi& d) { return std::get<3>(d); }
50 inline int digi_quality(const Digi& d) { return std::get<4>(d); }
51 inline int digi_pattern(const Digi& d) { return std::get<5>(d); }
52 
53 // can access and also modify the WG value by reference with this one
54 int& digi_wg(Digi& d);
55 // only read for const digi
56 int digi_wg(const Digi& d);
57 
58 // can access and also modify the dphi value by reference with this one
59 inline float& digi_dphi(Digi& d) { return std::get<7>(d); }
60 // only read for const digi
61 inline float digi_dphi(const Digi& d) { return std::get<7>(d); }
62 
63 }
64 
65 std::ostream & operator<<(std::ostream & o, const matching::Digi& d);
66 
67 #endif
68 
float & digi_dphi(Digi &d)
Definition: GenericDigi.h:59
std::ostream & operator<<(std::ostream &o, const matching::Digi &d)
bool is_valid(const Digi &d)
Definition: GenericDigi.h:44
std::vector< Digi > DigiContainer
Definition: GenericDigi.h:33
std::tuple< unsigned int, int, int, DigiType, int, int, int, float > Digi
Definition: GenericDigi.h:30
DigiType digi_type(const Digi &d)
Definition: GenericDigi.h:49
int digi_pattern(const Digi &d)
Definition: GenericDigi.h:51
Definition: HeavyIon.h:7
int digi_bx(const Digi &d)
Definition: GenericDigi.h:48
int digi_quality(const Digi &d)
Definition: GenericDigi.h:50
int digi_channel(const Digi &d)
Definition: GenericDigi.h:47
Digi make_digi()
Definition: GenericDigi.h:36
int & digi_wg(Digi &d)
unsigned int digi_id(const Digi &d)
Definition: GenericDigi.h:46