CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Public Attributes | Private Attributes
EcalRawToDigi Class Reference
Inheritance diagram for EcalRawToDigi:
edm::stream::EDProducer<>

Public Member Functions

void beginRun (const edm::Run &run, const edm::EventSetup &es) override
 
 EcalRawToDigi (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~EcalRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Public Attributes

edm::ESWatcher< EcalMappingRcdwatcher_
 

Private Attributes

edm::ESGetToken
< EcalChannelStatusMap,
EcalChannelStatusRcd
chStatusToken_
 
edm::EDGetTokenT
< FEDRawDataCollection
dataToken_
 
edm::ESGetToken
< EcalElectronicsMapping,
EcalMappingRcd
ecalMappingToken_
 
edm::EDGetTokenT< EcalListOfFEDSfedsToken_
 
std::vector< int > fedUnpackList_
 
bool feIdCheck_
 
bool feUnpacking_
 
bool first_
 
bool forceToKeepFRdata_
 
bool headerUnpacking_
 
bool memUnpacking_
 
EcalElectronicsMappermyMap_
 
unsigned int nevts_
 
unsigned int numbTriggerTSamples_
 
unsigned int numbXtalTSamples_
 
std::vector< int > orderedDCCIdList_
 
std::vector< int > orderedFedUnpackList_
 
bool put_
 
bool REGIONAL_
 
double RUNNING_TIME_
 
double SETUP_TIME_
 
bool srpUnpacking_
 
bool syncCheck_
 
bool tccUnpacking_
 
DCCDataUnpackertheUnpacker_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 42 of file EcalRawToDigi.cc.

Constructor & Destructor Documentation

EcalRawToDigi::EcalRawToDigi ( const edm::ParameterSet ps)
explicit

Class constructor

Definition at line 113 of file EcalRawToDigi.cc.

References chStatusToken_, dataToken_, ecalMappingToken_, fedsToken_, fedUnpackList_, feIdCheck_, feUnpacking_, first_, forceToKeepFRdata_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), headerUnpacking_, mps_fire::i, LogDebug, FEDNumbering::MAXECALFEDID, memUnpacking_, FEDNumbering::MINECALFEDID, myMap_, numbTriggerTSamples_, numbXtalTSamples_, orderedDCCIdList_, orderedFedUnpackList_, convertSQLitetoXML_cfg::output, REGIONAL_, DCCDataUnpacker::silentMode_, srpUnpacking_, syncCheck_, tccUnpacking_, and theUnpacker_.

