test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Public Attributes | Private Attributes
RPCRunIOV Class Reference

#include <RPCRunIOV.h>

Classes

struct  chRAW
 
struct  RunIOV_Item
 

Public Member Functions

std::string chamberName (const chRAW &)
 
unsigned long long DAQtoUNIX (unsigned long long *)
 
std::vector< RPCObImon::I_ItemfilterIMON (const std::vector< RPCObImon::I_Item > &, unsigned long long, unsigned long long)
 
std::vector< RPCObImon::I_ItemgetImon ()
 
std::map< int, RPCObPVSSmap::ItemgetPVSSMap ()
 
std::vector< RPCObTemp::T_ItemgetTemp ()
 
std::vector< RPCObVmon::V_ItemgetVmon ()
 
bool isReadingNeeded (unsigned long long)
 
 RPCRunIOV ()
 
 RPCRunIOV ()
 
 RPCRunIOV (const edm::EventSetup &evtSetup)
 
unsigned long long toDAQ (unsigned long long)
 
unsigned long long toUNIX (int, int)
 
virtual ~RPCRunIOV ()
 
 ~RPCRunIOV ()
 

Public Attributes

unsigned long long max_I
 
unsigned long long max_T
 
unsigned long long max_V
 
unsigned long long min_I
 
unsigned long long min_T
 
unsigned long long min_V
 
std::vector< RunIOV_ItemObRunIOV_rpc
 

Private Attributes

const edm::EventSetupeventSetup
 
std::vector< RPCObImon::I_ItemfiltImon
 

Detailed Description

Definition at line 5 of file RPCRunIOV.h.

Constructor & Destructor Documentation

RPCRunIOV::RPCRunIOV ( )
inline

Definition at line 13 of file RPCRunIOV.h.

13 {}
RPCRunIOV::~RPCRunIOV ( )
inlinevirtual

Definition at line 14 of file RPCRunIOV.h.

14 {}
RPCRunIOV::RPCRunIOV ( )
RPCRunIOV::RPCRunIOV ( const edm::EventSetup evtSetup)

Definition at line 25 of file RPCRunIOV.cc.

References eventSetup.

26 {
27  eventSetup = &evtSetup;
28 }
const edm::EventSetup * eventSetup
Definition: RPCRunIOV.h:63
RPCRunIOV::~RPCRunIOV ( )

Member Function Documentation

std::string RPCRunIOV::chamberName ( const chRAW ch)

Definition at line 282 of file RPCRunIOV.cc.

References RPCRunIOV::chRAW::layer, RPCRunIOV::chRAW::region, RPCRunIOV::chRAW::ring, relativeConstraints::ring, RPCRunIOV::chRAW::sector, RPCRunIOV::chRAW::station, relativeConstraints::station, RPCRunIOV::chRAW::subsector, and toolbox::toString().

282  {
283 
284  using namespace std;
285  string chambername, sector, station, DP, ring;
286 
287  // BARREL
288  if (ch.region == 0) {
289  switch(ch.ring) {
290  case 2: chambername = "WP2";
291  case 1: chambername = "WP1";
292  case 0: chambername = "W00";
293  case -1: chambername = "WM1";
294  case -2: chambername = "WM2";
295  }
296  sector = toString (ch.sector);
297  station = toString (ch.station);
298  chambername += "_S"+sector+"_RB"+station;
299 
300  switch(ch.station) {
301  case 1:; case 2:
302  if (ch.subsector == 1) chambername += "minus";
303  if (ch.subsector == 2) chambername += "minus";
304  case 3:
305  if(ch.layer == 1)chambername += "in";
306  if(ch.layer == 2)chambername += "out";
307  case 4:
308  if(ch.sector != 9 && ch.sector != 11) {
309  if (ch.subsector == 1) chambername += "minusminus";
310  if (ch.subsector == 2) chambername += "minus";
311  if (ch.subsector == 3) chambername += "plus";
312  if (ch.subsector == 4) chambername += "plusplus";
313  } else {
314  if (ch.subsector == 1) chambername += "minus";
315  if (ch.subsector == 2) chambername += "minus";
316  }
317  }
318  }
319  // ENDCAP
320  else{
321  int DP_ = 6*(ch.sector-1)+ch.subsector;
322  DP = toString (DP_);
323  ring = toString (ch.ring);
324  station = toString (ch.station);
325  if (ch.region == 1) chambername += "DP";
326  if (ch.region == -1)chambername += "DM";
327  chambername += station+"_R"+ring+"_C"+DP;
328  }
329  return chambername;
330 }
std::string toString(const char *format,...)
Definition: xdaq_compat.cc:4
unsigned long long RPCRunIOV::DAQtoUNIX ( unsigned long long *  time)

