CMS 3D CMS Logo

DTDeadFlagHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2009/09/16 11:00:18 $
5  * $Revision: 1.3.14.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_t const& ti = tagInfo();
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 
80  auto dFlag = std::make_unique<DTDeadFlag>(dataTag);
81 
82  int status = 0;
83  std::ifstream ifile(fileName.c_str());
84  int whe;
85  int sta;
86  int sec;
87  int qua;
88  int lay;
89  int cel;
90  int hv;
91  int tp;
92  int ro;
93  int dc;
94  while (ifile >> whe >> sta >> sec >> qua >> lay >> cel >> hv >> tp >> ro >> dc) {
95  status = dFlag->set(whe, sta, sec, qua, lay, cel, hv != 0, tp != 0, ro != 0, dc != 0);
96  std::cout << whe << " " << sta << " " << sec << " " << qua << " " << lay << " " << cel << " " << hv << " " << tp
97  << " " << ro << " " << dc << " -> ";
98  std::cout << "insert status: " << status << std::endl;
99  }
100 
101  /*
102  unsigned int runf = irun;
103  unsigned int runl = 0xffffffff;
104  popcon::IOVPair iop = { runf, runl };
105  std::cout << "APPEND NEW OBJECT: "
106  << runf << " " << runl << " " << dFlag << std::endl;
107  m_to_transfer->push_back( std::make_pair( dFlag, iop ) );
108 */
109 
110  //for each payload provide IOV information (say in this case we use since)
111  cond::Time_t snc = runNumber;
112  if (runNumber > last)
113  m_to_transfer.push_back(std::make_pair(dFlag.release(), snc));
114  else
115  std::cout << "More recent data already present - skipped" << std::endl;
116 
117  return;
118 }
119 
DTDeadFlagHandler::getNewObjects
void getNewObjects() override
Definition: DTDeadFlagHandler.cc:46
popcon::PopConSourceHandler< DTDeadFlag >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
mps_update.status
status
Definition: mps_update.py:69
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTDeadFlag.h
DTDeadFlagHandler::~DTDeadFlagHandler
~DTDeadFlagHandler() override
Definition: DTDeadFlagHandler.cc:41
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
convertSQLiteXML.runNumber
runNumber
Definition: convertSQLiteXML.py:91
DTDeadFlagHandler::id
std::string id() const override
Definition: DTDeadFlagHandler.cc:120
dqmdumpme.last
last
Definition: dqmdumpme.py:56
DTDeadFlagHandler::runNumber
unsigned int runNumber
Definition: DTDeadFlagHandler.h:53
DTDeadFlagHandler::dataTag
std::string dataTag
Definition: DTDeadFlagHandler.h:51
compare_using_db.ifile
ifile
Definition: compare_using_db.py:251
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTDeadFlagHandler::fileName
std::string fileName
Definition: DTDeadFlagHandler.h:52
DTDeadFlagHandler::DTDeadFlagHandler
DTDeadFlagHandler(const edm::ParameterSet &ps)
Definition: DTDeadFlagHandler.cc:33
edm::ParameterSet
Definition: ParameterSet.h:36
popcon::PopConSourceHandler< DTDeadFlag >::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
cond::Iov_t::since
Time_t since
Definition: Types.h:53
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
DTDeadFlagHandler.h
createfilelist.int
int
Definition: createfilelist.py:10
fileinputsource_cfi.sec
sec
Definition: fileinputsource_cfi.py:87
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
std
Definition: JetResolutionObject.h:76
gctErrorAnalyzer_cfi.dataTag
dataTag
Definition: gctErrorAnalyzer_cfi.py:28
cond::TagInfo_t
Definition: Types.h:69