12 #include <unordered_set> 15 unpacker_(conf.getUntrackedParameter<
int>(
"HcalFirstFED",
int(
FEDNumbering::MINHCALFEDID)),conf.getParameter<
int>(
"firstSample"),conf.getParameter<
int>(
"lastSample")),
16 filter_(conf.getParameter<
bool>(
"FilterDataQuality"),conf.getParameter<
bool>(
"FilterDataQuality"),
20 fedUnpackList_(conf.getUntrackedParameter<
std::vector<
int> >(
"FEDs",
std::vector<
int>())),
21 firstFED_(conf.getUntrackedParameter<
int>(
"HcalFirstFED",
FEDNumbering::MINHCALFEDID)),
22 unpackCalib_(conf.getUntrackedParameter<
bool>(
"UnpackCalib",
false)),
23 unpackZDC_(conf.getUntrackedParameter<
bool>(
"UnpackZDC",
false)),
24 unpackTTP_(conf.getUntrackedParameter<
bool>(
"UnpackTTP",
false)),
25 unpackUMNio_(conf.getUntrackedParameter<
bool>(
"UnpackUMNio",
false)),
26 saveQIE10DataNSamples_(conf.getUntrackedParameter<
std::vector<
int> >(
"saveQIE10DataNSamples",
std::vector<
int>())),
27 saveQIE10DataTags_(conf.getUntrackedParameter<
std::vector<
std::
string> >(
"saveQIE10DataTags",
std::vector<
std::
string>())),
28 saveQIE11DataNSamples_(conf.getUntrackedParameter<
std::vector<
int> >(
"saveQIE11DataNSamples",
std::vector<
int>())),
29 saveQIE11DataTags_(conf.getUntrackedParameter<
std::vector<
std::
string> >(
"saveQIE11DataTags",
std::vector<
std::
string>())),
30 silent_(conf.getUntrackedParameter<
bool>(
"silent",
true)),
31 complainEmptyData_(conf.getUntrackedParameter<
bool>(
"ComplainEmptyData",
false)),
32 unpackerMode_(conf.getUntrackedParameter<
int>(
"UnpackerMode",0)),
33 expectedOrbitMessageTime_(conf.getUntrackedParameter<
int>(
"ExpectedOrbitMessageTime",-1))
50 std::ostringstream ss;
53 edm::LogInfo(
"HCAL") <<
"HcalRawToDigi will unpack FEDs ( " << ss.str() <<
")";
56 produces<HBHEDigiCollection>();
57 produces<HFDigiCollection>();
58 produces<HODigiCollection>();
59 produces<HcalTrigPrimDigiCollection>();
60 produces<HOTrigPrimDigiCollection>();
61 produces<HcalUnpackerReport>();
63 produces<HcalCalibDigiCollection>();
65 produces<ZDCDigiCollection>();
67 produces<HcalTTPDigiCollection>();
69 produces<HcalUMNioDigi>();
70 produces<QIE10DigiCollection>();
71 produces<QIE11DigiCollection>();
73 produces<QIE10DigiCollection>(
"ZDC");
74 produces<QIE10DigiCollection>(
"LASERMON");
80 edm::LogWarning(
"HcalRawToDigi") <<
"Cannot create an additional QIE10 sample with name ZDC, it is already created! It must be removed along with the corresponding entry in saveQIE10DataNSamples" << std::endl;
88 edm::LogWarning(
"HcalRawToDigi") <<
"Cannot create an additional QIE10 sample with name LASERMON, it is already created! It must be removed along with the corresponding entry in saveQIE10DataNSamples" << std::endl;
97 edm::LogWarning(
"HcalRawToDigi") <<
"The saveQIE10DataTags and saveQIE10DataNSamples inputs must be the same length! These will be ignored" << std::endl;
102 edm::LogWarning(
"HcalRawToDigi") <<
"The saveQIE11DataTags and saveQIE11DataNSamples inputs must be the same length! These will be ignored" << std::endl;
116 produces<QIE10DigiCollection>(
tag);
129 produces<QIE11DigiCollection>(
tag);
144 desc.
add<
int>(
"firstSample",0);
145 desc.
add<
int>(
"lastSample",9);
146 desc.
add<
bool>(
"FilterDataQuality",
true);
147 desc.
addUntracked<std::vector<int>>(
"FEDs", std::vector<int>());
153 desc.
addUntracked<std::vector<int> >(
"saveQIE10DataNSamples", std::vector<int>());
154 desc.
addUntracked<std::vector<std::string> >(
"saveQIE10DataTags", std::vector<std::string>());
155 desc.
addUntracked<std::vector<int> >(
"saveQIE11DataNSamples", std::vector<int>());
156 desc.
addUntracked<std::vector<std::string> >(
"saveQIE11DataTags", std::vector<std::string>());
162 descriptions.
add(
"hcalRawToDigi",desc);
181 std::vector<HBHEDataFrame>
hbhe;
182 std::vector<HODataFrame>
ho;
183 std::vector<HFDataFrame>
hf;
184 std::vector<HcalTriggerPrimitiveDigi> htp;
185 std::vector<HcalCalibDataFrame>
hc;
186 std::vector<ZDCDataFrame>
zdc;
187 std::vector<HcalTTPDigi> ttp;
188 std::vector<HOTriggerPrimitiveDigi> hotp;
190 auto report = std::make_unique<HcalUnpackerReport>();
232 }
else if (fed.
size()<8*3) {
268 std::unordered_set<uint32_t> cacheForHFdup;
269 unsigned int cntHFdup = 0;
270 for(
auto & hf_digi : hf ){
271 if( ! cacheForHFdup.insert(hf_digi.id().rawId()).
second ) cntHFdup++;
273 if( cntHFdup )
edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for "<<cntHFdup<<
" times"<<std::endl;
278 if( addtl.second->samples() == colls.
qie10->
samples() ) {
280 edm::LogWarning(
"HcalRawToDigi") <<
"QIE10 data requested to be stored in tag " 281 << tag <<
" is already stored in the default QIE10 collection. " 282 <<
"To avoid duplicating, remove the tag " << tag
283 <<
" from the saveQIE10DataTags and the value of " 284 << addtl.second->samples() <<
" from the saveQIE10DataNSamples " 285 <<
"configurables to HcalRawToDigi" << std::endl;
289 if( addtl.second->samples() == colls.
qie11->
samples() ) {
291 edm::LogWarning(
"HcalRawToDigi") <<
"QIE11 data requested to be stored in tag " 292 << tag <<
" is already stored in the default QIE11 collection. " 293 <<
"To avoid duplicating, remove the tag " << tag
294 <<
" from the saveQIE11DataTags and the value of " 295 << addtl.second->samples() <<
" from the saveQIE11DataNSamples " 296 <<
"configurables to HcalRawToDigi" << std::endl;
301 auto hbhe_prod = std::make_unique<HBHEDigiCollection>();
302 auto hf_prod = std::make_unique<HFDigiCollection>();
303 auto ho_prod = std::make_unique<HODigiCollection>();
304 auto htp_prod = std::make_unique<HcalTrigPrimDigiCollection>();
305 auto hotp_prod = std::make_unique<HOTrigPrimDigiCollection>();
307 if (colls.
qie10 ==
nullptr) {
310 std::unique_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
316 std::unique_ptr<QIE10DigiCollection> qie10ZDC_prod(colls.
qie10ZDC);
322 std::unique_ptr<QIE10DigiCollection> qie10Lasermon_prod(colls.
qie10Lasermon);
324 if (colls.
qie11 ==
nullptr) {
327 std::unique_ptr<QIE11DigiCollection> qie11_prod(colls.
qie11);
332 std::unordered_map<int, std::unique_ptr<QIE10DigiCollection> > qie10_prodAddtl;
333 std::unordered_map<int, std::unique_ptr<QIE11DigiCollection> > qie11_prodAddtl;
335 qie10_prodAddtl[orig.first] = std::unique_ptr<QIE10DigiCollection>(orig.second);
338 qie11_prodAddtl[orig.first] = std::unique_ptr<QIE11DigiCollection>(orig.second);
341 hbhe_prod->swap_contents(hbhe);
342 if( !cntHFdup ) hf_prod->swap_contents(hf);
343 ho_prod->swap_contents(ho);
344 htp_prod->swap_contents(htp);
345 hotp_prod->swap_contents(hotp);
355 hbhe_prod->
swap(filtered_hbhe);
356 ho_prod->swap(filtered_ho);
357 hf_prod->swap(filtered_hf);
358 qie10_prod->swap(filtered_qie10);
359 qie11_prod->swap(filtered_qie11);
362 for(
auto &
prod : qie10_prodAddtl ) {
364 prod.second->swap(filtered_qie10);
367 for(
auto &
prod : qie11_prodAddtl ) {
369 prod.second->swap(filtered_qie11);
383 qie10ZDC_prod->sort();
384 qie10Lasermon_prod->sort();
388 for(
auto &
prod : qie10_prodAddtl ) {
391 for(
auto &
prod : qie11_prodAddtl ) {
406 for(
auto &
prod : qie10_prodAddtl ) {
411 for(
auto &
prod : qie11_prodAddtl ) {
418 auto hc_prod = std::make_unique<HcalCalibDigiCollection>();
419 hc_prod->swap_contents(hc);
423 hc_prod->
swap(filtered_calib);
432 auto prod = std::make_unique<ZDCDigiCollection>();
433 prod->swap_contents(zdc);
437 prod->swap(filtered_zdc);
445 auto prod = std::make_unique<HcalTTPDigiCollection>();
446 prod->swap_contents(ttp);
454 if(colls.
umnio !=
nullptr) {
455 e.
put(std::make_unique<HcalUMNioDigi>(umnio));
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
HcalDataFrameFilter filter_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< HcalTTPDigi > * ttp
std::vector< HFDataFrame > * hfCont
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unordered_map< int, std::string > saveQIE11Info_
void swap(SortedCollection &other)
QIE10DigiCollection * qie10Lasermon
std::vector< HBHEDataFrame > * hbheCont
char const * what() const override
std::vector< HOTriggerPrimitiveDigi > * tphoCont
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< std::string > saveQIE10DataTags_
std::unordered_map< int, QIE11DigiCollection * > qie11Addtl
~HcalRawToDigi() override
size_t size() const
Lenght of the data buffer in bytes.
void produce(edm::Event &, const edm::EventSetup &) override
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
U second(std::pair< T, U > const &p)
const int expectedOrbitMessageTime_
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::unordered_map< int, QIE10DigiCollection * > qie10Addtl
std::vector< int > saveQIE11DataNSamples_
QIE10DigiCollection * qie10ZDC
const bool complainEmptyData_
std::string electronicsMapLabel_
std::vector< HcalTriggerPrimitiveDigi > * tpCont
struct HcalRawToDigi::Statistics stats_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
HcalRawToDigi(const edm::ParameterSet &ps)
std::unordered_map< int, std::string > saveQIE10Info_
void setExpectedOrbitMessageTime(int time)
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
std::vector< HcalCalibDataFrame > * calibCont
std::vector< int > fedUnpackList_
std::vector< int > saveQIE10DataNSamples_
bool active() const
whether any filters are on
std::vector< HODataFrame > * hoCont
QIE11DigiCollection * qie11
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void setConditions(const HcalDbService *conditions)
get conditions
HBHEDigiCollection filter(const HBHEDigiCollection &incol, HcalUnpackerReport &r)
filter HB/HE data frames
QIE10DigiCollection * qie10
std::vector< ZDCDataFrame > * zdcCont
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
T const * product() const
std::vector< std::string > saveQIE11DataTags_