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 Member Functions | Private Attributes
HcalTBObjectUnpacker Class Reference

#include <HcalTBObjectUnpacker.h>

Inheritance diagram for HcalTBObjectUnpacker:
edm::EDProducer edm::ProducerBase 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 ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

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_
 
int triggerFed_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

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 30 of file HcalTBObjectUnpacker.h.

Constructor & Destructor Documentation

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

Definition at line 17 of file HcalTBObjectUnpacker.cc.

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

17  :
18  triggerFed_(conf.getUntrackedParameter<int>("HcalTriggerFED",-1)),
19  sdFed_(conf.getUntrackedParameter<int>("HcalSlowDataFED",-1)),
20  spdFed_(conf.getUntrackedParameter<int>("HcalSourcePositionFED",-1)),
21  tdcFed_(conf.getUntrackedParameter<int>("HcalTDCFED",-1)),
22  qadcFed_(conf.getUntrackedParameter<int>("HcalQADCFED",-1)),
23  calibFile_(conf.getUntrackedParameter<string>("ConfigurationFile","")),
24  tdcUnpacker_(conf.getUntrackedParameter<bool>("IncludeUnmatchedHits",false)),
25  doRunData_(false),doTriggerData_(false),doEventPosition_(false),doTiming_(false),doSourcePos_(false),doBeamADC_(false)
26  {
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_)
tuple conf
Definition: dbtoconf.py:185
hcaltb::HcalTBTDCUnpacker tdcUnpacker_
void setCalib(const std::vector< std::vector< std::string > > &calibLines_)
hcaltb::HcalTBQADCUnpacker qadcUnpacker_
tuple cout
Definition: gather_cfg.py:121
HcalTBObjectUnpacker::~HcalTBObjectUnpacker ( )
virtual

Definition at line 89 of file HcalTBObjectUnpacker.cc.

89 { }

Member Function Documentation

void HcalTBObjectUnpacker::parseCalib ( )
private

Definition at line 160 of file HcalTBObjectUnpacker.cc.

References calibFile_, calibLines_, relativeConstraints::empty, edm::FileInPath::fullPath(), i, EdgesToViz::infile, and errorMatrix2Lands_multiChannel::start.

Referenced by HcalTBObjectUnpacker().

160  {
161 
162  if(calibFile_.size()==0){
163  printf("HcalTBObjectUnpacker cowardly refuses to parse a NULL file...\n");
164  return;
165  }
166 
168 
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] == '#') continue; //ignore comment
177  if (buffer [0] == '/' && buffer [1] == '/') continue; //ignore comment
178  tmpStr = string(buffer);
179  vector<string> lineVect;
180 
181  int start = 0; bool empty = true;
182  for (unsigned i=0; i<=tmpStr.size(); i++) {
183  if (tmpStr[i] == ' ' || i==tmpStr.size()) {
184  if (!empty) {
185  std::string item(tmpStr, start, i-start);
186  lineVect.push_back(item);
187  empty = true;
188 // printf("Got: %s\n",item.c_str());
189  }
190  start = i+1;
191  }
192  else {
193  if (empty) empty = false;
194  }
195  }
196 
197  if(lineVect.size()>0) calibLines_.push_back(lineVect);
198  }
199 
200  infile.close();
201  return;
202 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::vector< std::string > > calibLines_
list infile
Definition: EdgesToViz.py:90
void HcalTBObjectUnpacker::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 92 of file HcalTBObjectUnpacker.cc.

References doBeamADC_, doEventPosition_, doRunData_, doSourcePos_, doTiming_, doTriggerData_, edm::Event::getByType(), edm::Event::put(), qadcFed_, qadcUnpacker_, sdFed_, sdUnpacker_, spdFed_, spdUnpacker_, tdcFed_, tdcUnpacker_, tdUnpacker_, triggerFed_, hcaltb::HcalTBQADCUnpacker::unpack(), hcaltb::HcalTBTriggerDataUnpacker::unpack(), hcaltb::HcalTBSourcePositionDataUnpacker::unpack(), hcaltb::HcalTBTDCUnpacker::unpack(), and hcaltb::HcalTBSlowDataUnpacker::unpack().

