CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
RPCMonitorRaw Class Reference

#include <RPCMonitorRaw.h>

Inheritance diagram for RPCMonitorRaw:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 get data, convert to digis attach againe to Event More...
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
 RPCMonitorRaw (const edm::ParameterSet &cfg)
 
virtual ~RPCMonitorRaw ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

MonitorElementme_e [3]
 
MonitorElementme_mapBadEvents
 
MonitorElementme_mapGoodEvents
 
MonitorElementme_t [3]
 
edm::EDGetTokenT
< RPCRawDataCounts
rpcRawDataCountsTag_
 
edm::ParameterSet theConfig
 
unsigned int theWatchedErrorHistoPos [10]
 
std::vector< MonitorElement * > theWatchedErrorHistos [3]
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Analyse errors in raw data stream as RPCRawDataCounts produced by RPCRawToDigi

Definition at line 20 of file RPCMonitorRaw.h.

Constructor & Destructor Documentation

RPCMonitorRaw::RPCMonitorRaw ( const edm::ParameterSet cfg)
explicit

Definition at line 28 of file RPCMonitorRaw.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, rpcRawDataCountsTag_, and theWatchedErrorHistoPos.

28  :theConfig(cfg){
29 
30  rpcRawDataCountsTag_ = consumes<RPCRawDataCounts>(cfg.getParameter<edm::InputTag>("rpcRawDataCountsTag"));
31 
32  for (unsigned int i=0; i<10;i++) theWatchedErrorHistoPos[i]=0;
33  std::vector<int> algos = cfg.getUntrackedParameter<std::vector<int> >("watchedErrors");
34  for (std::vector<int>::const_iterator it=algos.begin();it!= algos.end(); ++it) {
35  unsigned int ialgo = *it;
36  if (ialgo < 10) theWatchedErrorHistoPos[ialgo]=1; // real position initialisain is in begin job. here mark just switched on.
37  }
38 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< RPCRawDataCounts > rpcRawDataCountsTag_
Definition: RPCMonitorRaw.h:49
edm::ParameterSet theConfig
Definition: RPCMonitorRaw.h:40
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:44
RPCMonitorRaw::~RPCMonitorRaw ( )
virtual

Definition at line 40 of file RPCMonitorRaw.cc.

References LogTrace.

40 { LogTrace("") << "RPCMonitorRaw destructor"; }
#define LogTrace(id)

Member Function Documentation

void RPCMonitorRaw::analyze ( const edm::Event ev,
const edm::EventSetup es 
)
virtual

get data, convert to digis attach againe to Event

Implements edm::EDAnalyzer.

Definition at line 104 of file RPCMonitorRaw.cc.

References LinkBoardElectronicIndex::dccInputChannelNum, relativeConstraints::error, MonitorElement::Fill(), edm::Event::getByToken(), customizeTrackingMonitorSeedNumber::idx, me_e, me_mapBadEvents, me_mapGoodEvents, me_t, edm::Handle< T >::product(), rpcRawDataCountsTag_, LinkBoardElectronicIndex::tbLinkInputNum, RPCRawDataCounts::theBadEvents, RPCRawDataCounts::theGoodEvents, RPCRawDataCounts::theReadoutErrors, RPCRawDataCounts::theRecordTypes, theWatchedErrorHistoPos, theWatchedErrorHistos, rpcrawtodigi::ReadoutError::type(), and rpcrawtodigi::ReadoutError::where().

105 {
106 
108  ev.getByToken(rpcRawDataCountsTag_, rawCounts);
109  const RPCRawDataCounts & counts = *rawCounts.product();
110 
111  //
112  // record type
113  //
114  for (IT it=counts.theRecordTypes.begin(); it != counts.theRecordTypes.end(); ++it)
115  me_t[it->first.first-790]->Fill(it->first.second,it->second);
116 
117  //
118  // good events topology
119  //
120  for (IT it = counts.theGoodEvents.begin(); it != counts.theGoodEvents.end(); ++it)
121  me_mapGoodEvents->Fill(it->first.second, it->first.first, it->second);
122 
123  //
124  // bad events topology
125  //
126  for (IT it = counts.theBadEvents.begin(); it != counts.theBadEvents.end(); ++it)
127  me_mapBadEvents->Fill(it->first.second, it->first.first, it->second);
128 
129 
130  //
131  // readout errors
132  //
133  for (IT it=counts.theReadoutErrors.begin(); it != counts.theReadoutErrors.end(); ++it) {
134  rpcrawtodigi::ReadoutError error(it->first.second);
135  LinkBoardElectronicIndex ele = error.where();
137 
138  int fed = it->first.first;
139  me_e[fed-790]->Fill(type, it->second);
140 
141  //
142  // in addition fill location map for selected errors
143  //
145  if ( idx >= 0) {
146  std::vector<MonitorElement* > & wh = theWatchedErrorHistos[fed-790];
147  MonitorElement* me = wh[idx];
148  me->Fill(ele.dccInputChannelNum, ele.tbLinkInputNum, it->second);
149  }
150  }
151 
152 
153 // for (int i=0; i<3; ++i) {
154 // me_t[i]->update();
155 // me_e[i]->update();
156 // std::vector<MonitorElement* > & wh = theWatchedErrorHistos[i];
157 // for (std::vector<MonitorElement* >::iterator it=wh.begin(); it != wh.end(); ++it) (*it)->update();
158 // }
159 // me_mapGoodEvents->update();
160 // me_mapBadEvents->update();
161 
162 
163 
164 }
std::map< std::pair< int, int >, int > theReadoutErrors
type
Definition: HCALResponse.h:21
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:38
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:41
void Fill(long long x)
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:37
edm::EDGetTokenT< RPCRawDataCounts > rpcRawDataCountsTag_
Definition: RPCMonitorRaw.h:49
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:35
std::map< std::pair< int, int >, int > theGoodEvents
std::vector< LinkConnSpec >::const_iterator IT
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:44
std::map< std::pair< int, int >, int > theRecordTypes
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
T const * product() const
Definition: Handle.h:81
std::map< std::pair< int, int >, int > theBadEvents
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:36
void RPCMonitorRaw::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 42 of file RPCMonitorRaw.cc.

42 {}
void RPCMonitorRaw::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 45 of file RPCMonitorRaw.cc.

References DQMStore::book1D(), DQMStore::book2D(), RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(), RPCRawDataCountsHistoMaker::emptyReadoutErrorMapHisto(), RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(), getTH1F(), MonitorElement::getTH2F(), timingPdfMaker::histo, i, me_e, me_mapBadEvents, me_mapGoodEvents, me_t, cppFunctionSkipper::operator, DQMStore::setCurrentFolder(), theWatchedErrorHistoPos, and theWatchedErrorHistos.

45  {
46 // Get DQM interface
47  DQMStore* theDMBE = edm::Service<DQMStore>().operator->();
48 
49  theDMBE->setCurrentFolder("RPC/LinkMonitor");
50 
51  me_t[0]=theDMBE->book1D("recordType_790",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(790));
52  me_t[1]=theDMBE->book1D("recordType_791",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(791));
53  me_t[2]=theDMBE->book1D("recordType_792",RPCRawDataCountsHistoMaker::emptyRecordTypeHisto(792));
54  for (int i=0;i<3;++i)me_t[i]->getTH1F()->SetStats(0);
55 
56  me_e[0]=theDMBE->book1D("readoutErrors_790",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(790));
57  me_e[1]=theDMBE->book1D("readoutErrors_791",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(791));
58  me_e[2]=theDMBE->book1D("readoutErrors_792",RPCRawDataCountsHistoMaker::emptyReadoutErrorHisto(792));
59  for (int i=0;i<3;++i)me_e[i]->getTH1F()->SetStats(0);
60 
61  me_mapGoodEvents=theDMBE->book2D("mapGoodRecords","mapGoodRecords",36,-0.5,35.5, 3, 789.5,792.5);
62  me_mapGoodEvents->getTH2F()->SetNdivisions(3,"y");
63  me_mapGoodEvents->getTH2F()->SetXTitle("rmb");
64  me_mapGoodEvents->getTH2F()->SetYTitle("fed");
65  me_mapGoodEvents->getTH2F()->SetStats(0);
66  me_mapBadEvents =theDMBE->book2D("mapErrorRecords", "mapErrorRecords", 36,-0.5,35.5, 3, 789.5,792.5);
67  me_mapBadEvents->getTH2F()->SetXTitle("fed");
68  me_mapBadEvents->getTH2F()->SetYTitle("rmb");
69  me_mapBadEvents->getTH2F()->SetNdivisions(3,"y");
70  me_mapBadEvents->getTH2F()->SetStats(0);
71 
72  for (unsigned int i=0; i<=9; ++i) {
74  for (unsigned int fed=790; fed <=792; ++fed) {
76  MonitorElement* watched = theDMBE->book2D(histo->GetName(),histo);
77  theWatchedErrorHistos[fed-790].push_back(watched);
79  }
80  }
81  }
82 
83 }
int i
Definition: DBlmapReader.cc:9
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:38
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:41
static TH1F * emptyReadoutErrorHisto(int fedId)
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:37
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:35
static TH2F * emptyReadoutErrorMapHisto(int fedId, int type)
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
unsigned int theWatchedErrorHistoPos[10]
Definition: RPCMonitorRaw.h:44
static TH1F * emptyRecordTypeHisto(int fedId)
TH2F * getTH2F(void) const
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:36
void RPCMonitorRaw::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file RPCMonitorRaw.cc.

