CMS 3D CMS Logo

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

#include <RawDataTask.h>

Inheritance diagram for ecaldqm::RawDataTask:
ecaldqm::DQWorkerTask ecaldqm::DQWorker

Public Types

enum  Constants { nEventTypes = 25 }
 
- Public Types inherited from ecaldqm::DQWorkerTask
typedef
EcalDCCHeaderBlock::EcalDCCEventSettings 
EventSettings
 

Public Member Functions

void addDependencies (DependencySet &) override
 
bool analyze (void const *, Collections) override
 
void beginEvent (edm::Event const &, edm::EventSetup const &, bool const &, bool &) override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 RawDataTask ()
 
void runOnRawData (EcalRawDataCollection const &)
 
void runOnSource (FEDRawDataCollection const &)
 
 ~RawDataTask () override
 
- Public Member Functions inherited from ecaldqm::DQWorkerTask
 DQWorkerTask ()
 
virtual void endEvent (edm::Event const &, edm::EventSetup const &)
 
virtual bool filterRunType (short const *)
 
virtual bool filterTrigger (edm::TriggerResultsByName const &)
 
virtual void setTokens (edm::ConsumesCollector &)
 
 ~DQWorkerTask () override
 
- Public Member Functions inherited from ecaldqm::DQWorker
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void bookMEs (DQMStore::IBooker &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
EcalDQMSetupObjects const getEcalDQMSetupObjects ()
 
EcalElectronicsMapping const * GetElectronicsMap ()
 
CaloGeometry const * GetGeometry ()
 
std::string const & getName () const
 
CaloTopology const * GetTopology ()
 
EcalTrigTowerConstituentsMap
const * 
GetTrigTowerMap ()
 
bool onlineMode () const
 
virtual void releaseMEs ()
 
void setEventNumber (edm::EventNumber_t _e)
 
void setLumiNumber (edm::LuminosityBlockNumber_t _l)
 
void setRunNumber (edm::RunNumber_t _r)
 
void setSetupObjects (edm::EventSetup const &)
 
void setSetupObjectsEndLumi (edm::EventSetup const &)
 
void setTime (time_t _t)
 
void setTokens (edm::ConsumesCollector &)
 
virtual ~DQWorker () noexcept(false)
 

Private Attributes

int bx_
 
int feL1Offset_
 
int l1A_
 
int orbit_
 
edm::RunNumber_t runNumber_
 
short triggerType_
 

Additional Inherited Members

- Static Public Member Functions inherited from ecaldqm::DQWorkerTask
static void fillDescriptions (edm::ParameterSetDescription &)
 
- Static Public Member Functions inherited from ecaldqm::DQWorker
static void fillDescriptions (edm::ParameterSetDescription &_desc)
 
- Public Attributes inherited from ecaldqm::DQWorker
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
elecMapHandle
 
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
elecMapHandleEndLumi
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandle
 
edm::ESGetToken< CaloGeometry,
CaloGeometryRecord
geomHandleEndLumi
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandle
 
edm::ESGetToken< CaloTopology,
CaloTopologyRecord
topoHandleEndLumi
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandle
 
edm::ESGetToken
< EcalTrigTowerConstituentsMap,
IdealGeometryRecord
ttMapHandleEndLumi
 
- Protected Types inherited from ecaldqm::DQWorker
typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Protected Member Functions inherited from ecaldqm::DQWorkerTask
void setME (edm::ParameterSet const &) final
 
- Protected Member Functions inherited from ecaldqm::DQWorker
void initialize (std::string const &_name, edm::ParameterSet const &)
 
void print_ (std::string const &, int=0) const
 
virtual void setParams (edm::ParameterSet const &)
 
virtual void setSource (edm::ParameterSet const &)
 
void setVerbosity (int _verbosity)
 
- Protected Attributes inherited from ecaldqm::DQWorker
bool booked_
 
MESetCollection MEs_
 
std::string name_
 
bool onlineMode_
 
Timestamp timestamp_
 
int verbosity_
 
bool willConvertToEDM_
 

Detailed Description

Definition at line 12 of file RawDataTask.h.

Member Enumeration Documentation

Enumerator
nEventTypes 

Definition at line 27 of file RawDataTask.h.

Constructor & Destructor Documentation

ecaldqm::RawDataTask::RawDataTask ( )
ecaldqm::RawDataTask::~RawDataTask ( )
inlineoverride

Definition at line 15 of file RawDataTask.h.

15 {}

Member Function Documentation

void ecaldqm::RawDataTask::addDependencies ( DependencySet _dependencies)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 18 of file RawDataTask.cc.

References ecaldqm::kEcalRawData, ecaldqm::kSource, and ecaldqm::DependencySet::push_back().

18  {
19  _dependencies.push_back(Dependency(kEcalRawData, kSource));
20  }
bool ecaldqm::RawDataTask::analyze ( void const *  _p,
Collections  _collection 
)
inlineoverridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 38 of file RawDataTask.h.

References ecaldqm::kEcalRawData, ecaldqm::kSource, runOnRawData(), and runOnSource().

38  {
39  switch (_collection) {
40  case kSource:
41  if (_p)
42  runOnSource(*static_cast<FEDRawDataCollection const*>(_p));
43  return true;
44  break;
45  case kEcalRawData:
46  if (_p)
47  runOnRawData(*static_cast<EcalRawDataCollection const*>(_p));
48  return true;
49  break;
50  default:
51  break;
52  }
53  return false;
54  }
void runOnRawData(EcalRawDataCollection const &)
Definition: RawDataTask.cc:66
void runOnSource(FEDRawDataCollection const &)
Definition: RawDataTask.cc:45
void ecaldqm::RawDataTask::beginEvent ( edm::Event const &  _evt,
edm::EventSetup const &  ,
bool const &  ByLumiResetSwitch,
bool &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 24 of file RawDataTask.cc.

References ecaldqm::MESetCollection::at(), edm::EventBase::bunchCrossing(), bx_, edm::EventBase::experimentType(), feL1Offset_, ecaldqm::DQWorker::GetElectronicsMap(), edm::EventBase::isRealData(), l1A_, ecaldqm::DQWorker::MEs_, LumiConstants::numBX, orbit_, edm::EventBase::orbitNumber(), ecaldqm::MESet::reset(), and triggerType_.

24  {
25  orbit_ = _evt.orbitNumber() & 0xffffffff;
26 
27  bx_ = _evt.bunchCrossing() & 0xfff;
28  // There's no agreement in CMS on how to label the last/first BX
29  // TCDS calls it always 3564, but some subsystems call it 0.
30  // From testing: bx_ is labeled 0, dccBX and FEBxs[iFE] labeled 3564
31  // Setting bx_ to 0 to match the other two
32  if (bx_ == LumiConstants::numBX) // 3564
33  bx_ = 0;
34 
35  triggerType_ = _evt.experimentType() & 0xf;
36  l1A_ = 0;
37  feL1Offset_ = _evt.isRealData() ? 1 : 0;
38  if (ByLumiResetSwitch) {
39  MEs_.at("DesyncByLumi").reset(GetElectronicsMap());
40  MEs_.at("FEByLumi").reset(GetElectronicsMap());
41  MEs_.at("FEStatusErrMapByLumi").reset(GetElectronicsMap());
42  }
43  }
MESet & at(const std::string &key)
Definition: MESet.h:399
static const unsigned int numBX
Definition: LumiConstants.h:8
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
virtual void reset(EcalElectronicsMapping const *, double=0., double=0., double=0.)
Definition: MESet.cc:98
void ecaldqm::RawDataTask::beginRun ( edm::Run const &  _run,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 22 of file RawDataTask.cc.

References edm::RunBase::run(), and runNumber_.

22 { runNumber_ = _run.run(); }
edm::RunNumber_t runNumber_
Definition: RawDataTask.h:30
void ecaldqm::RawDataTask::runOnRawData ( EcalRawDataCollection const &  _dcchs)

Definition at line 66 of file RawDataTask.cc.

References ecaldqm::MESetCollection::at(), edm::SortedCollection< T, SORT >::begin(), ecaldqm::BlockSize, bx_, ecaldqm::BXDesync, ecaldqm::ccuExists(), ecaldqm::ChannelId, ecaldqm::dccId(), ecaldqm::Enabled, edm::SortedCollection< T, SORT >::end(), feL1Offset_, ecaldqm::FIFOFull, ecaldqm::FIFOFullL1ADesync, ecaldqm::ForcedZS, ecaldqm::DQWorker::getEcalDQMSetupObjects(), ecaldqm::DQWorker::GetElectronicsMap(), ecaldqm::HeaderError, ecaldqm::HParity, gpuClustering::id, ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::kEEpLow, l1A_, ecaldqm::L1ABXDesync, ecaldqm::L1ADesync, ecaldqm::LinkError, ecaldqm::DQWorker::MEs_, orbit_, runNumber_, runPedHist::runType, mps_update::status, ecaldqm::Suppressed, ecaldqm::Timeout, ecaldqm::DQWorker::timestamp_, triggerType_, and ecaldqm::VParity.

Referenced by analyze().

66  {
67  using namespace std;
68 
69  MESet& meRunNumber(MEs_.at("RunNumber"));
70  MESet& meOrbit(MEs_.at("Orbit"));
71  MESet& meOrbitDiff(MEs_.at("OrbitDiff"));
72  MESet& meTriggerType(MEs_.at("TriggerType"));
73  MESet& meL1ADCC(MEs_.at("L1ADCC"));
74  MESet& meBXDCC(MEs_.at("BXDCC"));
75  MESet& meBXDCCDiff(MEs_.at("BXDCCDiff"));
76  MESet& meBXFE(MEs_.at("BXFE"));
77  MESet& meBXFEDiff(MEs_.at("BXFEDiff"));
78  MESet& meBXFEInvalid(MEs_.at("BXFEInvalid"));
79  MESet& meL1AFE(MEs_.at("L1AFE"));
80  MESet& meFEStatus(MEs_.at("FEStatus"));
81  MESet& meFEStatusErrMapByLumi(MEs_.at("FEStatusErrMapByLumi"));
82  MESet& meFEStatusMEM(MEs_.at("FEStatusMEM"));
83  MESet& meDesyncByLumi(MEs_.at("DesyncByLumi"));
84  MESet& meDesyncTotal(MEs_.at("DesyncTotal"));
85  MESet& meFEByLumi(MEs_.at("FEByLumi"));
86  MESet& meBXTCC(MEs_.at("BXTCC"));
87  MESet& meL1ATCC(MEs_.at("L1ATCC"));
88  MESet& meBXSRP(MEs_.at("BXSRP"));
89  MESet& meL1ASRP(MEs_.at("L1ASRP"));
90  MESet& meTrendNSyncErrors(MEs_.at("L1ATCC"));
91  MESet& meEventTypePreCalib(MEs_.at("EventTypePreCalib"));
92  MESet& meEventTypeCalib(MEs_.at("EventTypeCalib"));
93  MESet& meEventTypePostCalib(MEs_.at("EventTypePostCalib"));
94 
95  if (!l1A_) {
96  // majority vote on L1A.. is there no better implementation?
97  map<int, int> l1aCounts;
98  for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) {
99  l1aCounts[dcchItr->getLV1()]++;
100  }
101  int maxVote(0);
102  for (map<int, int>::iterator l1aItr(l1aCounts.begin()); l1aItr != l1aCounts.end(); ++l1aItr) {
103  if (l1aItr->second > maxVote) {
104  maxVote = l1aItr->second;
105  l1A_ = l1aItr->first;
106  }
107  }
108  }
109 
110  for (EcalRawDataCollection::const_iterator dcchItr(_dcchs.begin()); dcchItr != _dcchs.end(); ++dcchItr) {
111  int dccId(dcchItr->id());
112 
113  int dccL1A(dcchItr->getLV1());
114  short dccL1AShort(dccL1A & 0xfff);
115  int dccBX(dcchItr->getBX());
116 
117  meOrbitDiff.fill(getEcalDQMSetupObjects(), dccId, dcchItr->getOrbit() - orbit_);
118  meBXDCCDiff.fill(getEcalDQMSetupObjects(), dccId, dccBX - bx_);
119  if (dccBX == -1)
120  meBXFEInvalid.fill(getEcalDQMSetupObjects(), dccId, 68.5);
121 
122  if (dcchItr->getRunNumber() != int(runNumber_))
123  meRunNumber.fill(getEcalDQMSetupObjects(), dccId);
124  if (dcchItr->getOrbit() != orbit_)
125  meOrbit.fill(getEcalDQMSetupObjects(), dccId);
126  if (dcchItr->getBasicTriggerType() != triggerType_)
127  meTriggerType.fill(getEcalDQMSetupObjects(), dccId);
128  if (dccL1A != l1A_)
129  meL1ADCC.fill(getEcalDQMSetupObjects(), dccId);
130  if (dccBX != bx_)
131  meBXDCC.fill(getEcalDQMSetupObjects(), dccId);
132 
133  const vector<short>& feStatus(dcchItr->getFEStatus());
134  const vector<short>& feBxs(dcchItr->getFEBxs());
135  const vector<short>& feL1s(dcchItr->getFELv1());
136 
137  double feDesync(0.);
138  double statusError(0.);
139 
140  for (unsigned iFE(0); iFE < feStatus.size(); iFE++) {
141  if (!ccuExists(dccId, iFE + 1))
142  continue;
143 
144  short status(feStatus[iFE]);
145 
146  if (feBxs[iFE] != -1 && dccBX != -1) {
147  meBXFEDiff.fill(getEcalDQMSetupObjects(), dccId, feBxs[iFE] - dccBX);
148  }
149  if (feBxs[iFE] == -1)
150  meBXFEInvalid.fill(getEcalDQMSetupObjects(), dccId, iFE + 0.5);
151 
152  if (status != BXDesync && status != L1ABXDesync) { // BX desync not detected in the DCC
153  if (feBxs[iFE] != dccBX && feBxs[iFE] != -1 && dccBX != -1) {
154  meBXFE.fill(getEcalDQMSetupObjects(), dccId, iFE + 0.5);
155  feDesync += 1.;
156  }
157  }
158 
159  if (status != L1ADesync && status != L1ABXDesync) {
160  if (feL1s[iFE] + feL1Offset_ != dccL1AShort && feL1s[iFE] != -1 && dccL1AShort != 0) {
161  meL1AFE.fill(getEcalDQMSetupObjects(), dccId, iFE + 0.5);
162  feDesync += 1.;
163  }
164  }
165 
166  if (iFE >= 68) {
167  // FE Status for MEM boxes (towerIds 69 and 70)
168  // Plot contains two bins per dccId. Integer number
169  // bins correspond to towerId 69 and half integer
170  // number bins correspond to towerId 70.
171  if (iFE + 1 == 69)
172  meFEStatusMEM.fill(getEcalDQMSetupObjects(), dccId + 0.0, status);
173  else if (iFE + 1 == 70)
174  meFEStatusMEM.fill(getEcalDQMSetupObjects(), dccId + 0.5, status);
175  continue;
176  }
177 
178  DetId id(GetElectronicsMap()->dccTowerConstituents(dccId, iFE + 1).at(0));
179  meFEStatus.fill(getEcalDQMSetupObjects(), id, status);
180  // Fill FE Status Error Map with error states only
182  status != ForcedZS)
183  meFEStatusErrMapByLumi.fill(getEcalDQMSetupObjects(), id, status);
184 
185  switch (status) {
186  case Timeout:
187  case HeaderError:
188  case ChannelId:
189  case LinkError:
190  case BlockSize:
191  case L1ADesync:
192  case BXDesync:
193  case L1ABXDesync:
194  case HParity:
195  case VParity:
196  statusError += 1.;
197  break;
198  default:
199  continue;
200  }
201  }
202 
203  if (feDesync > 0.) {
204  meDesyncByLumi.fill(getEcalDQMSetupObjects(), dccId, feDesync);
205  meDesyncTotal.fill(getEcalDQMSetupObjects(), dccId, feDesync);
206  meTrendNSyncErrors.fill(getEcalDQMSetupObjects(), double(timestamp_.iLumi), feDesync);
207  }
208  if (statusError > 0.)
209  meFEByLumi.fill(getEcalDQMSetupObjects(), dccId, statusError);
210 
211  const vector<short>& tccBx(dcchItr->getTCCBx());
212  const vector<short>& tccL1(dcchItr->getTCCLv1());
213 
214  if (tccBx.size() == 4) { // EB uses tccBx[0]; EE uses all
215  if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) {
216  for (int iTCC(0); iTCC < 4; iTCC++) {
217  if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1)
218  meBXTCC.fill(getEcalDQMSetupObjects(), dccId);
219 
220  if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0)
221  meL1ATCC.fill(getEcalDQMSetupObjects(), dccId);
222  }
223  } else {
224  if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1)
225  meBXTCC.fill(getEcalDQMSetupObjects(), dccId);
226 
227  if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0)
228  meL1ATCC.fill(getEcalDQMSetupObjects(), dccId);
229  }
230  }
231 
232  short srpBx(dcchItr->getSRPBx());
233  short srpL1(dcchItr->getSRPLv1());
234 
235  if (srpBx != dccBX && srpBx != -1 && dccBX != -1)
236  meBXSRP.fill(getEcalDQMSetupObjects(), dccId);
237 
238  if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0)
239  meL1ASRP.fill(getEcalDQMSetupObjects(), dccId);
240 
241  const int calibBX(3490);
242 
243  short runType(dcchItr->getRunType() + 1);
244  if (runType < 0 || runType > 22)
245  runType = 0;
246  if (dccBX < calibBX)
247  meEventTypePreCalib.fill(getEcalDQMSetupObjects(), dccId, runType, 1. / 54.);
248  else if (dccBX == calibBX)
249  meEventTypeCalib.fill(getEcalDQMSetupObjects(), dccId, runType, 1. / 54.);
250  else
251  meEventTypePostCalib.fill(getEcalDQMSetupObjects(), dccId, runType, 1. / 54.);
252  }
253  }
uint16_t *__restrict__ id
edm::LuminosityBlockNumber_t iLumi
Definition: DQWorker.h:48
MESet & at(const std::string &key)
Definition: MESet.h:399
std::vector< T >::const_iterator const_iterator
list status
Definition: mps_update.py:107
tuple runType
Definition: runPedHist.py:37
bool ccuExists(unsigned, unsigned)
edm::RunNumber_t runNumber_
Definition: RawDataTask.h:30
unsigned dccId(DetId const &, EcalElectronicsMapping const *)
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
Definition: DetId.h:17
Timestamp timestamp_
Definition: DQWorker.h:128
MESetCollection MEs_
Definition: DQWorker.h:125
EcalElectronicsMapping const * GetElectronicsMap()
Definition: DQWorker.cc:118
void ecaldqm::RawDataTask::runOnSource ( FEDRawDataCollection const &  _fedRaw)

