CMS 3D CMS Logo

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 &) override
 
void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) 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 bookMEs (DQMStore::IBooker &)
 
 DQWorker ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 
std::string const & getName () const
 
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 setTime (time_t _t)
 
virtual ~DQWorker ()(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)
 
- 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 28 of file RawDataTask.h.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 17 of file RawDataTask.cc.

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

Referenced by ~RawDataTask().

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 39 of file RawDataTask.h.

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

Referenced by ~RawDataTask().

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 30 of file RawDataTask.cc.

References edm::EventBase::bunchCrossing(), bx_, edm::EventBase::experimentType(), feL1Offset_, edm::EventBase::isRealData(), l1A_, orbit_, edm::EventBase::orbitNumber(), and triggerType_.

Referenced by ~RawDataTask().

30  {
31  orbit_ = _evt.orbitNumber() & 0xffffffff;
32  bx_ = _evt.bunchCrossing() & 0xfff;
33  triggerType_ = _evt.experimentType() & 0xf;
34  l1A_ = 0;
35  feL1Offset_ = _evt.isRealData() ? 1 : 0;
36  }
void ecaldqm::RawDataTask::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 23 of file RawDataTask.cc.

References ecaldqm::DQWorker::MEs_.

Referenced by ~RawDataTask().

23  {
24  // Reset by LS plots at beginning of every LS
25  MEs_.at("DesyncByLumi").reset();
26  MEs_.at("FEByLumi").reset();
27  MEs_.at("FEStatusErrMapByLumi").reset();
28  }
MESetCollection MEs_
Definition: DQWorker.h:78
void ecaldqm::RawDataTask::beginRun ( edm::Run const &  _run,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 21 of file RawDataTask.cc.

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

Referenced by ~RawDataTask().

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

Definition at line 59 of file RawDataTask.cc.

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

Referenced by analyze(), and ~RawDataTask().

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

Definition at line 38 of file RawDataTask.cc.

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

Referenced by analyze(), and ~RawDataTask().

38  {
39  MESet& meCRC(MEs_.at("CRC"));
40 
41  // Get GT L1 info
42  const FEDRawData& gtFED(_fedRaw.FEDData(812));
43  if (gtFED.size() > sizeof(uint64_t)) { // FED header is one 64 bit word
44  const uint32_t* halfHeader = reinterpret_cast<const uint32_t*>(gtFED.data());
45  l1A_ = *(halfHeader + 1) & 0xffffff;
46  }
47 
48  for (int iFED(601); iFED <= 654; iFED++) {
49  const FEDRawData& fedData(_fedRaw.FEDData(iFED));
50  unsigned length(fedData.size() / sizeof(uint64_t));
51  if (length > 1) { // FED header is one 64 bit word
52  const uint64_t* pData(reinterpret_cast<uint64_t const*>(fedData.data()));
53  if ((pData[length - 1] & 0x4) != 0)
54  meCRC.fill(iFED - 600);
55  }
56  }
57  }
unsigned long long uint64_t
Definition: Time.h:13
MESetCollection MEs_
Definition: DQWorker.h:78

Member Data Documentation

int ecaldqm::RawDataTask::bx_
private

Definition at line 34 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::feL1Offset_
private

Definition at line 36 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::l1A_
private

Definition at line 32 of file RawDataTask.h.

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

int ecaldqm::RawDataTask::orbit_
private

Definition at line 33 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

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

Definition at line 31 of file RawDataTask.h.

Referenced by beginRun(), and runOnRawData().

short ecaldqm::RawDataTask::triggerType_
private

Definition at line 35 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().