114  :
115 
116  //define the list of FED to be unpacked
117  fedUnpackList_(conf.getParameter<std::vector<int> >("FEDs")),
118 
119  //define the ordered FED list
120  orderedFedUnpackList_(conf.getParameter<std::vector<int> >("orderedFedList")),
121 
122  //define the ordered DCCId list
123  orderedDCCIdList_(conf.getParameter<std::vector<int> >("orderedDCCIdList")),
124 
125  //get number of Xtal Time Samples
126  numbXtalTSamples_(conf.getParameter<int>("numbXtalTSamples")),
127 
128  //Get number of Trigger Time Samples
129  numbTriggerTSamples_(conf.getParameter<int>("numbTriggerTSamples")),
130 
131  //See if header unpacking is enabled
132  headerUnpacking_(conf.getParameter<bool>("headerUnpacking")),
133 
134  //See if srp unpacking is enabled
135  srpUnpacking_(conf.getParameter<bool>("srpUnpacking")),
136 
137  //See if tcc unpacking is enabled
138  tccUnpacking_(conf.getParameter<bool>("tccUnpacking")),
139 
140  //See if fe unpacking is enabled
141  feUnpacking_(conf.getParameter<bool>("feUnpacking")),
142 
143  //See if fe unpacking is enabled for mem box
144  memUnpacking_(conf.getParameter<bool>("memUnpacking")),
145 
146  //See if syncCheck is enabled
147  syncCheck_(conf.getParameter<bool>("syncCheck")),
148 
149  //See if feIdCheck is enabled
150  feIdCheck_(conf.getParameter<bool>("feIdCheck")),
151 
152  // See if we want to keep data even if we have a mismatch between SR decision and block length
153  forceToKeepFRdata_(conf.getParameter<bool>("forceToKeepFRData")),
154 
155  put_(conf.getParameter<bool>("eventPut")),
156 
157  REGIONAL_(conf.getParameter<bool>("DoRegional")),
158 
159  myMap_(nullptr),
160 
161  theUnpacker_(nullptr)
162 
163 {
164  first_ = true;
165  DCCDataUnpacker::silentMode_ = conf.getUntrackedParameter<bool>("silentMode", false);
166 
167  if (numbXtalTSamples_ < 6 || numbXtalTSamples_ > 64 || (numbXtalTSamples_ - 2) % 4) {
168  std::ostringstream output;
169  output << "\n Unsuported number of xtal time samples : " << numbXtalTSamples_
170  << "\n Valid Number of xtal time samples are : 6,10,14,18,...,62";
171  edm::LogError("IncorrectConfiguration") << output.str();
172  // todo : throw an execption
173  }
174 
176  std::ostringstream output;
177  output << "\n Unsuported number of trigger time samples : " << numbTriggerTSamples_
178  << "\n Valid number of trigger time samples are : 1, 4 or 8";
179  edm::LogError("IncorrectConfiguration") << output.str();
180  // todo : throw an execption
181  }
182 
183  //NA : testing
184  //nevts_=0;
185  //RUNNING_TIME_=0;
186 
187  // if there are FEDs specified to unpack fill the vector of the fedUnpackList_
188  // else fill with the entire ECAL fed range (600-670)
189  if (fedUnpackList_.empty())
191  fedUnpackList_.push_back(i);
192 
193  //print the FEDs to unpack to the logger
194  std::ostringstream loggerOutput_;
195  if (!fedUnpackList_.empty()) {
196  for (unsigned int i = 0; i < fedUnpackList_.size(); i++)
197  loggerOutput_ << fedUnpackList_[i] << " ";
198  edm::LogInfo("EcalRawToDigi") << "EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() << ")";
199  LogDebug("EcalRawToDigi") << "EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() << ")";
200  }
201 
202  edm::LogInfo("EcalRawToDigi") << "\n ECAL RawToDigi configuration:"
203  << "\n Header unpacking is " << headerUnpacking_ << "\n SRP Bl. unpacking is "
204  << srpUnpacking_ << "\n TCC Bl. unpacking is " << tccUnpacking_
205  << "\n FE Bl. unpacking is " << feUnpacking_ << "\n MEM Bl. unpacking is "
206  << memUnpacking_ << "\n sync check is " << syncCheck_ << "\n feID check is "
207  << feIdCheck_ << "\n force keep FR data is " << forceToKeepFRdata_ << "\n";
208 
209  edm::InputTag dataLabel = conf.getParameter<edm::InputTag>("InputLabel");
210  edm::InputTag fedsLabel = conf.getParameter<edm::InputTag>("FedLabel");
211 
212  // Producer products
213  if (headerUnpacking_) {
214  produces<EcalRawDataCollection>();
215  }
216 
217  if (feUnpacking_) {
218  produces<EBDigiCollection>("ebDigis");
219  produces<EEDigiCollection>("eeDigis");
220 
221  // Integrity for xtal data
222  produces<EBDetIdCollection>("EcalIntegrityGainErrors");
223  produces<EBDetIdCollection>("EcalIntegrityGainSwitchErrors");
224  produces<EBDetIdCollection>("EcalIntegrityChIdErrors");
225 
226  // Integrity for xtal data - EE specific (to be rivisited towards EB+EE common collection)
227  produces<EEDetIdCollection>("EcalIntegrityGainErrors");
228  produces<EEDetIdCollection>("EcalIntegrityGainSwitchErrors");
229  produces<EEDetIdCollection>("EcalIntegrityChIdErrors");
230 
231  // Integrity Errors
232  produces<EcalElectronicsIdCollection>("EcalIntegrityTTIdErrors");
233  produces<EcalElectronicsIdCollection>("EcalIntegrityZSXtalIdErrors");
234  produces<EcalElectronicsIdCollection>("EcalIntegrityBlockSizeErrors");
235 
236  //
237  produces<EcalPnDiodeDigiCollection>();
238  }
239 
240  if (srpUnpacking_) {
241  produces<EBSrFlagCollection>();
242  produces<EESrFlagCollection>();
243  }
244 
245  if (tccUnpacking_) {
246  produces<EcalTrigPrimDigiCollection>("EcalTriggerPrimitives");
247  produces<EcalPSInputDigiCollection>("EcalPseudoStripInputs");
248  }
249 
250  // Mem channels' integrity
251  if (memUnpacking_) {
252  produces<EcalElectronicsIdCollection>("EcalIntegrityMemTtIdErrors");
253  produces<EcalElectronicsIdCollection>("EcalIntegrityMemBlockSizeErrors");
254  produces<EcalElectronicsIdCollection>("EcalIntegrityMemChIdErrors");
255  produces<EcalElectronicsIdCollection>("EcalIntegrityMemGainErrors");
256  }
257 
258  dataToken_ = consumes<FEDRawDataCollection>(dataLabel);
259  if (REGIONAL_) {
260  fedsToken_ = consumes<EcalListOfFEDS>(fedsLabel);
261  }
262  chStatusToken_ = esConsumes<EcalChannelStatusMap, EcalChannelStatusRcd, edm::Transition::BeginRun>();
263  ecalMappingToken_ = esConsumes<EcalElectronicsMapping, EcalMappingRcd>();
264 
265  // Build a new Electronics mapper and parse default map file
266  myMap_ = new EcalElectronicsMapper(numbXtalTSamples_, numbTriggerTSamples_);
267 
268  // in case of external tsext file (deprecated by HLT environment)
269  // bool readResult = myMap_->readDCCMapFile(conf.getParameter<std::string>("DCCMapFile",""));
270 
271  // use two arrays from cfg to establish DCCId:FedId. If they are empy, than use hard coded correspondence
272  bool readResult = myMap_->makeMapFromVectors(orderedFedUnpackList_, orderedDCCIdList_);
273  // myMap::makeMapFromVectors() returns "true" always
274  // need to be fixed?
275 
276  if (!readResult) {
277  edm::LogWarning("IncorrectConfiguration") << "Arrays orderedFedList and orderedDCCIdList are emply. "
278  "Hard coded correspondence for DCCId:FedId will be used.";
279  // edm::LogError("EcalRawToDigi")<<"\n unable to read file : "
280  // <<conf.getParameter<std::string>("DCCMapFile");
281  }
282 
283  // Build a new ECAL DCC data unpacker
284  theUnpacker_ = new DCCDataUnpacker(myMap_,
288  feUnpacking_,
290  syncCheck_,
291  feIdCheck_,
292  forceToKeepFRdata_);
293 }
unsigned int numbXtalTSamples_
bool forceToKeepFRdata_
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
std::vector< int > orderedFedUnpackList_
Log< level::Error, false > LogError
std::vector< int > fedUnpackList_
DCCDataUnpacker * theUnpacker_
static std::atomic< bool > silentMode_
unsigned int numbTriggerTSamples_
std::vector< int > orderedDCCIdList_
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
Log< level::Info, false > LogInfo
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > chStatusToken_
Log< level::Warning, false > LogWarning
EcalElectronicsMapper * myMap_
#define LogDebug(id)
EcalRawToDigi::~EcalRawToDigi ( )
override

