CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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:
14 
15  RPCLinkSynchroStat(bool useFirstHitOnly);
16 
17  virtual ~RPCLinkSynchroStat(){}
18 
19  void init(const RPCReadOutMapping* theCabling, bool addChamberInfo);
20 
21  void add(const RPCRawSynchro::ProdItem & counts, std::vector<LinkBoardElectronicIndex> & problems);
22 
23  void add(const std::string & lbName, const unsigned int *hits);
24 
25  std::string dumpDelays();
26 
27 protected:
28 
29  class LinkBoard {
30  public:
31  LinkBoard(const std::string & n) : theName(n) {}
32  const std::string & name() const { return theName; }
33  typedef std::pair<std::string,std::string> ChamberAndPartition;
34  int add(const ChamberAndPartition & part);
35  int add(const LinkBoardElectronicIndex & ele);
36  const std::vector<LinkBoardElectronicIndex> & paths() const { return theElePaths; }
37  const std::vector<ChamberAndPartition> & chamberAndPartitions() const { return theChamberAndPartitions; }
38  bool operator<(const LinkBoard &o) const {return theName < o.theName; }
39  bool operator==(const LinkBoard &o) const { return (theName == o.theName); }
40  private:
41  std::string theName;
42  std::vector<ChamberAndPartition> theChamberAndPartitions;
43  std::vector<LinkBoardElectronicIndex> theElePaths;
44  };
45 
46  class SynchroCounts {
47  public:
48  SynchroCounts() : theCounts(std::vector<unsigned int>(8,0)) {}
49  SynchroCounts(const unsigned int *hits) : theCounts(std::vector<unsigned int>(hits,hits+8)) {}
50 
51  void increment(unsigned int bxDiff);
52  void set(unsigned int bxDiff);
53  unsigned int firstHit() const;
54 
55  double rms() const;
56  double mean() const;
57  unsigned int sum() const { return mom0(); }
58 
59  std::string print() const;
60  const std::vector<unsigned int> & counts() const { return theCounts; }
61  bool operator==(const SynchroCounts &) const;
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 { bool operator()(const BoardAndCounts & o1, const BoardAndCounts & o2); };
71  struct LessCountSum { bool operator()(const BoardAndCounts & o1, const BoardAndCounts & o2); };
72  struct ShortLinkInfo{ unsigned int idx; std::vector<unsigned int> hit_paths; SynchroCounts counts; };
73 
75 
76  static const unsigned int MAXDCCINDEX=2;
77  static const unsigned int DCCINDEXSHIFT=790;
78  static const unsigned int MAXRBCINDEX=35;
79  static const unsigned int MAXLINKINDEX=17;
80  static const unsigned int MAXLBINDEX=2;
82  std::vector<BoardAndCounts> theLinkStatMap;
83 
85 };
86 #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]
SynchroCounts(const unsigned int *hits)
std::vector< std::pair< LinkBoardElectronicIndex, int > > ProdItem
Definition: RPCRawSynchro.h:9
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
static const unsigned int MAXRBCINDEX
std::pair< std::string, std::string > ChamberAndPartition
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:21
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