CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
HcalRawToDigi Class Reference

#include <HcalRawToDigi.h>

Inheritance diagram for HcalRawToDigi:
edm::stream::EDProducer<>

Classes

struct  Statistics
 

Public Member Functions

 HcalRawToDigi (const edm::ParameterSet &ps)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~HcalRawToDigi () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

const bool complainEmptyData_
 
std::string electronicsMapLabel_
 
const int expectedOrbitMessageTime_
 
std::vector< int > fedUnpackList_
 
HcalDataFrameFilter filter_
 
const int firstFED_
 
std::vector< int > saveQIE10DataNSamples_
 
std::vector< std::string > saveQIE10DataTags_
 
std::unordered_map< int, std::string > saveQIE10Info_
 
std::vector< int > saveQIE11DataNSamples_
 
std::vector< std::string > saveQIE11DataTags_
 
std::unordered_map< int, std::string > saveQIE11Info_
 
const bool silent_
 
struct HcalRawToDigi::Statistics stats_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_data_
 
const bool unpackCalib_
 
HcalUnpacker unpacker_
 
const int unpackerMode_
 
const bool unpackTTP_
 
bool unpackUMNio_
 
const bool unpackZDC_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

HcalRawToDigi is the EDProducer subclass which runs the Hcal Unpack algorithm.

Author
Jeremiah Mans
Version
1st Version June 10, 2005

Definition at line 29 of file HcalRawToDigi.h.

Constructor & Destructor Documentation

HcalRawToDigi::HcalRawToDigi ( const edm::ParameterSet ps)
explicit

Definition at line 14 of file HcalRawToDigi.cc.

References electronicsMapLabel_, expectedOrbitMessageTime_, fedUnpackList_, spr::find(), edm::ParameterSet::getParameter(), mps_fire::i, training_settings::idx, FEDNumbering::MAXHCALFEDID, FEDNumbering::MAXHCALuTCAFEDID, FEDNumbering::MINHCALFEDID, FEDNumbering::MINHCALuTCAFEDID, saveQIE10DataNSamples_, saveQIE10DataTags_, saveQIE10Info_, saveQIE11DataNSamples_, saveQIE11DataTags_, saveQIE11Info_, HcalUnpacker::setExpectedOrbitMessageTime(), HcalUnpacker::setMode(), contentValuesCheck::ss, stats_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tok_data_, unpackCalib_, unpacker_, unpackerMode_, unpackTTP_, unpackUMNio_, and unpackZDC_.

