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  }
33 
36  std::ostringstream ss;
37  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
38  ss << fedUnpackList_[i] << " ";
39  edm::LogInfo("HCAL") << "HcalRawToDigi will unpack FEDs ( " << ss.str() << ")";
40 
41  // products produced...
42  produces<HBHEDigiCollection>();
43  produces<HFDigiCollection>();
44  produces<HODigiCollection>();
45  produces<HcalTrigPrimDigiCollection>();
46  produces<HOTrigPrimDigiCollection>();
47  produces<HcalUnpackerReport>();
48  if (unpackCalib_)
49  produces<HcalCalibDigiCollection>();
50  if (unpackZDC_)
51  produces<ZDCDigiCollection>();
52  if (unpackTTP_)
53  produces<HcalTTPDigiCollection>();
54 
55  memset(&stats_,0,sizeof(stats_));
56 
57 }
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:38
void setMode(int mode)
Definition: HcalUnpacker.h:47
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 60 of file HcalRawToDigi.cc.

60 { }

Member Function Documentation

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

calib

zdc

Implements edm::EDProducer.

Definition at line 63 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(), 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().

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