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 silent_(conf.getUntrackedParameter<bool>(
"silent",
true)),
27 complainEmptyData_(conf.getUntrackedParameter<bool>(
"ComplainEmptyData",
false)),
28 unpackerMode_(conf.getUntrackedParameter<
int>(
"UnpackerMode",0)),
29 expectedOrbitMessageTime_(conf.getUntrackedParameter<
int>(
"ExpectedOrbitMessageTime",-1))
46 std::ostringstream ss;
49 edm::LogInfo(
"HCAL") <<
"HcalRawToDigi will unpack FEDs ( " << ss.str() <<
")";
52 produces<HBHEDigiCollection>();
53 produces<HFDigiCollection>();
54 produces<HODigiCollection>();
55 produces<HcalTrigPrimDigiCollection>();
56 produces<HOTrigPrimDigiCollection>();
57 produces<HcalUnpackerReport>();
59 produces<HcalCalibDigiCollection>();
61 produces<ZDCDigiCollection>();
63 produces<HcalTTPDigiCollection>();
65 produces<HcalUMNioDigi>();
66 produces<QIE10DigiCollection>();
67 produces<QIE11DigiCollection>();
68 produces<QIE10DigiCollection>(
"ZDC");
80 desc.
add<
int>(
"firstSample",0);
81 desc.
add<
int>(
"lastSample",9);
82 desc.
add<
bool>(
"FilterDataQuality",
true);
83 desc.
addUntracked<std::vector<int>>(
"FEDs", std::vector<int>());
94 descriptions.
add(
"hcalRawToDigi",desc);
113 std::vector<HBHEDataFrame>
hbhe;
114 std::vector<HODataFrame>
ho;
115 std::vector<HFDataFrame>
hf;
116 std::vector<HcalTriggerPrimitiveDigi> htp;
117 std::vector<HcalCalibDataFrame>
hc;
118 std::vector<ZDCDataFrame>
zdc;
119 std::vector<HcalTTPDigi> ttp;
120 std::vector<HOTriggerPrimitiveDigi> hotp;
122 auto report = std::make_unique<HcalUnpackerReport>();
154 }
else if (fed.
size()<8*3) {
190 std::unordered_set<uint32_t> cacheForHFdup;
191 unsigned int cntHFdup = 0;
192 for(
auto & hf_digi : hf ){
193 if( ! cacheForHFdup.insert(hf_digi.id().rawId()).
second ) cntHFdup++;
195 if( cntHFdup )
edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for "<<cntHFdup<<
" times"<<std::endl;
198 auto hbhe_prod = std::make_unique<HBHEDigiCollection>();
199 auto hf_prod = std::make_unique<HFDigiCollection>();
200 auto ho_prod = std::make_unique<HODigiCollection>();
201 auto htp_prod = std::make_unique<HcalTrigPrimDigiCollection>();
202 auto hotp_prod = std::make_unique<HOTrigPrimDigiCollection>();
203 if (colls.
qie10 == 0) {
206 std::unique_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
210 std::unique_ptr<QIE10DigiCollection> qie10ZDC_prod(colls.
qie10ZDC);
211 if (colls.
qie11 == 0) {
214 std::unique_ptr<QIE11DigiCollection> qie11_prod(colls.
qie11);
216 hbhe_prod->swap_contents(hbhe);
217 if( !cntHFdup ) hf_prod->swap_contents(hf);
218 ho_prod->swap_contents(ho);
219 htp_prod->swap_contents(htp);
220 hotp_prod->swap_contents(hotp);
230 hbhe_prod->
swap(filtered_hbhe);
231 ho_prod->swap(filtered_ho);
232 hf_prod->swap(filtered_hf);
233 qie10_prod->swap(filtered_qie10);
234 qie11_prod->swap(filtered_qie11);
246 qie10ZDC_prod->sort();
260 auto hc_prod = std::make_unique<HcalCalibDigiCollection>();
261 hc_prod->swap_contents(hc);
265 hc_prod->
swap(filtered_calib);
274 auto prod = std::make_unique<ZDCDigiCollection>();
275 prod->swap_contents(zdc);
279 prod->swap(filtered_zdc);
287 auto prod = std::make_unique<HcalTTPDigiCollection>();
288 prod->swap_contents(ttp);
296 if(colls.
umnio != 0) {
297 e.
put(std::make_unique<HcalUMNioDigi>(umnio));
virtual char const * what() const
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
void swap(SortedCollection &other)
std::vector< HBHEDataFrame > * hbheCont
std::vector< HOTriggerPrimitiveDigi > * tphoCont
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
size_t size() const
Lenght of the data buffer in bytes.
virtual 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
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)
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_
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