CMS 3D CMS Logo

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

#include <CastorRawToDigi.h>

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

Public Member Functions

virtual void beginRun (edm::Run const &, edm::EventSetup const &) override
 
 CastorRawToDigi (const edm::ParameterSet &ps)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c) override
 
virtual ~CastorRawToDigi ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
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 ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

bool complainEmptyData_
 
CastorCtdcUnpacker ctdcunpacker_
 
edm::InputTag dataTag_
 
int expectedOrbitMessageTime_
 
std::vector< int > fedUnpackList_
 
CastorDataFrameFilter filter_
 
int firstFED_
 
bool silent_
 
CastorUnpacker unpacker_
 
bool unpackTTP_
 
bool usenominalOrbitMessageTime_
 
bool usingctdc_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- 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

CastorRawToDigi is the EDProducer subclass which runs the Hcal Unpack algorithm.

Author
Alan Campbell
Version
1st Version April 18, 2008

Definition at line 28 of file CastorRawToDigi.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file CastorRawToDigi.cc.

References expectedOrbitMessageTime_, fedUnpackList_, i, FEDNumbering::MAXCASTORFEDID, FEDNumbering::MINCASTORFEDID, CastorUnpacker::setExpectedOrbitMessageTime(), unpacker_, and unpackTTP_.

15  :
16  dataTag_(conf.getParameter<edm::InputTag>("InputLabel")),
17  unpacker_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::MINCASTORFEDID),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
18  ctdcunpacker_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::MINCASTORFEDID),conf.getParameter<int>("firstSample"),conf.getParameter<int>("lastSample")),
19  filter_(conf.getParameter<bool>("FilterDataQuality"),conf.getParameter<bool>("FilterDataQuality"),
20  false,
21  0, 0,
22  -1),
23  fedUnpackList_(conf.getUntrackedParameter<std::vector<int> >("FEDs", std::vector<int>())),
24  firstFED_(conf.getUntrackedParameter<int>("CastorFirstFED",FEDNumbering::MINCASTORFEDID)),
25 // unpackCalib_(conf.getUntrackedParameter<bool>("UnpackCalib",false)),
26  complainEmptyData_(conf.getUntrackedParameter<bool>("ComplainEmptyData",false)),
27  usingctdc_(conf.getUntrackedParameter<bool>("CastorCtdc",false)),
28  unpackTTP_(conf.getUntrackedParameter<bool>("UnpackTTP",false)),
29  silent_(conf.getUntrackedParameter<bool>("silent",true)),
30  usenominalOrbitMessageTime_(conf.getUntrackedParameter<bool>("UseNominalOrbitMessageTime",true)),
31  expectedOrbitMessageTime_(conf.getUntrackedParameter<int>("ExpectedOrbitMessageTime",-1))
32 
33 {
34  if (fedUnpackList_.empty()) {
36  fedUnpackList_.push_back(i);
37  }
38 
40  std::ostringstream ss;
41  for (unsigned int i=0; i<fedUnpackList_.size(); i++)
42  ss << fedUnpackList_[i] << " ";
43  edm::LogInfo("CASTOR") << "CastorRawToDigi will unpack FEDs ( " << ss.str() << ")";
44 
45  // products produced...
46  produces<CastorDigiCollection>();
47  produces<CastorTrigPrimDigiCollection>();
48  produces<HcalUnpackerReport>();
49  if (unpackTTP_)
50  produces<HcalTTPDigiCollection>();
51 
52 // if (unpackCalib_)
53 // produces<HcalCalibDigiCollection>();
54 
55 }
CastorDataFrameFilter filter_
int i
Definition: DBlmapReader.cc:9
CastorUnpacker unpacker_
CastorCtdcUnpacker ctdcunpacker_
std::vector< int > fedUnpackList_
edm::InputTag dataTag_
void setExpectedOrbitMessageTime(int time)
tuple conf
Definition: dbtoconf.py:185
bool usenominalOrbitMessageTime_
CastorRawToDigi::~CastorRawToDigi ( )
virtual

