CMS 3D CMS Logo

RPCLinkSynchroStat.h
Go to the documentation of this file.
1 #ifndef DQM_RPCMonitorClient_RPCLinkSynchroStat_H
2 #define DQM_RPCMonitorClient_RPCLinkSynchroStat_H
3 
4 #include <map>
5 #include <cmath>
6 #include <vector>
9 
10 class RPCReadOutMapping;
11 
13 public:
15 
16  virtual ~RPCLinkSynchroStat() {}
17 
18  void init(const RPCReadOutMapping *theCabling, bool addChamberInfo);
19 
20  void add(const RPCRawSynchro::ProdItem &counts, std::vector<LinkBoardElectronicIndex> &problems);
21 
22  void add(const std::string &lbName, const unsigned int *hits);
23 
25 
26 protected:
27  class LinkBoard {
28  public:
29  LinkBoard(const std::string &n) : theName(n) {}
30  const std::string &name() const { return theName; }
31  typedef std::pair<std::string, std::string> ChamberAndPartition;
32  int add(const ChamberAndPartition &part);
33  int add(const LinkBoardElectronicIndex &ele);
34  const std::vector<LinkBoardElectronicIndex> &paths() const { return theElePaths; }
35  const std::vector<ChamberAndPartition> &chamberAndPartitions() const { return theChamberAndPartitions; }
36  bool operator<(const LinkBoard &o) const { return theName < o.theName; }
37  bool operator==(const LinkBoard &o) const { return (theName == o.theName); }
38 
39  private:
41  std::vector<ChamberAndPartition> theChamberAndPartitions;
42  std::vector<LinkBoardElectronicIndex> theElePaths;
43  };
44 
45  class SynchroCounts {
46  public:
47  SynchroCounts() : theCounts(std::vector<unsigned int>(8, 0)) {}
48  SynchroCounts(const unsigned int *hits) : theCounts(std::vector<unsigned int>(hits, hits + 8)) {}
49 
50  void increment(unsigned int bxDiff);
51  void set(unsigned int bxDiff);
52  unsigned int firstHit() const;
53 
54  double rms() const;
55  double mean() const;
56  unsigned int sum() const { return mom0(); }
57 
58  std::string print() const;
59  const std::vector<unsigned int> &counts() const { return theCounts; }
60  bool operator==(const SynchroCounts &) const;
62 
63  private:
64  unsigned int mom0() const;
65  double mom1() const;
66  std::vector<unsigned int> theCounts;
67  };
68 
69  typedef std::pair<LinkBoard, SynchroCounts> BoardAndCounts;
70  struct LessLinkName {
71  bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2);
72  };
73  struct LessCountSum {
74  bool operator()(const BoardAndCounts &o1, const BoardAndCounts &o2);
75  };
76  struct ShortLinkInfo {
77  unsigned int idx;
78  std::vector<unsigned int> hit_paths;
80  };
81 
83 
84  static const unsigned int MAXDCCINDEX = 2;
85  static const unsigned int DCCINDEXSHIFT = 790;
86  static const unsigned int MAXRBCINDEX = 35;
87  static const unsigned int MAXLINKINDEX = 17;
88  static const unsigned int MAXLBINDEX = 2;
89  unsigned int theLinkStatNavi[MAXDCCINDEX + 1][MAXRBCINDEX + 1][MAXLINKINDEX + 1][MAXLBINDEX + 1];
90  std::vector<BoardAndCounts> theLinkStatMap;
91 
93 };
94 #endif
void init(const RPCReadOutMapping *theCabling, bool addChamberInfo)
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
const std::vector< unsigned int > & counts() const
static const unsigned int MAXLBINDEX
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
std::vector< unsigned int > hit_paths
const std::vector< ChamberAndPartition > & chamberAndPartitions() const
std::pair< LinkBoard, SynchroCounts > BoardAndCounts
RPCLinkSynchroStat(bool useFirstHitOnly)
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)
const std::string & name() const
std::vector< unsigned int > theCounts
std::vector< ChamberAndPartition > theChamberAndPartitions
std::vector< BoardAndCounts > theLinkStatMap
Basic3DVector & operator+=(const Basic3DVector< U > &p)