CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 &) 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 ()
 
virtual ~DQWorkerTask ()
 
- 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 ()
 

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.

29  {
30  nEventTypes = 25
31  };

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

Definition at line 16 of file RawDataTask.h.

16 {}

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().

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().

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:77
void runOnSource(FEDRawDataCollection const &)
Definition: RawDataTask.cc:55
void ecaldqm::RawDataTask::beginEvent ( edm::Event const &  _evt,
edm::EventSetup const &   
)
overridevirtual

Reimplemented from ecaldqm::DQWorkerTask.

Definition at line 45 of file RawDataTask.cc.

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

46  {
47  orbit_ = _evt.orbitNumber() & 0xffffffff;
48  bx_ = _evt.bunchCrossing() & 0xfff;
49  triggerType_ = _evt.experimentType() & 0xf;
50  l1A_ = 0;
51  feL1Offset_ = _evt.isRealData() ? 1 : 0;
52  }
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_.

39  {
40  MEs_.at("DesyncByLumi").reset();
41  MEs_.at("FEByLumi").reset();
42  }
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_.

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

Definition at line 77 of file RawDataTask.cc.

References edm::SortedCollection< T, SORT >::begin(), ecaldqm::BlockSize, bx_, ecaldqm::BXDesync, ecaldqm::ccuExists(), ecaldqm::ChannelId, ecaldqm::dccId(), edm::SortedCollection< T, SORT >::end(), feL1Offset_, ecaldqm::getElectronicsMap(), ecaldqm::HeaderError, ecaldqm::HParity, ecaldqm::DQWorker::Timestamp::iLumi, ecaldqm::kEEpLow, l1A_, ecaldqm::L1ABXDesync, ecaldqm::L1ADesync, ecaldqm::LinkError, ecaldqm::DQWorker::MEs_, orbit_, runNumber_, hcal2_dqm_sourceclient-live_cfg::runType, mps_update::status, ecaldqm::Timeout, ecaldqm::DQWorker::timestamp_, triggerType_, and ecaldqm::VParity.

Referenced by analyze().

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

Definition at line 55 of file RawDataTask.cc.

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

Referenced by analyze().

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