Definition at line 218 of file RPCRunIOV.cc.

219 {
220  timeval *tmval=(timeval*)time;
221  unsigned long long int curVal=(tmval->tv_usec*1000000LL)+tmval->tv_sec;
222  return curVal;
223 }
std::vector< RPCObImon::I_Item > RPCRunIOV::filterIMON ( const std::vector< RPCObImon::I_Item > &  imon,
unsigned long long  since,
unsigned long long  till 
)

Definition at line 253 of file RPCRunIOV.cc.

References conv, gather_cfg::cout, util.getRunInfo::day(), filtImon, min(), LaserDQM_cfi::mon, gen::n, and RPCFw::TtoUT().

254 {
255 
256  std::cout << std::endl << "=============================================" << std::endl;
257  std::cout << std::endl << "============ FILTERING DATA ===========" << std::endl;
258  std::cout << std::endl << "=============================================" << std::endl << std::endl;
259  std::vector<RPCObImon::I_Item>::const_iterator it;
260  RPCFw conv ("","","");
261  int n = 0;
262  for ( it=imon.begin(); it < imon.end(); it++ ) {
263  n++;
264  int day = (int)it->day/10000;
265  int mon = (int)(it->day - day*10000)/100;
266  int yea = (int)(it->day - day*10000 - mon*100)+2000;
267  int hou = (int)it->time/10000;
268  int min = (int)(it->time - hou*10000)/100;
269  int sec = (int)(it->time - hou*10000 - min*100);
270  int nan = 0;
271  coral::TimeStamp timeD = coral::TimeStamp(yea, mon, day, hou, min, sec, nan);
272  unsigned long long timeU = conv.TtoUT(timeD);
273  if (timeU < till && timeU > since) filtImon.push_back(*it);
274  }
275  return filtImon;
276 }
static HepMC::IO_HEPEVT conv
Definition: RPCFw.h:32
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< RPCObImon::I_Item > filtImon
Definition: RPCRunIOV.h:64
tuple cout
Definition: gather_cfg.py:145
std::vector< RPCObImon::I_Item > RPCRunIOV::getImon ( )

Definition at line 33 of file RPCRunIOV.cc.

References gather_cfg::cout, eventSetup, plotBeamSpotDB::first, edm::EventSetup::get(), max_I, min_I, RPCObImon::ObImon_rpc, edm::ESHandle< class >::product(), toUNIX(), and relativeConstraints::value.

