CMS 3D CMS Logo

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

#include <L1RPCHwConfigSourceHandler.h>

Inheritance diagram for popcon::L1RPCHwConfigSourceHandler:
popcon::PopConSourceHandler< L1RPCHwConfig >

Public Member Functions

int Compare2Configs (const Ref &set1, L1RPCHwConfig *set2)
 
void ConnectOnlineDB (std::string connect, std::string authPath)
 
void DisconnectOnlineDB ()
 
void getNewObjects () override
 
std::string id () const override
 
 L1RPCHwConfigSourceHandler (const edm::ParameterSet &ps)
 
void readHwConfig1 ()
 
 ~L1RPCHwConfigSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< L1RPCHwConfig >
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

L1RPCHwConfigdisabledDevs
 
std::string m_authpath
 
std::string m_connect
 
std::vector< int > m_disableCrates
 
std::vector< int > m_disableTowers
 
int m_dummy
 
std::string m_name
 
int m_validate
 
cond::persistency::Session session
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< L1RPCHwConfig >
typedef std::vector< Triplet > Container
 
typedef std::vector< std::pair< L1RPCHwConfig *, cond::Time_t > > OldContainer
 
typedef PopConSourceHandler< L1RPCHwConfigself
 
typedef cond::Summary Summary
 
typedef cond::Time_t Time_t
 
typedef L1RPCHwConfig value_type
 
- Protected Member Functions inherited from popcon::PopConSourceHandler< L1RPCHwConfig >
int add (value_type *payload, Summary *summary, Time_t time)
 
cond::persistency::SessiondbSession () const
 
- Protected Attributes inherited from popcon::PopConSourceHandler< L1RPCHwConfig >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 31 of file L1RPCHwConfigSourceHandler.h.

Constructor & Destructor Documentation

◆ L1RPCHwConfigSourceHandler()

popcon::L1RPCHwConfigSourceHandler::L1RPCHwConfigSourceHandler ( const edm::ParameterSet ps)

Definition at line 7 of file L1RPCHwConfigSourceHandler.cc.

8  : m_name(ps.getUntrackedParameter<std::string>("name", "L1RPCHwConfigSourceHandler")),
9  m_dummy(ps.getUntrackedParameter<int>("WriteDummy", 0)),
10  m_validate(ps.getUntrackedParameter<int>("Validate", 0)),
11  m_disableCrates(ps.getUntrackedParameter<std::vector<int> >("DisabledCrates")),
12  m_disableTowers(ps.getUntrackedParameter<std::vector<int> >("DisabledTowers")),
13  m_connect(ps.getUntrackedParameter<std::string>("OnlineConn", "")),
14  m_authpath(ps.getUntrackedParameter<std::string>("OnlineAuthPath", ".")) {}

◆ ~L1RPCHwConfigSourceHandler()

popcon::L1RPCHwConfigSourceHandler::~L1RPCHwConfigSourceHandler ( )
override

Definition at line 16 of file L1RPCHwConfigSourceHandler.cc.

16 {}

Member Function Documentation

◆ Compare2Configs()

int popcon::L1RPCHwConfigSourceHandler::Compare2Configs ( const Ref &  set1,
L1RPCHwConfig set2 
)

Definition at line 221 of file L1RPCHwConfigSourceHandler.cc.

221  {
222  const Ref& set1 = _set1;
223  std::cout << "Size of new object is : " << std::flush;
224  std::cout << set2->size() << std::endl;
225  std::cout << "Size of ref object is : " << std::flush;
226  std::cout << set1->size() << std::endl;
227 
228  if (set1->size() != set2->size()) {
229  std::cout << " Number of disabled devices changed " << std::endl;
230  return 1;
231  }
232  for (int tower = -16; tower < 17; tower++) {
233  for (int sector = 0; sector < 12; sector++) {
234  for (int segment = 0; segment < 12; segment++)
235  if (set1->isActive(tower, sector, segment) != set2->isActive(tower, sector, segment)) {
236  std::cout << " Configuration changed for tower " << tower << ", sector " << sector << ", segment " << segment
237  << std::endl;
238  return 1;
239  }
240  }
241  }
242  return 0;
243 }

