16 #include <boost/algorithm/string/split.hpp> 17 #include <boost/algorithm/string_regex.hpp> 35 cout <<
"[DTTPGParamsWriter]Constructor called!" << endl;
42 cout <<
"[DTTPGParamsWriter]Destructor called!" << endl;
50 cout <<
"[DTTPGParamsWriter]Reading data from file." << endl;
52 std::ifstream inputFile_(inputFileName_.c_str());
56 while (std::getline(inputFile_, line)) {
60 pharseLine(line, chId, fine, coarse);
66 std::cout <<
"[DTTPGParamsWriter] Read data for chamber " << chId
67 <<
". File params -> fine: " << fine <<
" coarse: " << coarse
68 <<
". DB params -> fine: " << fineDB <<
" coarse: " << coarseDB
74 std::cout <<
"[DTTPGParamsWriter] # of entries written the the DB: " 75 << nLines << std::endl;
79 <<
"[DTTPGParamsWriter] # of DB entries != 250. Check you input file!" 87 float &fine,
int &coarse) {
92 boost::algorithm::is_any_of(
95 if (elements.size() != 5) {
96 std::cout <<
"[DTTPGParamsWriter] wrong number of entries in line : " 97 << line <<
" pleas check your input file syntax!" << std::endl;
99 chId =
DTChamberId(atoi(elements[0].c_str()), atoi(elements[1].c_str()),
100 atoi(elements[2].c_str()));
101 fine = atof(elements[3].c_str());
102 coarse = atoi(elements[4].c_str());
109 cout <<
"[DTTPGParamsWriter] Writing ttrig object to DB!" << endl;
111 string delayRecord =
"DTTPGParametersRcd";
T getUntrackedParameter(std::string const &, T const &) const
void endJob() override
Write ttrig in the DB.
void pharseLine(std::string &line, DTChamberId &chId, float &fine, int &coarse)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup) override
Compute the ttrig by fiting the TB rising edge.
~DTTPGParamsWriter() override
Destructor.
static void writeToDB(std::string record, T *payload)
DTTPGParamsWriter(const edm::ParameterSet &pset)
Constructor.