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_
 
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 expectedOrbitMessageTime_, fedUnpackList_, edm::ParameterSet::getParameter(), i, FEDNumbering::MAXHCALFEDID, FEDNumbering::MINHCALFEDID, HcalUnpacker::setExpectedOrbitMessageTime(), HcalUnpacker::setMode(), contentValuesCheck::ss, stats_, 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  tok_data_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("InputLabel"));
28 
29  if (fedUnpackList_.empty()) {
31  fedUnpackList_.push_back(i);
32  // HF uTCA
33  fedUnpackList_.push_back(1118);
34  fedUnpackList_.push_back(1120);
35  fedUnpackList_.push_back(1122);
36  }
37 
40  std::ostringstream ss;
41  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
42  ss << fedUnpackList_[i] << " ";
43  edm::LogInfo("HCAL") << "HcalRawToDigi will unpack FEDs ( " << ss.str() << ")";
44 
45  // products produced...
46  produces<HBHEDigiCollection>();
47  produces<HFDigiCollection>();
48  produces<HODigiCollection>();
49  produces<HcalTrigPrimDigiCollection>();
50  produces<HOTrigPrimDigiCollection>();
51  produces<HcalUnpackerReport>();
52  if (unpackCalib_)
53  produces<HcalCalibDigiCollection>();
54  if (unpackZDC_)
55  produces<ZDCDigiCollection>();
56  if (unpackTTP_)
57  produces<HcalTTPDigiCollection>();
58  produces<QIE10DigiCollection>();
59 
60  memset(&stats_,0,sizeof(stats_));
61 
62 }
int i
Definition: DBlmapReader.cc:9
HcalDataFrameFilter filter_
Definition: HcalRawToDigi.h:38
bool complainEmptyData_
Definition: HcalRawToDigi.h:42
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 65 of file HcalRawToDigi.cc.

65 { }

Member Function Documentation

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

calib

zdc

Implements edm::EDProducer.

Definition at line 68 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_, 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::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().

