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)
 
virtual void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~HcalTBObjectUnpacker ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 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
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)
 
- 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

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 ( const edm::ParameterSet ps)
explicit

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

Definition at line 89 of file HcalTBObjectUnpacker.cc.

89 { }

Member Function Documentation

void HcalTBObjectUnpacker::parseCalib ( )
private

Definition at line 153 of file HcalTBObjectUnpacker.cc.

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

Referenced by HcalTBObjectUnpacker().

153  {
154 
155  if(calibFile_.size()==0){
156  printf("HcalTBObjectUnpacker cowardly refuses to parse a NULL file...\n");
157  return;
158  }
159 
161 
162 
163  ifstream infile(fip.fullPath().c_str());
164 
165  char buffer [1024];
166  string tmpStr;
167 
168  while (infile.getline(buffer, 1024)) {
169  if (buffer [0] == '#') continue; //ignore comment
170  if (buffer [0] == '/' && buffer [1] == '/') continue; //ignore comment
171  tmpStr = string(buffer);
172  vector<string> lineVect;
173 
174  int start = 0; bool empty = true;
175  for (unsigned i=0; i<=tmpStr.size(); i++) {
176  if (tmpStr[i] == ' ' || i==tmpStr.size()) {
177  if (!empty) {
178  std::string item(tmpStr, start, i-start);
179  lineVect.push_back(item);
180  empty = true;
181 // printf("Got: %s\n",item.c_str());
182  }
183  start = i+1;
184  }
185  else {
186  if (empty) empty = false;
187  }
188  }
189 
190  if(lineVect.size()>0) calibLines_.push_back(lineVect);
191  }
192 
193  infile.close();
194  return;
195 }
Definition: start.py:1
std::vector< std::vector< std::string > > calibLines_
void HcalTBObjectUnpacker::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Definition at line 92 of file HcalTBObjectUnpacker.cc.

References doBeamADC_, doEventPosition_, doRunData_, doSourcePos_, doTiming_, doTriggerData_, FEDRawDataCollection::FEDData(), edm::Event::getByToken(), eostools::move(), edm::Event::put(), 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().

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

Member Data Documentation

std::string HcalTBObjectUnpacker::calibFile_
private

Definition at line 45 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

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

Definition at line 53 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

bool HcalTBObjectUnpacker::doBeamADC_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doEventPosition_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doRunData_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doSourcePos_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doTiming_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doTriggerData_
private

Definition at line 51 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

int HcalTBObjectUnpacker::qadcFed_
private

Definition at line 44 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBQADCUnpacker HcalTBObjectUnpacker::qadcUnpacker_
private

Definition at line 49 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

int HcalTBObjectUnpacker::sdFed_
private

Definition at line 41 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBSlowDataUnpacker HcalTBObjectUnpacker::sdUnpacker_
private

Definition at line 47 of file HcalTBObjectUnpacker.h.

Referenced by produce().

int HcalTBObjectUnpacker::spdFed_
private

Definition at line 42 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBSourcePositionDataUnpacker HcalTBObjectUnpacker::spdUnpacker_
private

Definition at line 50 of file HcalTBObjectUnpacker.h.

Referenced by produce().

int HcalTBObjectUnpacker::tdcFed_
private

Definition at line 43 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBTDCUnpacker HcalTBObjectUnpacker::tdcUnpacker_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBTriggerDataUnpacker HcalTBObjectUnpacker::tdUnpacker_
private

Definition at line 46 of file HcalTBObjectUnpacker.h.

Referenced by produce().

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

Definition at line 54 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

int HcalTBObjectUnpacker::triggerFed_
private

Definition at line 40 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().