CMS 3D CMS Logo

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)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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< FEDRawDataCollectiontok_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, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
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 19 of file CastorRawToDigi.cc.

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

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

60 { }

Member Function Documentation

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

Reimplemented from edm::stream::EDProducerBase.

Definition at line 217 of file CastorRawToDigi.cc.

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

217  {
219  if ( irun.run() > 132640 ) {
221  } else if ( irun.run() > 132174 ) {
223  } else if ( irun.run() > 124371 ) {
225  } else if ( irun.run() > 123984 ) {
227  } else if ( irun.run() > 123584 ) {
229  } else {
231  }
233  }
234 }
CastorUnpacker unpacker_
void setExpectedOrbitMessageTime(int time)
bool usenominalOrbitMessageTime_
void CastorRawToDigi::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Definition at line 63 of file CastorRawToDigi.cc.

References CastorDataFrameFilter::active(), castorDigitizer_cfi::castor, CastorRawCollections::castorCont, complainEmptyData_, ctdcunpacker_, FEDRawDataCollection::FEDData(), fedUnpackList_, CastorDataFrameFilter::filter(), filter_, edm::EventSetup::get(), edm::Event::getByToken(), CastorDbService::getCastorMapping(), mps_fire::i, eostools::move(), parseEventContent::prod, edm::Event::put(), edmIntegrityCheck::report, FEDRawData::size(), edm::SortedCollection< T, SORT >::swap(), tok_input_, CastorCtdcUnpacker::unpack(), CastorUnpacker::unpack(), ZdcUnpacker::unpack(), unpacker_, unpackTTP_, unpackZDC_, usingctdc_, cms::Exception::what(), hcalSimParameters_cfi::zdc, and zdcunpacker_.

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

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

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