CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCMonitorLinkSynchro.cc
Go to the documentation of this file.
7 
18 
20 
22 #include "TH1F.h"
23 #include "TH2F.h"
24 #include "TFile.h"
25 
26 //#include "UserCode/konec/test/R2DTimerObserver.h"
27 
28 
29 
31  : theConfig(cfg),
32  theSynchroStat(RPCLinkSynchroStat(theConfig.getUntrackedParameter<bool>("useFirstHitOnly", false)))
33 
34 {
35 
36  rpcRawSynchroProdItemTag_=consumes<RPCRawSynchro::ProdItem>(cfg.getParameter<edm::InputTag>("rpcRawSynchroProdItemTag"));
37 
38 }
39 
42 
44 {
45 
48 }
49 
50 
51 
52 
54 
55  if (theCablingWatcher.check(es)) {
56  edm::ESTransientHandle<RPCEMap> readoutMapping;
57  es.get<RPCEMapRcd>().get(readoutMapping);
58  RPCReadOutMapping const* cabling = readoutMapping->convert();
59  edm::LogInfo("RPCMonitorLinkSynchro") << "RPCMonitorLinkSynchro - record has CHANGED!!, read map, VERSION: " << cabling->version();
60  theSynchroStat.init(cabling, theConfig.getUntrackedParameter<bool>("dumpDelays"));
61  delete cabling;
62  }
63 
65  dmbe->setCurrentFolder("RPC/LinkMonitor/");
66 
67  me_delaySummary = dmbe->book1D("delaySummary","LinkDelaySummary",8,-3.5, 4.5);
68  me_delaySummary->getTH1F()->SetStats(111);
69 
70  me_delaySpread = dmbe->book2D("delaySpread","LinkDelaySpread",71,-3.05, 4.05, 31,-0.05,3.05);
71  me_delaySpread->getTH2F()->SetStats(0);
72 
73  me_notComplete[0] = dmbe->book2D("notComplete790","FED790: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5);
74  me_notComplete[1] = dmbe->book2D("notComplete791","FED791: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5);
75  me_notComplete[2] = dmbe->book2D("notComplete792","FED792: not All Paths hit",36,-0.5,35.5,18,-0.5,17.5);
76  for (unsigned int i=0;i<3;++i) {
77  me_notComplete[i]->getTH2F()->GetXaxis()->SetNdivisions(512);
78  me_notComplete[i]->getTH2F()->GetYaxis()->SetNdivisions(505);
79  me_notComplete[i]->getTH2F()->SetXTitle("rmb");
80  me_notComplete[i]->getTH2F()->SetYTitle("link");
81  me_notComplete[i]->getTH2F()->SetStats(0);
82  }
83  me_topOccup = dmbe->book2D("topOccup","Top10 LinkBoard occupancy",8,-0.5,7.5, 10,0.,10.);
84  me_topSpread = dmbe->book2D("topSpread","Top10 LinkBoard delay spread",8,-0.5,7.5, 10,0.,10.);
85  me_topOccup->getTH2F()->GetXaxis()->SetNdivisions(110);
86  me_topSpread->getTH2F()->GetXaxis()->SetNdivisions(110);
87  me_topOccup->getTH2F()->SetStats(0);
88  me_topSpread->getTH2F()->SetStats(0);
89 
90 }
91 
93 {
94  TObjArray result;
95  result.Add(me_delaySummary->getTH1F());
96  result.Add(me_delaySpread->getTH2F());
97  result.Add(me_topOccup->getTH2F());
98  result.Add(me_topSpread->getTH2F());
99  for (unsigned int i=0;i<=2;i++) result.Add(me_notComplete[i]->getTH2F());
100  return result;
101 }
102 
103 
105 {
106  if (theConfig.getUntrackedParameter<bool>("dumpDelays")) edm::LogInfo("RPCMonitorLinkSynchro DumpDelays") << theSynchroStat.dumpDelays();
107 }
108 
110 {
112  ev.getByToken(rpcRawSynchroProdItemTag_, synchroCounts);
113  std::vector<LinkBoardElectronicIndex> problems;
114  const RPCRawSynchro::ProdItem &vItem = select(*synchroCounts.product(), ev,es);
115  theSynchroStat.add(vItem, problems);
116 
117  for (std::vector<LinkBoardElectronicIndex>::const_iterator it=problems.begin(); it != problems.end(); ++it) {
118  me_notComplete[it->dccId-790]->Fill(it->dccInputChannelNum,it->tbLinkInputNum);
119  }
120 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void init(const RPCReadOutMapping *theCabling, bool addChamberInfo)
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
std::vector< std::pair< LinkBoardElectronicIndex, int > > ProdItem
Definition: RPCRawSynchro.h:9
MonitorElement * me_topOccup
virtual void analyze(const edm::Event &, const edm::EventSetup &)
RPCMonitorLinkSynchro(const edm::ParameterSet &cfg)
MonitorElement * me_topSpread
RPCLinkSynchroStat theSynchroStat
virtual const RPCRawSynchro::ProdItem & select(const RPCRawSynchro::ProdItem &v, const edm::Event &, const edm::EventSetup &)
void Fill(long long x)
MonitorElement * me_delaySpread
edm::ESWatcher< RPCEMapRcd > theCablingWatcher
const std::string & version() const
version as string
tuple result
Definition: query.py:137
edm::EDGetTokenT< RPCRawSynchro::ProdItem > rpcRawSynchroProdItemTag_
MonitorElement * me_notComplete[3]
void add(const RPCRawSynchro::ProdItem &counts, std::vector< LinkBoardElectronicIndex > &problems)
const T & get() const
Definition: EventSetup.h:55
TH1F * getTH1F(void) const
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
T const * product() const
Definition: Handle.h:81
edm::ParameterSet theConfig
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:58
virtual void endLuminosityBlock(const edm::LuminosityBlock &, const edm::EventSetup &)
void fill(TH1F *hDelay, TH2F *hDelaySpread, TH2F *hTopOccup, TH2F *hTopSpread) const
virtual TObjArray histos() const
volatile std::atomic< bool > shutdown_flag false
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * me_delaySummary
Definition: Run.h:41