test
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
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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_
 
std::auto_ptr< HcalElectronicsMapmyEMap
 
bool silent_
 
edm::EDGetTokenT
< FEDRawDataCollection
tok_input_
 
CastorUnpacker unpacker_
 
bool unpackTTP_
 
bool unpackZDC_
 
bool usenominalOrbitMessageTime_
 
bool usingctdc_
 
edm::ParameterSet zdcemap
 
ZdcUnpacker zdcunpacker_
 

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
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- 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::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 35 of file CastorRawToDigi.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file CastorRawToDigi.cc.

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

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

Definition at line 62 of file CastorRawToDigi.cc.

62 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 219 of file CastorRawToDigi.cc.

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

219  {
221  if ( irun.run() > 132640 ) {
223  } else if ( irun.run() > 132174 ) {
225  } else if ( irun.run() > 124371 ) {
227  } else if ( irun.run() > 123984 ) {
229  } else if ( irun.run() > 123584 ) {
231  } else {
233  }
235  }
236 }
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 65 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(), ZdcUnpacker::unpack(), unpacker_, unpackTTP_, unpackZDC_, usingctdc_, cms::Exception::what(), CastorRawCollections::zdcCont, and zdcunpacker_.

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

66 {
67  // Step A: Get Inputs
69  e.getByToken(tok_input_,rawraw);
70  // get the mapping
72  es.get<CastorDbRecord>().get( pSetup );
73  const CastorElectronicsMap* readoutMap=pSetup->getCastorMapping();
74 
75  // Step B: Create empty output : three vectors for three classes...
76  std::vector<CastorDataFrame> castor;
77  std::vector<ZDCDataFrame> zdc;
78  std::vector<HcalTTPDigi> ttp;
79  std::vector<CastorTriggerPrimitiveDigi> htp;
80 
81  std::auto_ptr<HcalUnpackerReport> report(new HcalUnpackerReport);
82 
84  colls.castorCont=&castor;
85  colls.zdcCont=&zdc;
86  if (unpackTTP_) colls.ttp=&ttp;
87  colls.tpCont=&htp;
88 
89  // Step C: unpack all requested FEDs
90  const FEDRawData& fed722 = rawraw->FEDData(722);
91  const int fed722size = fed722.size();
92  const FEDRawData& fed693 = rawraw->FEDData(693);
93  const int fed693size = fed693.size();
94  for (std::vector<int>::const_iterator i=fedUnpackList_.begin(); i!=fedUnpackList_.end(); i++) {
95  const FEDRawData& fed = rawraw->FEDData(*i);
96  //std::cout<<"Fed number "<<*i<<"is being worked on"<<std::endl;
97  if (*i == 693 && fed693size == 0 && fed722size != 0)
98  continue;
99  if (*i == 722 && fed722size == 0 && fed693size != 0)
100  continue;
101 
102  if (*i!=693 && *i!=722)
103  {
104  if (fed.size()==0)
105  {
106  if (complainEmptyData_)
107  {
108  edm::LogWarning("EmptyData") << "No data for FED " << *i;
109  report->addError(*i);
110  }
111  }
112  else if (fed.size()<8*3)
113  {
114  edm::LogWarning("EmptyData") << "Tiny data " << fed.size() << " for FED " << *i;
115  report->addError(*i);
116  }
117  else
118  {
119  try
120  {
121  if ( usingctdc_ )
122  {
123  ctdcunpacker_.unpack(fed,*readoutMap,colls, *report);
124  }
125  else
126  {
127  unpacker_.unpack(fed,*readoutMap,colls, *report);
128  }
129  report->addUnpacked(*i);
130  }
131  catch (cms::Exception& e)
132  {
133  edm::LogWarning("Unpacking error") << e.what();
134  report->addError(*i);
135  } catch (...)
136  {
137  edm::LogWarning("Unpacking exception");
138  report->addError(*i);
139  }
140  }
141  }
142 
143  if (*i==693 && unpackZDC_)
144  {
145  if (fed.size()==0)
146  {
147  if (complainEmptyData_)
148  {
149  edm::LogWarning("EmptyData") << "No data for FED " << *i;
150  report->addError(*i);
151  }
152  }
153  if (fed.size()!=0)
154  {
155  zdcunpacker_.unpack(fed,*readoutMap,colls,*report);
156  report->addUnpacked(*i);
157  }
158  }
159 
160  if (*i==722 && unpackZDC_)
161  {
162  if (fed.size()==0)
163  {
164  if (complainEmptyData_)
165  {
166  edm::LogWarning("EmptyData") << "No data for FED " << *i;
167  report->addError(*i);
168  }
169  }
170  if (fed.size()!=0)
171  {
172  zdcunpacker_.unpack(fed,*readoutMap,colls,*report);
173  report->addUnpacked(*i);
174  }
175  }
176 
177  }//end of loop over feds
178 
179  // Step B: encapsulate vectors in actual collections
180  std::auto_ptr<CastorDigiCollection> castor_prod(new CastorDigiCollection());
181  std::auto_ptr<CastorTrigPrimDigiCollection> htp_prod(new CastorTrigPrimDigiCollection());
182 
183  castor_prod->swap_contents(castor);
184  htp_prod->swap_contents(htp);
185 
186  // Step C2: filter FEDs, if required
187  if (filter_.active()) {
188  CastorDigiCollection filtered_castor=filter_.filter(*castor_prod,*report);
189 
190  castor_prod->swap(filtered_castor);
191  }
192 
193  // Step D: Put outputs into event
194  // just until the sorting is proven
195  castor_prod->sort();
196  htp_prod->sort();
197 
198  if(unpackZDC_)
199  {
200  std::auto_ptr<ZDCDigiCollection> zdc_prod(new ZDCDigiCollection());
201  zdc_prod->swap_contents(zdc);
202 
203  zdc_prod->sort();
204  e.put(zdc_prod);
205  }
206 
207  e.put(castor_prod);
208  e.put(htp_prod);
209 
210  if (unpackTTP_) {
211  std::auto_ptr<HcalTTPDigiCollection> prod(new HcalTTPDigiCollection());
212  prod->swap_contents(ttp);
213 
214  prod->sort();
215  e.put(prod);
216  }
217  e.put(report);
218 }
virtual char const * what() const
Definition: Exception.cc:141
CastorDataFrameFilter filter_
int i
Definition: DBlmapReader.cc:9
ZdcUnpacker zdcunpacker_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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
std::vector< ZDCDataFrame > * zdcCont
edm::SortedCollection< ZDCDataFrame > ZDCDigiCollection
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
void unpack(const FEDRawData &raw, const CastorElectronicsMap &emap, CastorRawCollections &conts, HcalUnpackerReport &report, bool silent=false)
For histograms, no begin and end.
Definition: ZdcUnpacker.cc:98
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 51 of file CastorRawToDigi.h.