Definition at line 58 of file CastorRawToDigi.cc.

58 { }

Member Function Documentation

void CastorRawToDigi::beginRun ( edm::Run const &  irun,
edm::EventSetup const &  es 
)
overridevirtual

Reimplemented from edm::EDProducer.

Definition at line 151 of file CastorRawToDigi.cc.

References expectedOrbitMessageTime_, edm::RunBase::run(), CastorUnpacker::setExpectedOrbitMessageTime(), unpacker_, and usenominalOrbitMessageTime_.

151  {
153  if ( irun.run() > 132640 ) {
155  } else if ( irun.run() > 132174 ) {
157  } else if ( irun.run() > 124371 ) {
159  } else if ( irun.run() > 123984 ) {
161  } else if ( irun.run() > 123584 ) {
163  } else {
165  }
167  }
168 }
CastorUnpacker unpacker_
void setExpectedOrbitMessageTime(int time)
bool usenominalOrbitMessageTime_
void CastorRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

calib

Implements edm::EDProducer.

Definition at line 61 of file CastorRawToDigi.cc.

References CastorDataFrameFilter::active(), CastorRawCollections::castorCont, complainEmptyData_, ctdcunpacker_, dataTag_, fedUnpackList_, CastorDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByLabel(), i, parseEventContent::prod, edm::Event::put(), zeeHLT_cff::report, FEDRawData::size(), edm::SortedCollection< T, SORT >::swap(), CastorRawCollections::tpCont, CastorRawCollections::ttp, CastorCtdcUnpacker::unpack(), CastorUnpacker::unpack(), unpacker_, unpackTTP_, usingctdc_, and cms::Exception::what().

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

