CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCMonitorSync.h
Go to the documentation of this file.
1 #ifndef RPCMonitorSync_h
2 #define RPCMonitorSync_h
3 
23 
26 
28 
29 #include <string>
30 #include <map>
31 #include <math.h>
32 
33 struct timing{
34 
35  int early_all[4];
36  int inTime;
37  int late_all[4];
38 
39  int early() const {
40  return (early_all[0]+early_all[1]+early_all[2]+early_all[3]);
41  }
42 
43  int late() const {
44  return (late_all[0]+late_all[1]+late_all[2]+late_all[3]);
45  }
46 
47  int early_w() const {
48  return (early_all[0]+2*early_all[1]+3*early_all[2]+4*early_all[3]);
49  }
50 
51  int late_w() const {
52  return (late_all[0]+2*late_all[1]+3*late_all[2]+4*late_all[3]);
53  }
54 
55  int early_w2() const {
56  return (early_all[0]+4*early_all[1]+9*early_all[2]+16*early_all[3]);
57  }
58 
59  int late_w2() const {
60  return (late_all[0]+4*late_all[1]+9*late_all[2]+16*late_all[3]);
61  }
62 
63  float earlyFraction() const{
64  return (float)early()/(early()+inTime+late());
65  }
66 
67  float inTimeFraction() const {
68  return (float)inTime/(early()+inTime+late());
69  }
70 
71  float lateFraction() const {
72  return (float)late()/(early()+inTime+late());
73  }
74 
75  float outOfTimeFraction() const {
76  return (float)(early()+late())/(early()+inTime+late());
77  }
78 
79  float offset() const {
80  return (float)(late_w()-early_w())/(early()+inTime+late());
81  }
82 
83  float width() const {
84  return (float)sqrt((float)(late_w2()+early_w2())/(early()+inTime+late()));
85  }
86 
87 };
88 
89 class RPCDetId;
90 
92  public:
93  explicit RPCMonitorSync( const edm::ParameterSet& );
95 
96  virtual void analyze( const edm::Event&, const edm::EventSetup& );
97 
98  virtual void endJob(void);
99 
101  std::map<std::string, MonitorElement*> bookDetUnitME(RPCDetId & detId);
102 
103  private:
104 
105  void readRPCDAQStrips(const edm::Event& iEvent);
106 
107  MonitorElement *barrelOffsetHist( std::string name, std::string title );
108  MonitorElement *endcapOffsetHist( std::string name, std::string title );
109  MonitorElement *barrelWidthHist( std::string name, std::string title );
110  MonitorElement *endcapWidthHist( std::string name, std::string title );
111 
112  std::map<uint32_t,timing> synchroMap;
113  int counter;
117  std::map<uint32_t, std::map<std::string, MonitorElement*> > meCollection;
118 
119  std::string nameInLog;
122  std::string RootFileName;
123 };
124 
125 #endif
int late_all[4]
MonitorElement * endcapOffsetHist(std::string name, std::string title)
void readRPCDAQStrips(const edm::Event &iEvent)
int late() const
virtual void endJob(void)
int early_w2() const
std::map< uint32_t, std::map< std::string, MonitorElement * > > meCollection
float offset() const
DQMStore * dbe
back-end interface
int late_w2() const
float lateFraction() const
virtual void analyze(const edm::Event &, const edm::EventSetup &)
float width() const
float inTimeFraction() const
MonitorElement * h1
int iEvent
Definition: GenABIO.cc:243
MonitorElement * endcapWidthHist(std::string name, std::string title)
T sqrt(T t)
Definition: SSEVec.h:46
std::string nameInLog
float outOfTimeFraction() const
RPCMonitorSync(const edm::ParameterSet &)
int early_w() const
int early_all[4]
int inTime
int late_w() const
int saveRootFileEventsInterval
std::map< uint32_t, timing > synchroMap
std::string RootFileName
float earlyFraction() const
MonitorElement * barrelWidthHist(std::string name, std::string title)
int early() const
MonitorElement * barrelOffsetHist(std::string name, std::string title)
Log messages.
std::map< std::string, MonitorElement * > bookDetUnitME(RPCDetId &detId)
Booking of MonitoringElemnt for one RPCDetId (= roll)