File indexing completed on 2024-10-16 05:03:43
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 if (runNumber <= last) {
0082 std::cout << "More recent data already present - skipped" << std::endl;
0083 return;
0084 }
0085
0086 DTPerformance* dtPerf = new DTPerformance(dataTag);
0087
0088 int status = 0;
0089 std::ifstream ifile(fileName.c_str());
0090 int whe;
0091 int sta;
0092 int sec;
0093 int qua;
0094 float meanT0;
0095 float meanTtrig;
0096 float meanMtime;
0097 float meanNoise;
0098 float meanAfterPulse;
0099 float meanResolution;
0100 float meanEfficiency;
0101 while (ifile >> whe >> sta >> sec >> qua >> meanT0 >> meanTtrig >> meanMtime >> meanNoise >> meanAfterPulse >>
0102 meanResolution >> meanEfficiency) {
0103 status = dtPerf->set(whe,
0104 sta,
0105 sec,
0106 qua,
0107 meanT0,
0108 meanTtrig,
0109 meanMtime,
0110 meanNoise,
0111 meanAfterPulse,
0112 meanResolution,
0113 meanEfficiency,
0114 DTTimeUnits::counts);
0115 std::cout << whe << " " << sta << " " << sec << " " << qua << std::endl
0116 << " === " << meanT0 << " " << meanTtrig << " " << meanMtime << " " << meanNoise << " " << meanAfterPulse
0117 << " " << meanResolution << " " << meanEfficiency << std::endl
0118 << " -> ";
0119 std::cout << "insert status: " << status << std::endl;
0120 }
0121
0122
0123
0124
0125
0126
0127
0128
0129
0130
0131
0132 m_to_transfer.emplace_back(dtPerf, runNumber);
0133 }
0134
0135 std::string DTPerformanceHandler::id() const { return dataTag; }