CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTTPGParametersHandler Class Reference

#include <DTTPGParametersHandler.h>

Inheritance diagram for DTTPGParametersHandler:
popcon::PopConSourceHandler< DTTPGParameters >

Public Member Functions

 DTTPGParametersHandler (const edm::ParameterSet &ps)
 
void getNewObjects ()
 
std::string id () const
 
virtual ~DTTPGParametersHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< DTTPGParameters >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (cond::DbSession dbSession, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (cond::DbSession session, cond::TagInfo const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo 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< DTTPGParameters >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< DTTPGParameters
*, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< DTTPGParameters
self
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef DTTPGParameters value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< DTTPGParameters >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< DTTPGParameters >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Description:

Date:
2009/02/16 13:21:15
Revision:
1.2
Author
Paolo Ronchese INFN Padova

Definition at line 35 of file DTTPGParametersHandler.h.

Constructor & Destructor Documentation

DTTPGParametersHandler::DTTPGParametersHandler ( const edm::ParameterSet ps)

Constructor

Definition at line 34 of file DTTPGParametersHandler.cc.

34  :
35  dataTag( ps.getParameter<std::string> ( "tag" ) ),
36  fileName( ps.getParameter<std::string> ( "file" ) ),
37  runNumber( ps.getParameter<unsigned int> ( "run" ) ) {
38 }
T getParameter(std::string const &) const
DTTPGParametersHandler::~DTTPGParametersHandler ( )
virtual

Destructor

Definition at line 43 of file DTTPGParametersHandler.cc.

43  {
44 }

Member Function Documentation

void DTTPGParametersHandler::getNewObjects ( )
virtual

Operations

Implements popcon::PopConSourceHandler< DTTPGParameters >.

Definition at line 49 of file DTTPGParametersHandler.cc.

References cl, gather_cfg::cout, dataTag, fileName, compare_using_db::ifile, prof2calltree::last, cond::TagInfo::lastInterval, popcon::PopConSourceHandler< DTTPGParameters >::m_to_transfer, DTTimeUnits::ns, runNumber, DTTPGParameters::set(), ntuplemaker::status, and popcon::PopConSourceHandler< DTTPGParameters >::tagInfo().

49  {
50 
51  //to access the information on the tag inside the offline database:
52  cond::TagInfo const & ti = tagInfo();
53  unsigned int last = ti.lastInterval.first;
54 
55  //to access the information on last successful log entry for this tag:
56 // cond::LogDBEntry const & lde = logDBEntry();
57 
58  //to access the lastest payload (Ref is a smart pointer)
59 // Ref payload = lastPayload();
60 
61 /*
62  int irun = event.id().run();
63  int ievt = event.id().event();
64  std::cout << "================ "
65  << irun << " " << ievt << std::endl;
66 
67  std::map<std::string, popcon::PayloadIOV> mp = getOfflineInfo();
68  std::map<std::string, popcon::PayloadIOV>::iterator iter = mp.begin();
69  std::map<std::string, popcon::PayloadIOV>::iterator iend = mp.end();
70  std::cout << "list of all tags: " << std::endl;
71  while ( iter != iend ) {
72  std::cout << "Tag: " << iter->first
73  << " , last object valid since " << iter->second.last_since
74  << " to " << iter->second.last_till
75  << std::endl;
76  iter++;
77  }
78 
79  std::cout << "look for tag " << dataTag << std::endl;
80  std::map<std::string, popcon::PayloadIOV>::iterator itag =
81  mp.find( dataTag );
82 */
83 
84  DTTPGParameters* tSync = new DTTPGParameters( dataTag );
85 
86  int status = 0;
87  std::ifstream ifile( fileName.c_str() );
88 // int cx = 32;
89 // ifile >> cx;
90 // tSync->setClock( cx );
91  int whe;
92  int sta;
93  int sec;
94  int cl;
95  float ph;
96  while ( ifile >> whe
97  >> sta
98  >> sec
99  >> cl
100  >> ph ) {
101  status = tSync->set( whe, sta, sec, cl, ph,
102  DTTimeUnits::ns );
103  std::cout << whe << " "
104  << sta << " "
105  << sec << " "
106  << cl << " "
107  << ph << " -> ";
108  std::cout << "insert status: " << status << std::endl;
109  }
110 
111 /*
112  unsigned int runf = irun;
113  unsigned int runl = 0xffffffff;
114  popcon::IOVPair iop = { runf, runl };
115  std::cout << "APPEND NEW OBJECT: "
116  << runf << " " << runl << " " << tSync << std::endl;
117  m_to_transfer->push_back( std::make_pair( tSync, iop ) );
118 */
119 
120  //for each payload provide IOV information (say in this case we use since)
121  cond::Time_t snc = runNumber;
122  if ( runNumber > last )
123  m_to_transfer.push_back( std::make_pair( tSync, snc ) );
124  else
125  std::cout << "More recent data already present - skipped" << std::endl;
126 
127  return;
128 
129 }
int set(int wheelId, int stationId, int sectorId, int nc, float ph, DTTimeUnits::type unit)
unsigned long long Time_t
Definition: Time.h:16
float cl
Definition: Combine.cc:71
cond::ValidityInterval lastInterval
Definition: TagInfo.h:11
tuple cout
Definition: gather_cfg.py:121
tuple status
Definition: ntuplemaker.py:245
std::string DTTPGParametersHandler::id ( void  ) const
virtual

Implements popcon::PopConSourceHandler< DTTPGParameters >.

Definition at line 132 of file DTTPGParametersHandler.cc.

References dataTag.

132  {
133  return dataTag;
134 }

Member Data Documentation

std::string DTTPGParametersHandler::dataTag
private

Definition at line 55 of file DTTPGParametersHandler.h.

Referenced by getNewObjects(), and id().

std::string DTTPGParametersHandler::fileName
private

Definition at line 56 of file DTTPGParametersHandler.h.

Referenced by getNewObjects().

unsigned int DTTPGParametersHandler::runNumber
private

Definition at line 57 of file DTTPGParametersHandler.h.

Referenced by getNewObjects().