CMS 3D CMS Logo

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

#include <RPCEMapSourceHandler.h>

Inheritance diagram for popcon::RPCEMapSourceHandler:
popcon::PopConSourceHandler< RPCEMap >

Classes

struct  FEBStruct
 

Public Member Functions

int Compare2EMaps (const Ref &map1, RPCEMap *map2)
 
void ConnectOnlineDB (std::string connect, std::string authPath)
 
void DisconnectOnlineDB ()
 
void getNewObjects () override
 
std::string id () const override
 
void readEMap1 ()
 
 RPCEMapSourceHandler (const edm::ParameterSet &ps)
 
 ~RPCEMapSourceHandler () override
 
- Public Member Functions inherited from popcon::PopConSourceHandler< RPCEMap >
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 Member Functions

std::string IntToString (int num)
 

Private Attributes

RPCEMapeMap
 
std::string m_authpath
 
std::string m_connect
 
int m_dummy
 
std::string m_name
 
int m_validate
 
cond::persistency::Session session
 

Additional Inherited Members

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

Detailed Description

Definition at line 44 of file RPCEMapSourceHandler.h.

Constructor & Destructor Documentation

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

Definition at line 7 of file RPCEMapSourceHandler.cc.

7  :
8  m_name(ps.getUntrackedParameter<std::string>("name","RPCEMapSourceHandler")),
9  m_dummy(ps.getUntrackedParameter<int>("WriteDummy",0)),
10  m_validate(ps.getUntrackedParameter<int>("Validate",0)),
11  m_connect(ps.getUntrackedParameter<std::string>("OnlineConn","")),
12  m_authpath(ps.getUntrackedParameter<std::string>("OnlineAuthPath","."))
13 {
14 }
T getUntrackedParameter(std::string const &, T const &) const
popcon::RPCEMapSourceHandler::~RPCEMapSourceHandler ( )
override

Definition at line 16 of file RPCEMapSourceHandler.cc.

17 {
18 }

Member Function Documentation

int popcon::RPCEMapSourceHandler::Compare2EMaps ( const Ref &  map1,
RPCEMap map2 
)

Definition at line 377 of file RPCEMapSourceHandler.cc.

