CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTT0Handler Class Reference

#include <DTT0Handler.h>

Inheritance diagram for DTT0Handler:
popcon::PopConSourceHandler< DTT0 >

Public Member Functions

 DTT0Handler (const edm::ParameterSet &ps)
 
void getNewObjects () override
 
std::string id () const override
 
 ~DTT0Handler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< DTT0 >
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 Attributes

std::string dataTag
 
std::string fileName
 
unsigned int runNumber
 

Additional Inherited Members

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

Detailed Description

Description:

Date
2007/12/07 15:12:29
Revision
1.2
Author
Paolo Ronchese INFN Padova

Definition at line 34 of file DTT0Handler.h.

Constructor & Destructor Documentation

◆ DTT0Handler()

DTT0Handler::DTT0Handler ( const edm::ParameterSet ps)

Constructor

Definition at line 33 of file DTT0Handler.cc.

34  : dataTag(ps.getParameter<std::string>("tag")),
35  fileName(ps.getParameter<std::string>("file")),
36  runNumber(ps.getParameter<unsigned int>("run")) {}
unsigned int runNumber
Definition: DTT0Handler.h:53
std::string dataTag
Definition: DTT0Handler.h:51
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::string fileName
Definition: DTT0Handler.h:52

◆ ~DTT0Handler()

DTT0Handler::~DTT0Handler ( )
override

Destructor

Definition at line 41 of file DTT0Handler.cc.

41 {}

Member Function Documentation

◆ getNewObjects()

void DTT0Handler::getNewObjects ( )
overridevirtual

Operations

Implements popcon::PopConSourceHandler< DTT0 >.

Definition at line 46 of file DTT0Handler.cc.

References DTTimeUnits::counts, gather_cfg::cout, dataTag, fileName, compare_using_db::ifile, dqmdumpme::last, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< DTT0 >::m_to_transfer, runNumber, fileinputsource_cfi::sec, cond::Iov_t::since, mps_update::status, FrontierCondition_GT_autoExpress_cfi::t0, and popcon::PopConSourceHandler< DTT0 >::tagInfo().

46  {
47  //to access the information on the tag inside the offline database:
48  cond::TagInfo_t const& ti = tagInfo();
50  std::cout << "last: " << last << std::endl;
51 
52  //to access the information on last successful log entry for this tag:
53  // cond::LogDBEntry const & lde = logDBEntry();
54 
55  //to access the lastest payload (Ref is a smart pointer)
56  // Ref payload = lastPayload();
57 
58  /*
59  int irun = event.id().run();
60  int ievt = event.id().event();
61  std::cout << "================ "
62  << irun << " " << ievt << std::endl;
63 
64  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
65  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
66  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
67  std::cout << "list of all tags: " << std::endl;
68  while ( iter != iend ) {
69  std::cout << "Tag: " << iter->first
70  << " , last object valid since " << iter->second.last_since
71  << " to " << iter->second.last_till
72  << std::endl;
73  iter++;
74  }
75 
76  std::cout << "look for tag " << dataTag << std::endl;
77  std::map<std::string, popcon::PayloadIOV>::iterator itag =
78  mp.find( dataTag );
79 */
80 
81  DTT0* t0 = new DTT0(dataTag);
82 
83  int status = 0;
84  std::ifstream ifile(fileName.c_str());
85  int whe;
86  int sta;
87  int sec;
88  int qua;
89  int lay;
90  int cel;
91  float t0mean;
92  float t0rms;
93  while (ifile >> whe >> sta >> sec >> qua >> lay >> cel >> t0mean >> t0rms) {
94  status = t0->set(whe, sta, sec, qua, lay, cel, t0mean, t0rms, DTTimeUnits::counts);
95  std::cout << whe << " " << sta << " " << sec << " " << qua << " " << lay << " " << cel << " " << t0mean << " "
96  << t0rms << " -> ";
97  std::cout << "insert status: " << status << std::endl;
98  }
99 
100  /*
101  unsigned int runf = irun;
102  unsigned int runl = 0xffffffff;
103  popcon::IOVPair iop = { runf, runl };
104  std::cout << "APPEND NEW OBJECT: "
105  << runf << " " << runl << " " << t0 << std::endl;
106  m_to_transfer->push_back( std::make_pair( t0, iop ) );
107 */
108 
109  //for each payload provide IOV information (say in this case we use since)
110  cond::Time_t snc = runNumber;
111  if (runNumber > last)
112  m_to_transfer.push_back(std::make_pair(t0, snc));
113  else {
114  std::cout << "More recent data already present - skipped" << std::endl;
115  delete t0;
116  }
117 
118  return;
119 }
unsigned int runNumber
Definition: DTT0Handler.h:53
std::string dataTag
Definition: DTT0Handler.h:51
Iov_t lastInterval
Definition: Types.h:73
Time_t since
Definition: Types.h:53
cond::TagInfo_t const & tagInfo() const
Definition: DTT0.h:48
unsigned long long Time_t
Definition: Time.h:14
std::vector< std::pair< DTT0 *, Time_t > > m_to_transfer
std::string fileName
Definition: DTT0Handler.h:52

◆ id()

std::string DTT0Handler::id ( ) const
overridevirtual

Implements popcon::PopConSourceHandler< DTT0 >.

Definition at line 121 of file DTT0Handler.cc.

References dataTag.

121 { return dataTag; }
std::string dataTag
Definition: DTT0Handler.h:51

Member Data Documentation

◆ dataTag

std::string DTT0Handler::dataTag
private

Definition at line 51 of file DTT0Handler.h.

Referenced by getNewObjects(), and id().

◆ fileName

std::string DTT0Handler::fileName
private

Definition at line 52 of file DTT0Handler.h.

Referenced by getNewObjects(), and readConfig.fileINI::read().

◆ runNumber

unsigned int DTT0Handler::runNumber
private