Definition at line 45 of file RawDataTask.cc.

References ecaldqm::MESetCollection::at(), FEDRawDataCollection::FEDData(), ecaldqm::DQWorker::getEcalDQMSetupObjects(), l1A_, and ecaldqm::DQWorker::MEs_.

Referenced by analyze().

45  {
46  MESet& meCRC(MEs_.at("CRC"));
47 
48  // Get GT L1 info
49  const FEDRawData& gtFED(_fedRaw.FEDData(812));
50  if (gtFED.size() > sizeof(uint64_t)) { // FED header is one 64 bit word
51  const uint32_t* halfHeader = reinterpret_cast<const uint32_t*>(gtFED.data());
52  l1A_ = *(halfHeader + 1) & 0xffffff;
53  }
54 
55  for (int iFED(601); iFED <= 654; iFED++) {
56  const FEDRawData& fedData(_fedRaw.FEDData(iFED));
57  unsigned length(fedData.size() / sizeof(uint64_t));
58  if (length > 1) { // FED header is one 64 bit word
59  const uint64_t* pData(reinterpret_cast<uint64_t const*>(fedData.data()));
60  if ((pData[length - 1] & 0x4) != 0)
61  meCRC.fill(getEcalDQMSetupObjects(), iFED - 600);
62  }
63  }
64  }
MESet & at(const std::string &key)
Definition: MESet.h:399
EcalDQMSetupObjects const getEcalDQMSetupObjects()
Definition: DQWorker.cc:142
unsigned long long uint64_t
Definition: Time.h:13
MESetCollection MEs_
Definition: DQWorker.h:125

Member Data Documentation

int ecaldqm::RawDataTask::bx_
private

Definition at line 33 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::feL1Offset_
private

Definition at line 35 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::l1A_
private

Definition at line 31 of file RawDataTask.h.

Referenced by beginEvent(), runOnRawData(), and runOnSource().

int ecaldqm::RawDataTask::orbit_
private

Definition at line 32 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

edm::RunNumber_t ecaldqm::RawDataTask::runNumber_
private

Definition at line 30 of file RawDataTask.h.

Referenced by beginRun(), and runOnRawData().

short ecaldqm::RawDataTask::triggerType_
private

Definition at line 34 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().