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 55 of file EcalLaser_weekly_Handler.h.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

popcon::EcalLaser_weekly_Handler::~EcalLaser_weekly_Handler ( )
override

Definition at line 19 of file EcalLaser_weekly_Handler.cc.

19  {
20  // do nothing
21 }
popcon::EcalLaser_weekly_Handler::EcalLaser_weekly_Handler ( edm::ParameterSet const &  )

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

void popcon::EcalLaser_weekly_Handler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< EcalLaserAPDPNRatios >.

Definition at line 23 of file EcalLaser_weekly_Handler.cc.

References Tm::cmsNanoSeconds(), corr, gather_cfg::cout, cmsRelvalreport::exit, alignmentValidation::fname, mps_fire::i, kEBChannels, kEEChannels, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::lastPayload(), popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::m_to_transfer, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p1, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p2, EcalLaserAPDPNRatios::EcalLaserAPDPNpair::p3, jets_cff::payload, findQualityFiles::run, cond::TagInfo_t::size, EcalCondObjectContainer< T >::size(), command_line::start, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t1, reco::t2, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t2, EcalLaserAPDPNRatios::EcalLaserTimeStamp::t3, popcon::PopConSourceHandler< EcalLaserAPDPNRatios >::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 
36  unsigned long long max_since= 1;
38 
39  // here popcon tells us which is the last since of the last object in the
40  // offline DB
41  max_since=tagInfo().lastInterval.first;
42  // Tm max_since_tm((max_since >> 32)*1000000);
43  Tm max_since_tm(max_since);
44  // get the last object in the orcoff
45  edm::Timestamp t_min= edm::Timestamp(18446744073709551615ULL);
46 
47  const EcalLaserAPDPNRatios::EcalLaserAPDPNRatiosMap& laserRatiosMap =
48  payload->getLaserMap();
49  std::cout << "payload->getLaserMap(): OK " << std::endl;
50  std::cout << "Its size is " << laserRatiosMap.size() << std::endl;
51  const EcalLaserAPDPNRatios::EcalLaserTimeStampMap& laserTimeMap =
52  payload->getTimeMap();
53  std::cout << "payload->getTimeMap(): OK " << std::endl;
54  std::cout << "Last Object in Offline DB has SINCE = " << max_since
55  << " -> " << max_since_tm.cmsNanoSeconds()
56  << " (" << max_since_tm << ")"
57  << " and SIZE = " << tagInfo().size
58  << std::endl;
59  // loop through light modules and determine the minimum date among the
60  // available channels
61  for (int i=0; i<92; i++) {
63  if( t_min > timestamp.t1) {
64  t_min=timestamp.t1;
65  }
66  }
67 
68  std::cout <<"WOW: we just retrieved the last valid record from DB "
69  << std::endl;
70  //std::cout <<"Its tmin is "<< Tm((t_min.value() >> 32)*1000000)
71  std::cout <<"Its tmin is "<< Tm(t_min.value()) << std::endl;
72 
73  // for(int week = 0; week < 1; week++) {
75 
77  int fileIOV;
78  std::cout << " which input IOV do you want " << std::endl;
79  std::cin >> fileIOV;
80  std::ifstream fWeek;
81  std::ostringstream oss;
82  oss << fileIOV;
83  std::string fname = "../../../Tools/DBDump/bin/weekly_" + oss.str();
84  fWeek.open(fname.c_str());
85  if(!fWeek.is_open()) {
86  std::cout << "ERROR : can't open file 'weekly_" << oss.str() << std::endl;
87  exit(-1);
88  }
89  std::cout << " file weekly_" << oss.str() << " opened" << std::endl;
90 
91  // find the timestamp for this run
92  std::ifstream fRunStartTime;
93  fRunStartTime.open("RunStartTime");
94  if(!fRunStartTime.is_open()) {
95  std::cout << "ERROR : cannot open file RunStartTime" << std::endl;
96  exit (1);
97  }
98  uint64_t iov = 0;
99  while(!fRunStartTime.eof()) {
100  int run;
101  uint64_t start;
102  fRunStartTime >> run >> start;
103  if(run == fileIOV) {
104  iov = start;
105  std::cout << "run " << run << " timestamp " << start << "\n";
106  break;
107  }
108  else if (run == fileIOV) {
109  std::cout << " run " << fileIOV << " not found in RunStartTime. Let us give up" << std::endl;
110  exit(-1);
111  }
112  }
113  fRunStartTime.close();
115 
116  t1 = iov;
117  // t3 = t1 + 2597596220620800; // 1 week << 32
118  t3 = t1 + 7792788661862400; // 3 weeks << 32
119  t2 = t1 + (t3 - t1)/2;
120  // iovStart = t1;
121  for(size_t i = 0; i < nLmes; ++i){
122  t.t1 = edm::Timestamp(t1);
123  t.t2 = edm::Timestamp(t2);
124  t.t3 = edm::Timestamp(t3);
125  corrSet->setTime(i, t);
126  }
127 
128  int rawId;
129  float corrp;
130  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
131  EBDetId ebId = EBDetId::unhashIndex(iChannel);
132  fWeek >> rawId >> corrp;
133  corr.p1=corr.p2=corr.p3 = corrp;
134  corrSet->setValue((int)ebId, corr );
135  }
136  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
137  EEDetId eeId = EEDetId::unhashIndex(iChannel);
138  fWeek >> rawId >> corrp;
139  corr.p1=corr.p2=corr.p3 = corrp;
140  corrSet->setValue((int)eeId, corr );
141  }
142  fWeek.close();
143 
144  std::cout << "Write IOV " << iIov << " starting from " << fileIOV << "... "<< std::endl;
145  // db_->writeOne(corrSet, iovStart, "EcalLaserAPDPNRatiosRcd");
146  m_to_transfer.push_back(std::make_pair(corrSet, fileIOV));
147  iIov++;
148  // } // end loop over week
149  std::cout << "Ecal -> end of getNewObjects -----------\n";
150 }
size_t size
Definition: Types.h:77
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:99
cond::ValidityInterval lastInterval
Definition: Types.h:75
auto const T2 &decltype(t1.eta()) t2
Definition: deltaR.h:16
JetCorrectorParameters corr
Definition: classes.h:5
unsigned long long uint64_t
Definition: Time.h:15
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:114
Definition: Tm.h:13
TimeValue_t value() const
Definition: Timestamp.h:56
std::string popcon::EcalLaser_weekly_Handler::id ( ) const
inlineoverridevirtual

Member Data Documentation

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

Definition at line 68 of file EcalLaser_weekly_Handler.h.

const EcalLaserAPDPNRatios* popcon::EcalLaser_weekly_Handler::myapdpns
private

Definition at line 67 of file EcalLaser_weekly_Handler.h.