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::stream::EDProducer<>

Public Member Functions

 HcalTBObjectUnpacker (const edm::ParameterSet &ps)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

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::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

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_

Member Function Documentation

◆ parseCalib()

void HcalTBObjectUnpacker::parseCalib ( )
private

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

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

◆ produce()

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

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

96  {
97  // Step A: Get Inputs
99  e.getByToken(tok_raw_, rawraw);
100 
101  // Step B: Create empty output
102  auto trigd = std::make_unique<HcalTBTriggerData>();
103 
104  auto rund = std::make_unique<HcalTBRunData>();
105 
106  auto epd = std::make_unique<HcalTBEventPosition>();
107 
108  auto tmgd = std::make_unique<HcalTBTiming>();
109 
110  auto bcntd = std::make_unique<HcalTBBeamCounters>();
111 
112  auto spd = std::make_unique<HcalSourcePositionData>();
113 
114  if (triggerFed_ >= 0) {
115  // Step C: unpack all requested FEDs
116  const FEDRawData& fed = rawraw->FEDData(triggerFed_);
117  tdUnpacker_.unpack(fed, *trigd);
118  }
119 
120  if (sdFed_ >= 0) {
121  // Step C: unpack all requested FEDs
122  const FEDRawData& fed = rawraw->FEDData(sdFed_);
123  sdUnpacker_.unpack(fed, *rund, *epd);
124  }
125 
126  if (tdcFed_ >= 0) {
127  // Step C: unpack all requested FEDs
128  const FEDRawData& fed = rawraw->FEDData(tdcFed_);
129  tdcUnpacker_.unpack(fed, *epd, *tmgd);
130  }
131 
132  if (qadcFed_ >= 0) {
133  // Step C: unpack all requested FEDs
134  const FEDRawData& fed = rawraw->FEDData(qadcFed_);
135  bool is04 = true;
136  if (qadcFed_ == 8)
137  is04 = false;
138  qadcUnpacker_.unpack(fed, *bcntd, is04);
139  }
140 
141  if (spdFed_ >= 0) {
142  // Step C: unpack all requested FEDs
143  const FEDRawData& fed = rawraw->FEDData(spdFed_);
144  spdUnpacker_.unpack(fed, *spd);
145  }
146 
147  // Step D: Put outputs into event
148  if (doTriggerData_)
149  e.put(std::move(trigd));
150  if (doRunData_)
151  e.put(std::move(rund));
152  if (doEventPosition_)
153  e.put(std::move(epd));
154  if (doTiming_)
155  e.put(std::move(tmgd));
156  if (doBeamADC_)
157  e.put(std::move(bcntd));
158  if (doSourcePos_)
159  e.put(std::move(spd));
160 }
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().