CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
popcon::EcalLaser_weekly_Handler Class Reference

#include <EcalLaser_weekly_Handler.h>

Inheritance diagram for popcon::EcalLaser_weekly_Handler:
popcon::PopConSourceHandler< EcalLaserAPDPNRatios >

Public Member Functions

 EcalLaser_weekly_Handler (edm::ParameterSet const &)
 
void getNewObjects () override
 
std::string id () const override
 
 ~EcalLaser_weekly_Handler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry_t const & logDBEntry () const
 
std::pair< Container const *, std::string const > operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry_t const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Private Types

enum  { kEBChannels = 61200, kEBEta = 85, kEEChannels = 14648 }
 

Private Attributes

std::string m_name
 
const EcalLaserAPDPNRatiosmyapdpns
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
typedef std::map< Time_t, std::shared_ptr< EcalLaserAPDPNRatios > > Container
 
typedef std::unique_ptr< EcalLaserAPDPNRatiosRef
 
typedef PopConSourceHandler< EcalLaserAPDPNRatiosself
 
typedef cond::Time_t Time_t
 
typedef EcalLaserAPDPNRatios value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
Container m_iovs
 
std::vector< std::pair< EcalLaserAPDPNRatios *, Time_t > > m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 51 of file EcalLaser_weekly_Handler.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ ~EcalLaser_weekly_Handler()

popcon::EcalLaser_weekly_Handler::~EcalLaser_weekly_Handler ( )
override

Definition at line 19 of file EcalLaser_weekly_Handler.cc.

19  {
20  // do nothing
21 }

◆ EcalLaser_weekly_Handler()

popcon::EcalLaser_weekly_Handler::EcalLaser_weekly_Handler ( edm::ParameterSet const &  ps)

Definition at line 13 of file EcalLaser_weekly_Handler.cc.

References gather_cfg::cout.

14  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalLaser_weekly_Handler")) {
15  // wrongBy = ps.getUntrackedParameter<double>("WrongBy",1.0);
16  std::cout << "EcalLaser Source handler constructor\n" << std::endl;
17 }

Member Function Documentation

◆ getNewObjects()

void popcon::EcalLaser_weekly_Handler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< EcalLaserAPDPNRatios >.

Definition at line 23 of file EcalLaser_weekly_Handler.cc.

References Tm::cmsNanoSeconds(), alignCSCRings::corr, gather_cfg::cout, beamvalidation::exit(), alignmentValidation::fname, mps_fire::i, kEBChannels, kEEChannels, jetsAK4_Puppi_cff::payload, nano_mu_digi_cff::rawId, writedatasetfile::run, EcalCondObjectContainer< T >::size(), command_line::start, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, RandomServiceHelper::t1, RandomServiceHelper::t2, RandomServiceHelper::t3, dumpRecoGeometry_cfg::tagInfo, cond::timestamp, EBDetId::unhashIndex(), EEDetId::unhashIndex(), and edm::Timestamp::value().

