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);
112 std::vector<HBHEDataFrame> hbhe;
113 std::vector<HODataFrame> ho;
114 std::vector<HFDataFrame> hf;
115 std::vector<HcalTriggerPrimitiveDigi> htp;
116 std::vector<HcalCalibDataFrame>
hc;
117 std::vector<ZDCDataFrame> zdc;
118 std::vector<HcalTTPDigi> ttp;
119 std::vector<HOTriggerPrimitiveDigi> hotp;
151 report->addError(*
i);
153 }
else if (fed.
size()<8*3) {
155 report->addError(*
i);
159 report->addUnpacked(*
i);
162 report->addError(*
i);
165 report->addError(*
i);
189 std::unordered_set<uint32_t> cacheForHFdup;
190 unsigned int cntHFdup = 0;
191 for(
auto & hf_digi : hf ){
192 if( ! cacheForHFdup.insert(hf_digi.id().rawId()).
second ) cntHFdup++;
194 if( cntHFdup )
edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for "<<cntHFdup<<
" times"<<std::endl;
202 if (colls.
qie10 == 0) {
205 std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
209 std::unique_ptr<QIE10DigiCollection> qie10ZDC_prod(colls.
qie10ZDC);
210 if (colls.
qie11 == 0) {
213 std::auto_ptr<QIE11DigiCollection> qie11_prod(colls.
qie11);
215 hbhe_prod->swap_contents(hbhe);
216 if( !cntHFdup ) hf_prod->swap_contents(hf);
217 ho_prod->swap_contents(ho);
218 htp_prod->swap_contents(htp);
219 hotp_prod->swap_contents(hotp);
227 hbhe_prod->
swap(filtered_hbhe);
228 ho_prod->swap(filtered_ho);
229 hf_prod->swap(filtered_hf);
241 qie10ZDC_prod->sort();
256 hc_prod->swap_contents(hc);
260 hc_prod->
swap(filtered_calib);
270 prod->swap_contents(zdc);
274 prod->
swap(filtered_zdc);
283 prod->swap_contents(ttp);
291 if(colls.
umnio != 0) {
virtual char const * what() const
T getParameter(std::string const &) const
HcalDataFrameFilter filter_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
std::vector< HcalTTPDigi > * ttp
edm::SortedCollection< HcalTriggerPrimitiveDigi > HcalTrigPrimDigiCollection
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)
edm::SortedCollection< HOTriggerPrimitiveDigi > HOTrigPrimDigiCollection
size_t size() const
Lenght of the data buffer in bytes.
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
virtual void produce(edm::Event &, const edm::EventSetup &) override
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
U second(std::pair< T, U > const &p)
const int expectedOrbitMessageTime_
edm::SortedCollection< HODataFrame > HODigiCollection
QIE10DigiCollection * qie10ZDC
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
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)
edm::SortedCollection< HcalCalibDataFrame > HcalCalibDigiCollection
std::vector< HcalCalibDataFrame > * calibCont
std::vector< int > fedUnpackList_
T const * product() const
bool active() const
whether any filters are on
std::vector< HODataFrame > * hoCont
QIE11DigiCollection * qie11
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HBHEDigiCollection filter(const HBHEDigiCollection &incol, HcalUnpackerReport &r)
filter HB/HE data frames
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
edm::SortedCollection< HFDataFrame > HFDigiCollection
QIE10DigiCollection * qie10
std::vector< ZDCDataFrame > * zdcCont
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
volatile std::atomic< bool > shutdown_flag false
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection