CMS 3D CMS Logo

DTPerformanceHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/02/15 18:14:45 $
5  * $Revision: 1.3 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //-----------------------
11 // This Class' Header --
12 //-----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 #include <iostream>
24 #include <fstream>
25 
26 //-------------------
27 // Initializations --
28 //-------------------
29 
30 //----------------
31 // Constructors --
32 //----------------
34  : dataTag(ps.getParameter<std::string>("tag")),
35  fileName(ps.getParameter<std::string>("file")),
36  runNumber(ps.getParameter<unsigned int>("run")) {}
37 
38 //--------------
39 // Destructor --
40 //--------------
42 
43 //--------------
44 // Operations --
45 //--------------
47  //to access the information on the tag inside the offline database:
48  cond::TagInfo const& ti = tagInfo();
49  unsigned int last = ti.lastInterval.first;
50 
51  //to access the information on last successful log entry for this tag:
52  // cond::LogDBEntry const & lde = logDBEntry();
53 
54  //to access the lastest payload (Ref is a smart pointer)
55  // Ref payload = lastPayload();
56 
57  /*
58  int irun = event.id().run();
59  int ievt = event.id().event();
60  std::cout << "================ "
61  << irun << " " << ievt << std::endl;
62 
63 // edm::Service<cond::service::PoolDBOutputService> dbservice;
64 
65  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
66  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
67  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
68  std::cout << "list of all tags: " << std::endl;
69  while ( iter != iend ) {
70  std::cout << "Tag: " << iter->first
71  << " , last object valid since " << iter->second.last_since
72  << " to " << iter->second.last_till
73  << std::endl;
74  iter++;
75  }
76 
77  std::cout << "look for tag " << dataTag << std::endl;
78  std::map<std::string, popcon::PayloadIOV>::iterator itag =
79  mp.find( dataTag );
80 */
81 
82  DTPerformance* dtPerf = new DTPerformance(dataTag);
83 
84  int status = 0;
85  std::ifstream ifile(fileName.c_str());
86  int whe;
87  int sta;
88  int sec;
89  int qua;
90  float meanT0;
91  float meanTtrig;
92  float meanMtime;
93  float meanNoise;
94  float meanAfterPulse;
95  float meanResolution;
96  float meanEfficiency;
97  while (ifile >> whe >> sta >> sec >> qua >> meanT0 >> meanTtrig >> meanMtime >> meanNoise >> meanAfterPulse >>
98  meanResolution >> meanEfficiency) {
99  status = dtPerf->set(whe,
100  sta,
101  sec,
102  qua,
103  meanT0,
104  meanTtrig,
105  meanMtime,
106  meanNoise,
107  meanAfterPulse,
108  meanResolution,
109  meanEfficiency,
111  std::cout << whe << " " << sta << " " << sec << " " << qua << std::endl
112  << " === " << meanT0 << " " << meanTtrig << " " << meanMtime << " " << meanNoise << " " << meanAfterPulse
113  << " " << meanResolution << " " << meanEfficiency << std::endl
114  << " -> ";
115  std::cout << "insert status: " << status << std::endl;
116  }
117 
118  /*
119  unsigned int runf = irun;
120  unsigned int runl = 0xffffffff;
121  popcon::IOVPair iop = { runf, runl };
122  std::cout << "APPEND NEW OBJECT: "
123  << runf << " " << runl << " " << dtPerf << std::endl;
124  m_to_transfer->push_back( std::make_pair( dtPerf, iop ) );
125 */
126 
127  //for each payload provide IOV information (say in this case we use since)
128  cond::Time_t snc = runNumber;
129  if (runNumber > last)
130  m_to_transfer.push_back(std::make_pair(dtPerf, snc));
131  else
132  std::cout << "More recent data already present - skipped" << std::endl;
133 
134  return;
135 }
136 
std::string id() const override
DTPerformanceHandler(const edm::ParameterSet &ps)
cond::ValidityInterval lastInterval
Definition: Types.h:74
unsigned long long Time_t
Definition: Time.h:14
void getNewObjects() override
int set(int wheelId, int stationId, int sectorId, int slId, float meanT0, float meanTtrig, float meanMtime, float meanNoise, float meanAfterPulse, float meanResolution, float meanEfficiency, DTTimeUnits::type unit)