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 //----------------
32 // Constructors --
33 //----------------
35  dataTag( ps.getParameter<std::string> ( "tag" ) ),
36  fileName( ps.getParameter<std::string> ( "file" ) ),
37  runNumber( ps.getParameter<unsigned int> ( "run" ) ) {
38 }
39 
40 //--------------
41 // Destructor --
42 //--------------
44 }
45 
46 //--------------
47 // Operations --
48 //--------------
50 
51  //to access the information on the tag inside the offline database:
52  cond::TagInfo const & ti = tagInfo();
53  unsigned int last = ti.lastInterval.first;
54 
55  //to access the information on last successful log entry for this tag:
56 // cond::LogDBEntry const & lde = logDBEntry();
57 
58  //to access the lastest payload (Ref is a smart pointer)
59 // Ref payload = lastPayload();
60 
61 /*
62  int irun = event.id().run();
63  int ievt = event.id().event();
64  std::cout << "================ "
65  << irun << " " << ievt << std::endl;
66 
67  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
68  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
69  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
70  std::cout << "list of all tags: " << std::endl;
71  while ( iter != iend ) {
72  std::cout << "Tag: " << iter->first
73  << " , last object valid since " << iter->second.last_since
74  << " to " << iter->second.last_till
75  << std::endl;
76  iter++;
77  }
78 
79  std::cout << "look for tag " << dataTag << std::endl;
80  std::map<std::string, popcon::PayloadIOV>::iterator itag =
81  mp.find( dataTag );
82 */
83 
84  DTDeadFlag* dFlag = new DTDeadFlag( dataTag );
85 
86  int status = 0;
87  std::ifstream ifile( fileName.c_str() );
88  int whe;
89  int sta;
90  int sec;
91  int qua;
92  int lay;
93  int cel;
94  int hv;
95  int tp;
96  int ro;
97  int dc;
98  while ( ifile >> whe
99  >> sta
100  >> sec
101  >> qua
102  >> lay
103  >> cel
104  >> hv
105  >> tp
106  >> ro
107  >> dc ) {
108  status = dFlag->set( whe, sta, sec, qua, lay, cel,
109  hv != 0, tp != 0, ro != 0, dc != 0 );
110  std::cout << whe << " "
111  << sta << " "
112  << sec << " "
113  << qua << " "
114  << lay << " "
115  << cel << " "
116  << hv << " "
117  << tp << " "
118  << ro << " "
119  << dc << " -> ";
120  std::cout << "insert status: " << status << std::endl;
121  }
122 
123 /*
124  unsigned int runf = irun;
125  unsigned int runl = 0xffffffff;
126  popcon::IOVPair iop = { runf, runl };
127  std::cout << "APPEND NEW OBJECT: "
128  << runf << " " << runl << " " << dFlag << std::endl;
129  m_to_transfer->push_back( std::make_pair( dFlag, iop ) );
130 */
131 
132  //for each payload provide IOV information (say in this case we use since)
133  cond::Time_t snc = runNumber;
134  if ( runNumber > last )
135  m_to_transfer.push_back( std::make_pair( dFlag, snc ) );
136  else
137  std::cout << "More recent data already present - skipped" << std::endl;
138 
139  return;
140 
141 }
142 
143 
145  return dataTag;
146 }
147 
148 
~DTDeadFlagHandler() override
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool dead_HV, bool dead_TP, bool dead_RO, bool discCat)
Definition: DTDeadFlag.cc:281
susybsm::HSCParticleRefVector hv
Definition: classes.h:28
cond::ValidityInterval lastInterval
Definition: Types.h:76
DTDeadFlagHandler(const edm::ParameterSet &ps)
unsigned long long Time_t
Definition: Time.h:16
unsigned int runNumber
std::string id() const override
void getNewObjects() override
cond::TagInfo_t const & tagInfo() const