CMS 3D CMS Logo

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

#include <DTKeyedConfigHandler.h>

Inheritance diagram for DTKeyedConfigHandler:
popcon::PopConSourceHandler< DTCCBConfig >

Public Member Functions

 DTKeyedConfigHandler (const edm::ParameterSet &ps)
 
void getNewObjects ()
 
std::string id () const
 
virtual ~DTKeyedConfigHandler ()
 
- Public Member Functions inherited from popcon::PopConSourceHandler< DTCCBConfig >
void convertFromOld ()
 
SummarydummySummary (typename OldContainer::value_type const &) const
 
void initialize (const cond::persistency::Session &dbSession, cond::TagInfo_t const &tagInfo, cond::LogDBEntry const &logDBEntry)
 
Ref lastPayload () const
 
cond::LogDBEntry const & logDBEntry () const
 
std::pair< Container const
*, std::string const > 
operator() (const cond::persistency::Session &session, cond::TagInfo_t const &tagInfo, cond::LogDBEntry const &logDBEntry) const
 
 PopConSourceHandler ()
 
Container const & returnData ()
 
void sort ()
 
cond::TagInfo_t const & tagInfo () const
 
std::string const & userTextLog () const
 
virtual ~PopConSourceHandler ()
 

Static Public Member Functions

static void setList (cond::persistency::KeyList *list)
 

Private Member Functions

void chkConfigList ()
 

Static Private Member Functions

static bool sameConfigList (const std::vector< DTConfigKey > &cfgl, const std::vector< DTConfigKey > &cfgr)
 

Private Attributes

std::string brickContainer
 
DTCCBConfigccbConfig
 
cond::persistency::ConnectionPool connection
 
bool copyData
 
std::string dataTag
 
boost::shared_ptr
< coral::ISessionProxy > 
isession
 
int maxBrickId
 
int maxRunId
 
int minBrickId
 
int minRunId
 
std::string onlineAuthentication
 
int onlineAuthSys
 
std::string onlineConnect
 

Static Private Attributes

static cond::persistency::KeyListkeyList = 0
 

Additional Inherited Members

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

Detailed Description

Description:

Date:
2010/05/14 11:43:08
Revision:
1.2
Author
Paolo Ronchese INFN Padova

Definition at line 46 of file DTKeyedConfigHandler.h.

Constructor & Destructor Documentation

DTKeyedConfigHandler::DTKeyedConfigHandler ( const edm::ParameterSet ps)

Constructor

Definition at line 48 of file DTKeyedConfigHandler.cc.

References gather_cfg::cout, and onlineAuthentication.