References gather_cfg::cout, L1RPCHwConfig::isActive(), L1RPCHwConfig::size(), and hgcalTowerProducer_cfi::tower.

◆ ConnectOnlineDB()

void popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB ( std::string  connect,
std::string  authPath 
)

Definition at line 76 of file L1RPCHwConfigSourceHandler.cc.

76  {
77  std::cout << "L1RPCHwConfigSourceHandler: connecting to " << connect << "..." << std::flush;
79  // session->configuration().setAuthenticationMethod(cond::XML);
80  connection.setAuthenticationPath(authPath);
81  connection.configure();
82  session = connection.createSession(connect, true);
83  std::cout << "Done." << std::endl;
84 }

References lumi_dqm_sourceclient-live_cfg::authPath, cond::persistency::ConnectionPool::configure(), DBConfiguration_cff::connect, gather_cfg::cout, cond::persistency::ConnectionPool::createSession(), and cond::persistency::ConnectionPool::setAuthenticationPath().

◆ DisconnectOnlineDB()

void popcon::L1RPCHwConfigSourceHandler::DisconnectOnlineDB ( )

Definition at line 86 of file L1RPCHwConfigSourceHandler.cc.

86 { session.close(); }

◆ getNewObjects()

void popcon::L1RPCHwConfigSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< L1RPCHwConfig >.

Definition at line 18 of file L1RPCHwConfigSourceHandler.cc.

18  {
19  std::cout << "L1RPCHwConfigSourceHandler: L1RPCHwConfigSourceHandler::getNewObjects begins\n";
21 
22  // std::cerr << "------- " << m_name
23  // << " - > getNewObjects" << std::endl;
24  // std::cerr<<"Got offlineInfo, tag: "<<std::endl;
25  // std::cerr << tagInfo().name << " , last object valid from "
26  // << tagInfo().lastInterval.first << " to "
27  // << tagInfo().lastInterval.second << " , token is "
28  // << tagInfo().token << " and this is the payload "
29  // << tagInfo().lastPayloadToken << std::endl;
30 
31  // first check what is already there in offline DB
32  Ref payload;
33 
34  if (m_validate == 1) {
35  std::cout << " Validation was requested, so will check present contents" << std::endl;
36  std::cout << "Name of tag : " << tagInfo().name << ", tag size : " << tagInfo().size << ", last object valid since "
37  << tagInfo().lastInterval.since << std::endl;
38  payload = lastPayload();
39  } else {
40  std::cout << "L1RPCHwConfigSourceHandler: no validation requested" << std::endl;
41  }
42 
43  // now construct new object from online DB
45  if (m_dummy == 1) {
46  std::vector<int>::iterator crIt = m_disableCrates.begin();
47  for (; crIt != m_disableCrates.end(); ++crIt) {
48  disabledDevs->enableCrate(*crIt, false);
49  }
50  std::vector<int>::iterator twIt = m_disableTowers.begin();
51  for (; twIt != m_disableTowers.end(); ++twIt) {
52  disabledDevs->enableTower(*twIt, false);
53  }
54  } else {
56  readHwConfig1();
58  }
59 
60  cond::Time_t snc = mydbservice->currentTime();
61 
62  // look for recent changes
63  int difference = 1;
64  if (m_validate == 1)
65  difference = Compare2Configs(payload, disabledDevs);
66  if (!difference)
67  std::cout << "No changes - will not write anything!!!" << std::endl;
68  if (difference == 1) {
69  std::cout << "Will write new object to offline DB!!!" << std::endl;
70  m_to_transfer.push_back(std::make_pair((L1RPCHwConfig*)disabledDevs, snc + 1));
71  }
72 
73  std::cout << "L1RPCHwConfigSourceHandler: L1RPCHwConfigSourceHandler::getNewObjects ends\n";
74 }

References gather_cfg::cout, cond::service::PoolDBOutputService::currentTime(), jets_cff::payload, and dumpRecoGeometry_cfg::tagInfo.

◆ id()

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

Implements popcon::PopConSourceHandler< L1RPCHwConfig >.

Definition at line 36 of file L1RPCHwConfigSourceHandler.h.

36 { return m_name; }

References m_name.

◆ readHwConfig1()

void popcon::L1RPCHwConfigSourceHandler::readHwConfig1 ( )

Definition at line 88 of file L1RPCHwConfigSourceHandler.cc.

88  {
89  session.transaction().start(true);
90  coral::ISchema& schema = session.nominalSchema();
92  coral::AttributeList conditionData;
93  std::cout << std::endl
94  << "L1RPCHwConfigSourceHandler: start to build L1RPC Hw Config..." << std::flush << std::endl
95  << std::endl;
96 
97  // get disabled crates and translate into towers/sectors/segments
98  coral::IQuery* query1 = schema.newQuery();
99  query1->addToTableList("CRATEDISABLED");
100  query1->addToTableList("CRATE");
101  query1->addToTableList("BOARD");
102  query1->addToTableList("TRIGGERBOARD");
103  query1->addToOutputList("TRIGGERBOARD.TOWERTO", "TOWERTO");
104  query1->addToOutputList("TRIGGERBOARD.TOWERFROM", "TOWERFROM");
105  query1->addToOutputList("TRIGGERBOARD.SECTOR", "SECTOR");
106  query1->addToOrderList("TOWERTO");
107  query1->addToOrderList("SECTOR");
108  condition =
109  "CRATE.CRATEID=CRATEDISABLED.CRATE_CRATEID AND BOARD.CRATE_CRATEID=CRATE.CRATEID AND "
110  "BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CRATE.TYPE='TRIGGERCRATE'";
111  query1->setCondition(condition, conditionData);
112  coral::ICursor& cursor1 = query1->execute();
113  while (cursor1.next()) {
114  // cursor1.currentRow().toOutputStream( std::cout ) << std::endl;
115  const coral::AttributeList& row = cursor1.currentRow();
116  int sector = atoi((row["SECTOR"].data<std::string>()).c_str());
117  int first = atoi((row["TOWERTO"].data<std::string>()).c_str());
118  int last = atoi((row["TOWERFROM"].data<std::string>()).c_str());
119  for (int iTower = first; iTower <= last; iTower++) {
120  for (int jSegment = 0; jSegment < 12; jSegment++) {
121  disabledDevs->enablePAC(iTower, sector, jSegment, false);
122  }
123  }
124  }
125  delete query1;
126 
127  // get disabled triggerboards and translate into towers/sectors/segments
128  coral::IQuery* query2 = schema.newQuery();
129  query2->addToTableList("BOARDDISABLED");
130  query2->addToTableList("BOARD");
131  query2->addToTableList("TRIGGERBOARD");
132  query2->addToOutputList("TRIGGERBOARD.TOWERTO", "TOWERTO");
133  query2->addToOutputList("TRIGGERBOARD.TOWERFROM", "TOWERFROM");
134  query2->addToOutputList("TRIGGERBOARD.SECTOR", "SECTOR");
135  query2->addToOrderList("TOWERTO");
136  query2->addToOrderList("SECTOR");
137  condition = "BOARD.BOARDID=BOARDDISABLED.BOARD_BOARDID AND BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID";
138  query2->setCondition(condition, conditionData);
139  coral::ICursor& cursor2 = query2->execute();
140  while (cursor2.next()) {
141  // cursor2.currentRow().toOutputStream( std::cout ) << std::endl;
142  const coral::AttributeList& row = cursor2.currentRow();
143  int sector = atoi((row["SECTOR"].data<std::string>()).c_str());
144  int first = atoi((row["TOWERTO"].data<std::string>()).c_str());
145  int last = atoi((row["TOWERFROM"].data<std::string>()).c_str());
146  for (int iTower = first; iTower <= last; iTower++) {
147  for (int jSegment = 0; jSegment < 12; jSegment++) {
148  disabledDevs->enablePAC(iTower, sector, jSegment, false);
149  }
150  }
151  }
152  delete query2;
153 
154  // get disabled links - this is not usable here
155  /*
156  coral::IQuery* query3 = schema.newQuery();
157  query3->addToTableList( "LINKDISABLED" );
158  query3->addToTableList( "LINKCONN" );
159  query3->addToTableList( "TRIGGERBOARD" );
160  query3->addToOutputList("TRIGGERBOARD.TOWERTO","TOWERTO");
161  query3->addToOutputList("TRIGGERBOARD.TOWERFROM","TOWERFROM");
162  query3->addToOutputList("TRIGGERBOARD.SECTOR","SECTOR");
163  query3->addToOutputList("LINKCONN.TRIGGERBOARDINPUTNUM","TBINPUTNUM");
164  query3->addToOrderList( "TOWERTO" );
165  query3->addToOrderList( "SECTOR" );
166  query3->addToOrderList( "TBINPUTNUM" );
167  condition = "LINKCONN.LINKCONNID=LINKDISABLED.LINK_LINKCONNID AND LINKCONN.TB_TRIGGERBOARDID=TRIGGERBOARD.TRIGGERBOARDID";
168  query3->setCondition( condition, conditionData );
169  coral::ICursor& cursor3 = query3->execute();
170  while ( cursor3.next() ) {
171 // cursor3.currentRow().toOutputStream( std::cout ) << std::endl;
172  const coral::AttributeList& row = cursor3.currentRow();
173  int sector = atoi((row["SECTOR"].data<std::string>()).c_str());
174  int first = atoi((row["TOWERTO"].data<std::string>()).c_str());
175  int last = atoi((row["TOWERFROM"].data<std::string>()).c_str());
176  for (int iTower=first; iTower<=last; iTower++) {
177  for (int jSegment=0; jSegment<12; jSegment++) {
178  disabledDevs->enablePAC(iTower,sector,jSegment,false);
179  }
180  }
181  }
182  delete query3;*/
183 
184  // get disabled chips and translate into towers/sectors
185  // for the moment assume that chip position 8 corresponds to lowest tower number
186  // and so on, ignoring bogus chip at position 11 if given TB operates 3 towers.
187  coral::IQuery* query4 = schema.newQuery();
188  query4->addToTableList("CHIPDISABLED");
189  query4->addToTableList("CHIP");
190  query4->addToTableList("BOARD");
191  query4->addToTableList("TRIGGERBOARD");
192  query4->addToOutputList("TRIGGERBOARD.TOWERTO", "TOWERTO");
193  query4->addToOutputList("TRIGGERBOARD.TOWERFROM", "TOWERFROM");
194  query4->addToOutputList("TRIGGERBOARD.SECTOR", "SECTOR");
195  query4->addToOutputList("CHIP.POSITION", "POSITION");
196  query4->addToOrderList("TOWERTO");
197  query4->addToOrderList("SECTOR");
198  query4->addToOrderList("POSITION");
199  condition =
200  "CHIP.CHIPID=CHIPDISABLED.CHIP_CHIPID AND CHIP.BOARD_BOARDID=BOARD.BOARDID AND "
201  "BOARD.BOARDID=TRIGGERBOARD.TRIGGERBOARDID AND CHIP.TYPE='PAC'";
202  query4->setCondition(condition, conditionData);
203  coral::ICursor& cursor4 = query4->execute();
204  while (cursor4.next()) {
205  // cursor4.currentRow().toOutputStream( std::cout ) << std::endl;
206  const coral::AttributeList& row = cursor4.currentRow();
207  int sector = atoi((row["SECTOR"].data<std::string>()).c_str());
208  int first = atoi((row["TOWERTO"].data<std::string>()).c_str());
209  int last = atoi((row["TOWERFROM"].data<std::string>()).c_str());
210  int chipPos = row["POSITION"].data<short>();
211  int tower = first + chipPos - 8;
212  if (tower <= last) {
213  for (int jSegment = 0; jSegment < 12; jSegment++) {
214  disabledDevs->enablePAC(tower, sector, jSegment, false);
215  }
216  }
217  }
218  delete query4;
219 }

References goodZToMuMu_cfi::condition, gather_cfg::cout, dqmdumpme::first, dqmdumpme::last, AlCaHLTBitMon_QueryRunRegistry::string, and hgcalTowerProducer_cfi::tower.

Member Data Documentation

◆ disabledDevs

L1RPCHwConfig* popcon::L1RPCHwConfigSourceHandler::disabledDevs
private

Definition at line 43 of file L1RPCHwConfigSourceHandler.h.

◆ m_authpath

std::string popcon::L1RPCHwConfigSourceHandler::m_authpath
private

Definition at line 51 of file L1RPCHwConfigSourceHandler.h.

◆ m_connect

std::string popcon::L1RPCHwConfigSourceHandler::m_connect
private

Definition at line 50 of file L1RPCHwConfigSourceHandler.h.

◆ m_disableCrates

std::vector<int> popcon::L1RPCHwConfigSourceHandler::m_disableCrates
private

Definition at line 48 of file L1RPCHwConfigSourceHandler.h.

◆ m_disableTowers

std::vector<int> popcon::L1RPCHwConfigSourceHandler::m_disableTowers
private

Definition at line 49 of file L1RPCHwConfigSourceHandler.h.

◆ m_dummy

int popcon::L1RPCHwConfigSourceHandler::m_dummy
private

