21 fedUnpackList_(conf.getParameter<
std::vector<
int> >(
"FEDs")),
24 orderedFedUnpackList_(conf.getParameter<
std::vector<
int> >(
"orderedFedList")),
27 orderedDCCIdList_(conf.getParameter<
std::vector<
int> >(
"orderedDCCIdList")),
30 numbXtalTSamples_(conf.getParameter<
int>(
"numbXtalTSamples")),
33 numbTriggerTSamples_(conf.getParameter<
int>(
"numbTriggerTSamples")),
36 headerUnpacking_(conf.getParameter<bool>(
"headerUnpacking")),
39 srpUnpacking_(conf.getParameter<bool>(
"srpUnpacking")),
42 tccUnpacking_(conf.getParameter<bool>(
"tccUnpacking")),
45 feUnpacking_(conf.getParameter<bool>(
"feUnpacking")),
48 memUnpacking_(conf.getParameter<bool>(
"memUnpacking")),
51 syncCheck_(conf.getParameter<bool>(
"syncCheck")),
54 feIdCheck_(conf.getParameter<bool>(
"feIdCheck")),
57 forceToKeepFRdata_(conf.getParameter<bool>(
"forceToKeepFRData")),
60 put_(conf.getParameter<bool>(
"eventPut")),
64 REGIONAL_(conf.getParameter<bool>(
"DoRegional")),
80 <<
"\n Valid Number of xtal time samples are : 6,10,14,18,...,62";
88 <<
"\n Valid number of trigger time samples are : 1, 4 or 8";
104 std::ostringstream loggerOutput_;
108 edm::LogInfo(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
109 LogDebug(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
113 <<
"\n ECAL RawToDigi configuration:" 128 produces<EBDigiCollection>(
"ebDigis");
129 produces<EEDigiCollection>(
"eeDigis");
130 produces<EBSrFlagCollection>();
131 produces<EESrFlagCollection>();
132 produces<EcalRawDataCollection>();
133 produces<EcalPnDiodeDigiCollection>();
134 produces<EcalTrigPrimDigiCollection>(
"EcalTriggerPrimitives");
135 produces<EcalPSInputDigiCollection>(
"EcalPseudoStripInputs");
138 produces<EBDetIdCollection>(
"EcalIntegrityGainErrors");
139 produces<EBDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
140 produces<EBDetIdCollection>(
"EcalIntegrityChIdErrors");
143 produces<EEDetIdCollection>(
"EcalIntegrityGainErrors");
144 produces<EEDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
145 produces<EEDetIdCollection>(
"EcalIntegrityChIdErrors");
148 produces<EcalElectronicsIdCollection>(
"EcalIntegrityTTIdErrors");
149 produces<EcalElectronicsIdCollection>(
"EcalIntegrityZSXtalIdErrors");
150 produces<EcalElectronicsIdCollection>(
"EcalIntegrityBlockSizeErrors");
153 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemTtIdErrors");
154 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemBlockSizeErrors");
155 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemChIdErrors");
156 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemGainErrors");
158 dataToken_=consumes<FEDRawDataCollection>(dataLabel);
160 fedsToken_=consumes<EcalListOfFEDS>(fedsLabel);
176 <<
"Arrays orderedFedList and orderedDCCIdList are emply. " 177 "Hard coded correspondence for DCCId:FedId will be used.";
208 <<
" id " <<
id.rawId()
209 <<
" -> (" <<
id.ix() <<
", " <<
id.iy() <<
", " <<
id.zside() <<
") " 211 <<
"status = " << code
232 <<
" id " <<
id.rawId()
233 <<
" -> (" <<
id.ieta() <<
", " <<
id.iphi() <<
", " <<
id.zside() <<
") " 235 <<
"status = " << code
245 desc.
add<
bool>(
"tccUnpacking",
true);
247 desc.
add<
bool>(
"srpUnpacking",
true);
248 desc.
add<
bool>(
"syncCheck",
true);
249 desc.
add<
bool>(
"feIdCheck",
true);
253 std::vector<int> temp1;
254 unsigned int nvec = 54;
256 for (
unsigned int i=0;
i<nvec;
i++) temp1.push_back(601+
i);
257 desc.
add<std::vector<int> >(
"orderedFedList",temp1);
259 desc.
add<
bool>(
"eventPut",
true);
260 desc.
add<
int>(
"numbTriggerTSamples",1);
261 desc.
add<
int>(
"numbXtalTSamples",10);
263 std::vector<int> temp1;
264 unsigned int nvec = 54;
266 for (
unsigned int i=0;
i<nvec;
i++) temp1.push_back(1+
i);
267 desc.
add<std::vector<int> >(
"orderedDCCIdList",temp1);
270 std::vector<int> temp1;
271 unsigned int nvec = 54;
273 for (
unsigned int i=0;
i<nvec;
i++) temp1.push_back(601+
i);
274 desc.
add<std::vector<int> >(
"FEDs",temp1);
276 desc.
add<
bool>(
"DoRegional",
false);
277 desc.
add<
bool>(
"feUnpacking",
true);
278 desc.
add<
bool>(
"forceToKeepFRData",
false);
279 desc.
add<
bool>(
"headerUnpacking",
true);
280 desc.
add<
bool>(
"memUnpacking",
true);
281 descriptions.
add(
"ecalRawToDigi",desc);
320 myMap_ -> deletePointers();
321 myMap_ -> resetPointers();
328 std::vector<int> FEDS_to_unpack;
332 FEDS_to_unpack = listoffeds -> GetList();
346 auto productDigisEB = std::make_unique<EBDigiCollection>();
347 productDigisEB->reserve(1700);
351 auto productDigisEE = std::make_unique<EEDigiCollection>();
355 auto productDccHeaders = std::make_unique<EcalRawDataCollection>();
359 auto productInvalidGains = std::make_unique<EBDetIdCollection>();
363 auto productInvalidGainsSwitch = std::make_unique<EBDetIdCollection>();
367 auto productInvalidChIds = std::make_unique<EBDetIdCollection>();
373 auto productInvalidEEGains = std::make_unique<EEDetIdCollection>();
377 auto productInvalidEEGainsSwitch = std::make_unique<EEDetIdCollection>();
381 auto productInvalidEEChIds = std::make_unique<EEDetIdCollection>();
387 auto productEBSrFlags = std::make_unique<EBSrFlagCollection>();
391 auto productEESrFlags = std::make_unique<EESrFlagCollection>();
395 auto productEcalTps = std::make_unique<EcalTrigPrimDigiCollection>();
400 auto productEcalPSs = std::make_unique<EcalPSInputDigiCollection>();
405 auto productInvalidTTIds = std::make_unique<EcalElectronicsIdCollection>();
409 auto productInvalidZSXtalIds = std::make_unique<EcalElectronicsIdCollection>();
415 auto productInvalidBlockLengths = std::make_unique<EcalElectronicsIdCollection>();
420 auto productPnDiodeDigis = std::make_unique<EcalPnDiodeDigiCollection>();
424 auto productInvalidMemTtIds = std::make_unique<EcalElectronicsIdCollection>();
428 auto productInvalidMemBlockSizes = std::make_unique<EcalElectronicsIdCollection>();
432 auto productInvalidMemChIds = std::make_unique<EcalElectronicsIdCollection>();
436 auto productInvalidMemGains = std::make_unique<EcalElectronicsIdCollection>();
445 std::vector<int>::const_iterator fed_it =
find(FEDS_to_unpack.begin(), FEDS_to_unpack.end(), *
i);
446 if (fed_it == FEDS_to_unpack.end())
continue;
452 const size_t length = fedData.
size();
454 LogDebug(
"EcalRawToDigi") <<
"raw data length: " << length ;
461 LogDebug(
"EcalRawToDigi") <<
"Getting FED = " << *
i <<
"(SM = "<<smId<<
")"<<
" data size is: " << length;
466 LogDebug(
"EcalRawToDigi") <<
" in EE :"<<productDigisEE->size()
467 <<
" in EB :"<<productDigisEB->size();
488 productDigisEB->sort();
490 productDigisEE->sort();
492 e.
put(
std::move(productInvalidGains),
"EcalIntegrityGainErrors");
493 e.
put(
std::move(productInvalidGainsSwitch),
"EcalIntegrityGainSwitchErrors");
494 e.
put(
std::move(productInvalidChIds),
"EcalIntegrityChIdErrors");
496 e.
put(
std::move(productInvalidEEGains),
"EcalIntegrityGainErrors");
497 e.
put(
std::move(productInvalidEEGainsSwitch),
"EcalIntegrityGainSwitchErrors");
498 e.
put(
std::move(productInvalidEEChIds),
"EcalIntegrityChIdErrors");
500 e.
put(
std::move(productInvalidTTIds),
"EcalIntegrityTTIdErrors");
501 e.
put(
std::move(productInvalidZSXtalIds),
"EcalIntegrityZSXtalIdErrors");
502 e.
put(
std::move(productInvalidBlockLengths),
"EcalIntegrityBlockSizeErrors");
506 e.
put(
std::move(productInvalidMemTtIds),
"EcalIntegrityMemTtIdErrors");
507 e.
put(
std::move(productInvalidMemBlockSizes),
"EcalIntegrityMemBlockSizeErrors");
508 e.
put(
std::move(productInvalidMemChIds),
"EcalIntegrityMemChIdErrors");
509 e.
put(
std::move(productInvalidMemGains),
"EcalIntegrityMemGainErrors");
516 e.
put(
std::move(productEcalTps),
"EcalTriggerPrimitives");
517 e.
put(
std::move(productEcalPSs),
"EcalPseudoStripInputs");
void setChannelStatusDB(const EcalChannelStatusMap *chdb)
T getParameter(std::string const &) const
void setInvalidEEChIdsCollection(std::unique_ptr< EEDetIdCollection > *x)
edm::ESWatcher< EcalMappingRcd > watcher_
T getUntrackedParameter(std::string const &, T const &) const
void setInvalidGainsCollection(std::unique_ptr< EBDetIdCollection > *x)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
unsigned int numbXtalTSamples_
int xtalId() const
get the channel id
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void unpack(const uint64_t *buffer, size_t bufferSize, unsigned int smId, unsigned int fedId)
int stripId() const
get the tower id
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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 [...
void setInvalidTTIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidBlockLengthsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setInvalidGainsSwitchCollection(std::unique_ptr< EBDetIdCollection > *x)
int towerId() const
get the tower id
void setInvalidZSXtalIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
static EEDetId unhashIndex(int hi)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
size_t size() const
Lenght of the data buffer in bytes.
std::vector< int > fedUnpackList_
const EcalElectronicsMapper * electronicsMapper() const
DCCDataUnpacker * theUnpacker_
EcalElectronicsId getElectronicsId(const DetId &id) const
Get the electronics id for this det id.
void setInvalidMemChIdsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int getDCCId(unsigned int aSMId) const
void setEBSrFlagsCollection(std::unique_ptr< EBSrFlagCollection > *x)
void setInvalidMemBlockSizesCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
void setEcalTpsCollection(std::unique_ptr< EcalTrigPrimDigiCollection > *x)
static std::atomic< bool > silentMode_
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)
uint16_t getChannelValue(const DetId &id) const
unsigned int numbTriggerTSamples_
std::vector< int > orderedDCCIdList_
virtual void produce(edm::Event &e, const edm::EventSetup &c) override
EcalRawToDigi(const edm::ParameterSet &ps)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::EDGetTokenT< EcalListOfFEDS > fedsToken_
void setEcalPSsCollection(std::unique_ptr< EcalPSInputDigiCollection > *x)
int dccId() const
get the DCC (Ecal Local DCC value not global one) id
void printStatusRecords(const DCCDataUnpacker *unpacker, const EcalElectronicsMapping *mapping)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void setEESrFlagsCollection(std::unique_ptr< EESrFlagCollection > *x)
void setInvalidEEGainsCollection(std::unique_ptr< EEDetIdCollection > *x)
unsigned long long uint64_t
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
char data[epos_bytes_allocation]
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
void setInvalidChIdsCollection(std::unique_ptr< EBDetIdCollection > *x)
void setInvalidMemGainsCollection(std::unique_ptr< EcalElectronicsIdCollection > *x)
EcalElectronicsMapper * myMap_
virtual void beginRun(const edm::Run &run, const edm::EventSetup &es) override
void setEBDigisCollection(std::unique_ptr< EBDigiCollection > *x)
unsigned int getActiveSM()
T const * product() const