48  :
49  copyData( ps.getUntrackedParameter<bool> ( "copyData", true ) ),
50  minBrickId( ps.getUntrackedParameter<int> ( "minBrick", 0 ) ),
51  maxBrickId( ps.getUntrackedParameter<int> ( "maxBrick", 999999999 ) ),
52  minRunId( ps.getUntrackedParameter<int> ( "minRun", 0 ) ),
53  maxRunId( ps.getUntrackedParameter<int> ( "maxRun", 999999999 ) ),
54  dataTag( ps.getParameter<std::string> ( "tag" ) ),
55  onlineConnect( ps.getParameter<std::string> ( "onlineDB" ) ),
57  "onlineAuthentication" ) ),
58  onlineAuthSys( ps.getUntrackedParameter<int>( "onlineAuthSys",1 ) ),
59  brickContainer( ps.getParameter<std::string> ( "container" ) ),
60  connection(),
61  isession() {
62  std::cout << " PopCon application for DT configuration export "
63  << onlineAuthentication << std::endl;
64 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
cond::persistency::ConnectionPool connection
boost::shared_ptr< coral::ISessionProxy > isession
tuple cout
Definition: gather_cfg.py:121
DTKeyedConfigHandler::~DTKeyedConfigHandler ( )
virtual

Destructor

Definition at line 69 of file DTKeyedConfigHandler.cc.

69  {
70 }

Member Function Documentation

void DTKeyedConfigHandler::chkConfigList ( )
private

Definition at line 446 of file DTKeyedConfigHandler.cc.

References DTKeyedConfig::add(), brickContainer, gather_cfg::cout, alignCSCRings::e, cppFunctionSkipper::exception, cond::persistency::KeyList::get(), isession, relval_steps::k, keyList, cond::persistency::KeyList::load(), cond::KeyedElement::m_key, cond::KeyedElement::m_obj, maxBrickId, minBrickId, DTKeyedConfig::setId(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOne().

Referenced by getNewObjects().

446  {
447 
448  std::cout << "open POOL out db " << std::endl;
450 
451  std::cout << "start queries " << std::endl;
452  std::map<int,bool> activeConfigMap;
453  coral::ITable& fullConfigTable =
454  isession->nominalSchema().tableHandle( "CONFIGSETS" );
455  std::auto_ptr<coral::IQuery>
456  fullConfigQuery( fullConfigTable.newQuery() );
457  fullConfigQuery->addToOutputList( "CONFKEY" );
458  fullConfigQuery->addToOutputList( "NAME" );
459  fullConfigQuery->addToOutputList( "RUN" );
460  coral::ICursor& fullConfigCursor = fullConfigQuery->execute();
461  while( fullConfigCursor.next() ) {
462  const coral::AttributeList& row = fullConfigCursor.currentRow();
463  int fullConfigId = row["CONFKEY"].data<int>();
464  int fullConfigRN = row["RUN" ].data<int>();
465  if ( fullConfigRN ) activeConfigMap.insert(
466  std::pair<int,bool>( fullConfigId, true ) );
467  else activeConfigMap.insert(
468  std::pair<int,bool>( fullConfigId, false ) );
469  std::string fullConfigName = row["NAME"].data<std::string>();
470  }
471 
472 // std::cout << " =============== CCB config list" << std::endl;
473  std::map<int,bool> activeCCBCfgMap;
474  coral::ITable& fullCCBCfgTable =
475  isession->nominalSchema().tableHandle( "CCBRELATIONS" );
476  std::auto_ptr<coral::IQuery>
477  fullCCBCfgQuery( fullCCBCfgTable.newQuery() );
478  fullCCBCfgQuery->addToOutputList( "CONFKEY" );
479  fullCCBCfgQuery->addToOutputList( "CONFCCBKEY" );
480  coral::ICursor& fullCCBCfgCursor = fullCCBCfgQuery->execute();
481  while( fullCCBCfgCursor.next() ) {
482  const coral::AttributeList& row = fullCCBCfgCursor.currentRow();
483  int fullConfigId = row["CONFKEY" ].data<int>();
484  int fullCCBCfgId = row["CONFCCBKEY"].data<int>();
485 // std::map<int,bool>::const_iterator cfgIter =
486 // activeConfigMap.find( fullConfigId );
487  std::map<int,bool>::const_iterator cfgIter;
488  if ( ( cfgIter = activeConfigMap.find( fullConfigId ) )
489  == activeConfigMap.end() ) continue;
490  if ( !( cfgIter->second ) ) continue;
491  if ( activeCCBCfgMap.find( fullCCBCfgId ) ==
492  activeCCBCfgMap.end() )
493  activeCCBCfgMap.insert( std::pair<int,bool>( fullCCBCfgId, true ) );
494  }
495 
496 // std::cout << " =============== config brick list" << std::endl;
497  std::map<int,bool> activeCfgBrkMap;
498  coral::ITable& ccbConfBrkTable =
499  isession->nominalSchema().tableHandle( "CFG2BRKREL" );
500  std::auto_ptr<coral::IQuery>
501  ccbConfBrickQuery( ccbConfBrkTable.newQuery() );
502  ccbConfBrickQuery->addToOutputList( "CONFID" );
503  ccbConfBrickQuery->addToOutputList( "BRKID" );
504  coral::ICursor& ccbConfBrickCursor = ccbConfBrickQuery->execute();
505  while( ccbConfBrickCursor.next() ) {
506  const coral::AttributeList& row = ccbConfBrickCursor.currentRow();
507  int fullCCBCfgId = row["CONFID"].data<int>();
508  int ccbConfBrkId = row["BRKID" ].data<int>();
509 // std::map<int,bool>::const_iterator ccbIter =
510 // activeCCBCfgMap.find( fullCCBCfgId );
511  std::map<int,bool>::const_iterator ccbIter;
512  if ( ( ccbIter = activeCCBCfgMap.find( fullCCBCfgId ) )
513  == activeCCBCfgMap.end() ) continue;
514  if ( !( ccbIter->second ) ) continue;
515  if ( activeCfgBrkMap.find( ccbConfBrkId ) ==
516  activeCfgBrkMap.end() )
517  activeCfgBrkMap.insert( std::pair<int,bool>( ccbConfBrkId, true ) );
518  }
519 
520 // std::cout << " ===============" << std::endl;
521 
522  coral::ITable& brickConfigTable =
523  isession->nominalSchema().tableHandle( "CFGBRICKS" );
524  std::auto_ptr<coral::IQuery>
525  brickConfigQuery( brickConfigTable.newQuery() );
526  brickConfigQuery->addToOutputList( "BRKID" );
527  brickConfigQuery->addToOutputList( "BRKNAME" );
528  coral::ICursor& brickConfigCursor = brickConfigQuery->execute();
529  DTKeyedConfig* brickData = 0;
530  std::vector<int> missingList;
531  std::vector<unsigned long long> checkedKeys;
532  while( brickConfigCursor.next() ) {
533  const coral::AttributeList& row = brickConfigCursor.currentRow();
534  int brickConfigId = row["BRKID"].data<int>();
535  if ( brickConfigId < minBrickId ) continue;
536  if ( brickConfigId > maxBrickId ) continue;
537 // std::map<int,bool>::const_iterator brkIter =
538 // activeCfgBrkMap.find( brickConfigId );
539  std::map<int,bool>::const_iterator brkIter;
540  if ( ( brkIter = activeCfgBrkMap.find( brickConfigId ) )
541  == activeCfgBrkMap.end() ) continue;
542  if ( !( brkIter->second ) ) continue;
543  std::string brickConfigName = row["BRKNAME"].data<std::string>();
544  std::cout << "brick " << brickConfigId
545  << " : " << brickConfigName << std::endl;
546  checkedKeys.push_back( brickConfigId );
547  bool brickFound = false;
548  try {
549  keyList->load( checkedKeys );
550  boost::shared_ptr<DTKeyedConfig> brickCheck = keyList->get<DTKeyedConfig>( 0 );
551  if ( brickCheck.get() ) brickFound =
552  ( brickCheck->getId() == brickConfigId );
553  }
554  catch ( std::exception e ) {
555  }
556  if ( !brickFound ) {
557  std::cout << "brick " << brickConfigId << " missing, copy request"
558  << std::endl;
559  missingList.push_back( brickConfigId );
560  }
561  checkedKeys.clear();
562  }
563  keyList->load( checkedKeys );
564 
565  std::vector<int>::const_iterator brickIter = missingList.begin();
566  std::vector<int>::const_iterator brickIend = missingList.end();
567  while ( brickIter != brickIend ) {
568  int brickConfigId = *brickIter++;
569 // std::cout << "get data for brick: " << brickConfigId << std::endl;
570  coral::AttributeList bindVariableList;
571  bindVariableList.extend( "brickId", typeid(int) );
572  bindVariableList["brickId"].data<int>() = brickConfigId;
573  std::auto_ptr<coral::IQuery>
574  brickDataQuery( isession->nominalSchema().newQuery() );
575  brickDataQuery->addToTableList( "CFGRELATIONS" );
576  brickDataQuery->addToTableList( "CONFIGCMDS" );
578  brickCondition = "CONFIGCMDS.CMDID=CFGRELATIONS.CMDID";
579  brickCondition += " and CFGRELATIONS.BRKID=:brickId";
580  brickDataQuery->addToOutputList( "CFGRELATIONS.BRKID" );
581  brickDataQuery->addToOutputList( "CONFIGCMDS.CONFDATA" );
582  brickDataQuery->setCondition( brickCondition, bindVariableList );
583  coral::ICursor& brickDataCursor = brickDataQuery->execute();
584  brickData = new DTKeyedConfig();
585  brickData->setId( brickConfigId );
586  while( brickDataCursor.next() ) {
587  const coral::AttributeList& row = brickDataCursor.currentRow();
588  brickData->add( row["CONFIGCMDS.CONFDATA"].data<std::string>() );
589  }
590  cond::KeyedElement k( brickData, brickConfigId );
591  std::cout << "now writing brick: " << brickConfigId << std::endl;
592  outdb->writeOne( k.m_obj, k.m_key, brickContainer );
593  }
594 
595  return;
596 
597 }
void add(const std::string &data)
boost::shared_ptr< T > get(size_t n) const
Definition: KeyList.h:39
static cond::persistency::KeyList * keyList
void writeOne(T *payload, Time_t time, const std::string &recordName, bool withlogging=false)
boost::shared_ptr< coral::ISessionProxy > isession
void setId(int id)
tuple cout
Definition: gather_cfg.py:121
void load(const std::vector< unsigned long long > &keys)
Definition: KeyList.cc:14
void DTKeyedConfigHandler::getNewObjects ( )
virtual

Operations

Implements popcon::PopConSourceHandler< DTCCBConfig >.

Definition at line 75 of file DTKeyedConfigHandler.cc.

References DTCCBConfig::appendConfigKey(), DTCCBConfig::begin(), looper::cfg, chkConfigList(), cond::persistency::ConnectionPool::configure(), DTConfigKey::confKey, DTConfigKey::confType, connection, copyData, gather_cfg::cout, cond::persistency::ConnectionPool::createCoralSession(), dataTag, DTCCBConfig::end(), citk::if(), isession, relval_steps::key, prof2calltree::last, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< DTCCBConfig >::lastPayload(), MergeJob_cfg::lastRun, popcon::PopConSourceHandler< DTCCBConfig >::m_to_transfer, maxRunId, minRunId, onlineAuthentication, onlineAuthSys, onlineConnect, DTTTrigCorrFirst::run, sameConfigList(), DTCCBId::sectorId, cond::persistency::ConnectionPool::setAuthenticationPath(), cond::persistency::ConnectionPool::setAuthenticationSystem(), DTCCBConfig::setFullKey(), DTCCBConfig::setStamp(), relativeConstraints::station, DTCCBId::stationId, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< DTCCBConfig >::tagInfo(), and DTCCBId::wheelId.

75  {
76 
77  //to access the information on the tag inside the offline database:
78  cond::TagInfo const & ti = tagInfo();
79  unsigned int last = ti.lastInterval.first;
80  std::cout << "last configuration key already copied for run: "
81  << last << std::endl;
82 
83  std::vector<DTConfigKey> lastKey;
84  std::cout << "check for last " << std::endl;
85  if ( last == 0 ) {
86  DTCCBConfig* dummyConf = new DTCCBConfig( dataTag );
87  dummyConf->setStamp( 0 );
88  dummyConf->setFullKey( lastKey );
89  cond::Time_t snc = 1;
90  std::cout << "write dummy " << std::endl;
91  m_to_transfer.push_back( std::make_pair( dummyConf, snc ) );
92  }
93  else {
94  std::cout << "get last payload" << std::endl;
95  Ref payload = lastPayload();
96  std::cout << "get last full key" << std::endl;
97  lastKey = payload->fullKey();
98  std::cout << "last key: " << std::endl;
99  std::vector<DTConfigKey>::const_iterator keyIter = lastKey.begin();
100  std::vector<DTConfigKey>::const_iterator keyIend = lastKey.end();
101  while ( keyIter != keyIend ) {
102  const DTConfigKey& cfgKeyList = *keyIter++;
103  std::cout << cfgKeyList.confType << " : "
104  << cfgKeyList.confKey << std::endl;
105  }
106  }
107 
108  //to access the information on last successful log entry for this tag:
109 // cond::LogDBEntry const & lde = logDBEntry();
110 
111  //to access the lastest payload (Ref is a smart pointer)
112 // Ref payload = lastPayload();
113 
114  if ( !copyData ) return;
115 
116  unsigned lastRun = last;
117  std::cout << "check for new runs since " << lastRun << std::endl;
118 
119  std::cout << "configure DbConnection" << std::endl;
120  // conn->configure( cond::CmsDefaults );
124  std::cout << "create/open DbSession" << std::endl;
126  std::cout << "start transaction" << std::endl;
127  isession->transaction().start( true );
128 
129  // =========== Update configuration data
130  chkConfigList();
131  // =========== Find latest runs
132  std::cout << "get run config..." << std::endl;
133  std::map<int,std::vector<int>*> runMap;
134  std::map<int,std::vector<DTConfigKey>*> rhcMap;
135  coral::ITable& runHistoryTable =
136  isession->nominalSchema().tableHandle( "RUNHISTORY" );
137  std::auto_ptr<coral::IQuery>
138  runHistoryQuery( runHistoryTable.newQuery() );
139  runHistoryQuery->addToOutputList( "RUN" );
140  runHistoryQuery->addToOutputList( "RHID" );
141  coral::ICursor& runHistoryCursor = runHistoryQuery->execute();
142  while( runHistoryCursor.next() ) {
143  const coral::AttributeList& row = runHistoryCursor.currentRow();
144  int runId = row[ "RUN"].data<int>();
145  int rhcId = static_cast<int>( row["RHID"].data<int>() );
146  // ----------- ignore already copied runs
147  if ( static_cast<unsigned>( runId ) <= lastRun ) continue;
148  // ----------- ignore runs outside required range
149  if ( runId < minRunId ) continue;
150  if ( runId > maxRunId ) continue;
151  std::cout << "schedule config key copy for run "
152  << runId << " ---> RHID " << rhcId << std::endl;
153  // ----------- retrieve or create RH relation list for this run
154  std::vector<int>* rhlPtr = 0;
155  std::map<int,std::vector<int>*>::const_iterator runIter;
156  if ( ( runIter = runMap.find( runId ) ) != runMap.end() )
157  rhlPtr = runIter->second;
158  else runMap.insert( std::pair<int,std::vector<int>*>( runId,
159  rhlPtr = new std::vector<int> ) );
160  // ----------- append RH relation to the list
161  rhlPtr->push_back( rhcId );
162  // ----------- create key list for this RH relation
163  if ( rhcMap.find( rhcId ) == rhcMap.end() )
164  rhcMap.insert( std::pair<int,std::vector<DTConfigKey>*>( rhcId,
165  new std::vector<DTConfigKey> ) );
166  }
167  if ( !runMap.size() ) std::cout << "no new run found" << std::endl;
168 
169  // =========== get ccb identifiers map
170  std::cout << "retrieve CCB map" << std::endl;
171  std::map<int,DTCCBId> ccbMap;
172  coral::ITable& ccbMapTable =
173  isession->nominalSchema().tableHandle( "CCBMAP" );
174  std::auto_ptr<coral::IQuery>
175  ccbMapQuery( ccbMapTable.newQuery() );
176  ccbMapQuery->addToOutputList( "CCBID" );
177  ccbMapQuery->addToOutputList( "WHEEL" );
178  ccbMapQuery->addToOutputList( "SECTOR" );
179  ccbMapQuery->addToOutputList( "STATION" );
180  coral::ICursor& ccbMapCursor = ccbMapQuery->execute();
181  while( ccbMapCursor.next() ) {
182  const coral::AttributeList& row = ccbMapCursor.currentRow();
183  int ccb = row["CCBID" ].data<int>();
184  int wheel = row["WHEEL" ].data<int>();
185  int sector = row["SECTOR" ].data<int>();
186  int station = row["STATION"].data<int>();
187  DTCCBId ccbId;
188  ccbId. wheelId = wheel;
189  ccbId.stationId = station;
190  ccbId. sectorId = sector;
191  ccbMap.insert( std::pair<int,DTCCBId>( ccb, ccbId ) );
192  }
193 
194  // =========== get brick types
195  std::cout << "retrieve brick types" << std::endl;
196  std::map<int,int> bktMap;
197  coral::AttributeList emptyBindVariableList;
198  std::auto_ptr<coral::IQuery>
199  brickTypeQuery( isession->nominalSchema().newQuery() );
200  brickTypeQuery->addToTableList( "CFGBRICKS" );
201  brickTypeQuery->addToTableList( "BRKT2CSETT" );
202  // ----------- join brick type (1-11) to subsystem part (1-6)
203  std::string bTypeCondition = "CFGBRICKS.BRKTYPE=BRKT2CSETT.BRKTYPE";
204  brickTypeQuery->addToOutputList( "CFGBRICKS.BRKID" );
205  brickTypeQuery->addToOutputList( "BRKT2CSETT.CSETTYPE" );
206  brickTypeQuery->setCondition( bTypeCondition, emptyBindVariableList );
207  coral::ICursor& brickTypeCursor = brickTypeQuery->execute();
208  while( brickTypeCursor.next() ) {
209  const coral::AttributeList& row = brickTypeCursor.currentRow();
210  int id = row["CFGBRICKS.BRKID" ].data<int>();
211  int bt = row["BRKT2CSETT.CSETTYPE"].data<short>();
212 // std::cout << "brick " << id << " type " << bt << std::endl;
213 // @@FIX - TEMPORARY PATCH
214 // if ( bt > 3 ) bt = 3;
215  bktMap.insert( std::pair<int,int>( id, bt ) );
216  }
217 
218  // =========== get RH relations
219  std::cout << "retrieve RH relations" << std::endl;
220  std::map<int,int> cfgMap;
221  coral::ITable& rhcRelTable =
222  isession->nominalSchema().tableHandle( "RHRELATIONS" );
223  std::auto_ptr<coral::IQuery>
224  rhcRelQuery( rhcRelTable.newQuery() );
225  rhcRelQuery->addToOutputList( "RHID" );
226  rhcRelQuery->addToOutputList( "CONFKEY" );
227  rhcRelQuery->addToOutputList( "CSETTYPEID" );
228  coral::ICursor& rhcRelCursor = rhcRelQuery->execute();
229  while( rhcRelCursor.next() ) {
230  const coral::AttributeList& row = rhcRelCursor.currentRow();
231  int rhc = row["RHID" ].data<int>();
232  int key = row["CONFKEY" ].data<int>();
233  int cfg = row["CSETTYPEID"].data<int>();
234  // ----------- check for used RH relations, skip unused
235  std::map<int,std::vector<DTConfigKey>*>::iterator rhcIter =
236  rhcMap.find( rhc );
237  std::map<int,std::vector<DTConfigKey>*>::iterator rhcIend =
238  rhcMap.end();
239  if ( rhcIter == rhcIend ) continue;
240  std::vector<DTConfigKey>* keyPtr = rhcIter->second;
241  DTConfigKey confList;
242  confList.confType = cfg;
243  confList.confKey = key;
244  keyPtr->push_back( confList );
245  // ----------- flag config key as used
246  if ( cfgMap.find( cfg ) == cfgMap.end() )
247  cfgMap.insert( std::pair<int,int>( key, rhc ) );
248  }
249 
250  // =========== get ccb config keys
251  std::cout << "retrieve CCB configuration keys" << std::endl;
252  std::map<int,std::map<int,int>*> keyMap;
253  std::map<int,int> cckMap;
254  coral::ITable& ccbRelTable =
255  isession->nominalSchema().tableHandle( "CCBRELATIONS" );
256  std::auto_ptr<coral::IQuery>
257  ccbRelQuery( ccbRelTable.newQuery() );
258  ccbRelQuery->addToOutputList( "CONFKEY" );
259  ccbRelQuery->addToOutputList( "CCBID" );
260  ccbRelQuery->addToOutputList( "CONFCCBKEY" );
261  coral::ICursor& ccbRelCursor = ccbRelQuery->execute();
262  while( ccbRelCursor.next() ) {
263  const coral::AttributeList& row = ccbRelCursor.currentRow();
264  int cfg = row["CONFKEY" ].data<int>();
265  int ccb = row["CCBID" ].data<int>();
266  int key = row["CONFCCBKEY"].data<int>();
267  // ----------- check for used configurations, skip unused
268  if ( cfgMap.find( cfg ) == cfgMap.end() ) continue;
269  // ----------- retrieve or create ccb id-key map for this configuration
270  std::map<int,int>* mapPtr = 0;
271  std::map<int,std::map<int,int>*>::const_iterator keyIter;
272  if ( ( keyIter = keyMap.find( cfg ) ) != keyMap.end() )
273  mapPtr = keyIter->second;
274  else keyMap.insert( std::pair<int,std::map<int,int>*>( cfg,
275  mapPtr = new std::map<int,int> ) );
276 // std::map<int,std::map<int,int>*>::const_iterator keyIter =
277 // keyMap.find( cfg );
278 // std::map<int,std::map<int,int>*>::const_iterator keyIend =
279 // keyMap.end();
280 // if ( keyIter != keyIend ) mapPtr = keyIter->second;
281 // else keyMap.insert(
282 // std::pair<int,std::map<int,int>*>( cfg,
283 // mapPtr = new std::map<int,int> ) );
284  // ----------- store config key for this ccb
285  std::map<int,int>& mapRef( *mapPtr );
286  mapRef.insert( std::pair<int,int>( ccb, key ) );
287  // ----------- flag ccb config key as used
288  if ( cckMap.find( key ) == cckMap.end() )
289  cckMap.insert( std::pair<int,int>( key, ccb ) );
290  }
291 
292  // =========== get brick keys
293  std::cout << "retrieve CCB configuration bricks" << std::endl;
294  std::map<int,std::vector<int>*> brkMap;
295  coral::ITable& confBrickTable =
296  isession->nominalSchema().tableHandle( "CFG2BRKREL" );
297  std::auto_ptr<coral::IQuery>
298  confBrickQuery( confBrickTable.newQuery() );
299  confBrickQuery->addToOutputList( "CONFID" );
300  confBrickQuery->addToOutputList( "BRKID" );
301  coral::ICursor& confBrickCursor = confBrickQuery->execute();
302  while( confBrickCursor.next() ) {
303  const coral::AttributeList& row = confBrickCursor.currentRow();
304  int key = row["CONFID"].data<int>();
305  int brk = row["BRKID" ].data<int>();
306  // ----------- check for used ccb config key, skip unused
307  if ( cckMap.find( key ) == cckMap.end() ) continue;
308 // std::map<int,std::vector<int>*>::const_iterator brkIter =
309 // brkMap.find( key );
310 // std::map<int,std::vector<int>*>::const_iterator brkIend =
311 // brkMap.end();
312  // ----------- retrieve or create brick list for this ccb config
313  std::vector<int>* brkPtr = 0;
314  std::map<int,std::vector<int>*>::const_iterator brkIter;
315 //check for new ccb config key
316  if ( ( brkIter = brkMap.find( key ) ) != brkMap.end() )
317  brkPtr = brkIter->second;
318  else brkMap.insert( std::pair<int,std::vector<int>*>( key,
319  brkPtr = new std::vector<int> ) );
320 // if ( brkIter != brkIend ) brkPtr = brkIter->second;
321 // else brkMap.insert(
322 // std::pair<int,std::vector<int>*>( key,
323 // brkPtr = new std::vector<int> ) );
324  // ----------- store brick key
325  brkPtr->push_back( brk );
326  }
327 
328  // =========== loop over new runs
329  std::map<int,std::vector<int>*>::const_iterator runIter = runMap.begin();
330  std::map<int,std::vector<int>*>::const_iterator runIend = runMap.end();
331  while ( runIter != runIend ) {
332  const std::pair<int,std::vector<int>*>& runEntry = *runIter++;
333  // ----------- get full configuration
334  int run = runEntry.first;
335  std::vector<DTConfigKey> cfl;
336  // ----------- get RH relation list
337  std::vector<int>* rhlPtr = runEntry.second;
338  std::vector<int>::const_iterator rhlIter = rhlPtr->begin();
339  std::vector<int>::const_iterator rhlIend = rhlPtr->end();
340  // ----------- loop over RH relations
341  while ( rhlIter != rhlIend ) {
342  int rhc = *rhlIter++;
343  std::cout << "retrieve configuration bricks for run " << run
344  << " ---> RH " << rhc << std::endl;
345 // std::map<int,std::vector<DTConfigKey>*>::const_iterator
346 // rhcIter = rhcMap.find( rhc );
347 // std::map<int,std::vector<DTConfigKey>*>::const_iterator
348 // rhcIend = rhcMap.end();
349  std::map<int,std::vector<DTConfigKey>*>::const_iterator rhcIter;
350  // ----------- redundant check
351  if ( ( rhcIter = rhcMap.find( rhc ) ) == rhcMap.end() ) continue;
352  std::vector<DTConfigKey>* listPtr = rhcIter->second;
353  // ----------- redundant check
354  if ( listPtr == 0 ) continue;
355  std::vector<DTConfigKey>::const_iterator bkiIter = listPtr->begin();
356  std::vector<DTConfigKey>::const_iterator bkiIend = listPtr->end();
357  while ( bkiIter != bkiIend ) cfl.push_back( *bkiIter++ );
358  }
359  if ( sameConfigList( cfl, lastKey ) ) continue;
360  lastKey = cfl;
361  DTCCBConfig* fullConf = new DTCCBConfig( dataTag );
362  // set run and full configuration in payload
363  fullConf->setStamp( run );
364  fullConf->setFullKey( cfl );
365 
366  std::vector<DTConfigKey>::const_iterator cfgIter = cfl.begin();
367  std::vector<DTConfigKey>::const_iterator cfgIend = cfl.end();
368  while ( cfgIter != cfgIend ) {
369  const DTConfigKey& cfgEntry = *cfgIter++;
370  int cft = cfgEntry.confType;
371  int cfg = cfgEntry.confKey;
372 
373  // =========== retrieve ccb config map
374 // std::map<int,std::map<int,int>*>::const_iterator keyIter =
375 // keyMap.find( cfg );
376 // std::map<int,std::map<int,int>*>::const_iterator keyIend =
377 // keyMap.end();
378  std::map<int,int>* mapPtr = 0;
379  std::map<int,std::map<int,int>*>::const_iterator keyIter;
380  // ----------- redundant check
381 // if ( keyIter != keyIend )
382  if ( ( keyIter = keyMap.find( cfg ) ) != keyMap.end() )
383  mapPtr = keyIter->second;
384  if ( mapPtr == 0 ) continue;
385  std::map<int,int>::const_iterator ccmIter = mapPtr->begin();
386  std::map<int,int>::const_iterator ccmIend = mapPtr->end();
387  while ( ccmIter != ccmIend ) {
388  const std::pair<int,int>& ccmEntry = *ccmIter++;
389  // ----------- get ccb config key
390  int ccb = ccmEntry.first;
391  int key = ccmEntry.second;
392  // retrieve chamber id
393 // std::map<int,DTCCBId>::const_iterator ccbIter = ccbMap.find( ccb );
394 // std::map<int,DTCCBId>::const_iterator ccbIend = ccbMap.end();
395  std::map<int,DTCCBId>::const_iterator ccbIter;
396  // ----------- redundant check
397 // if ( ccbIter == ccbIend ) continue;
398  if ( ( ccbIter = ccbMap.find( ccb ) ) == ccbMap.end() ) continue;
399  const DTCCBId& chaId = ccbIter->second;
400  // ----------- retrieve brick id list
401 // std::map<int,std::vector<int>*>::const_iterator brkIter =
402 // brkMap.find( key );
403 // std::map<int,std::vector<int>*>::const_iterator brkIend =
404 // brkMap.end();
405 // if ( brkIter == brkIend ) continue;
406  std::map<int,std::vector<int>*>::const_iterator brkIter;
407  if ( ( brkIter = brkMap.find( key ) ) == brkMap.end() ) continue;
408  std::vector<int>* brkPtr = brkIter->second;
409  // ----------- redundant check
410  if ( brkPtr == 0 ) continue;
411  // ----------- set brick id lists in payload
412  std::vector<int> bkList;
413  bkList.reserve( 20 );
414 // std::map<int,int>::const_iterator bktIter = bktMap.begin();
415 // std::map<int,int>::const_iterator bktIend = bktMap.end();
416  std::map<int,int>::const_iterator bktIter;
417  std::vector<int>::const_iterator bkiIter = brkPtr->begin();
418  std::vector<int>::const_iterator bkiIend = brkPtr->end();
419  while ( bkiIter != bkiIend ) {
420  int brickId = *bkiIter++;
421 // bktIter = bktMap.find( brickId );
422  // ----------- redundant check
423  if ( ( bktIter = bktMap.find( brickId ) ) == bktMap.end() ) continue;
424  if ( bktIter->second == cft ) bkList.push_back( brickId );
425  }
426  fullConf->appendConfigKey( chaId.wheelId,
427  chaId.stationId,
428  chaId.sectorId,
429  bkList );
430  }
431  }
432  cond::Time_t snc = runEntry.first;
433  m_to_transfer.push_back( std::make_pair( fullConf, snc ) );
434  std::cout << "writing payload : " << sizeof( *fullConf )
435  << " ( " << ( fullConf->end() - fullConf->begin() )
436  << " ) " << std::endl;
437  }
438 
439  isession->transaction().commit();
440 
441  return;
442 
443 }
tuple cfg
Definition: looper.py:293
cond::persistency::ConnectionPool connection
int wheelId
Definition: DTCCBConfig.h:45
void setStamp(int s)
Definition: DTCCBConfig.cc:174
boost::shared_ptr< coral::ISessionProxy > createCoralSession(const std::string &connectionString, bool writeCapable=false)
const_iterator end() const
Definition: DTCCBConfig.cc:291
int sectorId
Definition: DTCCBConfig.h:47
cond::ValidityInterval lastInterval
Definition: Types.h:75
unsigned long long Time_t
Definition: Time.h:16
int stationId
Definition: DTCCBConfig.h:46
void setAuthenticationSystem(int authSysCode)
static bool sameConfigList(const std::vector< DTConfigKey > &cfgl, const std::vector< DTConfigKey > &cfgr)
if(c.getParameter< edm::InputTag >("puppiValueMap").label().size()!=0)
boost::shared_ptr< coral::ISessionProxy > isession
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
tuple cout
Definition: gather_cfg.py:121
void setFullKey(const std::vector< DTConfigKey > &)
Definition: DTCCBConfig.cc:169
const_iterator begin() const
Definition: DTCCBConfig.cc:286
void setAuthenticationPath(const std::string &p)
int appendConfigKey(int wheelId, int stationId, int sectorId, const std::vector< int > &confKey)
Definition: DTCCBConfig.cc:238
cond::TagInfo_t const & tagInfo() const
std::string DTKeyedConfigHandler::id ( ) const
virtual

Implements popcon::PopConSourceHandler< DTCCBConfig >.

Definition at line 600 of file DTKeyedConfigHandler.cc.

References dataTag.

600  {
601  return dataTag;
602 }
bool DTKeyedConfigHandler::sameConfigList ( const std::vector< DTConfigKey > &  cfgl,
const std::vector< DTConfigKey > &  cfgr 
)
staticprivate

Definition at line 605 of file DTKeyedConfigHandler.cc.

References DTConfigKey::confKey, and DTConfigKey::confType.

Referenced by getNewObjects().

607  {
608  if ( cfgl.size() != cfgr.size() ) return false;
609  std::map<int,int> lmap;
610  std::vector<DTConfigKey>::const_iterator lIter = cfgl.begin();
611  std::vector<DTConfigKey>::const_iterator lIend = cfgl.end();
612  while ( lIter != lIend ) {
613  const DTConfigKey& entry = *lIter++;
614  lmap.insert( std::pair<int,int>( entry.confType, entry.confKey ) );
615  }
616  std::map<int,int> rmap;
617  std::vector<DTConfigKey>::const_iterator rIter = cfgr.begin();
618  std::vector<DTConfigKey>::const_iterator rIend = cfgr.end();
619  while ( rIter != rIend ) {
620  const DTConfigKey& entry = *rIter++;
621  rmap.insert( std::pair<int,int>( entry.confType, entry.confKey ) );
622  }
623  std::map<int,int>::const_iterator lmIter = lmap.begin();
624  std::map<int,int>::const_iterator lmIend = lmap.end();
625  std::map<int,int>::const_iterator rmIter = rmap.begin();
626  std::map<int,int>::const_iterator rmIend = rmap.end();
627  while ( ( lmIter != lmIend ) &&
628  ( rmIter != rmIend ) ) {
629  const std::pair<int,int>& lEntry = *lmIter++;
630  const std::pair<int,int>& rEntry = *rmIter++;
631  if ( lEntry.first != rEntry.first ) return false;
632  if ( lEntry.second != rEntry.second ) return false;
633  }
634  return true;
635 }
void DTKeyedConfigHandler::setList ( cond::persistency::KeyList list)
static

Definition at line 638 of file DTKeyedConfigHandler.cc.

References keyList, and list().

Referenced by DTKeyedConfigPopConAnalyzer::analyze().

638  {
639  keyList = list;
640 }
static cond::persistency::KeyList * keyList
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Data Documentation

std::string DTKeyedConfigHandler::brickContainer
private

Definition at line 78 of file DTKeyedConfigHandler.h.

Referenced by chkConfigList().

DTCCBConfig* DTKeyedConfigHandler::ccbConfig
private

Definition at line 79 of file DTKeyedConfigHandler.h.

cond::persistency::ConnectionPool DTKeyedConfigHandler::connection
private

Definition at line 81 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().

bool DTKeyedConfigHandler::copyData
private

Definition at line 68 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().

std::string DTKeyedConfigHandler::dataTag
private

Definition at line 74 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects(), and id().

boost::shared_ptr<coral::ISessionProxy> DTKeyedConfigHandler::isession
private

Definition at line 82 of file DTKeyedConfigHandler.h.

Referenced by chkConfigList(), and getNewObjects().

cond::persistency::KeyList * DTKeyedConfigHandler::keyList = 0
staticprivate

Definition at line 87 of file DTKeyedConfigHandler.h.

Referenced by chkConfigList(), and setList().

int DTKeyedConfigHandler::maxBrickId
private

Definition at line 70 of file DTKeyedConfigHandler.h.

Referenced by chkConfigList().

int DTKeyedConfigHandler::maxRunId
private

Definition at line 72 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().

int DTKeyedConfigHandler::minBrickId
private

Definition at line 69 of file DTKeyedConfigHandler.h.

Referenced by chkConfigList().

int DTKeyedConfigHandler::minRunId
private

Definition at line 71 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().

std::string DTKeyedConfigHandler::onlineAuthentication
private

Definition at line 76 of file DTKeyedConfigHandler.h.

Referenced by DTKeyedConfigHandler(), and getNewObjects().

int DTKeyedConfigHandler::onlineAuthSys
private

Definition at line 77 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().

std::string DTKeyedConfigHandler::onlineConnect
private

Definition at line 75 of file DTKeyedConfigHandler.h.

Referenced by getNewObjects().