33  {
34 
36  eventSetup->get<RPCObImonRcd>().get(condRcd);
37 
38  std::cout << std::endl << "=============================================" << std::endl;
39  std::cout << std::endl << "=============== IMON READER ===============" << std::endl;
40  std::cout << std::endl << "=============================================" << std::endl << std::endl;
41 
42 
43  const RPCObImon* cond = condRcd.product();
44  std::vector<RPCObImon::I_Item> mycond = cond->ObImon_rpc;
45  std::vector<RPCObImon::I_Item>::iterator icond;
46 
47  std::cout << ">>> Object IMON" << std::endl;
48  std::cout << " size " << mycond.size() << std::endl;
49 
50  std::cout << std::endl << "=============================================" << std::endl << std::endl;
51 
52  if (mycond.size() == 0) {
53  min_I = 0;
54  max_I = 0;
55  return mycond;
56  }
57 
58  std::vector<RPCObImon::I_Item>::iterator first;
59  first = mycond.begin();
60  min_I = this->toUNIX(first->day, first->time);
61  max_I = min_I;
62  unsigned long long value;
63  for(icond = mycond.begin(); icond < mycond.end(); ++icond){
64  value = this->toUNIX(icond->day, icond->time);
65  if (value < min_I) min_I = value;
66  if (value > max_I) max_I = value;
67  }
68  return mycond;
69 }
unsigned long long max_I
Definition: RPCRunIOV.h:56
unsigned long long min_I
Definition: RPCRunIOV.h:55
unsigned long long toUNIX(int, int)
Definition: RPCRunIOV.cc:227
const edm::EventSetup * eventSetup
Definition: RPCRunIOV.h:63
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
std::vector< I_Item > ObImon_rpc
Definition: RPCObCond.h:27
tuple cout
Definition: gather_cfg.py:145
std::map< int, RPCObPVSSmap::Item > RPCRunIOV::getPVSSMap ( )

Definition at line 158 of file RPCRunIOV.cc.

References gather_cfg::cout, RPCObPVSSmap::Item::dpid, eventSetup, edm::EventSetup::get(), RPCObPVSSmap::Item::layer, RPCObPVSSmap::ObIDMap_rpc, edm::ESHandle< class >::product(), RPCObPVSSmap::Item::region, RPCObPVSSmap::Item::ring, RPCObPVSSmap::Item::sector, RPCObPVSSmap::Item::station, RPCObPVSSmap::Item::subsector, and RPCObPVSSmap::Item::suptype.

159 {
160 
162  eventSetup->get<RPCObPVSSmapRcd>().get(pvssRcd);
163 
164  std::cout << std::endl << "=============================================" << std::endl;
165  std::cout << std::endl << "=============== PVSS READER ===============" << std::endl;
166  std::cout << std::endl << "=============================================" << std::endl << std::endl;
167 
168  const RPCObPVSSmap* pvss = pvssRcd.product();
169  std::vector<RPCObPVSSmap::Item> mypvss = pvss->ObIDMap_rpc;
170  std::vector<RPCObPVSSmap::Item>::iterator ipvss;
171 
172  std::cout << ">>> Object PVSS" << std::endl;
173  std::cout << " size " << mypvss.size() << std::endl;
174 
175  RPCObPVSSmap::Item pvssItem={0,0,0,0,0,0,0,0,0};
176  int id;
177  std::map<int, RPCObPVSSmap::Item> pvssmap;
178  for(ipvss = mypvss.begin(); ipvss < mypvss.end(); ++ipvss){
179  id = ipvss->dpid;
180  pvssItem.region = ipvss->region;
181  pvssItem.ring = ipvss->ring;
182  pvssItem.station = ipvss->station;
183  pvssItem.sector = ipvss->sector;
184  pvssItem.layer = ipvss->layer;
185  pvssItem.subsector = ipvss->subsector;
186  pvssItem.suptype = ipvss->suptype;
187  pvssmap.insert ( std::pair<int, RPCObPVSSmap::Item>(id, pvssItem) );
188 
189  }
190 
191  std::cout << std::endl << "=============================================" << std::endl << std::endl;
192 
193  return pvssmap;
194 }
std::vector< Item > ObIDMap_rpc
Definition: RPCObPVSSmap.h:34
const edm::EventSetup * eventSetup
Definition: RPCRunIOV.h:63
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
tuple cout
Definition: gather_cfg.py:145
std::vector< RPCObTemp::T_Item > RPCRunIOV::getTemp ( )

Definition at line 115 of file RPCRunIOV.cc.

References gather_cfg::cout, eventSetup, plotBeamSpotDB::first, edm::EventSetup::get(), max_I, max_T, min_I, min_T, RPCObTemp::ObTemp_rpc, edm::ESHandle< class >::product(), toUNIX(), and relativeConstraints::value.