Class destructor

Definition at line 609 of file EcalRawToDigi.cc.

References myMap_, and theUnpacker_.

609  {
610  //cout << "EcalDCCUnpackingModule " << "N events " << (nevts_-1)<<endl;
611  //cout << "EcalDCCUnpackingModule " << " --- SETUP time " << endl;
612  //cout << "EcalDCCUnpackingModule " << "Time (sys) " << SETUP_TIME_ << endl;
613  //cout << "EcalDCCUnpackingModule " << "Time in sec. " << SETUP_TIME_/ CLOCKS_PER_SEC << endl;
614  //cout << "EcalDCCUnpackingModule " << " --- Per event " << endl;
615 
616  //RUNNING_TIME_ = RUNNING_TIME_ / (nevts_-1);
617 
618  //cout << "EcalDCCUnpackingModule "<< "Time (sys) " << RUNNING_TIME_ << endl;
619  //cout << "EcalDCCUnpackingModule "<< "Time in sec. " << RUNNING_TIME_ / CLOCKS_PER_SEC << endl;
620 
621  if (myMap_)
622  delete myMap_;
623  if (theUnpacker_)
624  delete theUnpacker_;
625 }
DCCDataUnpacker * theUnpacker_
EcalElectronicsMapper * myMap_

Member Function Documentation

