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::stream::EDProducer<> edm::stream::EDProducerBase 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::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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_
 
CastorCtdcUnpacker ctdcunpacker_
 
edm::InputTag dataTag_
 
int expectedOrbitMessageTime_
 
std::vector< int > fedUnpackList_
 
CastorDataFrameFilter filter_
 
int firstFED_
 
bool silent_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_input_
 
CastorUnpacker unpacker_
 
bool unpackTTP_
 
bool usenominalOrbitMessageTime_
 
bool usingctdc_
 

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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
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

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

Author
Alan Campbell
Version
1st Version April 18, 2008

Definition at line 29 of file CastorRawToDigi.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file CastorRawToDigi.cc.

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

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

Definition at line 53 of file CastorRawToDigi.cc.

53 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 138 of file CastorRawToDigi.cc.

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

138  {
140  if ( irun.run() > 132640 ) {
142  } else if ( irun.run() > 132174 ) {
144  } else if ( irun.run() > 124371 ) {
146  } else if ( irun.run() > 123984 ) {
148  } else if ( irun.run() > 123584 ) {
150  } else {
152  }
154  }
155 }
CastorUnpacker unpacker_
void setExpectedOrbitMessageTime(int time)
bool usenominalOrbitMessageTime_
void CastorRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::stream::EDProducerBase.

Definition at line 56 of file CastorRawToDigi.cc.

References CastorDataFrameFilter::active(), CastorRawCollections::castorCont, complainEmptyData_, ctdcunpacker_, fedUnpackList_, CastorDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByToken(), i, parseEventContent::prod, edm::Event::put(), zeeHLT_cff::report, FEDRawData::size(), edm::SortedCollection< T, SORT >::swap(), tok_input_, 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().

57 {
58  // Step A: Get Inputs
60  e.getByToken(tok_input_,rawraw);
61  // get the mapping
63  es.get<CastorDbRecord>().get( pSetup );
64  const CastorElectronicsMap* readoutMap=pSetup->getCastorMapping();
65 
66  // Step B: Create empty output : three vectors for three classes...
67  std::vector<CastorDataFrame> castor;
68  std::vector<HcalTTPDigi> ttp;
69  std::vector<CastorTriggerPrimitiveDigi> htp;
70 
71  std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
72 
74  colls.castorCont=&castor;
75  if (unpackTTP_) colls.ttp=&ttp;
76  colls.tpCont=&htp;
77 
78  // Step C: unpack all requested FEDs
79  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
80  const FEDRawData& fed = rawraw->FEDData(*i);
81  if (fed.size()==0) {
82  if (complainEmptyData_) {
83  edm::LogWarning("EmptyData") << "No data for FED " << *i;
84  report->addError(*i);
85  }
86  } else if (fed.size()<8*3) {
87  edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
88  report->addError(*i);
89  } else {
90  try {
91  if ( usingctdc_ ) {
92  ctdcunpacker_.unpack(fed,*readoutMap,colls, *report);
93  } else {
94  unpacker_.unpack(fed,*readoutMap,colls, *report);
95  }
96  report->addUnpacked(*i);
97  } catch (cms::Exception& e) {
98  edm::LogWarning("Unpacking error") << e.what();
99  report->addError(*i);
100  } catch (...) {
101  edm::LogWarning("Unpacking exception");
102  report->addError(*i);
103  }
104  }
105  }
106 
107  // Step B: encapsulate vectors in actual collections
108  std::auto_ptr<CastorDigiCollection> castor_prod(new CastorDigiCollection());
109  std::auto_ptr<CastorTrigPrimDigiCollection> htp_prod(new CastorTrigPrimDigiCollection());
110 
111  castor_prod->swap_contents(castor);
112  htp_prod->swap_contents(htp);
113 
114  // Step C2: filter FEDs, if required
115  if (filter_.active()) {
116  CastorDigiCollection filtered_castor=filter_.filter(*castor_prod,*report);
117 
118  castor_prod->swap(filtered_castor);
119  }
120 
121  // Step D: Put outputs into event
122  // just until the sorting is proven
123  castor_prod->sort();
124  htp_prod->sort();
125 
126  e.put(castor_prod);
127  e.put(htp_prod);
128 
129  if (unpackTTP_) {
130  std::auto_ptr<HcalTTPDigiCollection> prod(new HcalTTPDigiCollection());
131  prod->swap_contents(ttp);
132 
133  prod->sort();
134  e.put(prod);
135  }
136  e.put(report);
137 }
virtual char const * what() const
Definition: Exception.cc:141
CastorDataFrameFilter filter_
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
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:47
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
edm::EDGetTokenT< FEDRawDataCollection > tok_input_
void unpack(const FEDRawData &raw, const CastorElectronicsMap &emap, CastorRawCollections &conts, HcalUnpackerReport &report)
bool active() const
whether any filters are on
std::vector< CastorDataFrame > * castorCont
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 40 of file CastorRawToDigi.h.

Referenced by produce().

edm::InputTag CastorRawToDigi::dataTag_
private

Definition at line 38 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi().

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 42 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorDataFrameFilter CastorRawToDigi::filter_
private

Definition at line 41 of file CastorRawToDigi.h.

Referenced by produce().

int CastorRawToDigi::firstFED_
private

Definition at line 43 of file CastorRawToDigi.h.

bool CastorRawToDigi::silent_
private

Definition at line 47 of file CastorRawToDigi.h.

edm::EDGetTokenT<FEDRawDataCollection> CastorRawToDigi::tok_input_
private

Definition at line 50 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorUnpacker CastorRawToDigi::unpacker_
private

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