test
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
DTStatusFlagHandler Class Reference

#include <DTStatusFlagHandler.h>

Inheritance diagram for DTStatusFlagHandler:
popcon::PopConSourceHandler< DTStatusFlag >

Public Member Functions

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

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

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< DTStatusFlag >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< DTStatusFlag *, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< DTStatusFlag
self
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef DTStatusFlag value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< DTStatusFlag >
int add (value_type *payload, Summary *summary, Time_t time)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< DTStatusFlag >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Description:

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

Definition at line 35 of file DTStatusFlagHandler.h.

Constructor & Destructor Documentation

DTStatusFlagHandler::DTStatusFlagHandler ( const edm::ParameterSet ps)

Constructor

Definition at line 34 of file DTStatusFlagHandler.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
DTStatusFlagHandler::~DTStatusFlagHandler ( )
virtual

Destructor

Definition at line 43 of file DTStatusFlagHandler.cc.

43  {
44 }

Member Function Documentation

void DTStatusFlagHandler::getNewObjects ( )
virtual

Operations

Implements popcon::PopConSourceHandler< DTStatusFlag >.

Definition at line 49 of file DTStatusFlagHandler.cc.

References gather_cfg::cout, dataTag, fileName, compare_using_db::ifile, prof2calltree::last, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< DTStatusFlag >::m_to_transfer, runNumber, DTStatusFlag::set(), ntuplemaker::status, and popcon::PopConSourceHandler< DTStatusFlag >::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  DTStatusFlag* stFlag = new DTStatusFlag( dataTag );
85 
86  int status = 0;
87  std::ifstream ifile( fileName.c_str() );
88  int whe;
89  int sta;
90  int sec;
91  int qua;
92  int lay;
93  int cel;
94  int noiseFlag;
95  int feMask;
96  int tdcMask;
97  int trigMask;
98  int deadFlag;
99  int nohvFlag;
100  while ( ifile >> whe
101  >> sta
102  >> sec
103  >> qua
104  >> lay
105  >> cel
106  >> noiseFlag
107  >> feMask
108  >> tdcMask
109  >> trigMask
110  >> deadFlag
111  >> nohvFlag ) {
112  status = stFlag->set( whe, sta, sec, qua, lay, cel,
113  noiseFlag != 0,
114  feMask != 0,
115  tdcMask != 0,
116  trigMask != 0,
117  deadFlag != 0,
118  nohvFlag != 0 );
119  std::cout << whe << " "
120  << sta << " "
121  << sec << " "
122  << qua << " "
123  << lay << " "
124  << cel << " "
125  << noiseFlag << " "
126  << feMask << " "
127  << tdcMask << " "
128  << trigMask << " "
129  << deadFlag << " "
130  << nohvFlag << " -> ";
131  std::cout << "insert status: " << status << std::endl;
132  }
133 
134 /*
135  unsigned int runf = irun;
136  unsigned int runl = 0xffffffff;
137  popcon::IOVPair iop = { runf, runl };
138  std::cout << "APPEND NEW OBJECT: "
139  << runf << " " << runl << " " << stFlag << std::endl;
140  m_to_transfer->push_back( std::make_pair( stFlag, iop ) );
141 */
142 
143  //for each payload provide IOV information (say in this case we use since)
144  cond::Time_t snc = runNumber;
145  if ( runNumber > last )
146  m_to_transfer.push_back( std::make_pair( stFlag, snc ) );
147  else
148  std::cout << "More recent data already present - skipped" << std::endl;
149 
150  return;
151 
152 }
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool noiseFlag, bool feMask, bool tdcMask, bool trigMask, bool deadFlag, bool nohvFlag)
cond::ValidityInterval lastInterval
Definition: Types.h:70
unsigned long long Time_t
Definition: Time.h:16
tuple cout
Definition: gather_cfg.py:121
tuple status
Definition: ntuplemaker.py:245
std::string DTStatusFlagHandler::id ( void  ) const
virtual

Implements popcon::PopConSourceHandler< DTStatusFlag >.

Definition at line 155 of file DTStatusFlagHandler.cc.

References dataTag.

155  {
156  return dataTag;
157 }

Member Data Documentation

std::string DTStatusFlagHandler::dataTag
private

Definition at line 55 of file DTStatusFlagHandler.h.

Referenced by getNewObjects(), and id().

std::string DTStatusFlagHandler::fileName
private

Definition at line 56 of file DTStatusFlagHandler.h.

Referenced by getNewObjects().

unsigned int DTStatusFlagHandler::runNumber
private

Definition at line 57 of file DTStatusFlagHandler.h.

Referenced by getNewObjects().