File indexing completed on 2023-03-17 10:47:49
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "CondTools/DT/interface/DTPerformanceHandler.h"
0014
0015
0016
0017
0018 #include "CondFormats/DTObjects/interface/DTPerformance.h"
0019
0020
0021
0022
0023 #include <iostream>
0024 #include <fstream>
0025
0026
0027
0028
0029
0030
0031
0032
0033 DTPerformanceHandler::DTPerformanceHandler(const edm::ParameterSet& ps)
0034 : dataTag(ps.getParameter<std::string>("tag")),
0035 fileName(ps.getParameter<std::string>("file")),
0036 runNumber(ps.getParameter<unsigned int>("run")) {}
0037
0038
0039
0040
0041 DTPerformanceHandler::~DTPerformanceHandler() {}
0042
0043
0044
0045
0046 void DTPerformanceHandler::getNewObjects() {
0047
0048 cond::TagInfo_t const& ti = tagInfo();
0049 cond::Time_t last = ti.lastInterval.since;
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081
0082 DTPerformance* dtPerf = new DTPerformance(dataTag);
0083
0084 int status = 0;
0085 std::ifstream ifile(fileName.c_str());
0086 int whe;
0087 int sta;
0088 int sec;
0089 int qua;
0090 float meanT0;
0091 float meanTtrig;
0092 float meanMtime;
0093 float meanNoise;
0094 float meanAfterPulse;
0095 float meanResolution;
0096 float meanEfficiency;
0097 while (ifile >> whe >> sta >> sec >> qua >> meanT0 >> meanTtrig >> meanMtime >> meanNoise >> meanAfterPulse >>
0098 meanResolution >> meanEfficiency) {
0099 status = dtPerf->set(whe,
0100 sta,
0101 sec,
0102 qua,
0103 meanT0,
0104 meanTtrig,
0105 meanMtime,
0106 meanNoise,
0107 meanAfterPulse,
0108 meanResolution,
0109 meanEfficiency,
0110 DTTimeUnits::counts);
0111 std::cout << whe << " " << sta << " " << sec << " " << qua << std::endl
0112 << " === " << meanT0 << " " << meanTtrig << " " << meanMtime << " " << meanNoise << " " << meanAfterPulse
0113 << " " << meanResolution << " " << meanEfficiency << std::endl
0114 << " -> ";
0115 std::cout << "insert status: " << status << std::endl;
0116 }
0117
0118
0119
0120
0121
0122
0123
0124
0125
0126
0127
0128 cond::Time_t snc = runNumber;
0129 if (runNumber > last)
0130 m_to_transfer.push_back(std::make_pair(dtPerf, snc));
0131 else
0132 std::cout << "More recent data already present - skipped" << std::endl;
0133
0134 return;
0135 }
0136
0137 std::string DTPerformanceHandler::id() const { return dataTag; }