CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Attributes
HcalRawToDigi Class Reference

#include <HcalRawToDigi.h>

Inheritance diagram for HcalRawToDigi:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  Statistics
 

Public Member Functions

 HcalRawToDigi (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~HcalRawToDigi ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool complainEmptyData_
 
std::string electronicsMapLabel_
 
int expectedOrbitMessageTime_
 
std::vector< int > fedUnpackList_
 
HcalDataFrameFilter filter_
 
int firstFED_
 
bool silent_
 
struct HcalRawToDigi::Statistics stats_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_data_
 
bool unpackCalib_
 
HcalUnpacker unpacker_
 
int unpackerMode_
 
bool unpackTTP_
 
bool unpackZDC_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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 11 of file HcalRawToDigi.cc.

References electronicsMapLabel_, edm::ParameterSet::exists(), expectedOrbitMessageTime_, fedUnpackList_, edm::ParameterSet::getParameter(), i, FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, HcalUnpacker::setExpectedOrbitMessageTime(), HcalUnpacker::setMode(), contentValuesCheck::ss, stats_, AlCaHLTBitMon_QueryRunRegistry::string, tok_data_, unpackCalib_, unpacker_, unpackerMode_, unpackTTP_, and unpackZDC_.

11  :
12  unpacker_(conf.getUntrackedParameter<int>("HcalFirstFED",int(FEDNumbering::MINHCALFEDID)),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
13  filter_(conf.getParameter<bool>("FilterDataQuality"),conf.getParameter<bool>("FilterDataQuality"),
14  false,
15  0, 0,
16  -1),
17  fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>())),
18  firstFED_(conf.getUntrackedParameter<int>("HcalFirstFED",FEDNumbering::MINHCALFEDID)),
19  unpackCalib_(conf.getUntrackedParameter<bool>("UnpackCalib",false)),
20  unpackZDC_(conf.getUntrackedParameter<bool>("UnpackZDC",false)),
21  unpackTTP_(conf.getUntrackedParameter<bool>("UnpackTTP",false)),
22  silent_(conf.getUntrackedParameter<bool>("silent",true)),
23  complainEmptyData_(conf.getUntrackedParameter<bool>("ComplainEmptyData",false)),
24  unpackerMode_(conf.getUntrackedParameter<int>("UnpackerMode",0)),
25  expectedOrbitMessageTime_(conf.getUntrackedParameter<int>("ExpectedOrbitMessageTime",-1))
26 {
27  if(conf.exists("ElectronicsMap")) {
28  electronicsMapLabel_ = conf.getParameter<std::string>("ElectronicsMap");
29  }
30  else {
32  }
33 
34  tok_data_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("InputLabel"));
35 
36  if (fedUnpackList_.empty()) {
38  fedUnpackList_.push_back(i);
39  // HF uTCA
40  fedUnpackList_.push_back(1118);
41  fedUnpackList_.push_back(1120);
42  fedUnpackList_.push_back(1122);
43  }
44 
47  std::ostringstream ss;
48  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
49  ss << fedUnpackList_[i] << " ";
50  edm::LogInfo("HCAL") << "HcalRawToDigi will unpack FEDs ( " << ss.str() << ")";
51 
52  // products produced...
53  produces<HBHEDigiCollection>();
54  produces<HFDigiCollection>();
55  produces<HODigiCollection>();
56  produces<HcalTrigPrimDigiCollection>();
57  produces<HOTrigPrimDigiCollection>();
58  produces<HcalUnpackerReport>();
59  if (unpackCalib_)
60  produces<HcalCalibDigiCollection>();
61  if (unpackZDC_)
62  produces<ZDCDigiCollection>();
63  if (unpackTTP_)
64  produces<HcalTTPDigiCollection>();
65  produces<QIE10DigiCollection>();
66 
67  memset(&stats_,0,sizeof(stats_));
68 
69 }
int i
Definition: DBlmapReader.cc:9
HcalDataFrameFilter filter_
Definition: HcalRawToDigi.h:38
bool complainEmptyData_
Definition: HcalRawToDigi.h:42
std::string electronicsMapLabel_
Definition: HcalRawToDigi.h:44
struct HcalRawToDigi::Statistics stats_
int expectedOrbitMessageTime_
Definition: HcalRawToDigi.h:43
tuple conf
Definition: dbtoconf.py:185
void setExpectedOrbitMessageTime(int time)
Definition: HcalUnpacker.h:40
void setMode(int mode)
Definition: HcalUnpacker.h:43
std::vector< int > fedUnpackList_
Definition: HcalRawToDigi.h:39
HcalUnpacker unpacker_
Definition: HcalRawToDigi.h:37
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
Definition: HcalRawToDigi.h:36
HcalRawToDigi::~HcalRawToDigi ( )
virtual

