CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RPCLinkSynchroStat.h
Go to the documentation of this file.
1 #ifndef DQM_RPCMonitorDigi_RPCLinkSynchroStat_H
2 #define DQM_RPCMonitorDigi_RPCLinkSynchroStat_H
3 
7 
8 #include <cmath>
9 #include <vector>
10 
12 public:
13  RPCLinkSynchroStat(bool useFirstHitOnly);
14 
15  virtual ~RPCLinkSynchroStat() {}
16 
17  void init(const RPCReadOutMapping *theCabling, bool addChamberInfo);
18 
19  void add(const RPCRawSynchro::ProdItem &counts, std::vector<LinkBoardElectronicIndex> &problems);
20 
21  void add(const std::string &lbName, const unsigned int *hits);
22 
24 
25 protected:
26  class LinkBoard {
27  public:
28  LinkBoard(const std::string &n) : theName(n) {}
29  const std::string &name() const { return theName; }
30  typedef std::pair<std::string, std::string> ChamberAndPartition;
31  int add(const ChamberAndPartition &part);
32  int add(const LinkBoardElectronicIndex &ele);
33  const std::vector<LinkBoardElectronicIndex> &paths() const { return theElePaths; }
34  const std::vector<ChamberAndPartition> &chamberAndPartitions() const { return theChamberAndPartitions; }
35  bool operator<(const LinkBoard &o) const { return theName < o.theName; }
36  bool operator==(const LinkBoard &o) const { return (theName == o.theName); }
37 
38  private:
40  std::vector<ChamberAndPartition> theChamberAndPartitions;
41  std::vector<LinkBoardElectronicIndex> theElePaths;
42  };
43 
44  class SynchroCounts {
45  public:
46  SynchroCounts() : theCounts(std::vector<unsigned int>(8, 0)) {}
47  SynchroCounts(const unsigned int *hits) : theCounts(std::vector<unsigned int>(hits, hits + 8)) {}
48 
49  void increment(unsigned int bxDiff);
50  void set(unsigned int bxDiff);
51  unsigned int firstHit() const;
52 
53  double rms() const;
54  double mean() const;
55  unsigned int sum() const { return mom0(); }
56 
57  std::string print() const;
58  const std::vector<unsigned int> &counts() const { return theCounts; }
59  bool operator==(const SynchroCounts &) const;
61 
62  private:
63  unsigned int mom0() const;
64  double mom1() const;
65  std::vector<unsigned int> theCounts;
66  };
67 
68  typedef std::pair<LinkBoard, SynchroCounts> BoardAndCounts;
69  struct LessLinkName {
70  bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2);
71  };
72  struct LessCountSum {
73  bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2);
74  };
75  struct ShortLinkInfo {
76  unsigned int idx;
77  std::vector<unsigned int> hit_paths;
79  };
80 
82 
83  static const unsigned int MAXDCCINDEX = 2;
84  static const unsigned int DCCINDEXSHIFT = 790;
85  static const unsigned int MAXRBCINDEX = 35;
86  static const unsigned int MAXLINKINDEX = 17;
87  static const unsigned int MAXLBINDEX = 2;
89  std::vector<BoardAndCounts> theLinkStatMap;
90 
92 };
93 #endif
bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2)
void init(const RPCReadOutMapping *theCabling, bool addChamberInfo)
bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2)
bool operator==(const LinkBoard &o) const
unsigned int theLinkStatNavi[MAXDCCINDEX+1][MAXRBCINDEX+1][MAXLINKINDEX+1][MAXLBINDEX+1]
std::pair< std::string, std::string > ChamberAndPartition
SynchroCounts(const unsigned int *hits)
static const unsigned int MAXLINKINDEX
void increment(unsigned int bxDiff)
const std::vector< unsigned int > & counts() const
static const unsigned int MAXLBINDEX
std::vector< unsigned int > hit_paths
const std::vector< ChamberAndPartition > & chamberAndPartitions() const
std::pair< LinkBoard, SynchroCounts > BoardAndCounts
RPCLinkSynchroStat(bool useFirstHitOnly)
SynchroCounts & operator+=(const SynchroCounts &rhs)
const std::vector< LinkBoardElectronicIndex > & paths() const
std::vector< std::pair< LinkBoardElectronicIndex, int > > ProdItem
Definition: RPCRawSynchro.h:9
static const unsigned int MAXRBCINDEX
static const unsigned int DCCINDEXSHIFT
LinkBoard(const std::string &n)
bool operator<(const LinkBoard &o) const
void add(const RPCRawSynchro::ProdItem &counts, std::vector< LinkBoardElectronicIndex > &problems)
std::vector< LinkBoardElectronicIndex > theElePaths
part
Definition: HCALResponse.h:20
static const unsigned int MAXDCCINDEX
int add(const ChamberAndPartition &part)
bool operator==(const SynchroCounts &) const
const std::string & name() const
std::vector< unsigned int > theCounts
std::vector< ChamberAndPartition > theChamberAndPartitions
std::vector< BoardAndCounts > theLinkStatMap