115  {
116 
117  edm::ESHandle<RPCObTemp> condRcd;
118  eventSetup->get<RPCObTempRcd>().get(condRcd);
119 
120  std::cout << std::endl << "=============================================" << std::endl;
121  std::cout << std::endl << "=============== TEMP READER ===============" << std::endl;
122  std::cout << std::endl << "=============================================" << std::endl << std::endl;
123 
124 
125  const RPCObTemp* cond = condRcd.product();
126  std::vector<RPCObTemp::T_Item> mycond = cond->ObTemp_rpc;
127  std::vector<RPCObTemp::T_Item>::iterator icond;
128 
129  std::cout << ">>> Object TEMPERATURE" << std::endl;
130  std::cout << " size " << mycond.size() << std::endl;
131 
132  std::cout << std::endl << "=============================================" << std::endl << std::endl;
133 
134  if (mycond.size() == 0) {
135  min_I = 0;
136  max_I = 0;
137  return mycond;
138  }
139 
140  std::vector<RPCObTemp::T_Item>::iterator first;
141  first = mycond.begin();
142  min_T = this->toUNIX(first->day, first->time);
143  max_T = min_T;
144  unsigned long long value;
145  for(icond = mycond.begin(); icond < mycond.end(); ++icond){
146  value = this->toUNIX(icond->day, icond->time);
147  if (value < min_T) min_T = value;
148  if (value > max_T) max_T = value;
149  }
150  return mycond;
151 }
std::vector< T_Item > ObTemp_rpc
Definition: RPCObCond.h:78
unsigned long long max_I
Definition: RPCRunIOV.h:56
unsigned long long min_I
Definition: RPCRunIOV.h:55
unsigned long long max_T
Definition: RPCRunIOV.h:60
unsigned long long min_T
Definition: RPCRunIOV.h:59
unsigned long long toUNIX(int, int)
Definition: RPCRunIOV.cc:227
const edm::EventSetup * eventSetup
Definition: RPCRunIOV.h:63
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
tuple cout
Definition: gather_cfg.py:145
std::vector< RPCObVmon::V_Item > RPCRunIOV::getVmon ( )

Definition at line 74 of file RPCRunIOV.cc.

References gather_cfg::cout, eventSetup, plotBeamSpotDB::first, edm::EventSetup::get(), max_I, max_V, min_I, min_V, RPCObVmon::ObVmon_rpc, edm::ESHandle< class >::product(), toUNIX(), and relativeConstraints::value.

74  {
75 
77  eventSetup->get<RPCObVmonRcd>().get(condRcd);
78 
79  std::cout << std::endl << "=============================================" << std::endl;
80  std::cout << std::endl << "=============== VMON READER ===============" << std::endl;
81  std::cout << std::endl << "=============================================" << std::endl << std::endl;
82 
83 
84  const RPCObVmon* cond = condRcd.product();
85  std::vector<RPCObVmon::V_Item> mycond = cond->ObVmon_rpc;
86  std::vector<RPCObVmon::V_Item>::iterator icond;
87 
88  std::cout << ">>> Object VMON" << std::endl;
89  std::cout << " size " << mycond.size() << std::endl;
90 
91  std::cout << std::endl << "=============================================" << std::endl << std::endl;
92 
93  if (mycond.size() == 0) {
94  min_I = 0;
95  max_I = 0;
96  return mycond;
97  }
98 
99  std::vector<RPCObVmon::V_Item>::iterator first;
100  first = mycond.begin();
101  min_V = this->toUNIX(first->day, first->time);
102  max_V = min_I;
103  unsigned long long value;
104  for(icond = mycond.begin(); icond < mycond.end(); ++icond){
105  value = this->toUNIX(icond->day, icond->time);
106  if (value < min_V) min_V = value;
107  if (value > max_V) max_V = value;
108  }
109  return mycond;
110 }
unsigned long long max_I
Definition: RPCRunIOV.h:56
unsigned long long min_I
Definition: RPCRunIOV.h:55
std::vector< V_Item > ObVmon_rpc
Definition: RPCObCond.h:44
unsigned long long toUNIX(int, int)
Definition: RPCRunIOV.cc:227
const edm::EventSetup * eventSetup
Definition: RPCRunIOV.h:63
unsigned long long max_V
Definition: RPCRunIOV.h:58
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
tuple cout
Definition: gather_cfg.py:145
unsigned long long min_V
Definition: RPCRunIOV.h:57
bool RPCRunIOV::isReadingNeeded ( unsigned long  long)
unsigned long long RPCRunIOV::toDAQ ( unsigned long long  timeU)