15  : unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED", int(FEDNumbering::MINHCALFEDID)),
16  conf.getParameter<int>("firstSample"),
17  conf.getParameter<int>("lastSample")),
18  filter_(
19  conf.getParameter<bool>("FilterDataQuality"), conf.getParameter<bool>("FilterDataQuality"), false, 0, 0, -1),
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>())),
28  conf.getUntrackedParameter<std::vector<std::string>>("saveQIE10DataTags", std::vector<std::string>())),
29  saveQIE11DataNSamples_(conf.getUntrackedParameter<std::vector<int>>("saveQIE11DataNSamples", std::vector<int>())),
31  conf.getUntrackedParameter<std::vector<std::string>>("saveQIE11DataTags", std::vector<std::string>())),
32  silent_(conf.getUntrackedParameter<bool>("silent", true)),
33  complainEmptyData_(conf.getUntrackedParameter<bool>("ComplainEmptyData", false)),
34  unpackerMode_(conf.getUntrackedParameter<int>("UnpackerMode", 0)),
35  expectedOrbitMessageTime_(conf.getUntrackedParameter<int>("ExpectedOrbitMessageTime", -1)) {
36  electronicsMapLabel_ = conf.getParameter<std::string>("ElectronicsMap");
37  tok_data_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("InputLabel"));
38 
39  if (fedUnpackList_.empty()) {
40  // VME range for back-compatibility
42  fedUnpackList_.push_back(i);
43 
44  // uTCA range
46  fedUnpackList_.push_back(i);
47  }
48 
51  std::ostringstream ss;
52  for (unsigned int i = 0; i < fedUnpackList_.size(); i++)
53  ss << fedUnpackList_[i] << " ";
54  edm::LogInfo("HCAL") << "HcalRawToDigi will unpack FEDs ( " << ss.str() << ")";
55 
56  // products produced...
57  produces<HBHEDigiCollection>();
58  produces<HFDigiCollection>();
59  produces<HODigiCollection>();
60  produces<HcalTrigPrimDigiCollection>();
61  produces<HOTrigPrimDigiCollection>();
62  produces<HcalUnpackerReport>();
63  if (unpackCalib_)
64  produces<HcalCalibDigiCollection>();
65  if (unpackZDC_)
66  produces<ZDCDigiCollection>();
67  if (unpackTTP_)
68  produces<HcalTTPDigiCollection>();
69  if (unpackUMNio_)
70  produces<HcalUMNioDigi>();
71  produces<QIE10DigiCollection>();
72  produces<QIE11DigiCollection>();
73 
74  produces<QIE10DigiCollection>("ZDC");
75  produces<QIE10DigiCollection>("LASERMON");
76 
77  // Print a warning if an already
78  // used tag was requested
79  if (std::find(saveQIE10DataTags_.begin(), saveQIE10DataTags_.end(), "ZDC") != saveQIE10DataTags_.end()) {
80  edm::LogWarning("HcalRawToDigi")
81  << "Cannot create an additional QIE10 sample with name ZDC, it is already created! It must be removed along "
82  "with the corresponding entry in saveQIE10DataNSamples"
83  << std::endl;
84  saveQIE10DataTags_.clear();
85  saveQIE10DataNSamples_.clear();
86  }
87  // Print a warning if an already
88  // used tag was requested
89  if (std::find(saveQIE10DataTags_.begin(), saveQIE10DataTags_.end(), "LASERMON") != saveQIE10DataTags_.end()) {
90  edm::LogWarning("HcalRawToDigi")
91  << "Cannot create an additional QIE10 sample with name LASERMON, it is already created! It must be removed "
92  "along with the corresponding entry in saveQIE10DataNSamples"
93  << std::endl;
94  saveQIE10DataTags_.clear();
95  saveQIE10DataNSamples_.clear();
96  }
97 
98  // Print a warning if the two vectors
99  // for additional qie10 or qie11 data
100  // are not the same length
101  if (saveQIE10DataTags_.size() != saveQIE10DataNSamples_.size()) {
102  edm::LogWarning("HcalRawToDigi")
103  << "The saveQIE10DataTags and saveQIE10DataNSamples inputs must be the same length! These will be ignored"
104  << std::endl;
105  saveQIE10DataTags_.clear();
106  saveQIE10DataNSamples_.clear();
107  }
108  if (saveQIE11DataTags_.size() != saveQIE11DataNSamples_.size()) {
109  edm::LogWarning("HcalRawToDigi")
110  << "The saveQIE11DataTags and saveQIE11DataNSamples inputs must be the same length! These will be ignored"
111  << std::endl;
112  saveQIE11DataTags_.clear();
113  saveQIE11DataNSamples_.clear();
114  }
115 
116  // If additional qie10 samples were requested,
117  // declare that we will produce this collection
118  // with the given tag. Also store the map
119  // from nSamples to tag for later use
120  for (unsigned idx = 0; idx < saveQIE10DataNSamples_.size(); ++idx) {
121  int nsamples = saveQIE10DataNSamples_[idx];
123 
124  produces<QIE10DigiCollection>(tag);
125 
126  saveQIE10Info_[nsamples] = tag;
127  }
128 
129  // If additional qie11 samples were requested,
130  // declare that we will produce this collection
131  // with the given tag. Also store the map
132  // from nSamples to tag for later use
133  for (unsigned idx = 0; idx < saveQIE11DataNSamples_.size(); ++idx) {
134  int nsamples = saveQIE11DataNSamples_[idx];
136 
137  produces<QIE11DigiCollection>(tag);
138 
139  saveQIE11Info_[nsamples] = tag;
140  }
141 
142  memset(&stats_, 0, sizeof(stats_));
143 }
HcalDataFrameFilter filter_
Definition: HcalRawToDigi.h:39
const bool unpackTTP_
Definition: HcalRawToDigi.h:42
std::unordered_map< int, std::string > saveQIE11Info_
Definition: HcalRawToDigi.h:60
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< std::string > saveQIE10DataTags_
Definition: HcalRawToDigi.h:47
const int expectedOrbitMessageTime_
Definition: HcalRawToDigi.h:54
std::vector< int > saveQIE11DataNSamples_
Definition: HcalRawToDigi.h:50
const bool complainEmptyData_
Definition: HcalRawToDigi.h:53
std::string electronicsMapLabel_
Definition: HcalRawToDigi.h:55
struct HcalRawToDigi::Statistics stats_
const bool unpackZDC_
Definition: HcalRawToDigi.h:42
const bool unpackCalib_
Definition: HcalRawToDigi.h:42
std::unordered_map< int, std::string > saveQIE10Info_
Definition: HcalRawToDigi.h:59
const bool silent_
Definition: HcalRawToDigi.h:53
void setExpectedOrbitMessageTime(int time)
Definition: HcalUnpacker.h:59
void setMode(int mode)
Definition: HcalUnpacker.h:66
std::vector< int > fedUnpackList_
Definition: HcalRawToDigi.h:40
std::vector< int > saveQIE10DataNSamples_
Definition: HcalRawToDigi.h:46
const int unpackerMode_
Definition: HcalRawToDigi.h:54
HcalUnpacker unpacker_
Definition: HcalRawToDigi.h:38
const int firstFED_
Definition: HcalRawToDigi.h:41
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
Definition: HcalRawToDigi.h:37
std::vector< std::string > saveQIE11DataTags_
Definition: HcalRawToDigi.h:51
HcalRawToDigi::~HcalRawToDigi ( )
override

