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 silent_(conf.getUntrackedParameter<bool>(
"silent",
true)),
26 complainEmptyData_(conf.getUntrackedParameter<bool>(
"ComplainEmptyData",
false)),
27 unpackerMode_(conf.getUntrackedParameter<int>(
"UnpackerMode",0)),
28 expectedOrbitMessageTime_(conf.getUntrackedParameter<int>(
"ExpectedOrbitMessageTime",-1))
44 std::ostringstream
ss;
47 edm::LogInfo(
"HCAL") <<
"HcalRawToDigi will unpack FEDs ( " << ss.str() <<
")";
50 produces<HBHEDigiCollection>();
51 produces<HFDigiCollection>();
52 produces<HODigiCollection>();
53 produces<HcalTrigPrimDigiCollection>();
54 produces<HOTrigPrimDigiCollection>();
55 produces<HcalUnpackerReport>();
57 produces<HcalCalibDigiCollection>();
59 produces<ZDCDigiCollection>();
61 produces<HcalTTPDigiCollection>();
62 produces<QIE10DigiCollection>();
74 desc.
add<
int>(
"firstSample",0);
75 desc.
add<
int>(
"lastSample",9);
76 desc.
add<
bool>(
"FilterDataQuality",
true);
77 desc.
addUntracked<std::vector<int>>(
"FEDs", std::vector<int>());
87 descriptions.
add(
"hcalRawToDigi",desc);
105 std::vector<HBHEDataFrame> hbhe;
106 std::vector<HODataFrame> ho;
107 std::vector<HFDataFrame> hf;
108 std::vector<HcalTriggerPrimitiveDigi> htp;
109 std::vector<HcalCalibDataFrame>
hc;
110 std::vector<ZDCDataFrame> zdc;
111 std::vector<HcalTTPDigi> ttp;
112 std::vector<HOTriggerPrimitiveDigi> hotp;
142 report->addError(*
i);
144 }
else if (fed.
size()<8*3) {
146 report->addError(*
i);
150 report->addUnpacked(*
i);
153 report->addError(*
i);
156 report->addError(*
i);
180 std::unordered_set<uint32_t> cacheForHFdup;
181 unsigned int cntHFdup = 0;
182 for(
auto & hf_digi : hf ){
183 if( ! cacheForHFdup.insert(hf_digi.id().rawId()).
second ) cntHFdup++;
185 if( cntHFdup )
edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for "<<cntHFdup<<
" times"<<std::endl;
193 if (colls.
qie10 == 0) {
196 std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
198 hbhe_prod->swap_contents(hbhe);
199 if( !cntHFdup ) hf_prod->swap_contents(hf);
200 ho_prod->swap_contents(ho);
201 htp_prod->swap_contents(htp);
202 hotp_prod->swap_contents(hotp);
210 hbhe_prod->
swap(filtered_hbhe);
211 ho_prod->swap(filtered_ho);
212 hf_prod->swap(filtered_hf);
235 hc_prod->swap_contents(hc);
239 hc_prod->
swap(filtered_calib);
249 prod->swap_contents(zdc);
253 prod->
swap(filtered_zdc);
262 prod->swap_contents(ttp);
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
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)
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
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