Referenced by produce().

CastorCtdcUnpacker CastorRawToDigi::ctdcunpacker_
private

Definition at line 47 of file CastorRawToDigi.h.

Referenced by produce().

edm::InputTag CastorRawToDigi::dataTag_
private

Definition at line 44 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi().

int CastorRawToDigi::expectedOrbitMessageTime_
private

Definition at line 57 of file CastorRawToDigi.h.

Referenced by beginRun(), and CastorRawToDigi().

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

Definition at line 49 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorDataFrameFilter CastorRawToDigi::filter_
private

Definition at line 48 of file CastorRawToDigi.h.

Referenced by produce().

int CastorRawToDigi::firstFED_
private

Definition at line 50 of file CastorRawToDigi.h.

std::auto_ptr<HcalElectronicsMap> CastorRawToDigi::myEMap
private

Definition at line 58 of file CastorRawToDigi.h.

bool CastorRawToDigi::silent_
private

Definition at line 55 of file CastorRawToDigi.h.

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

Definition at line 59 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

CastorUnpacker CastorRawToDigi::unpacker_
private

Definition at line 45 of file CastorRawToDigi.h.

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

bool CastorRawToDigi::unpackTTP_
private

Definition at line 53 of file CastorRawToDigi.h.

Referenced by CastorRawToDigi(), and produce().

bool CastorRawToDigi::unpackZDC_
private

Definition at line 54 of file CastorRawToDigi.h.

Referenced by produce().

bool CastorRawToDigi::usenominalOrbitMessageTime_
private

Definition at line 56 of file CastorRawToDigi.h.

Referenced by beginRun().

bool CastorRawToDigi::usingctdc_
private

Definition at line 52 of file CastorRawToDigi.h.

Referenced by produce().

edm::ParameterSet CastorRawToDigi::zdcemap
private

Definition at line 60 of file CastorRawToDigi.h.

ZdcUnpacker CastorRawToDigi::zdcunpacker_
private

Definition at line 46 of file CastorRawToDigi.h.

Referenced by produce().