117 fedUnpackList_(conf.getParameter<
std::
vector<
int> >(
"FEDs")),
120 orderedFedUnpackList_(conf.getParameter<
std::
vector<
int> >(
"orderedFedList")),
123 orderedDCCIdList_(conf.getParameter<
std::
vector<
int> >(
"orderedDCCIdList")),
126 numbXtalTSamples_(conf.getParameter<
int>(
"numbXtalTSamples")),
129 numbTriggerTSamples_(conf.getParameter<
int>(
"numbTriggerTSamples")),
132 headerUnpacking_(conf.getParameter<
bool>(
"headerUnpacking")),
135 srpUnpacking_(conf.getParameter<
bool>(
"srpUnpacking")),
138 tccUnpacking_(conf.getParameter<
bool>(
"tccUnpacking")),
141 feUnpacking_(conf.getParameter<
bool>(
"feUnpacking")),
144 memUnpacking_(conf.getParameter<
bool>(
"memUnpacking")),
147 syncCheck_(conf.getParameter<
bool>(
"syncCheck")),
150 feIdCheck_(conf.getParameter<
bool>(
"feIdCheck")),
153 forceToKeepFRdata_(conf.getParameter<
bool>(
"forceToKeepFRData")),
155 put_(conf.getParameter<
bool>(
"eventPut")),
157 REGIONAL_(conf.getParameter<
bool>(
"DoRegional")),
161 theUnpacker_(nullptr)
167 if (numbXtalTSamples_ < 6 || numbXtalTSamples_ > 64 || (
numbXtalTSamples_ - 2) % 4) {
168 std::ostringstream
output;
170 <<
"\n Valid Number of xtal time samples are : 6,10,14,18,...,62";
176 std::ostringstream
output;
178 <<
"\n Valid number of trigger time samples are : 1, 4 or 8";
194 std::ostringstream loggerOutput_;
198 edm::LogInfo(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
199 LogDebug(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
202 edm::LogInfo(
"EcalRawToDigi") <<
"\n ECAL RawToDigi configuration:" 203 <<
"\n Header unpacking is " <<
headerUnpacking_ <<
"\n SRP Bl. unpacking is " 205 <<
"\n FE Bl. unpacking is " <<
feUnpacking_ <<
"\n MEM Bl. unpacking is " 214 produces<EcalRawDataCollection>();
218 produces<EBDigiCollection>(
"ebDigis");
219 produces<EEDigiCollection>(
"eeDigis");
222 produces<EBDetIdCollection>(
"EcalIntegrityGainErrors");
223 produces<EBDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
224 produces<EBDetIdCollection>(
"EcalIntegrityChIdErrors");
227 produces<EEDetIdCollection>(
"EcalIntegrityGainErrors");
228 produces<EEDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
229 produces<EEDetIdCollection>(
"EcalIntegrityChIdErrors");
232 produces<EcalElectronicsIdCollection>(
"EcalIntegrityTTIdErrors");
233 produces<EcalElectronicsIdCollection>(
"EcalIntegrityZSXtalIdErrors");
234 produces<EcalElectronicsIdCollection>(
"EcalIntegrityBlockSizeErrors");
237 produces<EcalPnDiodeDigiCollection>();
241 produces<EBSrFlagCollection>();
242 produces<EESrFlagCollection>();
246 produces<EcalTrigPrimDigiCollection>(
"EcalTriggerPrimitives");
247 produces<EcalPSInputDigiCollection>(
"EcalPseudoStripInputs");
252 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemTtIdErrors");
253 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemBlockSizeErrors");
254 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemChIdErrors");
255 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemGainErrors");
258 dataToken_ = consumes<FEDRawDataCollection>(dataLabel);
260 fedsToken_ = consumes<EcalListOfFEDS>(fedsLabel);
262 chStatusToken_ = esConsumes<EcalChannelStatusMap, EcalChannelStatusRcd, edm::Transition::BeginRun>();
277 edm::LogWarning(
"IncorrectConfiguration") <<
"Arrays orderedFedList and orderedDCCIdList are emply. " 278 "Hard coded correspondence for DCCId:FedId will be used.";
312 std::cout <<
" id " <<
id.rawId() <<
" -> (" <<
id.ix() <<
", " <<
id.iy() <<
", " <<
id.zside() <<
") " 313 <<
"(" << ei.
dccId() <<
" : " << fed_id <<
", " << ei.
towerId() <<
", " << ei.
stripId() <<
", " 315 <<
"status = " << code << std::endl;
334 std::cout <<
" id " <<
id.rawId() <<
" -> (" <<
id.ieta() <<
", " <<
id.iphi() <<
", " <<
id.zside() <<
") " 335 <<
"(" << ei.
dccId() <<
" : " << fed_id <<
", " << ei.
towerId() <<
", " << ei.
stripId() <<
", " 337 <<
"status = " << code << std::endl;
346 desc.add<
bool>(
"tccUnpacking",
true);
348 desc.add<
bool>(
"srpUnpacking",
true);
349 desc.add<
bool>(
"syncCheck",
true);
350 desc.add<
bool>(
"feIdCheck",
true);
351 desc.addUntracked<
bool>(
"silentMode",
true);
354 std::vector<int> temp1;
355 unsigned int nvec = 54;
357 for (
unsigned int i = 0;
i < nvec;
i++)
358 temp1.push_back(601 +
i);
359 desc.add<std::vector<int> >(
"orderedFedList", temp1);
361 desc.add<
bool>(
"eventPut",
true);
362 desc.add<
int>(
"numbTriggerTSamples", 1);
363 desc.add<
int>(
"numbXtalTSamples", 10);
365 std::vector<int> temp1;
366 unsigned int nvec = 54;
368 for (
unsigned int i = 0;
i < nvec;
i++)
369 temp1.push_back(1 +
i);
370 desc.add<std::vector<int> >(
"orderedDCCIdList", temp1);
373 std::vector<int> temp1;
374 unsigned int nvec = 54;
376 for (
unsigned int i = 0;
i < nvec;
i++)
377 temp1.push_back(601 +
i);
378 desc.add<std::vector<int> >(
"FEDs", temp1);
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);
421 std::vector<int> FEDS_to_unpack;
425 FEDS_to_unpack = listoffeds->
GetList();
436 auto productDigisEB = std::make_unique<EBDigiCollection>();
437 productDigisEB->reserve(1700);
441 auto productDigisEE = std::make_unique<EEDigiCollection>();
445 auto productDccHeaders = std::make_unique<EcalRawDataCollection>();
449 auto productInvalidGains = std::make_unique<EBDetIdCollection>();
453 auto productInvalidGainsSwitch = std::make_unique<EBDetIdCollection>();
457 auto productInvalidChIds = std::make_unique<EBDetIdCollection>();
463 auto productInvalidEEGains = std::make_unique<EEDetIdCollection>();
467 auto productInvalidEEGainsSwitch = std::make_unique<EEDetIdCollection>();
471 auto productInvalidEEChIds = std::make_unique<EEDetIdCollection>();
477 auto productEBSrFlags = std::make_unique<EBSrFlagCollection>();
481 auto productEESrFlags = std::make_unique<EESrFlagCollection>();
485 auto productEcalTps = std::make_unique<EcalTrigPrimDigiCollection>();
490 auto productEcalPSs = std::make_unique<EcalPSInputDigiCollection>();
495 auto productInvalidTTIds = std::make_unique<EcalElectronicsIdCollection>();
499 auto productInvalidZSXtalIds = std::make_unique<EcalElectronicsIdCollection>();
503 auto productInvalidBlockLengths = std::make_unique<EcalElectronicsIdCollection>();
508 auto productPnDiodeDigis = std::make_unique<EcalPnDiodeDigiCollection>();
512 auto productInvalidMemTtIds = std::make_unique<EcalElectronicsIdCollection>();
516 auto productInvalidMemBlockSizes = std::make_unique<EcalElectronicsIdCollection>();
520 auto productInvalidMemChIds = std::make_unique<EcalElectronicsIdCollection>();
524 auto productInvalidMemGains = std::make_unique<EcalElectronicsIdCollection>();
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())
538 const size_t length = fedData.
size();
540 LogDebug(
"EcalRawToDigi") <<
"raw data length: " << length;
545 LogDebug(
"EcalRawToDigi") <<
"Getting FED = " << *
i <<
"(SM = " << smId <<
")" 546 <<
" data size is: " << length;
551 LogDebug(
"EcalRawToDigi") <<
" in EE :" << productDigisEE->size() <<
" in EB :" << productDigisEB->size();
570 productDigisEB->sort();
572 productDigisEE->sort();
574 e.put(
std::move(productInvalidGains),
"EcalIntegrityGainErrors");
575 e.put(
std::move(productInvalidGainsSwitch),
"EcalIntegrityGainSwitchErrors");
576 e.put(
std::move(productInvalidChIds),
"EcalIntegrityChIdErrors");
578 e.put(
std::move(productInvalidEEGains),
"EcalIntegrityGainErrors");
579 e.put(
std::move(productInvalidEEGainsSwitch),
"EcalIntegrityGainSwitchErrors");
580 e.put(
std::move(productInvalidEEChIds),
"EcalIntegrityChIdErrors");
582 e.put(
std::move(productInvalidTTIds),
"EcalIntegrityTTIdErrors");
583 e.put(
std::move(productInvalidZSXtalIds),
"EcalIntegrityZSXtalIdErrors");
584 e.put(
std::move(productInvalidBlockLengths),
"EcalIntegrityBlockSizeErrors");
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");
598 e.put(
std::move(productEcalTps),
"EcalTriggerPrimitives");
599 e.put(
std::move(productEcalPSs),
"EcalPseudoStripInputs");
static constexpr int kSizeForDenseIndexing
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
void setInvalidEEChIdsCollection(std::unique_ptr< EEDetIdCollection > *x)
edm::ESWatcher< EcalMappingRcd > watcher_
T getParameter(std::string const &) const
void setInvalidGainsCollection(std::unique_ptr< EBDetIdCollection > *x)
unsigned int numbXtalTSamples_
~EcalRawToDigi() override
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
void setPnDiodeDigisCollection(std::unique_ptr< EcalPnDiodeDigiCollection > *x)
std::vector< int > orderedFedUnpackList_
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void setInvalidTTIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidGainsSwitchCollection(std::unique_ptr< EBDetIdCollection > *x)
size_t size() const
Lenght of the data buffer in bytes.
void setInvalidZSXtalIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
Log< level::Error, false > LogError
static EEDetId unhashIndex(int hi)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
std::vector< int > fedUnpackList_
DCCDataUnpacker * theUnpacker_
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > GetList() const
const EcalElectronicsMapper * electronicsMapper() const
void setInvalidMemChIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
T const * product() const
void setEBSrFlagsCollection(std::unique_ptr< EBSrFlagCollection > *x)
void setInvalidMemBlockSizesCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setEcalTpsCollection(std::unique_ptr< EcalTrigPrimDigiCollection > *x)
uint16_t getChannelValue(const DetId &id) const
static std::atomic< bool > silentMode_
bool setActiveDCC(unsigned int dccId)
void setInvalidMemTtIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
static constexpr int kSizeForDenseIndexing
void setInvalidEEGainsSwitchCollection(std::unique_ptr< EEDetIdCollection > *x)
int towerId() const
get the tower id
void setEEDigisCollection(std::unique_ptr< EEDigiCollection > *x)
unsigned int numbTriggerTSamples_
bool makeMapFromVectors(std::vector< int > &, std::vector< int > &)
std::vector< int > orderedDCCIdList_
#define DEFINE_FWK_MODULE(type)
void produce(edm::Event &e, const edm::EventSetup &c) override
EcalRawToDigi(const edm::ParameterSet &ps)
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
void setEcalPSsCollection(std::unique_ptr< EcalPSInputDigiCollection > *x)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void printStatusRecords(const DCCDataUnpacker *unpacker, const EcalElectronicsMapping *mapping)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Log< level::Info, false > LogInfo
void setEESrFlagsCollection(std::unique_ptr< EESrFlagCollection > *x)
void setInvalidEEGainsCollection(std::unique_ptr< EEDetIdCollection > *x)
unsigned long long uint64_t
edm::ESGetToken< EcalElectronicsMapping, EcalMappingRcd > ecalMappingToken_
int stripId() const
get the tower id
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool check(const edm::EventSetup &iSetup)
void setDccHeadersCollection(std::unique_ptr< EcalRawDataCollection > *x)
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
int xtalId() const
get the channel id
char data[epos_bytes_allocation]
unsigned int getDCCId(unsigned int aSMId) const
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void setInvalidChIdsCollection(std::unique_ptr< EBDetIdCollection > *x)
edm::ESGetToken< EcalChannelStatusMap, EcalChannelStatusRcd > chStatusToken_
void setInvalidMemGainsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
Log< level::Warning, false > LogWarning
EcalElectronicsMapper * myMap_
void beginRun(const edm::Run &run, const edm::EventSetup &es) override
void setEBDigisCollection(std::unique_ptr< EBDigiCollection > *x)
unsigned int getActiveSM()