CMS 3D CMS Logo

DTReadOutMappingHandler.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2007/12/07 15:13:50 $
5  * $Revision: 1.2 $
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  std::string robMap( dataTag );
85  std::string rosMap( dataTag );
86  robMap += "_ROB";
87  rosMap += "_ROS";
88  DTReadOutMapping* ro_map = new DTReadOutMapping( robMap, rosMap );
89 
90  int status = 0;
91  std::ifstream ifile( fileName.c_str() );
92  int ddu;
93  int ros;
94  int rob;
95  int tdc;
96  int cha;
97  int whe;
98  int sta;
99  int sec;
100  int qua;
101  int lay;
102  int cel;
103  while ( ifile >> ddu
104  >> ros
105  >> rob
106  >> tdc
107  >> cha
108  >> whe
109  >> sta
110  >> sec
111  >> qua
112  >> lay
113  >> cel ) {
114  status = ro_map->insertReadOutGeometryLink( ddu, ros, rob, tdc, cha,
115  whe, sta, sec,
116  qua, lay, cel );
117  std::cout << ddu << " "
118  << ros << " "
119  << rob << " "
120  << tdc << " "
121  << cha << " "
122  << whe << " "
123  << sta << " "
124  << sec << " "
125  << qua << " "
126  << lay << " "
127  << cel << " -> ";
128  std::cout << "insert status: " << status << std::endl;
129  }
130 
131 /*
132  unsigned int runf = irun;
133  unsigned int runl = 0xffffffff;
134  popcon::IOVPair iop = { runf, runl };
135  std::cout << "APPEND NEW OBJECT: "
136  << runf << " " << runl << " " << ro_map << std::endl;
137  m_to_transfer->push_back( std::make_pair( ro_map, iop ) );
138 */
139 
140  //for each payload provide IOV information (say in this case we use since)
141  cond::Time_t snc = runNumber;
142  if ( runNumber > last )
143  m_to_transfer.push_back( std::make_pair( ro_map, snc ) );
144  else
145  std::cout << "More recent data already present - skipped" << std::endl;
146 
147  return;
148 
149 }
150 
151 
153  return dataTag;
154 }
155 
156 
cond::ValidityInterval lastInterval
Definition: Types.h:75
unsigned long long Time_t
Definition: Time.h:16
std::string id() const override
DTReadOutMappingHandler(const edm::ParameterSet &ps)
int insertReadOutGeometryLink(int dduId, int rosId, int robId, int tdcId, int channelId, int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId)
insert connection