CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalTBObjectUnpacker Class Reference

#include <HcalTBObjectUnpacker.h>

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

Public Member Functions

 HcalTBObjectUnpacker (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~HcalTBObjectUnpacker () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- 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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void parseCalib ()
 

Private Attributes

std::string calibFile_
 
std::vector< std::vector< std::string > > calibLines_
 
bool doBeamADC_
 
bool doEventPosition_
 
bool doRunData_
 
bool doSourcePos_
 
bool doTiming_
 
bool doTriggerData_
 
int qadcFed_
 
hcaltb::HcalTBQADCUnpacker qadcUnpacker_
 
int sdFed_
 
hcaltb::HcalTBSlowDataUnpacker sdUnpacker_
 
int spdFed_
 
hcaltb::HcalTBSourcePositionDataUnpacker spdUnpacker_
 
int tdcFed_
 
hcaltb::HcalTBTDCUnpacker tdcUnpacker_
 
hcaltb::HcalTBTriggerDataUnpacker tdUnpacker_
 
edm::EDGetTokenT< FEDRawDataCollectiontok_raw_
 
int triggerFed_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

HcalTBObjectUnpacker is the EDProducer subclass which runs the Hcal Test Beam Object Unpack algorithm.

Author
Phil Dudero
Version
1st Version June 10, 2005

Definition at line 33 of file HcalTBObjectUnpacker.h.

Constructor & Destructor Documentation

◆ HcalTBObjectUnpacker()

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

Definition at line 14 of file HcalTBObjectUnpacker.cc.

References calibFile_, calibLines_, gather_cfg::cout, doBeamADC_, doEventPosition_, doRunData_, doSourcePos_, doTiming_, doTriggerData_, Exception, edm::ParameterSet::getParameter(), parseCalib(), qadcFed_, qadcUnpacker_, sdFed_, hcaltb::HcalTBQADCUnpacker::setCalib(), hcaltb::HcalTBTDCUnpacker::setCalib(), spdFed_, tdcFed_, tdcUnpacker_, tok_raw_, and triggerFed_.

15  : triggerFed_(conf.getUntrackedParameter<int>("HcalTriggerFED", -1)),
16  sdFed_(conf.getUntrackedParameter<int>("HcalSlowDataFED", -1)),
17  spdFed_(conf.getUntrackedParameter<int>("HcalSourcePositionFED", -1)),
18  tdcFed_(conf.getUntrackedParameter<int>("HcalTDCFED", -1)),
19  qadcFed_(conf.getUntrackedParameter<int>("HcalQADCFED", -1)),
20  calibFile_(conf.getUntrackedParameter<string>("ConfigurationFile", "")),
21  tdcUnpacker_(conf.getUntrackedParameter<bool>("IncludeUnmatchedHits", false)),
22  doRunData_(false),
23  doTriggerData_(false),
24  doEventPosition_(false),
25  doTiming_(false),
26  doSourcePos_(false),
27  doBeamADC_(false) {
28  tok_raw_ = consumes<FEDRawDataCollection>(conf.getParameter<edm::InputTag>("fedRawDataCollectionTag"));
29 
30  if (triggerFed_ >= 0) {
31  std::cout << "HcalTBObjectUnpacker will unpack Trigger FED ";
32  std::cout << triggerFed_ << endl;
33  doTriggerData_ = true;
34  }
35 
36  if (sdFed_ >= 0) {
37  std::cout << "HcalTBObjectUnpacker will unpack SlowData FED ";
38  std::cout << sdFed_ << endl;
39  doRunData_ = true;
40  doEventPosition_ = true; // at least the table
41  }
42 
43  if (tdcFed_ >= 0) {
44  std::cout << "HcalTBObjectUnpacker will unpack TDC FED ";
45  std::cout << tdcFed_ << endl;
46  doTiming_ = true;
47  doEventPosition_ = true; // at least the WC
48  }
49 
50  if (qadcFed_ >= 0) {
51  std::cout << "HcalTBObjectUnpacker will unpack QADC FED ";
52  std::cout << qadcFed_ << endl;
53  doBeamADC_ = true;
54  }
55 
56  if (spdFed_ >= 0) {
57  std::cout << "HcalTBObjectUnpacker will unpack Source Position Data FED ";
58  std::cout << spdFed_ << endl;
59  doSourcePos_ = true;
60  }
61 
62  if (tdcFed_ >= 0 || qadcFed_ >= 0) {
63  calibLines_.clear();
64  if (!calibFile_.empty()) {
65  parseCalib();
66  // printf("I got %d lines!\n",calibLines_.size());
67  if (calibLines_.empty())
68  throw cms::Exception("Incomplete configuration")
69  << "HcalTBObjectUnpacker: TDC/QADC/WC configuration file not found or is empty: " << calibFile_ << endl;
70  } else {
71  throw cms::Exception("Incomplete configuration")
72  << "HcalTBObjectUnpacker: TDC/QADC/WC configuration file not found: " << calibFile_ << endl;
73  }
74  }
75 
76  if (doTriggerData_)
77  produces<HcalTBTriggerData>();
78  if (doRunData_)
79  produces<HcalTBRunData>();
80  if (doEventPosition_)
81  produces<HcalTBEventPosition>();
82  if (doTiming_)
83  produces<HcalTBTiming>();
84  // if (doBeamADC_) produces<HcalTBBeamCounters>();
85  if (doBeamADC_) {
86  produces<HcalTBBeamCounters>();
88  }
89  if (doSourcePos_)
90  produces<HcalSourcePositionData>();
93 }
std::vector< std::vector< std::string > > calibLines_
void setCalib(const std::vector< std::vector< std::string > > &calibLines_)
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
hcaltb::HcalTBTDCUnpacker tdcUnpacker_
void setCalib(const std::vector< std::vector< std::string > > &calibLines_)
hcaltb::HcalTBQADCUnpacker qadcUnpacker_

◆ ~HcalTBObjectUnpacker()

HcalTBObjectUnpacker::~HcalTBObjectUnpacker ( )
override

Definition at line 96 of file HcalTBObjectUnpacker.cc.

96 {}

Member Function Documentation

◆ parseCalib()

void HcalTBObjectUnpacker::parseCalib ( )
private

Definition at line 165 of file HcalTBObjectUnpacker.cc.

References edmScanValgrind::buffer, calibFile_, calibLines_, relativeConstraints::empty, edm::FileInPath::fullPath(), mps_fire::i, timingPdfMaker::infile, B2GTnPMonitor_cfi::item, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by HcalTBObjectUnpacker().

165  {
166  if (calibFile_.empty()) {
167  printf("HcalTBObjectUnpacker cowardly refuses to parse a NULL file...\n");
168  return;
169  }
170 
172 
173  ifstream infile(fip.fullPath().c_str());
174 
175  char buffer[1024];
176  string tmpStr;
177 
178  while (infile.getline(buffer, 1024)) {
179  if (buffer[0] == '#')
180  continue; //ignore comment
181  if (buffer[0] == '/' && buffer[1] == '/')
182  continue; //ignore comment
183  tmpStr = string(buffer);
184  vector<string> lineVect;
185 
186  int start = 0;
187  bool empty = true;
188  for (unsigned i = 0; i <= tmpStr.size(); i++) {
189  if (tmpStr[i] == ' ' || i == tmpStr.size()) {
190  if (!empty) {
191  std::string item(tmpStr, start, i - start);
192  lineVect.push_back(item);
193  empty = true;
194  // printf("Got: %s\n",item.c_str());
195  }
196  start = i + 1;
197  } else {
198  if (empty)
199  empty = false;
200  }
201  }
202 
203  if (!lineVect.empty())
204  calibLines_.push_back(lineVect);
205  }
206 
207  infile.close();
208  return;
209 }
Definition: start.py:1
std::vector< std::vector< std::string > > calibLines_

◆ produce()

void HcalTBObjectUnpacker::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 99 of file HcalTBObjectUnpacker.cc.

References doBeamADC_, doEventPosition_, doRunData_, doSourcePos_, doTiming_, doTriggerData_, MillePedeFileConverter_cfg::e, FEDRawDataCollection::FEDData(), eostools::move(), qadcFed_, qadcUnpacker_, sdFed_, sdUnpacker_, spdFed_, spdUnpacker_, tdcFed_, tdcUnpacker_, tdUnpacker_, tok_raw_, triggerFed_, hcaltb::HcalTBQADCUnpacker::unpack(), hcaltb::HcalTBSourcePositionDataUnpacker::unpack(), hcaltb::HcalTBTriggerDataUnpacker::unpack(), hcaltb::HcalTBTDCUnpacker::unpack(), and hcaltb::HcalTBSlowDataUnpacker::unpack().

99  {
100  // Step A: Get Inputs
102  e.getByToken(tok_raw_, rawraw);
103 
104  // Step B: Create empty output
105  auto trigd = std::make_unique<HcalTBTriggerData>();
106 
107  auto rund = std::make_unique<HcalTBRunData>();
108 
109  auto epd = std::make_unique<HcalTBEventPosition>();
110 
111  auto tmgd = std::make_unique<HcalTBTiming>();
112 
113  auto bcntd = std::make_unique<HcalTBBeamCounters>();
114 
115  auto spd = std::make_unique<HcalSourcePositionData>();
116 
117  if (triggerFed_ >= 0) {
118  // Step C: unpack all requested FEDs
119  const FEDRawData& fed = rawraw->FEDData(triggerFed_);
120  tdUnpacker_.unpack(fed, *trigd);
121  }
122 
123  if (sdFed_ >= 0) {
124  // Step C: unpack all requested FEDs
125  const FEDRawData& fed = rawraw->FEDData(sdFed_);
126  sdUnpacker_.unpack(fed, *rund, *epd);
127  }
128 
129  if (tdcFed_ >= 0) {
130  // Step C: unpack all requested FEDs
131  const FEDRawData& fed = rawraw->FEDData(tdcFed_);
132  tdcUnpacker_.unpack(fed, *epd, *tmgd);
133  }
134 
135  if (qadcFed_ >= 0) {
136  // Step C: unpack all requested FEDs
137  const FEDRawData& fed = rawraw->FEDData(qadcFed_);
138  bool is04 = true;
139  if (qadcFed_ == 8)
140  is04 = false;
141  qadcUnpacker_.unpack(fed, *bcntd, is04);
142  }
143 
144  if (spdFed_ >= 0) {
145  // Step C: unpack all requested FEDs
146  const FEDRawData& fed = rawraw->FEDData(spdFed_);
147  spdUnpacker_.unpack(fed, *spd);
148  }
149 
150  // Step D: Put outputs into event
151  if (doTriggerData_)
152  e.put(std::move(trigd));
153  if (doRunData_)
154  e.put(std::move(rund));
155  if (doEventPosition_)
156  e.put(std::move(epd));
157  if (doTiming_)
158  e.put(std::move(tmgd));
159  if (doBeamADC_)
160  e.put(std::move(bcntd));
161  if (doSourcePos_)
162  e.put(std::move(spd));
163 }
hcaltb::HcalTBTriggerDataUnpacker tdUnpacker_
hcaltb::HcalTBSlowDataUnpacker sdUnpacker_
hcaltb::HcalTBSourcePositionDataUnpacker spdUnpacker_
void unpack(const FEDRawData &raw, HcalTBRunData &htbrd, HcalTBEventPosition &htbep) const
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
void unpack(const FEDRawData &raw, HcalTBTriggerData &htbtd) const
edm::EDGetTokenT< FEDRawDataCollection > tok_raw_
void unpack(const FEDRawData &raw, HcalSourcePositionData &hspd) const
hcaltb::HcalTBTDCUnpacker tdcUnpacker_
void unpack(const FEDRawData &raw, HcalTBBeamCounters &beamadc, bool is04_=true) const
hcaltb::HcalTBQADCUnpacker qadcUnpacker_
void unpack(const FEDRawData &raw, HcalTBEventPosition &pos, HcalTBTiming &timing) const
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ calibFile_

std::string HcalTBObjectUnpacker::calibFile_
private

Definition at line 45 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

◆ calibLines_

std::vector<std::vector<std::string> > HcalTBObjectUnpacker::calibLines_
private

Definition at line 53 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

◆ doBeamADC_

bool HcalTBObjectUnpacker::doBeamADC_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ doEventPosition_

bool HcalTBObjectUnpacker::doEventPosition_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ doRunData_

bool HcalTBObjectUnpacker::doRunData_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ doSourcePos_

bool HcalTBObjectUnpacker::doSourcePos_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ doTiming_

bool HcalTBObjectUnpacker::doTiming_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ doTriggerData_

bool HcalTBObjectUnpacker::doTriggerData_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ qadcFed_

int HcalTBObjectUnpacker::qadcFed_
private

Definition at line 44 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ qadcUnpacker_

hcaltb::HcalTBQADCUnpacker HcalTBObjectUnpacker::qadcUnpacker_
private

Definition at line 49 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ sdFed_

int HcalTBObjectUnpacker::sdFed_
private

Definition at line 41 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ sdUnpacker_

hcaltb::HcalTBSlowDataUnpacker HcalTBObjectUnpacker::sdUnpacker_
private

Definition at line 47 of file HcalTBObjectUnpacker.h.

Referenced by produce().

◆ spdFed_

int HcalTBObjectUnpacker::spdFed_
private

Definition at line 42 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ spdUnpacker_

hcaltb::HcalTBSourcePositionDataUnpacker HcalTBObjectUnpacker::spdUnpacker_
private

Definition at line 50 of file HcalTBObjectUnpacker.h.

Referenced by produce().

◆ tdcFed_

int HcalTBObjectUnpacker::tdcFed_
private

Definition at line 43 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ tdcUnpacker_

hcaltb::HcalTBTDCUnpacker HcalTBObjectUnpacker::tdcUnpacker_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ tdUnpacker_

hcaltb::HcalTBTriggerDataUnpacker HcalTBObjectUnpacker::tdUnpacker_
private

Definition at line 46 of file HcalTBObjectUnpacker.h.

Referenced by produce().

◆ tok_raw_

edm::EDGetTokenT<FEDRawDataCollection> HcalTBObjectUnpacker::tok_raw_
private

Definition at line 54 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

◆ triggerFed_

int HcalTBObjectUnpacker::triggerFed_
private

Definition at line 40 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().