CMS 3D CMS Logo

EcalFEDMonitor.cc
Go to the documentation of this file.
4 
5 template <int SUBDET>
7  : folderName_(_ps.getUntrackedParameter<std::string>("folderName")),
8  FEDRawDataToken_(consumes<FEDRawDataCollection>(_ps.getParameter<edm::InputTag>("FEDRawDataCollection"))),
9  ebGainErrorsToken_(),
10  eeGainErrorsToken_(),
11  ebChIdErrorsToken_(),
12  eeChIdErrorsToken_(),
13  ebGainSwitchErrorsToken_(),
14  eeGainSwitchErrorsToken_(),
15  towerIdErrorsToken_(
16  consumes<EcalElectronicsIdCollection>(_ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection1"))),
17  blockSizeErrorsToken_(
18  consumes<EcalElectronicsIdCollection>(_ps.getParameter<edm::InputTag>("EcalElectronicsIdCollection2"))),
19  MEs_(nMEs, nullptr) {
20  if (_ps.existsAs<edm::InputTag>("EBDetIdCollection1"))
21  ebGainErrorsToken_ = consumes<EBDetIdCollection>(_ps.getParameter<edm::InputTag>("EBDetIdCollection1"));
22  if (_ps.existsAs<edm::InputTag>("EEDetIdCollection1"))
23  eeGainErrorsToken_ = consumes<EEDetIdCollection>(_ps.getParameter<edm::InputTag>("EEDetIdCollection1"));
24  if (_ps.existsAs<edm::InputTag>("EBDetIdCollection2"))
25  ebChIdErrorsToken_ = consumes<EBDetIdCollection>(_ps.getParameter<edm::InputTag>("EBDetIdCollection2"));
26  if (_ps.existsAs<edm::InputTag>("EEDetIdCollection2"))
27  eeChIdErrorsToken_ = consumes<EEDetIdCollection>(_ps.getParameter<edm::InputTag>("EEDetIdCollection2"));
28  if (_ps.existsAs<edm::InputTag>("EBDetIdCollection3"))
29  ebGainSwitchErrorsToken_ = consumes<EBDetIdCollection>(_ps.getParameter<edm::InputTag>("EBDetIdCollection3"));
30  if (_ps.existsAs<edm::InputTag>("EEDetIdCollection3"))
31  eeGainSwitchErrorsToken_ = consumes<EEDetIdCollection>(_ps.getParameter<edm::InputTag>("EEDetIdCollection3"));
32 }
33 
34 template <int SUBDET>
36  if (!ecaldqm::checkElectronicsMap(false)) {
37  // set up ecaldqm::electronicsMap in EcalDQMCommonUtils
39  _es.get<EcalMappingRcd>().get(elecMapHandle);
40  ecaldqm::setElectronicsMap(elecMapHandle.product());
41  }
42 }
43 
44 template <int SUBDET>
46  _ibooker.cd();
47 
49 
50  if (SUBDET == EcalBarrel || SUBDET < 0) {
51  _ibooker.setCurrentFolder("EcalBarrel/" + folderName_);
52 
53  name = "FEDEntries";
54  MEs_[kEBOccupancy] = _ibooker.book1D(name, name, 36, 610, 646);
55 
56  name = "FEDFatal";
57  MEs_[kEBFatal] = _ibooker.book1D(name, name, 36, 610, 646);
58 
59  name = "FEDNonFatal";
60  MEs_[kEBNonFatal] = _ibooker.book1D(name, name, 36, 610, 646);
61  }
62  if (SUBDET == EcalEndcap || SUBDET < 0) {
63  _ibooker.setCurrentFolder("EcalEndcap/" + folderName_);
64 
65  name = "FEDEntries";
66  MEs_[kEEOccupancy] = _ibooker.book1D(name, name, 54, 601, 655);
67 
68  name = "FEDFatal";
69  MEs_[kEEFatal] = _ibooker.book1D(name, name, 54, 601, 655);
70 
71  name = "FEDNonFatal";
72  MEs_[kEENonFatal] = _ibooker.book1D(name, name, 54, 601, 655);
73  }
74 }
75 
76 template <int SUBDET>
79  if (_evt.getByToken(FEDRawDataToken_, fedHndl)) {
80  for (unsigned fedId(601); fedId <= 654; fedId++) {
81  if (SUBDET == EcalBarrel && (fedId < 610 || fedId > 645))
82  continue;
83  if (SUBDET == EcalEndcap && (fedId > 609 && fedId < 646))
84  continue;
85 
86  unsigned occupancy(-1);
87  // unsigned fatal(-1);
88  if (fedId < 610 || fedId > 645) {
89  occupancy = kEEOccupancy;
90  // fatal = kEEFatal;
91  } else {
92  occupancy = kEBOccupancy;
93  // fatal = kEBFatal;
94  }
95 
96  const FEDRawData& fedData(fedHndl->FEDData(fedId));
97  unsigned length(fedData.size() / sizeof(uint64_t));
98 
99  if (length > 1) { // FED header is one 64 bit word
100  MEs_[occupancy]->Fill(fedId + 0.5);
101 
102  // const uint64_t* pData(reinterpret_cast<const uint64_t*>(fedData.data()));
103  // bool crcError(((pData[length - 1] >> 2) & 0x1) == 0x1);
104 
105  // if(crcError) MEs_[fatal]->Fill(fedId + 0.5);
106  }
107  }
108  }
109 
113 
114  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainErrorsToken_, ebHndl)) {
115  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
116  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
117  unsigned iDCC(ecaldqm::dccId(*ebItr) - 1);
118 
119  double normalization(ecaldqm::nCrystals(iDCC + 1));
120  if (normalization < 1.)
121  continue;
122 
123  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
124  }
125  }
126  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainErrorsToken_, eeHndl)) {
127  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
128  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
129  unsigned iDCC(ecaldqm::dccId(*eeItr) - 1);
130 
131  double normalization(ecaldqm::nCrystals(iDCC + 1));
132  if (normalization < 1.)
133  continue;
134 
135  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
136  }
137  }
138 
139  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebChIdErrorsToken_, ebHndl)) {
140  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
141  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
142  unsigned iDCC(ecaldqm::dccId(*ebItr) - 1);
143 
144  double normalization(ecaldqm::nCrystals(iDCC + 1));
145  if (normalization < 1.)
146  continue;
147 
148  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
149  }
150  }
151  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeChIdErrorsToken_, eeHndl)) {
152  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
153  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
154  unsigned iDCC(ecaldqm::dccId(*eeItr) - 1);
155 
156  double normalization(ecaldqm::nCrystals(iDCC + 1));
157  if (normalization < 1.)
158  continue;
159 
160  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
161  }
162  }
163 
164  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainSwitchErrorsToken_, ebHndl)) {
165  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
166  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
167  unsigned iDCC(ecaldqm::dccId(*ebItr) - 1);
168 
169  double normalization(ecaldqm::nCrystals(iDCC + 1));
170  if (normalization < 1.)
171  continue;
172 
173  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
174  }
175  }
176  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainSwitchErrorsToken_, eeHndl)) {
177  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
178  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
179  unsigned iDCC(ecaldqm::dccId(*eeItr) - 1);
180 
181  double normalization(ecaldqm::nCrystals(iDCC + 1));
182  if (normalization < 1.)
183  continue;
184 
185  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
186  }
187  }
188 
189  if (_evt.getByToken(towerIdErrorsToken_, eleHndl)) {
191  for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) {
192  unsigned iDCC(eleItr->dccId() - 1);
193 
194  unsigned nonfatal(-1);
195  if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh)
196  nonfatal = kEBNonFatal;
197  else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow))
198  nonfatal = kEENonFatal;
199  else
200  continue;
201 
202  double normalization(ecaldqm::nCrystals(iDCC + 1));
203  if (normalization < 1.)
204  continue;
205 
206  MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization);
207  }
208  }
209 
210  if (_evt.getByToken(blockSizeErrorsToken_, eleHndl)) {
212  for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) {
213  unsigned iDCC(eleItr->dccId() - 1);
214 
215  unsigned nonfatal(-1);
216  if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh)
217  nonfatal = kEBNonFatal;
218  else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow))
219  nonfatal = kEENonFatal;
220  else
221  continue;
222 
223  double normalization(ecaldqm::nCrystals(iDCC + 1));
224  if (normalization < 1.)
225  continue;
226 
227  MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization);
228  }
229  }
230 }
231 
235 
PostProcessor_cff.normalization
normalization
Definition: PostProcessor_cff.py:9
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::EDCollection::begin
const_iterator begin() const
Definition: EDCollection.h:117
EcalFEDMonitor
EcalFEDMonitorTemp<-1 > EcalFEDMonitor
Definition: EcalFEDMonitor.cc:234
EcalFEDMonitorTemp::eeGainSwitchErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeGainSwitchErrorsToken_
Definition: EcalFEDMonitor.h:49
edm::Run
Definition: Run.h:45
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::ParameterSet::existsAs
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:160
EcalFEDMonitor.h
EcalFEDMonitorTemp::ebChIdErrorsToken_
edm::EDGetTokenT< EBDetIdCollection > ebChIdErrorsToken_
Definition: EcalFEDMonitor.h:46
edm::Handle
Definition: AssociativeIterator.h:50
EcalFEDMonitorTemp::EcalFEDMonitorTemp
EcalFEDMonitorTemp(edm::ParameterSet const &)
Definition: EcalFEDMonitor.cc:6
EcalFEDMonitorTemp::eeChIdErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeChIdErrorsToken_
Definition: EcalFEDMonitor.h:47
EcalBarrel
Definition: EcalSubdetector.h:10
FEDRawData
Definition: FEDRawData.h:19
MakerMacros.h
EcalFEDMonitorTemp::eeGainErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeGainErrorsToken_
Definition: EcalFEDMonitor.h:45
edm::EDCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: EDCollection.h:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ecaldqm::checkElectronicsMap
bool checkElectronicsMap(bool=true)
Definition: EcalDQMCommonUtils.cc:429
EcalFEDMonitorTemp::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: EcalFEDMonitor.cc:77
edm::ESHandle< EcalElectronicsMapping >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
ecaldqm::kEBpHigh
Definition: EcalDQMCommonUtils.h:88
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:528
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
EcalFEDMonitorTemp::ebGainErrorsToken_
edm::EDGetTokenT< EBDetIdCollection > ebGainErrorsToken_
Definition: EcalFEDMonitor.h:44
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::ParameterSet
Definition: ParameterSet.h:36
ecaldqm::nCrystals
unsigned nCrystals(unsigned)
Definition: EcalDQMCommonUtils.cc:334
EcalFEDMonitorTemp::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: EcalFEDMonitor.cc:45
ecaldqm::kEBmLow
Definition: EcalDQMCommonUtils.h:85
edm::EventSetup
Definition: EventSetup.h:57
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
get
#define get
edm::EDCollection
Definition: EDCollection.h:16
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
EBHltTask
EcalFEDMonitorTemp< EcalBarrel > EBHltTask
Definition: EcalFEDMonitor.cc:232
std
Definition: JetResolutionObject.h:76
HcalDetIdTransform::SUBDET
Definition: HcalDetIdTransform.h:14
EcalMappingRcd
Definition: EcalMappingRcd.h:15
EcalFEDMonitorTemp::ebGainSwitchErrorsToken_
edm::EDGetTokenT< EBDetIdCollection > ebGainSwitchErrorsToken_
Definition: EcalFEDMonitor.h:48
EcalFEDMonitorTemp
Definition: EcalFEDMonitor.h:28
ecaldqm::kEEpLow
Definition: EcalDQMCommonUtils.h:83
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
dqm::implementation::IBooker
Definition: DQMStore.h:43
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
EEHltTask
EcalFEDMonitorTemp< EcalEndcap > EEHltTask
Definition: EcalFEDMonitor.cc:233
EcalFEDMonitorTemp::dqmBeginRun
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
Definition: EcalFEDMonitor.cc:35
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
edm::EDCollection::end
const_iterator end() const
Definition: EDCollection.h:122
ecaldqm::setElectronicsMap
void setElectronicsMap(EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:444
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
ecaldqm::dccId
unsigned dccId(DetId const &)
Definition: EcalDQMCommonUtils.cc:16