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  setElectronicsMap(_es);
37 }
38 
39 template <int SUBDET>
41  _ibooker.cd();
42 
44 
45  if (SUBDET == EcalBarrel || SUBDET < 0) {
46  _ibooker.setCurrentFolder("EcalBarrel/" + folderName_);
47 
48  name = "FEDEntries";
49  MEs_[kEBOccupancy] = _ibooker.book1D(name, name, 36, 610, 646);
50 
51  name = "FEDFatal";
52  MEs_[kEBFatal] = _ibooker.book1D(name, name, 36, 610, 646);
53 
54  name = "FEDNonFatal";
55  MEs_[kEBNonFatal] = _ibooker.book1D(name, name, 36, 610, 646);
56  }
57  if (SUBDET == EcalEndcap || SUBDET < 0) {
58  _ibooker.setCurrentFolder("EcalEndcap/" + folderName_);
59 
60  name = "FEDEntries";
61  MEs_[kEEOccupancy] = _ibooker.book1D(name, name, 54, 601, 655);
62 
63  name = "FEDFatal";
64  MEs_[kEEFatal] = _ibooker.book1D(name, name, 54, 601, 655);
65 
66  name = "FEDNonFatal";
67  MEs_[kEENonFatal] = _ibooker.book1D(name, name, 54, 601, 655);
68  }
69 }
70 
71 template <int SUBDET>
74  if (_evt.getByToken(FEDRawDataToken_, fedHndl)) {
75  for (unsigned fedId(601); fedId <= 654; fedId++) {
76  if (SUBDET == EcalBarrel && (fedId < 610 || fedId > 645))
77  continue;
78  if (SUBDET == EcalEndcap && (fedId > 609 && fedId < 646))
79  continue;
80 
81  unsigned occupancy(-1);
82  // unsigned fatal(-1);
83  if (fedId < 610 || fedId > 645) {
84  occupancy = kEEOccupancy;
85  // fatal = kEEFatal;
86  } else {
87  occupancy = kEBOccupancy;
88  // fatal = kEBFatal;
89  }
90 
91  const FEDRawData& fedData(fedHndl->FEDData(fedId));
92  unsigned length(fedData.size() / sizeof(uint64_t));
93 
94  if (length > 1) { // FED header is one 64 bit word
95  MEs_[occupancy]->Fill(fedId + 0.5);
96 
97  // const uint64_t* pData(reinterpret_cast<const uint64_t*>(fedData.data()));
98  // bool crcError(((pData[length - 1] >> 2) & 0x1) == 0x1);
99 
100  // if(crcError) MEs_[fatal]->Fill(fedId + 0.5);
101  }
102  }
103  }
104 
108 
109  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainErrorsToken_, ebHndl)) {
110  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
111  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
112  unsigned iDCC(ecaldqm::dccId(*ebItr, GetElectronicsMap()) - 1);
113 
114  double normalization(ecaldqm::nCrystals(iDCC + 1));
115  if (normalization < 1.)
116  continue;
117 
118  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
119  }
120  }
121  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainErrorsToken_, eeHndl)) {
122  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
123  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
124  unsigned iDCC(ecaldqm::dccId(*eeItr, GetElectronicsMap()) - 1);
125 
126  double normalization(ecaldqm::nCrystals(iDCC + 1));
127  if (normalization < 1.)
128  continue;
129 
130  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
131  }
132  }
133 
134  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebChIdErrorsToken_, ebHndl)) {
135  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
136  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
137  unsigned iDCC(ecaldqm::dccId(*ebItr, GetElectronicsMap()) - 1);
138 
139  double normalization(ecaldqm::nCrystals(iDCC + 1));
140  if (normalization < 1.)
141  continue;
142 
143  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
144  }
145  }
146  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeChIdErrorsToken_, eeHndl)) {
147  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
148  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
149  unsigned iDCC(ecaldqm::dccId(*eeItr, GetElectronicsMap()) - 1);
150 
151  double normalization(ecaldqm::nCrystals(iDCC + 1));
152  if (normalization < 1.)
153  continue;
154 
155  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
156  }
157  }
158 
159  if ((SUBDET == EcalBarrel || SUBDET < 0) && _evt.getByToken(ebGainSwitchErrorsToken_, ebHndl)) {
160  EBDetIdCollection::const_iterator ebEnd(ebHndl->end());
161  for (EBDetIdCollection::const_iterator ebItr(ebHndl->begin()); ebItr != ebEnd; ++ebItr) {
162  unsigned iDCC(ecaldqm::dccId(*ebItr, GetElectronicsMap()) - 1);
163 
164  double normalization(ecaldqm::nCrystals(iDCC + 1));
165  if (normalization < 1.)
166  continue;
167 
168  MEs_[kEBNonFatal]->Fill(iDCC + 601.5, 1. / normalization);
169  }
170  }
171  if ((SUBDET == EcalEndcap || SUBDET < 0) && _evt.getByToken(eeGainSwitchErrorsToken_, eeHndl)) {
172  EEDetIdCollection::const_iterator eeEnd(eeHndl->end());
173  for (EEDetIdCollection::const_iterator eeItr(eeHndl->begin()); eeItr != eeEnd; ++eeItr) {
174  unsigned iDCC(ecaldqm::dccId(*eeItr, GetElectronicsMap()) - 1);
175 
176  double normalization(ecaldqm::nCrystals(iDCC + 1));
177  if (normalization < 1.)
178  continue;
179 
180  MEs_[kEENonFatal]->Fill(iDCC + 601.5, 1. / normalization);
181  }
182  }
183 
184  if (_evt.getByToken(towerIdErrorsToken_, eleHndl)) {
186  for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) {
187  unsigned iDCC(eleItr->dccId() - 1);
188 
189  unsigned nonfatal(-1);
190  if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh)
191  nonfatal = kEBNonFatal;
192  else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow))
193  nonfatal = kEENonFatal;
194  else
195  continue;
196 
197  double normalization(ecaldqm::nCrystals(iDCC + 1));
198  if (normalization < 1.)
199  continue;
200 
201  MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization);
202  }
203  }
204 
205  if (_evt.getByToken(blockSizeErrorsToken_, eleHndl)) {
207  for (EcalElectronicsIdCollection::const_iterator eleItr(eleHndl->begin()); eleItr != eleEnd; ++eleItr) {
208  unsigned iDCC(eleItr->dccId() - 1);
209 
210  unsigned nonfatal(-1);
211  if ((SUBDET == EcalBarrel || SUBDET < 0) && iDCC >= ecaldqm::kEBmLow && iDCC <= ecaldqm::kEBpHigh)
212  nonfatal = kEBNonFatal;
213  else if ((SUBDET == EcalEndcap || SUBDET < 0) && (iDCC <= ecaldqm::kEEmHigh || iDCC >= ecaldqm::kEEpLow))
214  nonfatal = kEENonFatal;
215  else
216  continue;
217 
218  double normalization(ecaldqm::nCrystals(iDCC + 1));
219  if (normalization < 1.)
220  continue;
221 
222  MEs_[nonfatal]->Fill(iDCC + 601.5, 25. / normalization);
223  }
224  }
225 }
226 
227 template <int SUBDET>
230  _es.get<EcalMappingRcd>().get(elecMapHandle);
231  electronicsMap = elecMapHandle.product();
232 }
233 
234 template <int SUBDET>
236  if (!electronicsMap)
237  throw cms::Exception("InvalidCall") << "Electronics Mapping not initialized";
238  return electronicsMap;
239 }
240 
244 
PostProcessor_cff.normalization
normalization
Definition: PostProcessor_cff.py:9
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalElectronicsMapping
Definition: EcalElectronicsMapping.h:28
edm::EDCollection::begin
const_iterator begin() const
Definition: EDCollection.h:117
EcalFEDMonitor
EcalFEDMonitorTemp<-1 > EcalFEDMonitor
Definition: EcalFEDMonitor.cc:243
EcalFEDMonitorTemp::eeGainSwitchErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeGainSwitchErrorsToken_
Definition: EcalFEDMonitor.h:55
edm::Run
Definition: Run.h:45
FEDRawDataCollection
Definition: FEDRawDataCollection.h:18
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
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:171
EcalFEDMonitor.h
EcalFEDMonitorTemp::ebChIdErrorsToken_
edm::EDGetTokenT< EBDetIdCollection > ebChIdErrorsToken_
Definition: EcalFEDMonitor.h:52
edm::Handle< FEDRawDataCollection >
EcalFEDMonitorTemp::EcalFEDMonitorTemp
EcalFEDMonitorTemp(edm::ParameterSet const &)
Definition: EcalFEDMonitor.cc:6
EcalFEDMonitorTemp::eeChIdErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeChIdErrorsToken_
Definition: EcalFEDMonitor.h:53
EcalBarrel
Definition: EcalSubdetector.h:10
FEDRawData
Definition: FEDRawData.h:19
MakerMacros.h
EcalFEDMonitorTemp::eeGainErrorsToken_
edm::EDGetTokenT< EEDetIdCollection > eeGainErrorsToken_
Definition: EcalFEDMonitor.h:51
edm::EDCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: EDCollection.h:19
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
EcalFEDMonitorTemp::analyze
void analyze(edm::Event const &, edm::EventSetup const &) override
Definition: EcalFEDMonitor.cc:72
edm::ESHandle< EcalElectronicsMapping >
dqm::implementation::NavigatorBase::cd
virtual void cd()
Definition: DQMStore.cc:29
ecaldqm::kEBpHigh
Definition: EcalDQMCommonUtils.h:87
EcalFEDMonitorTemp::GetElectronicsMap
const EcalElectronicsMapping * GetElectronicsMap()
Definition: EcalFEDMonitor.cc:235
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
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:50
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalSubdetector.h
EcalEndcap
Definition: EcalSubdetector.h:10
edm::ParameterSet
Definition: ParameterSet.h:47
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:40
ecaldqm::kEBmLow
Definition: EcalDQMCommonUtils.h:84
edm::EventSetup
Definition: EventSetup.h:58
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
get
#define get
edm::EDCollection
Definition: EDCollection.h:16
ecaldqm::dccId
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
Definition: EcalDQMCommonUtils.cc:16
EBHltTask
EcalFEDMonitorTemp< EcalBarrel > EBHltTask
Definition: EcalFEDMonitor.cc:241
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:54
EcalFEDMonitorTemp
Definition: EcalFEDMonitor.h:30
ecaldqm::kEEpLow
Definition: EcalDQMCommonUtils.h:82
Exception
Definition: hltDiff.cc:245
EcalFEDMonitorTemp::setElectronicsMap
void setElectronicsMap(edm::EventSetup const &)
Definition: EcalFEDMonitor.cc:228
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
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:242
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
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