Definition at line 46 of file L1RPCHwConfigSourceHandler.h.

◆ m_name

std::string popcon::L1RPCHwConfigSourceHandler::m_name
private

Definition at line 45 of file L1RPCHwConfigSourceHandler.h.

Referenced by id().

◆ m_validate

int popcon::L1RPCHwConfigSourceHandler::m_validate
private

Definition at line 47 of file L1RPCHwConfigSourceHandler.h.

◆ session

cond::persistency::Session popcon::L1RPCHwConfigSourceHandler::session
private

Definition at line 44 of file L1RPCHwConfigSourceHandler.h.

lumi_dqm_sourceclient-live_cfg.authPath
authPath
Definition: lumi_dqm_sourceclient-live_cfg.py:33
popcon::L1RPCHwConfigSourceHandler::m_validate
int m_validate
Definition: L1RPCHwConfigSourceHandler.h:47
popcon::PopConSourceHandler< L1RPCHwConfig >::m_to_transfer
OldContainer m_to_transfer
Definition: PopConSourceHandler.h:162
popcon::L1RPCHwConfigSourceHandler::m_connect
std::string m_connect
Definition: L1RPCHwConfigSourceHandler.h:50
gather_cfg.cout
cout
Definition: gather_cfg.py:144
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
L1RPCHwConfig::isActive
bool isActive(int tower, int sector, int segment) const
Definition: L1RPCHwConfig.h:70
popcon::L1RPCHwConfigSourceHandler::session
cond::persistency::Session session
Definition: L1RPCHwConfigSourceHandler.h:44
popcon::L1RPCHwConfigSourceHandler::disabledDevs
L1RPCHwConfig * disabledDevs
Definition: L1RPCHwConfigSourceHandler.h:43
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
cond::persistency::Session::close
void close()
Definition: Session.cc:50
cond::persistency::ConnectionPool::createSession
Session createSession(const std::string &connectionString, bool writeCapable=false)
Definition: ConnectionPool.cc:158
dqmdumpme.first
first
Definition: dqmdumpme.py:55
cond::TagInfo_t::name
std::string name
Definition: Types.h:72
popcon::L1RPCHwConfigSourceHandler::readHwConfig1
void readHwConfig1()
Definition: L1RPCHwConfigSourceHandler.cc:88
dqmdumpme.last
last
Definition: dqmdumpme.py:56
popcon::L1RPCHwConfigSourceHandler::m_authpath
std::string m_authpath
Definition: L1RPCHwConfigSourceHandler.h:51
L1RPCHwConfig::enableTower
void enableTower(int tower, bool enable)
Definition: L1RPCHwConfig.cc:50
cond::persistency::ConnectionPool
Definition: ConnectionPool.h:35
jets_cff.payload
payload
Definition: jets_cff.py:34
popcon::L1RPCHwConfigSourceHandler::m_dummy
int m_dummy
Definition: L1RPCHwConfigSourceHandler.h:46
popcon::L1RPCHwConfigSourceHandler::m_disableCrates
std::vector< int > m_disableCrates
Definition: L1RPCHwConfigSourceHandler.h:48
popcon::L1RPCHwConfigSourceHandler::ConnectOnlineDB
void ConnectOnlineDB(std::string connect, std::string authPath)
Definition: L1RPCHwConfigSourceHandler.cc:76
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
popcon::PopConSourceHandler< L1RPCHwConfig >::tagInfo
cond::TagInfo_t const & tagInfo() const
Definition: PopConSourceHandler.h:78
L1RPCHwConfig
Definition: L1RPCHwConfig.h:65
cond::persistency::Session::nominalSchema
coral::ISchema & nominalSchema()
Definition: Session.cc:224
popcon::L1RPCHwConfigSourceHandler::DisconnectOnlineDB
void DisconnectOnlineDB()
Definition: L1RPCHwConfigSourceHandler.cc:86
cond::Iov_t::since
Time_t since
Definition: Types.h:53
cond::Time_t
unsigned long long Time_t
Definition: Time.h:14
L1RPCHwConfig::size
int size() const
Definition: L1RPCHwConfig.h:88
edm::Service< cond::service::PoolDBOutputService >
cond::persistency::ConnectionPool::setAuthenticationPath
void setAuthenticationPath(const std::string &p)
Definition: ConnectionPool.cc:31
DBConfiguration_cff.connect
connect
Definition: DBConfiguration_cff.py:18
popcon::L1RPCHwConfigSourceHandler::Compare2Configs
int Compare2Configs(const Ref &set1, L1RPCHwConfig *set2)
Definition: L1RPCHwConfigSourceHandler.cc:221
cond::persistency::ConnectionPool::configure
void configure()
Definition: ConnectionPool.cc:125
popcon::L1RPCHwConfigSourceHandler::m_name
std::string m_name
Definition: L1RPCHwConfigSourceHandler.h:45
goodZToMuMu_cfi.condition
condition
Definition: goodZToMuMu_cfi.py:37
L1RPCHwConfig::enablePAC
void enablePAC(int tower, int sector, int segment, bool enable)
Definition: L1RPCHwConfig.cc:40
cond::TagInfo_t::lastInterval
Iov_t lastInterval
Definition: Types.h:73
cond::persistency::Session::transaction
Transaction & transaction()
Definition: Session.cc:52
cond::persistency::Transaction::start
void start(bool readOnly=true)
Definition: Session.cc:18
reco::JetExtendedAssociation::Ref
edm::Ref< Container > Ref
Definition: JetExtendedAssociation.h:32
popcon::PopConSourceHandler< L1RPCHwConfig >::lastPayload
Ref lastPayload() const
Definition: PopConSourceHandler.h:81
popcon::L1RPCHwConfigSourceHandler::m_disableTowers
std::vector< int > m_disableTowers
Definition: L1RPCHwConfigSourceHandler.h:49
L1RPCHwConfig::enableCrate
void enableCrate(int logSector, bool enable)
Definition: L1RPCHwConfig.cc:64
cond::service::PoolDBOutputService::currentTime
cond::Time_t currentTime() const
Definition: PoolDBOutputService.cc:189
cond::TagInfo_t::size
size_t size
Definition: Types.h:74