References RPCEMap::convert(), RPCReadOutMapping::dccList(), RPCReadOutMapping::dccNumberRange(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getNewObjects(), and id().

377  {
378  const Ref& map1 = _map1;
379  RPCReadOutMapping const* oldmap1 = map1->convert();
380  RPCReadOutMapping const* oldmap2 = map2->convert();
381  std::vector<const DccSpec *> dccs1 = oldmap1->dccList();
382  std::vector<const DccSpec *> dccs2 = oldmap2->dccList();
383  if(dccs1.size()!=dccs2.size()) {
384  return 1;
385  }
386  std::pair<int,int> dccRange1 = oldmap1->dccNumberRange();
387  std::pair<int,int> dccRange2 = oldmap2->dccNumberRange();
388  if(dccRange1.first!=dccRange2.first) {
389  return 1;
390  }
391  if(dccRange1.second!=dccRange2.second) {
392  return 1;
393  }
394  typedef std::vector<const DccSpec *>::const_iterator IDCC;
395  IDCC idcc2 = dccs2.begin();
396  for (IDCC idcc1 = dccs1.begin(); idcc1 != dccs1.end(); idcc1++) {
397  int dccNo = (**idcc1).id();
398  std::string dccContents = (**idcc1).print(4);
399  if ((**idcc2).id()!=dccNo) {
400  return 1;
401  }
402  if ((**idcc2).print(4)!=dccContents) {
403  return 1;
404  }
405  idcc2++;
406  }
407  return 0;
408 }
std::vector< const DccSpec * > dccList() const
all FEDs in map
std::pair< int, int > dccNumberRange() const
Range of FED IDs in map (min and max id)
RPCReadOutMapping const * convert() const
Definition: RPCEMap.h:67
void popcon::RPCEMapSourceHandler::ConnectOnlineDB ( std::string  connect,
std::string  authPath 
)

Definition at line 66 of file RPCEMapSourceHandler.cc.

References cond::persistency::ConnectionPool::configure(), gather_cfg::cout, cond::persistency::ConnectionPool::createSession(), session, and cond::persistency::ConnectionPool::setAuthenticationPath().

Referenced by getNewObjects(), and id().

67 {
69  std::cout << "RPCEMapConfigSourceHandler: connecting to " << connect << "..." << std::flush;
70  connection.setAuthenticationPath( authPath ) ;
71  connection.configure();
72  session = connection.createSession( connect,true );
73  std::cout << "Done." << std::endl;
74 }
Session createSession(const std::string &connectionString, bool writeCapable=false)
cond::persistency::Session session
edm::Handle< T > connect(const T *&ptr, edm::EDGetTokenT< T > token, const edm::Event &evt)
void setAuthenticationPath(const std::string &p)
void popcon::RPCEMapSourceHandler::DisconnectOnlineDB ( )

Definition at line 76 of file RPCEMapSourceHandler.cc.

References cond::persistency::Session::close(), and session.

Referenced by getNewObjects(), and id().

77 {
78  session.close();
79 }
cond::persistency::Session session
void popcon::RPCEMapSourceHandler::getNewObjects ( )
overridevirtual

Implements popcon::PopConSourceHandler< RPCEMap >.

Definition at line 20 of file RPCEMapSourceHandler.cc.

References edmScanValgrind::buffer, Compare2EMaps(), ConnectOnlineDB(), gather_cfg::cout, cond::service::PoolDBOutputService::currentTime(), DisconnectOnlineDB(), eMap, cond::TagInfo_t::lastInterval, popcon::PopConSourceHandler< RPCEMap >::lastPayload(), m_authpath, m_connect, m_dummy, popcon::PopConSourceHandler< RPCEMap >::m_to_transfer, m_validate, cond::TagInfo_t::name, jetCorrFactors_cfi::payload, plotBeamSpotDB::ptm, readEMap1(), cond::TagInfo_t::size, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, popcon::PopConSourceHandler< RPCEMap >::tagInfo(), and ntuplemaker::time.

21 {
22 
23 // std::cout << "RPCEMapSourceHandler: RPCEMapSourceHandler::getNewObjects begins\n";
24 
26 
27 // first check what is already there in offline DB
28  Ref payload;
29  if(m_validate==1 && tagInfo().size>0) {
30  std::cout<<" Validation was requested, so will check present contents"<<std::endl;
31  std::cout<<"Name of tag : "<<tagInfo().name << ", tag size : " << tagInfo().size
32  << ", last object valid since "
33  << tagInfo().lastInterval.first << std::endl;
34  payload = lastPayload();
35  }
36 
37 // now construct new cabling map from online DB
38  time_t rawtime;
39  time(&rawtime); //time since January 1, 1970
40  tm * ptm = gmtime(&rawtime);//GMT time
41  char buffer[20];
42  strftime(buffer,20,"%d/%m/%Y_%H:%M:%S",ptm);
43  std::string eMap_version=(std::string)buffer;
44 
45  eMap = new RPCEMap(eMap_version);
46  if (m_dummy==0) {
48  readEMap1();
50  }
51 
52  cond::Time_t snc=mydbservice->currentTime();
53 
54 // look for recent changes
55  int difference=1;
56  if (m_validate==1) difference=Compare2EMaps(payload,eMap);
57  if (!difference) std::cout<<"No changes - will not write anything!!!"<<std::endl;
58  if (difference==1) {
59  std::cout<<"Will write new object to offline DB!!!"<<std::endl;
60  m_to_transfer.push_back(std::make_pair((RPCEMap*)eMap,snc));
61  }
62 
63 // std::cout << "RPCEMapSourceHandler: RPCEMapSourceHandler::getNewObjects ends\n";
64 }
size
Write out results.
void ConnectOnlineDB(std::string connect, std::string authPath)
size_t size
Definition: Types.h:77
std::string name
Definition: Types.h:73
cond::ValidityInterval lastInterval
Definition: Types.h:75
payload
payload postfix for testing
unsigned long long Time_t
Definition: Time.h:16
int Compare2EMaps(const Ref &map1, RPCEMap *map2)
cond::TagInfo_t const & tagInfo() const
std::string popcon::RPCEMapSourceHandler::id ( ) const
inlineoverridevirtual
std::string popcon::RPCEMapSourceHandler::IntToString ( int  num)
inlineprivate

Definition at line 67 of file RPCEMapSourceHandler.h.

Referenced by readEMap1().

68  {
69  std::stringstream snum;
70  snum << num << std::flush;
71  return(snum.str());
72  }
void popcon::RPCEMapSourceHandler::readEMap1 ( )

Definition at line 81 of file RPCEMapSourceHandler.cc.

References patPFMETCorrections_cff::algo, popcon::RPCEMapSourceHandler::FEBStruct::chamberId, popcon::RPCEMapSourceHandler::FEBStruct::cmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::connectorId, gather_cfg::cout, eMap, popcon::RPCEMapSourceHandler::FEBStruct::febId, plotBeamSpotDB::first, mps_fire::i, IntToString(), popcon::RPCEMapSourceHandler::FEBStruct::lbInputNum, popcon::RPCEMapSourceHandler::FEBStruct::localEtaPart, RPCEMap::lbItem::nFebs, RPCEMap::linkItem::nLBs, RPCEMap::tbItem::nLinks, cond::persistency::Session::nominalSchema(), RPCEMap::dccItem::nTBs, popcon::RPCEMapSourceHandler::FEBStruct::posInCmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::posInLocalEtaPart, dataDML::schema, session, cond::persistency::Transaction::start(), AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, RPCEMap::febItem::theAlgo, RPCEMap::febItem::theChamber, RPCEMap::lbItem::theCode, RPCEMap::theDccs, RPCEMap::theFebs, RPCEMap::dccItem::theId, RPCEMap::theLBs, RPCEMap::febItem::theLinkBoardInputNum, RPCEMap::lbItem::theLinkBoardNumInLink, RPCEMap::theLinks, RPCEMap::lbItem::theMaster, RPCEMap::tbItem::theNum, RPCEMap::febItem::thePartition, RPCEMap::theTBs, RPCEMap::linkItem::theTriggerBoardInputNumber, cond::persistency::Session::transaction(), and makeMuonMisalignmentScenario::wheel.

Referenced by getNewObjects(), and id().

82 {
83  session.transaction().start( true );
84  coral::ISchema& schema = session.nominalSchema();
85  std::string condition="";
86  coral::AttributeList conditionData;
87 
88  std::cout << std::endl <<"RPCEMapSourceHandler: start to build RPC e-Map..." << std::flush << std::endl << std::endl;
89 
90  // Get FEDs
91  RPCEMap::dccItem thisDcc;
92  coral::IQuery* query1 = schema.newQuery();
93  query1->addToTableList( "DCCBOARD" );
94  query1->addToOutputList("DCCBOARD.DCCBOARDID","DCCBOARDID");
95  query1->addToOutputList("DCCBOARD.FEDNUMBER","FEDNUMBER");
96  query1->addToOrderList("FEDNUMBER");
97  condition = "DCCBOARD.DCCBOARDID>0";
98  query1->setCondition( condition, conditionData );
99 // std::cout<<"Getting DCCBOARD...";
100  coral::ICursor& cursor1 = query1->execute();
101  std::cout<<"OK"<<std::endl;
102  std::pair<int,int> tmp_tbl;
103  std::vector< std::pair<int,int> > theDAQ;
104  while ( cursor1.next() ) {
105 // cursor1.currentRow().toOutputStream( std::cout ) << std::endl;
106  const coral::AttributeList& row = cursor1.currentRow();
107  tmp_tbl.first=row["DCCBOARDID"].data<long long>();
108  tmp_tbl.second=row["FEDNUMBER"].data<long long>();
109  theDAQ.push_back(tmp_tbl);
110  }
111  delete query1;
112 
113  for(unsigned int iFED=0;iFED<theDAQ.size();iFED++) {
114  thisDcc.theId=theDAQ[iFED].second;
115  std::vector<std::pair<int,int> > theTB;
116 // get TBs
117  RPCEMap::tbItem thisTB;
118  coral::IQuery* query2 = schema.newQuery();
119  query2->addToTableList( "TRIGGERBOARD" );
120  query2->addToOutputList("TRIGGERBOARD.TRIGGERBOARDID","TRIGGERBOARDID");
121  query2->addToOutputList("TRIGGERBOARD.DCCINPUTCHANNELNUM","DCCCHANNELNUM");
122  query2->addToOrderList("DCCCHANNELNUM");
123  condition = "TRIGGERBOARD.DCCBOARD_DCCBOARDID="+IntToString(theDAQ[iFED].first);
124  query2->setCondition( condition, conditionData );
125  coral::ICursor& cursor2 = query2->execute();
126  int ntbs=0;
127  while ( cursor2.next() ) {
128  ntbs++;
129 // cursor2.currentRow().toOutputStream( std::cout ) << std::endl;
130  const coral::AttributeList& row = cursor2.currentRow();
131  tmp_tbl.first=row["TRIGGERBOARDID"].data<long long>();
132  tmp_tbl.second=row["DCCCHANNELNUM"].data<long long>();
133  theTB.push_back(tmp_tbl);
134  }
135  delete query2;
136  for(unsigned int iTB=0;iTB<theTB.size();iTB++) {
137  thisTB.theNum=theTB[iTB].second;
138  std::vector<std::pair<int,int> > theLink;
139 // get links
140  RPCEMap::linkItem thisLink;
141  coral::IQuery* query3 = schema.newQuery();
142  query3->addToTableList("BOARDBOARDCONN");
143  query3->addToOutputList("BOARDBOARDCONN.BOARD_BOARDID","BOARDID");
144  query3->addToOutputList("BOARDBOARDCONN.COLLECTORBOARDINPUTNUM","TBINPUTNUM");
145  query3->addToOrderList("TBINPUTNUM");
146  condition = "BOARDBOARDCONN.BOARD_COLLECTORBOARDID="+IntToString(theTB[iTB].first);
147  query3->setCondition( condition, conditionData );
148  coral::ICursor& cursor3 = query3->execute();
149  int nlinks=0;
150  while (cursor3.next()) {
151  nlinks++;
152  const coral::AttributeList& row = cursor3.currentRow();
153  tmp_tbl.first=row["BOARDID"].data<long long>();
154  tmp_tbl.second=row["TBINPUTNUM"].data<long long>();
155  theLink.push_back(tmp_tbl);
156  }
157  delete query3;
158  for(unsigned int iLink=0;iLink<theLink.size();iLink++) {
159  int boardId=theLink[iLink].first;
160  thisLink.theTriggerBoardInputNumber=theLink[iLink].second;
161  std::vector<std::pair<int,std::string> > theLB;
162  std::pair<int,std::string> tmpLB;
163  // Get master LBs first...
164  RPCEMap::lbItem thisLB;
165  coral::IQuery* query4 = schema.newQuery();
166  query4->addToTableList("BOARD");
167  query4->addToOutputList("BOARD.NAME","NAME");
168  condition = "BOARD.BOARDID="+IntToString(theLink[iLink].first);
169  query4->setCondition( condition, conditionData );
170  coral::ICursor& cursor4 = query4->execute();
171  int nlbs=0;
172  while (cursor4.next()) {
173  nlbs++;
174  const coral::AttributeList& row = cursor4.currentRow();
175  tmpLB.first=theLink[iLink].first;
176  tmpLB.second=row["NAME"].data<std::string>();
177  theLB.push_back(tmpLB);
178  }
179  delete query4;
180  // then slaves
181  coral::IQuery* query5 = schema.newQuery();
182  query5->addToTableList("LINKBOARD");
183  query5->addToTableList("BOARD");
184  query5->addToOutputList("LINKBOARD.LINKBOARDID","LINKBOARDID");
185  query5->addToOutputList("BOARD.NAME","NAME");
186  query5->addToOrderList("LINKBOARDID");
187  condition = "LINKBOARD.MASTERID="+IntToString(theLink[iLink].first)+" AND BOARD.BOARDID=LINKBOARD.LINKBOARDID AND LINKBOARD.MASTERID<>LINKBOARD.LINKBOARDID";
188  query5->setCondition( condition, conditionData );
189  coral::ICursor& cursor5 = query5->execute();
190  while (cursor5.next()) {
191  nlbs++;
192  const coral::AttributeList& row = cursor5.currentRow();
193  tmpLB.first=row["LINKBOARDID"].data<long long>();
194  tmpLB.second=row["NAME"].data<std::string>();
195  theLB.push_back(tmpLB);
196  }
197  delete query5;
198  for(unsigned int iLB=0; iLB<theLB.size(); iLB++) {
199  thisLB.theMaster = (theLB[iLB].first==boardId);
200 // extract all relevant information from BOARD.NAME
201  std::string theName = theLB[iLB].second;
202  int slength = theName.length();
203  thisLB.theLinkBoardNumInLink=atoi((theName.substr(slength-1,1)).c_str());
204  int wheel=atoi((theName.substr(6,1)).c_str());
205  std::string char1=theName.substr(4,1);
206  std::string char2=theName.substr(slength-7,1);
207  int num3=atoi((theName.substr(slength-6,1)).c_str());
208  std::string char4=theName.substr(slength-5,1);
209  bool itsS1to9=(theName.substr(slength-11,1)=="S");
210  int n1=10;
211  int n2=1;
212  int n3=0;
213  if (!itsS1to9) {
214  n1=11;
215  n2=2;
216  }
217  int sector=atoi((theName.substr(slength-n1,n2)).c_str());
218  std::string char1Val[2]={"B","E"}; // 1,2
219  std::string char2Val[3]={"N","M","P"}; // 0,1,2
220  std::string char4Val[9]={"0","1","2","3","A","B","C","D","E"}; // 0,...,8
221  for (int i=0; i<2; i++) if (char1==char1Val[i]) n1=i+1;
222  for (int i=0; i<3; i++) if (char2==char2Val[i]) n2=i;
223  for (int i=0; i<9; i++) if (char4==char4Val[i]) n3=i;
224  thisLB.theCode=n3+num3*10+n2*100+n1*1000+wheel*10000+sector*100000;
225  FEBStruct tmpFEB;
226  std::vector<FEBStruct> theFEB;
227 // get FEBs
228  RPCEMap::febItem thisFeb;
229  coral::IQuery* query6 = schema.newQuery();
230  query6->addToTableList("FEBLOCATION");
231  query6->addToTableList("FEBCONNECTOR");
232  query6->addToOutputList("FEBLOCATION.FEBLOCATIONID","FEBLOCATIONID");
233  query6->addToOutputList("FEBLOCATION.CL_CHAMBERLOCATIONID","CHAMBERLOCATIONID");
234  query6->addToOutputList("FEBCONNECTOR.FEBCONNECTORID","FEBCONNECTORID");
235  query6->addToOutputList("FEBLOCATION.FEBLOCALETAPARTITION","LOCALETAPART");
236  query6->addToOutputList("FEBLOCATION.POSINLOCALETAPARTITION","POSINLOCALETAPART");
237  query6->addToOutputList("FEBLOCATION.FEBCMSETAPARTITION","CMSETAPART");
238  query6->addToOutputList("FEBLOCATION.POSINCMSETAPARTITION","POSINCMSETAPART");
239  query6->addToOutputList("FEBCONNECTOR.LINKBOARDINPUTNUM","LINKBOARDINPUTNUM");
240  query6->addToOrderList("FEBLOCATIONID");
241  query6->addToOrderList("FEBCONNECTORID");
242  condition = "FEBLOCATION.LB_LINKBOARDID="+IntToString(theLB[iLB].first)+" AND FEBLOCATION.FEBLOCATIONID=FEBCONNECTOR.FL_FEBLOCATIONID";
243  query6->setCondition( condition, conditionData );
244  coral::ICursor& cursor6 = query6->execute();
245  int nfebs=0;
246  while (cursor6.next()) {
247  nfebs++;
248  const coral::AttributeList& row = cursor6.currentRow();
249  tmpFEB.febId=row["FEBLOCATIONID"].data<long long>();
250  tmpFEB.chamberId=row["CHAMBERLOCATIONID"].data<long long>();
251  tmpFEB.connectorId=row["FEBCONNECTORID"].data<long long>();
252  tmpFEB.localEtaPart=row["LOCALETAPART"].data<std::string>();
253  tmpFEB.posInLocalEtaPart=row["POSINLOCALETAPART"].data<short>();
254  tmpFEB.cmsEtaPart=row["CMSETAPART"].data<std::string>();
255  tmpFEB.posInCmsEtaPart=row["POSINCMSETAPART"].data<short>();
256  tmpFEB.lbInputNum=row["LINKBOARDINPUTNUM"].data<short>();
257  theFEB.push_back(tmpFEB);
258  }
259  delete query6;
260  for(unsigned int iFEB=0; iFEB<theFEB.size(); iFEB++) {
261  std::string temp=theFEB[iFEB].localEtaPart;
262  std::string localEtaVal[6]={"Forward","Central","Backward","A","B","C"};
263  char localEtaPartition=0;
264  for (int i=0; i<6; i++) if (temp==localEtaVal[i]) localEtaPartition=i+1;
265  char positionInLocalEtaPartition=theFEB[iFEB].posInLocalEtaPart;
266  temp=theFEB[iFEB].cmsEtaPart;
267  std::string cmsEtaVal[6]={"1","2","3","A","B","C"};
268  char cmsEtaPartition=0;
269  for (int i=0; i<6; i++) if (temp==cmsEtaVal[i]) cmsEtaPartition=i+1;
270  char positionInCmsEtaPartition=theFEB[iFEB].posInCmsEtaPart;
271  thisFeb.thePartition=positionInLocalEtaPartition+10*localEtaPartition+100*positionInCmsEtaPartition+1000*cmsEtaPartition;
272  thisFeb.theLinkBoardInputNum=theFEB[iFEB].lbInputNum;
273  // Get chamber
274  coral::IQuery* query7 = schema.newQuery();
275  query7->addToTableList("CHAMBERLOCATION");
276  query7->addToOutputList("CHAMBERLOCATION.DISKORWHEEL","DISKORWHEEL");
277  query7->addToOutputList("CHAMBERLOCATION.LAYER","LAYER");
278  query7->addToOutputList("CHAMBERLOCATION.SECTOR","SECTOR");
279  query7->addToOutputList("CHAMBERLOCATION.SUBSECTOR","SUBSECTOR");
280  query7->addToOutputList("CHAMBERLOCATION.CHAMBERLOCATIONNAME","NAME");
281  query7->addToOutputList("CHAMBERLOCATION.FEBZORNT","FEBZORNT");
282  query7->addToOutputList("CHAMBERLOCATION.FEBRADORNT","FEBRADORNT");
283  query7->addToOutputList("CHAMBERLOCATION.BARRELORENDCAP","BARRELORENDCAP");
284  condition = "CHAMBERLOCATION.CHAMBERLOCATIONID="+IntToString(theFEB[iFEB].chamberId);
285  query7->setCondition( condition, conditionData );
286  coral::ICursor& cursor7 = query7->execute();
287  while (cursor7.next()) {
288  const coral::AttributeList& row = cursor7.currentRow();
289  char diskOrWheel=row["DISKORWHEEL"].data<short>()+3;
290  char layer=row["LAYER"].data<short>();
291  int sector=row["SECTOR"].data<short>();
292  temp=row["SUBSECTOR"].data<std::string>();
293 // TEMPORARY TO CORRECT A LITTLE BUG IN OMDS
294 // std::string chname=row["NAME"].data<std::string>();
295 // if (layer==6 && (sector==9 || sector==11)) {
296 // if (temp=="+") {
297 // temp="";
298 // std::cout<<"Changed subsector + to null for "<<chname<<std::endl;
299 // }
300 // }
301 
302  std::string subsVal[5]={"--","-","","+","++"};
303  char subsector=0;
304  for (int i=0; i<5; i++) if (temp==subsVal[i]) subsector=i;
305  temp=row["FEBZORNT"].data<std::string>();
306  char febZOrnt=0;
307  if (temp=="+z") febZOrnt=1;
308  temp=row["FEBRADORNT"].data<std::string>();
309  char febZRadOrnt=0;
310  std::string febZRVal[3]={"","IN","OUT"};
311  for (int i=0; i<3; i++) if (temp==febZRVal[i]) febZRadOrnt=i;
312  temp=row["BARRELORENDCAP"].data<std::string>();
313  char barrelOrEndcap=0;
314  if (temp=="Barrel") barrelOrEndcap=1;
315  thisFeb.theChamber=sector+100*subsector+1000*febZRadOrnt+5000*febZOrnt+10000*diskOrWheel+100000*layer+1000000*barrelOrEndcap;
316  }
317  delete query7;
318  // Get Strips
319  coral::IQuery* query8 = schema.newQuery();
320  query8->addToTableList("CHAMBERSTRIP");
321  query8->addToOutputList("CHAMBERSTRIP.CABLECHANNELNUM","CABLECHANNELNUM");
322  query8->addToOutputList("CHAMBERSTRIP.CHAMBERSTRIPNUMBER","CHAMBERSTRIPNUM");
323 // query8->addToOutputList("CHAMBERSTRIP.CMSSTRIPNUMBER","CMSSTRIPNUM");
324  query8->addToOrderList("CABLECHANNELNUM");
325  condition = "CHAMBERSTRIP.FC_FEBCONNECTORID="+IntToString(theFEB[iFEB].connectorId);
326  query8->setCondition( condition, conditionData );
327  coral::ICursor& cursor8 = query8->execute();
328 // NEW: do not store all the strip information as goes, only the minimum data needed to
329 // reproduce it later on
330  int nstrips=0;
331  int firstChamberStrip=0;
332  int firstPin=0;
333  int lastChamberStrip=0;
334  int lastPin=0;
335  while (cursor8.next()) {
336  const coral::AttributeList& row = cursor8.currentRow();
337  lastChamberStrip=row["CHAMBERSTRIPNUM"].data<int>();
338  lastPin=row["CABLECHANNELNUM"].data<short>();
339  if (nstrips==0) {
340  firstChamberStrip=lastChamberStrip;
341  firstPin=lastPin;
342  }
343  nstrips++;
344  }
345  delete query8;
346  int algo = -1;
347  if (firstPin == 1 && lastPin == nstrips)
348  { algo = 1; }
349  else if (firstPin == 2 && lastPin == nstrips+1)
350  { algo = 2; }
351  else if (firstPin == 3 && lastPin == nstrips+2)
352  { algo = 3; }
353  else if (firstPin == 2 && lastPin == nstrips+2)
354  { algo = 0;}
355  else
356  { std::cout<<" Unknown algo : "<<firstPin<<" "<<lastPin<<std::endl; }
357  if ((lastPin-firstPin)*(lastChamberStrip-firstChamberStrip) < 0) algo=algo+4;
358  thisFeb.theAlgo=algo+100*firstChamberStrip+10000*nstrips;
359  eMap->theFebs.push_back(thisFeb);
360  }
361  thisLB.nFebs=nfebs;
362  eMap->theLBs.push_back(thisLB);
363  }
364  thisLink.nLBs=nlbs;
365  eMap->theLinks.push_back(thisLink);
366  }
367  thisTB.nLinks=nlinks;
368  eMap->theTBs.push_back(thisTB);
369  }
370  thisDcc.nTBs=ntbs;
371  std::cout<<"DCC added"<<std::endl;
372  eMap->theDccs.push_back(thisDcc);
373  }
374  std::cout << std::endl <<"Building RPC e-Map done!" << std::flush << std::endl << std::endl;
375 }
int theTriggerBoardInputNumber
Definition: RPCEMap.h:37
int theLinkBoardInputNum
Definition: RPCEMap.h:53
std::string IntToString(int num)
std::vector< tbItem > theTBs
Definition: RPCEMap.h:62
void start(bool readOnly=true)
Definition: Session.cc:22
Transaction & transaction()
Definition: Session.cc:66
int theLinkBoardNumInLink
Definition: RPCEMap.h:44
std::vector< dccItem > theDccs
Definition: RPCEMap.h:61
std::vector< febItem > theFebs
Definition: RPCEMap.h:65
coral::ISchema & nominalSchema()
Definition: Session.cc:233
int thePartition
Definition: RPCEMap.h:54
std::vector< linkItem > theLinks
Definition: RPCEMap.h:63
cond::persistency::Session session
bool theMaster
Definition: RPCEMap.h:43
std::vector< lbItem > theLBs
Definition: RPCEMap.h:64

Member Data Documentation

RPCEMap* popcon::RPCEMapSourceHandler::eMap
private

Definition at line 58 of file RPCEMapSourceHandler.h.

Referenced by getNewObjects(), and readEMap1().

std::string popcon::RPCEMapSourceHandler::m_authpath
private

Definition at line 64 of file RPCEMapSourceHandler.h.

Referenced by getNewObjects().

std::string popcon::RPCEMapSourceHandler::m_connect
private

Definition at line 63 of file RPCEMapSourceHandler.h.

Referenced by getNewObjects().

int popcon::RPCEMapSourceHandler::m_dummy
private

Definition at line 61 of file RPCEMapSourceHandler.h.

Referenced by getNewObjects().

std::string popcon::RPCEMapSourceHandler::m_name
private

Definition at line 60 of file RPCEMapSourceHandler.h.

Referenced by id().

int popcon::RPCEMapSourceHandler::m_validate
private

Definition at line 62 of file RPCEMapSourceHandler.h.

Referenced by getNewObjects().

cond::persistency::Session popcon::RPCEMapSourceHandler::session
private

Definition at line 59 of file RPCEMapSourceHandler.h.

Referenced by ConnectOnlineDB(), DisconnectOnlineDB(), and readEMap1().