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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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_
 
edm::ESGetToken< HcalDbService, HcalDbRecordtok_dbService_
 
edm::ESGetToken< HcalElectronicsMap, HcalElectronicsMapRcdtok_electronicsMap_
 
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<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 32 of file HcalRawToDigi.h.

Constructor & Destructor Documentation

◆ HcalRawToDigi()

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

Definition at line 12 of file HcalRawToDigi.cc.

References electronicsMapLabel_, expectedOrbitMessageTime_, fedUnpackList_, spr::find(), edm::ParameterSet::getParameter(), mps_fire::i, heavyIonCSV_trainingSettings::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, makeGlobalPositionRcd_cfg::tag, tok_data_, tok_dbService_, tok_electronicsMap_, unpackCalib_, unpacker_, unpackerMode_, unpackTTP_, unpackUMNio_, and unpackZDC_.

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

◆ ~HcalRawToDigi()

HcalRawToDigi::~HcalRawToDigi ( )
override

Definition at line 147 of file HcalRawToDigi.cc.

147 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 149 of file HcalRawToDigi.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, createfilelist::int, FEDNumbering::MINHCALFEDID, and AlCaHLTBitMon_QueryRunRegistry::string.

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

◆ produce()

void HcalRawToDigi::produce ( edm::Event e,
const edm::EventSetup es 
)
override

calib

zdc

umnio

Definition at line 174 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_, MillePedeFileConverter_cfg::e, FEDRawDataCollection::FEDData(), fedUnpackList_, HcalDataFrameFilter::filter(), filter_, edm::EventSetup::getHandle(), photonIsolationHIProducer_cfi::hbhe, HcalUnpacker::Collections::hbheCont, 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(), 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(), makeGlobalPositionRcd_cfg::tag, tok_data_, tok_dbService_, tok_electronicsMap_, HcalUnpacker::Collections::tpCont, HcalUnpacker::Collections::tphoCont, HcalUnpacker::Collections::ttp, HcalUnpacker::Collections::umnio, HcalUnpacker::unpack(), unpackCalib_, unpacker_, unpackTTP_, unpackUMNio_, unpackZDC_, hcalSimParameters_cfi::zdc, and HcalUnpacker::Collections::zdcCont.

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

Member Data Documentation

◆ complainEmptyData_

const bool HcalRawToDigi::complainEmptyData_
private

Definition at line 58 of file HcalRawToDigi.h.

Referenced by produce().

◆ electronicsMapLabel_

std::string HcalRawToDigi::electronicsMapLabel_
private

Definition at line 60 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ expectedOrbitMessageTime_

const int HcalRawToDigi::expectedOrbitMessageTime_
private

Definition at line 59 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ fedUnpackList_

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

Definition at line 45 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ filter_

HcalDataFrameFilter HcalRawToDigi::filter_
private

Definition at line 44 of file HcalRawToDigi.h.

Referenced by produce().

◆ firstFED_

const int HcalRawToDigi::firstFED_
private

Definition at line 46 of file HcalRawToDigi.h.

◆ saveQIE10DataNSamples_

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

Definition at line 51 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ saveQIE10DataTags_

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

Definition at line 52 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ saveQIE10Info_

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

Definition at line 64 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ saveQIE11DataNSamples_

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

Definition at line 55 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ saveQIE11DataTags_

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

Definition at line 56 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ saveQIE11Info_

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

Definition at line 65 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ silent_

const bool HcalRawToDigi::silent_
private

Definition at line 58 of file HcalRawToDigi.h.

Referenced by produce().

◆ stats_

struct HcalRawToDigi::Statistics HcalRawToDigi::stats_
private

Referenced by HcalRawToDigi(), and produce().

◆ tok_data_

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

Definition at line 40 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ tok_dbService_

edm::ESGetToken<HcalDbService, HcalDbRecord> HcalRawToDigi::tok_dbService_
private

Definition at line 41 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ tok_electronicsMap_

edm::ESGetToken<HcalElectronicsMap, HcalElectronicsMapRcd> HcalRawToDigi::tok_electronicsMap_
private

Definition at line 42 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ unpackCalib_

const bool HcalRawToDigi::unpackCalib_
private

Definition at line 47 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ unpacker_

HcalUnpacker HcalRawToDigi::unpacker_
private

Definition at line 43 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ unpackerMode_

const int HcalRawToDigi::unpackerMode_
private

Definition at line 59 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

◆ unpackTTP_

const bool HcalRawToDigi::unpackTTP_
private

Definition at line 47 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ unpackUMNio_

bool HcalRawToDigi::unpackUMNio_
private

Definition at line 48 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

◆ unpackZDC_

const bool HcalRawToDigi::unpackZDC_
private

Definition at line 47 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().