CMS 3D CMS Logo

DTT0Handler.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:49 $
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 //----------------
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  std::cout << "last: " << last << std::endl;
55 
56  //to access the information on last successful log entry for this tag:
57 // cond::LogDBEntry const & lde = logDBEntry();
58 
59  //to access the lastest payload (Ref is a smart pointer)
60 // Ref payload = lastPayload();
61 
62 /*
63  int irun = event.id().run();
64  int ievt = event.id().event();
65  std::cout << "================ "
66  << irun << " " << ievt << std::endl;
67 
68  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
69  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
70  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
71  std::cout << "list of all tags: " << std::endl;
72  while ( iter != iend ) {
73  std::cout << "Tag: " << iter->first
74  << " , last object valid since " << iter->second.last_since
75  << " to " << iter->second.last_till
76  << std::endl;
77  iter++;
78  }
79 
80  std::cout << "look for tag " << dataTag << std::endl;
81  std::map<std::string, popcon::PayloadIOV>::iterator itag =
82  mp.find( dataTag );
83 */
84 
85  DTT0* t0 = new DTT0( dataTag );
86 
87  int status = 0;
88  std::ifstream ifile( fileName.c_str() );
89  int whe;
90  int sta;
91  int sec;
92  int qua;
93  int lay;
94  int cel;
95  float t0mean;
96  float t0rms;
97  while ( ifile >> whe
98  >> sta
99  >> sec
100  >> qua
101  >> lay
102  >> cel
103  >> t0mean
104  >> t0rms ) {
105  status = t0->set( whe, sta, sec, qua, lay, cel, t0mean, t0rms,
107  std::cout << whe << " "
108  << sta << " "
109  << sec << " "
110  << qua << " "
111  << lay << " "
112  << cel << " "
113  << t0mean << " "
114  << t0rms << " -> ";
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 << " " << t0 << std::endl;
124  m_to_transfer->push_back( std::make_pair( t0, 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( t0, snc ) );
131  else
132  std::cout << "More recent data already present - skipped" << std::endl;
133 
134  return;
135 
136 }
137 
138 
140  return dataTag;
141 }
142 
143 
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:140
unsigned int runNumber
Definition: DTT0Handler.h:57
std::string dataTag
Definition: DTT0Handler.h:55
std::string id() const
Definition: DTT0Handler.cc:139
DTT0Handler(const edm::ParameterSet &ps)
Definition: DTT0Handler.cc:34
void getNewObjects()
Definition: DTT0Handler.cc:49
Definition: DTT0.h:53
cond::ValidityInterval lastInterval
Definition: Types.h:75
unsigned long long Time_t
Definition: Time.h:16
virtual ~DTT0Handler()
Definition: DTT0Handler.cc:43
std::string fileName
Definition: DTT0Handler.h:56
cond::TagInfo_t const & tagInfo() const