void EcalRawToDigi::beginRun ( const edm::Run run,
const edm::EventSetup es 
)
override

Definition at line 388 of file EcalRawToDigi.cc.

References chStatusToken_, edm::EventSetup::getHandle(), edm::ESHandle< class >::product(), DCCDataUnpacker::setChannelStatusDB(), and theUnpacker_.

388  {
389  // channel status database
392 
393  // uncomment following line to print list of crystals with bad status
394  //edm::ESHandle<EcalElectronicsMapping> pEcalMapping;
395  //es.get<EcalMappingRcd>().get(pEcalMapping);
396  //const EcalElectronicsMapping* mapping = pEcalMapping.product();
397  //printStatusRecords(theUnpacker_, mapping);
398 }
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
DCCDataUnpacker * theUnpacker_
T const * product() const
Definition: ESHandle.h:86
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > chStatusToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void EcalRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 344 of file EcalRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, mps_fire::i, and HLT_FULL_cff::InputTag.

344  {
346  desc.add<bool>("tccUnpacking", true);
347  desc.add<edm::InputTag>("FedLabel", edm::InputTag("listfeds"));
348  desc.add<bool>("srpUnpacking", true);
349  desc.add<bool>("syncCheck", true);
350  desc.add<bool>("feIdCheck", true);
351  desc.addUntracked<bool>("silentMode", true);
352  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
353  {
354  std::vector<int> temp1;
355  unsigned int nvec = 54;
356  temp1.reserve(nvec);
357  for (unsigned int i = 0; i < nvec; i++)
358  temp1.push_back(601 + i);
359  desc.add<std::vector<int> >("orderedFedList", temp1);
360  }
361  desc.add<bool>("eventPut", true);
362  desc.add<int>("numbTriggerTSamples", 1);
363  desc.add<int>("numbXtalTSamples", 10);
364  {
365  std::vector<int> temp1;
366  unsigned int nvec = 54;
367  temp1.reserve(nvec);
368  for (unsigned int i = 0; i < nvec; i++)
369  temp1.push_back(1 + i);
370  desc.add<std::vector<int> >("orderedDCCIdList", temp1);
371  }
372  {
373  std::vector<int> temp1;
374  unsigned int nvec = 54;
375  temp1.reserve(nvec);
376  for (unsigned int i = 0; i < nvec; i++)
377  temp1.push_back(601 + i);
378  desc.add<std::vector<int> >("FEDs", temp1);
379  }
380  desc.add<bool>("DoRegional", false);
381  desc.add<bool>("feUnpacking", true);
382  desc.add<bool>("forceToKeepFRData", false);
383  desc.add<bool>("headerUnpacking", true);
384  desc.add<bool>("memUnpacking", true);
385  descriptions.add("ecalRawToDigi", desc);
386 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void EcalRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
override

Functions that are called by framework at each event

Definition at line 400 of file EcalRawToDigi.cc.

References edm::ESWatcher< T >::check(), FEDRawData::data(), data, dataToken_, EcalElectronicsMapper::deletePointers(), ecalMappingToken_, EMPTYEVENTSIZE, fedsToken_, fedUnpackList_, feUnpacking_, spr::find(), first_, EcalElectronicsMapper::getActiveSM(), edm::Event::getByToken(), edm::EventSetup::getHandle(), headerUnpacking_, mps_fire::i, LogDebug, memUnpacking_, eostools::move(), myMap_, edm::ESHandle< class >::product(), edm::Event::put(), put_, REGIONAL_, EcalElectronicsMapper::resetPointers(), EcalElectronicsMapper::setActiveDCC(), DCCDataUnpacker::setDccHeadersCollection(), DCCDataUnpacker::setEBDigisCollection(), DCCDataUnpacker::setEBSrFlagsCollection(), EcalElectronicsMapper::setEcalElectronicsMapping(), DCCDataUnpacker::setEcalPSsCollection(), DCCDataUnpacker::setEcalTpsCollection(), DCCDataUnpacker::setEEDigisCollection(), DCCDataUnpacker::setEESrFlagsCollection(), DCCDataUnpacker::setInvalidBlockLengthsCollection(), DCCDataUnpacker::setInvalidChIdsCollection(), DCCDataUnpacker::setInvalidEEChIdsCollection(), DCCDataUnpacker::setInvalidEEGainsCollection(), DCCDataUnpacker::setInvalidEEGainsSwitchCollection(), DCCDataUnpacker::setInvalidGainsCollection(), DCCDataUnpacker::setInvalidGainsSwitchCollection(), DCCDataUnpacker::setInvalidMemBlockSizesCollection(), DCCDataUnpacker::setInvalidMemChIdsCollection(), DCCDataUnpacker::setInvalidMemGainsCollection(), DCCDataUnpacker::setInvalidMemTtIdsCollection(), DCCDataUnpacker::setInvalidTTIdsCollection(), DCCDataUnpacker::setInvalidZSXtalIdsCollection(), DCCDataUnpacker::setPnDiodeDigisCollection(), FEDRawData::size(), srpUnpacking_, tccUnpacking_, theUnpacker_, DCCDataUnpacker::unpack(), and watcher_.

400  {
401  //double TIME_START = clock();
402  //nevts_++; //NUNO
403 
404  if (first_) {
405  watcher_.check(es);
406  edm::ESHandle<EcalElectronicsMapping> ecalmapping = es.getHandle(ecalMappingToken_);
407  myMap_->setEcalElectronicsMapping(ecalmapping.product());
408 
409  first_ = false;
410 
411  } else {
412  if (watcher_.check(es)) {
413  edm::ESHandle<EcalElectronicsMapping> ecalmapping = es.getHandle(ecalMappingToken_);
416  myMap_->setEcalElectronicsMapping(ecalmapping.product());
417  }
418  }
419 
420  // Get list of FEDS :
421  std::vector<int> FEDS_to_unpack;
422  if (REGIONAL_) {
423  edm::Handle<EcalListOfFEDS> listoffeds;
424  e.getByToken(fedsToken_, listoffeds);
425  FEDS_to_unpack = listoffeds->GetList();
426  }
427 
428  // Step A: Get Inputs
429 
431  e.getByToken(dataToken_, rawdata);
432 
433  // Step B: encapsulate vectors in actual collections and set unpacker pointers
434 
435  // create the collection of Ecal Digis
436  auto productDigisEB = std::make_unique<EBDigiCollection>();
437  productDigisEB->reserve(1700);
438  theUnpacker_->setEBDigisCollection(&productDigisEB);
439 
440  // create the collection of Ecal Digis
441  auto productDigisEE = std::make_unique<EEDigiCollection>();
442  theUnpacker_->setEEDigisCollection(&productDigisEE);
443 
444  // create the collection for headers
445  auto productDccHeaders = std::make_unique<EcalRawDataCollection>();
446  theUnpacker_->setDccHeadersCollection(&productDccHeaders);
447 
448  // create the collection for invalid gains
449  auto productInvalidGains = std::make_unique<EBDetIdCollection>();
450  theUnpacker_->setInvalidGainsCollection(&productInvalidGains);
451 
452  // create the collection for invalid gain Switch
453  auto productInvalidGainsSwitch = std::make_unique<EBDetIdCollection>();
454  theUnpacker_->setInvalidGainsSwitchCollection(&productInvalidGainsSwitch);
455 
456  // create the collection for invalid chids
457  auto productInvalidChIds = std::make_unique<EBDetIdCollection>();
458  theUnpacker_->setInvalidChIdsCollection(&productInvalidChIds);
459 
461 
462  // create the collection for invalid gains
463  auto productInvalidEEGains = std::make_unique<EEDetIdCollection>();
464  theUnpacker_->setInvalidEEGainsCollection(&productInvalidEEGains);
465 
466  // create the collection for invalid gain Switch
467  auto productInvalidEEGainsSwitch = std::make_unique<EEDetIdCollection>();
468  theUnpacker_->setInvalidEEGainsSwitchCollection(&productInvalidEEGainsSwitch);
469 
470  // create the collection for invalid chids
471  auto productInvalidEEChIds = std::make_unique<EEDetIdCollection>();
472  theUnpacker_->setInvalidEEChIdsCollection(&productInvalidEEChIds);
473 
475 
476  // create the collection for EB srflags
477  auto productEBSrFlags = std::make_unique<EBSrFlagCollection>();
478  theUnpacker_->setEBSrFlagsCollection(&productEBSrFlags);
479 
480  // create the collection for EB srflags
481  auto productEESrFlags = std::make_unique<EESrFlagCollection>();
482  theUnpacker_->setEESrFlagsCollection(&productEESrFlags);
483 
484  // create the collection for ecal trigger primitives
485  auto productEcalTps = std::make_unique<EcalTrigPrimDigiCollection>();
486  theUnpacker_->setEcalTpsCollection(&productEcalTps);
488 
489  // create the collection for ecal trigger primitives
490  auto productEcalPSs = std::make_unique<EcalPSInputDigiCollection>();
491  theUnpacker_->setEcalPSsCollection(&productEcalPSs);
493 
494  // create the collection for invalid TTIds
495  auto productInvalidTTIds = std::make_unique<EcalElectronicsIdCollection>();
496  theUnpacker_->setInvalidTTIdsCollection(&productInvalidTTIds);
497 
498  // create the collection for invalid TTIds
499  auto productInvalidZSXtalIds = std::make_unique<EcalElectronicsIdCollection>();
500  theUnpacker_->setInvalidZSXtalIdsCollection(&productInvalidZSXtalIds);
501 
502  // create the collection for invalid BlockLengths
503  auto productInvalidBlockLengths = std::make_unique<EcalElectronicsIdCollection>();
504  theUnpacker_->setInvalidBlockLengthsCollection(&productInvalidBlockLengths);
505 
506  // MEMs Collections
507  // create the collection for the Pn Diode Digis
508  auto productPnDiodeDigis = std::make_unique<EcalPnDiodeDigiCollection>();
509  theUnpacker_->setPnDiodeDigisCollection(&productPnDiodeDigis);
510 
511  // create the collection for invalid Mem Tt id
512  auto productInvalidMemTtIds = std::make_unique<EcalElectronicsIdCollection>();
513  theUnpacker_->setInvalidMemTtIdsCollection(&productInvalidMemTtIds);
514 
515  // create the collection for invalid Mem Block Size
516  auto productInvalidMemBlockSizes = std::make_unique<EcalElectronicsIdCollection>();
517  theUnpacker_->setInvalidMemBlockSizesCollection(&productInvalidMemBlockSizes);
518 
519  // create the collection for invalid Mem Block Size
520  auto productInvalidMemChIds = std::make_unique<EcalElectronicsIdCollection>();
521  theUnpacker_->setInvalidMemChIdsCollection(&productInvalidMemChIds);
522 
523  // create the collection for invalid Mem Gain Errors
524  auto productInvalidMemGains = std::make_unique<EcalElectronicsIdCollection>();
525  theUnpacker_->setInvalidMemGainsCollection(&productInvalidMemGains);
526  // double TIME_START = clock();
527 
528  // Step C: unpack all requested FEDs
529  for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
530  if (REGIONAL_) {
531  std::vector<int>::const_iterator fed_it = find(FEDS_to_unpack.begin(), FEDS_to_unpack.end(), *i);
532  if (fed_it == FEDS_to_unpack.end())
533  continue;
534  }
535 
536  // get fed raw data and SM id
537  const FEDRawData& fedData = rawdata->FEDData(*i);
538  const size_t length = fedData.size();
539 
540  LogDebug("EcalRawToDigi") << "raw data length: " << length;
541  //if data size is not null interpret data
542  if (length >= EMPTYEVENTSIZE) {
543  if (myMap_->setActiveDCC(*i)) {
544  const int smId = myMap_->getActiveSM();
545  LogDebug("EcalRawToDigi") << "Getting FED = " << *i << "(SM = " << smId << ")"
546  << " data size is: " << length;
547 
548  const uint64_t* data = (uint64_t*)fedData.data();
549  theUnpacker_->unpack(data, length, smId, *i);
550 
551  LogDebug("EcalRawToDigi") << " in EE :" << productDigisEE->size() << " in EB :" << productDigisEB->size();
552  }
553  }
554 
555  } // loop on FEDs
556 
557  //if(nevts_>1){ //NUNO
558  // double TIME_END = clock(); //NUNO
559  // RUNNING_TIME_ += TIME_END-TIME_START; //NUNO
560  // }
561 
562  // Add collections to the event
563 
564  if (put_) {
565  if (headerUnpacking_) {
566  e.put(std::move(productDccHeaders));
567  }
568 
569  if (feUnpacking_) {
570  productDigisEB->sort();
571  e.put(std::move(productDigisEB), "ebDigis");
572  productDigisEE->sort();
573  e.put(std::move(productDigisEE), "eeDigis");
574  e.put(std::move(productInvalidGains), "EcalIntegrityGainErrors");
575  e.put(std::move(productInvalidGainsSwitch), "EcalIntegrityGainSwitchErrors");
576  e.put(std::move(productInvalidChIds), "EcalIntegrityChIdErrors");
577  // EE (leaving for now the same names as in EB)
578  e.put(std::move(productInvalidEEGains), "EcalIntegrityGainErrors");
579  e.put(std::move(productInvalidEEGainsSwitch), "EcalIntegrityGainSwitchErrors");
580  e.put(std::move(productInvalidEEChIds), "EcalIntegrityChIdErrors");
581  // EE
582  e.put(std::move(productInvalidTTIds), "EcalIntegrityTTIdErrors");
583  e.put(std::move(productInvalidZSXtalIds), "EcalIntegrityZSXtalIdErrors");
584  e.put(std::move(productInvalidBlockLengths), "EcalIntegrityBlockSizeErrors");
585  e.put(std::move(productPnDiodeDigis));
586  }
587  if (memUnpacking_) {
588  e.put(std::move(productInvalidMemTtIds), "EcalIntegrityMemTtIdErrors");
589  e.put(std::move(productInvalidMemBlockSizes), "EcalIntegrityMemBlockSizeErrors");
590  e.put(std::move(productInvalidMemChIds), "EcalIntegrityMemChIdErrors");
591  e.put(std::move(productInvalidMemGains), "EcalIntegrityMemGainErrors");
592  }
593  if (srpUnpacking_) {
594  e.put(std::move(productEBSrFlags));
595  e.put(std::move(productEESrFlags));
596  }
597  if (tccUnpacking_) {
598  e.put(std::move(productEcalTps), "EcalTriggerPrimitives");
599  e.put(std::move(productEcalPSs), "EcalPseudoStripInputs");
600  }
601  }
602 
603  //if(nevts_>1){ //NUNO
604  // double TIME_END = clock(); //NUNO
605  // RUNNING_TIME_ += TIME_END-TIME_START; //NUNO
606  //}
607 }
void setInvalidEEChIdsCollection(std::unique_ptr< EEDetIdCollection > *x)
edm::ESWatcher< EcalMappingRcd > watcher_
void setInvalidGainsCollection(std::unique_ptr< EBDetIdCollection > *x)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
void setPnDiodeDigisCollection(std::unique_ptr< EcalPnDiodeDigiCollection > *x)
void setInvalidTTIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidGainsSwitchCollection(std::unique_ptr< EBDetIdCollection > *x)
void setInvalidZSXtalIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
std::vector< int > fedUnpackList_
DCCDataUnpacker * theUnpacker_
void setInvalidMemChIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setEBSrFlagsCollection(std::unique_ptr< EBSrFlagCollection > *x)
void setInvalidMemBlockSizesCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setEcalTpsCollection(std::unique_ptr< EcalTrigPrimDigiCollection > *x)
bool setActiveDCC(unsigned int dccId)
void setInvalidMemTtIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidEEGainsSwitchCollection(std::unique_ptr< EEDetIdCollection > *x)
void setEEDigisCollection(std::unique_ptr< EEDigiCollection > *x)
def move
Definition: eostools.py:511
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
void setEcalPSsCollection(std::unique_ptr< EcalPSInputDigiCollection > *x)
void setEESrFlagsCollection(std::unique_ptr< EESrFlagCollection > *x)
void setInvalidEEGainsCollection(std::unique_ptr< EEDetIdCollection > *x)
unsigned long long uint64_t
Definition: Time.h:13
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
T const * product() const
Definition: ESHandle.h:86
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
void setDccHeadersCollection(std::unique_ptr< EcalRawDataCollection > *x)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
void setInvalidChIdsCollection(std::unique_ptr< EBDetIdCollection > *x)
void setInvalidMemGainsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
EcalElectronicsMapper * myMap_
void setEBDigisCollection(std::unique_ptr< EBDigiCollection > *x)
#define LogDebug(id)