Definition at line 146 of file HcalRawToDigi.cc.

146 {}

Member Function Documentation

void HcalRawToDigi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 148 of file HcalRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), HLT_2018_cff::InputTag, createfilelist::int, FEDNumbering::MINHCALFEDID, and AlCaHLTBitMon_QueryRunRegistry::string.

148  {
150  desc.addUntracked<int>("HcalFirstFED", int(FEDNumbering::MINHCALFEDID));
151  desc.add<int>("firstSample", 0);
152  desc.add<int>("lastSample", 9);
153  desc.add<bool>("FilterDataQuality", true);
154  desc.addUntracked<std::vector<int>>("FEDs", std::vector<int>());
155  desc.addUntracked<bool>("UnpackZDC", true);
156  desc.addUntracked<bool>("UnpackCalib", true);
157  desc.addUntracked<bool>("UnpackUMNio", true);
158  desc.addUntracked<bool>("UnpackTTP", true);
159  desc.addUntracked<bool>("silent", true);
160  desc.addUntracked<std::vector<int>>("saveQIE10DataNSamples", std::vector<int>());
161  desc.addUntracked<std::vector<std::string>>("saveQIE10DataTags", std::vector<std::string>());
162  desc.addUntracked<std::vector<int>>("saveQIE11DataNSamples", std::vector<int>());
163  desc.addUntracked<std::vector<std::string>>("saveQIE11DataTags", std::vector<std::string>());
164  desc.addUntracked<bool>("ComplainEmptyData", false);
165  desc.addUntracked<int>("UnpackerMode", 0);
166  desc.addUntracked<int>("ExpectedOrbitMessageTime", -1);
167  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
168  desc.add<std::string>("ElectronicsMap", "");
169  descriptions.add("hcalRawToDigi", desc);
170 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HcalRawToDigi::produce ( edm::Event e,
const edm::EventSetup es 
)
override

calib

zdc

umnio

Definition at line 173 of file HcalRawToDigi.cc.

References HcalDataFrameFilter::active(), HcalRawToDigi::Statistics::ave_calib, HcalRawToDigi::Statistics::ave_hbhe, HcalRawToDigi::Statistics::ave_hf, HcalRawToDigi::Statistics::ave_ho, HcalRawToDigi::Statistics::ave_tp, HcalRawToDigi::Statistics::ave_tpho, HcalUnpacker::Collections::calibCont, complainEmptyData_, electronicsMapLabel_, FEDRawDataCollection::FEDData(), fedUnpackList_, HcalDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByToken(), photonIsolationHIProducer_cfi::hbhe, HcalUnpacker::Collections::hbheCont, AnalysisDataFormats_SUSYBSMObjects::hc, photonIsolationHIProducer_cfi::hf, HcalUnpacker::Collections::hfCont, photonIsolationHIProducer_cfi::ho, HcalUnpacker::Collections::hoCont, mps_fire::i, info(), B2GTnPMonitor_cfi::item, SiStripPI::max, HcalRawToDigi::Statistics::max_calib, HcalRawToDigi::Statistics::max_hbhe, HcalRawToDigi::Statistics::max_hf, HcalRawToDigi::Statistics::max_ho, HcalRawToDigi::Statistics::max_tp, HcalRawToDigi::Statistics::max_tpho, eostools::move(), HcalRawToDigi::Statistics::n, dumpMFGeometry_cfg::prod, edm::ESHandle< T >::product(), edm::Event::put(), HcalUnpacker::Collections::qie10, HcalUnpacker::Collections::qie10Addtl, HcalUnpacker::Collections::qie10Lasermon, HcalUnpacker::Collections::qie10ZDC, HcalUnpacker::Collections::qie11, HcalUnpacker::Collections::qie11Addtl, edmIntegrityCheck::report, HcalDataFrameContainer< Digi >::samples(), saveQIE10Info_, saveQIE11Info_, edm::second(), HcalDataFrameFilter::setConditions(), silent_, FEDRawData::size(), stats_, AlCaHLTBitMon_QueryRunRegistry::string, edm::SortedCollection< T, SORT >::swap(), GlobalPosition_Frontier_DevDB_cff::tag, tok_data_, HcalUnpacker::Collections::tpCont, HcalUnpacker::Collections::tphoCont, HcalUnpacker::Collections::ttp, HcalUnpacker::Collections::umnio, HcalUnpacker::unpack(), unpackCalib_, unpacker_, unpackTTP_, unpackUMNio_, unpackZDC_, cms::Exception::what(), hcalSimParameters_cfi::zdc, and HcalUnpacker::Collections::zdcCont.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

173  {
174  // Step A: Get Inputs
176  e.getByToken(tok_data_, rawraw);
177  // get the mapping
179  es.get<HcalDbRecord>().get(pSetup);
182  const HcalElectronicsMap* readoutMap = item.product();
183  filter_.setConditions(pSetup.product());
184 
185  // Step B: Create empty output : three vectors for three classes...
186  std::vector<HBHEDataFrame> hbhe;
187  std::vector<HODataFrame> ho;
188  std::vector<HFDataFrame> hf;
189  std::vector<HcalTriggerPrimitiveDigi> htp;
190  std::vector<HcalCalibDataFrame> hc;
191  std::vector<ZDCDataFrame> zdc;
192  std::vector<HcalTTPDigi> ttp;
193  std::vector<HOTriggerPrimitiveDigi> hotp;
194  HcalUMNioDigi umnio;
195  auto report = std::make_unique<HcalUnpackerReport>();
196 
197  // Heuristics: use ave+(max-ave)/8
198  if (stats_.max_hbhe > 0)
199  hbhe.reserve(stats_.ave_hbhe + (stats_.max_hbhe - stats_.ave_hbhe) / 8);
200  if (stats_.max_ho > 0)
201  ho.reserve(stats_.ave_ho + (stats_.max_ho - stats_.ave_ho) / 8);
202  if (stats_.max_hf > 0)
203  hf.reserve(stats_.ave_hf + (stats_.max_hf - stats_.ave_hf) / 8);
204  if (stats_.max_calib > 0)
205  hc.reserve(stats_.ave_calib + (stats_.max_calib - stats_.ave_calib) / 8);
206  if (stats_.max_tp > 0)
207  htp.reserve(stats_.ave_tp + (stats_.max_tp - stats_.ave_tp) / 8);
208  if (stats_.max_tpho > 0)
209  hotp.reserve(stats_.ave_tpho + (stats_.max_tpho - stats_.ave_tpho) / 8);
210 
211  if (unpackZDC_)
212  zdc.reserve(24);
213 
215  colls.hbheCont = &hbhe;
216  colls.hoCont = &ho;
217  colls.hfCont = &hf;
218  colls.tpCont = &htp;
219  colls.tphoCont = &hotp;
220  colls.calibCont = &hc;
221  colls.zdcCont = &zdc;
222  colls.umnio = &umnio;
223  if (unpackTTP_)
224  colls.ttp = &ttp;
225 
226  // make an entry for each additional qie10 collection that is requested
227  for (const auto& info : saveQIE10Info_) {
228  colls.qie10Addtl[info.first] = new QIE10DigiCollection(info.first);
229  }
230 
231  // make an entry for each additional qie11 collection that is requested
232  for (const auto& info : saveQIE11Info_) {
233  colls.qie11Addtl[info.first] = new QIE11DigiCollection(info.first);
234  }
235 
236  // Step C: unpack all requested FEDs
237  for (std::vector<int>::const_iterator i = fedUnpackList_.begin(); i != fedUnpackList_.end(); i++) {
238  const FEDRawData& fed = rawraw->FEDData(*i);
239  if (fed.size() == 0) {
240  if (complainEmptyData_) {
241  if (!silent_)
242  edm::LogWarning("EmptyData") << "No data for FED " << *i;
243  report->addError(*i);
244  }
245  } else if (fed.size() < 8 * 3) {
246  if (!silent_)
247  edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
248  report->addError(*i);
249  } else {
250  try {
251  unpacker_.unpack(fed, *readoutMap, colls, *report, silent_);
252  report->addUnpacked(*i);
253  } catch (cms::Exception& e) {
254  if (!silent_)
255  edm::LogWarning("Unpacking error") << e.what();
256  report->addError(*i);
257  } catch (...) {
258  if (!silent_)
259  edm::LogWarning("Unpacking exception");
260  report->addError(*i);
261  }
262  }
263  }
264 
265  // gather statistics
266  stats_.max_hbhe = std::max(stats_.max_hbhe, (int)hbhe.size());
267  stats_.ave_hbhe = (stats_.ave_hbhe * stats_.n + hbhe.size()) / (stats_.n + 1);
268  stats_.max_ho = std::max(stats_.max_ho, (int)ho.size());
269  stats_.ave_ho = (stats_.ave_ho * stats_.n + ho.size()) / (stats_.n + 1);
270  stats_.max_hf = std::max(stats_.max_hf, (int)hf.size());
271  stats_.ave_hf = (stats_.ave_hf * stats_.n + hf.size()) / (stats_.n + 1);
272  stats_.max_tp = std::max(stats_.max_tp, (int)htp.size());
273  stats_.ave_tp = (stats_.ave_tp * stats_.n + htp.size()) / (stats_.n + 1);
274  stats_.max_tpho = std::max(stats_.max_tpho, (int)hotp.size());
275  stats_.ave_tpho = (stats_.ave_tpho * stats_.n + hotp.size()) / (stats_.n + 1);
276  stats_.max_calib = std::max(stats_.max_calib, (int)hc.size());
277  stats_.ave_calib = (stats_.ave_calib * stats_.n + hc.size()) / (stats_.n + 1);
278 
279  stats_.n++;
280 
281  // check HF duplication
282  std::unordered_set<uint32_t> cacheForHFdup;
283  unsigned int cntHFdup = 0;
284  for (auto& hf_digi : hf) {
285  if (!cacheForHFdup.insert(hf_digi.id().rawId()).second)
286  cntHFdup++;
287  }
288  if (cntHFdup)
289  edm::LogError("HcalRawToDigi") << "Duplicated HF digis found for " << cntHFdup << " times" << std::endl;
290 
291  // Check that additional QIE10 and QIE11 collections
292  // do not duplicate the default collections
293  for (const auto& addtl : colls.qie10Addtl) {
294  if (addtl.second->samples() == colls.qie10->samples()) {
295  std::string tag = saveQIE10Info_[addtl.second->samples()];
296  edm::LogWarning("HcalRawToDigi") << "QIE10 data requested to be stored in tag " << tag
297  << " is already stored in the default QIE10 collection. "
298  << "To avoid duplicating, remove the tag " << tag
299  << " from the saveQIE10DataTags and the value of " << addtl.second->samples()
300  << " from the saveQIE10DataNSamples "
301  << "configurables to HcalRawToDigi" << std::endl;
302  }
303  }
304  for (const auto& addtl : colls.qie11Addtl) {
305  if (addtl.second->samples() == colls.qie11->samples()) {
306  std::string tag = saveQIE11Info_[addtl.second->samples()];
307  edm::LogWarning("HcalRawToDigi") << "QIE11 data requested to be stored in tag " << tag
308  << " is already stored in the default QIE11 collection. "
309  << "To avoid duplicating, remove the tag " << tag
310  << " from the saveQIE11DataTags and the value of " << addtl.second->samples()
311  << " from the saveQIE11DataNSamples "
312  << "configurables to HcalRawToDigi" << std::endl;
313  }
314  }
315 
316  // Step B: encapsulate vectors in actual collections
317  auto hbhe_prod = std::make_unique<HBHEDigiCollection>();
318  auto hf_prod = std::make_unique<HFDigiCollection>();
319  auto ho_prod = std::make_unique<HODigiCollection>();
320  auto htp_prod = std::make_unique<HcalTrigPrimDigiCollection>();
321  auto hotp_prod = std::make_unique<HOTrigPrimDigiCollection>();
322  // make qie10 collection if it wasn't made in theunpacker
323  if (colls.qie10 == nullptr) {
324  colls.qie10 = new QIE10DigiCollection();
325  }
326  std::unique_ptr<QIE10DigiCollection> qie10_prod(colls.qie10);
327 
328  // make qie10ZDC collection if it wasn't made in theunpacker
329  if (colls.qie10ZDC == nullptr) {
330  colls.qie10ZDC = new QIE10DigiCollection();
331  }
332  std::unique_ptr<QIE10DigiCollection> qie10ZDC_prod(colls.qie10ZDC);
333 
334  // make qie10Lasermon collection if it wasn't made in theunpacker
335  if (colls.qie10Lasermon == nullptr) {
336  colls.qie10Lasermon = new QIE10DigiCollection();
337  }
338  std::unique_ptr<QIE10DigiCollection> qie10Lasermon_prod(colls.qie10Lasermon);
339 
340  if (colls.qie11 == nullptr) {
341  colls.qie11 = new QIE11DigiCollection();
342  }
343  std::unique_ptr<QIE11DigiCollection> qie11_prod(colls.qie11);
344 
345  // follow the procedure for other collections. Copy the unpacked
346  // data so that it can be filtered and sorted
347  std::unordered_map<int, std::unique_ptr<QIE10DigiCollection>> qie10_prodAddtl;
348  std::unordered_map<int, std::unique_ptr<QIE11DigiCollection>> qie11_prodAddtl;
349  for (const auto& orig : colls.qie10Addtl) {
350  qie10_prodAddtl[orig.first] = std::unique_ptr<QIE10DigiCollection>(orig.second);
351  }
352  for (const auto& orig : colls.qie11Addtl) {
353  qie11_prodAddtl[orig.first] = std::unique_ptr<QIE11DigiCollection>(orig.second);
354  }
355 
356  hbhe_prod->swap_contents(hbhe);
357  if (!cntHFdup)
358  hf_prod->swap_contents(hf);
359  ho_prod->swap_contents(ho);
360  htp_prod->swap_contents(htp);
361  hotp_prod->swap_contents(hotp);
362 
363  // Step C2: filter FEDs, if required
364  if (filter_.active()) {
365  HBHEDigiCollection filtered_hbhe = filter_.filter(*hbhe_prod, *report);
366  HODigiCollection filtered_ho = filter_.filter(*ho_prod, *report);
367  HFDigiCollection filtered_hf = filter_.filter(*hf_prod, *report);
368  QIE10DigiCollection filtered_qie10 = filter_.filter(*qie10_prod, *report);
369  QIE11DigiCollection filtered_qie11 = filter_.filter(*qie11_prod, *report);
370 
371  hbhe_prod->swap(filtered_hbhe);
372  ho_prod->swap(filtered_ho);
373  hf_prod->swap(filtered_hf);
374  qie10_prod->swap(filtered_qie10);
375  qie11_prod->swap(filtered_qie11);
376 
377  // apply filter to additional collections
378  for (auto& prod : qie10_prodAddtl) {
379  QIE10DigiCollection filtered_qie10 = filter_.filter(*(prod.second), *report);
380  prod.second->swap(filtered_qie10);
381  }
382 
383  for (auto& prod : qie11_prodAddtl) {
384  QIE11DigiCollection filtered_qie11 = filter_.filter(*(prod.second), *report);
385  prod.second->swap(filtered_qie11);
386  }
387  }
388 
389  // Step D: Put outputs into event
390  // just until the sorting is proven
391  hbhe_prod->sort();
392  ho_prod->sort();
393  hf_prod->sort();
394  htp_prod->sort();
395  hotp_prod->sort();
396  qie10_prod->sort();
397  qie10ZDC_prod->sort();
398  qie10Lasermon_prod->sort();
399  qie11_prod->sort();
400 
401  // sort the additional collections
402  for (auto& prod : qie10_prodAddtl) {
403  prod.second->sort();
404  }
405  for (auto& prod : qie11_prodAddtl) {
406  prod.second->sort();
407  }
408 
409  e.put(std::move(hbhe_prod));
410  e.put(std::move(ho_prod));
411  e.put(std::move(hf_prod));
412  e.put(std::move(htp_prod));
413  e.put(std::move(hotp_prod));
414  e.put(std::move(qie10_prod));
415  e.put(std::move(qie10ZDC_prod), "ZDC");
416  e.put(std::move(qie10Lasermon_prod), "LASERMON");
417  e.put(std::move(qie11_prod));
418 
419  // put the qie10 and qie11 collections into the event
420  for (auto& prod : qie10_prodAddtl) {
421  std::string tag = saveQIE10Info_[prod.first];
422  e.put(std::move(prod.second), tag);
423  }
424 
425  for (auto& prod : qie11_prodAddtl) {
426  std::string tag = saveQIE11Info_[prod.first];
427  e.put(std::move(prod.second), tag);
428  }
429 
431  if (unpackCalib_) {
432  auto hc_prod = std::make_unique<HcalCalibDigiCollection>();
433  hc_prod->swap_contents(hc);
434 
435  if (filter_.active()) {
436  HcalCalibDigiCollection filtered_calib = filter_.filter(*hc_prod, *report);
437  hc_prod->swap(filtered_calib);
438  }
439 
440  hc_prod->sort();
441  e.put(std::move(hc_prod));
442  }
443 
445  if (unpackZDC_) {
446  auto prod = std::make_unique<ZDCDigiCollection>();
447  prod->swap_contents(zdc);
448 
449  if (filter_.active()) {
450  ZDCDigiCollection filtered_zdc = filter_.filter(*prod, *report);
451  prod->swap(filtered_zdc);
452  }
453 
454  prod->sort();
455  e.put(std::move(prod));
456  }
457 
458  if (unpackTTP_) {
459  auto prod = std::make_unique<HcalTTPDigiCollection>();
460  prod->swap_contents(ttp);
461 
462  prod->sort();
463  e.put(std::move(prod));
464  }
465  e.put(std::move(report));
467  if (unpackUMNio_) {
468  if (colls.umnio != nullptr) {
469  e.put(std::make_unique<HcalUMNioDigi>(umnio));
470  }
471  }
472 }
static const TGPicture * info(bool iBackgroundIsBlack)
HcalDataFrameFilter filter_
Definition: HcalRawToDigi.h:39
std::vector< HcalTTPDigi > * ttp
Definition: HcalUnpacker.h:32
const bool unpackTTP_
Definition: HcalRawToDigi.h:42
std::vector< HFDataFrame > * hfCont
Definition: HcalUnpacker.h:27
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
HcalUMNioDigi * umnio
Definition: HcalUnpacker.h:40
std::unordered_map< int, std::string > saveQIE11Info_
Definition: HcalRawToDigi.h:60
void swap(SortedCollection &other)
QIE10DigiCollection * qie10Lasermon
Definition: HcalUnpacker.h:35
std::vector< HBHEDataFrame > * hbheCont
Definition: HcalUnpacker.h:25
char const * what() const override
Definition: Exception.cc:103
std::vector< HOTriggerPrimitiveDigi > * tphoCont
Definition: HcalUnpacker.h:31
std::unordered_map< int, QIE11DigiCollection * > qie11Addtl
Definition: HcalUnpacker.h:39
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
U second(std::pair< T, U > const &p)
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
std::unordered_map< int, QIE10DigiCollection * > qie10Addtl
Definition: HcalUnpacker.h:38
QIE10DigiCollection * qie10ZDC
Definition: HcalUnpacker.h:34
const bool complainEmptyData_
Definition: HcalRawToDigi.h:53
std::string electronicsMapLabel_
Definition: HcalRawToDigi.h:55
std::vector< HcalTriggerPrimitiveDigi > * tpCont
Definition: HcalUnpacker.h:30
struct HcalRawToDigi::Statistics stats_
const bool unpackZDC_
Definition: HcalRawToDigi.h:42
const bool unpackCalib_
Definition: HcalRawToDigi.h:42
std::unordered_map< int, std::string > saveQIE10Info_
Definition: HcalRawToDigi.h:59
const bool silent_
Definition: HcalRawToDigi.h:53
HcalDataFrameContainer< QIE11DataFrame > QIE11DigiCollection
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
std::vector< HcalCalibDataFrame > * calibCont
Definition: HcalUnpacker.h:28
std::vector< int > fedUnpackList_
Definition: HcalRawToDigi.h:40
bool active() const
whether any filters are on
std::vector< HODataFrame > * hoCont
Definition: HcalUnpacker.h:26
QIE11DigiCollection * qie11
Definition: HcalUnpacker.h:36
void setConditions(const HcalDbService *conditions)
get conditions
HBHEDigiCollection filter(const HBHEDigiCollection &incol, HcalUnpackerReport &r)
filter HB/HE data frames
HcalUnpacker unpacker_
Definition: HcalRawToDigi.h:38
T get() const
Definition: EventSetup.h:73
susybsm::HSCParticleCollection hc
Definition: classes.h:25
QIE10DigiCollection * qie10
Definition: HcalUnpacker.h:33
std::vector< ZDCDataFrame > * zdcCont
Definition: HcalUnpacker.h:29
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
Definition: HcalRawToDigi.h:37
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const bool HcalRawToDigi::complainEmptyData_
private

Definition at line 53 of file HcalRawToDigi.h.

Referenced by produce().

std::string HcalRawToDigi::electronicsMapLabel_
private

Definition at line 55 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

const int HcalRawToDigi::expectedOrbitMessageTime_
private

Definition at line 54 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

std::vector<int> HcalRawToDigi::fedUnpackList_
private

Definition at line 40 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

HcalDataFrameFilter HcalRawToDigi::filter_
private

Definition at line 39 of file HcalRawToDigi.h.

Referenced by produce().

const int HcalRawToDigi::firstFED_
private

Definition at line 41 of file HcalRawToDigi.h.

std::vector<int> HcalRawToDigi::saveQIE10DataNSamples_
private

Definition at line 46 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

std::vector<std::string> HcalRawToDigi::saveQIE10DataTags_
private

Definition at line 47 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

std::unordered_map<int, std::string> HcalRawToDigi::saveQIE10Info_
private

Definition at line 59 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

std::vector<int> HcalRawToDigi::saveQIE11DataNSamples_
private

Definition at line 50 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

std::vector<std::string> HcalRawToDigi::saveQIE11DataTags_
private

Definition at line 51 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

std::unordered_map<int, std::string> HcalRawToDigi::saveQIE11Info_
private

Definition at line 60 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

const bool HcalRawToDigi::silent_
private

Definition at line 53 of file HcalRawToDigi.h.

Referenced by produce().

struct HcalRawToDigi::Statistics HcalRawToDigi::stats_
private

Referenced by HcalRawToDigi(), and produce().

edm::EDGetTokenT<FEDRawDataCollection> HcalRawToDigi::tok_data_
private

Definition at line 37 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

const bool HcalRawToDigi::unpackCalib_
private

Definition at line 42 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

HcalUnpacker HcalRawToDigi::unpacker_
private

Definition at line 38 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

const int HcalRawToDigi::unpackerMode_
private

Definition at line 54 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

const bool HcalRawToDigi::unpackTTP_
private

Definition at line 42 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

bool HcalRawToDigi::unpackUMNio_
private

Definition at line 43 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

const bool HcalRawToDigi::unpackZDC_
private

Definition at line 42 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().