Definition at line 72 of file HcalRawToDigi.cc.

72 { }

Member Function Documentation

void HcalRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

calib

zdc

Implements edm::EDProducer.

Definition at line 75 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_, fedUnpackList_, HcalDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByToken(), HcalUnpacker::Collections::hbheCont, AnalysisDataFormats_SUSYBSMObjects::hc, HcalUnpacker::Collections::hfCont, HcalUnpacker::Collections::hoCont, i, bookConverter::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, HcalRawToDigi::Statistics::n, parseEventContent::prod, edm::ESHandle< class >::product(), edm::Event::put(), HcalUnpacker::Collections::qie10, zeeHLT_cff::report, silent_, FEDRawData::size(), stats_, edm::SortedCollection< T, SORT >::swap(), tok_data_, HcalUnpacker::Collections::tpCont, HcalUnpacker::Collections::tphoCont, HcalUnpacker::Collections::ttp, HcalUnpacker::unpack(), unpackCalib_, unpacker_, unpackTTP_, unpackZDC_, cms::Exception::what(), and HcalUnpacker::Collections::zdcCont.

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

76 {
77  // Step A: Get Inputs
79  e.getByToken(tok_data_,rawraw);
80  // get the mapping
82  es.get<HcalDbRecord>().get( pSetup );
84  es.get<HcalElectronicsMapRcd>().get(electronicsMapLabel_, item);
85  const HcalElectronicsMap* readoutMap = item.product();
86 
87  // Step B: Create empty output : three vectors for three classes...
88  std::vector<HBHEDataFrame> hbhe;
89  std::vector<HODataFrame> ho;
90  std::vector<HFDataFrame> hf;
91  std::vector<HcalTriggerPrimitiveDigi> htp;
92  std::vector<HcalCalibDataFrame> hc;
93  std::vector<ZDCDataFrame> zdc;
94  std::vector<HcalTTPDigi> ttp;
95  std::vector<HOTriggerPrimitiveDigi> hotp;
96  std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
97 
98  // Heuristics: use ave+(max-ave)/8
99  if (stats_.max_hbhe>0) hbhe.reserve(stats_.ave_hbhe+(stats_.max_hbhe-stats_.ave_hbhe)/8);
100  if (stats_.max_ho>0) ho.reserve(stats_.ave_ho+(stats_.max_ho-stats_.ave_ho)/8);
101  if (stats_.max_hf>0) hf.reserve(stats_.ave_hf+(stats_.max_hf-stats_.ave_hf)/8);
103  if (stats_.max_tp>0) htp.reserve(stats_.ave_tp+(stats_.max_tp-stats_.ave_tp)/8);
104  if (stats_.max_tpho>0) hotp.reserve(stats_.ave_tpho+(stats_.max_tpho-stats_.ave_tpho)/8);
105 
106  if (unpackZDC_) zdc.reserve(24);
107 
108 
110  colls.hbheCont=&hbhe;
111  colls.hoCont=&ho;
112  colls.hfCont=&hf;
113  colls.tpCont=&htp;
114  colls.tphoCont=&hotp;
115  colls.calibCont=&hc;
116  colls.zdcCont=&zdc;
117  if (unpackTTP_) colls.ttp=&ttp;
118 
119  // Step C: unpack all requested FEDs
120  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
121  const FEDRawData& fed = rawraw->FEDData(*i);
122  if (fed.size()==0) {
123  if (complainEmptyData_) {
124  if (!silent_) edm::LogWarning("EmptyData") << "No data for FED " << *i;
125  report->addError(*i);
126  }
127  } else if (fed.size()<8*3) {
128  if (!silent_) edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
129  report->addError(*i);
130  } else {
131  try {
132  unpacker_.unpack(fed,*readoutMap,colls, *report,silent_);
133  report->addUnpacked(*i);
134  } catch (cms::Exception& e) {
135  if (!silent_) edm::LogWarning("Unpacking error") << e.what();
136  report->addError(*i);
137  } catch (...) {
138  if (!silent_) edm::LogWarning("Unpacking exception");
139  report->addError(*i);
140  }
141  }
142  }
143 
144 
145  // gather statistics
146  stats_.max_hbhe=std::max(stats_.max_hbhe,(int)hbhe.size());
147  stats_.ave_hbhe=(stats_.ave_hbhe*stats_.n+hbhe.size())/(stats_.n+1);
148  stats_.max_ho=std::max(stats_.max_ho,(int)ho.size());
149  stats_.ave_ho=(stats_.ave_ho*stats_.n+ho.size())/(stats_.n+1);
150  stats_.max_hf=std::max(stats_.max_hf,(int)hf.size());
151  stats_.ave_hf=(stats_.ave_hf*stats_.n+hf.size())/(stats_.n+1);
152  stats_.max_tp=std::max(stats_.max_tp,(int)htp.size());
153  stats_.ave_tp=(stats_.ave_tp*stats_.n+htp.size())/(stats_.n+1);
154  stats_.max_tpho=std::max(stats_.max_tpho,(int)hotp.size());
155  stats_.ave_tpho=(stats_.ave_tpho*stats_.n+hotp.size())/(stats_.n+1);
156  stats_.max_calib=std::max(stats_.max_calib,(int)hc.size());
157  stats_.ave_calib=(stats_.ave_calib*stats_.n+hc.size())/(stats_.n+1);
158 
159 
160  stats_.n++;
161 
162  // Step B: encapsulate vectors in actual collections
163  std::auto_ptr<HBHEDigiCollection> hbhe_prod(new HBHEDigiCollection());
164  std::auto_ptr<HFDigiCollection> hf_prod(new HFDigiCollection());
165  std::auto_ptr<HODigiCollection> ho_prod(new HODigiCollection());
166  std::auto_ptr<HcalTrigPrimDigiCollection> htp_prod(new HcalTrigPrimDigiCollection());
167  std::auto_ptr<HOTrigPrimDigiCollection> hotp_prod(new HOTrigPrimDigiCollection());
168  if (colls.qie10 == 0) {
169  colls.qie10 = new QIE10DigiCollection();
170  }
171  std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.qie10);
172 
173  hbhe_prod->swap_contents(hbhe);
174  hf_prod->swap_contents(hf);
175  ho_prod->swap_contents(ho);
176  htp_prod->swap_contents(htp);
177  hotp_prod->swap_contents(hotp);
178 
179  // Step C2: filter FEDs, if required
180  if (filter_.active()) {
181  HBHEDigiCollection filtered_hbhe=filter_.filter(*hbhe_prod,*report);
182  HODigiCollection filtered_ho=filter_.filter(*ho_prod,*report);
183  HFDigiCollection filtered_hf=filter_.filter(*hf_prod,*report);
184 
185  hbhe_prod->swap(filtered_hbhe);
186  ho_prod->swap(filtered_ho);
187  hf_prod->swap(filtered_hf);
188  }
189 
190 
191  // Step D: Put outputs into event
192  // just until the sorting is proven
193  hbhe_prod->sort();
194  ho_prod->sort();
195  hf_prod->sort();
196  htp_prod->sort();
197  hotp_prod->sort();
198  qie10_prod->sort();
199 
200  e.put(hbhe_prod);
201  e.put(ho_prod);
202  e.put(hf_prod);
203  e.put(htp_prod);
204  e.put(hotp_prod);
205  e.put(qie10_prod);
206 
208  if (unpackCalib_) {
209  std::auto_ptr<HcalCalibDigiCollection> hc_prod(new HcalCalibDigiCollection());
210  hc_prod->swap_contents(hc);
211 
212  if (filter_.active()) {
213  HcalCalibDigiCollection filtered_calib=filter_.filter(*hc_prod,*report);
214  hc_prod->swap(filtered_calib);
215  }
216 
217  hc_prod->sort();
218  e.put(hc_prod);
219  }
220 
222  if (unpackZDC_) {
223  std::auto_ptr<ZDCDigiCollection> prod(new ZDCDigiCollection());
224  prod->swap_contents(zdc);
225 
226  if (filter_.active()) {
227  ZDCDigiCollection filtered_zdc=filter_.filter(*prod,*report);
228  prod->swap(filtered_zdc);
229  }
230 
231  prod->sort();
232  e.put(prod);
233  }
234 
235  if (unpackTTP_) {
236  std::auto_ptr<HcalTTPDigiCollection> prod(new HcalTTPDigiCollection());
237  prod->swap_contents(ttp);
238 
239  prod->sort();
240  e.put(prod);
241  }
242  e.put(report);
243 
244 
245 }
virtual char const * what() const
Definition: Exception.cc:141
int i
Definition: DBlmapReader.cc:9
HcalDataFrameFilter filter_
Definition: HcalRawToDigi.h:38
std::vector< HcalTTPDigi > * ttp
Definition: HcalUnpacker.h:32
edm::SortedCollection< HcalTriggerPrimitiveDigi > HcalTrigPrimDigiCollection
std::vector< HFDataFrame > * hfCont
Definition: HcalUnpacker.h:27
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
void swap(SortedCollection &other)
std::vector< HBHEDataFrame > * hbheCont
Definition: HcalUnpacker.h:25
std::vector< HOTriggerPrimitiveDigi > * tphoCont
Definition: HcalUnpacker.h:31
edm::SortedCollection< HOTriggerPrimitiveDigi > HOTrigPrimDigiCollection
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
HcalDataFrameContainer< QIE10DataFrame > QIE10DigiCollection
tuple report
Definition: zeeHLT_cff.py:9
edm::SortedCollection< HODataFrame > HODigiCollection
bool complainEmptyData_
Definition: HcalRawToDigi.h:42
std::string electronicsMapLabel_
Definition: HcalRawToDigi.h:44
std::vector< HcalTriggerPrimitiveDigi > * tpCont
Definition: HcalUnpacker.h:30
struct HcalRawToDigi::Statistics stats_
void unpack(const FEDRawData &raw, const HcalElectronicsMap &emap, std::vector< HcalHistogramDigi > &histoDigis)
edm::SortedCollection< HcalCalibDataFrame > HcalCalibDigiCollection
std::vector< HcalCalibDataFrame > * calibCont
Definition: HcalUnpacker.h:28
std::vector< int > fedUnpackList_
Definition: HcalRawToDigi.h:39
T const * product() const
Definition: ESHandle.h:86
bool active() const
whether any filters are on
std::vector< HODataFrame > * hoCont
Definition: HcalUnpacker.h:26
HBHEDigiCollection filter(const HBHEDigiCollection &incol, HcalUnpackerReport &r)
filter HB/HE data frames
HcalUnpacker unpacker_
Definition: HcalRawToDigi.h:37
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
susybsm::HSCParticleCollection hc
Definition: classes.h:25
edm::SortedCollection< HFDataFrame > HFDigiCollection
QIE10DigiCollection * qie10
Definition: HcalUnpacker.h:33
std::vector< ZDCDataFrame > * zdcCont
Definition: HcalUnpacker.h:29
edm::EDGetTokenT< FEDRawDataCollection > tok_data_
Definition: HcalRawToDigi.h:36
edm::SortedCollection< HBHEDataFrame > HBHEDigiCollection

Member Data Documentation

bool HcalRawToDigi::complainEmptyData_
private

Definition at line 42 of file HcalRawToDigi.h.

Referenced by produce().

std::string HcalRawToDigi::electronicsMapLabel_
private

Definition at line 44 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

int HcalRawToDigi::expectedOrbitMessageTime_
private

Definition at line 43 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

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

Definition at line 39 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

HcalDataFrameFilter HcalRawToDigi::filter_
private

Definition at line 38 of file HcalRawToDigi.h.

Referenced by produce().

int HcalRawToDigi::firstFED_
private

Definition at line 40 of file HcalRawToDigi.h.

bool HcalRawToDigi::silent_
private

Definition at line 42 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 36 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

bool HcalRawToDigi::unpackCalib_
private

Definition at line 41 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

HcalUnpacker HcalRawToDigi::unpacker_
private

Definition at line 37 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

int HcalRawToDigi::unpackerMode_
private

Definition at line 43 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi().

bool HcalRawToDigi::unpackTTP_
private

Definition at line 41 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().

bool HcalRawToDigi::unpackZDC_
private

Definition at line 41 of file HcalRawToDigi.h.

Referenced by HcalRawToDigi(), and produce().