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