Member Data Documentation

edm::ESGetToken<EcalChannelStatusMap, EcalChannelStatusRcd> EcalRawToDigi::chStatusToken_
private

Definition at line 88 of file EcalRawToDigi.cc.

Referenced by beginRun(), and EcalRawToDigi().

edm::EDGetTokenT<FEDRawDataCollection> EcalRawToDigi::dataToken_
private

Definition at line 86 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

edm::ESGetToken<EcalElectronicsMapping, EcalMappingRcd> EcalRawToDigi::ecalMappingToken_
private

Definition at line 89 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

edm::EDGetTokenT<EcalListOfFEDS> EcalRawToDigi::fedsToken_
private

Definition at line 87 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

std::vector<int> EcalRawToDigi::fedUnpackList_
private

Definition at line 67 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::feIdCheck_
private

Definition at line 81 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::feUnpacking_
private

Definition at line 78 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::first_
private

Definition at line 83 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::forceToKeepFRdata_
private

Definition at line 82 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::headerUnpacking_
private

Definition at line 75 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::memUnpacking_
private

Definition at line 79 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

EcalElectronicsMapper* EcalRawToDigi::myMap_
private

Definition at line 95 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), produce(), and ~EcalRawToDigi().

unsigned int EcalRawToDigi::nevts_
private