93  {
94  // Step A: Get Inputs
96  // edm::ProcessNameSelector s("PROD"); // HACK!
97  e.getByType(rawraw);
98 
99  // Step B: Create empty output
100  std::auto_ptr<HcalTBTriggerData>
101  trigd(new HcalTBTriggerData);
102 
103  std::auto_ptr<HcalTBRunData>
104  rund(new HcalTBRunData);
105 
106  std::auto_ptr<HcalTBEventPosition>
107  epd(new HcalTBEventPosition);
108 
109  std::auto_ptr<HcalTBTiming>
110  tmgd(new HcalTBTiming);
111 
112  std::auto_ptr<HcalTBBeamCounters>
113  bcntd(new HcalTBBeamCounters);
114 
115  std::auto_ptr<HcalSourcePositionData>
116  spd(new HcalSourcePositionData);
117 
118  if (triggerFed_ >=0) {
119  // Step C: unpack all requested FEDs
120  const FEDRawData& fed = rawraw->FEDData(triggerFed_);
121  tdUnpacker_.unpack(fed,*trigd);
122  }
123 
124  if (sdFed_ >=0) {
125  // Step C: unpack all requested FEDs
126  const FEDRawData& fed = rawraw->FEDData(sdFed_);
127  sdUnpacker_.unpack(fed, *rund, *epd);
128  }
129 
130  if (tdcFed_ >=0) {
131  // Step C: unpack all requested FEDs
132  const FEDRawData& fed = rawraw->FEDData(tdcFed_);
133  tdcUnpacker_.unpack(fed, *epd, *tmgd);
134  }
135 
136  if (qadcFed_ >=0) {
137  // Step C: unpack all requested FEDs
138  const FEDRawData& fed = rawraw->FEDData(qadcFed_);
139  bool is04 = true;
140  if(qadcFed_==8) 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_) e.put(trigd);
152  if (doRunData_) e.put(rund);
153  if (doEventPosition_) e.put(epd);
154  if (doTiming_) e.put(tmgd);
155  if (doBeamADC_) e.put(bcntd);
156  if (doSourcePos_) e.put(spd);
157  }
hcaltb::HcalTBTriggerDataUnpacker tdUnpacker_
void unpack(const FEDRawData &raw, HcalTBTriggerData &htbtd) const
void unpack(const FEDRawData &raw, HcalTBBeamCounters &beamadc, bool is04_=true) const
bool getByType(Handle< PROD > &result) const
Definition: Event.h:398
void unpack(const FEDRawData &raw, HcalSourcePositionData &hspd) const
hcaltb::HcalTBSlowDataUnpacker sdUnpacker_
hcaltb::HcalTBSourcePositionDataUnpacker spdUnpacker_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:85
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_

Member Data Documentation

std::string HcalTBObjectUnpacker::calibFile_
private

Definition at line 42 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

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

Definition at line 50 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and parseCalib().

bool HcalTBObjectUnpacker::doBeamADC_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doEventPosition_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doRunData_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doSourcePos_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doTiming_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

bool HcalTBObjectUnpacker::doTriggerData_
private

Definition at line 48 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

int HcalTBObjectUnpacker::qadcFed_
private

Definition at line 41 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBQADCUnpacker HcalTBObjectUnpacker::qadcUnpacker_
private

Definition at line 46 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

int HcalTBObjectUnpacker::sdFed_
private

Definition at line 38 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBSlowDataUnpacker HcalTBObjectUnpacker::sdUnpacker_
private

Definition at line 44 of file HcalTBObjectUnpacker.h.

Referenced by produce().

int HcalTBObjectUnpacker::spdFed_
private

Definition at line 39 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBSourcePositionDataUnpacker HcalTBObjectUnpacker::spdUnpacker_
private

Definition at line 47 of file HcalTBObjectUnpacker.h.

Referenced by produce().

int HcalTBObjectUnpacker::tdcFed_
private

Definition at line 40 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBTDCUnpacker HcalTBObjectUnpacker::tdcUnpacker_
private

Definition at line 45 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().

hcaltb::HcalTBTriggerDataUnpacker HcalTBObjectUnpacker::tdUnpacker_
private

Definition at line 43 of file HcalTBObjectUnpacker.h.

Referenced by produce().

int HcalTBObjectUnpacker::triggerFed_
private

Definition at line 37 of file HcalTBObjectUnpacker.h.

Referenced by HcalTBObjectUnpacker(), and produce().