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))
45 std::ostringstream
ss;
48 edm::LogInfo(
"HCAL") <<
"HcalRawToDigi will unpack FEDs ( " << ss.str() <<
")";
51 produces<HBHEDigiCollection>();
52 produces<HFDigiCollection>();
53 produces<HODigiCollection>();
54 produces<HcalTrigPrimDigiCollection>();
55 produces<HOTrigPrimDigiCollection>();
56 produces<HcalUnpackerReport>();
58 produces<HcalCalibDigiCollection>();
60 produces<ZDCDigiCollection>();
62 produces<HcalTTPDigiCollection>();
63 produces<QIE10DigiCollection>();
64 produces<QIE11DigiCollection>();
76 desc.
add<
int>(
"firstSample",0);
77 desc.
add<
int>(
"lastSample",9);
78 desc.
add<
bool>(
"FilterDataQuality",
true);
79 desc.
addUntracked<std::vector<int>>(
"FEDs", std::vector<int>());
89 descriptions.
add(
"hcalRawToDigi",desc);
107 std::vector<HBHEDataFrame> hbhe;
108 std::vector<HODataFrame> ho;
109 std::vector<HFDataFrame> hf;
110 std::vector<HcalTriggerPrimitiveDigi> htp;
111 std::vector<HcalCalibDataFrame>
hc;
112 std::vector<ZDCDataFrame> zdc;
113 std::vector<HcalTTPDigi> ttp;
114 std::vector<HOTriggerPrimitiveDigi> hotp;
144 report->addError(*
i);
146 }
else if (fed.
size()<8*3) {
148 report->addError(*
i);
152 report->addUnpacked(*
i);
155 report->addError(*
i);
158 report->addError(*
i);
182 std::unordered_set<uint32_t> cacheForHFdup;
183 unsigned int cntHFdup = 0;
184 for(
auto & hf_digi : hf ){
185 if( ! cacheForHFdup.insert(hf_digi.id().rawId()).
second ) cntHFdup++;
187 if( cntHFdup )
edm::LogError(
"HcalRawToDigi") <<
"Duplicated HF digis found for "<<cntHFdup<<
" times"<<std::endl;
195 if (colls.
qie10 == 0) {
198 std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.
qie10);
199 if (colls.
qie11 == 0) {
202 std::auto_ptr<QIE11DigiCollection> qie11_prod(colls.
qie11);
204 hbhe_prod->swap_contents(hbhe);
205 if( !cntHFdup ) hf_prod->swap_contents(hf);
206 ho_prod->swap_contents(ho);
207 htp_prod->swap_contents(htp);
208 hotp_prod->swap_contents(hotp);
216 hbhe_prod->
swap(filtered_hbhe);
217 ho_prod->swap(filtered_ho);
218 hf_prod->swap(filtered_hf);
243 hc_prod->swap_contents(hc);
247 hc_prod->
swap(filtered_calib);
257 prod->swap_contents(zdc);
261 prod->
swap(filtered_zdc);
270 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)
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