69 {
70  // Step A: Get Inputs
72  e.getByToken(tok_data_,rawraw);
73  // get the mapping
75  es.get<HcalDbRecord>().get( pSetup );
76  const HcalElectronicsMap* readoutMap=pSetup->getHcalMapping();
77 
78  // Step B: Create empty output : three vectors for three classes...
79  std::vector<HBHEDataFrame> hbhe;
80  std::vector<HODataFrame> ho;
81  std::vector<HFDataFrame> hf;
82  std::vector<HcalTriggerPrimitiveDigi> htp;
83  std::vector<HcalCalibDataFrame> hc;
84  std::vector<ZDCDataFrame> zdc;
85  std::vector<HcalTTPDigi> ttp;
86  std::vector<HOTriggerPrimitiveDigi> hotp;
87  std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
88 
89  // Heuristics: use ave+(max-ave)/8
90  if (stats_.max_hbhe>0) hbhe.reserve(stats_.ave_hbhe+(stats_.max_hbhe-stats_.ave_hbhe)/8);
91  if (stats_.max_ho>0) ho.reserve(stats_.ave_ho+(stats_.max_ho-stats_.ave_ho)/8);
92  if (stats_.max_hf>0) hf.reserve(stats_.ave_hf+(stats_.max_hf-stats_.ave_hf)/8);
94  if (stats_.max_tp>0) htp.reserve(stats_.ave_tp+(stats_.max_tp-stats_.ave_tp)/8);
95  if (stats_.max_tpho>0) hotp.reserve(stats_.ave_tpho+(stats_.max_tpho-stats_.ave_tpho)/8);
96 
97  if (unpackZDC_) zdc.reserve(24);
98 
99 
101  colls.hbheCont=&hbhe;
102  colls.hoCont=&ho;
103  colls.hfCont=&hf;
104  colls.tpCont=&htp;
105  colls.tphoCont=&hotp;
106  colls.calibCont=&hc;
107  colls.zdcCont=&zdc;
108  if (unpackTTP_) colls.ttp=&ttp;
109 
110  // Step C: unpack all requested FEDs
111  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
112  const FEDRawData& fed = rawraw->FEDData(*i);
113  if (fed.size()==0) {
114  if (complainEmptyData_) {
115  if (!silent_) edm::LogWarning("EmptyData") << "No data for FED " << *i;
116  report->addError(*i);
117  }
118  } else if (fed.size()<8*3) {
119  if (!silent_) edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
120  report->addError(*i);
121  } else {
122  try {
123  unpacker_.unpack(fed,*readoutMap,colls, *report,silent_);
124  report->addUnpacked(*i);
125  } catch (cms::Exception& e) {
126  if (!silent_) edm::LogWarning("Unpacking error") << e.what();
127  report->addError(*i);
128  } catch (...) {
129  if (!silent_) edm::LogWarning("Unpacking exception");
130  report->addError(*i);
131  }
132  }
133  }
134 
135 
136  // gather statistics
137  stats_.max_hbhe=std::max(stats_.max_hbhe,(int)hbhe.size());
138  stats_.ave_hbhe=(stats_.ave_hbhe*stats_.n+hbhe.size())/(stats_.n+1);
139  stats_.max_ho=std::max(stats_.max_ho,(int)ho.size());
140  stats_.ave_ho=(stats_.ave_ho*stats_.n+ho.size())/(stats_.n+1);
141  stats_.max_hf=std::max(stats_.max_hf,(int)hf.size());
142  stats_.ave_hf=(stats_.ave_hf*stats_.n+hf.size())/(stats_.n+1);
143  stats_.max_tp=std::max(stats_.max_tp,(int)htp.size());
144  stats_.ave_tp=(stats_.ave_tp*stats_.n+htp.size())/(stats_.n+1);
145  stats_.max_tpho=std::max(stats_.max_tpho,(int)hotp.size());
146  stats_.ave_tpho=(stats_.ave_tpho*stats_.n+hotp.size())/(stats_.n+1);
147  stats_.max_calib=std::max(stats_.max_calib,(int)hc.size());
148  stats_.ave_calib=(stats_.ave_calib*stats_.n+hc.size())/(stats_.n+1);
149 
150 
151  stats_.n++;
152 
153  // Step B: encapsulate vectors in actual collections
154  std::auto_ptr<HBHEDigiCollection> hbhe_prod(new HBHEDigiCollection());
155  std::auto_ptr<HFDigiCollection> hf_prod(new HFDigiCollection());
156  std::auto_ptr<HODigiCollection> ho_prod(new HODigiCollection());
157  std::auto_ptr<HcalTrigPrimDigiCollection> htp_prod(new HcalTrigPrimDigiCollection());
158  std::auto_ptr<HOTrigPrimDigiCollection> hotp_prod(new HOTrigPrimDigiCollection());
159  if (colls.qie10 == 0) {
160  colls.qie10 = new QIE10DigiCollection();
161  }
162  std::auto_ptr<QIE10DigiCollection> qie10_prod(colls.qie10);
163 
164  hbhe_prod->swap_contents(hbhe);
165  hf_prod->swap_contents(hf);
166  ho_prod->swap_contents(ho);
167  htp_prod->swap_contents(htp);
168  hotp_prod->swap_contents(hotp);
169 
170  // Step C2: filter FEDs, if required
171  if (filter_.active()) {
172  HBHEDigiCollection filtered_hbhe=filter_.filter(*hbhe_prod,*report);
173  HODigiCollection filtered_ho=filter_.filter(*ho_prod,*report);
174  HFDigiCollection filtered_hf=filter_.filter(*hf_prod,*report);
175 
176  hbhe_prod->swap(filtered_hbhe);
177  ho_prod->swap(filtered_ho);
178  hf_prod->swap(filtered_hf);
179  }
180 
181 
182  // Step D: Put outputs into event
183  // just until the sorting is proven
184  hbhe_prod->sort();
185  ho_prod->sort();
186  hf_prod->sort();
187  htp_prod->sort();
188  hotp_prod->sort();
189  qie10_prod->sort();
190 
191  e.put(hbhe_prod);
192  e.put(ho_prod);
193  e.put(hf_prod);
194  e.put(htp_prod);
195  e.put(hotp_prod);
196  e.put(qie10_prod);
197 
199  if (unpackCalib_) {
200  std::auto_ptr<HcalCalibDigiCollection> hc_prod(new HcalCalibDigiCollection());
201  hc_prod->swap_contents(hc);
202 
203  if (filter_.active()) {
204  HcalCalibDigiCollection filtered_calib=filter_.filter(*hc_prod,*report);
205  hc_prod->swap(filtered_calib);
206  }
207 
208  hc_prod->sort();
209  e.put(hc_prod);
210  }
211 
213  if (unpackZDC_) {
214  std::auto_ptr<ZDCDigiCollection> prod(new ZDCDigiCollection());
215  prod->swap_contents(zdc);
216 
217  if (filter_.active()) {
218  ZDCDigiCollection filtered_zdc=filter_.filter(*prod,*report);
219  prod->swap(filtered_zdc);
220  }
221 
222  prod->sort();
223  e.put(prod);
224  }
225 
226  if (unpackTTP_) {
227  std::auto_ptr<HcalTTPDigiCollection> prod(new HcalTTPDigiCollection());
228  prod->swap_contents(ttp);
229 
230  prod->sort();
231  e.put(prod);
232  }
233  e.put(report);
234 
235 
236 }
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::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
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().

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().