23  {
24  // uint64_t iov[1] = {5726925116361670656};
25  // int file[1] = {190111};
26  // int file[1] = {190708};
27  const size_t nLmes = 92;
28  // cond::Time_t iovStart = 0;
29  uint64_t t1, t2, t3;
30 
31  int iIov = 0;
32 
33  std::cout << "------- Ecal -> getNewObjects\n";
34 
35  unsigned long long max_since = 1;
37 
38  // here popcon tells us which is the last since of the last object in the
39  // offline DB
40  max_since = tagInfo().lastInterval.since;
41  // Tm max_since_tm((max_since >> 32)*1000000);
42  Tm max_since_tm(max_since);
43  // get the last object in the orcoff
44  edm::Timestamp t_min = edm::Timestamp(18446744073709551615ULL);
45 
46  const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap = payload->getLaserMap();
47  std::cout << "payload->getLaserMap(): OK " << std::endl;
48  std::cout << "Its size is " << laserRatiosMap.size() << std::endl;
49  const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap = payload->getTimeMap();
50  std::cout << "payload->getTimeMap(): OK " << std::endl;
51  std::cout << "Last Object in Offline DB has SINCE = " << max_since << " -> " << max_since_tm.cmsNanoSeconds() << " ("
52  << max_since_tm << ")"
53  << " and SIZE = " << tagInfo().size << std::endl;
54  // loop through light modules and determine the minimum date among the
55  // available channels
56  for (int i = 0; i < 92; i++) {
58  if (t_min > timestamp.t1) {
59  t_min = timestamp.t1;
60  }
61  }
62 
63  std::cout << "WOW: we just retrieved the last valid record from DB " << std::endl;
64  //std::cout <<"Its tmin is "<< Tm((t_min.value() >> 32)*1000000)
65  std::cout << "Its tmin is " << Tm(t_min.value()) << std::endl;
66 
67  // for(int week = 0; week < 1; week++) {
69 
71  int fileIOV;
72  std::cout << " which input IOV do you want " << std::endl;
73  std::cin >> fileIOV;
74  std::ifstream fWeek;
75  std::ostringstream oss;
76  oss << fileIOV;
77  std::string fname = "../../../Tools/DBDump/bin/weekly_" + oss.str();
78  fWeek.open(fname.c_str());
79  if (!fWeek.is_open()) {
80  std::cout << "ERROR : can't open file 'weekly_" << oss.str() << std::endl;
81  exit(-1);
82  }
83  std::cout << " file weekly_" << oss.str() << " opened" << std::endl;
84 
85  // find the timestamp for this run
86  std::ifstream fRunStartTime;
87  fRunStartTime.open("RunStartTime");
88  if (!fRunStartTime.is_open()) {
89  std::cout << "ERROR : cannot open file RunStartTime" << std::endl;
90  exit(1);
91  }
92  uint64_t iov = 0;
93  while (!fRunStartTime.eof()) {
94  int run;
96  fRunStartTime >> run >> start;
97  if (run == fileIOV) {
98  iov = start;
99  std::cout << "run " << run << " timestamp " << start << "\n";
100  break;
101  } else if (run == fileIOV) {
102  std::cout << " run " << fileIOV << " not found in RunStartTime. Let us give up" << std::endl;
103  exit(-1);
104  }
105  }
106  fRunStartTime.close();
108 
109  t1 = iov;
110  // t3 = t1 + 2597596220620800; // 1 week << 32
111  t3 = t1 + 7792788661862400; // 3 weeks << 32
112  t2 = t1 + (t3 - t1) / 2;
113  // iovStart = t1;
114  for (size_t i = 0; i < nLmes; ++i) {
115  t.t1 = edm::Timestamp(t1);
116  t.t2 = edm::Timestamp(t2);
117  t.t3 = edm::Timestamp(t3);
118  corrSet->setTime(i, t);
119  }
120 
121  int rawId;
122  float corrp;
123  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
124  EBDetId ebId = EBDetId::unhashIndex(iChannel);
125  fWeek >> rawId >> corrp;
126  corr.p1 = corr.p2 = corr.p3 = corrp;
127  corrSet->setValue((int)ebId, corr);
128  }
129  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
130  EEDetId eeId = EEDetId::unhashIndex(iChannel);
131  fWeek >> rawId >> corrp;
132  corr.p1 = corr.p2 = corr.p3 = corrp;
133  corrSet->setValue((int)eeId, corr);
134  }
135  fWeek.close();
136 
137  std::cout << "Write IOV " << iIov << " starting from " << fileIOV << "... " << std::endl;
138  // db_->writeOne(corrSet, iovStart, "EcalLaserAPDPNRatiosRcd");
139  m_to_transfer.push_back(std::make_pair(corrSet, fileIOV));
140  iIov++;
141  // } // end loop over week
142  std::cout << "Ecal -> end of getNewObjects -----------\n";
143 }
Definition: start.py:1
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
size_t size
Definition: Types.h:74
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
dictionary corr
std::vector< std::pair< EcalLaserAPDPNRatios *, Time_t > > m_to_transfer
unsigned long long uint64_t
Definition: Time.h:13
TimeValue_t value() const
Definition: Timestamp.h:38
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
string fname
main script
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
std::unique_ptr< EcalLaserAPDPNRatios > Ref
Definition: Tm.h:13
def exit(msg="")

◆ id()

std::string popcon::EcalLaser_weekly_Handler::id ( ) const
inlineoverridevirtual

Member Data Documentation

◆ m_name

std::string popcon::EcalLaser_weekly_Handler::m_name
private

Definition at line 62 of file EcalLaser_weekly_Handler.h.

Referenced by id().

◆ myapdpns

const EcalLaserAPDPNRatios* popcon::EcalLaser_weekly_Handler::myapdpns
private

Definition at line 61 of file EcalLaser_weekly_Handler.h.