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 ()
 
- 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 &)
 
void recoverStats ()
 
virtual void setTokens (edm::ConsumesCollector &)
 
void softReset ()
 
 ~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 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::DQWorkerTask
std::set< std::string > resettable_
 
- 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 13 of file RawDataTask.h.

Member Enumeration Documentation

Enumerator
nEventTypes 

Definition at line 29 of file RawDataTask.h.

Constructor & Destructor Documentation

ecaldqm::RawDataTask::RawDataTask ( )

Definition at line 14 of file RawDataTask.cc.

14  :
15  DQWorkerTask(),
16  runNumber_(0),
17  l1A_(0),
18  orbit_(0),
19  bx_(0),
20  triggerType_(0),
21  feL1Offset_(0)
22  {
23  }
edm::RunNumber_t runNumber_
Definition: RawDataTask.h:34
ecaldqm::RawDataTask::~RawDataTask ( )
inline

Member Function Documentation

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 26 of file RawDataTask.cc.

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

Referenced by ~RawDataTask().

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 43 of file RawDataTask.h.

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

Referenced by ~RawDataTask().

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

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 47 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().

48  {
49  orbit_ = _evt.orbitNumber() & 0xffffffff;
50  bx_ = _evt.bunchCrossing() & 0xfff;
51  triggerType_ = _evt.experimentType() & 0xf;
52  l1A_ = 0;
53  feL1Offset_ = _evt.isRealData() ? 1 : 0;
54  }
void ecaldqm::RawDataTask::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 38 of file RawDataTask.cc.

References ecaldqm::DQWorker::MEs_.

Referenced by ~RawDataTask().

39  {
40  // Reset by LS plots at beginning of every LS
41  MEs_.at("DesyncByLumi").reset();
42  MEs_.at("FEByLumi").reset();
43  MEs_.at("FEStatusErrMapByLumi").reset();
44  }
MESetCollection MEs_
Definition: DQWorker.h:75
void ecaldqm::RawDataTask::beginRun ( edm::Run const &  _run,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorker.

Definition at line 32 of file RawDataTask.cc.

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

Referenced by ~RawDataTask().

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

Definition at line 79 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_, mps_update::status, ecaldqm::Suppressed, ecaldqm::Timeout, ecaldqm::DQWorker::timestamp_, triggerType_, and ecaldqm::VParity.

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

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

Definition at line 57 of file RawDataTask.cc.

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

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

58  {
59  MESet& meCRC(MEs_.at("CRC"));
60 
61  // Get GT L1 info
62  const FEDRawData &gtFED(_fedRaw.FEDData(812));
63  if(gtFED.size() > sizeof(uint64_t)){ // FED header is one 64 bit word
64  uint32_t *halfHeader((uint32_t *)gtFED.data());
65  l1A_ = *(halfHeader + 1) & 0xffffff;
66  }
67 
68  for(int iFED(601); iFED <= 654; iFED++){
69  const FEDRawData& fedData(_fedRaw.FEDData(iFED));
70  unsigned length(fedData.size() / sizeof(uint64_t));
71  if(length > 1){ // FED header is one 64 bit word
72  const uint64_t* pData(reinterpret_cast<uint64_t const*>(fedData.data()));
73  if((pData[length - 1] & 0x4) != 0) meCRC.fill(iFED - 600);
74  }
75  }
76  }
unsigned long long uint64_t
Definition: Time.h:15
MESetCollection MEs_
Definition: DQWorker.h:75

Member Data Documentation

int ecaldqm::RawDataTask::bx_
private

Definition at line 37 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::feL1Offset_
private

Definition at line 39 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

int ecaldqm::RawDataTask::l1A_
private

Definition at line 35 of file RawDataTask.h.

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

int ecaldqm::RawDataTask::orbit_
private

Definition at line 36 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().

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

Definition at line 34 of file RawDataTask.h.

Referenced by beginRun(), and runOnRawData().

short ecaldqm::RawDataTask::triggerType_
private

Definition at line 38 of file RawDataTask.h.

Referenced by beginEvent(), and runOnRawData().