CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
std::string id () const
 
void readEMap1 ()
 
 RPCEMapSourceHandler (const edm::ParameterSet &ps)
 
 ~RPCEMapSourceHandler ()
 
- 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 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 ()
 

Private Member Functions

std::string IntToString (int num)
 

Private Attributes

cond::DbConnectionconnection
 
RPCEMapeMap
 
std::string m_authpath
 
std::string m_connect
 
int m_dummy
 
std::string m_name
 
int m_validate
 
cond::DbSessionsession
 

Additional Inherited Members

- Public Types inherited from popcon::PopConSourceHandler< RPCEMap >
typedef std::vector< TripletContainer
 
typedef std::vector< std::pair
< RPCEMap *, cond::Time_t > > 
OldContainer
 
typedef PopConSourceHandler
< RPCEMap
self
 
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)
 
- Protected Attributes inherited from popcon::PopConSourceHandler< RPCEMap >
OldContainer m_to_transfer
 
std::string m_userTextLog
 

Detailed Description

Definition at line 46 of file RPCEMapSourceHandler.h.

Constructor & Destructor Documentation

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

Definition at line 6 of file RPCEMapSourceHandler.cc.

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

Definition at line 15 of file RPCEMapSourceHandler.cc.

16 {
17 }

Member Function Documentation

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

Definition at line 381 of file RPCEMapSourceHandler.cc.

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

381  {
382  Ref map1 = _map1;
383  RPCReadOutMapping const* oldmap1 = map1->convert();
384  RPCReadOutMapping const* oldmap2 = map2->convert();
385  std::vector<const DccSpec *> dccs1 = oldmap1->dccList();
386  std::vector<const DccSpec *> dccs2 = oldmap2->dccList();
387  if(dccs1.size()!=dccs2.size()) {
388  return 1;
389  }
390  std::pair<int,int> dccRange1 = oldmap1->dccNumberRange();
391  std::pair<int,int> dccRange2 = oldmap2->dccNumberRange();
392  if(dccRange1.first!=dccRange2.first) {
393  return 1;
394  }
395  if(dccRange1.second!=dccRange2.second) {
396  return 1;
397  }
398  typedef std::vector<const DccSpec *>::const_iterator IDCC;
399  IDCC idcc2 = dccs2.begin();
400  for (IDCC idcc1 = dccs1.begin(); idcc1 != dccs1.end(); idcc1++) {
401  int dccNo = (**idcc1).id();
402  std::string dccContents = (**idcc1).print(4);
403  if ((**idcc2).id()!=dccNo) {
404  return 1;
405  }
406  if ((**idcc2).print(4)!=dccContents) {
407  return 1;
408  }
409  idcc2++;
410  }
411  return 0;
412 }
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 65 of file RPCEMapSourceHandler.cc.

References gather_cfg::cout, and python.CommonUtils::session.

66 {
67  std::cout << "RPCEMapConfigSourceHandler: connecting to " << connect << "..." << std::flush;
69 // session->configuration().setAuthenticationMethod(cond::XML);
73  session->open(connect,true) ;
74  std::cout << "Done." << std::endl;
75 }
void open(const std::string &connectionString, bool readOnly=false)
Definition: DbSession.cc:159
DbConnectionConfiguration & configuration()
Definition: DbConnection.cc:83
DbSession createSession() const
Definition: DbConnection.cc:66
void setAuthenticationPath(const std::string &p)
tuple cout
Definition: gather_cfg.py:121
void popcon::RPCEMapSourceHandler::DisconnectOnlineDB ( )

Definition at line 77 of file RPCEMapSourceHandler.cc.

References python.CommonUtils::session.

78 {
79  connection->close() ;
80  delete connection ;
81  session->close();
82  delete session ;
83 }
void popcon::RPCEMapSourceHandler::getNewObjects ( )
virtual

Implements popcon::PopConSourceHandler< RPCEMap >.

Definition at line 19 of file RPCEMapSourceHandler.cc.

References gather_cfg::cout, cond::service::PoolDBOutputService::currentTime(), plotBeamSpotDB::ptm, findQualityFiles::size, AlCaHLTBitMon_QueryRunRegistry::string, dumpRecoGeometry_cfg::tagInfo, and cond::rpcobgas::time.

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

Implements popcon::PopConSourceHandler< RPCEMap >.

Definition at line 53 of file RPCEMapSourceHandler.h.

References m_name.

53 {return m_name;}
std::string popcon::RPCEMapSourceHandler::IntToString ( int  num)
inlineprivate

Definition at line 70 of file RPCEMapSourceHandler.h.

71  {
72  std::stringstream snum;
73  snum << num << std::flush;
74  return(snum.str());
75  }
void popcon::RPCEMapSourceHandler::readEMap1 ( )

Definition at line 85 of file RPCEMapSourceHandler.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, popcon::RPCEMapSourceHandler::FEBStruct::chamberId, popcon::RPCEMapSourceHandler::FEBStruct::cmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::connectorId, gather_cfg::cout, popcon::RPCEMapSourceHandler::FEBStruct::febId, plotBeamSpotDB::first, i, popcon::RPCEMapSourceHandler::FEBStruct::lbInputNum, popcon::RPCEMapSourceHandler::FEBStruct::localEtaPart, RPCEMap::lbItem::nFebs, RPCEMap::linkItem::nLBs, RPCEMap::tbItem::nLinks, RPCEMap::dccItem::nTBs, popcon::RPCEMapSourceHandler::FEBStruct::posInCmsEtaPart, popcon::RPCEMapSourceHandler::FEBStruct::posInLocalEtaPart, python.IdGenerator::schema, python.CommonUtils::session, AlCaHLTBitMon_QueryRunRegistry::string, groupFilesInBlocks::temp, RPCEMap::febItem::theAlgo, RPCEMap::febItem::theChamber, RPCEMap::lbItem::theCode, RPCEMap::dccItem::theId, RPCEMap::febItem::theLinkBoardInputNum, RPCEMap::lbItem::theLinkBoardNumInLink, RPCEMap::lbItem::theMaster, RPCEMap::tbItem::theNum, RPCEMap::febItem::thePartition, and RPCEMap::linkItem::theTriggerBoardInputNumber.

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

Member Data Documentation

cond::DbConnection* popcon::RPCEMapSourceHandler::connection
private

Definition at line 62 of file RPCEMapSourceHandler.h.

RPCEMap* popcon::RPCEMapSourceHandler::eMap
private

Definition at line 60 of file RPCEMapSourceHandler.h.

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

Definition at line 67 of file RPCEMapSourceHandler.h.

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

Definition at line 66 of file RPCEMapSourceHandler.h.

int popcon::RPCEMapSourceHandler::m_dummy
private

Definition at line 64 of file RPCEMapSourceHandler.h.

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

Definition at line 63 of file RPCEMapSourceHandler.h.

Referenced by id().

int popcon::RPCEMapSourceHandler::m_validate
private

Definition at line 65 of file RPCEMapSourceHandler.h.

cond::DbSession* popcon::RPCEMapSourceHandler::session
private

Definition at line 61 of file RPCEMapSourceHandler.h.