Definition at line 100 of file EcalRawToDigi.cc.

unsigned int EcalRawToDigi::numbTriggerTSamples_
private

Definition at line 73 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

unsigned int EcalRawToDigi::numbXtalTSamples_
private

Definition at line 72 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

std::vector<int> EcalRawToDigi::orderedDCCIdList_
private

Definition at line 70 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

std::vector<int> EcalRawToDigi::orderedFedUnpackList_
private

Definition at line 69 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::put_
private

Definition at line 84 of file EcalRawToDigi.cc.

Referenced by produce().

bool EcalRawToDigi::REGIONAL_
private

Definition at line 92 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

double EcalRawToDigi::RUNNING_TIME_
private

Definition at line 101 of file EcalRawToDigi.cc.

double EcalRawToDigi::SETUP_TIME_
private

Definition at line 101 of file EcalRawToDigi.cc.

bool EcalRawToDigi::srpUnpacking_
private

Definition at line 76 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

bool EcalRawToDigi::syncCheck_
private

Definition at line 80 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi().

bool EcalRawToDigi::tccUnpacking_
private

Definition at line 77 of file EcalRawToDigi.cc.

Referenced by EcalRawToDigi(), and produce().

DCCDataUnpacker* EcalRawToDigi::theUnpacker_
private

Definition at line 98 of file EcalRawToDigi.cc.

Referenced by beginRun(), EcalRawToDigi(), produce(), and ~EcalRawToDigi().

edm::ESWatcher<EcalMappingRcd> EcalRawToDigi::watcher_

Definition at line 63 of file EcalRawToDigi.cc.

Referenced by produce().