22 fedUnpackList_(conf.getParameter<
std::vector<
int> >(
"FEDs")),
25 orderedFedUnpackList_(conf.getParameter<
std::vector<
int> >(
"orderedFedList")),
28 orderedDCCIdList_(conf.getParameter<
std::vector<
int> >(
"orderedDCCIdList")),
31 numbXtalTSamples_(conf.getParameter<
int>(
"numbXtalTSamples")),
34 numbTriggerTSamples_(conf.getParameter<
int>(
"numbTriggerTSamples")),
37 headerUnpacking_(conf.getParameter<
bool>(
"headerUnpacking")),
40 srpUnpacking_(conf.getParameter<
bool>(
"srpUnpacking")),
43 tccUnpacking_(conf.getParameter<
bool>(
"tccUnpacking")),
46 feUnpacking_(conf.getParameter<
bool>(
"feUnpacking")),
49 memUnpacking_(conf.getParameter<
bool>(
"memUnpacking")),
52 syncCheck_(conf.getParameter<
bool>(
"syncCheck")),
55 feIdCheck_(conf.getParameter<
bool>(
"feIdCheck")),
58 forceToKeepFRdata_(conf.getParameter<
bool>(
"forceToKeepFRData")),
60 put_(conf.getParameter<
bool>(
"eventPut")),
62 REGIONAL_(conf.getParameter<
bool>(
"DoRegional")),
72 if (numbXtalTSamples_ < 6 || numbXtalTSamples_ > 64 || (
numbXtalTSamples_ - 2) % 4) {
75 <<
"\n Valid Number of xtal time samples are : 6,10,14,18,...,62";
83 <<
"\n Valid number of trigger time samples are : 1, 4 or 8";
99 std::ostringstream loggerOutput_;
103 edm::LogInfo(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
104 LogDebug(
"EcalRawToDigi") <<
"EcalRawToDigi will unpack FEDs ( " << loggerOutput_.str() <<
")";
107 edm::LogInfo(
"EcalRawToDigi") <<
"\n ECAL RawToDigi configuration:" 108 <<
"\n Header unpacking is " <<
headerUnpacking_ <<
"\n SRP Bl. unpacking is " 110 <<
"\n FE Bl. unpacking is " <<
feUnpacking_ <<
"\n MEM Bl. unpacking is " 118 produces<EBDigiCollection>(
"ebDigis");
119 produces<EEDigiCollection>(
"eeDigis");
120 produces<EBSrFlagCollection>();
121 produces<EESrFlagCollection>();
122 produces<EcalRawDataCollection>();
123 produces<EcalPnDiodeDigiCollection>();
124 produces<EcalTrigPrimDigiCollection>(
"EcalTriggerPrimitives");
125 produces<EcalPSInputDigiCollection>(
"EcalPseudoStripInputs");
128 produces<EBDetIdCollection>(
"EcalIntegrityGainErrors");
129 produces<EBDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
130 produces<EBDetIdCollection>(
"EcalIntegrityChIdErrors");
133 produces<EEDetIdCollection>(
"EcalIntegrityGainErrors");
134 produces<EEDetIdCollection>(
"EcalIntegrityGainSwitchErrors");
135 produces<EEDetIdCollection>(
"EcalIntegrityChIdErrors");
138 produces<EcalElectronicsIdCollection>(
"EcalIntegrityTTIdErrors");
139 produces<EcalElectronicsIdCollection>(
"EcalIntegrityZSXtalIdErrors");
140 produces<EcalElectronicsIdCollection>(
"EcalIntegrityBlockSizeErrors");
143 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemTtIdErrors");
144 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemBlockSizeErrors");
145 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemChIdErrors");
146 produces<EcalElectronicsIdCollection>(
"EcalIntegrityMemGainErrors");
148 dataToken_ = consumes<FEDRawDataCollection>(dataLabel);
150 fedsToken_ = consumes<EcalListOfFEDS>(fedsLabel);
165 edm::LogWarning(
"IncorrectConfiguration") <<
"Arrays orderedFedList and orderedDCCIdList are emply. " 166 "Hard coded correspondence for DCCId:FedId will be used.";
200 std::cout <<
" id " <<
id.rawId() <<
" -> (" <<
id.ix() <<
", " <<
id.iy() <<
", " <<
id.zside() <<
") " 201 <<
"(" << ei.
dccId() <<
" : " << fed_id <<
", " << ei.
towerId() <<
", " << ei.
stripId() <<
", " 203 <<
"status = " << code << std::endl;
222 std::cout <<
" id " <<
id.rawId() <<
" -> (" <<
id.ieta() <<
", " <<
id.iphi() <<
", " <<
id.zside() <<
") " 223 <<
"(" << ei.
dccId() <<
" : " << fed_id <<
", " << ei.
towerId() <<
", " << ei.
stripId() <<
", " 225 <<
"status = " << code << std::endl;
234 desc.
add<
bool>(
"tccUnpacking",
true);
236 desc.
add<
bool>(
"srpUnpacking",
true);
237 desc.
add<
bool>(
"syncCheck",
true);
238 desc.
add<
bool>(
"feIdCheck",
true);
242 std::vector<int> temp1;
243 unsigned int nvec = 54;
245 for (
unsigned int i = 0;
i < nvec;
i++)
246 temp1.push_back(601 +
i);
247 desc.
add<std::vector<int> >(
"orderedFedList", temp1);
249 desc.
add<
bool>(
"eventPut",
true);
250 desc.
add<
int>(
"numbTriggerTSamples", 1);
251 desc.
add<
int>(
"numbXtalTSamples", 10);
253 std::vector<int> temp1;
254 unsigned int nvec = 54;
256 for (
unsigned int i = 0;
i < nvec;
i++)
257 temp1.push_back(1 +
i);
258 desc.
add<std::vector<int> >(
"orderedDCCIdList", temp1);
261 std::vector<int> temp1;
262 unsigned int nvec = 54;
264 for (
unsigned int i = 0;
i < nvec;
i++)
265 temp1.push_back(601 +
i);
266 desc.
add<std::vector<int> >(
"FEDs", temp1);
268 desc.
add<
bool>(
"DoRegional",
false);
269 desc.
add<
bool>(
"feUnpacking",
true);
270 desc.
add<
bool>(
"forceToKeepFRData",
false);
271 desc.
add<
bool>(
"headerUnpacking",
true);
272 desc.
add<
bool>(
"memUnpacking",
true);
273 descriptions.
add(
"ecalRawToDigi", desc);
312 std::vector<int> FEDS_to_unpack;
316 FEDS_to_unpack = listoffeds->
GetList();
327 auto productDigisEB = std::make_unique<EBDigiCollection>();
328 productDigisEB->reserve(1700);
332 auto productDigisEE = std::make_unique<EEDigiCollection>();
336 auto productDccHeaders = std::make_unique<EcalRawDataCollection>();
340 auto productInvalidGains = std::make_unique<EBDetIdCollection>();
344 auto productInvalidGainsSwitch = std::make_unique<EBDetIdCollection>();
348 auto productInvalidChIds = std::make_unique<EBDetIdCollection>();
354 auto productInvalidEEGains = std::make_unique<EEDetIdCollection>();
358 auto productInvalidEEGainsSwitch = std::make_unique<EEDetIdCollection>();
362 auto productInvalidEEChIds = std::make_unique<EEDetIdCollection>();
368 auto productEBSrFlags = std::make_unique<EBSrFlagCollection>();
372 auto productEESrFlags = std::make_unique<EESrFlagCollection>();
376 auto productEcalTps = std::make_unique<EcalTrigPrimDigiCollection>();
381 auto productEcalPSs = std::make_unique<EcalPSInputDigiCollection>();
386 auto productInvalidTTIds = std::make_unique<EcalElectronicsIdCollection>();
390 auto productInvalidZSXtalIds = std::make_unique<EcalElectronicsIdCollection>();
394 auto productInvalidBlockLengths = std::make_unique<EcalElectronicsIdCollection>();
399 auto productPnDiodeDigis = std::make_unique<EcalPnDiodeDigiCollection>();
403 auto productInvalidMemTtIds = std::make_unique<EcalElectronicsIdCollection>();
407 auto productInvalidMemBlockSizes = std::make_unique<EcalElectronicsIdCollection>();
411 auto productInvalidMemChIds = std::make_unique<EcalElectronicsIdCollection>();
415 auto productInvalidMemGains = std::make_unique<EcalElectronicsIdCollection>();
422 std::vector<int>::const_iterator fed_it =
find(FEDS_to_unpack.begin(), FEDS_to_unpack.end(), *
i);
423 if (fed_it == FEDS_to_unpack.end())
429 const size_t length = fedData.
size();
431 LogDebug(
"EcalRawToDigi") <<
"raw data length: " << length;
436 LogDebug(
"EcalRawToDigi") <<
"Getting FED = " << *
i <<
"(SM = " << smId <<
")" 437 <<
" data size is: " << length;
442 LogDebug(
"EcalRawToDigi") <<
" in EE :" << productDigisEE->size() <<
" in EB :" << productDigisEB->size();
461 productDigisEB->sort();
463 productDigisEE->sort();
465 e.
put(
std::move(productInvalidGains),
"EcalIntegrityGainErrors");
466 e.
put(
std::move(productInvalidGainsSwitch),
"EcalIntegrityGainSwitchErrors");
467 e.
put(
std::move(productInvalidChIds),
"EcalIntegrityChIdErrors");
469 e.
put(
std::move(productInvalidEEGains),
"EcalIntegrityGainErrors");
470 e.
put(
std::move(productInvalidEEGainsSwitch),
"EcalIntegrityGainSwitchErrors");
471 e.
put(
std::move(productInvalidEEChIds),
"EcalIntegrityChIdErrors");
473 e.
put(
std::move(productInvalidTTIds),
"EcalIntegrityTTIdErrors");
474 e.
put(
std::move(productInvalidZSXtalIds),
"EcalIntegrityZSXtalIdErrors");
475 e.
put(
std::move(productInvalidBlockLengths),
"EcalIntegrityBlockSizeErrors");
479 e.
put(
std::move(productInvalidMemTtIds),
"EcalIntegrityMemTtIdErrors");
480 e.
put(
std::move(productInvalidMemBlockSizes),
"EcalIntegrityMemBlockSizeErrors");
481 e.
put(
std::move(productInvalidMemChIds),
"EcalIntegrityMemChIdErrors");
482 e.
put(
std::move(productInvalidMemGains),
"EcalIntegrityMemGainErrors");
489 e.
put(
std::move(productEcalTps),
"EcalTriggerPrimitives");
490 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
~EcalRawToDigi() override
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)
void setEcalElectronicsMapping(const EcalElectronicsMapping *)
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
std::vector< int > GetList() const
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_
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_
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