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 convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
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 ()
 
void sort ()
 
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::vector< Triplet > Container
 
typedef std::vector< std::pair< EcalLaserAPDPNRatios *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< EcalLaserAPDPNRatiosself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef EcalLaserAPDPNRatios value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< EcalLaserAPDPNRatios >
OldContainer 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
Enumerator
kEBChannels 
kEBEta 
kEEChannels 

Definition at line 60 of file EcalLaser_weekly_Handler.h.

60 { kEBChannels = 61200, kEBEta = 85, kEEChannels = 14648 };

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.

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 }

References gather_cfg::cout.

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.

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 }

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

◆ id()

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

Implements popcon::PopConSourceHandler< EcalLaserAPDPNRatios >.

Definition at line 57 of file EcalLaser_weekly_Handler.h.

57 { return m_name; }

References m_name.

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.

RandomServiceHelper.t2
t2
Definition: RandomServiceHelper.py:257
mps_fire.i
i
Definition: mps_fire.py:355
start
Definition: start.py:1
popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
EBDetId
Definition: EBDetId.h:17
EEDetId::unhashIndex
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
gather_cfg.cout
cout
Definition: gather_cfg.py:144
EBDetId::unhashIndex
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
edm::Timestamp::value
TimeValue_t value() const
Definition: Timestamp.h:45
EcalCondObjectContainer::size
size_t size() const
Definition: EcalCondObjectContainer.h:82
EcalCondObjectContainer< EcalLaserAPDPNpair >
popcon::EcalLaser_weekly_Handler::kEBEta
Definition: EcalLaser_weekly_Handler.h:60
cond::timestamp
Definition: Time.h:19
popcon::EcalLaser_weekly_Handler::kEEChannels
Definition: EcalLaser_weekly_Handler.h:60
RandomServiceHelper.t1
t1
Definition: RandomServiceHelper.py:256
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
popcon::EcalLaser_weekly_Handler::kEBChannels
Definition: EcalLaser_weekly_Handler.h:60
popcon::EcalLaser_weekly_Handler::m_name
std::string m_name
Definition: EcalLaser_weekly_Handler.h:62
jets_cff.payload
payload
Definition: jets_cff.py:34
OrderedSet.t
t
Definition: OrderedSet.py:90
RandomServiceHelper.t3
t3
Definition: RandomServiceHelper.py:258
Tm
Definition: Tm.h:13
EEDetId
Definition: EEDetId.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EcalLaserAPDPNRatios::EcalLaserAPDPNpair
Definition: EcalLaserAPDPNRatios.h:16
popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
cond::Iov_t::since
Time_t since
Definition: Types.h:53
EcalLaserAPDPNRatios::EcalLaserTimeStampMap
std::vector< EcalLaserTimeStamp > EcalLaserTimeStampMap
Definition: EcalLaserAPDPNRatios.h:34
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
writedatasetfile.run
run
Definition: writedatasetfile.py:27
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::lastPayload
Ref lastPayload() const
Definition: PopConSourceHandler.h:81
cond::uint64_t
unsigned long long uint64_t
Definition: Time.h:13
beamvalidation.exit
def exit(msg="")
Definition: beamvalidation.py:53
EcalLaserAPDPNRatios
Definition: EcalLaserAPDPNRatios.h:14
command_line.start
start
Definition: command_line.py:167
EcalLaserAPDPNRatios::EcalLaserTimeStamp
Definition: EcalLaserAPDPNRatios.h:24
cond::TagInfo_t::size
size_t size
Definition: Types.h:74
edm::Timestamp
Definition: Timestamp.h:30