CMS 3D CMS Logo

DTTPGParametersHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2009/01/27 12:08:40 $
5  * $Revision: 1.1.2.1 $
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  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
64  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
65  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
66  std::cout << "list of all tags: " << std::endl;
67  while ( iter != iend ) {
68  std::cout << "Tag: " << iter->first
69  << " , last object valid since " << iter->second.last_since
70  << " to " << iter->second.last_till
71  << std::endl;
72  iter++;
73  }
74 
75  std::cout << "look for tag " << dataTag << std::endl;
76  std::map<std::string, popcon::PayloadIOV>::iterator itag =
77  mp.find( dataTag );
78 */
79 
81 
82  int status = 0;
83  std::ifstream ifile(fileName.c_str());
84  // int cx = 32;
85  // ifile >> cx;
86  // tSync->setClock( cx );
87  int whe;
88  int sta;
89  int sec;
90  int cl;
91  float ph;
92  while (ifile >> whe >> sta >> sec >> cl >> ph) {
93  status = tSync->set(whe, sta, sec, cl, ph, DTTimeUnits::ns);
94  std::cout << whe << " " << sta << " " << sec << " " << cl << " " << ph << " -> ";
95  std::cout << "insert status: " << status << std::endl;
96  }
97 
98  /*
99  unsigned int runf = irun;
100  unsigned int runl = 0xffffffff;
101  popcon::IOVPair iop = { runf, runl };
102  std::cout << "APPEND NEW OBJECT: "
103  << runf << " " << runl << " " << tSync << std::endl;
104  m_to_transfer->push_back( std::make_pair( tSync, iop ) );
105 */
106 
107  //for each payload provide IOV information (say in this case we use since)
108  cond::Time_t snc = runNumber;
109  if (runNumber > last)
110  m_to_transfer.push_back(std::make_pair(tSync, snc));
111  else {
112  std::cout << "More recent data already present - skipped" << std::endl;
113  delete tSync;
114  }
115 
116  return;
117 }
118 
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
DTTPGParametersHandler(const edm::ParameterSet &ps)
cond::ValidityInterval lastInterval
Definition: Types.h:74
unsigned long long Time_t
Definition: Time.h:14
std::string id() const override