References f, MonitorElement::getTH1F(), MonitorElement::getTH2F(), edm::ParameterSet::getUntrackedParameter(), histoFile, i, me_e, me_mapBadEvents, me_mapGoodEvents, me_t, AlCaHLTBitMon_QueryRunRegistry::string, theConfig, and theWatchedErrorHistos.

85 {
86 bool writeHistos = theConfig.getUntrackedParameter<bool>("writeHistograms", false);
87  if (writeHistos) {
89  TFile f(histoFile.c_str(),"RECREATE");
90  for (int i=0; i<3; ++i) {
91  me_t[i]->getTH1F()->Write();
92  me_e[i]->getTH1F()->Write();
93  std::vector<MonitorElement* > & wh = theWatchedErrorHistos[i];
94  for (std::vector<MonitorElement* >::const_iterator it=wh.begin(); it != wh.end(); ++it)(*it)->getTH2F()->Write();
95  }
96  me_mapGoodEvents->getTH2F()->Write();
97  me_mapBadEvents->getTH2F()->Write();
98  edm::LogInfo(" END JOB, histos saved!");
99  f.Close();
100  }
101 }
TFile * histoFile
Definition: hcalCalib.cc:44
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * me_mapBadEvents
Definition: RPCMonitorRaw.h:38
std::vector< MonitorElement * > theWatchedErrorHistos[3]
Definition: RPCMonitorRaw.h:41
MonitorElement * me_mapGoodEvents
Definition: RPCMonitorRaw.h:37
MonitorElement * me_t[3]
Definition: RPCMonitorRaw.h:35
edm::ParameterSet theConfig
Definition: RPCMonitorRaw.h:40
double f[11][100]
TH1F * getTH1F(void) const
TH2F * getTH2F(void) const
MonitorElement * me_e[3]
Definition: RPCMonitorRaw.h:36

Member Data Documentation

MonitorElement* RPCMonitorRaw::me_e[3]
private

Definition at line 36 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and endJob().

MonitorElement* RPCMonitorRaw::me_mapBadEvents
private

Definition at line 38 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and endJob().

MonitorElement* RPCMonitorRaw::me_mapGoodEvents
private

Definition at line 37 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and endJob().

MonitorElement* RPCMonitorRaw::me_t[3]
private

Definition at line 35 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and endJob().

edm::EDGetTokenT<RPCRawDataCounts> RPCMonitorRaw::rpcRawDataCountsTag_
private

Definition at line 49 of file RPCMonitorRaw.h.

Referenced by analyze(), and RPCMonitorRaw().

edm::ParameterSet RPCMonitorRaw::theConfig
private

Definition at line 40 of file RPCMonitorRaw.h.

Referenced by endJob().

unsigned int RPCMonitorRaw::theWatchedErrorHistoPos[10]
private

Definition at line 44 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and RPCMonitorRaw().

std::vector<MonitorElement* > RPCMonitorRaw::theWatchedErrorHistos[3]
private

Definition at line 41 of file RPCMonitorRaw.h.

Referenced by analyze(), beginRun(), and endJob().