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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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(), stats_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, tok_data_, unpackCalib_, unpacker_, unpackerMode_, unpackTTP_, unpackUMNio_, and unpackZDC_.

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

139 { }

Member Function Documentation

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

Definition at line 141 of file HcalRawToDigi.cc.

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

141  {
143  desc.addUntracked<int>("HcalFirstFED",int(FEDNumbering::MINHCALFEDID));
144  desc.add<int>("firstSample",0);
145  desc.add<int>("lastSample",9);
146  desc.add<bool>("FilterDataQuality",true);
147  desc.addUntracked<std::vector<int>>("FEDs", std::vector<int>());
148  desc.addUntracked<bool>("UnpackZDC",true);
149  desc.addUntracked<bool>("UnpackCalib",true);
150  desc.addUntracked<bool>("UnpackUMNio",true);
151  desc.addUntracked<bool>("UnpackTTP",true);
152  desc.addUntracked<bool>("silent",true);
153  desc.addUntracked<std::vector<int> >("saveQIE10DataNSamples", std::vector<int>());
154  desc.addUntracked<std::vector<std::string> >("saveQIE10DataTags", std::vector<std::string>());
155  desc.addUntracked<std::vector<int> >("saveQIE11DataNSamples", std::vector<int>());
156  desc.addUntracked<std::vector<std::string> >("saveQIE11DataTags", std::vector<std::string>());
157  desc.addUntracked<bool>("ComplainEmptyData",false);
158  desc.addUntracked<int>("UnpackerMode",0);
159  desc.addUntracked<int>("ExpectedOrbitMessageTime",-1);
160  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
161  desc.add<std::string>("ElectronicsMap","");
162  descriptions.add("hcalRawToDigi",desc);
163 }
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 167 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(), 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, parseEventContent::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().

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