62 {
63  // Step A: Get Inputs
65  e.getByLabel(dataTag_,rawraw);
66  // get the mapping
68  es.get<CastorDbRecord>().get( pSetup );
69  const CastorElectronicsMap* readoutMap=pSetup->getCastorMapping();
70 
71  // Step B: Create empty output : three vectors for three classes...
72  std::vector<CastorDataFrame> castor;
73  std::vector<HcalTTPDigi> ttp;
74  std::vector<CastorTriggerPrimitiveDigi> htp;
75 
76  std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
77 
79  colls.castorCont=&castor;
80  if (unpackTTP_) colls.ttp=&ttp;
81  colls.tpCont=&htp;
82  //colls.calibCont=&hc;
83 
84  // Step C: unpack all requested FEDs
85  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
86  const FEDRawData& fed = rawraw->FEDData(*i);
87  if (fed.size()==0) {
88  if (complainEmptyData_) {
89  edm::LogWarning("EmptyData") << "No data for FED " << *i;
90  report->addError(*i);
91  }
92  } else if (fed.size()<8*3) {
93  edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
94  report->addError(*i);
95  } else {
96  try {
97  if ( usingctdc_ ) {
98  ctdcunpacker_.unpack(fed,*readoutMap,colls, *report);
99  } else {
100  unpacker_.unpack(fed,*readoutMap,colls, *report);
101  }
102  report->addUnpacked(*i);
103  } catch (cms::Exception& e) {
104  edm::LogWarning("Unpacking error") << e.what();
105  report->addError(*i);
106  } catch (...) {
107  edm::LogWarning("Unpacking exception");
108  report->addError(*i);
109  }
110  }
111  }
112 
113  // Step B: encapsulate vectors in actual collections
114  std::auto_ptr<CastorDigiCollection> castor_prod(new CastorDigiCollection());
115  std::auto_ptr<CastorTrigPrimDigiCollection> htp_prod(new CastorTrigPrimDigiCollection());
116 
117  castor_prod->swap_contents(castor);
118  htp_prod->swap_contents(htp);
119 
120  // Step C2: filter FEDs, if required
121  if (filter_.active()) {
122  CastorDigiCollection filtered_castor=filter_.filter(*castor_prod,*report);
123 
124  castor_prod->swap(filtered_castor);
125  }
126 
127  // Step D: Put outputs into event
128  // just until the sorting is proven
129  castor_prod->sort();
130  htp_prod->sort();
131 
132  e.put(castor_prod);
133  e.put(htp_prod);
134 
136 // if (unpackCalib_) {
137 // std::auto_ptr<CastorCalibDigiCollection> hc_prod(new CastorCalibDigiCollection());
138 // hc_prod->swap_contents(hc);
139 // hc_prod->sort();
140 // e.put(hc_prod);
141 // }
142  if (unpackTTP_) {
143  std::auto_ptr<HcalTTPDigiCollection> prod(new HcalTTPDigiCollection());
144  prod->swap_contents(ttp);
145 
146  prod->sort();
147  e.put(prod);
148  }
149  e.put(report);
150 }
virtual char const * what() const
Definition: Exception.cc:141
CastorDataFrameFilter filter_
int i
Definition: DBlmapReader.cc:9
CastorDigiCollection filter(const CastorDigiCollection &incol, HcalUnpackerReport &r)
filter Castor data frames
CastorUnpacker unpacker_
void swap(SortedCollection &other)
CastorCtdcUnpacker ctdcunpacker_
std::vector< int > fedUnpackList_
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
edm::InputTag dataTag_
void unpack(const FEDRawData &raw, const CastorElectronicsMap &emap, CastorRawCollections &conts, HcalUnpackerReport &report, bool silent=false)
For histograms, no begin and end.
tuple report
Definition: zeeHLT_cff.py:9
void unpack(const FEDRawData &raw, const CastorElectronicsMap &emap, CastorRawCollections &conts, HcalUnpackerReport &report)
bool active() const
whether any filters are on
std::vector< CastorDataFrame > * castorCont
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< CastorTriggerPrimitiveDigi > * tpCont
edm::SortedCollection< HcalTTPDigi > HcalTTPDigiCollection
edm::SortedCollection< CastorDataFrame > CastorDigiCollection
edm::SortedCollection< CastorTriggerPrimitiveDigi > CastorTrigPrimDigiCollection
std::vector< HcalTTPDigi > * ttp

Member Data Documentation

bool CastorRawToDigi::complainEmptyData_
private

Definition at line 44 of file CastorRawToDigi.h.

Referenced by produce().

CastorCtdcUnpacker CastorRawToDigi::ctdcunpacker_
private

Definition at line 39 of file CastorRawToDigi.h.

Referenced by produce().

edm::InputTag CastorRawToDigi::dataTag_
private

Definition at line 37 of file CastorRawToDigi.h.

Referenced by produce().

int CastorRawToDigi::expectedOrbitMessageTime_
private

Definition at line 49 of file CastorRawToDigi.h.

Referenced by beginRun(), and CastorRawToDigi().

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

Definition at line 41 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorDataFrameFilter CastorRawToDigi::filter_
private

Definition at line 40 of file CastorRawToDigi.h.

Referenced by produce().

int CastorRawToDigi::firstFED_
private

Definition at line 42 of file CastorRawToDigi.h.

bool CastorRawToDigi::silent_
private

Definition at line 47 of file CastorRawToDigi.h.

CastorUnpacker CastorRawToDigi::unpacker_
private

Definition at line 38 of file CastorRawToDigi.h.

Referenced by beginRun(), CastorRawToDigi(), and produce().

bool CastorRawToDigi::unpackTTP_
private

Definition at line 46 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

bool CastorRawToDigi::usenominalOrbitMessageTime_
private

Definition at line 48 of file CastorRawToDigi.h.

Referenced by beginRun().

bool CastorRawToDigi::usingctdc_
private

Definition at line 45 of file CastorRawToDigi.h.

Referenced by produce().