Definition at line 202 of file RPCRunIOV.cc.

References edm::Timestamp::value().

203 {
204  ::timeval tv;
205  tv.tv_sec = timeU;
206  tv.tv_usec = 0;
207  edm::TimeValue_t daqtime=0LL;
208  daqtime=tv.tv_sec;
209  daqtime=(daqtime<<32)+tv.tv_usec;
210  edm::Timestamp daqstamp(daqtime);
211  edm::TimeValue_t dtime_ = daqstamp.value();
212  unsigned long long dtime = dtime_;
213  return dtime;
214 }
unsigned long long TimeValue_t
Definition: Timestamp.h:28
TimeValue_t value() const
Definition: Timestamp.h:56
unsigned long long RPCRunIOV::toUNIX ( int  date,
int  time 
)

Definition at line 227 of file RPCRunIOV.cc.

References conv, util.getRunInfo::day(), min(), LaserDQM_cfi::mon, and RPCFw::TtoUT().

Referenced by getImon(), getTemp(), and getVmon().

228 {
229  int yea_ = (int)date/100;
230  int yea = 2000 + (date - yea_*100);
231  int mon_ = (int)yea_/100;
232  int mon = yea_ - mon_*100;
233  int day = (int)yea_/100;
234  int sec_ = (int)time/100;
235  int sec = time - sec_*100;
236  int min_ = (int)sec_/100;
237  int min = sec_ - min_*100;
238  int hou = (int)sec_/100;
239  int nan = 0;
240  coral::TimeStamp TS;
241  TS = coral::TimeStamp(yea, mon, day, hou, min, sec, nan);
242  RPCFw conv ("","","");
243  unsigned long long UT = conv.TtoUT(TS);
244  return UT;
245 }
static HepMC::IO_HEPEVT conv
Definition: RPCFw.h:32
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

const edm::EventSetup* RPCRunIOV::eventSetup
private

Definition at line 63 of file RPCRunIOV.h.

Referenced by getImon(), getPVSSMap(), getTemp(), getVmon(), and RPCRunIOV().

std::vector<RPCObImon::I_Item> RPCRunIOV::filtImon
private

Definition at line 64 of file RPCRunIOV.h.

Referenced by filterIMON().

unsigned long long RPCRunIOV::max_I

Definition at line 56 of file RPCRunIOV.h.

Referenced by getImon(), getTemp(), and getVmon().

unsigned long long RPCRunIOV::max_T

Definition at line 60 of file RPCRunIOV.h.

Referenced by getTemp().

unsigned long long RPCRunIOV::max_V

Definition at line 58 of file RPCRunIOV.h.

Referenced by getVmon().

unsigned long long RPCRunIOV::min_I

Definition at line 55 of file RPCRunIOV.h.

Referenced by getImon(), getTemp(), and getVmon().

unsigned long long RPCRunIOV::min_T

Definition at line 59 of file RPCRunIOV.h.

Referenced by getTemp().

unsigned long long RPCRunIOV::min_V

Definition at line 57 of file RPCRunIOV.h.

Referenced by getVmon().

std::vector<RunIOV_Item> RPCRunIOV::ObRunIOV_rpc

Definition at line 15 of file RPCRunIOV.h.