CMS 3D CMS Logo

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

#include <EcalTPGPedfromFile.h>

Inheritance diagram for popcon::EcalTPGPedfromFile:
popcon::PopConSourceHandler< EcalTPGPedestals >

Public Member Functions

 EcalTPGPedfromFile (edm::ParameterSet const &)
 
void getNewObjects () override
 
std::string id () const override
 
 ~EcalTPGPedfromFile () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< EcalTPGPedestals >
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, kEEChannels = 14648, kGains = 3 }
 

Private Attributes

std::string m_name
 

Additional Inherited Members

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

Detailed Description

Definition at line 48 of file EcalTPGPedfromFile.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Constructor & Destructor Documentation

◆ ~EcalTPGPedfromFile()

popcon::EcalTPGPedfromFile::~EcalTPGPedfromFile ( )
override

Definition at line 19 of file EcalTPGPedfromFile.cc.

19  {
20  // do nothing
21 }

◆ EcalTPGPedfromFile()

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

Definition at line 14 of file EcalTPGPedfromFile.cc.

References gather_cfg::cout.

15  : m_name(ps.getUntrackedParameter<std::string>("name", "EcalTPGPedfromFileHandler")) {
16  std::cout << "EcalTPGPedfromFile constructor\n" << std::endl;
17 }

Member Function Documentation

◆ getNewObjects()

void popcon::EcalTPGPedfromFile::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< EcalTPGPedestals >.

Definition at line 23 of file EcalTPGPedfromFile.cc.

References gather_cfg::cout, alignmentValidation::fname, PedestalClient_cfi::gain, mps_fire::i, triggerObjects_cff::id, EcalCondObjectContainer< T >::insert(), B2GTnPMonitor_cfi::item, kEBChannels, kEEChannels, kGains, mps_splice::line, VarParsing::mult, jetsAK4_Puppi_cff::payload, edm::shift, AlCaHLTBitMon_QueryRunRegistry::string, and dumpRecoGeometry_cfg::tagInfo.

23  {
24  std::cout << "------- Ecal -> getNewObjects\n";
25 
26  unsigned long long max_since = 1;
28 
29  // here popcon tells us which is the last since of the last object in the offline DB
30  max_since = tagInfo().lastInterval.since;
31  Tm max_since_tm(max_since);
32 
33  int fileIOV;
34  std::cout << "PedfromFile which input IOV do you want " << std::endl;
35  std::cin >> fileIOV;
36  std::ifstream fLin;
37  std::ostringstream oss;
38  oss << fileIOV;
39  std::string fname = "/afs/cern.ch/cms/ECAL/triggerTransp/TPG_beamv6_trans_" + oss.str() + "_spikekill.txt";
40  fLin.open(fname.c_str());
41  if (!fLin.is_open()) {
42  std::cout << "ERROR : can't open file '" << fname << std::endl;
43  return;
44  }
45  std::cout << " file " << fname << " opened" << std::endl;
47  for (int i = 0; i < 85; i++)
48  getline(fLin, line);
49  char cryst[10];
50  uint32_t ped[kGains], mult[kGains], shift[kGains];
51  uint32_t id;
54  for (int iChannel = 0; iChannel < kEBChannels; iChannel++) {
55  getline(fLin, line);
56  sscanf(line.c_str(), "%s %u", cryst, &id);
57  for (int gain = 0; gain < kGains; gain++) {
58  getline(fLin, line);
59  sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
60  }
62  item.mult_x1 = mult[2];
63  item.mult_x6 = mult[1];
64  item.mult_x12 = mult[0];
65  item.shift_x1 = shift[2];
66  item.shift_x6 = shift[1];
67  item.shift_x12 = shift[0];
68 
69  EcalTPGPedestals::Item itemPed;
70  itemPed.mean_x1 = ped[2];
71  itemPed.mean_x6 = ped[1];
72  itemPed.mean_x12 = ped[0];
73 
74  linC->insert(std::make_pair(id, item));
75  peds->insert(std::make_pair(id, itemPed));
76  } // end loop over EB channels
77  getline(fLin, line); // comment before EE crystals
78  std::cout << " comment line " << line << std::endl;
79  for (int iChannel = 0; iChannel < kEEChannels; iChannel++) {
80  getline(fLin, line);
81  // std::cout << " line " << line << std::endl;
82  sscanf(line.c_str(), "%s %u", cryst, &id);
83  // std::cout << cryst << " id " << id << std::endl;
84  for (int gain = 0; gain < kGains; gain++) {
85  getline(fLin, line);
86  // std::cout << " line g " << line << std::endl;
87  sscanf(line.c_str(), "%X %X %X", &ped[gain], &mult[gain], &shift[gain]);
88  // std::cout << " gain " << gain << " ped " << ped[gain] << " mult " << mult[gain] << " shift " << shift[gain]<< std::endl;
89  }
91  item.mult_x1 = mult[2];
92  item.mult_x6 = mult[1];
93  item.mult_x12 = mult[0];
94  item.shift_x1 = shift[2];
95  item.shift_x6 = shift[1];
96  item.shift_x12 = shift[0];
97 
98  EcalTPGPedestals::Item itemPed;
99  itemPed.mean_x1 = ped[2];
100  itemPed.mean_x6 = ped[1];
101  itemPed.mean_x12 = ped[0];
102 
103  linC->insert(std::make_pair(id, item));
104  peds->insert(std::make_pair(id, itemPed));
105  } // end loop over EE channels
106  fLin.close();
107  // for the time beeing just transfer pedestal
108  // m_to_transfer.push_back(std::make_pair(linC, fileIOV));
109  m_to_transfer.push_back(std::make_pair(peds, fileIOV));
110 
111  std::cout << "Ecal -> end of getNewObjects -----------\n";
112 }
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
std::string id() const override
std::vector< std::pair< EcalTPGPedestals *, Time_t > > m_to_transfer
void insert(std::pair< uint32_t, Item > const &a)
string fname
main script
std::unique_ptr< EcalTPGPedestals > Ref
static unsigned int const shift
EcalTPGPedestalsMap EcalTPGPedestals
Definition: Tm.h:13
EcalTPGLinearizationConstMap EcalTPGLinearizationConst

◆ id()

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

Implements popcon::PopConSourceHandler< EcalTPGPedestals >.

Definition at line 54 of file EcalTPGPedfromFile.h.

References m_name.

54 { return m_name; }

Member Data Documentation

◆ m_name

std::string popcon::EcalTPGPedfromFile::m_name
private

Definition at line 58 of file EcalTPGPedfromFile.h.

Referenced by id().