#include <RecoTBCalo/HcalTBObjectUnpacker/interface/HcalTBObjectUnpacker.h>
Public Member Functions | |
HcalTBObjectUnpacker (const edm::ParameterSet &ps) | |
virtual void | produce (edm::Event &e, const edm::EventSetup &c) |
virtual | ~HcalTBObjectUnpacker () |
Private Member Functions | |
void | parseCalib () |
Private Attributes | |
string | calibFile_ |
vector< vector< 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_ |
Definition at line 33 of file HcalTBObjectUnpacker.h.
HcalTBObjectUnpacker::HcalTBObjectUnpacker | ( | const edm::ParameterSet & | ps | ) | [explicit] |
Definition at line 17 of file HcalTBObjectUnpacker.cc.
References calibFile_, calibLines_, GenMuonPlsPt100GeV_cfg::cout, doBeamADC_, doEventPosition_, doRunData_, doSourcePos_, doTiming_, doTriggerData_, lat::endl(), Exception, parseCalib(), qadcFed_, qadcUnpacker_, sdFed_, hcaltb::HcalTBTDCUnpacker::setCalib(), hcaltb::HcalTBQADCUnpacker::setCalib(), spdFed_, tdcFed_, tdcUnpacker_, and triggerFed_.
00017 : 00018 triggerFed_(conf.getUntrackedParameter<int>("HcalTriggerFED",-1)), 00019 sdFed_(conf.getUntrackedParameter<int>("HcalSlowDataFED",-1)), 00020 spdFed_(conf.getUntrackedParameter<int>("HcalSourcePositionFED",-1)), 00021 tdcFed_(conf.getUntrackedParameter<int>("HcalTDCFED",-1)), 00022 qadcFed_(conf.getUntrackedParameter<int>("HcalQADCFED",-1)), 00023 calibFile_(conf.getUntrackedParameter<string>("ConfigurationFile","")), 00024 tdcUnpacker_(conf.getUntrackedParameter<bool>("IncludeUnmatchedHits",false)), 00025 doRunData_(false),doTriggerData_(false),doEventPosition_(false),doTiming_(false),doSourcePos_(false),doBeamADC_(false) 00026 { 00027 00028 if (triggerFed_ >=0) { 00029 std::cout << "HcalTBObjectUnpacker will unpack Trigger FED "; 00030 std::cout << triggerFed_ << endl; 00031 doTriggerData_=true; 00032 } 00033 00034 if (sdFed_ >=0) { 00035 std::cout << "HcalTBObjectUnpacker will unpack SlowData FED "; 00036 std::cout << sdFed_ << endl; 00037 doRunData_=true; 00038 doEventPosition_=true; // at least the table 00039 } 00040 00041 if (tdcFed_ >=0) { 00042 std::cout << "HcalTBObjectUnpacker will unpack TDC FED "; 00043 std::cout << tdcFed_ << endl; 00044 doTiming_=true; 00045 doEventPosition_=true; // at least the WC 00046 } 00047 00048 if (qadcFed_ >=0) { 00049 std::cout << "HcalTBObjectUnpacker will unpack QADC FED "; 00050 std::cout << qadcFed_ << endl; 00051 doBeamADC_=true; 00052 } 00053 00054 if (spdFed_ >=0) { 00055 std::cout << "HcalTBObjectUnpacker will unpack Source Position Data FED "; 00056 std::cout << spdFed_ << endl; 00057 doSourcePos_=true; 00058 } 00059 00060 00061 if (tdcFed_ >= 0 || qadcFed_ >=0 ) { 00062 calibLines_.clear(); 00063 if(calibFile_.size()>0){ 00064 parseCalib(); 00065 // printf("I got %d lines!\n",calibLines_.size()); 00066 if(calibLines_.size()==0) 00067 throw cms::Exception("Incomplete configuration") << 00068 "HcalTBObjectUnpacker: TDC/QADC/WC configuration file not found or is empty: "<<calibFile_<<endl; 00069 } 00070 else{ 00071 throw cms::Exception("Incomplete configuration") << 00072 "HcalTBObjectUnpacker: TDC/QADC/WC configuration file not found: "<<calibFile_<<endl; 00073 } 00074 } 00075 00076 00077 if (doTriggerData_) produces<HcalTBTriggerData>(); 00078 if (doRunData_) produces<HcalTBRunData>(); 00079 if (doEventPosition_) produces<HcalTBEventPosition>(); 00080 if (doTiming_) produces<HcalTBTiming>(); 00081 // if (doBeamADC_) produces<HcalTBBeamCounters>(); 00082 if (doBeamADC_) {produces<HcalTBBeamCounters>();qadcUnpacker_.setCalib(calibLines_);} 00083 // if (doSourcePos_) produces<HcalSourcePositionData>(); 00084 if(doTiming_||doEventPosition_)tdcUnpacker_.setCalib(calibLines_); 00085 }
HcalTBObjectUnpacker::~HcalTBObjectUnpacker | ( | ) | [virtual] |
void HcalTBObjectUnpacker::parseCalib | ( | ) | [private] |
Definition at line 159 of file HcalTBObjectUnpacker.cc.
References calibFile_, calibLines_, empty, i, and TreeToEdges::infile.
Referenced by HcalTBObjectUnpacker().
00159 { 00160 00161 if(calibFile_.size()==0){ 00162 printf("HcalTBObjectUnpacker cowardly refuses to parse a NULL file...\n"); 00163 return; 00164 } 00165 00166 ifstream infile(calibFile_.c_str()); 00167 00168 char buffer [1024]; 00169 string tmpStr; 00170 00171 while (infile.getline(buffer, 1024)) { 00172 if (buffer [0] == '#') continue; //ignore comment 00173 if (buffer [0] == '/' && buffer [1] == '/') continue; //ignore comment 00174 tmpStr = string(buffer); 00175 vector<string> lineVect; 00176 00177 int start = 0; bool empty = true; 00178 for (unsigned i=0; i<=tmpStr.size(); i++) { 00179 if (tmpStr[i] == ' ' || i==tmpStr.size()) { 00180 if (!empty) { 00181 std::string item(tmpStr, start, i-start); 00182 lineVect.push_back(item); 00183 empty = true; 00184 // printf("Got: %s\n",item.c_str()); 00185 } 00186 start = i+1; 00187 } 00188 else { 00189 if (empty) empty = false; 00190 } 00191 } 00192 00193 if(lineVect.size()>0) calibLines_.push_back(lineVect); 00194 } 00195 00196 infile.close(); 00197 return; 00198 }
void HcalTBObjectUnpacker::produce | ( | edm::Event & | e, | |
const edm::EventSetup & | c | |||
) | [virtual] |
Implements edm::EDProducer.
Definition at line 91 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::HcalTBTDCUnpacker::unpack(), hcaltb::HcalTBTriggerDataUnpacker::unpack(), hcaltb::HcalTBSourcePositionDataUnpacker::unpack(), hcaltb::HcalTBQADCUnpacker::unpack(), and hcaltb::HcalTBSlowDataUnpacker::unpack().
00092 { 00093 // Step A: Get Inputs 00094 edm::Handle<FEDRawDataCollection> rawraw; 00095 // edm::ProcessNameSelector s("PROD"); // HACK! 00096 e.getByType(rawraw); 00097 00098 // Step B: Create empty output 00099 std::auto_ptr<HcalTBTriggerData> 00100 trigd(new HcalTBTriggerData); 00101 00102 std::auto_ptr<HcalTBRunData> 00103 rund(new HcalTBRunData); 00104 00105 std::auto_ptr<HcalTBEventPosition> 00106 epd(new HcalTBEventPosition); 00107 00108 std::auto_ptr<HcalTBTiming> 00109 tmgd(new HcalTBTiming); 00110 00111 std::auto_ptr<HcalTBBeamCounters> 00112 bcntd(new HcalTBBeamCounters); 00113 00114 std::auto_ptr<HcalSourcePositionData> 00115 spd(new HcalSourcePositionData); 00116 00117 if (triggerFed_ >=0) { 00118 // Step C: unpack all requested FEDs 00119 const FEDRawData& fed = rawraw->FEDData(triggerFed_); 00120 tdUnpacker_.unpack(fed,*trigd); 00121 } 00122 00123 if (sdFed_ >=0) { 00124 // Step C: unpack all requested FEDs 00125 const FEDRawData& fed = rawraw->FEDData(sdFed_); 00126 sdUnpacker_.unpack(fed, *rund, *epd); 00127 } 00128 00129 if (tdcFed_ >=0) { 00130 // Step C: unpack all requested FEDs 00131 const FEDRawData& fed = rawraw->FEDData(tdcFed_); 00132 tdcUnpacker_.unpack(fed, *epd, *tmgd); 00133 } 00134 00135 if (qadcFed_ >=0) { 00136 // Step C: unpack all requested FEDs 00137 const FEDRawData& fed = rawraw->FEDData(qadcFed_); 00138 bool is04 = true; 00139 if(qadcFed_==8) is04=false; 00140 qadcUnpacker_.unpack(fed, *bcntd,is04); 00141 } 00142 00143 if (spdFed_ >=0) { 00144 // Step C: unpack all requested FEDs 00145 const FEDRawData& fed = rawraw->FEDData(spdFed_); 00146 spdUnpacker_.unpack(fed, *spd); 00147 } 00148 00149 // Step D: Put outputs into event 00150 if (doTriggerData_) e.put(trigd); 00151 if (doRunData_) e.put(rund); 00152 if (doEventPosition_) e.put(epd); 00153 if (doTiming_) e.put(tmgd); 00154 if (doBeamADC_) e.put(bcntd); 00155 if (doSourcePos_) e.put(spd); 00156 }
string HcalTBObjectUnpacker::calibFile_ [private] |
Definition at line 45 of file HcalTBObjectUnpacker.h.
Referenced by HcalTBObjectUnpacker(), and parseCalib().
vector<vector<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().
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().
int HcalTBObjectUnpacker::spdFed_ [private] |
Definition at line 42 of file HcalTBObjectUnpacker.h.
Referenced by HcalTBObjectUnpacker(), and produce().
int HcalTBObjectUnpacker::tdcFed_ [private] |
Definition at line 43 of file HcalTBObjectUnpacker.h.
Referenced by HcalTBObjectUnpacker(), and produce().
Definition at line 48 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().